alignfirst 0.1.0-beta.0
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.
- package/README.md +31 -0
- package/bin/alignfirst.mjs +3 -0
- package/dist/cli-error.d.ts +2 -0
- package/dist/cli-error.js +2 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +98 -0
- package/dist/command-form.d.ts +3 -0
- package/dist/command-form.js +8 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +55 -0
- package/dist/commands/developers.d.ts +2 -0
- package/dist/commands/developers.js +36 -0
- package/dist/commands/docmap.d.ts +2 -0
- package/dist/commands/docmap.js +22 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +167 -0
- package/dist/commands/guide.d.ts +2 -0
- package/dist/commands/guide.js +126 -0
- package/dist/commands/plans.d.ts +2 -0
- package/dist/commands/plans.js +154 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.js +254 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +63 -0
- package/dist/commands/ticket.d.ts +2 -0
- package/dist/commands/ticket.js +119 -0
- package/dist/context.d.ts +15 -0
- package/dist/context.js +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +6 -0
- package/dist/executables.d.ts +1 -0
- package/dist/executables.js +24 -0
- package/dist/git.d.ts +5 -0
- package/dist/git.js +52 -0
- package/dist/overlay.d.ts +19 -0
- package/dist/overlay.js +83 -0
- package/dist/parse-args.d.ts +1 -0
- package/dist/parse-args.js +11 -0
- package/dist/plans/archive.d.ts +4 -0
- package/dist/plans/archive.js +68 -0
- package/dist/plans/layout.d.ts +6 -0
- package/dist/plans/layout.js +19 -0
- package/dist/plans/link.d.ts +2 -0
- package/dist/plans/link.js +36 -0
- package/dist/plans/mode.d.ts +9 -0
- package/dist/plans/mode.js +31 -0
- package/dist/plans/ticket.d.ts +21 -0
- package/dist/plans/ticket.js +104 -0
- package/dist/project-config.d.ts +27 -0
- package/dist/project-config.js +79 -0
- package/dist/protocols.d.ts +2 -0
- package/dist/protocols.js +9 -0
- package/dist/skills.d.ts +9 -0
- package/dist/skills.js +54 -0
- package/dist/version-guard.d.ts +8 -0
- package/dist/version-guard.js +24 -0
- package/package.json +48 -0
- package/templates/guide/code-review/correctness-reviewer.md +53 -0
- package/templates/guide/code-review/intent-reviewer.md +22 -0
- package/templates/guide/code-review/module-javascript.md +80 -0
- package/templates/guide/code-review/module-python.md +77 -0
- package/templates/guide/code-review/module-typescript-strict.md +84 -0
- package/templates/guide/code-review/quality-reviewer.md +54 -0
- package/templates/guide/code-review/reviewer-common.md +62 -0
- package/templates/guide/code-review/safety-reviewer.md +66 -0
- package/templates/guide/core.md +54 -0
- package/templates/guide/overview.md +57 -0
- package/templates/guide/protocols/aad.md +85 -0
- package/templates/guide/protocols/catchup.md +13 -0
- package/templates/guide/protocols/description.md +51 -0
- package/templates/guide/protocols/merge.md +65 -0
- package/templates/guide/protocols/plan.md +256 -0
- package/templates/guide/protocols/review.md +114 -0
- package/templates/guide/protocols/spec.md +78 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# How to Write a Code Review Report
|
|
2
|
+
|
|
3
|
+
## Pre-requisites
|
|
4
|
+
|
|
5
|
+
You need:
|
|
6
|
+
|
|
7
|
+
- the TASK_DIR — run `{{CMD}} ticket <id>` (`{{CMD}} ticket` alone deduces the id from the branch when the project defines a ticket format; `{{CMD}} ticket --side` when there is no ticket)
|
|
8
|
+
- the CYCLE_LETTER and FILE_NUMBER — start a new cycle: `{{CMD}} ticket <id> --next review.md --new-cycle` prints the file to create
|
|
9
|
+
- the **base branch** to compare against - use the branch provided by the user, or fall back to the default branch.
|
|
10
|
+
|
|
11
|
+
Identify and state these values before starting the protocol.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
We need a code review for this branch, compared to the base branch. A code review, above all, guarantees that the codebase stays healthy.
|
|
16
|
+
|
|
17
|
+
You are the orchestrator: you scope the work, run one reviewer subagent per perspective, then merge their findings into a single report. Reviewers work with fresh eyes — they derive intent from the code and the diff. Neither you nor the reviewers read specs, plans, summaries, or any file content in TASK_DIR.
|
|
18
|
+
|
|
19
|
+
Before starting, create your report as a new file `{CYCLE_LETTER}1-review.md` in the TASK_DIR, containing just the header — this reserves the filename. Write the report into it at the end.
|
|
20
|
+
|
|
21
|
+
## Phase 1. Scoping
|
|
22
|
+
|
|
23
|
+
1. Find the merge-base: `git merge-base <base_branch> HEAD`, then get the change overview: `git diff --stat <merge_base> HEAD`. The review target is the branch as committed.
|
|
24
|
+
2. Select the **ecosystem modules** from the changed files and the repo configuration:
|
|
25
|
+
|
|
26
|
+
| Changed files | Condition | `--module` value |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| TypeScript | `strict` enabled in the applicable tsconfig | `typescript-strict` |
|
|
29
|
+
| TypeScript | `strict` disabled | `javascript` |
|
|
30
|
+
| JavaScript | — | `javascript` |
|
|
31
|
+
| Python | — | `python` |
|
|
32
|
+
| Other stacks | — | no module; the perspectives cover them |
|
|
33
|
+
|
|
34
|
+
A diff spanning several ecosystems gets all the applicable modules.
|
|
35
|
+
|
|
36
|
+
3. Note the **active tooling**: type-checker and its strictness, linter, formatter. Reviewers use this to skip what the tooling already catches.
|
|
37
|
+
4. Note the **repo coding conventions**: instruction files (CLAUDE.md, AGENTS.md) and coding-style skills that apply to the changed files. Collect paths, not content.
|
|
38
|
+
|
|
39
|
+
## Phase 2. Perspective Reviews
|
|
40
|
+
|
|
41
|
+
**Small diff** (roughly under 100 changed lines, outside generated files and lockfiles): skip the subagents. Execute the perspectives yourself, sequentially — intent, correctness, safety, quality — reading the same files. The rest of the protocol is unchanged.
|
|
42
|
+
|
|
43
|
+
Otherwise, launch four reviewer subagents in parallel:
|
|
44
|
+
|
|
45
|
+
| Reviewer | `--reviewer` value | `--module` values from Phase 1 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| Intent | `intent` | none |
|
|
48
|
+
| Correctness | `correctness` | from Phase 1 |
|
|
49
|
+
| Change safety | `safety` | from Phase 1 |
|
|
50
|
+
| Quality | `quality` | from Phase 1 |
|
|
51
|
+
|
|
52
|
+
Each subagent prompt must contain:
|
|
53
|
+
|
|
54
|
+
- the command `{{CMD}} guide review --reviewer <perspective> --module <module>...` to run from the project root, with the modules selected in Phase 1, and the instruction to read its output before anything else
|
|
55
|
+
- the base branch and the merge-base
|
|
56
|
+
- the tooling notes from Phase 1
|
|
57
|
+
- for the intent and quality reviewers: the convention paths from Phase 1
|
|
58
|
+
- the instruction that its final message is its report, in the format the reviewer rules define
|
|
59
|
+
|
|
60
|
+
_If your environment has no subagent tool, or a subagent cannot run commands, follow the small-diff procedure regardless of the diff size._
|
|
61
|
+
|
|
62
|
+
## Phase 3. Merge and Verify
|
|
63
|
+
|
|
64
|
+
1. **Dedupe**: same location and same defect reported by several reviewers → keep one, at the highest severity.
|
|
65
|
+
2. **Verify**: for each 🔴 and 🟣 finding, read the cited lines yourself. Drop or downgrade a finding whose evidence does not hold.
|
|
66
|
+
3. **Cap the noise**: keep the most valuable 🟡 findings, in proportion to the diff — about five for a typical diff, fewer for a small one, up to ten for a very large one — and state the number left out. A review with zero findings is a valid outcome; open the assessment with "no blocking issues" when there is no 🔴.
|
|
67
|
+
4. **Rewrite for the reader**: a finding states its defect first; evidence and remedy follow. Rewrite any merged finding that buries the defect or narrates commit history.
|
|
68
|
+
5. **Reconcile the verdict**: adjust the intent reviewer's assessment and verdict to reflect the merged, verified findings. A surviving 🔴 forbids "mergeable as is".
|
|
69
|
+
|
|
70
|
+
## Phase 4. Output Format
|
|
71
|
+
|
|
72
|
+
```md
|
|
73
|
+
# Code Review - [very short title]
|
|
74
|
+
|
|
75
|
+
**Base branch:** `<base_branch>`
|
|
76
|
+
|
|
77
|
+
## Intent
|
|
78
|
+
|
|
79
|
+
[One or two sentences describing what this branch is trying to accomplish.]
|
|
80
|
+
|
|
81
|
+
## How It's Done
|
|
82
|
+
|
|
83
|
+
[Short description of the approach taken to implement the intent.]
|
|
84
|
+
|
|
85
|
+
## Assessment
|
|
86
|
+
|
|
87
|
+
[Is this the optimal way to implement this intent? Be direct. If yes, say so briefly. If not, explain what a better approach would be. End with the verdict: mergeable as is | mergeable after fixes | needs rework.]
|
|
88
|
+
|
|
89
|
+
## Findings
|
|
90
|
+
|
|
91
|
+
### 🔴 Important
|
|
92
|
+
|
|
93
|
+
- [`file1.ts#10`](/path/to/file1.ts#L10): [what is wrong, why it matters, and the scenario that triggers it]
|
|
94
|
+
|
|
95
|
+
### 🟡 Nits
|
|
96
|
+
|
|
97
|
+
- [`file2.ts#20`](/path/to/file2.ts#L20-L25): [concise reason]
|
|
98
|
+
|
|
99
|
+
### 🟣 Pre-existing
|
|
100
|
+
|
|
101
|
+
- [`file3.ts#30`](/path/to/file3.ts#L30): [concise reason]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Note:
|
|
105
|
+
|
|
106
|
+
- The Intent, How It's Done, and Assessment sections come from the intent reviewer; the intent reviewer's rewrite suggestions become findings.
|
|
107
|
+
- Omit a severity section when it is empty. When there is no finding at all, replace the Findings section with a single line stating it.
|
|
108
|
+
- Link URLs must start with `/` (absolute from workspace root, e.g. `/src/file.ts#L10`). Never include a range in the link label.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
_Ignore lint errors (formatting issues) in the review file._
|
|
113
|
+
|
|
114
|
+
At the end, give the path of the review file to the user.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# How to Write a Technical Specification
|
|
2
|
+
|
|
3
|
+
## Pre-requisites
|
|
4
|
+
|
|
5
|
+
You need:
|
|
6
|
+
|
|
7
|
+
- the TASK_DIR — run `{{CMD}} ticket <id>` (`{{CMD}} ticket` alone deduces the id from the branch when the project defines a ticket format; `{{CMD}} ticket --side` when there is no ticket)
|
|
8
|
+
- the CYCLE_LETTER and FILE_NUMBER — start a new cycle: `{{CMD}} ticket <id> --next spec.md --new-cycle` prints the file to create
|
|
9
|
+
|
|
10
|
+
Identify and state these values before starting the protocol.
|
|
11
|
+
|
|
12
|
+
## Phases
|
|
13
|
+
|
|
14
|
+
When the user asks you for a SPEC (technical specification), you MUST follow this process:
|
|
15
|
+
|
|
16
|
+
1. **Investigation Phase**: Research the codebase to understand the current implementation and identify the problem
|
|
17
|
+
2. **Discussion Phase**: Collaborate with the user to explore the problem space and potential solutions BEFORE writing the specification file
|
|
18
|
+
3. **Specification Phase**: Only after user approval, write the final specification file
|
|
19
|
+
|
|
20
|
+
The discussion phase is MANDATORY. Remember that you are a newcomer to this project while the user has extensive experience with the codebase and will be happy to help guide you.
|
|
21
|
+
|
|
22
|
+
## Phase 1. Investigation Phase
|
|
23
|
+
|
|
24
|
+
Check your context for available **documentation** and **skills**. Read every document and skill relevant to any aspect of the task — this is not optional. For each skill, also **read its relevant references**.
|
|
25
|
+
|
|
26
|
+
Investigate the codebase yourself, find the relevant source code, think carefully, take the time to understand how it currently works and what has to be done. If the Context7 MCP is available, feel free to use it.
|
|
27
|
+
|
|
28
|
+
Always seek a clean break solution by default. Never consider backward compatibility unless explicitly requested.
|
|
29
|
+
|
|
30
|
+
## Phase 2. Discussion Phase
|
|
31
|
+
|
|
32
|
+
Engage in a thorough collaborative discussion covering:
|
|
33
|
+
|
|
34
|
+
- **Problem exploration**: Present your understanding of the problem and ask clarifying questions
|
|
35
|
+
- **Current implementation analysis**: Share what you discovered and ask for confirmation or corrections
|
|
36
|
+
- **Multiple solution approaches**: Present several viable alternatives when they exist, explaining trade-offs
|
|
37
|
+
- **Sub-subject identification**: Break down the problem into all relevant sub-components and ensure each is addressed
|
|
38
|
+
- **Design decisions**: Ask for user input on key architectural choices
|
|
39
|
+
- **Edge cases and implications**: Explore potential issues and broader system impacts
|
|
40
|
+
|
|
41
|
+
You should ask questions freely to ensure you fully understand:
|
|
42
|
+
|
|
43
|
+
- The problem context and requirements
|
|
44
|
+
- Existing patterns and conventions in the codebase
|
|
45
|
+
- User preferences for implementation approaches
|
|
46
|
+
- Any constraints or considerations you might have missed
|
|
47
|
+
|
|
48
|
+
Do not use your question tool. Always ask in plain text. Your questions will be the opportunity for a real discussion.
|
|
49
|
+
|
|
50
|
+
## Phase 3. Specification Phase
|
|
51
|
+
|
|
52
|
+
After the user approves your proposal, write the specification in a markdown file in TASK_DIR. Compose the filename with the current CYCLE_LETTER and the next FILE_NUMBER, e.g. `A1-spec.md`. Do not overwrite an existing file.
|
|
53
|
+
|
|
54
|
+
- After the title, include a suggested commit message (follow the convention you are aware of, or default to `<type>: [<ticket_id>] very short description`). The shorter the better. Then list the required documentation and skills. List each doc file individually — never a folder. Always exclude `alignfirst` from skills. Omit any field with nothing to list. Example:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
# [{TICKET_ID}] Short Title
|
|
58
|
+
|
|
59
|
+
Suggested commit message: `<commit message>`
|
|
60
|
+
|
|
61
|
+
Required Documentation:
|
|
62
|
+
|
|
63
|
+
- `docs/topic-a/doc-1.md`
|
|
64
|
+
- `docs/topic-b/doc-2.md`
|
|
65
|
+
|
|
66
|
+
Required skills: `skill-1`, `skill-2`
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **Do not specify backward compatibility** unless explicitly requested. Prefer clean break by default. Unused code must be removed.
|
|
70
|
+
- A specification is not always immediately executed, and you have to assume that the code can change before it is executed. You can mention a function by name, but NEVER mention specific line numbers as they will become obsolete.
|
|
71
|
+
- Spell out every change to code contracts: database schema and migrations, API shapes, critical type definitions.
|
|
72
|
+
- Do not include other detailed code. Refer to source files by path or function name.
|
|
73
|
+
- Cover the full scope of the task. Never drop parts to shrink the spec — splitting work across plans is handled later by the *plan* protocol. If you anticipate a section should land in a separate plan, flag it inline (e.g. "candidate for a specialized plan").
|
|
74
|
+
- Do not include sections like "Benefits", "Code Style Compliance" or anything that adds no new information. Focus on the problem and the solution.
|
|
75
|
+
|
|
76
|
+
_Important Note:_ There will be lint errors in the markdown file you write. Ignore them. NEVER FIX LINT ERRORS (FORMATTING ISSUES) IN THE SPEC.
|
|
77
|
+
|
|
78
|
+
At the end, give the path of the spec file to the user.
|