thachvd-kit 1.0.33 → 1.0.35
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 +75 -19
- package/bin/cli.js +187 -103
- package/bin/entry.js +60 -0
- package/bin/global.js +103 -0
- package/bin/matt-skills.js +191 -0
- package/bin/policy.js +8 -4
- package/bin/upgrade.js +298 -0
- package/package.json +3 -3
package/bin/cli.js
CHANGED
|
@@ -6,6 +6,15 @@ const { spawnSync } = require('child_process');
|
|
|
6
6
|
const prompts = require('prompts');
|
|
7
7
|
const pc = require('picocolors');
|
|
8
8
|
const packageJson = require('../package.json');
|
|
9
|
+
const mattSkills = require('./matt-skills');
|
|
10
|
+
const {
|
|
11
|
+
QUALITY_FLOOR_SECTION,
|
|
12
|
+
AGENT_RULES_SECTION,
|
|
13
|
+
CONVENTIONS_STANDARDS_SECTION,
|
|
14
|
+
FAST_PATH_SECTION,
|
|
15
|
+
GETTING_STARTED_FAST_PATH_SECTION,
|
|
16
|
+
TOOL_ROUTING_SECTION
|
|
17
|
+
} = require('./policy');
|
|
9
18
|
|
|
10
19
|
const sourceDir = path.resolve(__dirname, '..');
|
|
11
20
|
const targetDir = process.cwd();
|
|
@@ -36,17 +45,25 @@ function printHelp() {
|
|
|
36
45
|
console.log(`
|
|
37
46
|
${pc.bold('Usage:')}
|
|
38
47
|
thachvd-kit init [--yes]
|
|
39
|
-
thachvd-kit
|
|
48
|
+
thachvd-kit upgrade [--dry-run]
|
|
49
|
+
thachvd-kit global [--dry-run] [--antigravity-only|--codex-only]
|
|
50
|
+
thachvd-kit setup [--yes] [--no-install-skills]
|
|
40
51
|
thachvd-kit doctor
|
|
41
52
|
thachvd-kit prompt
|
|
53
|
+
thachvd-kit skills install [--dry-run]
|
|
54
|
+
thachvd-kit skills check
|
|
55
|
+
thachvd-kit skills update [--dry-run]
|
|
42
56
|
thachvd-kit --version
|
|
43
57
|
thachvd-kit --help
|
|
44
58
|
|
|
45
59
|
${pc.bold('Commands:')}
|
|
46
|
-
init Generate project context files and documentation
|
|
47
|
-
|
|
60
|
+
init Generate project context files and documentation (new projects)
|
|
61
|
+
upgrade Safely add/update thachvd-kit's managed policy blocks in an existing project (does not rescan or regenerate)
|
|
62
|
+
global Patch a managed tool-routing block into the current user's Antigravity/Codex global instructions
|
|
63
|
+
setup Install/configure MCP, Matt Pocock skills, and recommended local tooling
|
|
48
64
|
doctor Check project context and local integrations
|
|
49
65
|
prompt Print the saved project-indexing prompt again
|
|
66
|
+
skills Install, check, or update the promoted Matt Pocock skill set
|
|
50
67
|
|
|
51
68
|
${pc.bold('Options:')}
|
|
52
69
|
--yes Overwrite generated files or accept setup defaults
|
|
@@ -54,6 +71,10 @@ ${pc.bold('Options:')}
|
|
|
54
71
|
--no-setup-hook Skip the Claude Code Definition-of-Done Stop hook during setup
|
|
55
72
|
--no-install-rtk Skip auto-installing rtk via cargo during setup
|
|
56
73
|
--no-index Skip auto-indexing the repository with codebase-memory-mcp during setup
|
|
74
|
+
--no-install-skills Skip installing Matt Pocock skills during setup
|
|
75
|
+
--dry-run Preview a change without writing it (upgrade/global/skills install/skills update)
|
|
76
|
+
--antigravity-only Limit global to the Antigravity global instructions
|
|
77
|
+
--codex-only Limit global to the Codex global instructions
|
|
57
78
|
--version Show the installed CLI version
|
|
58
79
|
--help Show this help message
|
|
59
80
|
|
|
@@ -64,19 +85,15 @@ ${pc.bold('What gets generated:')}
|
|
|
64
85
|
.cursorrules Cursor entry file that points to AGENTS.md
|
|
65
86
|
.agent/docs/ Project context, architecture, workflow, tooling, and durable onboarding prompt
|
|
66
87
|
|
|
67
|
-
${pc.bold('Workflow
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Bug or failing behavior systematic-debugging Find the root cause before editing
|
|
73
|
-
Pre-merge review requesting-code-review Review before completion or merge
|
|
74
|
-
UI / UX work $frontend-design, $webapp-testing
|
|
75
|
-
Project state thachvd-kit doctor
|
|
88
|
+
${pc.bold('Workflow:')}
|
|
89
|
+
Matt Pocock's promoted skills (installed under .agents/skills/) are the
|
|
90
|
+
workflow layer. Use the matching skill when a specialized workflow is
|
|
91
|
+
useful; if unsure which one, use /ask-matt. Do not invoke a heavyweight
|
|
92
|
+
skill for a localized, obvious change.
|
|
76
93
|
|
|
77
94
|
${pc.bold('Tip:')}
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
Run thachvd-kit setup to install the promoted skill set and configure
|
|
96
|
+
local tooling, then thachvd-kit doctor to verify the machine.
|
|
80
97
|
`);
|
|
81
98
|
}
|
|
82
99
|
|
|
@@ -742,7 +759,6 @@ function scanProject() {
|
|
|
742
759
|
infrastructure: uniq(infrastructure),
|
|
743
760
|
ci_cd: ciCd,
|
|
744
761
|
test_framework: TEST_FRAMEWORK_CHOICES.includes(testFramework) ? testFramework : 'auto-detect',
|
|
745
|
-
max_file_lines: '300',
|
|
746
762
|
code_style: 'project-standard',
|
|
747
763
|
architecture_notes: '<!-- Add notes -->',
|
|
748
764
|
current_phase: 'Initial setup',
|
|
@@ -769,35 +785,33 @@ If any \`.agent/docs/*.md\` file still contains \`TODO: refine\`, update the doc
|
|
|
769
785
|
|
|
770
786
|
## Workflow
|
|
771
787
|
|
|
772
|
-
|
|
788
|
+
Matt Pocock's promoted skills (installed under \`.agents/skills/\` by \`thachvd-kit setup\`) are the workflow layer. Use the matching skill when a specialized workflow is useful:
|
|
773
789
|
|
|
774
|
-
-
|
|
775
|
-
-
|
|
776
|
-
-
|
|
777
|
-
-
|
|
778
|
-
-
|
|
779
|
-
-
|
|
790
|
+
- Clear, localized change: inspect -> edit -> focused verification. Do not force a heavyweight skill.
|
|
791
|
+
- Ambiguous feature or design: \`/grill-with-docs\`, then optionally \`/to-spec\` for a durable contract.
|
|
792
|
+
- Normal feature: \`/grill-with-docs\` -> \`/to-spec\` -> \`/implement\`.
|
|
793
|
+
- Large feature needing decomposition: add \`/to-tickets\` before \`/implement\`.
|
|
794
|
+
- Huge, multi-session uncertainty: \`/wayfinder\`.
|
|
795
|
+
- Bug or failing behavior: \`/diagnosing-bugs\`.
|
|
796
|
+
- Test-driven implementation: \`/tdd\` (skip the ceremony for trivial config/text changes).
|
|
797
|
+
- Architecture survey: \`/improve-codebase-architecture\`; use \`/codebase-design\` as the design vocabulary.
|
|
798
|
+
- Pre-completion review: \`/code-review\` once when code risk warrants it.
|
|
780
799
|
|
|
781
|
-
|
|
800
|
+
If unsure which skill fits, use \`/ask-matt\`.
|
|
782
801
|
|
|
783
|
-
|
|
802
|
+
Questions and research do not edit product code. A fast path is allowed only when the change is localized, mechanically obvious, low-risk, and has focused verification; file count alone is not a gate. State the scope and verification before editing. If the task becomes ambiguous or its behavior, contract, or risk surface grows, use the matching planning skill above instead.
|
|
784
803
|
|
|
785
|
-
|
|
804
|
+
See \`.agent/docs/workflow.md\` for the full route matrix. This kit does not implement a second workflow engine; it only installs and checks the promoted skill set (\`thachvd-kit skills install|check|update\`).
|
|
786
805
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
- Keep changes surgical and remove only dead code introduced by your change.
|
|
791
|
-
- **MCP First**: Prioritize \`codebase-memory-mcp\` for symbols, call paths, architecture, and impact; use \`context7\` for API/docs queries and \`playwright\` for browser/UI verification. Fall back to normal file search when an integration is unavailable.
|
|
792
|
-
- Prefer \`rtk\` by default for verbose shell commands such as \`rtk git status\`, \`rtk npm test\`, and \`rtk git log\`. Run the underlying command directly only when RTK is unavailable or incompatible.
|
|
793
|
-
- Tests or equivalent verification are mandatory before claiming done.
|
|
794
|
-
- Keep files under ${data.max_file_lines || '300'} lines unless the project already has a different standard in \`.agent/docs/conventions.md\`.
|
|
806
|
+
${QUALITY_FLOOR_SECTION}
|
|
807
|
+
|
|
808
|
+
${AGENT_RULES_SECTION}
|
|
795
809
|
|
|
796
810
|
## Shared Knowledge
|
|
797
811
|
|
|
798
812
|
- Project context: \`.agent/docs/\`
|
|
799
813
|
- Tooling setup: \`.agent/docs/tooling.md\`
|
|
800
|
-
-
|
|
814
|
+
- Matt Pocock skills: promoted set installed under \`.agents/skills/\` via \`thachvd-kit skills install\`
|
|
801
815
|
- RTK: recommended local CLI for compact command output
|
|
802
816
|
- Antigravity and Cursor entry rules: \`GEMINI.md\` and \`.cursorrules\`
|
|
803
817
|
`;
|
|
@@ -807,7 +821,7 @@ function generateIndexProjectPrompt() {
|
|
|
807
821
|
return `# Project Indexing Prompt
|
|
808
822
|
|
|
809
823
|
Read CLAUDE.md (if using Claude Code), AGENTS.md, and all files under .agent/docs/.
|
|
810
|
-
Use
|
|
824
|
+
Use the project's Matt Pocock skills for workflow (see AGENTS.md; run /ask-matt if unsure which fits) and use codebase-memory MCP for structural code discovery when available.
|
|
811
825
|
Ask me what this project does and any important conventions I want preserved.
|
|
812
826
|
Then scan this repository and refine the generated context docs with factual rules.
|
|
813
827
|
Do not implement product code during onboarding.
|
|
@@ -985,16 +999,12 @@ Before non-trivial implementation work, inspect this file. If it is stale or sti
|
|
|
985
999
|
`;
|
|
986
1000
|
}
|
|
987
1001
|
|
|
988
|
-
function generateConventionsDoc(
|
|
1002
|
+
function generateConventionsDoc() {
|
|
989
1003
|
return `# Coding Conventions
|
|
990
1004
|
|
|
991
|
-
|
|
1005
|
+
${CONVENTIONS_STANDARDS_SECTION}
|
|
992
1006
|
|
|
993
|
-
|
|
994
|
-
- Code comments and identifiers should be written in English.
|
|
995
|
-
- Keep changes scoped to the user request.
|
|
996
|
-
- Prefer existing local patterns over introducing new abstractions.
|
|
997
|
-
- TODO: refine naming, formatting, folder, API, state, styling, and testing conventions from the real codebase.
|
|
1007
|
+
${QUALITY_FLOOR_SECTION}
|
|
998
1008
|
|
|
999
1009
|
## Verification
|
|
1000
1010
|
|
|
@@ -1008,34 +1018,38 @@ function generateConventionsDoc(data) {
|
|
|
1008
1018
|
function generateWorkflowDoc() {
|
|
1009
1019
|
return `# Agent Workflow
|
|
1010
1020
|
|
|
1011
|
-
This project uses
|
|
1021
|
+
This project uses Matt Pocock's promoted skills (installed under .agents/skills/ by \`thachvd-kit setup\`) as the workflow layer. thachvd-kit only provides project context, the skill manifest, and integration setup; it is not a second workflow engine.
|
|
1012
1022
|
|
|
1013
1023
|
## Before Every Task
|
|
1014
1024
|
|
|
1015
1025
|
1. Read AGENTS.md and the relevant files under .agent/docs/.
|
|
1016
|
-
2. Use the
|
|
1026
|
+
2. Use the promoted skill that matches the request, or run /ask-matt if unsure which one fits.
|
|
1017
1027
|
3. Use codebase-memory MCP for structural discovery when available.
|
|
1018
|
-
4. Make changes only after the required planning gate.
|
|
1028
|
+
4. Make changes only after the required planning gate for that situation.
|
|
1019
1029
|
5. Verify the change and request review before completion.
|
|
1020
1030
|
|
|
1021
1031
|
## Route Matrix
|
|
1022
1032
|
|
|
1023
|
-
| Situation |
|
|
1033
|
+
| Situation | Skill | Gate |
|
|
1024
1034
|
|---|---|---|
|
|
1025
1035
|
| Question or research only | direct answer or research | no product-code edits |
|
|
1026
|
-
|
|
|
1027
|
-
|
|
|
1028
|
-
|
|
|
1029
|
-
|
|
|
1030
|
-
|
|
|
1036
|
+
| Clear, localized change | fast path (no skill) | inspect -> edit -> focused verify |
|
|
1037
|
+
| Ambiguous feature or design | /grill-with-docs, then optionally /to-spec | durable contract before implementation when useful |
|
|
1038
|
+
| Normal feature | /grill-with-docs -> /to-spec -> /implement | spec agreed before implementation |
|
|
1039
|
+
| Large feature needing decomposition | /grill-with-docs -> /to-spec -> /to-tickets -> /implement | tickets agreed before implementation |
|
|
1040
|
+
| Huge, multi-session uncertainty | /wayfinder | shared decision map before implementation |
|
|
1041
|
+
| Bug or failing behavior | /diagnosing-bugs | reproduce -> root cause -> regression protection -> fix -> verify |
|
|
1042
|
+
| Test-driven implementation | /tdd | red -> green -> refactor per slice |
|
|
1043
|
+
| Architecture survey | /improve-codebase-architecture (+ /codebase-design vocabulary) | findings reviewed before large refactors |
|
|
1044
|
+
| Pre-merge | /code-review | blocking findings resolved |
|
|
1045
|
+
|
|
1046
|
+
Not sure which row applies? Run /ask-matt instead of guessing.
|
|
1031
1047
|
|
|
1032
1048
|
## Standard Feature Flow
|
|
1033
1049
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
## Fast Path
|
|
1050
|
+
/grill-with-docs -> /to-spec -> (/to-tickets for large work) -> /implement (with /tdd where it helps) -> /code-review.
|
|
1037
1051
|
|
|
1038
|
-
|
|
1052
|
+
${FAST_PATH_SECTION}
|
|
1039
1053
|
|
|
1040
1054
|
## Documentation Maintenance
|
|
1041
1055
|
|
|
@@ -1049,33 +1063,31 @@ Use it only for one-file, unambiguous changes with no behavior, API, schema, sec
|
|
|
1049
1063
|
function generateGettingStartedDoc() {
|
|
1050
1064
|
return `# Getting Started
|
|
1051
1065
|
|
|
1052
|
-
thachvd-kit creates project context.
|
|
1066
|
+
thachvd-kit creates project context. Matt Pocock's promoted skills own the development workflow.
|
|
1053
1067
|
|
|
1054
1068
|
## Setup
|
|
1055
1069
|
|
|
1056
1070
|
1. Run \`thachvd-kit init\` in the repository.
|
|
1057
1071
|
2. Open or print \`.agent/docs/index-project-prompt.md\` with \`thachvd-kit prompt\`.
|
|
1058
|
-
3.
|
|
1059
|
-
4.
|
|
1072
|
+
3. Run \`thachvd-kit setup\` (installs the promoted skill set by default; add \`--no-install-skills\` to skip) and RTK.
|
|
1073
|
+
4. Inside the AI client, run \`/setup-matt-pocock-skills\` once to configure the issue tracker, triage labels, and doc layout.
|
|
1074
|
+
5. Run \`thachvd-kit doctor\` and restart the AI client.
|
|
1060
1075
|
|
|
1061
1076
|
## Standard Flow
|
|
1062
1077
|
|
|
1063
|
-
|
|
1078
|
+
1. \`/grill-with-docs\` for unclear requirements or design.
|
|
1079
|
+
2. \`/to-spec\` when a durable implementation contract is useful.
|
|
1080
|
+
3. \`/to-tickets\` for large work that benefits from decomposition.
|
|
1081
|
+
4. \`/implement\`, with \`/tdd\` where red-green-refactor helps.
|
|
1082
|
+
5. \`/code-review\` once before completion.
|
|
1064
1083
|
|
|
1065
|
-
|
|
1066
|
-
2. \`using-git-worktrees\` for isolated work.
|
|
1067
|
-
3. \`writing-plans\`, then wait for explicit approval.
|
|
1068
|
-
4. \`test-driven-development\` and \`executing-plans\` or \`subagent-driven-development\`.
|
|
1069
|
-
5. \`requesting-code-review\` and \`verification-before-completion\`.
|
|
1070
|
-
6. \`finishing-a-development-branch\`.
|
|
1084
|
+
Not sure which skill fits? Run \`/ask-matt\`.
|
|
1071
1085
|
|
|
1072
1086
|
## Bug Flow
|
|
1073
1087
|
|
|
1074
|
-
Use
|
|
1088
|
+
Use \`/diagnosing-bugs\`: reproduce the symptom, inspect the path with codebase-memory MCP, test hypotheses, add regression protection, fix the root cause, and verify.
|
|
1075
1089
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
Use a fast path only for one-file, unambiguous changes with no behavior or contract change. State the scope and verification before editing. If the scope expands, return to brainstorming and writing-plans.
|
|
1090
|
+
${GETTING_STARTED_FAST_PATH_SECTION}
|
|
1079
1091
|
`;
|
|
1080
1092
|
}
|
|
1081
1093
|
|
|
@@ -1102,19 +1114,20 @@ function generateToolingDoc(data) {
|
|
|
1102
1114
|
|
|
1103
1115
|
return `# Optional Tooling
|
|
1104
1116
|
|
|
1105
|
-
Run \`thachvd-kit doctor\` to check the current machine.
|
|
1117
|
+
Run \`thachvd-kit doctor\` to check the current machine.
|
|
1106
1118
|
|
|
1107
|
-
##
|
|
1119
|
+
## Matt Pocock Skills
|
|
1108
1120
|
|
|
1109
|
-
|
|
1121
|
+
Matt Pocock's promoted engineering and productivity skills are the workflow layer for this project, installed project-locally under \`.agents/skills/\` (never globally):
|
|
1110
1122
|
|
|
1111
|
-
-
|
|
1112
|
-
-
|
|
1113
|
-
-
|
|
1114
|
-
-
|
|
1115
|
-
-
|
|
1123
|
+
- Install the promoted set: \`thachvd-kit skills install\` (\`--dry-run\` to preview the command without running it)
|
|
1124
|
+
- Check what is installed: \`thachvd-kit skills check\` (read-only)
|
|
1125
|
+
- Update the promoted set: \`thachvd-kit skills update\` (re-adds each skill individually for safety, so it is slower than install — one network clone per skill)
|
|
1126
|
+
- The full manifest lives in \`bin/matt-skills.js\` (\`PROMOTED_SKILLS\`); it mirrors upstream's \`skills/engineering/\` + \`skills/productivity/\` catalog and never includes \`in-progress\`, \`misc\`, or \`deprecated\` skills.
|
|
1127
|
+
- After the first install, run \`/setup-matt-pocock-skills\` once inside the AI client to configure the issue tracker, triage labels, and generated docs location. thachvd-kit does not simulate that skill.
|
|
1128
|
+
- Unsure which skill fits a task? Run \`/ask-matt\`.
|
|
1116
1129
|
|
|
1117
|
-
|
|
1130
|
+
${TOOL_ROUTING_SECTION}
|
|
1118
1131
|
|
|
1119
1132
|
## Codebase Memory MCP
|
|
1120
1133
|
|
|
@@ -1167,17 +1180,8 @@ function homePath(...parts) {
|
|
|
1167
1180
|
return home ? path.join(home, ...parts) : null;
|
|
1168
1181
|
}
|
|
1169
1182
|
|
|
1170
|
-
function
|
|
1171
|
-
console.log(`
|
|
1172
|
-
${pc.bold('Superpowers setup')} (official client integrations)
|
|
1173
|
-
Claude Code: /plugin install superpowers@claude-plugins-official
|
|
1174
|
-
Antigravity: agy plugin install https://github.com/obra/superpowers
|
|
1175
|
-
Codex App: install Superpowers from the Plugins sidebar
|
|
1176
|
-
Codex CLI: open /plugins, search Superpowers, then Install Plugin
|
|
1177
|
-
Cursor: /add-plugin superpowers
|
|
1178
|
-
|
|
1179
|
-
Full guide: https://github.com/obra/superpowers#installation
|
|
1180
|
-
`);
|
|
1183
|
+
function printMattSkillsSetupReminder() {
|
|
1184
|
+
console.log(` Run ${pc.bold('/setup-matt-pocock-skills')} once inside your AI client to configure the issue tracker, triage labels, and generated docs location.`);
|
|
1181
1185
|
}
|
|
1182
1186
|
|
|
1183
1187
|
function runDoctor() {
|
|
@@ -1191,10 +1195,7 @@ function runDoctor() {
|
|
|
1191
1195
|
|
|
1192
1196
|
const tools = [
|
|
1193
1197
|
[CODEBASE_MEMORY_BINARY, `npm install -g ${CODEBASE_MEMORY_PACKAGE}`],
|
|
1194
|
-
['rtk', `recommended: ${RTK_INSTALL_COMMAND}`]
|
|
1195
|
-
['agy', 'install Antigravity before running its Superpowers plugin command'],
|
|
1196
|
-
['claude', 'install Claude Code before installing its Superpowers plugin'],
|
|
1197
|
-
['codex', 'install Codex before using its Superpowers plugin']
|
|
1198
|
+
['rtk', `recommended: ${RTK_INSTALL_COMMAND}`]
|
|
1198
1199
|
];
|
|
1199
1200
|
console.log(`\n${pc.bold('Local integrations (RTK recommended)')}`);
|
|
1200
1201
|
for (const [binary, hint] of tools) {
|
|
@@ -1202,6 +1203,21 @@ function runDoctor() {
|
|
|
1202
1203
|
console.log(` ${ok ? pc.green('OK') : pc.yellow('WARN')} ${binary}${ok ? '' : ` - ${hint}`}`);
|
|
1203
1204
|
}
|
|
1204
1205
|
|
|
1206
|
+
console.log(`\n${pc.bold('Matt Pocock skills')}`);
|
|
1207
|
+
const skillStatus = mattSkills.checkSkills(targetDir);
|
|
1208
|
+
if (skillStatus.missing.length === 0) {
|
|
1209
|
+
console.log(` ${pc.green('OK')} promoted skill set installed (${skillStatus.total}/${skillStatus.total})`);
|
|
1210
|
+
} else {
|
|
1211
|
+
console.log(` ${pc.yellow('WARN')} ${skillStatus.missing.length} promoted skill(s) missing`);
|
|
1212
|
+
console.log(` Run: ${pc.bold('thachvd-kit skills install')}`);
|
|
1213
|
+
}
|
|
1214
|
+
const setupSkillOk = mattSkills.isSkillInstalled(targetDir, mattSkills.SETUP_SKILL_NAME);
|
|
1215
|
+
console.log(` ${setupSkillOk ? pc.green('OK') : pc.yellow('WARN')} ${mattSkills.SETUP_SKILL_NAME} available`);
|
|
1216
|
+
const contextMdExists = fs.existsSync(path.join(targetDir, 'CONTEXT.md'));
|
|
1217
|
+
const docsAdrExists = fs.existsSync(path.join(targetDir, 'docs', 'adr'));
|
|
1218
|
+
console.log(` ${pc.dim('-')} CONTEXT.md ${contextMdExists ? 'detected' : 'not created yet (informational only)'}`);
|
|
1219
|
+
console.log(` ${pc.dim('-')} docs/adr ${docsAdrExists ? 'detected' : 'not created yet (informational only)'}`);
|
|
1220
|
+
|
|
1205
1221
|
console.log(`\n${pc.bold('Next step')}`);
|
|
1206
1222
|
console.log(' Run thachvd-kit prompt to print the saved project-indexing prompt.');
|
|
1207
1223
|
}
|
|
@@ -1211,8 +1227,25 @@ async function runSetup(args) {
|
|
|
1211
1227
|
const skipHookSetup = args.includes('--no-setup-hook');
|
|
1212
1228
|
const skipRtkInstall = args.includes('--no-install-rtk');
|
|
1213
1229
|
const skipIndex = args.includes('--no-index');
|
|
1230
|
+
const skipSkillsInstall = args.includes('--no-install-skills');
|
|
1214
1231
|
console.log(pc.bold(pc.cyan('thachvd-kit setup')));
|
|
1215
|
-
|
|
1232
|
+
if (!skipSkillsInstall) {
|
|
1233
|
+
console.log(pc.bold('Matt Pocock skills'));
|
|
1234
|
+
const skillStatus = mattSkills.checkSkills(targetDir);
|
|
1235
|
+
if (skillStatus.missing.length === 0) {
|
|
1236
|
+
// Already fully installed: `setup` only ensures presence, it
|
|
1237
|
+
// never re-installs or updates on its own. Explicit
|
|
1238
|
+
// `thachvd-kit skills update` is required for that.
|
|
1239
|
+
console.log(` ${pc.green('OK')} promoted skill set already installed (${skillStatus.total}/${skillStatus.total})`);
|
|
1240
|
+
} else {
|
|
1241
|
+
const skillsResult = mattSkills.installSkills(targetDir);
|
|
1242
|
+
const skillsMarker = skillsResult.ok ? pc.green('OK') : pc.yellow('WARN');
|
|
1243
|
+
console.log(` ${skillsMarker} ${skillsResult.message}`);
|
|
1244
|
+
}
|
|
1245
|
+
printMattSkillsSetupReminder();
|
|
1246
|
+
} else {
|
|
1247
|
+
console.log(`${pc.bold('Matt Pocock skills')}\n ${pc.dim('skipped (--no-install-skills)')}`);
|
|
1248
|
+
}
|
|
1216
1249
|
if (!skipMcpSetup) {
|
|
1217
1250
|
console.log(pc.bold('MCP setup'));
|
|
1218
1251
|
for (const result of setupMcpServers({ install: true })) {
|
|
@@ -1393,7 +1426,7 @@ tool_timeout_sec = 120
|
|
|
1393
1426
|
const DOD_HOOK_MARKER = 'feature/refactor Definition-of-Done gate';
|
|
1394
1427
|
|
|
1395
1428
|
function generateDodStopHookPrompt() {
|
|
1396
|
-
return `Input JSON (Stop hook payload): $ARGUMENTS\n\nCheck this project's ${DOD_HOOK_MARKER}. This kit does not define its own workflow steps; it only verifies that evidence of the gate exists,
|
|
1429
|
+
return `Input JSON (Stop hook payload): $ARGUMENTS\n\nCheck this project's ${DOD_HOOK_MARKER}. This kit does not define its own workflow steps or require any specific workflow skill; it only verifies that evidence of the gate exists, however that evidence was produced (a documented planning/review skill, a manual process, or anything equivalent). Use the \`last_assistant_message\` field as the authoritative final response. Use \`transcript_path\` only for additional context because the transcript may not contain the final response yet.\n\nVerification is never optional: every change, fast path included, requires semantic evidence in the final response or visible transcript that focused tests or equivalent verification actually ran and passed (for example test/build output, or a described manual verification). Do not require a specific command; judge the evidence on its meaning.\n\nFor any change that is not a verified fast path (see below), completion additionally requires evidence of:\n- Plan: a plan was written and explicitly approved by the human before implementation started.\n- Review: the change was reviewed (correctness, simplicity, architecture, security, performance) and blocking issues were resolved.\n\nFast-path eligibility is based on risk and contract surface, not file count. A change is fast path only when it is localized, mechanically obvious, low-risk, and has no meaningful public API, schema, auth/security, data-integrity, payment, concurrency, dependency, CI/release, or architectural risk, with focused verification available. A source file plus its own focused test can still be fast path; a one-file auth, payment, schema, security, or concurrency change is not fast path no matter how small. A verified fast-path change is exempt from the Plan and Review evidence only when the final response states FAST_PATH: simple-fix, its reason, and its narrow scope — Verification evidence is still mandatory in that case, not optional.\n\nSteps:\n1. If the input JSON has \`stop_hook_active: true\`, allow stopping immediately (already checked once this cycle; never block twice in a row).\n2. Inspect the changed files and the \`last_assistant_message\` field.\n3. If no source files changed or the final response does not claim the task is done/complete, allow stopping.\n4. If the final response explicitly contains FAST_PATH: simple-fix, first check the claim against the risk criteria above, not file count. If it actually touches one of those risk areas regardless of file count, the FAST_PATH claim is invalid; treat it as a full feature/refactor change and continue to step 5. Otherwise, look for semantic evidence that focused verification actually ran and passed. If that evidence is present, allow stopping. If it is missing, block with {"ok": false, "reason": "Missing Verification evidence: ..."}.\n5. If the final response claims completion for a change that is not a verified fast path, check all three gates: (a) a plan was written and explicitly approved by the human before implementation started; (b) the change was reviewed and blocking issues were resolved; (c) tests or equivalent verification ran and passed. If any one of the three is missing, block naming exactly that gate; a generic statement that the task was simple, or that it touched only one file, is not enough on its own.\n6. Return exactly JSON: {"ok": true} to allow stopping, or {"ok": false, "reason": "..."} to block.\n\nWhen blocking, name exactly which gate is missing without prescribing which skill or workflow must produce it.`;
|
|
1397
1430
|
}
|
|
1398
1431
|
|
|
1399
1432
|
function isDefinitionOfDoneHook(hook) {
|
|
@@ -1488,9 +1521,57 @@ function setupMcpServers(options = {}) {
|
|
|
1488
1521
|
return results;
|
|
1489
1522
|
}
|
|
1490
1523
|
|
|
1524
|
+
function runSkillsCommand(args) {
|
|
1525
|
+
const subcommand = args[0];
|
|
1526
|
+
const dryRun = args.includes('--dry-run');
|
|
1527
|
+
|
|
1528
|
+
if (subcommand === 'install') {
|
|
1529
|
+
console.log(pc.bold(pc.cyan('thachvd-kit skills install')));
|
|
1530
|
+
const result = mattSkills.installSkills(targetDir, { dryRun });
|
|
1531
|
+
console.log(` ${result.ok ? pc.green('OK') : pc.yellow('WARN')} ${result.message}`);
|
|
1532
|
+
if (!dryRun && result.ok) printMattSkillsSetupReminder();
|
|
1533
|
+
if (!result.ok) process.exitCode = 1;
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
if (subcommand === 'check') {
|
|
1538
|
+
console.log(pc.bold(pc.cyan('thachvd-kit skills check')));
|
|
1539
|
+
const status = mattSkills.checkSkills(targetDir);
|
|
1540
|
+
for (const name of mattSkills.PROMOTED_SKILLS) {
|
|
1541
|
+
const installed = status.installed.includes(name);
|
|
1542
|
+
console.log(` ${installed ? pc.green('OK') : pc.yellow('WARN')} ${name}`);
|
|
1543
|
+
}
|
|
1544
|
+
console.log(`\n ${status.installed.length}/${status.total} promoted skills installed in ${mattSkills.SKILLS_RELATIVE_DIR}`);
|
|
1545
|
+
if (status.missing.length > 0) {
|
|
1546
|
+
console.log(` Run: ${pc.bold('thachvd-kit skills install')}`);
|
|
1547
|
+
}
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
if (subcommand === 'update') {
|
|
1552
|
+
console.log(pc.bold(pc.cyan('thachvd-kit skills update')));
|
|
1553
|
+
const result = mattSkills.updateSkills(targetDir, { dryRun });
|
|
1554
|
+
if (dryRun) {
|
|
1555
|
+
for (const item of result.results) console.log(` ${pc.dim('would run')} ${item.command}`);
|
|
1556
|
+
} else {
|
|
1557
|
+
for (const item of result.results) console.log(` ${item.ok ? pc.green('OK') : pc.yellow('WARN')} ${item.name}`);
|
|
1558
|
+
}
|
|
1559
|
+
console.log(`\n ${result.ok ? pc.green('OK') : pc.yellow('WARN')} ${result.message}`);
|
|
1560
|
+
if (!result.ok) process.exitCode = 1;
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
console.error(pc.red(`Unknown skills subcommand: ${subcommand || '(none)'}`));
|
|
1565
|
+
console.error('Usage: thachvd-kit skills install|check|update [--dry-run]');
|
|
1566
|
+
process.exit(1);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1491
1569
|
// --- Main CLI ---
|
|
1492
1570
|
|
|
1493
1571
|
async function main() {
|
|
1572
|
+
// Note: 'upgrade' and 'global' are handled directly by bin/entry.js
|
|
1573
|
+
// (bin/upgrade.js / bin/global.js) before this module is even required,
|
|
1574
|
+
// so they never reach here.
|
|
1494
1575
|
const rawArgs = process.argv.slice(2);
|
|
1495
1576
|
const command = rawArgs[0] && !rawArgs[0].startsWith('-') ? rawArgs[0] : 'init';
|
|
1496
1577
|
const args = command === 'init' ? rawArgs.slice(rawArgs[0] === 'init' ? 1 : 0) : rawArgs.slice(1);
|
|
@@ -1520,6 +1601,11 @@ async function main() {
|
|
|
1520
1601
|
return;
|
|
1521
1602
|
}
|
|
1522
1603
|
|
|
1604
|
+
if (command === 'skills') {
|
|
1605
|
+
runSkillsCommand(rawArgs.slice(1));
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1523
1609
|
if (command !== 'init') {
|
|
1524
1610
|
console.error(pc.red(`Unknown command: ${command}`));
|
|
1525
1611
|
printHelp();
|
|
@@ -1559,8 +1645,7 @@ async function main() {
|
|
|
1559
1645
|
uses_docker: scanned?.uses_docker ?? true,
|
|
1560
1646
|
cloud: scanned?.cloud || 'none',
|
|
1561
1647
|
package_manager: scanned?.package_manager || 'auto-detect',
|
|
1562
|
-
test_framework: scanned?.test_framework || 'auto-detect'
|
|
1563
|
-
max_file_lines: scanned?.max_file_lines || '300'
|
|
1648
|
+
test_framework: scanned?.test_framework || 'auto-detect'
|
|
1564
1649
|
};
|
|
1565
1650
|
|
|
1566
1651
|
data.database = data.database || scanned?.database || 'none';
|
|
@@ -1568,7 +1653,6 @@ async function main() {
|
|
|
1568
1653
|
data.cloud = data.cloud || scanned?.cloud || 'none';
|
|
1569
1654
|
data.package_manager = data.package_manager || scanned?.package_manager || 'auto-detect';
|
|
1570
1655
|
data.test_framework = data.test_framework || scanned?.test_framework || 'auto-detect';
|
|
1571
|
-
data.max_file_lines = data.max_file_lines || scanned?.max_file_lines || '300';
|
|
1572
1656
|
data.framework_details = scanned?.framework_details || [];
|
|
1573
1657
|
data.scan_evidence = scanned?.scan_evidence || [];
|
|
1574
1658
|
data.app_root = scanned?.app_root || '.';
|
|
@@ -1583,7 +1667,7 @@ async function main() {
|
|
|
1583
1667
|
|
|
1584
1668
|
// Shared entry files are written after the .agent folder is available.
|
|
1585
1669
|
|
|
1586
|
-
console.log(` ${pc.green('OK')} Project context generation enabled;
|
|
1670
|
+
console.log(` ${pc.green('OK')} Project context generation enabled; run thachvd-kit setup to install the promoted Matt Pocock skill set`);
|
|
1587
1671
|
|
|
1588
1672
|
|
|
1589
1673
|
const generatedFiles = [
|
|
@@ -1593,7 +1677,7 @@ async function main() {
|
|
|
1593
1677
|
['.cursorrules', generateSharedCursorrules(data)],
|
|
1594
1678
|
[path.join('.agent', 'docs', 'project.md'), generateProjectDoc(data)],
|
|
1595
1679
|
[path.join('.agent', 'docs', 'architecture.md'), generateArchitectureDoc(data)],
|
|
1596
|
-
[path.join('.agent', 'docs', 'conventions.md'), generateConventionsDoc(
|
|
1680
|
+
[path.join('.agent', 'docs', 'conventions.md'), generateConventionsDoc()],
|
|
1597
1681
|
[path.join('.agent', 'docs', 'workflow.md'), generateWorkflowDoc()],
|
|
1598
1682
|
[path.join('.agent', 'docs', 'tooling.md'), generateToolingDoc(data)],
|
|
1599
1683
|
[path.join('.agent', 'docs', 'getting-started.md'), generateGettingStartedDoc()],
|
|
@@ -1628,12 +1712,12 @@ async function main() {
|
|
|
1628
1712
|
- ${pc.bold('.agent/docs/index-project-prompt.md')} durable onboarding prompt
|
|
1629
1713
|
|
|
1630
1714
|
${pc.bold('MCP/tooling setup:')}
|
|
1631
|
-
-
|
|
1632
|
-
- Run ${pc.bold('thachvd-kit setup')} to configure codebase-memory MCP and recommended RTK
|
|
1715
|
+
- Matt Pocock's promoted skills (.agents/skills/) are the workflow layer
|
|
1716
|
+
- Run ${pc.bold('thachvd-kit setup')} to install them and configure codebase-memory MCP and recommended RTK
|
|
1633
1717
|
|
|
1634
1718
|
${pc.bold('Next steps:')}
|
|
1635
1719
|
1. Run ${pc.bold('thachvd-kit prompt')} and paste the saved prompt into your AI editor
|
|
1636
|
-
2.
|
|
1720
|
+
2. Run ${pc.bold('thachvd-kit setup')} to install the promoted skill set and RTK
|
|
1637
1721
|
3. Run ${pc.bold('thachvd-kit doctor')} to verify the machine
|
|
1638
1722
|
4. Re-run ${pc.bold('thachvd-kit prompt')} whenever you need the onboarding prompt again
|
|
1639
1723
|
|
package/bin/entry.js
CHANGED
|
@@ -4,16 +4,76 @@ const {
|
|
|
4
4
|
snapshotPolicyFiles,
|
|
5
5
|
applyPolicyUpgrades
|
|
6
6
|
} = require('./policy');
|
|
7
|
+
const { upgradeProject } = require('./upgrade');
|
|
8
|
+
const { installGlobalPolicies } = require('./global');
|
|
7
9
|
|
|
8
10
|
function isInitInvocation(args) {
|
|
9
11
|
if (args.includes('--help') || args.includes('-h') || args.includes('--version') || args.includes('-v')) {
|
|
10
12
|
return false;
|
|
11
13
|
}
|
|
14
|
+
// Note: 'upgrade' and 'global' are handled and returned above before this
|
|
15
|
+
// is ever called, so they never reach here.
|
|
12
16
|
const first = args[0];
|
|
13
17
|
return !first || first === 'init' || first.startsWith('-');
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
function runUpgrade(args) {
|
|
21
|
+
const results = upgradeProject(process.cwd(), { dryRun: args.includes('--dry-run') });
|
|
22
|
+
const changed = results.filter(result => result.changed);
|
|
23
|
+
if (changed.length === 0) {
|
|
24
|
+
console.log('No managed project policy changes needed.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const result of changed) {
|
|
28
|
+
console.log(`${result.dryRun ? 'WOULD UPDATE' : 'UPDATED'} ${result.path}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function runGlobal(args) {
|
|
33
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME;
|
|
34
|
+
if (!homeDir) {
|
|
35
|
+
console.error('Cannot determine home directory from USERPROFILE or HOME.');
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const antigravityOnly = args.includes('--antigravity-only');
|
|
41
|
+
const codexOnly = args.includes('--codex-only');
|
|
42
|
+
if (antigravityOnly && codexOnly) {
|
|
43
|
+
console.error('Choose at most one of --antigravity-only or --codex-only.');
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const results = installGlobalPolicies(homeDir, {
|
|
49
|
+
antigravityOnly,
|
|
50
|
+
codexOnly,
|
|
51
|
+
dryRun: args.includes('--dry-run')
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
for (const result of results) {
|
|
55
|
+
const status = result.changed ? (result.dryRun ? 'WOULD UPDATE' : 'UPDATED') : 'OK';
|
|
56
|
+
console.log(`${status} ${result.path}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (results.some(result => result.changed) && !args.includes('--dry-run')) {
|
|
60
|
+
console.log('Restart Antigravity/Codex sessions so the updated global instructions are reloaded.');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
16
64
|
const args = process.argv.slice(2);
|
|
65
|
+
const command = args[0];
|
|
66
|
+
|
|
67
|
+
if (command === 'upgrade') {
|
|
68
|
+
runUpgrade(args.slice(1));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (command === 'global') {
|
|
73
|
+
runGlobal(args.slice(1));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
17
77
|
const shouldUpgradeGeneratedPolicy = isInitInvocation(args);
|
|
18
78
|
const beforeSnapshot = shouldUpgradeGeneratedPolicy ? snapshotPolicyFiles(process.cwd()) : null;
|
|
19
79
|
const force = args.includes('--yes') || args.includes('-y');
|