aiwcli 0.9.8 → 0.10.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/bin/run.js +5 -2
- package/dist/lib/claude-settings-types.d.ts +2 -0
- package/dist/templates/CLAUDE.md +3 -3
- package/dist/templates/_shared/.claude/settings.json +4 -0
- package/dist/templates/_shared/hooks/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/archive_plan.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/context_enforcer.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/context_monitor.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/file-suggestion.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/pre_compact.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/session_end.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/session_start.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/task_create_capture.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/task_update_capture.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/__pycache__/user_prompt_submit.cpython-313.pyc +0 -0
- package/dist/templates/_shared/hooks/archive_plan.py +87 -178
- package/dist/templates/_shared/hooks/context_monitor.py +104 -247
- package/dist/templates/_shared/hooks/file-suggestion.py +26 -23
- package/dist/templates/_shared/hooks/pre_compact.py +47 -32
- package/dist/templates/_shared/hooks/session_end.py +103 -60
- package/dist/templates/_shared/hooks/session_start.py +110 -81
- package/dist/templates/_shared/hooks/task_create_capture.py +26 -50
- package/dist/templates/_shared/hooks/task_update_capture.py +42 -115
- package/dist/templates/_shared/hooks/user_prompt_submit.py +61 -61
- package/dist/templates/_shared/lib/base/__init__.py +16 -0
- package/dist/templates/_shared/lib/base/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/base/__pycache__/hook_utils.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/base/__pycache__/inference.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/base/__pycache__/logger.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/base/__pycache__/utils.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/base/hook_utils.py +199 -11
- package/dist/templates/_shared/lib/base/inference.py +121 -0
- package/dist/templates/_shared/lib/base/logger.py +291 -0
- package/dist/templates/_shared/lib/base/utils.py +42 -9
- package/dist/templates/_shared/lib/context/__init__.py +72 -80
- package/dist/templates/_shared/lib/context/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/context_formatter.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/context_manager.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/context_selector.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/context_store.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/discovery.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/plan_manager.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/__pycache__/task_tracker.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/context/context_formatter.py +316 -0
- package/dist/templates/_shared/lib/context/context_selector.py +491 -0
- package/dist/templates/_shared/lib/context/context_store.py +636 -0
- package/dist/templates/_shared/lib/context/plan_manager.py +204 -0
- package/dist/templates/_shared/lib/context/task_tracker.py +188 -0
- package/dist/templates/_shared/lib/handoff/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/handoff/__pycache__/document_generator.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/handoff/document_generator.py +14 -40
- package/dist/templates/_shared/lib/templates/README.md +5 -13
- package/dist/templates/_shared/lib/templates/__init__.py +2 -6
- package/dist/templates/_shared/lib/templates/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/templates/__pycache__/formatters.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/templates/__pycache__/plan_context.cpython-313.pyc +0 -0
- package/dist/templates/_shared/lib/templates/plan_context.py +1 -38
- package/dist/templates/_shared/scripts/__pycache__/save_handoff.cpython-313.pyc +0 -0
- package/dist/templates/_shared/scripts/__pycache__/status_line.cpython-313.pyc +0 -0
- package/dist/templates/_shared/scripts/save_handoff.py +39 -19
- package/dist/templates/_shared/scripts/status_line.py +701 -0
- package/dist/templates/_shared/workflows/handoff.md +9 -3
- package/dist/templates/cc-native/.claude/settings.json +41 -8
- package/dist/templates/cc-native/CC-NATIVE-README.md +25 -28
- package/dist/templates/cc-native/MIGRATION.md +1 -1
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +14 -39
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +49 -21
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/add_plan_context.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/cc-native-plan-review.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/mark_questions_asked.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/plan_accepted.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/plan_questions_early.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/suggest-fresh-perspective.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/add_plan_context.py +57 -55
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.py +163 -131
- package/dist/templates/cc-native/_cc-native/hooks/plan_accepted.py +127 -0
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.py +81 -0
- package/dist/templates/cc-native/_cc-native/hooks/suggest-fresh-perspective.py +26 -25
- package/dist/templates/cc-native/_cc-native/lib/CLAUDE.md +6 -4
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/constants.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/debug.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/orchestrator.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/state.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/__pycache__/utils.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/debug.py +37 -22
- package/dist/templates/cc-native/_cc-native/lib/orchestrator.py +34 -29
- package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/agent.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/base.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/codex.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/__pycache__/gemini.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/agent.py +26 -21
- package/dist/templates/cc-native/_cc-native/lib/reviewers/codex.py +12 -7
- package/dist/templates/cc-native/_cc-native/lib/reviewers/gemini.py +12 -7
- package/dist/templates/cc-native/_cc-native/lib/state.py +31 -16
- package/dist/templates/cc-native/_cc-native/lib/utils.py +207 -40
- package/dist/templates/cc-native/_cc-native/plan-review.config.json +1 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/dist/templates/_shared/hooks/context_enforcer.py +0 -625
- package/dist/templates/_shared/hooks/task_create_atomicity.py +0 -177
- package/dist/templates/_shared/lib/context/auto_state.py +0 -167
- package/dist/templates/_shared/lib/context/cache.py +0 -444
- package/dist/templates/_shared/lib/context/context_extractor.py +0 -115
- package/dist/templates/_shared/lib/context/context_manager.py +0 -1057
- package/dist/templates/_shared/lib/context/discovery.py +0 -554
- package/dist/templates/_shared/lib/context/event_log.py +0 -316
- package/dist/templates/_shared/lib/context/plan_archive.py +0 -101
- package/dist/templates/_shared/lib/context/task_sync.py +0 -407
- package/dist/templates/_shared/lib/templates/persona_questions.py +0 -113
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/archive_plan.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/cc-native-agent-review.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/hooks/__pycache__/test_permission_request.cpython-313.pyc +0 -0
- package/dist/templates/cc-native/_cc-native/lib/async_archive.py +0 -68
- package/dist/templates/cc-native/_cc-native/lib/atomic_write.py +0 -98
|
@@ -31,8 +31,8 @@ SCRIPT_DIR = Path(__file__).resolve().parent
|
|
|
31
31
|
SHARED_ROOT = SCRIPT_DIR.parent
|
|
32
32
|
sys.path.insert(0, str(SHARED_ROOT))
|
|
33
33
|
|
|
34
|
-
from lib.context.
|
|
35
|
-
from lib.base.
|
|
34
|
+
from lib.context.context_store import get_context, save_state, update_mode
|
|
35
|
+
from lib.base.logger import log_info, log_warn, log_error
|
|
36
36
|
from lib.base.atomic_write import atomic_write
|
|
37
37
|
from lib.base.constants import get_handoff_folder_path
|
|
38
38
|
|
|
@@ -106,16 +106,14 @@ def get_git_status() -> str:
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def get_plan_path_from_context(context_id: str, project_root: Path) -> Optional[Path]:
|
|
109
|
-
"""Get the plan path from
|
|
109
|
+
"""Get the plan path from state.json if available."""
|
|
110
110
|
context = get_context(context_id, project_root)
|
|
111
|
-
if not context or not context.
|
|
111
|
+
if not context or not context.plan_path:
|
|
112
112
|
return None
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
if
|
|
116
|
-
plan_path
|
|
117
|
-
if plan_path.exists():
|
|
118
|
-
return plan_path
|
|
114
|
+
plan_path = Path(context.plan_path)
|
|
115
|
+
if plan_path.exists():
|
|
116
|
+
return plan_path
|
|
119
117
|
|
|
120
118
|
return None
|
|
121
119
|
|
|
@@ -206,7 +204,7 @@ def write_section_file(folder: Path, filename: str, title: str, content: str) ->
|
|
|
206
204
|
file_path = folder / filename
|
|
207
205
|
success, error = atomic_write(file_path, '\n'.join(lines))
|
|
208
206
|
if not success:
|
|
209
|
-
|
|
207
|
+
log_warn("save_handoff", f"Failed to write {filename}: {error}")
|
|
210
208
|
return False
|
|
211
209
|
return True
|
|
212
210
|
|
|
@@ -224,7 +222,7 @@ def main():
|
|
|
224
222
|
# Read content from stdin
|
|
225
223
|
content = sys.stdin.read()
|
|
226
224
|
if not content.strip():
|
|
227
|
-
|
|
225
|
+
log_error("save_handoff", "No content provided via stdin")
|
|
228
226
|
sys.exit(1)
|
|
229
227
|
|
|
230
228
|
# Project root is the parent of .aiwcli
|
|
@@ -233,19 +231,19 @@ def main():
|
|
|
233
231
|
# Verify context exists
|
|
234
232
|
context = get_context(context_id, project_root)
|
|
235
233
|
if not context:
|
|
236
|
-
|
|
234
|
+
log_error("save_handoff", f"Context not found: {context_id}")
|
|
237
235
|
sys.exit(1)
|
|
238
236
|
|
|
239
237
|
# Parse frontmatter and sections
|
|
240
238
|
frontmatter, body = parse_frontmatter(content)
|
|
241
239
|
sections = parse_handoff_sections(body)
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
log_info("save_handoff", f"Parsed {len(sections)} sections: {list(sections.keys())}")
|
|
244
242
|
|
|
245
243
|
# Create handoff folder
|
|
246
244
|
handoff_folder = get_handoff_folder_path(context_id, project_root)
|
|
247
245
|
handoff_folder.mkdir(parents=True, exist_ok=True)
|
|
248
|
-
|
|
246
|
+
log_info("save_handoff", f"Created folder: {handoff_folder}")
|
|
249
247
|
|
|
250
248
|
# Get git status
|
|
251
249
|
git_status = get_git_status()
|
|
@@ -261,18 +259,18 @@ def main():
|
|
|
261
259
|
plan_dest = handoff_folder / "plan.md"
|
|
262
260
|
success, error = atomic_write(plan_dest, plan_content)
|
|
263
261
|
if success:
|
|
264
|
-
|
|
262
|
+
log_info("save_handoff", f"Copied plan from {plan_path}")
|
|
265
263
|
else:
|
|
266
|
-
|
|
264
|
+
log_warn("save_handoff", f"Failed to copy plan: {error}")
|
|
267
265
|
except Exception as e:
|
|
268
|
-
|
|
266
|
+
log_warn("save_handoff", f"Failed to read plan: {e}")
|
|
269
267
|
|
|
270
268
|
# Write index.md
|
|
271
269
|
index_content = generate_index(frontmatter, sections, git_status, has_plan)
|
|
272
270
|
index_path = handoff_folder / "index.md"
|
|
273
271
|
success, error = atomic_write(index_path, index_content)
|
|
274
272
|
if not success:
|
|
275
|
-
|
|
273
|
+
log_error("save_handoff", f"Failed to write index.md: {error}")
|
|
276
274
|
sys.exit(1)
|
|
277
275
|
|
|
278
276
|
# Write section files
|
|
@@ -313,7 +311,7 @@ def main():
|
|
|
313
311
|
full_content = '\n'.join(content_parts) + '\n'
|
|
314
312
|
success, error = atomic_write(file_path, full_content)
|
|
315
313
|
if not success:
|
|
316
|
-
|
|
314
|
+
log_warn("save_handoff", f"Failed to write {filename}: {error}")
|
|
317
315
|
|
|
318
316
|
# Ensure all expected files exist (even if empty)
|
|
319
317
|
expected_files = ['completed-work.md', 'dead-ends.md', 'decisions.md', 'pending.md', 'context.md']
|
|
@@ -330,6 +328,28 @@ def main():
|
|
|
330
328
|
if not file_path.exists():
|
|
331
329
|
write_section_file(handoff_folder, filename, titles[filename], "")
|
|
332
330
|
|
|
331
|
+
# Set handoff_path so next session auto-detects it
|
|
332
|
+
try:
|
|
333
|
+
index_path_str = str(handoff_folder / "index.md")
|
|
334
|
+
state = get_context(context_id, project_root)
|
|
335
|
+
if state:
|
|
336
|
+
state.handoff_path = index_path_str
|
|
337
|
+
save_state(state, project_root)
|
|
338
|
+
log_info("save_handoff", f"Set handoff_path: {index_path_str}")
|
|
339
|
+
else:
|
|
340
|
+
log_warn("save_handoff", f"Could not load context state for {context_id}")
|
|
341
|
+
except Exception as e:
|
|
342
|
+
log_warn("save_handoff", f"Handoff saved but auto-resume won't work (context update failed): {e}")
|
|
343
|
+
|
|
344
|
+
# Transition context to idle — handoff is saved, no longer "active work"
|
|
345
|
+
# This prevents auto-selection in new sessions while keeping the context
|
|
346
|
+
# accessible via explicit caret commands (^, ^N)
|
|
347
|
+
try:
|
|
348
|
+
update_mode(context_id, "idle", project_root=project_root)
|
|
349
|
+
log_info("save_handoff", f"Set mode to 'idle' (dormant) for context: {context_id}")
|
|
350
|
+
except Exception as e:
|
|
351
|
+
log_warn("save_handoff", f"Failed to set dormant mode: {e}")
|
|
352
|
+
|
|
333
353
|
# Output success message (ASCII-safe for Windows)
|
|
334
354
|
print(f"[OK] Created handoff folder: {handoff_folder}")
|
|
335
355
|
print(f" - index.md (entry point with navigation)")
|