@haposoft/cafekit 0.14.1 → 0.15.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 +86 -11
- package/bin/__tests__/codex-hooks.test.js +331 -0
- package/bin/__tests__/codex-native.test.js +458 -0
- package/bin/__tests__/installer-safety.test.js +259 -0
- package/bin/install.js +30 -8
- package/bin/lib/backup.js +82 -18
- package/bin/lib/codex-frontmatter.js +56 -0
- package/bin/lib/codex-install.js +195 -0
- package/bin/lib/context.js +65 -8
- package/bin/lib/copy-utils.js +1 -1
- package/bin/lib/i18n.js +12 -3
- package/bin/lib/managed-writer.js +17 -2
- package/bin/lib/manifest.js +21 -4
- package/bin/lib/opencode-install.js +21 -19
- package/bin/lib/path-safety.js +40 -0
- package/bin/lib/version-check.js +25 -12
- package/bin/phases/claude-runtime.js +60 -9
- package/bin/phases/codex-runtime.js +110 -0
- package/bin/phases/copy-payload.js +36 -16
- package/bin/phases/post-install.js +98 -48
- package/bin/phases/root-config.js +4 -2
- package/bin/phases/select-platform.js +105 -66
- package/bin/phases/summary.js +6 -1
- package/package.json +3 -2
- package/src/claude/CLAUDE.md +1 -1
- package/src/claude/agents/code-auditor.md +1 -1
- package/src/claude/agents/debugger.md +1 -0
- package/src/claude/agents/god-developer.md +10 -1
- package/src/claude/agents/inspector.md +1 -0
- package/src/claude/agents/spec-maker.md +1 -1
- package/src/claude/agents/test-runner.md +2 -2
- package/src/claude/hooks/__tests__/privacy-block.test.js +50 -10
- package/src/claude/hooks/__tests__/spec-gate.test.js +75 -1
- package/src/claude/hooks/__tests__/state.test.js +65 -0
- package/src/claude/hooks/docs-sync.cjs +15 -21
- package/src/claude/hooks/inspect-block.cjs +1 -1
- package/src/claude/hooks/lib/config.cjs +0 -5
- package/src/claude/hooks/privacy-block.cjs +39 -62
- package/src/claude/hooks/spec-gate.cjs +18 -7
- package/src/claude/hooks/spec-state.cjs +4 -0
- package/src/claude/hooks/state.cjs +13 -3
- package/src/claude/hooks/usage.cjs +6 -0
- package/src/claude/rules/orchestrator.md +2 -2
- package/src/claude/rules/skill-domain-routing.md +27 -86
- package/src/claude/rules/skill-workflow-routing.md +11 -82
- package/src/claude/rules/state-sync.md +1 -1
- package/src/claude/runtime.json +7 -7
- package/src/claude/scripts/generate-skill-catalog.cjs +8 -3
- package/src/claude/scripts/validate-spec-output.cjs +6 -0
- package/src/claude/skills/code-review/references/spec-compliance-review.md +1 -1
- package/src/claude/skills/develop/SKILL.md +26 -5
- package/src/claude/skills/develop/references/parallel-waves.md +112 -0
- package/src/claude/skills/develop/references/quality-gate.md +10 -2
- package/src/claude/skills/hotfix/references/parallel-patterns.md +1 -1
- package/src/claude/skills/inspect/SKILL.md +42 -113
- package/src/claude/skills/inspect/references/internal-inspection.md +16 -135
- package/src/claude/skills/specs/SKILL.md +134 -386
- package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
- package/src/claude/skills/specs/templates/task.md +3 -1
- package/src/claude/skills/sync/SKILL.md +2 -2
- package/src/claude/skills/sync/references/sync-protocols.md +4 -4
- package/src/claude/skills/test/SKILL.md +1 -1
- package/src/claude/status.cjs +9 -6
- package/src/codex/AGENTS.md +30 -0
- package/src/codex/agents-gitignore +11 -0
- package/src/codex/gitignore +12 -0
- package/src/codex/hooks/agent.cjs +66 -0
- package/src/codex/hooks/docs-sync.cjs +66 -0
- package/src/codex/hooks/inspect-block.cjs +40 -0
- package/src/codex/hooks/lib/hook-context.cjs +93 -0
- package/src/codex/hooks/lib/inspect-paths.cjs +199 -0
- package/src/codex/hooks/lib/privacy-state.cjs +199 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +78 -0
- package/src/codex/hooks/lib/spec-utils.cjs +50 -0
- package/src/codex/hooks/lib/state-store.cjs +166 -0
- package/src/codex/hooks/privacy-approval.cjs +59 -0
- package/src/codex/hooks/privacy-block.cjs +182 -0
- package/src/codex/hooks/rules.cjs +79 -0
- package/src/codex/hooks/session.cjs +114 -0
- package/src/codex/hooks/spec-gate.cjs +80 -0
- package/src/codex/hooks/spec-state.cjs +73 -0
- package/src/codex/hooks/state.cjs +157 -0
- package/src/codex/hooks/task-scaffold-guard.cjs +63 -0
- package/src/codex/hooks.json +122 -0
- package/src/codex/rules/hook-protocols.md +32 -0
- package/src/codex/rules/state-sync.md +41 -0
- package/src/codex/runtime.json +28 -0
- package/src/opencode/plugins/docs-sync.ts +10 -16
- package/src/claude/archive-command/code/SKILL.md +0 -55
- package/src/claude/archive-command/code/references/execution-loop.md +0 -21
- package/src/claude/archive-command/code.md +0 -17
- package/src/claude/archive-command/docs.md +0 -609
- package/src/claude/archive-command/review/codebase/parallel.md +0 -76
- package/src/claude/archive-command/spec-design.md +0 -247
- package/src/claude/archive-command/spec-init.md +0 -120
- package/src/claude/archive-command/spec-requirements.md +0 -138
- package/src/claude/archive-command/spec-status.md +0 -98
- package/src/claude/archive-command/spec-tasks.md +0 -173
- package/src/claude/archive-command/spec-validate.md +0 -118
- package/src/claude/archive-command/test.md +0 -8
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const {
|
|
7
|
+
getHookContext,
|
|
8
|
+
logCrash,
|
|
9
|
+
readPayload
|
|
10
|
+
} = require('./lib/hook-context.cjs');
|
|
11
|
+
|
|
12
|
+
function addedFiles(toolName, input) {
|
|
13
|
+
if (toolName === 'Write') {
|
|
14
|
+
return [input.file_path || input.filePath || input.path || ''].filter(Boolean);
|
|
15
|
+
}
|
|
16
|
+
if (toolName !== 'apply_patch') return [];
|
|
17
|
+
const patch = typeof input.command === 'string'
|
|
18
|
+
? input.command
|
|
19
|
+
: typeof input.patch === 'string' ? input.patch : '';
|
|
20
|
+
return [...patch.matchAll(/^\*\*\* Add File:\s+(.+)$/gm)]
|
|
21
|
+
.map((match) => match[1].trim());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function projectRelative(filePath, projectRoot, sessionCwd) {
|
|
25
|
+
const absolute = path.isAbsolute(filePath)
|
|
26
|
+
? path.normalize(filePath)
|
|
27
|
+
: path.resolve(sessionCwd, filePath);
|
|
28
|
+
return path.relative(projectRoot, absolute).replace(/\\/g, '/');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const payload = readPayload();
|
|
33
|
+
if (!payload) process.exit(0);
|
|
34
|
+
const { projectRoot, runtime, sessionCwd } = getHookContext(payload);
|
|
35
|
+
const candidates = addedFiles(payload.tool_name || '', payload.tool_input || {});
|
|
36
|
+
const taskFile = candidates
|
|
37
|
+
.map((requested) => ({
|
|
38
|
+
requested,
|
|
39
|
+
relative: projectRelative(requested, projectRoot, sessionCwd)
|
|
40
|
+
}))
|
|
41
|
+
.find(({ relative }) => (
|
|
42
|
+
/^specs\/[^/]+\/tasks\/task-[^/]+\.md$/.test(relative)
|
|
43
|
+
));
|
|
44
|
+
if (!taskFile) process.exit(0);
|
|
45
|
+
if (runtime.spec?.scaffold_guard === false) process.exit(0);
|
|
46
|
+
|
|
47
|
+
const scaffold = path.join(projectRoot, '.codex', 'scripts', 'spec-scaffold.cjs');
|
|
48
|
+
if (!fs.existsSync(scaffold)) process.exit(0);
|
|
49
|
+
|
|
50
|
+
const feature = taskFile.relative.split('/')[1];
|
|
51
|
+
const command = sessionCwd === projectRoot
|
|
52
|
+
? `node .codex/scripts/spec-scaffold.cjs ${feature}`
|
|
53
|
+
: `node ${JSON.stringify(scaffold)} ${feature}`;
|
|
54
|
+
process.stderr.write(
|
|
55
|
+
'TASK SCAFFOLD REQUIRED: task files must be generated, not hand-written.\n'
|
|
56
|
+
+ `Blocked Write: ${taskFile.requested}\n\n`
|
|
57
|
+
+ 'Generate the stubs, then fill their {{...}} placeholders with apply_patch:\n'
|
|
58
|
+
+ ` ${command} --tasks "R0-01-slug,R1-01-slug,..." --tasks-only\n`
|
|
59
|
+
);
|
|
60
|
+
process.exit(2);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
logCrash('task-scaffold-guard', error);
|
|
63
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "CafeKit project-local lifecycle hooks for Codex CLI. Review and trust with /hooks.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"matcher": "startup|resume|clear|compact",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"type": "command",
|
|
10
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/session.cjs\"",
|
|
11
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/session.cjs\""
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "command",
|
|
15
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/docs-sync.cjs\"",
|
|
16
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/docs-sync.cjs\""
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
21
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\""
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"SubagentStart": [
|
|
27
|
+
{
|
|
28
|
+
"matcher": "*",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/agent.cjs\"",
|
|
33
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/agent.cjs\""
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"UserPromptSubmit": [
|
|
39
|
+
{
|
|
40
|
+
"hooks": [
|
|
41
|
+
{
|
|
42
|
+
"type": "command",
|
|
43
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/privacy-approval.cjs\"",
|
|
44
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/privacy-approval.cjs\""
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "command",
|
|
48
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/rules.cjs\"",
|
|
49
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/rules.cjs\""
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "command",
|
|
53
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/spec-state.cjs\"",
|
|
54
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/spec-state.cjs\""
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"PreToolUse": [
|
|
60
|
+
{
|
|
61
|
+
"matcher": "Bash|apply_patch|Edit|Write|Read|Glob|Grep|mcp__.*",
|
|
62
|
+
"hooks": [
|
|
63
|
+
{
|
|
64
|
+
"type": "command",
|
|
65
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/privacy-block.cjs\"",
|
|
66
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/privacy-block.cjs\""
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "command",
|
|
70
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/inspect-block.cjs\"",
|
|
71
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/inspect-block.cjs\""
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "command",
|
|
75
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/task-scaffold-guard.cjs\"",
|
|
76
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/task-scaffold-guard.cjs\""
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"PostToolUse": [
|
|
82
|
+
{
|
|
83
|
+
"matcher": "Agent|spawn_agent|update_plan|task|Task|TodoWrite",
|
|
84
|
+
"hooks": [
|
|
85
|
+
{
|
|
86
|
+
"type": "command",
|
|
87
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
88
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\""
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"Stop": [
|
|
94
|
+
{
|
|
95
|
+
"hooks": [
|
|
96
|
+
{
|
|
97
|
+
"type": "command",
|
|
98
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/spec-gate.cjs\"",
|
|
99
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/spec-gate.cjs\""
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "command",
|
|
103
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
104
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\""
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"SubagentStop": [
|
|
110
|
+
{
|
|
111
|
+
"matcher": "*",
|
|
112
|
+
"hooks": [
|
|
113
|
+
{
|
|
114
|
+
"type": "command",
|
|
115
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
116
|
+
"commandWindows": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\""
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Hook Protocols
|
|
2
|
+
|
|
3
|
+
Hooks are instruction boundaries. Do not bypass or work around them.
|
|
4
|
+
|
|
5
|
+
## Privacy Block Hook
|
|
6
|
+
|
|
7
|
+
Codex cannot pause a blocked tool call for an interactive permission question.
|
|
8
|
+
CafeKit therefore denies the sensitive access and emits one exact approval
|
|
9
|
+
phrase tied to the current session, requested path, tool, and expiry.
|
|
10
|
+
|
|
11
|
+
Required flow:
|
|
12
|
+
|
|
13
|
+
1. Stop the blocked access and show the user the hook's reason.
|
|
14
|
+
2. Ask the user to send the exact approval phrase if they want one retry.
|
|
15
|
+
3. Do not write, repeat as a user message, or otherwise simulate that phrase.
|
|
16
|
+
4. Retry only after a later real user prompt exactly matches it.
|
|
17
|
+
5. Use the resulting token once, only for the originally blocked operation.
|
|
18
|
+
|
|
19
|
+
Never use another command, path, encoding, subprocess, or side channel to read a
|
|
20
|
+
privacy-blocked file without that explicit approval.
|
|
21
|
+
|
|
22
|
+
## State And Spec Hooks
|
|
23
|
+
|
|
24
|
+
- If a hook reports state drift, run the appropriate sync or audit flow before continuing.
|
|
25
|
+
- If a hook rejects task completion, keep the task `in_progress` or `blocked` until proof exists.
|
|
26
|
+
- Do not mark a task `done` unless the matching task file contains a valid verification receipt.
|
|
27
|
+
|
|
28
|
+
## Hook Failure Handling
|
|
29
|
+
|
|
30
|
+
- Treat hook errors as blockers when they affect safety, privacy, or task state.
|
|
31
|
+
- Record the blocker in the task or spec state when relevant.
|
|
32
|
+
- If hook output is malformed, stop and report the exact failure instead of guessing.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Tollgate Protocol (State Sync)
|
|
2
|
+
|
|
3
|
+
## Sources Of Truth
|
|
4
|
+
|
|
5
|
+
Spec-driven work persists state in two synchronized layers:
|
|
6
|
+
|
|
7
|
+
1. `spec.json` tracks phase, overall status, and `task_registry`.
|
|
8
|
+
2. `tasks/task-*.md` tracks the human-readable checklist and verification receipt.
|
|
9
|
+
|
|
10
|
+
## Sync-back Rule
|
|
11
|
+
|
|
12
|
+
Before reporting a task completed or blocked:
|
|
13
|
+
|
|
14
|
+
### On success
|
|
15
|
+
|
|
16
|
+
1. Update `spec.json` only after verification. Keep `current_phase`,
|
|
17
|
+
`task_files`, status, timestamps, and the matching `task_registry` entry accurate.
|
|
18
|
+
2. Update the matching task Markdown status, checkboxes, completion criteria,
|
|
19
|
+
and `## Evidence` receipt from the current verification run.
|
|
20
|
+
3. Update native plan or task state when the active Codex session provides it,
|
|
21
|
+
but never use chat-only state as a substitute for the files above.
|
|
22
|
+
|
|
23
|
+
### On block after repeated attempts
|
|
24
|
+
|
|
25
|
+
1. Set the spec and matching registry entry to `blocked`, with the root cause and timestamp.
|
|
26
|
+
2. Mark the task Markdown `blocked` and record the evidence.
|
|
27
|
+
3. Tell the user or orchestrator exactly what external input or state change is required.
|
|
28
|
+
|
|
29
|
+
New specs use `in_progress`; legacy `in-progress` may be read but not emitted.
|
|
30
|
+
Never let `task_registry` disagree with its task Markdown file.
|
|
31
|
+
|
|
32
|
+
## Completion Gate
|
|
33
|
+
|
|
34
|
+
The Stop hook checks newly completed tasks. Each requires:
|
|
35
|
+
|
|
36
|
+
- `Status: done`;
|
|
37
|
+
- a non-placeholder `## Evidence` section with a command block or PASS/FAIL result;
|
|
38
|
+
- a non-empty `task_registry[path].completed_at`.
|
|
39
|
+
|
|
40
|
+
The first run seeds completion history without blocking. Humans can disable the
|
|
41
|
+
gate with `"spec": { "completion_gate": false }` in `.codex/runtime.json`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"privacyBlock": true,
|
|
3
|
+
"inspect": {
|
|
4
|
+
"enabled": true
|
|
5
|
+
},
|
|
6
|
+
"docs": {
|
|
7
|
+
"maxLoc": 800
|
|
8
|
+
},
|
|
9
|
+
"paths": {
|
|
10
|
+
"docs": "docs",
|
|
11
|
+
"specs": "specs",
|
|
12
|
+
"plans": "plans"
|
|
13
|
+
},
|
|
14
|
+
"spec": {
|
|
15
|
+
"scaffold_guard": true,
|
|
16
|
+
"completion_gate": true,
|
|
17
|
+
"tollgate": true
|
|
18
|
+
},
|
|
19
|
+
"develop": {
|
|
20
|
+
"parallel": true
|
|
21
|
+
},
|
|
22
|
+
"locale": {
|
|
23
|
+
"thinkingLanguage": null,
|
|
24
|
+
"responseLanguage": null
|
|
25
|
+
},
|
|
26
|
+
"hooks": {},
|
|
27
|
+
"assertions": []
|
|
28
|
+
}
|
|
@@ -71,27 +71,21 @@ function currentSourceHash(cwd: string): string {
|
|
|
71
71
|
|
|
72
72
|
function buildMissingDocsBanner(): string {
|
|
73
73
|
return [
|
|
74
|
-
"###
|
|
75
|
-
">
|
|
76
|
-
">
|
|
77
|
-
">
|
|
78
|
-
|
|
79
|
-
"> 3. Khởi tạo file hidden `docs/.sync_hash` để theo dõi cập nhật.",
|
|
80
|
-
"> ",
|
|
81
|
-
'> LƯU Ý BẮT BUỘC: Bạn phải chạy lệnh Git này trong Terminal để lấy Hash Code mới nhất: `git log -1 --format="%H" -- . ":(exclude)docs"`',
|
|
82
|
-
"> Sau đó ghi chuẩn giá trị Hash đó vào file `docs/.sync_hash`.",
|
|
74
|
+
"### Missing docs/",
|
|
75
|
+
"> Source exists but `docs/` does not. Create baseline docs first:",
|
|
76
|
+
"> 1. `docs/system-architecture.md` — system architecture and flows",
|
|
77
|
+
"> 2. `docs/project-overview-pdr.md` — overview, goals, features",
|
|
78
|
+
'> 3. Write current hash to `docs/.sync_hash` via `git log -1 --format="%H" -- . ":(exclude)docs"`',
|
|
83
79
|
].join("\n");
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
function buildStaleDocsBanner(currentHash: string, lastSyncHash: string): string {
|
|
87
83
|
return [
|
|
88
|
-
"###
|
|
89
|
-
`> Source
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"> 3. Cập nhật Changelog (nhật ký thay đổi).",
|
|
94
|
-
`> 4. KHI HOÀN TẤT, BẠN PHẢI GHI ĐÈ GIÁ TRỊ SAU: \`${currentHash}\` VÀO FILE \`docs/.sync_hash\` ĐỂ CHỐT TRẠNG THÁI HIỆN TẠI.`,
|
|
84
|
+
"### Docs sync needed",
|
|
85
|
+
`> Source changed (\`${currentHash}\`) since last docs sync (\`${lastSyncHash || "none"}\`).`,
|
|
86
|
+
`> 1. Review recent changes (\`git diff ${lastSyncHash} ${currentHash}\` or \`git log\`).`,
|
|
87
|
+
"> 2. Update architecture/code-standards docs and changelog as needed.",
|
|
88
|
+
`> 3. Write \`${currentHash}\` to \`docs/.sync_hash\` when done.`,
|
|
95
89
|
].join("\n");
|
|
96
90
|
}
|
|
97
91
|
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hapo:code
|
|
3
|
-
description: Implement the next approved spec task and then hand off to hapo:test and hapo:review.
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
argument-hint: <feature-name>
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Code
|
|
9
|
-
|
|
10
|
-
Implement the next pending task from an approved spec instead of coding from memory.
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
/hapo:code <feature-name>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Load First
|
|
19
|
-
|
|
20
|
-
- `references/execution-loop.md`
|
|
21
|
-
- `.specs/$ARGUMENTS/tasks.md`
|
|
22
|
-
- `.specs/$ARGUMENTS/design.md`
|
|
23
|
-
- `.specs/$ARGUMENTS/requirements.md`
|
|
24
|
-
|
|
25
|
-
## Execute
|
|
26
|
-
|
|
27
|
-
1. Read `.specs/$ARGUMENTS/tasks.md` and identify the next pending task.
|
|
28
|
-
2. Read the related context from `design.md` and `requirements.md`.
|
|
29
|
-
3. Implement only that task. Keep scope tight.
|
|
30
|
-
4. Follow the project standards already present in the repo.
|
|
31
|
-
5. Update task status in the spec artifact if the workflow supports it.
|
|
32
|
-
6. Hand off immediately to:
|
|
33
|
-
- `/hapo:test`
|
|
34
|
-
- `/hapo:review`
|
|
35
|
-
|
|
36
|
-
## Output
|
|
37
|
-
|
|
38
|
-
Return:
|
|
39
|
-
- implemented task name
|
|
40
|
-
- touched files
|
|
41
|
-
- blockers or follow-up items
|
|
42
|
-
- explicit handoff to `/hapo:test` and `/hapo:review`
|
|
43
|
-
|
|
44
|
-
## Rules
|
|
45
|
-
|
|
46
|
-
- Do not implement multiple major tasks in one pass.
|
|
47
|
-
- Stop if `tasks.md` is missing.
|
|
48
|
-
- Prefer existing patterns over new abstractions.
|
|
49
|
-
- Keep the work aligned to the spec.
|
|
50
|
-
|
|
51
|
-
## Related
|
|
52
|
-
|
|
53
|
-
- Command: `/code`
|
|
54
|
-
- Previous skill: `/hapo:spec-tasks`
|
|
55
|
-
- Next skills: `/hapo:test`, `/hapo:review`
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Execution Loop
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Implement one approved task at a time and immediately validate it.
|
|
6
|
-
|
|
7
|
-
## Loop
|
|
8
|
-
|
|
9
|
-
1. Read the next pending task in `tasks.md`.
|
|
10
|
-
2. Read the matching context in `design.md` and `requirements.md`.
|
|
11
|
-
3. Implement only that task.
|
|
12
|
-
4. Run `/hapo:test`.
|
|
13
|
-
5. Run `/hapo:review`.
|
|
14
|
-
6. Move to the next task only after the current pass is clear.
|
|
15
|
-
|
|
16
|
-
## Guardrails
|
|
17
|
-
|
|
18
|
-
- Keep scope tight.
|
|
19
|
-
- Prefer existing project patterns.
|
|
20
|
-
- Do not batch multiple major tasks into one pass.
|
|
21
|
-
- Stop and report blockers instead of guessing.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code
|
|
3
|
-
description: Implement approved work from specification tasks and then hand off to test and review.
|
|
4
|
-
allowed-tools: Read, Glob, Grep, Edit, Write, Bash
|
|
5
|
-
argument-hint: <feature-name>
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# /code - Implement from spec tasks
|
|
9
|
-
|
|
10
|
-
Use this command after /spec-tasks.
|
|
11
|
-
|
|
12
|
-
1. Read `.specs/$ARGUMENTS/tasks.md` and identify the next pending task.
|
|
13
|
-
2. Implement only that task following project standards.
|
|
14
|
-
3. Run `/test`.
|
|
15
|
-
4. Run `/review`.
|
|
16
|
-
|
|
17
|
-
Preferred flow: /spec-init -> /spec-requirements -> /spec-design -> /spec-tasks -> /code -> /test -> /review
|