Skip to content

Comments

feat: Phase 1 — src/ layout migration, pyproject.toml fixes, CI/CD, entry points#5

Merged
nsalvacao merged 7 commits intomainfrom
001-cli-plugins-base
Feb 13, 2026
Merged

feat: Phase 1 — src/ layout migration, pyproject.toml fixes, CI/CD, entry points#5
nsalvacao merged 7 commits intomainfrom
001-cli-plugins-base

Conversation

@nsalvacao
Copy link
Owner

Phase 1: Setup + Pre-Launch Blockers

Tasks Completed (T001-T005, T032, T038, T039, T066)

  • T001: Migrate crawler/src/crawler/ via git mv (preserves history)
  • T002/T038: Fix pyproject.toml — classifiers, readme path, [build-system] with hatchling, explicit packages
  • T039: Register cli-crawler and generate-plugin entry points with argparse + --version
  • T003-T005: Configure config.yaml, ruff linting, pytest markers
  • T032: CI/CD pipeline (.github/workflows/ci.yml) — Python 3.11/3.12 matrix + lint job
  • T066: --version flag on both entry points via importlib.metadata

Pre-existing Bugs Fixed

  • UnicodeDecodeError on Windows in load_cli_map and test_pipeline (missing encoding='utf-8')
  • Import path in test_generate_plugin.py updated for new package structure

Real-World Smoke Test

  • cli-crawler ruff → 12 commands, 127 flags, 0.4s ✅
  • generate-plugin output/ruff.json → 6 plugin files generated ✅
  • New plugin: plugins/cli-ruff/

Verification

  • pip install -e '.[dev]'
  • pytest tests/100/100 passed
  • cli-crawler --versioncli-crawler 0.1.0
  • generate-plugin --versiongenerate-plugin 0.1.0

@gemini-code-assist
Copy link

Summary of Changes

Hello @nsalvacao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents 'Phase 1' of project setup and pre-launch blockers, primarily focusing on modernizing the project's structure and build process. It involves migrating the main application logic into a src/ directory, refining the pyproject.toml for better packaging and dependency management, and establishing proper CLI entry points. Additionally, it sets up robust development tooling with pytest markers and ruff linting, and includes a new example plugin to demonstrate the system's capabilities. The changes aim to improve maintainability, developer experience, and cross-platform compatibility.

Highlights

  • Project Structure Migration: Migrated the core crawler/ directory and its contents to src/crawler/ to align with modern Python packaging standards, preserving file history.
  • Improved Build and Packaging Configuration: Updated pyproject.toml to use hatchling for the build system, adjusted the readme path, and explicitly defined packages for wheel builds. Project URLs were also moved to the [project.urls] section.
  • CLI Entry Point Registration: Registered cli-crawler and generate-plugin as console scripts, enabling direct execution from the command line. Both entry points now support a --version flag using importlib.metadata.
  • Development Tooling Enhancements: Configured pytest with specific markers for different test types (unit, integration, e2e, performance) and integrated ruff for linting with a defined target Python version, line length, and specific linting rules.
  • Cross-Platform Compatibility Fixes: Resolved UnicodeDecodeError issues on Windows by explicitly specifying encoding='utf-8' when opening files in plugin_generator.py and test_pipeline_integration.py.
  • New Example Plugin Added: Introduced a new example plugin for the ruff CLI, including its metadata, a scan-cli command, a rescan script, and detailed skill and command reference documentation.
Changelog
  • plugins/cli-ruff/.claude-plugin/plugin.json
    • Added plugin metadata for the new cli-ruff example plugin.
  • plugins/cli-ruff/commands/scan-cli.md
    • Added documentation for the scan-cli command, explaining how to re-scan the ruff CLI and regenerate plugin files.
  • plugins/cli-ruff/scripts/rescan.sh
    • Added a new bash script to automate the re-scanning of the ruff CLI and regeneration of its plugin files.
  • plugins/cli-ruff/skills/cli-ruff/SKILL.md
    • Added the main skill definition for the cli-ruff plugin, detailing its purpose, commands, flags, and usage.
  • plugins/cli-ruff/skills/cli-ruff/references/commands.md
    • Added a comprehensive command reference for the ruff CLI, including global flags, command groups, and individual commands with their respective flags.
  • plugins/cli-ruff/skills/cli-ruff/references/examples.md
    • Added an empty placeholder file for ruff CLI usage examples.
  • pyproject.toml
    • Added [build-system] configuration to use hatchling as the build backend.
    • Updated the readme path from docs/README.md to README.md.
    • Removed old [project.urls] section and re-added it after classifiers.
    • Updated cli-crawler entry point to point to crawler.pipeline:main.
    • Added generate-plugin entry point pointing to generator.plugin_generator:main.
    • Added [tool.hatch.build.targets.wheel] configuration to specify src as the source directory and explicitly list packages.
    • Updated dev optional dependency group to include ruff>=0.9.0.
    • Added pytest markers for unit, integration, e2e, and performance tests.
    • Added [tool.ruff] configuration for target Python version, line length, source directories, linting rules, and isort settings.
  • src/config/init.py
    • Added an __init__.py file to define the src/config directory as a Python package.
  • src/crawler/init.py
    • Renamed crawler/__init__.py to src/crawler/__init__.py.
  • src/crawler/config.py
    • Renamed crawler/config.py to src/crawler/config.py.
  • src/crawler/detector.py
    • Renamed crawler/detector.py to src/crawler/detector.py.
  • src/crawler/discovery.py
    • Renamed crawler/discovery.py to src/crawler/discovery.py.
  • src/crawler/executor.py
    • Renamed crawler/executor.py to src/crawler/executor.py.
  • src/crawler/formatter.py
    • Renamed crawler/formatter.py to src/crawler/formatter.py.
  • src/crawler/models.py
    • Renamed crawler/models.py to src/crawler/models.py.
  • src/crawler/parser.py
    • Renamed crawler/parser.py to src/crawler/parser.py.
  • src/crawler/parsers/init.py
    • Renamed crawler/parsers/__init__.py to src/crawler/parsers/__init__.py.
  • src/crawler/parsers/commands.py
    • Renamed crawler/parsers/commands.py to src/crawler/parsers/commands.py.
  • src/crawler/parsers/envvars.py
    • Renamed crawler/parsers/envvars.py to src/crawler/parsers/envvars.py.
  • src/crawler/parsers/examples.py
    • Renamed crawler/parsers/examples.py to src/crawler/parsers/examples.py.
  • src/crawler/parsers/flags.py
    • Renamed crawler/parsers/flags.py to src/crawler/parsers/flags.py.
  • src/crawler/parsers/manpage.py
    • Renamed crawler/parsers/manpage.py to src/crawler/parsers/manpage.py.
  • src/crawler/parsers/sections.py
    • Renamed crawler/parsers/sections.py to src/crawler/parsers/sections.py.
  • src/crawler/parsers/usage.py
    • Renamed crawler/parsers/usage.py to src/crawler/parsers/usage.py.
  • src/crawler/pipeline.py
    • Renamed crawler/pipeline.py to src/crawler/pipeline.py.
    • Added main function to serve as the CLI entry point for cli-crawler.
    • Implemented --version flag using importlib.metadata for the cli-crawler entry point.
  • src/crawler/version.py
    • Renamed crawler/version.py to src/crawler/version.py.
  • src/generator/init.py
    • Added an __init__.py file to define the src/generator directory as a Python package.
  • src/generator/plugin_generator.py
    • Renamed scripts/generate_plugin.py to src/generator/plugin_generator.py.
    • Added encoding='utf-8' to path.open() call in load_cli_map to prevent UnicodeDecodeError.
    • Added main function to serve as the CLI entry point for generate-plugin.
    • Implemented --version flag using importlib.metadata for the generate-plugin entry point.
  • src/lib/init.py
    • Added an __init__.py file to define the src/lib directory as a Python package.
  • tests/test_generate_plugin.py
    • Updated the module import path for plugin_generator to reflect its new location in src/generator.
    • Removed the sys.path.insert line, as it's no longer needed with the updated package structure.
  • tests/test_pipeline_integration.py
    • Added encoding='utf-8' to f.read_text() call to prevent UnicodeDecodeError when loading JSON files.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly refactors the project by migrating to a src/ layout, modernizing pyproject.toml with hatchling, and introducing proper CLI entry points, alongside adding a CI/CD pipeline and ruff linting for improved quality. However, critical security vulnerabilities were identified, specifically OS command injection risks on Windows due to unsafe PowerShell command construction and path traversal vulnerabilities in the crawler output and plugin generator, arising from user-supplied CLI names and external JSON map data. General code issues also include a critical problem in a generated script using outdated file paths, minor issues in generated documentation, a configuration mistake in pyproject.toml, and style improvements for local imports in new entry point functions. Addressing these security and general code concerns is crucial to ensure the new structure is consistently and securely implemented.

@nsalvacao nsalvacao force-pushed the 001-cli-plugins-base branch from f0dd507 to 1678fec Compare February 13, 2026 14:51
…ntry points

Phase 1: Setup + Pre-Launch Blockers complete (T001-T005, T032, T038, T039, T066)

Changes:
- Migrate crawler/ → src/crawler/ via git mv (preserves history)
- Migrate scripts/generate_plugin.py → src/generator/plugin_generator.py
- Fix pyproject.toml: classifiers, readme path, add [build-system] with hatchling
- Add hatch.build.targets.wheel config for src/ layout with explicit packages
- Register cli-crawler and generate-plugin entry points with argparse + --version
- Configure ruff linting and pytest markers in pyproject.toml
- Create CI/CD pipeline (.github/workflows/ci.yml) with Python 3.11/3.12 matrix
- Fix pre-existing UnicodeDecodeError in load_cli_map and test_pipeline (Windows)
- Fix test_generate_plugin.py import path for new package structure
- Add real-world smoke test: ruff CLI → CLIMap JSON → Plugin (12 cmds, 127 flags)

Verification: 100/100 tests pass, cli-crawler 0.1.0, generate-plugin 0.1.0
@nsalvacao nsalvacao force-pushed the 001-cli-plugins-base branch from 1678fec to 2c2fec5 Compare February 13, 2026 14:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Phase-1 groundwork for the cli-plugins project: migrates core code into a src/ layout, formalizes packaging/entry points, expands parsers and pipeline CLI behavior, and adds CI plus spec-kit scaffolding/docs to support spec-driven development.

Changes:

  • Introduces src/ package structure for crawler/ and generator/, with new CLI entry points (cli-crawler, generate-plugin) and --version.
  • Improves cross-platform robustness (UTF-8 file reads) and parser/pipeline refactors (typing updates, new usage/version parsing).
  • Adds CI workflow and spec-kit templates/scripts/docs plus a sample generated plugin (plugins/cli-ruff/).

Reviewed changes

Copilot reviewed 103 out of 109 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_pipeline_integration.py Fixes JSON reading to use UTF-8; minor formatting cleanup.
tests/test_parser_sections.py Import ordering + formatting adjustments for readability.
tests/test_parser_flags.py Import ordering + minor formatting; extra blank lines for clarity.
tests/test_parser_commands.py Minor import ordering/formatting.
tests/test_generate_plugin.py Updates imports for new module layout; skips when gitignored inputs absent.
tests/conftest.py Import ordering cleanup.
tests/capture_fixtures.py Formats subprocess.run args more readably (keeps UTF-8).
src/lib/init.py Adds lib package marker/docstring.
src/generator/init.py Adds generator package marker/docstring.
src/generator/plugin_generator.py Updates typing import, UTF-8 JSON load, adds CLI --version, misc formatting.
src/crawler/init.py Adds crawler package marker/docstring.
src/crawler/version.py Adds version detection/parsing helper.
src/crawler/pipeline.py Adds cli-crawler CLI entrypoint + refactors/typing updates; uses UTC timestamps.
src/crawler/parsers/init.py Adds parsers package marker/docstring.
src/crawler/parsers/usage.py Adds usage extraction helper.
src/crawler/parsers/sections.py Refactors typing + formatting; keeps section segmentation logic.
src/crawler/parsers/manpage.py Formatting/refactor of regex/constants + Flag construction formatting.
src/crawler/parsers/flags.py Typing modernization + formatting; minor logic refactor in _build_flag.
src/crawler/parsers/examples.py Formatting-only change to long condition.
src/crawler/parsers/envvars.py Regex formatting simplification.
src/crawler/parsers/commands.py Typing modernization + formatting; no functional changes apparent.
src/crawler/parser.py Import ordering + formatting; minor formatting in logging and args parsing.
src/crawler/models.py Typing modernization (PEP 604 unions).
src/crawler/formatter.py Import ordering + formatting of serialization expressions.
src/crawler/executor.py Typing modernization + formatting of PowerShell command building.
src/crawler/discovery.py Formatting + typing modernization; no functional changes apparent.
src/crawler/detector.py Import ordering + formatting of ExecutionResult construction.
src/crawler/config.py Typing modernization + formatting in scalar parsing condition.
src/config/init.py Adds config package marker/docstring.
specs/001-cli-plugins-base/spec.md Adds Phase 1 spec doc for project goals/requirements.
specs/001-cli-plugins-base/research.md Adds research summary (none required).
specs/001-cli-plugins-base/quickstart.md Adds quickstart doc (setup/run/test guidance).
specs/001-cli-plugins-base/plan.md Adds implementation plan doc (structure + constraints).
specs/001-cli-plugins-base/data-model.md Adds data model doc (entities + rules).
specs/001-cli-plugins-base/contracts/plugin-contract.md Adds plugin contract doc.
specs/001-cli-plugins-base/checklists/requirements.md Adds spec-quality checklist.
pyproject.toml Adds hatchling build-system, scripts entry points, Ruff/Pytest config, dev extras.
plugins/cli-ruff/.claude-plugin/plugin.json Adds sample generated plugin metadata for ruff.
plugins/cli-ruff/skills/cli-ruff/SKILL.md Adds generated skill file for ruff.
plugins/cli-ruff/skills/cli-ruff/references/examples.md Adds generated examples placeholder for ruff.
plugins/cli-ruff/commands/scan-cli.md Adds generated scan command for ruff plugin.
plugins/cli-ruff/scripts/rescan.sh Adds generated rescan wrapper script for ruff plugin.
.vscode/settings.json Adds chat prompt/tool auto-approve configuration.
.specify/templates/vision-brief-template.md Adds spec-kit template.
.specify/templates/tasks-template.md Adds spec-kit template.
.specify/templates/spec-template.md Adds spec-kit template.
.specify/templates/plan-template.md Adds spec-kit template.
.specify/templates/ideas-backlog-template.md Adds spec-kit template.
.specify/templates/idea-selection-template.md Adds spec-kit template.
.specify/templates/g0-validation-report-template.md Adds spec-kit template.
.specify/templates/checklist-template.md Adds spec-kit template.
.specify/templates/ai-vision-canvas-template.md Adds spec-kit template.
.specify/templates/agent-file-template.md Adds spec-kit template.
.specify/scripts/bash/validate-scamper.sh Adds spec-kit validator script.
.specify/scripts/bash/validate-g0.sh Adds spec-kit validator script.
.specify/scripts/bash/validate-canvas.sh Adds spec-kit validator script.
.specify/scripts/bash/validate-airice.sh Adds spec-kit validator script.
.specify/scripts/bash/test-e2e-validate.sh Adds spec-kit E2E test script.
.specify/scripts/bash/test-e2e-structure.sh Adds spec-kit E2E test script.
.specify/scripts/bash/test-e2e-select.sh Adds spec-kit E2E test script.
.specify/scripts/bash/test-e2e-phase0.sh Adds spec-kit E2E driver script.
.specify/scripts/bash/test-e2e-ideate.sh Adds spec-kit E2E test script.
.specify/scripts/bash/sync-upstream.sh Adds upstream-sync helper.
.specify/scripts/bash/state-update.sh Adds state update helper.
.specify/scripts/bash/state-reconstruct.sh Adds state reconstruction helper.
.specify/scripts/bash/state-log-violation.sh Adds state logging helper.
.specify/scripts/bash/state-init.sh Adds state init helper.
.specify/scripts/bash/state-check.sh Adds state check helper.
.specify/scripts/bash/setup-plan.sh Adds plan setup helper.
.specify/scripts/bash/common.sh Adds shared helper functions.
.specify/scripts/bash/check-prerequisites.sh Adds consolidated prerequisites checker.
.specify/memory/constitution.md Adds project constitution doc.
.repo-audit-2026-02-12.md Adds repo audit report.
.gitignore Adds ignores for local files and Node artifacts.
.github/workflows/ci.yml Adds CI matrix + lint job.
.github/prompts/speckit.validate.prompt.md Adds prompt stub.
.github/prompts/speckit.taskstoissues.prompt.md Adds prompt stub.
.github/prompts/speckit.tasks.prompt.md Adds prompt stub.
.github/prompts/speckit.structure.prompt.md Adds prompt stub.
.github/prompts/speckit.specify.prompt.md Adds prompt stub.
.github/prompts/speckit.select.prompt.md Adds prompt stub.
.github/prompts/speckit.plan.prompt.md Adds prompt stub.
.github/prompts/speckit.implement.prompt.md Adds prompt stub.
.github/prompts/speckit.ideate.prompt.md Adds prompt stub.
.github/prompts/speckit.constitution.prompt.md Adds prompt stub.
.github/prompts/speckit.clarify.prompt.md Adds prompt stub.
.github/prompts/speckit.checklist.prompt.md Adds prompt stub.
.github/prompts/speckit.analyze.prompt.md Adds prompt stub.
.github/agents/speckit.validate.agent.md Adds agent workflow doc.
.github/agents/speckit.taskstoissues.agent.md Adds agent workflow doc.
.github/agents/speckit.tasks.agent.md Adds agent workflow doc.
.github/agents/speckit.structure.agent.md Adds agent workflow doc.
.github/agents/speckit.specify.agent.md Adds agent workflow doc.
.github/agents/speckit.select.agent.md Adds agent workflow doc.
.github/agents/speckit.plan.agent.md Adds agent workflow doc.
.github/agents/speckit.implement.agent.md Adds agent workflow doc.
.github/agents/speckit.ideate.agent.md Adds agent workflow doc.
.github/agents/speckit.constitution.agent.md Adds agent workflow doc.
.github/agents/speckit.clarify.agent.md Adds agent workflow doc.
.github/agents/speckit.analyze.agent.md Adds agent workflow doc.
.agent/workflows/verify-and-ship.md Adds local workflow doc.
.agent/workflows/smoke-test.md Adds local workflow doc.
.agent/workflows/push-pr.md Adds local workflow doc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nsalvacao nsalvacao merged commit a88d708 into main Feb 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant