-
Notifications
You must be signed in to change notification settings - Fork 156
fix(compile): emit and clean up copilot root instructions (#792) #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+593
−50
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
59c5136
fix(compile): emit and clean up copilot root instructions
WilliamK112 3f46ad8
feat(dogfood): adopt copilot root instructions compile path
danielmeppiel a51921e
docs(contributing): mirror CI Lint job pre-PR (ruff check + format --…
danielmeppiel ad75659
Merge branch 'main' into issue-792-copilot-root-instructions
danielmeppiel 78fe23a
chore(integration): regenerate .github/instructions/ after adding lin…
danielmeppiel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| description: "Lint contract: run BEFORE pushing or producing artifacts that claim green CI. Mirrors the CI Lint job." | ||
| --- | ||
|
|
||
| # Linting (canonical contract) | ||
|
|
||
| The CI `Lint` job is a hard gate. Mirror it locally before `git push` | ||
| and before producing any artifact (PR body, release note, audit | ||
| report) that claims CI is green. | ||
|
|
||
| ## CI-mirror commands | ||
|
|
||
| The `Lint` job runs: | ||
|
|
||
| - `uv run --extra dev ruff check src/ tests/` | ||
| - `uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Both must be silent. | ||
|
|
||
| ## Local workflow | ||
|
|
||
| - **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` | ||
| - **Apply formatter:** `uv run --extra dev ruff format src/ tests/` | ||
| - **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Always run the verify pair before `git push` -- the CI Lint job | ||
| fails on any remaining diagnostic. | ||
|
|
||
| ## Common surprises | ||
|
|
||
| - `RUF043` -- use `match=r"..."` for `pytest.raises` patterns with | ||
| regex metacharacters (`(`, `)`, `[`, etc.). | ||
| - `UP006` / `UP045` -- use `list` / `dict` / `X | None` instead of | ||
| `List` / `Dict` / `Optional`. | ||
| - `RUF100` -- drop stale `# noqa` directives. | ||
| - `F401` / `F841` -- remove unused imports / unused locals. | ||
| - `SIM103` -- inline negated returns where the body is one line. | ||
| - `I001` -- import sort order (auto-fixable). | ||
|
|
||
| ## Lifecycle binding | ||
|
|
||
| This is the canonical lint contract for the repo. Skills that | ||
| produce artifacts asserting green CI -- notably `pr-description-skill` | ||
| (whose "Validation evidence" row covers CI checks) -- inherit this | ||
| gate transitively. Do NOT redefine ruff commands inside individual | ||
| skills; honor this instruction before invoking them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,52 @@ | ||
| - This project uses uv to manage Python environments and dependencies. | ||
| - Use `uv sync` to create the virtual environment and install all dependencies automatically. | ||
| - Use `uv run <command>` to run commands in the uv-managed environment. | ||
| - For development dependencies, use `uv sync --extra dev`. | ||
| - **Running tests**: Use pytest via `uv run`. Prefer targeted test runs during development: | ||
| - **Targeted (fastest, use during iteration):** `uv run pytest tests/unit/path/to/relevant_test.py -x` | ||
| - **Unit suite (default validation):** `uv run pytest tests/unit tests/test_console.py -x` (~2,400 tests, matches CI) | ||
| - **Full suite (only before final commit):** `uv run pytest` | ||
| - When modifying a specific module, run only its corresponding test file(s) first. Run the full unit suite once as final validation before considering your work done. | ||
| - **Test coverage principle**: When modifying existing code, add tests for the code paths you touch, on top of tests for the new functionality. | ||
| - **Linting (run BEFORE pushing - CI gate fails otherwise)**: The `Lint` job runs `uv run --extra dev ruff check src/ tests/` AND `uv run --extra dev ruff format --check src/ tests/`. Mirror it locally: | ||
| - **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` | ||
| - **Apply formatter:** `uv run --extra dev ruff format src/ tests/` | ||
| - **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` | ||
| - Always run the verify pair before `git push` -- the CI Lint job fails on any remaining diagnostic. Common surprises: `RUF043` (use `match=r"..."` for regex with metacharacters), `UP006/UP045` (use `list`/`dict`/`X | None` instead of `List`/`Dict`/`Optional`), `RUF100` (drop stale `# noqa`), `F401`/`F841` (unused import / unused local). | ||
| - **Lifecycle binding**: this rule is the canonical lint contract for the repo. Any skill that produces an artifact claiming green CI -- notably `pr-description-skill` (whose "Validation evidence" row covers CI checks) -- inherits this gate transitively. Do NOT redefine ruff commands inside individual skills; honor this rule before invoking them. | ||
| - **Development Workflow**: To run APM from source while working in other directories: | ||
| - Install in development mode: `cd /path/to/awd-cli && uv run pip install -e .` | ||
| - Use absolute path: `/Users/danielmeppiel/Repos/awd-cli/.venv/bin/apm compile --verbose --dry-run` | ||
| - Or create alias: `alias apm-dev='/Users/danielmeppiel/Repos/awd-cli/.venv/bin/apm'` | ||
| - Changes to source code are immediately reflected (no reinstall needed) | ||
| - The solution must meet the functionality as explained in the [README.md](README.md) file. | ||
| - The general high-level basis to the solution is depicted in [APPROACH.md](../../APPROACH.md). | ||
| - When developing functionality, we need to respect our own [CONTRIBUTING.md](../../CONTRIBUTING.md) file. | ||
| The architectural decisions and basis for the project in that document are only the inspiring foundation. It can and should always be challenged when needed and is not meant as the only truth, but a very useful context and grounding research. | ||
| - The project is meant for the Open Source community and should be open to contributions and follow the standards of the community. | ||
| - The project is meant to be used by developers and should be easy to use, with a focus on developer experience. | ||
| - The philosophy when architecting and implementing the project is to prime speed and simplicity over complexity. Do NOT over-engineer, but rather build a solid foundation that can be iterated on. | ||
| - APM is an active OSS project under the `microsoft` org with a growing community (250+ stars, external contributors). Breaking changes should be communicated clearly (CHANGELOG.md), but we still favor shipping fast over lengthy deprecation cycles. | ||
| - The goal is to deliver a solid and scalable architecture but simple starting implementation. Not building something complex from the start and then having to simplify it later. Remember we are delivering a new tool to the developer community and we will need to rapidly adapt to what's really useful, evolving standards, etc. | ||
| - **Cross-platform encoding rule**: All source code and CLI output must stay within printable ASCII (U+0020–U+007E). Do NOT use emojis, Unicode symbols, box-drawing characters, em dashes, or any character outside the ASCII range in source files or CLI output strings. Use bracket notation for status symbols: `[+]` success, `[!]` warning, `[x]` error, `[i]` info, `[*]` action, `[>]` running. This is required to prevent `charmap` codec errors on Windows cp1252 terminals. | ||
| - **Path safety rule**: Any code that builds filesystem paths from user input or external data (marketplace names, plugin paths, lockfile entries, bundle contents) **must** use the centralized guards in `src/apm_cli/utils/path_security.py`. Use `validate_path_segments(value, context=)` at parse time to reject traversal sequences (`.`, `..`) with cross-platform backslash normalization, and `ensure_path_within(path, base_dir)` after resolution to assert containment (resolves symlinks). Never write ad-hoc `".." in x` checks. | ||
| - **Expert review panel**: For any non-trivial change (cross-cutting refactor, new CLI surface, dependency/auth/lockfile work, release or positioning decision), invoke the [APM Review Panel skill](skills/apm-review-panel/SKILL.md). It orchestrates seven personas (Python Architect, CLI Logging Expert, DevX UX Expert, Supply Chain Security Expert, APM CEO, OSS Growth Hacker) with explicit routing: specialists raise findings, the CEO arbitrates disagreements and strategic calls, the Growth Hacker side-channels conversion / `WIP/growth-strategy.md` insights to the CEO. Individual per-persona skills (`devx-ux`, `supply-chain-security`, `apm-strategy`, `oss-growth`) auto-activate on relevant edits even outside the panel. | ||
| <!-- Generated by APM CLI from .apm/ primitives --> | ||
| <!-- Build ID: 3a5991d7ca52 --> | ||
| <!-- APM Version: 0.11.0 --> | ||
|
|
||
| <!-- Source: .apm/instructions/linting.instructions.md --> | ||
| # Linting (canonical contract) | ||
|
|
||
| The CI `Lint` job is a hard gate. Mirror it locally before `git push` | ||
| and before producing any artifact (PR body, release note, audit | ||
| report) that claims CI is green. | ||
|
|
||
| ## CI-mirror commands | ||
|
|
||
| The `Lint` job runs: | ||
|
|
||
| - `uv run --extra dev ruff check src/ tests/` | ||
| - `uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Both must be silent. | ||
|
|
||
| ## Local workflow | ||
|
|
||
| - **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` | ||
| - **Apply formatter:** `uv run --extra dev ruff format src/ tests/` | ||
| - **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Always run the verify pair before `git push` -- the CI Lint job | ||
| fails on any remaining diagnostic. | ||
|
|
||
| ## Common surprises | ||
|
|
||
| - `RUF043` -- use `match=r"..."` for `pytest.raises` patterns with | ||
| regex metacharacters (`(`, `)`, `[`, etc.). | ||
| - `UP006` / `UP045` -- use `list` / `dict` / `X | None` instead of | ||
| `List` / `Dict` / `Optional`. | ||
| - `RUF100` -- drop stale `# noqa` directives. | ||
| - `F401` / `F841` -- remove unused imports / unused locals. | ||
| - `SIM103` -- inline negated returns where the body is one line. | ||
| - `I001` -- import sort order (auto-fixable). | ||
|
|
||
| ## Lifecycle binding | ||
|
|
||
| This is the canonical lint contract for the repo. Skills that | ||
| produce artifacts asserting green CI -- notably `pr-description-skill` | ||
| (whose "Validation evidence" row covers CI checks) -- inherit this | ||
| gate transitively. Do NOT redefine ruff commands inside individual | ||
| skills; honor this instruction before invoking them. | ||
| <!-- End source: .apm/instructions/linting.instructions.md --> | ||
|
|
||
| --- | ||
| *This file was generated by APM CLI. Do not edit manually.* | ||
| *To regenerate: `specify apm compile`* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| description: "Lint contract: run BEFORE pushing or producing artifacts that claim green CI. Mirrors the CI Lint job." | ||
| --- | ||
|
|
||
| # Linting (canonical contract) | ||
|
|
||
| The CI `Lint` job is a hard gate. Mirror it locally before `git push` | ||
| and before producing any artifact (PR body, release note, audit | ||
| report) that claims CI is green. | ||
|
|
||
| ## CI-mirror commands | ||
|
|
||
| The `Lint` job runs: | ||
|
|
||
| - `uv run --extra dev ruff check src/ tests/` | ||
| - `uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Both must be silent. | ||
|
|
||
| ## Local workflow | ||
|
|
||
| - **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` | ||
| - **Apply formatter:** `uv run --extra dev ruff format src/ tests/` | ||
| - **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` | ||
|
|
||
| Always run the verify pair before `git push` -- the CI Lint job | ||
| fails on any remaining diagnostic. | ||
|
|
||
| ## Common surprises | ||
|
|
||
| - `RUF043` -- use `match=r"..."` for `pytest.raises` patterns with | ||
| regex metacharacters (`(`, `)`, `[`, etc.). | ||
| - `UP006` / `UP045` -- use `list` / `dict` / `X | None` instead of | ||
| `List` / `Dict` / `Optional`. | ||
| - `RUF100` -- drop stale `# noqa` directives. | ||
| - `F401` / `F841` -- remove unused imports / unused locals. | ||
| - `SIM103` -- inline negated returns where the body is one line. | ||
| - `I001` -- import sort order (auto-fixable). | ||
|
|
||
| ## Lifecycle binding | ||
|
|
||
| This is the canonical lint contract for the repo. Skills that | ||
| produce artifacts asserting green CI -- notably `pr-description-skill` | ||
| (whose "Validation evidence" row covers CI checks) -- inherit this | ||
| gate transitively. Do NOT redefine ruff commands inside individual | ||
| skills; honor this instruction before invoking them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -216,8 +216,7 @@ Run these steps in order. Tick each before moving on. | |||||
| 1. [ ] Confirm every row of the activation contract is filled in. | ||||||
| Defense-in-depth gate: before drafting the body, confirm the | ||||||
| repo's lint contract is green (canonical commands and lifecycle | ||||||
| binding live in the project's `copilot-instructions.md` Linting | ||||||
| block - do NOT inline or restate them here). If lint is red, | ||||||
| binding live in `.apm/instructions/linting.instructions.md`). If lint is red, | ||||||
|
||||||
| binding live in `.apm/instructions/linting.instructions.md`). If lint is red, | |
| binding lives in `.apm/instructions/linting.instructions.md`. If lint is red, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue here:
binding live in.apm/instructions/linting.instructions.md).has an unmatched closing parenthesis. Remove the stray)so the instruction reads cleanly.