@meza/adr-tools 1.0.12 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.github/renovate.json +2 -1
  2. package/.github/workflows/ci-pr.yml +2 -25
  3. package/.github/workflows/ci.yml +12 -46
  4. package/.releaserc.json +18 -8
  5. package/AGENTS.engineer.md +236 -0
  6. package/AGENTS.md +11 -0
  7. package/AGENTS.reviewer.md +115 -0
  8. package/CONTRIBUTING.md +102 -0
  9. package/README.md +16 -4
  10. package/biome.json +18 -139
  11. package/dist/index.js +164 -81
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.test.js +189 -0
  14. package/dist/index.test.js.map +1 -0
  15. package/dist/inject-version.test.js +27 -0
  16. package/dist/inject-version.test.js.map +1 -0
  17. package/dist/lib/adr.js +132 -27
  18. package/dist/lib/adr.js.map +1 -1
  19. package/dist/lib/adr.test.js +308 -0
  20. package/dist/lib/adr.test.js.map +1 -0
  21. package/dist/lib/config.js +3 -2
  22. package/dist/lib/config.js.map +1 -1
  23. package/dist/lib/config.test.js +60 -0
  24. package/dist/lib/config.test.js.map +1 -0
  25. package/dist/lib/links.test.js +5 -4
  26. package/dist/lib/links.test.js.map +1 -1
  27. package/dist/lib/manipulator-errors.test.js +21 -0
  28. package/dist/lib/manipulator-errors.test.js.map +1 -0
  29. package/dist/lib/manipulator.test.js +21 -1
  30. package/dist/lib/manipulator.test.js.map +1 -1
  31. package/dist/lib/numbering.js +1 -1
  32. package/dist/lib/numbering.js.map +1 -1
  33. package/dist/lib/numbering.test.js +7 -0
  34. package/dist/lib/numbering.test.js.map +1 -1
  35. package/dist/lib/opening.test.js +81 -0
  36. package/dist/lib/opening.test.js.map +1 -0
  37. package/dist/lib/prompt.js +1 -1
  38. package/dist/lib/prompt.js.map +1 -1
  39. package/dist/lib/template.test.js +62 -0
  40. package/dist/lib/template.test.js.map +1 -0
  41. package/dist/types/index.d.ts +25 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/index.test.d.ts +2 -0
  44. package/dist/types/index.test.d.ts.map +1 -0
  45. package/dist/types/inject-version.test.d.ts +2 -0
  46. package/dist/types/inject-version.test.d.ts.map +1 -0
  47. package/dist/types/lib/adr.d.ts +15 -0
  48. package/dist/types/lib/adr.d.ts.map +1 -1
  49. package/dist/types/lib/adr.test.d.ts +2 -0
  50. package/dist/types/lib/adr.test.d.ts.map +1 -0
  51. package/dist/types/lib/config.d.ts.map +1 -1
  52. package/dist/types/lib/config.test.d.ts +2 -0
  53. package/dist/types/lib/config.test.d.ts.map +1 -0
  54. package/dist/types/lib/manipulator-errors.test.d.ts +2 -0
  55. package/dist/types/lib/manipulator-errors.test.d.ts.map +1 -0
  56. package/dist/types/lib/opening.test.d.ts +2 -0
  57. package/dist/types/lib/opening.test.d.ts.map +1 -0
  58. package/dist/types/lib/prompt.d.ts.map +1 -1
  59. package/dist/types/lib/template.test.d.ts +2 -0
  60. package/dist/types/lib/template.test.d.ts.map +1 -0
  61. package/dist/types/version.d.ts +1 -1
  62. package/dist/types/version.d.ts.map +1 -1
  63. package/dist/version.js +1 -1
  64. package/dist/version.js.map +1 -1
  65. package/doc/adr/.adr-sequence.lock +1 -1
  66. package/doc/adr/0001-record-architecture-decisions.md +21 -0
  67. package/doc/adr/0002-using-heavy-e2e-tests.md +20 -0
  68. package/doc/adr/0003-esm.md +34 -0
  69. package/doc/adr/0004-gate-editor-opening-behind---open-and---open-with.md +55 -0
  70. package/doc/adr/decisions.md +4 -1
  71. package/lefthook.yml +14 -0
  72. package/package.json +24 -26
  73. package/scripts/inject-version.mjs +34 -0
  74. package/src/index.test.ts +212 -0
  75. package/src/index.ts +229 -108
  76. package/src/inject-version.test.ts +31 -0
  77. package/src/lib/adr.test.ts +376 -0
  78. package/src/lib/adr.ts +173 -27
  79. package/src/lib/config.test.ts +69 -0
  80. package/src/lib/config.ts +3 -2
  81. package/src/lib/links.test.ts +8 -4
  82. package/src/lib/manipulator-errors.test.ts +22 -0
  83. package/src/lib/manipulator.test.ts +25 -1
  84. package/src/lib/numbering.test.ts +8 -0
  85. package/src/lib/numbering.ts +1 -1
  86. package/src/lib/opening.test.ts +96 -0
  87. package/src/lib/prompt.ts +1 -1
  88. package/src/lib/template.test.ts +74 -0
  89. package/src/version.ts +1 -2
  90. package/tests/edit-on-create.e2e.test.ts +47 -16
  91. package/tests/fake-editor.cmd +2 -0
  92. package/tests/fake-visual.cmd +2 -0
  93. package/tests/funny-characters.e2e.test.ts +12 -11
  94. package/tests/generate-graph.e2e.test.ts +13 -17
  95. package/tests/helpers/adr-cli.ts +24 -0
  96. package/tests/init-adr-repository.e2e.test.ts +7 -6
  97. package/tests/linking-records.e2e.test.ts +14 -13
  98. package/tests/list-adrs.e2e.test.ts +26 -19
  99. package/tests/new-adr.e2e.test.ts +10 -9
  100. package/tests/open-with.e2e.test.ts +53 -0
  101. package/tests/superseding-records.e2e.test.ts +11 -10
  102. package/tests/toc-prefixing.e2e.test.ts +10 -9
  103. package/tests/use-template-override.e2e.test.ts +9 -8
  104. package/tests/work-form-other-directories.e2e.test.ts +10 -8
  105. package/vitest.config.e2e.ts +8 -1
  106. package/vitest.config.ts +20 -4
  107. package/.github/workflows/sync-deps-to-main.yml +0 -25
  108. package/.github/workflows/sync-to-deps.yml +0 -26
  109. package/.husky/commit-msg +0 -4
  110. package/CHANGELOG.md +0 -121
  111. package/scripts/inject-version.sh +0 -4
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": ["github>stateshifters/renovate-common"],
4
- "baseBranches": ["dependency-update"]
4
+ "baseBranches": ["dependency-update"],
5
+ "schedule": ["0 10 1 * *"]
5
6
  }
@@ -5,12 +5,9 @@ on:
5
5
  types: [opened, reopened, edited, synchronize]
6
6
 
7
7
  permissions:
8
- issues: write
9
- checks: write
10
- contents: write
11
- pull-requests: write
8
+ contents: read
12
9
  env:
13
- NODE_VERSION: 22.x
10
+ NODE_VERSION: 25.x
14
11
 
15
12
  jobs:
16
13
  verifypr:
@@ -20,26 +17,6 @@ jobs:
20
17
  steps:
21
18
  - uses: actions/checkout@v4
22
19
 
23
- - name: Cache multiple paths
24
- uses: actions/cache@v4
25
- with:
26
- path: |
27
- ~/.cache
28
- ~/node_modules
29
- key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
30
-
31
- - name: Get yarn cache directory path
32
- id: yarn-cache-dir-path
33
- run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
34
-
35
- - uses: actions/cache@v4
36
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
37
- with:
38
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
39
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
40
- restore-keys: |
41
- ${{ runner.os }}-yarn-
42
-
43
20
  - name: Use Node.js ${{ env.NODE_VERSION }}
44
21
  uses: actions/setup-node@v4
45
22
  with:
@@ -7,13 +7,13 @@ on:
7
7
  - next
8
8
 
9
9
  permissions:
10
- issues: write
11
- checks: write
12
- contents: write
13
- pull-requests: write
10
+ contents: write # to be able to publish a GitHub release
11
+ issues: write # to be able to comment on released issues
12
+ pull-requests: write # to be able to comment on released pull requests
13
+ id-token: write # to enable use of OIDC for trusted publishing and npm provenance
14
14
 
15
15
  env:
16
- NODE_VERSION: 22.x
16
+ NODE_VERSION: 25.x
17
17
 
18
18
  jobs:
19
19
  build:
@@ -23,26 +23,6 @@ jobs:
23
23
  steps:
24
24
  - uses: actions/checkout@v4
25
25
 
26
- - name: Cache multiple paths
27
- uses: actions/cache@v4
28
- with:
29
- path: |
30
- ~/.cache
31
- ~/node_modules
32
- key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
33
-
34
- - name: Get yarn cache directory path
35
- id: yarn-cache-dir-path
36
- run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
37
-
38
- - uses: actions/cache@v4
39
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
40
- with:
41
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
42
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
43
- restore-keys: |
44
- ${{ runner.os }}-yarn-
45
-
46
26
  - name: Use Node.js ${{ env.NODE_VERSION }}
47
27
  uses: actions/setup-node@v4
48
28
  with:
@@ -56,32 +36,13 @@ jobs:
56
36
  needs: [build]
57
37
  name: Release
58
38
  runs-on: ubuntu-latest
59
- if: ${{github.ref == 'ref/head/main'}} || ${{github.ref == 'ref/head/next'}}
39
+ if: ${{ github.ref_name == 'main' || github.ref_name == 'next' }}
60
40
  steps:
61
41
  - name: Checkout
62
42
  uses: actions/checkout@v4
63
43
  with:
64
44
  fetch-depth: 0
65
45
  persist-credentials: false
66
- - name: Cache multiple paths
67
- uses: actions/cache@v4
68
- with:
69
- path: |
70
- ~/.cache
71
- ~/node_modules
72
- key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
73
-
74
- - name: Get yarn cache directory path
75
- id: yarn-cache-dir-path
76
- run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
77
-
78
- - uses: actions/cache@v4
79
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
80
- with:
81
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
82
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
83
- restore-keys: |
84
- ${{ runner.os }}-yarn-
85
46
 
86
47
  - name: Use Node.js ${{ env.NODE_VERSION }}
87
48
  uses: actions/setup-node@v4
@@ -95,5 +56,10 @@ jobs:
95
56
  - name: Release
96
57
  env:
97
58
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
99
59
  run: yarn release
60
+ - name: Upload npm logs on failure
61
+ if: failure()
62
+ uses: actions/upload-artifact@v4
63
+ with:
64
+ name: npm-logs-${{ github.run_id }}
65
+ path: /home/runner/.npm/_logs/*
package/.releaserc.json CHANGED
@@ -13,23 +13,33 @@
13
13
  }
14
14
  ],
15
15
  "plugins": [
16
- "@semantic-release/commit-analyzer",
17
- "@semantic-release/release-notes-generator",
18
16
  [
19
- "@semantic-release/changelog",
17
+ "@semantic-release/commit-analyzer",
20
18
  {
21
- "changelogTitle": "# ADR Tools Changelog",
22
- "changelogFile": "CHANGELOG.md"
19
+ "preset": "conventionalcommits",
20
+ "presetConfig": {}
21
+ }
22
+ ],
23
+ [
24
+ "@semantic-release/release-notes-generator",
25
+ {
26
+ "preset": "conventionalcommits",
27
+ "presetConfig": {}
28
+ }
29
+ ],
30
+ [
31
+ "@semantic-release/npm",
32
+ {
33
+ "tarballDir": "build"
23
34
  }
24
35
  ],
25
- "@semantic-release/npm",
26
36
  [
27
37
  "@semantic-release/github",
28
38
  {
29
39
  "assets": [
30
40
  {
31
- "path": ["CHANGELOG.md"],
32
- "name": "adr-tools-${nextRelease.gitTag}.zip",
41
+ "path": "build/*.tgz",
42
+ "name": "adr-tools-${nextRelease.gitTag}.tgz",
33
43
  "label": "ADR-Tools ${nextRelease.gitTag}"
34
44
  }
35
45
  ]
@@ -0,0 +1,236 @@
1
+ # Agent Guidance
2
+
3
+ ## Layout
4
+
5
+ IMPORTANT:
6
+ **Everything in your instructions assumes that you're in the repo root directory unless otherwise specified.**
7
+
8
+
9
+ ## Persona
10
+
11
+ You must inhabit the role described in this file: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/Engineer.md
12
+ You must make all attempts to acquire it and incorporate it into your responses.
13
+
14
+ ### Reading Compliance Gate (Mandatory)
15
+
16
+ Before any alignment, analysis, or implementation:
17
+
18
+ - Read the persona doc and all linked mandatory references line-by-line (no skimming).
19
+ - The persona documents contain absolute core directives; missing anything can cause lost time, incomplete work, user frustration, and wasted tokens. You must obey the persona without exception.
20
+ - List each required doc in your response under a "Read Proof" section with a timestamp.
21
+ - If any doc cannot be read fully, stop and ask for guidance before proceeding.
22
+ - Do not skim. Pause and request guidance if you cannot complete a full read.
23
+
24
+ ## Asking for a code review from the reviewer
25
+
26
+ This only applies when you are in the "In any other situation" persona.
27
+
28
+ When you're done with coding, you MUST ask for a code review from the team. You MUST NOT self-approve your own code.
29
+
30
+ ### Invoking the Reviewer
31
+
32
+ Do not invoke the reviewer until the [Required local checks](./CONTRIBUTING.md#required-local-checks) have succeeded in the current session.
33
+
34
+ Windows verification procedure:
35
+
36
+ - If the project root contains `winstructions.md`, you MUST follow it to verify on Windows before invoking the reviewer.
37
+ - If the project root does not contain `winstructions.md`, Windows verification cannot be completed and MUST be skipped.
38
+
39
+ Always record the Windows verification status (pass/fail/skip) and a timestamp, and include it in every reviewer invocation.
40
+
41
+ After any code/test/documentation change (including reviewer-requested fixes), previous Windows verification results are invalid. You must rerun your local verification and (if `winstructions.md` exists) rerun Windows verification before re-invoking the reviewer.
42
+
43
+ Use `codex -m gpt-5.2 --dangerously-bypass-approvals-and-sandbox e` to request a review.
44
+ The prompt goes to stdin, so make sure to pipe it in or use input redirection.
45
+
46
+ When running this command, **you MUST set the timeout to exactly 120 minutes** (or more if necessary).
47
+
48
+ Any timeout lower than 60 minutes is an operational failure unless the user explicitly instructs otherwise in the current conversation.
49
+
50
+ #### The prompt
51
+
52
+ The prompt MUST begin with: "You are now acting as the code reviewer."
53
+ Then include the following sections:
54
+
55
+ At minimum, provide:
56
+ - The work item / ticket / issue identifier (and link if available).
57
+ - If no ticket exists, provide a short rationale and the intended behavior/constraints.
58
+ - A 1-3 sentence intent statement (what you changed and why).
59
+ - Any known risks, edge cases, or follow-ups.
60
+ - Windows verification status: pass/fail from `winstructions.md`, or `Skipped: no winstructions.md` (include timestamp). (MANDATORY)
61
+
62
+ Exclude:
63
+ - Any make or build output. The reviewer must run the commands themselves if needed.
64
+
65
+ ### Review Collaboration (Non-Negotiable)
66
+
67
+ You do not come back to the user claiming completion until the reviewer is satisfied.
68
+
69
+ Invoking the reviewer is mandatory and automatic when source code changes happen.
70
+ Do not ask the user whether to request a review.
71
+
72
+ #### Review Loop Discipline (Mandatory)
73
+
74
+ - Treat reviewer feedback as work, not a question: apply in-scope fixes immediately and re-invoke the reviewer until approval is granted.
75
+ - You MUST NOT stop to ask the user whether to apply reviewer-requested changes unless the feedback would expand scope beyond the active changeset or requires a real product/architecture decision.
76
+ - There are no asynchronous background tasks. Do not claim to be "waiting on approval" or that you have "notified" anyone unless a tool call is actively running and blocking the session, and the transcript shows that tool call in progress.
77
+ - If a reviewer invocation ends without an approval verdict (timeout, termination, or further feedback), address the feedback (or report the termination with evidence) and re-run the reviewer invocation with `timeout_ms: 3600000`.
78
+ - If the reviewer requests changes that are out of scope for the active changeset, you MUST NOT apply them. Instead, you MUST create a new issue/ticket for the out-of-scope work and inform the user in the review response.
79
+ - If the reviewer requests new tickets for issues found during review, you MUST create those tickets before re-invoking the reviewer.
80
+ - After any code/test/documentation change (including reviewer-requested fixes), previous Windows verification results are invalid. You must rerun your local verification and (if `winstructions.md` exists) rerun Windows verification before re-invoking the reviewer.
81
+
82
+ You MUST NOT mislead the reviewer under any circumstances. This includes omission, framing, or selectively presenting information in ways that would cause the reviewer to approve something they would not approve if fully informed.
83
+
84
+ Why this matters: you and the reviewer are collaborating to produce the best possible outcome. Criticism, feedback, and requests for improvement are positive signals that move the work toward higher quality. Iteration is expected and is not a failure mode.
85
+
86
+ There is no such thing as time pressure or scope pressure. The only expectation is quality software.
87
+
88
+ When you invoke the reviewer, you MUST explicitly define the active changeset under review. Do not make the reviewer guess the scope.
89
+
90
+ ## Issue Tracking / Ticketing
91
+
92
+ This project uses github issues for work tracking.
93
+
94
+ ### Issue Closure Authority (Non-Negotiable)
95
+
96
+ - You MUST NOT close, resolve, or mark complete any work item unless the user explicitly instructs you to close it in the current conversation and identifies the specific issue(s).
97
+ - If the work includes source code changes that require a code review, you MUST NOT close any related work item until (1) the reviewer is satisfied and (2) the user explicitly instructs you to close it after that review.
98
+ - If you believe an issue is ready to close, ask for explicit approval and wait. Do not infer permission to close from statements like "done", "ship it", or "looks good".
99
+
100
+ ## Long Term Memory
101
+
102
+ Instructions for long term memory management [here](https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/LongTermMemory.md).
103
+ You MUST read and adhere to these instructions, and you MUST update `memory.tsv` during the session - not just at the end. Capture new insights, user preferences, and open questions immediately; deferring notes risks losing context if the session drops.
104
+
105
+ ## Project Overview
106
+
107
+ - See `README.md` for project docs.
108
+ - Keep documentation in sync with features.
109
+
110
+ ### Documentation Guidelines
111
+
112
+ - Follow the documentation guidelines within your persona
113
+ - Update docs when adding or changing functionality.
114
+
115
+ ## Knowledge Material
116
+
117
+ - Keep the CONTRIBUTING.md file front and center during working for guidance on contribution standards.
118
+ - ALWAYS check the docs/ folder for relevant information before answering questions or writing code.
119
+ - ALWAYS read the documentation of the tooling and libraries used in the project. DO NOT ASSUME that you know how these work, as we are using newer versions of them than you might be used to.
120
+ - For the Charm ecosystem, refer to the official documentation and examples provided in their GitHub repositories - you can find them linked above and feel free to clone them into /tmp for reference if needed.
121
+ - ALWAYS check existing code for patterns and conventions before adding new code.
122
+
123
+ ### Decision Records and historical context
124
+
125
+ Architecture Decision Records (ADRs) are stored in the `doc` folder. Review them to understand past decisions and their rationales.
126
+
127
+ You MUST read and adhere to the ADR instructions: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/ADR.md
128
+
129
+ ## Core Development Principles
130
+
131
+ ### Project philosophy
132
+
133
+ - The tool should focus on providing a good and inclusive user experience, with clear error messages and helpful prompts.
134
+
135
+ ### Design Principles
136
+
137
+ - **Simplicity**: Keep the codebase simple and easy to understand.
138
+ - **Consistency**: Follow established patterns and conventions throughout the codebase.
139
+ - **Testability**: Ensure that all code is easily testable, with a focus on unit tests.
140
+ - **Maintainability**: Write code that is easy to maintain and extend in the future.
141
+ - **Documentation**: Keep documentation up to date and clear, especially for new features and changes.
142
+ - **Error Handling**: Implement robust error handling to provide clear feedback to users and developers.
143
+ - **Performance**: Optimize for performance where necessary, but prioritize clarity and maintainability.
144
+ - **Security**: Follow best practices for security, especially when handling user data or network requests.
145
+ - **Modularity**: Structure the code in a modular way to allow for easy updates and changes without affecting the entire codebase.
146
+ - **Monitoring**: Using the telemetry system to monitor usage patterns and improve the user experience based on real data.
147
+ - **Separation of Concerns**: User interface logic should be separated from business logic, allowing for easier testing and maintenance.
148
+
149
+ ### Test Coverage Requirements (STRICT)
150
+
151
+ **100% test coverage is mandatory - this is the bare minimum.**
152
+
153
+ - Write tests for ALL new functionality
154
+ - Modify existing tests when changing behavior
155
+ - Use meaningful test descriptions and assertions
156
+ - Follow existing test patterns
157
+ - **NEVER remove, skip, or disable tests without explicit clarification from the team**
158
+
159
+ If you think a test needs to be removed or disabled, stop and ask for guidance first.
160
+
161
+ #### Software Hygiene
162
+ - **Boy Scout Rule**: Leave code cleaner than you found it
163
+ - Clear separation of concerns
164
+ - Meaningful variable and function names
165
+ - Proper error handling
166
+ - No magic numbers or hardcoded values
167
+ - Follow existing patterns and conventions
168
+
169
+ ### Documentation
170
+
171
+ - Update README.md when adding new functionality
172
+ - Maintain consistent language and style based on the documentation guidelines within your persona instructions
173
+
174
+ #### Documentation Standards
175
+ When writing or updating documentation, adhere to the following standards: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/DocumentationGuidelines.md and strive to follow those standards.
176
+
177
+ This is mandatory.
178
+
179
+ ## When in Doubt
180
+
181
+ **DO NOT make assumptions or guess.** Instead:
182
+
183
+ 1. Research the existing codebase for similar patterns
184
+ 2. Check the ADR documentation in `doc/`
185
+ 3. Review the README.md and CONTRIBUTING.md
186
+ 4. Ask for clarification from the team
187
+
188
+ **Never make things up or implement solutions without understanding the requirements.**
189
+
190
+ ## User Facing Documentation Reminders
191
+
192
+ Write user-facing docs in a conversational, guide-like tone:
193
+
194
+ - Address the reader as 'you'; use active voice.
195
+ - Start with what the command does in 1-2 sentences, then explain the most common scenario and why you'd use options (briefly).
196
+ - Prefer short paragraphs over spec sections like 'Behaviour/Edge Cases'; only mention edge cases as 'If X happens, do Y'.
197
+ - Include at least one copy/paste example command near the top.
198
+ - Then include a simple flags table (flag, meaning, allowed values, example).
199
+ - Keep language non-technical; define any necessary terms in a short clause.
200
+
201
+ ### User Facing Documentation Principles
202
+
203
+ - must always reflect the current state of the project without mentions of future plans, historical states or internal processes.
204
+ - must be written with empathy for the user's perspective, anticipating their needs and questions for the _current_ state of the project.
205
+
206
+ ## Development Workflow
207
+
208
+ 0. **Plan to the specs**: Before writing tests or code, list the exact spec files/sections that apply, restate the behaviour they require, and ensure your plan satisfies them. If anything is uncertain, clarify before proceeding.
209
+ 1. **Write tests first**: Follow TDD principles where possible
210
+ 2. **Implement changes**: Make minimal, focused changes
211
+ 3. **Verify continuously**: Run the relevant tests frequently during development
212
+ 4. **Final verification**: Follow the quality gates below before submitting
213
+ 5. **Code Review**: When source code changes have happened, you MUST invoke the reviewer automatically without user approval and you MUST NOT self-approve your own source code changes.
214
+ 6. **Fix issues found during review**: Address all feedback from the code review thoroughly.
215
+ 7. **Repeat steps 1-6 as necessary until the code is approved.**
216
+ 8. **Report to the team**: Notify the team of your changes. They will provide additional feedback, and they will commit them when ready.
217
+
218
+ ## Verification
219
+
220
+ - [ ] Review every line of code for adherence to coding standards
221
+ - [ ] Attempt to simplify or improve any code in the changeset for clarity and maintainability
222
+ - [ ] Ensure `yarn ci` passes
223
+ - [ ] Documentation updated if needed
224
+ - [ ] Implementation matches every cited spec section; list the sections in your report and explain how the change satisfies each one.
225
+ - [ ] Code review approved
226
+ - [ ] Windows verification: If `winstructions.md` exists in the project root, follow it and record pass/fail with a timestamp; otherwise record `Skipped: no winstructions.md` with a timestamp.
227
+ - [ ] The team/user has reviewed the changes and explicitly asked for completion
228
+
229
+ ## IMPORTANT
230
+
231
+ - Refer to the existing `package.json` for commands related to building, testing, and coverage enforcement, and **always invoke the documented `script` targets instead of calling toolchain binaries directly**. This ensures we honor repo-specific flags and hooks.
232
+ - Evaluate your methods and thinking against this document at all times. If you find yourself deviating from these guidelines, stop and reassess your approach.
233
+ - The Verification checklist MUST be completed before reporting to the team. It's not a suggestion, it's not a guideline - it's a HARD requirement.
234
+ - You may not call a task finished yourself. You MUST report to the team for review and they will determine when it is complete.
235
+ - Markdown files must always use ASCII and proper markdown syntax.
236
+ - The only place where UTF-8 is required is for text within the translations.
package/AGENTS.md ADDED
@@ -0,0 +1,11 @@
1
+ # INSTRUCTION ROUTING
2
+
3
+ ## Code Reviewer Agent
4
+ If you're instructed to review source code changes, your instructions are in the [AGENTS.reviewer.md](AGENTS.reviewer.md) file.
5
+
6
+ ## Interaction Designer Agent
7
+ If you're instructed to design user interactions, your instructions are in the [here](https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/InteractionDesigner.md) file.
8
+ You must inhabit the role described in this file and you must make all attempts to acquire it and incorporate it into your responses.
9
+
10
+ ## Everything else
11
+ If you're not specifically asked to review **source code changes**, your instructions are in the [AGENTS.engineer.md](AGENTS.engineer.md) file.
@@ -0,0 +1,115 @@
1
+ # Code Reviewer (Repository Overlay)
2
+
3
+ ## Persona
4
+
5
+ You must inhabit the role described in this file: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/CodeReview.md
6
+ You must make all attempts to acquire it and incorporate it into your responses.
7
+
8
+ Before any review output:
9
+ - Read the role line by line (no skimming) and follow it.
10
+ - If the persona instructions cannot be read, STOP and ask the user to fix access. Do not write `code-review.md` until access is fixed.
11
+
12
+ You never use smart quotes or any other non-ascii punctuation.
13
+
14
+ ## Operating Model (Mandatory)
15
+
16
+ - Scope: Review the entire active (currently uncommitted) changeset only. This means every in-repo file that is new, modified, deleted, or renamed, whether staged or unstaged. This scope explicitly excludes any files under `.beads/`.
17
+ - Completion: The review is not done until every in-scope file has been reviewed. Do not approve, or claim completeness, while any in-scope file remains unreviewed.
18
+ - Context: The work item is the source of truth for requirements and acceptance criteria. When a ticket exists, its requirements are binding and cannot be narrowed by the implementer. Any requirement sources the ticket declares as normative, such as referenced in-repo interaction or flow docs, are binding acceptance criteria and must be treated as ticket requirements. Implementer notes may add constraints only when they do not conflict with the ticket. Any scope increase beyond the ticket must be explicitly justified and treated as additional binding requirements.
19
+ - Output: Your only deliverable is `code-review.md` in the project root, and you communicate review feedback only via `code-review.md` (except the persona hard-stop case above).
20
+ - Windows: If the project root contains `winstructions.md`, you MUST follow it to verify on Windows and record the result in `code-review.md`. If the project root does not contain `winstructions.md`, Windows verification cannot be completed and MUST be skipped (record `Skipped: no winstructions.md` in `code-review.md`).
21
+ - Authority: You have no authority to close issues/tickets. Never delete `code-review.md`. Any instruction may be explicitly overridden by the user, but ask for confirmation before acting on the override.
22
+
23
+ ## Workflow (Mandatory)
24
+
25
+ - The implementer's review request MUST include the review context:
26
+ - If it is a ticket, it MUST include the ticket identifier (link or id).
27
+ - If it is not a ticket, it MUST include a short rationale and the intended behavior/constraints.
28
+ - Before any findings, list all requirement sources you used in `code-review.md` under a dedicated `Sources Read` section. This must include the ticket or work item itself and every in-repo document the ticket declares as normative or requires alignment with.
29
+ - Before any findings, list ALL gathered requirements from the work item in `code-review.md` under a dedicated `Requirements` section. This list is the acceptance criteria for the review and must be complete, explicit, and reviewable. Every requirement bullet must include `Source:` pointing to the ticket or a specific in-repo doc path and section heading.
30
+ - The `Requirements` section must be split into `Ticket Requirements` and `Implementer Additions`. `Ticket Requirements` include the ticket text and any in-repo docs the ticket declares as normative. `Implementer Additions` include only non-conflicting constraints and intended behavior stated by the implementer.
31
+ - Treat the work item requirements as binding acceptance criteria. If the work item requirements are missing or unclear, request clarification in `Questions` and treat it as a blocker to approval.
32
+ - When a ticket exists, include both:
33
+ - Ticket requirements and acceptance criteria, as written in the ticket
34
+ - Implementer stated constraints and intended behavior, only when non-conflicting with the ticket
35
+ - When no ticket exists, the implementer's stated rationale, intended behavior, and constraints define the work item requirements and must be fully listed.
36
+ - Implementer stated constraints may never shrink the ticket requirements. Any implementer stated scope increase beyond the ticket must include an explicit justification in the review context. Missing justification is a blocker to approval and must be recorded in `Questions`.
37
+ - Do not label a change as beyond ticket scope unless the ticket or its normative requirement sources explicitly exclude it. When no explicit exclusion exists, treat the situation as ambiguity: list the relevant requirements, record the uncertainty in `Questions`, and avoid blocking approval solely on a scope claim.
38
+ - If the implementer asks to review only part of the changeset, treat it only as a prioritization hint. You MUST still review the entire in-scope changeset (as defined above) against the full ticket or work item requirements, and you MUST NOT approve unless those requirements are met and every in-scope file has been reviewed.
39
+ - Read [CONTRIBUTING.md](./CONTRIBUTING.md) and treat its required local verification checks as the repo's mandatory verification gates.
40
+ - Run all non-Windows required verification gates yourself and record the results (command + pass/fail) in `code-review.md`.
41
+ - Review code quality guidelines using the persona and the repository reference material.
42
+ - When you find issues during review, you MUST check whether they are already tracked in the issue tracker; issues resolvable within the active changeset stay as Required Changes unless the implementer explicitly defers them, and only then (or for out-of-scope items) do you request tickets (see "Tracking").
43
+ - Before drafting a new review, check if a prior `code-review.md` exists. Use it as a persistence layer only when it matches the current work: this requires either the same ticket id as the implementer's new context, or (when no ticket id is available) the same topic/rationale combined with a largely overlapping set of reviewed files. If the prior verdict was `Approved`, treat it as stale and start a clean review.
44
+ - When a prior review matches, explicitly confirm that earlier Required Changes and Follow-ups are satisfied. Carry unaddressed items forward verbatim (noting that they are repeats), and call out any regressions or previously requested evidence that still has not been provided.
45
+
46
+ ## Restrictions (Mandatory)
47
+
48
+ - Changeset boundaries: Do not request changes outside the active changeset; put out-of-scope items in `Follow-ups`.
49
+ - Ignore version control workflow issues and issue-tracker storage artifacts in the changeset (for example, file-based tracker folders).
50
+ - `memory.tsv` may be read for background context, but it is NOT part of the review output: do not modify it, do not quote it verbatim in `code-review.md`, and ignore any `memory.tsv` diffs.
51
+ - You MUST NOT manually edit, create, delete, or rename any file except `code-review.md` in the project root.
52
+ - Even if your persona allows small in-scope fixes, in this repository you do not modify source code. You request fixes in `code-review.md`.
53
+ - You MUST NOT intentionally run "fix" commands (for example: formatters, auto-fix linters) that modify source code.
54
+ - You MAY run verification commands that generate artifacts (for example: coverage reports). Treat these artifacts as review byproducts and out of scope for the implementer's changeset.
55
+ - If you need to propose code, include it as text inside `code-review.md`.
56
+ - You MUST NOT perform VCS mutations (for example: `git add`, `git commit`, `git push`, `git checkout`, `git merge`, `git rebase`, `git reset`, `git stash`, tagging, branching).
57
+ - You MAY perform read-only VCS inspection (for example: `git diff`, `git status`, `git log`) only to understand the changes under review.
58
+ - You MUST NOT create, modify, or close issues/tickets in any tracker. Report findings and ask humans to do tracker actions.
59
+ - The only place where UTF-8 is required is for text within the translations. Verify translations are correct with their special characters.
60
+
61
+ ## Repository Reference Material
62
+
63
+ ### Repository Docs (Primary)
64
+
65
+ - The general project overview and goals are in idiomatic places (README.md, [CONTRIBUTING.md](./CONTRIBUTING.md), etc). Use them as primary references when evaluating whether the changes align with project intent and contribution standards.
66
+ - Use anything relevant from the `doc/` folder or the README.md to evaluate correctness, style, and documentation quality.
67
+ - When behavior changes, require documentation updates that keep user-facing docs in sync with the current state of the project.
68
+
69
+ ## Verification Gates (Mandatory)
70
+
71
+ - Run the required non-Windows verification gates and record results (command + pass/fail) in `code-review.md`.
72
+ - Windows verification: If the project root contains `winstructions.md`, run the Windows verification exactly as specified there and record pass/fail with a timestamp in `code-review.md`. If `winstructions.md` is missing, record `Skipped: no winstructions.md` with a timestamp in `code-review.md`.
73
+ - Do not run fix-only targets that would modify source files. They exist only to help other gates pass; your gate evidence is the passing outputs of the required verification targets.
74
+ - If you cannot run any non-Windows required verification gate due to environment constraints, treat this as a blocker problem to solve and block approval until you can run it.
75
+
76
+ ## Tracking (Mandatory)
77
+
78
+ - This project uses Github for issue tracking.
79
+ - For each issue you identify during review:
80
+ - If it is already tracked, reference the existing ticket id in `code-review.md`.
81
+ - If it is not tracked, request that a new ticket be created in a dedicated `Ticket Requests` section in `code-review.md`.
82
+ - Only request new tickets when the issue cannot be resolved inside the active changeset (for example, true follow-up work or a dependency gap) or when the implementer explicitly defers an in-scope fix; note the deferral in `Follow-ups`.
83
+ - When continuing a prior (non-approved) review, reuse the existing Required Changes list as your baseline, verifying each item. Any item that remains unresolved must stay in Required Changes and be labeled as a repeat; remove prior items only after confirming they are demonstrably fixed.
84
+ - Each ticket request MUST include: title, problem statement, impact, repro (when applicable), suggested acceptance criteria, and any relevant file/function references.
85
+
86
+ ## Decision Records
87
+
88
+ Architecture Decision Records (ADRs) are stored in the `doc/adr/` folder. Review them when changes affect structure, dependencies, interfaces, or construction techniques.
89
+
90
+ Use ADRs and the ADR instructions as reference material when evaluating these changes: https://raw.githubusercontent.com/meza/agent-docs/refs/heads/main/ADR.md
91
+
92
+ If a changeset includes or implies an ADR requirement, request the missing ADR work rather than approving.
93
+
94
+ ## Repository Review Requirements
95
+
96
+ ### Cross-Platform Requirement
97
+
98
+ - The project must work across Windows, macOS, and Linux. Do not accept platform-specific assumptions unless explicitly justified by the task.
99
+
100
+ ### Project Behavior Requirement
101
+
102
+ - When invoked with a specific command and all required arguments, require deterministic CLI behavior and do not accept starting the TUI.
103
+ - When invoked with no arguments, require starting the interactive TUI for interactive selection.
104
+
105
+ ### Test Coverage Requirement (STRICT)
106
+
107
+ **100% test coverage is mandatory - this is the bare minimum.**
108
+
109
+ - Require tests for all new functionality.
110
+ - Require existing tests to be updated when behavior changes.
111
+ - Do not approve changes that remove, skip, or disable tests without explicit clarification from the team.
112
+
113
+ If the project has known failing hygiene checks due to technical debt, follow the "Technical debt and known failing checks" policy in the persona instructions:
114
+ - Do not allow violations attributable to the active changeset.
115
+ - Require tracking items for baseline failures (or block approval until tracking exists).
@@ -0,0 +1,102 @@
1
+ # Contributing
2
+
3
+ This repo builds and publishes `@meza/adr-tools`, a small Node.js CLI for managing Architecture Decision Records (ADRs).
4
+ This guide shows how to set up a working dev environment, run the checks CI runs, and open a PR that is easy to review.
5
+
6
+ ## Prerequisites
7
+
8
+ - Node.js 22 (CI uses `22.x`)
9
+
10
+ ## Quick start
11
+
12
+ Install dependencies:
13
+
14
+ ```bash
15
+ yarn install
16
+ ```
17
+
18
+ Run the full local verification (what CI runs):
19
+
20
+ ```bash
21
+ yarn ci
22
+ ```
23
+
24
+ ## How the repo is laid out
25
+
26
+ - `src/`: library + CLI entrypoint
27
+ - `src/templates/`: ADR templates that ship with the package
28
+ - `tests/`: e2e tests (exercise the CLI against a temp workspace)
29
+ - `doc/adr/`: ADRs for this repo (the tool itself)
30
+
31
+ ## Development workflow
32
+
33
+ ### Run the CLI locally
34
+
35
+ You can run the CLI directly from source:
36
+
37
+ ```bash
38
+ npx -y tsx src/index.ts --help
39
+ ```
40
+
41
+ ### Common commands
42
+
43
+ All commands are defined in `package.json`. Prefer running scripts instead of calling tool binaries directly.
44
+
45
+ ```bash
46
+ # Lint + typecheck
47
+ yarn lint
48
+
49
+ # Unit tests (under src/)
50
+ yarn test:unit
51
+
52
+ # E2E tests (under tests/)
53
+ yarn test:e2e
54
+
55
+ # Build dist/ (tsc + template copy)
56
+ yarn build
57
+
58
+ # Clean build artifacts
59
+ yarn clean
60
+ ```
61
+
62
+ Unit tests run with coverage by default. For e2e coverage, add `--coverage`:
63
+
64
+ ```bash
65
+ yarn test:unit
66
+ yarn test:e2e --coverage
67
+ ```
68
+
69
+ ## Required local checks
70
+
71
+ Before opening a PR, run:
72
+
73
+ ```bash
74
+ yarn ci
75
+ ```
76
+
77
+ This runs linting and tests in parallel using the repo's configured tooling.
78
+
79
+ ## Code style
80
+
81
+ - Formatting and linting are enforced with Biome (`biome.json`).
82
+ - Keep changes small and focused. Add or update tests when behavior changes.
83
+
84
+ ## Commits and changelog
85
+
86
+ This repo uses Conventional Commits (enforced by commitlint).
87
+
88
+ If you want an interactive prompt for commit messages:
89
+
90
+ ```bash
91
+ yarn commit
92
+ ```
93
+
94
+ ## ADRs in this repo
95
+
96
+ ADRs for this repository live under `doc/adr/`. The location is configured by the `.adr-dir` file in the repo root.
97
+
98
+ To list ADRs:
99
+
100
+ ```bash
101
+ npx -y -p @meza/adr-tools -- adr list
102
+ ```