aiwcli 0.12.6 → 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.
Files changed (124) hide show
  1. package/bin/dev.cmd +3 -3
  2. package/bin/dev.js +16 -16
  3. package/bin/run.cmd +3 -3
  4. package/bin/run.js +21 -21
  5. package/dist/commands/branch.js +7 -2
  6. package/dist/lib/bmad-installer.js +37 -37
  7. package/dist/lib/terminal.d.ts +2 -0
  8. package/dist/lib/terminal.js +57 -7
  9. package/dist/templates/CLAUDE.md +205 -205
  10. package/dist/templates/_shared/.claude/commands/handoff-resume.md +12 -12
  11. package/dist/templates/_shared/.claude/commands/handoff.md +12 -12
  12. package/dist/templates/_shared/.claude/settings.json +65 -65
  13. package/dist/templates/_shared/.codex/workflows/handoff.md +226 -226
  14. package/dist/templates/_shared/.windsurf/workflows/handoff.md +226 -226
  15. package/dist/templates/_shared/handoff-system/CLAUDE.md +421 -421
  16. package/dist/templates/_shared/handoff-system/lib/document-generator.ts +215 -215
  17. package/dist/templates/_shared/handoff-system/lib/handoff-reader.ts +158 -158
  18. package/dist/templates/_shared/handoff-system/scripts/resume_handoff.ts +373 -373
  19. package/dist/templates/_shared/handoff-system/scripts/save_handoff.ts +469 -469
  20. package/dist/templates/_shared/handoff-system/workflows/handoff-resume.md +66 -66
  21. package/dist/templates/_shared/handoff-system/workflows/handoff.md +254 -254
  22. package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +2 -2
  23. package/dist/templates/_shared/hooks-ts/archive_plan.ts +159 -159
  24. package/dist/templates/_shared/hooks-ts/context_monitor.ts +147 -147
  25. package/dist/templates/_shared/hooks-ts/file-suggestion.ts +128 -128
  26. package/dist/templates/_shared/hooks-ts/pre_compact.ts +49 -49
  27. package/dist/templates/_shared/hooks-ts/session_end.ts +196 -196
  28. package/dist/templates/_shared/hooks-ts/session_start.ts +163 -163
  29. package/dist/templates/_shared/hooks-ts/task_create_capture.ts +48 -48
  30. package/dist/templates/_shared/hooks-ts/task_update_capture.ts +74 -74
  31. package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +93 -93
  32. package/dist/templates/_shared/lib-ts/CLAUDE.md +367 -367
  33. package/dist/templates/_shared/lib-ts/base/atomic-write.ts +138 -138
  34. package/dist/templates/_shared/lib-ts/base/constants.ts +303 -303
  35. package/dist/templates/_shared/lib-ts/base/git-state.ts +58 -58
  36. package/dist/templates/_shared/lib-ts/base/hook-utils.ts +582 -582
  37. package/dist/templates/_shared/lib-ts/base/inference.ts +301 -301
  38. package/dist/templates/_shared/lib-ts/base/logger.ts +247 -247
  39. package/dist/templates/_shared/lib-ts/base/state-io.ts +202 -202
  40. package/dist/templates/_shared/lib-ts/base/stop-words.ts +184 -184
  41. package/dist/templates/_shared/lib-ts/base/utils.ts +184 -184
  42. package/dist/templates/_shared/lib-ts/context/context-formatter.ts +566 -566
  43. package/dist/templates/_shared/lib-ts/context/context-selector.ts +524 -524
  44. package/dist/templates/_shared/lib-ts/context/context-store.ts +712 -712
  45. package/dist/templates/_shared/lib-ts/context/plan-manager.ts +312 -312
  46. package/dist/templates/_shared/lib-ts/context/task-tracker.ts +185 -185
  47. package/dist/templates/_shared/lib-ts/package.json +20 -20
  48. package/dist/templates/_shared/lib-ts/templates/formatters.ts +102 -102
  49. package/dist/templates/_shared/lib-ts/templates/plan-context.ts +58 -58
  50. package/dist/templates/_shared/lib-ts/tsconfig.json +13 -13
  51. package/dist/templates/_shared/lib-ts/types.ts +186 -186
  52. package/dist/templates/_shared/scripts/resolve_context.ts +33 -33
  53. package/dist/templates/_shared/scripts/status_line.ts +690 -690
  54. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/ask.md +136 -136
  55. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/index.md +21 -21
  56. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/overview.md +56 -56
  57. package/dist/templates/cc-native/.claude/commands/cc-native/specdev.md +10 -10
  58. package/dist/templates/cc-native/.windsurf/workflows/cc-native/fix.md +8 -8
  59. package/dist/templates/cc-native/.windsurf/workflows/cc-native/implement.md +8 -8
  60. package/dist/templates/cc-native/.windsurf/workflows/cc-native/research.md +8 -8
  61. package/dist/templates/cc-native/CC-NATIVE-README.md +189 -189
  62. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +304 -304
  63. package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +143 -143
  64. package/dist/templates/cc-native/_cc-native/agents/PLAN-ORCHESTRATOR.md +213 -213
  65. package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -70
  66. package/dist/templates/cc-native/_cc-native/cc-native.config.json +96 -96
  67. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +247 -247
  68. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +76 -76
  69. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +54 -54
  70. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +51 -51
  71. package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -53
  72. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +61 -61
  73. package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -163
  74. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +156 -156
  75. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/format.ts +597 -597
  76. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/index.ts +26 -26
  77. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/tracker.ts +107 -107
  78. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/write.ts +119 -119
  79. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -21
  80. package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +319 -319
  81. package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +144 -144
  82. package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +57 -57
  83. package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +83 -83
  84. package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +119 -119
  85. package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +79 -79
  86. package/dist/templates/cc-native/_cc-native/lib-ts/graduation.ts +132 -132
  87. package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +116 -116
  88. package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +168 -168
  89. package/dist/templates/cc-native/_cc-native/lib-ts/orchestrator.ts +70 -70
  90. package/dist/templates/cc-native/_cc-native/lib-ts/output-builder.ts +130 -130
  91. package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +80 -80
  92. package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -41
  93. package/dist/templates/cc-native/_cc-native/lib-ts/plan-questions.ts +101 -101
  94. package/dist/templates/cc-native/_cc-native/lib-ts/review-pipeline.ts +511 -511
  95. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/agent.ts +71 -71
  96. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/base/base-agent.ts +217 -217
  97. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/index.ts +12 -12
  98. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +66 -66
  99. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/codex-agent.ts +184 -184
  100. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/gemini-agent.ts +39 -39
  101. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +196 -196
  102. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/schemas.ts +201 -201
  103. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/types.ts +21 -21
  104. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/CLAUDE.md +480 -480
  105. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +287 -287
  106. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +148 -148
  107. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +54 -54
  108. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +58 -58
  109. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +208 -208
  110. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +460 -460
  111. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +446 -446
  112. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +280 -280
  113. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +274 -274
  114. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +201 -201
  115. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +278 -278
  116. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +184 -184
  117. package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +275 -275
  118. package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +18 -18
  119. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +329 -329
  120. package/dist/templates/cc-native/_cc-native/lib-ts/verdict.ts +72 -72
  121. package/dist/templates/cc-native/_cc-native/workflows/specdev.md +9 -9
  122. package/oclif.manifest.json +1 -1
  123. package/package.json +108 -108
  124. 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,186 +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" | "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
+ /**
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);