aiwcli 0.13.0 → 0.13.1

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 (27) hide show
  1. package/dist/commands/init/index.d.ts +8 -8
  2. package/dist/commands/init/index.js +24 -24
  3. package/dist/templates/_shared/.claude/settings.json +57 -2
  4. package/dist/templates/_shared/.windsurf/workflows/handoff.md +4 -221
  5. package/dist/templates/_shared/.windsurf/workflows/meta-plan.md +5 -341
  6. package/dist/templates/_shared/hooks-ts/context_monitor.ts +2 -2
  7. package/dist/templates/_shared/lib-ts/CLAUDE.md +27 -2
  8. package/dist/templates/_shared/lib-ts/base/lint-dispatch.ts +52 -0
  9. package/dist/templates/_shared/scripts/resolve-run.ts +1 -0
  10. package/dist/templates/_shared/skills/handoff-system/CLAUDE.md +4 -4
  11. package/dist/templates/_shared/skills/handoff-system/lib/document-generator.ts +8 -8
  12. package/dist/templates/_shared/skills/handoff-system/lib/handoff-reader.ts +3 -3
  13. package/dist/templates/_shared/skills/handoff-system/scripts/resume_handoff.ts +4 -4
  14. package/dist/templates/_shared/skills/handoff-system/scripts/save_handoff.ts +6 -6
  15. package/dist/templates/_shared/skills/handoff-system/workflows/handoff.md +2 -2
  16. package/dist/templates/_shared/skills/meta-plan/CLAUDE.md +8 -6
  17. package/dist/templates/_shared/skills/meta-plan/workflows/meta-plan.md +102 -172
  18. package/dist/templates/cc-native/.claude/settings.json +1 -127
  19. package/dist/templates/cc-native/_cc-native/artifacts/lib/format.ts +14 -14
  20. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +32 -2
  21. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +25 -0
  22. package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +6 -1
  23. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +1 -0
  24. package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +75 -0
  25. package/dist/templates/cc-native/_cc-native/plan-review/lib/corroboration.ts +69 -16
  26. package/oclif.manifest.json +1 -1
  27. package/package.json +1 -1
@@ -29,6 +29,14 @@ export default class Init extends BaseCommand {
29
29
  * @returns Template description
30
30
  */
31
31
  private getTemplateDescription;
32
+ /**
33
+ * Install the global resolve-run.ts script to ~/.aiwcli/bin/.
34
+ *
35
+ * This resolver allows hook and status line commands to find the project root
36
+ * regardless of cwd drift (e.g., after `cd` in a Bash tool call).
37
+ * Always overwrites to ensure the latest version is installed.
38
+ */
39
+ private installGlobalResolver;
32
40
  /**
33
41
  * Perform minimal installation (_shared folder only, no template method).
34
42
  *
@@ -77,14 +85,6 @@ export default class Init extends BaseCommand {
77
85
  * @returns Wizard configuration result
78
86
  */
79
87
  private runInteractiveWizard;
80
- /**
81
- * Install the global resolve-run.ts script to ~/.aiwcli/bin/.
82
- *
83
- * This resolver allows hook and status line commands to find the project root
84
- * regardless of cwd drift (e.g., after `cd` in a Bash tool call).
85
- * Always overwrites to ensure the latest version is installed.
86
- */
87
- private installGlobalResolver;
88
88
  /**
89
89
  * Track method installation in settings.json
90
90
  *
@@ -233,6 +233,30 @@ export default class Init extends BaseCommand {
233
233
  };
234
234
  return descriptions[template] || 'Custom template';
235
235
  }
236
+ /**
237
+ * Install the global resolve-run.ts script to ~/.aiwcli/bin/.
238
+ *
239
+ * This resolver allows hook and status line commands to find the project root
240
+ * regardless of cwd drift (e.g., after `cd` in a Bash tool call).
241
+ * Always overwrites to ensure the latest version is installed.
242
+ */
243
+ async installGlobalResolver() {
244
+ try {
245
+ const currentFilePath = fileURLToPath(import.meta.url);
246
+ const currentDir = dirname(currentFilePath);
247
+ const templatesRoot = join(dirname(dirname(currentDir)), 'templates');
248
+ const resolverSrc = join(templatesRoot, '_shared', 'scripts', 'resolve-run.ts');
249
+ const globalBinDir = join(homedir(), '.aiwcli', 'bin');
250
+ const resolverDest = join(globalBinDir, 'resolve-run.ts');
251
+ await fs.mkdir(globalBinDir, { recursive: true });
252
+ await fs.copyFile(resolverSrc, resolverDest);
253
+ this.logSuccess('✓ Global resolver installed (~/.aiwcli/bin/resolve-run.ts)');
254
+ }
255
+ catch (error) {
256
+ const err = error;
257
+ this.warn(`Failed to install global resolver: ${err.message}`);
258
+ }
259
+ }
236
260
  /**
237
261
  * Perform minimal installation (_shared folder only, no template method).
238
262
  *
@@ -432,30 +456,6 @@ export default class Init extends BaseCommand {
432
456
  confirmed,
433
457
  };
434
458
  }
435
- /**
436
- * Install the global resolve-run.ts script to ~/.aiwcli/bin/.
437
- *
438
- * This resolver allows hook and status line commands to find the project root
439
- * regardless of cwd drift (e.g., after `cd` in a Bash tool call).
440
- * Always overwrites to ensure the latest version is installed.
441
- */
442
- async installGlobalResolver() {
443
- try {
444
- const currentFilePath = fileURLToPath(import.meta.url);
445
- const currentDir = dirname(currentFilePath);
446
- const templatesRoot = join(dirname(dirname(currentDir)), 'templates');
447
- const resolverSrc = join(templatesRoot, '_shared', 'scripts', 'resolve-run.ts');
448
- const globalBinDir = join(homedir(), '.aiwcli', 'bin');
449
- const resolverDest = join(globalBinDir, 'resolve-run.ts');
450
- await fs.mkdir(globalBinDir, { recursive: true });
451
- await fs.copyFile(resolverSrc, resolverDest);
452
- this.logSuccess('✓ Global resolver installed (~/.aiwcli/bin/resolve-run.ts)');
453
- }
454
- catch (error) {
455
- const err = error;
456
- this.warn(`Failed to install global resolver: ${err.message}`);
457
- }
458
- }
459
459
  /**
460
460
  * Track method installation in settings.json
461
461
  *
@@ -14,14 +14,14 @@
14
14
  {
15
15
  "type": "command",
16
16
  "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/user_prompt_submit.ts",
17
- "timeout": 5000
17
+ "timeout": 10000
18
18
  }
19
19
  ]
20
20
  }
21
21
  ],
22
22
  "PostToolUse": [
23
23
  {
24
- "matcher": "Task|Read|Bash|WebFetch|Edit|Write|NotebookEdit",
24
+ "matcher": "*",
25
25
  "hooks": [
26
26
  {
27
27
  "type": "command",
@@ -50,6 +50,61 @@
50
50
  }
51
51
  ]
52
52
  },
53
+ {
54
+ "matcher": "ExitPlanMode",
55
+ "hooks": [
56
+ {
57
+ "type": "command",
58
+ "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/archive_plan.ts",
59
+ "timeout": 5000
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "matcher": "Write|Edit",
65
+ "hooks": [
66
+ {
67
+ "type": "command",
68
+ "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/lint_after_edit.ts",
69
+ "timeout": 10000
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ "SessionStart": [
75
+ {
76
+ "hooks": [
77
+ {
78
+ "type": "command",
79
+ "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/session_start.ts",
80
+ "timeout": 5000
81
+ }
82
+ ]
83
+ }
84
+ ],
85
+ "SessionEnd": [
86
+ {
87
+ "hooks": [
88
+ {
89
+ "type": "command",
90
+ "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/session_end.ts",
91
+ "timeout": 5000
92
+ }
93
+ ]
94
+ }
95
+ ],
96
+ "PreCompact": [
97
+ {
98
+ "hooks": [
99
+ {
100
+ "type": "command",
101
+ "command": "bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/hooks-ts/pre_compact.ts",
102
+ "timeout": 5000
103
+ }
104
+ ]
105
+ }
106
+ ],
107
+ "PermissionRequest": [
53
108
  {
54
109
  "matcher": "ExitPlanMode",
55
110
  "hooks": [
@@ -1,226 +1,9 @@
1
- # Handoff Workflow
2
-
3
- Generate a handoff document summarizing the current session's work, decisions, and pending items. Optionally update a plan document to track completed vs remaining tasks.
4
-
5
- ## Triggers
6
-
7
- - `/handoff` command
8
- - `/handoff path/to/PLAN.md` - with plan document integration
9
- - Phrases like "write a handoff", "create a session summary", "document what we did", "end session with notes"
10
-
11
- ## Arguments
12
-
13
- - `$ARGUMENTS` - Optional path to a plan document. If provided, the handoff will:
14
- 1. Mark completed items in the plan with `[x]`
15
- 2. Add notes about partial progress
16
- 3. Append a "Session Progress" section to the plan
17
-
18
- ## Process
19
-
20
- ### Step 1: Get Context ID
21
-
22
- Extract the `context_id` from the system reminder injected by the context enforcer hook.
23
-
24
- Look for the pattern in the system reminder:
25
- ```
26
- Active Context: {context_id}
27
- ```
28
-
29
- If no active context is found, inform the user and stop - handoffs require an active context.
30
-
31
- ### Step 2: Gather Information
32
-
33
- 1. Review conversation history for:
34
- - Completed tasks and implementations
35
- - Key decisions and their rationale
36
- - Failed approaches (to avoid repeating)
37
- - External context (deadlines, stakeholder requirements)
38
-
39
- 2. Check git status if available:
40
- ```bash
41
- git status --short
42
- git diff --stat
43
- ```
44
-
45
- 3. Look for TODOs/FIXMEs mentioned in session
46
-
47
- 4. **If plan document provided**: Read the plan and identify:
48
- - Tasks that are now completed
49
- - Tasks that are partially done
50
- - Tasks that were attempted but blocked
51
- - New tasks discovered during implementation
52
-
53
- ### Step 3: Generate Document
54
-
55
- Use this template. The `<!-- SECTION: name -->` markers are required for the save script to parse sections into sharded files.
56
-
57
- ```markdown
58
- ---
59
- title: Session Handoff
60
- date: {ISO timestamp}
61
- session_id: {conversation ID if available}
62
- project: {project name from package.json, Cargo.toml, or directory name}
63
- context_id: {context_id from Step 1}
64
- plan_document: {path to plan if provided, or "none"}
65
- ---
66
-
67
- # Session Handoff — {Date}
68
-
69
- <!-- SECTION: summary -->
70
- ## Summary
71
- {2-3 sentences: what's different now vs. session start}
72
-
73
- <!-- SECTION: completed -->
74
- ## Work Completed
75
- {Grouped by category if multiple areas. Specific file:function references.}
76
-
77
- <!-- SECTION: dead-ends -->
78
- ## Dead Ends — Do Not Retry
79
-
80
- These approaches were attempted and failed. Do not retry without addressing the root cause.
81
-
82
- | Approach | Why It Failed | Time Spent | Alternative |
83
- |----------|---------------|------------|-------------|
84
- | {What was attempted} | {Specific reason} | {Rough estimate} | {What to try instead} |
85
-
86
- <!-- SECTION: decisions -->
87
- ## Key Decisions
88
- {Technical choices with rationale. Format: **Decision**: Rationale. Trade-off: X.}
89
-
90
- <!-- SECTION: pending -->
91
- ## Pending Issues
92
- - [ ] {Issue} — {severity: HIGH/MED/LOW} {optional workaround note}
93
-
94
- <!-- SECTION: next-steps -->
95
- ## Next Steps
96
- 1. {Actionable item with file:line reference if applicable}
97
-
98
- <!-- SECTION: files -->
99
- ## Files Modified
100
- {Significant changes only. Skip formatting-only edits.}
101
-
102
- <!-- SECTION: context -->
103
- ## Context for Future Sessions
104
- {Non-obvious context: env quirks, stakeholder requirements}
105
-
106
- ```
107
-
108
- ### Step 4: Update Plan Document (if provided)
109
-
110
- If a plan document path was provided in `$ARGUMENTS`:
111
-
112
- 1. **Read the plan document**
113
- 2. **Identify completed items**:
114
- - Find checkboxes `- [ ]` that match completed work
115
- - Change them to `- [x]`
116
- 3. **Add progress notes** to items that are partially complete:
117
- - Append `(partial: {brief status})` to the line
118
- 4. **Append Session Progress section** at the bottom:
119
-
120
- ```markdown
121
-
122
1
  ---
123
-
124
- ## Session Progress Log
125
-
126
- ### {Date} — Session {session_id or timestamp}
127
-
128
- **Completed this session:**
129
- - [x] {Task from plan that was completed}
130
- - [x] {Another completed task}
131
-
132
- **Partially completed:**
133
- - {Task} — {current state, what remains}
134
-
135
- **Blocked/Deferred:**
136
- - {Task} — {reason, what's needed}
137
-
138
- **New items discovered:**
139
- - [ ] {New task not in original plan}
140
- - [ ] {Another new task}
141
-
2
+ description: Create handoff document to preserve session context for future sessions
142
3
  ---
143
- ```
144
-
145
- 5. **If no plan document was provided**:
146
- - Skip plan creation - the handoff document serves as the session record
147
-
148
- ### Step 5: Save and Update Status
149
-
150
- Instead of writing the file directly, pipe your handoff content to the save script:
151
-
152
- ```bash
153
- bun .aiwcli/_shared/skills/handoff-system/scripts/save_handoff.ts "{context_id}" <<'EOF'
154
- {Your complete handoff markdown content from Step 3}
155
- EOF
156
- ```
157
-
158
- This script:
159
- 1. Creates a folder at `_output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/`
160
- 2. Parses sections and writes sharded files (index.md, completed-work.md, dead-ends.md, etc.)
161
- 3. Copies the current plan (if any) to plan.md
162
- 4. Records the event in the context's event log (informational only)
163
-
164
- Use the handoff folder for context in the next session.
165
-
166
- ## Dead Ends Section Guidelines
167
-
168
- This section is critical for preventing context rot across sessions. Be specific:
169
-
170
- **Bad (too vague):**
171
- > - Tried using library X, didn't work
172
-
173
- **Good (actionable):**
174
- > ### Fixing the race condition in SessionStore
175
- > | Approach Tried | Why It Failed |
176
- > |----------------|---------------|
177
- > | `async-mutex` package | Deadlock when nested calls to `getSession()` |
178
- > | Redis WATCH/MULTI | Our Redis 6.x cluster doesn't support WATCH in cluster mode |
179
- > | In-memory lock Map | Works single-node but breaks in horizontal scaling |
180
- >
181
- > **What to try instead**: Upgrade to Redis 7.x which supports WATCH in cluster mode, or use Redlock algorithm
182
-
183
- **Capture these dead ends:**
184
- - Packages/libraries that had incompatibilities
185
- - Approaches that caused new bugs or regressions
186
- - Solutions that worked locally but failed in CI/staging/prod
187
- - Configurations that conflicted with existing setup
188
- - Rabbit holes that consumed significant time without progress
189
-
190
- ## Post-Generation Output
191
-
192
- After creating file, output:
193
-
194
- ```
195
- ✓ Created handoff folder: _output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/
196
- - index.md (entry point with navigation)
197
- - completed-work.md, dead-ends.md, decisions.md, pending.md, context.md
198
- - plan.md (copy of current plan, if any)
199
-
200
- To continue next session:
201
- The index.md will be automatically suggested when you start a new session.
202
- Read dead-ends.md first to avoid repeating failed approaches.
203
-
204
- ⚠️ {N} dead ends documented — avoid re-attempting these approaches
205
- ```
206
4
 
207
- If plan was updated:
208
- ```
209
- ✓ Updated plan document: {path}
210
- - {N} items marked complete
211
- - {N} items partially complete
212
- - {N} new items added
213
- ```
5
+ # Handoff
214
6
 
215
- ## Success Criteria
7
+ Load and execute the handoff workflow from `.aiwcli/_shared/skills/handoff-system/workflows/handoff.md`.
216
8
 
217
- - [ ] Handoff folder created at `handoffs/{YYYY-MM-DD-HHMM}/`
218
- - [ ] index.md contains summary and navigation table
219
- - [ ] All section files created (completed-work.md, dead-ends.md, etc.)
220
- - [ ] Dead ends use structured table format for quick scanning
221
- - [ ] plan.md copied from context if plan exists
222
- - [ ] Next steps are actionable with file references
223
- - [ ] Git status included in index.md
224
- - [ ] If plan provided: checkboxes updated to reflect completion status
225
- - [ ] If plan provided: Session Progress Log appended
226
- - [ ] Context state updated to indicate handoff pending
9
+ **Triggers:** "/handoff", "write a handoff", "create a session summary", "document what we did", "end session with notes"