|
1 | | -- This project uses uv to manage Python environments and dependencies. |
2 | | - - Use `uv sync` to create the virtual environment and install all dependencies automatically. |
3 | | - - Use `uv run <command>` to run commands in the uv-managed environment. |
4 | | - - For development dependencies, use `uv sync --extra dev`. |
5 | | -- **Running tests**: Use pytest via `uv run`. Prefer targeted test runs during development: |
6 | | - - **Targeted (fastest, use during iteration):** `uv run pytest tests/unit/path/to/relevant_test.py -x` |
7 | | - - **Unit suite (default validation):** `uv run pytest tests/unit tests/test_console.py -x` (~2,400 tests, matches CI) |
8 | | - - **Full suite (only before final commit):** `uv run pytest` |
9 | | - - 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. |
10 | | -- **Test coverage principle**: When modifying existing code, add tests for the code paths you touch, on top of tests for the new functionality. |
11 | | -- **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: |
12 | | - - **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` |
13 | | - - **Apply formatter:** `uv run --extra dev ruff format src/ tests/` |
14 | | - - **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` |
15 | | - - 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). |
16 | | - - **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. |
17 | | -- **Development Workflow**: To run APM from source while working in other directories: |
18 | | - - Install in development mode: `cd /path/to/awd-cli && uv run pip install -e .` |
19 | | - - Use absolute path: `/Users/danielmeppiel/Repos/awd-cli/.venv/bin/apm compile --verbose --dry-run` |
20 | | - - Or create alias: `alias apm-dev='/Users/danielmeppiel/Repos/awd-cli/.venv/bin/apm'` |
21 | | - - Changes to source code are immediately reflected (no reinstall needed) |
22 | | -- The solution must meet the functionality as explained in the [README.md](README.md) file. |
23 | | -- The general high-level basis to the solution is depicted in [APPROACH.md](../../APPROACH.md). |
24 | | -- When developing functionality, we need to respect our own [CONTRIBUTING.md](../../CONTRIBUTING.md) file. |
25 | | -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. |
26 | | -- The project is meant for the Open Source community and should be open to contributions and follow the standards of the community. |
27 | | -- The project is meant to be used by developers and should be easy to use, with a focus on developer experience. |
28 | | -- 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. |
29 | | -- 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. |
30 | | -- 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. |
31 | | -- **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. |
32 | | -- **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. |
33 | | -- **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. |
| 1 | +<!-- Generated by APM CLI from .apm/ primitives --> |
| 2 | +<!-- Build ID: 3a5991d7ca52 --> |
| 3 | +<!-- APM Version: 0.11.0 --> |
| 4 | + |
| 5 | +<!-- Source: .apm/instructions/linting.instructions.md --> |
| 6 | +# Linting (canonical contract) |
| 7 | + |
| 8 | +The CI `Lint` job is a hard gate. Mirror it locally before `git push` |
| 9 | +and before producing any artifact (PR body, release note, audit |
| 10 | +report) that claims CI is green. |
| 11 | + |
| 12 | +## CI-mirror commands |
| 13 | + |
| 14 | +The `Lint` job runs: |
| 15 | + |
| 16 | +- `uv run --extra dev ruff check src/ tests/` |
| 17 | +- `uv run --extra dev ruff format --check src/ tests/` |
| 18 | + |
| 19 | +Both must be silent. |
| 20 | + |
| 21 | +## Local workflow |
| 22 | + |
| 23 | +- **Auto-fix style+imports:** `uv run --extra dev ruff check src/ tests/ --fix` |
| 24 | +- **Apply formatter:** `uv run --extra dev ruff format src/ tests/` |
| 25 | +- **Verify (must be silent):** `uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/` |
| 26 | + |
| 27 | +Always run the verify pair before `git push` -- the CI Lint job |
| 28 | +fails on any remaining diagnostic. |
| 29 | + |
| 30 | +## Common surprises |
| 31 | + |
| 32 | +- `RUF043` -- use `match=r"..."` for `pytest.raises` patterns with |
| 33 | + regex metacharacters (`(`, `)`, `[`, etc.). |
| 34 | +- `UP006` / `UP045` -- use `list` / `dict` / `X | None` instead of |
| 35 | + `List` / `Dict` / `Optional`. |
| 36 | +- `RUF100` -- drop stale `# noqa` directives. |
| 37 | +- `F401` / `F841` -- remove unused imports / unused locals. |
| 38 | +- `SIM103` -- inline negated returns where the body is one line. |
| 39 | +- `I001` -- import sort order (auto-fixable). |
| 40 | + |
| 41 | +## Lifecycle binding |
| 42 | + |
| 43 | +This is the canonical lint contract for the repo. Skills that |
| 44 | +produce artifacts asserting green CI -- notably `pr-description-skill` |
| 45 | +(whose "Validation evidence" row covers CI checks) -- inherit this |
| 46 | +gate transitively. Do NOT redefine ruff commands inside individual |
| 47 | +skills; honor this instruction before invoking them. |
| 48 | +<!-- End source: .apm/instructions/linting.instructions.md --> |
| 49 | + |
| 50 | +--- |
| 51 | +*This file was generated by APM CLI. Do not edit manually.* |
| 52 | +*To regenerate: `specify apm compile`* |
0 commit comments