|
| 1 | +--- |
| 2 | +name: cmsis-pack-guard |
| 3 | +description: Use when generating or repairing the CMSIS-Pack for this repository, or before editing `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, `cmsis-pack/*`, or pack-related GitHub Actions. Apply this skill when changing pack component layers, file inclusion scope, workflow triggers, or the release pipeline, and enforce the rule that the pack only describes tracked `HEAD` files unless the user explicitly asks for working-tree content. |
| 4 | +--- |
| 5 | + |
| 6 | +# CMSIS Pack Guard |
| 7 | + |
| 8 | +Apply this skill before changing the CMSIS-Pack definition or generation flow in this repository. |
| 9 | + |
| 10 | +## Scope |
| 11 | + |
| 12 | +Treat these as the canonical pack files: |
| 13 | + |
| 14 | +- `fool_cat.fc_embed.pdsc` |
| 15 | +- `gen_pack.sh` |
| 16 | +- `cmsis-pack/README.md` |
| 17 | +- `cmsis-pack/*.pack` |
| 18 | +- `.github/workflows/cmake-single-platform.yml` |
| 19 | +- `.github/workflows/publish-pack.yml` |
| 20 | + |
| 21 | +Also inspect the tracked module tree under: |
| 22 | + |
| 23 | +- `core/` |
| 24 | +- `device/` |
| 25 | + |
| 26 | +## Required Start Checks |
| 27 | + |
| 28 | +Run these before editing pack files: |
| 29 | + |
| 30 | +```powershell |
| 31 | +git status --short |
| 32 | +git ls-tree -r --name-only HEAD |
| 33 | +Get-Content fool_cat.fc_embed.pdsc |
| 34 | +Get-Content gen_pack.sh |
| 35 | +Get-Content .github/workflows/cmake-single-platform.yml |
| 36 | +Get-Content .github/workflows/publish-pack.yml |
| 37 | +``` |
| 38 | + |
| 39 | +Use `rg` to confirm component names and dependencies from real code, not from memory: |
| 40 | + |
| 41 | +```powershell |
| 42 | +rg -n '#include "fc_[^"]+"' core device |
| 43 | +``` |
| 44 | + |
| 45 | +## Core Rules |
| 46 | + |
| 47 | +1. Treat the PDSC component list as a released pack contract, not a scratch view of the current worktree. |
| 48 | +2. Only add modules to the pack when their files are tracked in `HEAD`. |
| 49 | +3. Do not add ignored or untracked `device/` or `core/` files to `fool_cat.fc_embed.pdsc`. |
| 50 | +4. When the repo contains uncommitted module work, keep the official pack scoped to tracked files unless the user explicitly asks for working-tree packaging. |
| 51 | +5. Keep `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, and pack-related workflows aligned in the same change. |
| 52 | +6. If a new top-level directory is added to the pack, restrict the generated pack to tracked files. Do not rely on whole-directory copy alone. |
| 53 | +7. Use CMSIS component layering with: |
| 54 | + - `Cgroup` for the major repository layer such as `core` or `device` |
| 55 | + - `Csub` for the concrete module such as `log`, `fifo`, or `sig` |
| 56 | +8. Derive `<require ...>` relations from actual header or source dependencies before editing conditions. |
| 57 | +9. Keep generated `.pack` artifacts under `cmsis-pack/`. |
| 58 | +10. If a workflow commits generated pack files, make sure at least one trigger path can actually reach that commit step. |
| 59 | + |
| 60 | +## Repository-Specific Baseline |
| 61 | + |
| 62 | +As of the current tracked tree, the official pack baseline is: |
| 63 | + |
| 64 | +- `core`: `fc_auto_init`, `fc_fifo`, `fc_pool`, `fc_port`, `fc_trans`, `fc_stdio`, `fc_log` |
| 65 | +- `device`: `fc_type`, `fc_sig`, `fc_sig_filter`, `fc_stp_base`, `fc_stp_curve` |
| 66 | + |
| 67 | +Files that exist only in the working tree must stay out of the official pack until they are committed. |
| 68 | + |
| 69 | +## Standard Workflow |
| 70 | + |
| 71 | +1. Inspect `git status --short` and `git ls-tree -r --name-only HEAD`. |
| 72 | +2. Build the allowed pack component set from tracked `core/` and `device/` files only. |
| 73 | +3. Update `fool_cat.fc_embed.pdsc` so component layering and conditions match the tracked code. |
| 74 | +4. Update `gen_pack.sh` if pack directory scope or file pruning needs to change. |
| 75 | +5. Review pack workflows and fix any trigger or commit path that became inconsistent with the generation flow. |
| 76 | +6. Validate XML syntax and verify the pack scope when feasible. |
| 77 | + |
| 78 | +## Recommended Verification Commands |
| 79 | + |
| 80 | +PowerShell: |
| 81 | + |
| 82 | +```powershell |
| 83 | +git status --short |
| 84 | +git ls-tree -r --name-only HEAD | rg "^(core|device|\\.github/workflows|cmsis-pack|gen_pack\\.sh|fool_cat\\.fc_embed\\.pdsc)" |
| 85 | +python -c "import xml.etree.ElementTree as ET; ET.parse('fool_cat.fc_embed.pdsc')" |
| 86 | +``` |
| 87 | + |
| 88 | +If a local Linux or WSL pack build is available: |
| 89 | + |
| 90 | +```powershell |
| 91 | +wsl.exe bash -lc "cd /mnt/d/GitHub_Clone/fc_embed && ./gen_pack.sh" |
| 92 | +``` |
| 93 | + |
| 94 | +If a `.pack` file is regenerated, inspect its contents: |
| 95 | + |
| 96 | +```powershell |
| 97 | +Expand-Archive -Path cmsis-pack/fool_cat.fc_embed.1.0.0.pack -DestinationPath $env:TEMP\\fc_embed_pack_check -Force |
| 98 | +Get-ChildItem -Recurse -File $env:TEMP\\fc_embed_pack_check |
| 99 | +``` |
| 100 | + |
| 101 | +## Final Report Checklist |
| 102 | + |
| 103 | +State explicitly: |
| 104 | + |
| 105 | +- whether the pack scope was limited to tracked `HEAD` files |
| 106 | +- whether untracked `core/` or `device/` files were excluded |
| 107 | +- whether `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, and workflows were kept in sync |
| 108 | +- whether XML or pack generation was validated locally, and how |
0 commit comments