aiwcli 0.12.3 → 0.12.7
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/bin/dev.cmd +3 -3
- package/bin/dev.js +16 -16
- package/bin/run.cmd +3 -3
- package/bin/run.js +21 -21
- package/dist/commands/branch.js +7 -2
- package/dist/lib/bmad-installer.js +37 -37
- package/dist/lib/terminal.d.ts +2 -0
- package/dist/lib/terminal.js +57 -7
- package/dist/templates/CLAUDE.md +205 -205
- package/dist/templates/_shared/.claude/commands/handoff-resume.md +12 -64
- package/dist/templates/_shared/.claude/commands/handoff.md +12 -198
- package/dist/templates/_shared/.claude/settings.json +65 -65
- package/dist/templates/_shared/.codex/workflows/handoff.md +226 -226
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +226 -226
- package/dist/templates/_shared/handoff-system/CLAUDE.md +421 -0
- package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/document-generator.ts +215 -216
- package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/handoff-reader.ts +157 -158
- package/dist/templates/_shared/{scripts → handoff-system/scripts}/resume_handoff.ts +373 -373
- package/dist/templates/_shared/{scripts → handoff-system/scripts}/save_handoff.ts +469 -358
- package/dist/templates/_shared/handoff-system/workflows/handoff-resume.md +66 -0
- package/dist/templates/_shared/{workflows → handoff-system/workflows}/handoff.md +254 -254
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +2 -2
- package/dist/templates/_shared/hooks-ts/archive_plan.ts +159 -159
- package/dist/templates/_shared/hooks-ts/context_monitor.ts +147 -147
- package/dist/templates/_shared/hooks-ts/file-suggestion.ts +128 -128
- package/dist/templates/_shared/hooks-ts/pre_compact.ts +49 -49
- package/dist/templates/_shared/hooks-ts/session_end.ts +196 -183
- package/dist/templates/_shared/hooks-ts/session_start.ts +163 -151
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +48 -48
- package/dist/templates/_shared/hooks-ts/task_update_capture.ts +74 -74
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +93 -93
- package/dist/templates/_shared/lib-ts/CLAUDE.md +367 -367
- package/dist/templates/_shared/lib-ts/base/atomic-write.ts +138 -138
- package/dist/templates/_shared/lib-ts/base/constants.ts +303 -303
- package/dist/templates/_shared/lib-ts/base/git-state.ts +58 -58
- package/dist/templates/_shared/lib-ts/base/hook-utils.ts +582 -582
- package/dist/templates/_shared/lib-ts/base/inference.ts +301 -301
- package/dist/templates/_shared/lib-ts/base/logger.ts +247 -247
- package/dist/templates/_shared/lib-ts/base/state-io.ts +202 -130
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +184 -184
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +56 -0
- package/dist/templates/_shared/lib-ts/base/utils.ts +184 -184
- package/dist/templates/_shared/lib-ts/context/context-formatter.ts +566 -560
- package/dist/templates/_shared/lib-ts/context/context-selector.ts +524 -515
- package/dist/templates/_shared/lib-ts/context/context-store.ts +712 -668
- package/dist/templates/_shared/lib-ts/context/plan-manager.ts +312 -312
- package/dist/templates/_shared/lib-ts/context/task-tracker.ts +185 -185
- package/dist/templates/_shared/lib-ts/package.json +20 -20
- package/dist/templates/_shared/lib-ts/templates/formatters.ts +102 -102
- package/dist/templates/_shared/lib-ts/templates/plan-context.ts +58 -58
- package/dist/templates/_shared/lib-ts/tsconfig.json +13 -13
- package/dist/templates/_shared/lib-ts/types.ts +186 -180
- package/dist/templates/_shared/scripts/resolve_context.ts +33 -33
- package/dist/templates/_shared/scripts/status_line.ts +690 -690
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/ask.md +136 -136
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/index.md +21 -21
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/overview.md +56 -56
- package/dist/templates/cc-native/.claude/commands/cc-native/specdev.md +10 -10
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/fix.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/implement.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/research.md +8 -8
- package/dist/templates/cc-native/CC-NATIVE-README.md +189 -189
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +304 -304
- package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +143 -143
- package/dist/templates/cc-native/_cc-native/agents/PLAN-ORCHESTRATOR.md +213 -213
- package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -70
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +96 -96
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +247 -247
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +76 -76
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +54 -54
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +51 -51
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -53
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +61 -61
- package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -163
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +156 -156
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/format.ts +597 -597
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/index.ts +26 -26
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/tracker.ts +107 -107
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/write.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +319 -319
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +144 -144
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +57 -57
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +83 -83
- package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +79 -79
- package/dist/templates/cc-native/_cc-native/lib-ts/graduation.ts +132 -132
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +116 -116
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +168 -168
- package/dist/templates/cc-native/_cc-native/lib-ts/orchestrator.ts +70 -70
- package/dist/templates/cc-native/_cc-native/lib-ts/output-builder.ts +130 -130
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +80 -80
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-questions.ts +101 -101
- package/dist/templates/cc-native/_cc-native/lib-ts/review-pipeline.ts +511 -511
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/agent.ts +71 -71
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/base/base-agent.ts +217 -217
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/index.ts +12 -12
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +66 -65
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/codex-agent.ts +184 -184
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/gemini-agent.ts +39 -39
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +196 -195
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/schemas.ts +201 -201
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/types.ts +21 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/CLAUDE.md +480 -480
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +287 -287
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +148 -148
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +54 -54
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +58 -58
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +208 -208
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +460 -460
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +446 -447
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +280 -280
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +274 -274
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +201 -201
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +278 -278
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +184 -184
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +275 -275
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +18 -18
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +329 -329
- package/dist/templates/cc-native/_cc-native/lib-ts/verdict.ts +72 -72
- package/dist/templates/cc-native/_cc-native/workflows/specdev.md +9 -9
- package/oclif.manifest.json +1 -1
- package/package.json +108 -108
- package/dist/templates/cc-native/_cc-native/lib-ts/nul +0 -3
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plan evaluation guidance template.
|
|
3
|
-
* Injected as context to guide the Plan agent during plan creation.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export function getEvaluationContextReminder(): string {
|
|
7
|
-
return `## Write This Plan for a Different Agent
|
|
8
|
-
|
|
9
|
-
The agent executing this plan has zero context from this conversation — no chat history, no memory of files explored or decisions made.
|
|
10
|
-
|
|
11
|
-
Write as if you are that agent. What would you need?
|
|
12
|
-
|
|
13
|
-
### Structure
|
|
14
|
-
|
|
15
|
-
\`\`\`
|
|
16
|
-
# Plan: [descriptive title]
|
|
17
|
-
|
|
18
|
-
## Background
|
|
19
|
-
Why this change is needed (2-3 sentences of motivation)
|
|
20
|
-
|
|
21
|
-
## Task
|
|
22
|
-
What exactly to build or change
|
|
23
|
-
|
|
24
|
-
## Files
|
|
25
|
-
**Modify:**
|
|
26
|
-
- \`exact/path/to/file.ext\` — What changes and why
|
|
27
|
-
|
|
28
|
-
**Reference:**
|
|
29
|
-
- \`exact/path/to/reference.ext\` — Why relevant (e.g., "pattern to follow at lines 12-30")
|
|
30
|
-
|
|
31
|
-
## Steps
|
|
32
|
-
Numbered steps with specific details. For each step, consider whether any of the skills available in your system-reminder messages would help the implementation agent — if so, reference the skill inline at the point of use.
|
|
33
|
-
|
|
34
|
-
1. [Specific action with function names, patterns, or code snippets]
|
|
35
|
-
2. [Enough detail for someone who never saw this conversation]
|
|
36
|
-
|
|
37
|
-
## Constraints
|
|
38
|
-
Technical requirements, preferences, or limitations discovered during planning
|
|
39
|
-
|
|
40
|
-
## Verification
|
|
41
|
-
Binary-testable checks the implementation agent runs to confirm success. Reference relevant skills inline where they aid verification.
|
|
42
|
-
|
|
43
|
-
## Decisions Worth Preserving
|
|
44
|
-
Decisions made during this session that would be lost without documentation. Focus on:
|
|
45
|
-
- What was chosen and why the alternatives were rejected
|
|
46
|
-
- Constraints that aren't obvious from the code itself
|
|
47
|
-
- Patterns discovered that prevent future mistakes
|
|
48
|
-
|
|
49
|
-
The implementation agent should document these so the next session inherits what this session learned.
|
|
50
|
-
\`\`\`
|
|
51
|
-
|
|
52
|
-
### Self-Check
|
|
53
|
-
- [ ] Could I execute this plan having never seen this conversation?
|
|
54
|
-
- [ ] Are all file paths exact (not "the auth file")?
|
|
55
|
-
- [ ] Are implementation details specific (not "use the approach we discussed")?
|
|
56
|
-
- [ ] Are relevant skills referenced where they add value?
|
|
57
|
-
- [ ] Are key decisions captured so they survive this session?`;
|
|
58
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Plan evaluation guidance template.
|
|
3
|
+
* Injected as context to guide the Plan agent during plan creation.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function getEvaluationContextReminder(): string {
|
|
7
|
+
return `## Write This Plan for a Different Agent
|
|
8
|
+
|
|
9
|
+
The agent executing this plan has zero context from this conversation — no chat history, no memory of files explored or decisions made.
|
|
10
|
+
|
|
11
|
+
Write as if you are that agent. What would you need?
|
|
12
|
+
|
|
13
|
+
### Structure
|
|
14
|
+
|
|
15
|
+
\`\`\`
|
|
16
|
+
# Plan: [descriptive title]
|
|
17
|
+
|
|
18
|
+
## Background
|
|
19
|
+
Why this change is needed (2-3 sentences of motivation)
|
|
20
|
+
|
|
21
|
+
## Task
|
|
22
|
+
What exactly to build or change
|
|
23
|
+
|
|
24
|
+
## Files
|
|
25
|
+
**Modify:**
|
|
26
|
+
- \`exact/path/to/file.ext\` — What changes and why
|
|
27
|
+
|
|
28
|
+
**Reference:**
|
|
29
|
+
- \`exact/path/to/reference.ext\` — Why relevant (e.g., "pattern to follow at lines 12-30")
|
|
30
|
+
|
|
31
|
+
## Steps
|
|
32
|
+
Numbered steps with specific details. For each step, consider whether any of the skills available in your system-reminder messages would help the implementation agent — if so, reference the skill inline at the point of use.
|
|
33
|
+
|
|
34
|
+
1. [Specific action with function names, patterns, or code snippets]
|
|
35
|
+
2. [Enough detail for someone who never saw this conversation]
|
|
36
|
+
|
|
37
|
+
## Constraints
|
|
38
|
+
Technical requirements, preferences, or limitations discovered during planning
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
Binary-testable checks the implementation agent runs to confirm success. Reference relevant skills inline where they aid verification.
|
|
42
|
+
|
|
43
|
+
## Decisions Worth Preserving
|
|
44
|
+
Decisions made during this session that would be lost without documentation. Focus on:
|
|
45
|
+
- What was chosen and why the alternatives were rejected
|
|
46
|
+
- Constraints that aren't obvious from the code itself
|
|
47
|
+
- Patterns discovered that prevent future mistakes
|
|
48
|
+
|
|
49
|
+
The implementation agent should document these so the next session inherits what this session learned.
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
### Self-Check
|
|
53
|
+
- [ ] Could I execute this plan having never seen this conversation?
|
|
54
|
+
- [ ] Are all file paths exact (not "the auth file")?
|
|
55
|
+
- [ ] Are implementation details specific (not "use the approach we discussed")?
|
|
56
|
+
- [ ] Are relevant skills referenced where they add value?
|
|
57
|
+
- [ ] Are key decisions captured so they survive this session?`;
|
|
58
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "node16",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noUncheckedIndexedAccess": true,
|
|
8
|
-
"outDir": "dist",
|
|
9
|
-
"rootDir": ".",
|
|
10
|
-
"declaration": true
|
|
11
|
-
},
|
|
12
|
-
"include": ["./**/*.ts"]
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noUncheckedIndexedAccess": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"rootDir": ".",
|
|
10
|
+
"declaration": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["./**/*.ts"]
|
|
13
|
+
}
|
|
@@ -1,180 +1,186 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared type definitions for the lib-ts library.
|
|
3
|
-
* All field names use snake_case for JSON backward compatibility with state.json.
|
|
4
|
-
* See SPEC.md §1 for full behavioral specification.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// §1.1
|
|
8
|
-
export type Mode = "idle" | "
|
|
9
|
-
|
|
10
|
-
export interface ContextState {
|
|
11
|
-
id: string;
|
|
12
|
-
status: "active" | "completed";
|
|
13
|
-
summary: string;
|
|
14
|
-
method: string;
|
|
15
|
-
tags: string[];
|
|
16
|
-
created_at: string;
|
|
17
|
-
last_active: string;
|
|
18
|
-
mode: Mode;
|
|
19
|
-
plan_path: string | null;
|
|
20
|
-
plan_hash: string | null;
|
|
21
|
-
plan_signature: string | null;
|
|
22
|
-
plan_id: string | null;
|
|
23
|
-
plan_anchors: string[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export interface
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
decision
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for the lib-ts library.
|
|
3
|
+
* All field names use snake_case for JSON backward compatibility with state.json.
|
|
4
|
+
* See SPEC.md §1 for full behavioral specification.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// §1.1
|
|
8
|
+
export type Mode = "idle" | "has_staged_work" | "active";
|
|
9
|
+
|
|
10
|
+
export interface ContextState {
|
|
11
|
+
id: string;
|
|
12
|
+
status: "active" | "completed";
|
|
13
|
+
summary: string;
|
|
14
|
+
method: string;
|
|
15
|
+
tags: string[];
|
|
16
|
+
created_at: string;
|
|
17
|
+
last_active: string;
|
|
18
|
+
mode: Mode;
|
|
19
|
+
plan_path: string | null;
|
|
20
|
+
plan_hash: string | null;
|
|
21
|
+
plan_signature: string | null;
|
|
22
|
+
plan_id: string | null;
|
|
23
|
+
plan_anchors: string[];
|
|
24
|
+
plan_hash_consumed: string | null;
|
|
25
|
+
handoff_path: string | null;
|
|
26
|
+
// Unified lifecycle fields (v0.13.0+)
|
|
27
|
+
work_consumed: boolean; // Replaces plan_consumed + handoff_consumed
|
|
28
|
+
next_artifact_type: "plan" | "handoff" | null; // Explicit artifact type for has_staged_work mode
|
|
29
|
+
// Deprecated fields (kept for migration)
|
|
30
|
+
/** @deprecated Use work_consumed instead */
|
|
31
|
+
plan_consumed?: boolean;
|
|
32
|
+
/** @deprecated Use work_consumed instead */
|
|
33
|
+
handoff_consumed?: boolean;
|
|
34
|
+
session_ids: string[];
|
|
35
|
+
last_session: LastSession | null;
|
|
36
|
+
tasks: Task[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// §1.2
|
|
40
|
+
export interface GitState {
|
|
41
|
+
branch?: string;
|
|
42
|
+
uncommitted_files?: string[];
|
|
43
|
+
last_commit_short?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface LastSession {
|
|
47
|
+
session_id?: string;
|
|
48
|
+
saved_at?: string;
|
|
49
|
+
save_reason?: string;
|
|
50
|
+
transcript_path?: string;
|
|
51
|
+
context_remaining_pct?: number;
|
|
52
|
+
context_warnings_fired?: number[];
|
|
53
|
+
git_state?: GitState;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// §1.3
|
|
57
|
+
export interface Task {
|
|
58
|
+
id: string;
|
|
59
|
+
subject: string;
|
|
60
|
+
description: string;
|
|
61
|
+
active_form: string;
|
|
62
|
+
status: "pending" | "in_progress" | "completed" | "blocked";
|
|
63
|
+
created_at: string;
|
|
64
|
+
completed_at: string | null;
|
|
65
|
+
evidence: string;
|
|
66
|
+
work_summary: string;
|
|
67
|
+
files_changed: string[];
|
|
68
|
+
session_id?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// §1.4
|
|
72
|
+
export interface IndexEntry {
|
|
73
|
+
summary: string;
|
|
74
|
+
mode: string;
|
|
75
|
+
last_active: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IndexFile {
|
|
79
|
+
version: "3.0";
|
|
80
|
+
updated_at: string;
|
|
81
|
+
sessions: Record<string, string>;
|
|
82
|
+
contexts: Record<string, IndexEntry>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// §1.5
|
|
86
|
+
export interface LogEntry {
|
|
87
|
+
ts: string;
|
|
88
|
+
level: "debug" | "info" | "warn" | "error";
|
|
89
|
+
hook: string;
|
|
90
|
+
msg: string;
|
|
91
|
+
component?: string;
|
|
92
|
+
data?: any;
|
|
93
|
+
tb?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// §1.6
|
|
97
|
+
export interface HookInput {
|
|
98
|
+
hook_event_name: string;
|
|
99
|
+
tool_name?: string;
|
|
100
|
+
tool_input?: Record<string, any>;
|
|
101
|
+
tool_result?: string;
|
|
102
|
+
session_id?: string;
|
|
103
|
+
cwd?: string;
|
|
104
|
+
transcript_path?: string;
|
|
105
|
+
context_window?: {
|
|
106
|
+
current_usage?: {
|
|
107
|
+
cache_read_input_tokens?: number;
|
|
108
|
+
input_tokens?: number;
|
|
109
|
+
cache_creation_input_tokens?: number;
|
|
110
|
+
output_tokens?: number;
|
|
111
|
+
};
|
|
112
|
+
context_window_size?: number;
|
|
113
|
+
};
|
|
114
|
+
permission_mode?: string;
|
|
115
|
+
source?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// §1.7 — Three hook output patterns (see hook-utils.ts for emit functions)
|
|
119
|
+
export interface HookOutput {
|
|
120
|
+
// Pattern 1: hookSpecificOutput (PreToolUse, PostToolUse, UserPromptSubmit, etc.)
|
|
121
|
+
hookSpecificOutput?: {
|
|
122
|
+
hookEventName?: string;
|
|
123
|
+
additionalContext?: string;
|
|
124
|
+
permissionDecision?: "allow" | "deny" | "ask";
|
|
125
|
+
permissionDecisionReason?: string;
|
|
126
|
+
updatedInput?: Record<string, unknown>;
|
|
127
|
+
};
|
|
128
|
+
// Pattern 2: Top-level decision (UserPromptSubmit, Stop, SubagentStop)
|
|
129
|
+
decision?: "block";
|
|
130
|
+
reason?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// §1.7b — PermissionRequest output (structurally different from HookOutput)
|
|
134
|
+
export interface PermissionRequestOutput {
|
|
135
|
+
decision: {
|
|
136
|
+
behavior: "allow" | "deny";
|
|
137
|
+
message?: string;
|
|
138
|
+
updatedInput?: Record<string, unknown>;
|
|
139
|
+
updatedPermissions?: Record<string, unknown>;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// §1.8
|
|
144
|
+
export interface InferenceResult {
|
|
145
|
+
success: boolean;
|
|
146
|
+
output: string;
|
|
147
|
+
error?: string;
|
|
148
|
+
latency_ms: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// §1.9
|
|
152
|
+
export interface HandoffDocument {
|
|
153
|
+
context_id: string;
|
|
154
|
+
context_summary: string;
|
|
155
|
+
session_id: string;
|
|
156
|
+
reason: string;
|
|
157
|
+
created_at: string;
|
|
158
|
+
plan_path: string | null;
|
|
159
|
+
context_folder: string;
|
|
160
|
+
events_log_path: string;
|
|
161
|
+
active_tasks: Task[];
|
|
162
|
+
completed_tasks_this_session: Array<{ subject: string }>;
|
|
163
|
+
work_summary: string;
|
|
164
|
+
next_steps: string[];
|
|
165
|
+
important_notes: string[];
|
|
166
|
+
file_path: string | null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// §1.10
|
|
170
|
+
export interface HandoffSections {
|
|
171
|
+
index: string | null;
|
|
172
|
+
deadEnds: string | null;
|
|
173
|
+
pending: string | null;
|
|
174
|
+
plan: string | null;
|
|
175
|
+
decisions: string | null;
|
|
176
|
+
completedWork: string | null;
|
|
177
|
+
context: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// §1.11
|
|
181
|
+
export interface CaretCommand {
|
|
182
|
+
ends: string[];
|
|
183
|
+
select: string | null;
|
|
184
|
+
new_context_desc: string | null;
|
|
185
|
+
remaining_prompt: string;
|
|
186
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Resolve and print the active context ID.
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* bun .aiwcli/_shared/scripts/resolve_context.ts
|
|
7
|
-
*
|
|
8
|
-
* Prints the context ID to stdout. Exits 1 if no active context found.
|
|
9
|
-
* Used by command templates (/handoff, /handoff-resume) to programmatically
|
|
10
|
-
* get the context ID instead of parsing system reminders.
|
|
11
|
-
*
|
|
12
|
-
* Requires CLAUDE_SESSION_ID environment variable (set by Claude Code).
|
|
13
|
-
*/
|
|
14
|
-
import { getContextBySessionId } from "../lib-ts/context/context-store.js";
|
|
15
|
-
import { getProjectRoot } from "../lib-ts/base/constants.js";
|
|
16
|
-
import { eprint } from "../lib-ts/base/utils.js";
|
|
17
|
-
|
|
18
|
-
const projectRoot = getProjectRoot(process.cwd());
|
|
19
|
-
const sessionId = process.env.CLAUDE_SESSION_ID;
|
|
20
|
-
|
|
21
|
-
if (!sessionId) {
|
|
22
|
-
eprint("CLAUDE_SESSION_ID not set. This script must be run from within a Claude Code session.");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const context = getContextBySessionId(sessionId, projectRoot);
|
|
27
|
-
|
|
28
|
-
if (!context) {
|
|
29
|
-
eprint(`No context found for session: ${sessionId}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.log(context.id);
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Resolve and print the active context ID.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* bun .aiwcli/_shared/scripts/resolve_context.ts
|
|
7
|
+
*
|
|
8
|
+
* Prints the context ID to stdout. Exits 1 if no active context found.
|
|
9
|
+
* Used by command templates (/handoff, /handoff-resume) to programmatically
|
|
10
|
+
* get the context ID instead of parsing system reminders.
|
|
11
|
+
*
|
|
12
|
+
* Requires CLAUDE_SESSION_ID environment variable (set by Claude Code).
|
|
13
|
+
*/
|
|
14
|
+
import { getContextBySessionId } from "../lib-ts/context/context-store.js";
|
|
15
|
+
import { getProjectRoot } from "../lib-ts/base/constants.js";
|
|
16
|
+
import { eprint } from "../lib-ts/base/utils.js";
|
|
17
|
+
|
|
18
|
+
const projectRoot = getProjectRoot(process.cwd());
|
|
19
|
+
const sessionId = process.env.CLAUDE_SESSION_ID;
|
|
20
|
+
|
|
21
|
+
if (!sessionId) {
|
|
22
|
+
eprint("CLAUDE_SESSION_ID not set. This script must be run from within a Claude Code session.");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const context = getContextBySessionId(sessionId, projectRoot);
|
|
27
|
+
|
|
28
|
+
if (!context) {
|
|
29
|
+
eprint(`No context found for session: ${sessionId}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log(context.id);
|