kairn-cli 1.12.0 → 1.14.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/dist/cli.js +159 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -706,6 +706,23 @@ Use subagents for deep investigation to keep main context clean.
|
|
|
706
706
|
- Do not create abstractions for one-time operations
|
|
707
707
|
- Complete the task fully \u2014 don't gold-plate, but don't leave it half-done
|
|
708
708
|
- Prefer editing existing files over creating new ones
|
|
709
|
+
|
|
710
|
+
## First Turn Protocol
|
|
711
|
+
|
|
712
|
+
At the start of every session, before doing ANY work:
|
|
713
|
+
1. Run \`pwd && ls -la && git status --short\` to orient yourself
|
|
714
|
+
2. Check relevant runtimes (e.g. \`node --version\`, \`python3 --version\` \u2014 pick what fits this project)
|
|
715
|
+
3. Read any task-tracking files (docs/SPRINT.md, docs/DECISIONS.md)
|
|
716
|
+
4. Summarize what you see in 2-3 lines, then proceed
|
|
717
|
+
|
|
718
|
+
This saves 2-5 exploratory turns. Never ask "what files are here?" \u2014 look first.
|
|
719
|
+
|
|
720
|
+
## Completion Standards
|
|
721
|
+
|
|
722
|
+
Never mark a task "done" without running the Completion Verification checklist.
|
|
723
|
+
Tests passing is necessary but not sufficient \u2014 also verify requirements coverage,
|
|
724
|
+
state cleanliness, and review changes from the perspective of a test engineer,
|
|
725
|
+
code reviewer, and the requesting user.
|
|
709
726
|
\`\`\`
|
|
710
727
|
|
|
711
728
|
Do not add generic filler. Every line must be specific to the user's workflow.
|
|
@@ -727,6 +744,8 @@ Do not add generic filler. Every line must be specific to the user's workflow.
|
|
|
727
744
|
13. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
|
|
728
745
|
14. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
|
|
729
746
|
15. "Engineering Standards", "Tool Usage Policy", and "Code Philosophy" sections in CLAUDE.md
|
|
747
|
+
16. A "First Turn Protocol" section in CLAUDE.md (orient before working: pwd, ls, git status, check relevant runtimes, read task files)
|
|
748
|
+
17. A "Completion Standards" section in CLAUDE.md (never mark done without verifying: requirements met, tests passing, no debug artifacts, reviewed from 3 perspectives)
|
|
730
749
|
|
|
731
750
|
## Shell-Integrated Commands
|
|
732
751
|
|
|
@@ -844,7 +863,7 @@ Merge this into the settings hooks alongside the PreToolUse and PostToolUse hook
|
|
|
844
863
|
- \`/project:status\` command (live git status, recent commits, SPRINT.md overview using ! prefix)
|
|
845
864
|
- \`/project:fix\` command (takes $ARGUMENTS as issue number, plans fix, implements, tests, commits)
|
|
846
865
|
- \`/project:sprint\` command (define acceptance criteria before coding, writes to docs/SPRINT.md)
|
|
847
|
-
- \`/project:develop\` command (full development pipeline \u2014 orchestrates @architect \u2192 @planner \u2192 @implementer \u2192 @verifier \u2192 @fixer \u2192 @grill \u2192 @doc-updater through spec, plan, TDD implement, review, and doc update phases)
|
|
866
|
+
- \`/project:develop\` command (full development pipeline \u2014 orchestrates @architect \u2192 @planner \u2192 @implementer \u2192 @verifier \u2192 @fixer \u2192 @grill \u2192 @doc-updater through spec, plan, TDD implement, review, and doc update phases). MUST include a Phase 7 "Completion Gate" that runs a Completion Verification checklist before marking the feature done: re-read original requirements, confirm each is met with evidence, run test suite + lint/typecheck, review git diff for unexpected changes or debug artifacts, answer 3 perspective questions (test engineer, code reviewer, requesting user). If ANY check fails, loop back to fix before completing.
|
|
848
867
|
- A TDD skill using the 3-phase isolation pattern (RED \u2192 GREEN \u2192 REFACTOR):
|
|
849
868
|
- RED: Write failing test only. Verify it FAILS.
|
|
850
869
|
- GREEN: Write MINIMUM code to pass. Nothing extra.
|
|
@@ -1002,6 +1021,23 @@ Use subagents for deep investigation to keep main context clean.
|
|
|
1002
1021
|
- Do not create abstractions for one-time operations
|
|
1003
1022
|
- Complete the task fully \u2014 don't gold-plate, but don't leave it half-done
|
|
1004
1023
|
- Prefer editing existing files over creating new ones
|
|
1024
|
+
|
|
1025
|
+
## First Turn Protocol
|
|
1026
|
+
|
|
1027
|
+
At the start of every session, before doing ANY work:
|
|
1028
|
+
1. Run \`pwd && ls -la && git status --short\` to orient yourself
|
|
1029
|
+
2. Check relevant runtimes (e.g. \`node --version\`, \`python3 --version\` \u2014 pick what fits this project)
|
|
1030
|
+
3. Read any task-tracking files (docs/SPRINT.md, docs/DECISIONS.md)
|
|
1031
|
+
4. Summarize what you see in 2-3 lines, then proceed
|
|
1032
|
+
|
|
1033
|
+
This saves 2-5 exploratory turns. Never ask "what files are here?" \u2014 look first.
|
|
1034
|
+
|
|
1035
|
+
## Completion Standards
|
|
1036
|
+
|
|
1037
|
+
Never mark a task "done" without running the Completion Verification checklist.
|
|
1038
|
+
Tests passing is necessary but not sufficient \u2014 also verify requirements coverage,
|
|
1039
|
+
state cleanliness, and review changes from the perspective of a test engineer,
|
|
1040
|
+
code reviewer, and the requesting user.
|
|
1005
1041
|
\`\`\`
|
|
1006
1042
|
|
|
1007
1043
|
Do not add generic filler. Every line must be specific to the user's workflow.
|
|
@@ -1023,6 +1059,8 @@ Do not add generic filler. Every line must be specific to the user's workflow.
|
|
|
1023
1059
|
13. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
|
|
1024
1060
|
14. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
|
|
1025
1061
|
15. "Engineering Standards", "Tool Usage Policy", and "Code Philosophy" sections in CLAUDE.md
|
|
1062
|
+
16. A "First Turn Protocol" section in CLAUDE.md (orient before working: pwd, ls, git status, check relevant runtimes, read task files)
|
|
1063
|
+
17. A "Completion Standards" section in CLAUDE.md (never mark done without verifying: requirements met, tests passing, no debug artifacts, reviewed from 3 perspectives)
|
|
1026
1064
|
|
|
1027
1065
|
## Tool Selection Rules
|
|
1028
1066
|
|
|
@@ -1577,6 +1615,61 @@ ${agentList}
|
|
|
1577
1615
|
Type \`/project:help\` in Claude Code for a quick reference.
|
|
1578
1616
|
`;
|
|
1579
1617
|
}
|
|
1618
|
+
var BOOTSTRAP_COMMAND = `# Environment Snapshot
|
|
1619
|
+
|
|
1620
|
+
Run this command at the start of any session to gather runtime context.
|
|
1621
|
+
This saves 2-5 exploratory turns.
|
|
1622
|
+
|
|
1623
|
+
1. Run the following compound command and read the output:
|
|
1624
|
+
\`\`\`bash
|
|
1625
|
+
echo '=== WORKING DIRECTORY ===' && pwd && \\
|
|
1626
|
+
echo '=== PROJECT FILES ===' && ls -la && \\
|
|
1627
|
+
echo '=== GIT STATUS ===' && (git status --short 2>/dev/null || echo 'not a git repo') && \\
|
|
1628
|
+
echo '=== LANGUAGES ===' && \\
|
|
1629
|
+
(node --version 2>&1 || true) && \\
|
|
1630
|
+
(python3 --version 2>&1 || true) && \\
|
|
1631
|
+
(go version 2>&1 || true) && \\
|
|
1632
|
+
(rustc --version 2>&1 || true) && \\
|
|
1633
|
+
echo '=== PACKAGE MANAGERS ===' && \\
|
|
1634
|
+
(npm --version 2>&1 && echo "npm $(npm --version 2>&1)" || true) && \\
|
|
1635
|
+
(pip3 --version 2>&1 || true) && \\
|
|
1636
|
+
(cargo --version 2>&1 || true) && \\
|
|
1637
|
+
echo '=== ENVIRONMENT ===' && \\
|
|
1638
|
+
(cat .env 2>/dev/null | sed 's/=.*/=***/' || echo 'no .env file')
|
|
1639
|
+
\`\`\`
|
|
1640
|
+
|
|
1641
|
+
2. Summarize the environment in 3-4 lines:
|
|
1642
|
+
- Runtime: [languages + versions found]
|
|
1643
|
+
- Project: [framework, key deps, file count]
|
|
1644
|
+
- State: [git branch, clean/dirty, .env present]
|
|
1645
|
+
|
|
1646
|
+
3. Keep this summary in context for the rest of the session.`;
|
|
1647
|
+
function buildBootstrapHookCommand(spec) {
|
|
1648
|
+
const checks = [
|
|
1649
|
+
"echo '--- Environment Snapshot ---'",
|
|
1650
|
+
"pwd",
|
|
1651
|
+
"ls -la --color=never | head -20",
|
|
1652
|
+
"echo '---'",
|
|
1653
|
+
"git status --short 2>/dev/null || true",
|
|
1654
|
+
"echo '---'"
|
|
1655
|
+
];
|
|
1656
|
+
const md = (spec.harness.claude_md ?? "").toLowerCase();
|
|
1657
|
+
if (md.includes("node") || md.includes("typescript") || md.includes("javascript") || md.includes("react") || md.includes("next")) {
|
|
1658
|
+
checks.push("node --version 2>&1 || true");
|
|
1659
|
+
checks.push("cat package.json 2>/dev/null | head -5 || true");
|
|
1660
|
+
}
|
|
1661
|
+
if (md.includes("python") || md.includes("django") || md.includes("flask") || md.includes("fastapi")) {
|
|
1662
|
+
checks.push("python3 --version 2>&1 || true");
|
|
1663
|
+
}
|
|
1664
|
+
if (md.includes("rust") || md.includes("cargo")) {
|
|
1665
|
+
checks.push("rustc --version 2>&1 || true");
|
|
1666
|
+
}
|
|
1667
|
+
if (md.includes("go ") || md.includes("golang")) {
|
|
1668
|
+
checks.push("go version 2>&1 || true");
|
|
1669
|
+
}
|
|
1670
|
+
checks.push("cat .env 2>/dev/null | sed 's/=.*/=***/' || true");
|
|
1671
|
+
return checks.join(" && ");
|
|
1672
|
+
}
|
|
1580
1673
|
var LOOP_COMMAND_CODE = `# Development Loop
|
|
1581
1674
|
|
|
1582
1675
|
Run an assisted development cycle for the next feature.
|
|
@@ -1605,7 +1698,29 @@ If confidence is LOW or MEDIUM, fix issues and re-verify.
|
|
|
1605
1698
|
Run /project:grill for adversarial review.
|
|
1606
1699
|
Fix any BLOCKERs.
|
|
1607
1700
|
|
|
1608
|
-
## Phase 6:
|
|
1701
|
+
## Phase 6: COMPLETION GATE
|
|
1702
|
+
|
|
1703
|
+
Before shipping, run the Completion Verification checklist:
|
|
1704
|
+
|
|
1705
|
+
### Requirements Check
|
|
1706
|
+
- [ ] Re-read the ORIGINAL task description (not your interpretation)
|
|
1707
|
+
- [ ] Each explicit requirement is met with evidence (test output, diff)
|
|
1708
|
+
- [ ] Each implicit requirement (error handling, types, tests) is addressed
|
|
1709
|
+
|
|
1710
|
+
### State Check
|
|
1711
|
+
- [ ] Test suite passes
|
|
1712
|
+
- [ ] Lint/typecheck passes
|
|
1713
|
+
- [ ] \`git diff --stat\` \u2014 every changed file is intentional
|
|
1714
|
+
- [ ] No debug artifacts (console.log, TODO, commented-out code, temp files)
|
|
1715
|
+
|
|
1716
|
+
### Perspective Check (1 sentence each)
|
|
1717
|
+
- **Test engineer:** Most likely production failure mode?
|
|
1718
|
+
- **Code reviewer:** What would I flag in review?
|
|
1719
|
+
- **Requesting user:** Does this solve my actual problem?
|
|
1720
|
+
|
|
1721
|
+
ALL pass \u2192 proceed to ship. ANY fail \u2192 fix first, then re-verify.
|
|
1722
|
+
|
|
1723
|
+
## Phase 7: SHIP
|
|
1609
1724
|
Run /project:commit.
|
|
1610
1725
|
Report what was built and what's next from docs/SPRINT.md.
|
|
1611
1726
|
|
|
@@ -1685,11 +1800,26 @@ Run verification:
|
|
|
1685
1800
|
- Run functional tests
|
|
1686
1801
|
- If NEEDS FIXES: fix and re-verify
|
|
1687
1802
|
|
|
1688
|
-
## Phase 5:
|
|
1803
|
+
## Phase 5: COMPLETION GATE
|
|
1804
|
+
|
|
1805
|
+
Before creating a PR, run the Completion Verification checklist:
|
|
1806
|
+
- [ ] Re-read the ORIGINAL spec from docs/SPRINT.md
|
|
1807
|
+
- [ ] Each requirement is met with evidence (test output, diff)
|
|
1808
|
+
- [ ] Test suite + lint/typecheck pass
|
|
1809
|
+
- [ ] \`git diff --stat\` \u2014 every changed file is intentional, no debug artifacts
|
|
1810
|
+
- **Test engineer:** Most likely production failure mode?
|
|
1811
|
+
- **Code reviewer:** What would I flag in review?
|
|
1812
|
+
- **Requesting user:** Does this solve my actual problem?
|
|
1813
|
+
|
|
1814
|
+
ALL pass \u2192 proceed to PR. ANY fail \u2192 fix first, then re-verify.
|
|
1815
|
+
|
|
1816
|
+
Include the checklist results in the PR description.
|
|
1817
|
+
|
|
1818
|
+
## Phase 6: PR
|
|
1689
1819
|
Create a pull request:
|
|
1690
|
-
gh pr create --title "feat: {name}" --body "{spec + QA report}"
|
|
1820
|
+
gh pr create --title "feat: {name}" --body "{spec + QA report + verification checklist}"
|
|
1691
1821
|
|
|
1692
|
-
## Phase
|
|
1822
|
+
## Phase 7: NEXT
|
|
1693
1823
|
Report:
|
|
1694
1824
|
"PR #{N} ready for review: {link}
|
|
1695
1825
|
Next priority from SPRINT.md: {next task}
|
|
@@ -1713,13 +1843,19 @@ Repeat until max features reached or stopped:
|
|
|
1713
1843
|
2. Create worktree + branch
|
|
1714
1844
|
3. Implement the feature
|
|
1715
1845
|
4. Run verification (build, test, lint)
|
|
1716
|
-
5.
|
|
1717
|
-
|
|
1718
|
-
|
|
1846
|
+
5. Run Completion Verification checklist:
|
|
1847
|
+
- Requirements met with evidence
|
|
1848
|
+
- Tests + lint/typecheck pass
|
|
1849
|
+
- No debug artifacts or unexpected file changes
|
|
1850
|
+
- 3-perspective check (test engineer, reviewer, user)
|
|
1851
|
+
6. Open PR via gh (include verification results in PR body)
|
|
1852
|
+
7. Report status
|
|
1853
|
+
8. Move to next feature
|
|
1719
1854
|
|
|
1720
1855
|
## Stop Conditions
|
|
1721
1856
|
- Max 5 features per autopilot session
|
|
1722
1857
|
- Any BLOCKER from verification
|
|
1858
|
+
- Completion Verification checklist fails after 2 fix attempts
|
|
1723
1859
|
- Build failure that can't be resolved in 3 attempts
|
|
1724
1860
|
- User presses Escape`;
|
|
1725
1861
|
var AUTOPILOT_WARNING = `
|
|
@@ -1750,6 +1886,9 @@ function applyAutonomyLevel(spec) {
|
|
|
1750
1886
|
settings.hooks = hooks;
|
|
1751
1887
|
}
|
|
1752
1888
|
if (level >= 2) {
|
|
1889
|
+
if (!("bootstrap" in commands)) {
|
|
1890
|
+
commands.bootstrap = BOOTSTRAP_COMMAND;
|
|
1891
|
+
}
|
|
1753
1892
|
if (!("loop" in commands)) {
|
|
1754
1893
|
commands.loop = isResearchProject(spec) ? LOOP_COMMAND_RESEARCH : LOOP_COMMAND_CODE;
|
|
1755
1894
|
}
|
|
@@ -1761,6 +1900,18 @@ function applyAutonomyLevel(spec) {
|
|
|
1761
1900
|
if (!("auto" in commands)) {
|
|
1762
1901
|
commands.auto = AUTO_COMMAND;
|
|
1763
1902
|
}
|
|
1903
|
+
const hooks = settings.hooks ?? {};
|
|
1904
|
+
const sessionStart = hooks.SessionStart ?? [];
|
|
1905
|
+
const bootstrapHook = {
|
|
1906
|
+
matcher: "",
|
|
1907
|
+
hooks: [{
|
|
1908
|
+
type: "command",
|
|
1909
|
+
command: buildBootstrapHookCommand(spec)
|
|
1910
|
+
}]
|
|
1911
|
+
};
|
|
1912
|
+
sessionStart.push(bootstrapHook);
|
|
1913
|
+
hooks.SessionStart = sessionStart;
|
|
1914
|
+
settings.hooks = hooks;
|
|
1764
1915
|
}
|
|
1765
1916
|
if (level >= 4) {
|
|
1766
1917
|
if (!("autopilot" in commands)) {
|