Commit 1d8e25e
Christian Kaman
install-rules: write to docs, constitution, and agent context file
The install-rules command previously wrote a single docs file that
the AI agent could safely ignore. Change it to also update the
spec-kit constitution and the agent-specific system context file so
the rules become binding at runtime for whichever agent the user
initialized the project with.
- scripts/bash/install-rules.sh: new helper that performs all three
writes. Parses .specify/init-options.json for the agent id and
project name. Maps agent ids to their native context files
(CLAUDE.md, AGENTS.md, .cursorrules, .windsurfrules, GEMINI.md,
.github/copilot-instructions.md). Defaults to AGENTS.md for any
unknown agent so the emerging cross-agent convention still works.
Supports --docs, --project-name, and --force flags. Backs up the
full docs file before replacement. Appends the short rules block
to the constitution and agent context file idempotently — skips
if the section already exists, unless --force.
- commands/install-rules.md: rewrite the Context and Steps sections
to reflect the three-target design. Adds a script reference in
the frontmatter and documents the agent-to-file mapping, the
--force semantics, and the safety rules.
- tests/install-rules/writes-three-targets.sh: fixture with a claude
init, asserts docs/DEVELOPMENT-RULES.md exists with project name
substituted, constitution contains the Development Rules section,
CLAUDE.md is written with the agent-specific block, and the
summary output mentions the detected agent.
- tests/install-rules/agent-fallback.sh: fixture with no
.specify/init-options.json at all. Installer defaults to generic +
AGENTS.md, creates the constitution from scratch, and still
substitutes a project name passed via --project-name.
- tests/install-rules/idempotent-append.sh: runs the installer
twice, asserts the constitution and AGENTS.md each contain exactly
one "## Development Rules" heading, and the second run prints
"skipped" for both append targets.
- extension.yml: version bumped to 0.2.2.
- README.md: version badge and verify block updated to 0.2.2.
- CHANGELOG.md: 0.2.2 entry documenting the three-target change and
the new helper script, with full per-agent mapping.
Test suite is now 8 tests (was 5). All pass on macOS.1 parent 0cd824c commit 1d8e25e
8 files changed
Lines changed: 463 additions & 57 deletions
File tree
- commands
- scripts/bash
- tests/install-rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
6 | 47 | | |
7 | 48 | | |
8 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
26 | | - | |
| 33 | + | |
27 | 34 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | | - | |
38 | | - | |
| 45 | + | |
39 | 46 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 47 | + | |
43 | 48 | | |
44 | | - | |
45 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | | - | |
48 | | - | |
| 54 | + | |
49 | 55 | | |
50 | | - | |
51 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
52 | 62 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 63 | + | |
57 | 64 | | |
58 | | - | |
59 | | - | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
62 | 76 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
0 commit comments