aiwcli 0.15.1 → 0.15.3

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 (23) hide show
  1. package/dist/commands/launch.d.ts +1 -0
  2. package/dist/commands/launch.js +24 -8
  3. package/dist/templates/_shared/.claude/skills/codex/SKILL.md +19 -26
  4. package/dist/templates/_shared/.codex/workflows/codex.md +11 -0
  5. package/dist/templates/_shared/lib-ts/agent-exec/backends/tmux.ts +23 -49
  6. package/dist/templates/_shared/lib-ts/base/launchers/tmux-launcher.ts +173 -0
  7. package/dist/templates/_shared/lib-ts/base/launchers/window-launcher.ts +93 -0
  8. package/dist/templates/_shared/lib-ts/base/launchers/wt-launcher.ts +64 -0
  9. package/dist/templates/_shared/lib-ts/base/pane-launcher.ts +55 -0
  10. package/dist/templates/_shared/lib-ts/base/sentinel-ipc.ts +87 -0
  11. package/dist/templates/_shared/lib-ts/base/tmux-driver.ts +160 -200
  12. package/dist/templates/_shared/lib-ts/base/tmux-pane-placement.ts +78 -0
  13. package/dist/templates/_shared/lib-ts/context/context-formatter.ts +0 -3
  14. package/dist/templates/_shared/scripts/resolve-run.ts +1 -1
  15. package/dist/templates/_shared/skills/codex/CLAUDE.md +70 -0
  16. package/dist/templates/_shared/skills/codex/SKILL.md +71 -0
  17. package/dist/templates/_shared/skills/{prompt-codex/scripts/watch-codex.ts → codex/lib/codex-watcher.ts} +78 -63
  18. package/dist/templates/_shared/skills/{prompt-codex → codex}/scripts/launch-codex.ts +106 -61
  19. package/dist/templates/_shared/skills/codex/scripts/watch-codex.ts +42 -0
  20. package/oclif.manifest.json +2 -2
  21. package/package.json +1 -1
  22. package/dist/templates/_shared/.claude/skills/codex/prompt.md +0 -30
  23. package/dist/templates/_shared/skills/prompt-codex/CLAUDE.md +0 -71
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Thin CLI wrapper over lib/codex-watcher.ts for backward compatibility.
4
+ *
5
+ * Usage:
6
+ * bun watch-codex.ts <pane_id> <session_id> <session_file>
7
+ *
8
+ * Prefer using launch-codex.ts directly (watch is built-in by default).
9
+ */
10
+ import {
11
+ SUMMARY_UNAVAILABLE_MESSAGE,
12
+ summarizeFromSessionFileFallback,
13
+ summarizeViaResume,
14
+ summarizeViaSessionFileSpark,
15
+ waitForPaneClose,
16
+ } from "../lib/codex-watcher.js";
17
+
18
+ async function main(): Promise<void> {
19
+ const [paneId, sessionId, sessionFile] = process.argv.slice(2);
20
+ if (!paneId) {
21
+ console.log(SUMMARY_UNAVAILABLE_MESSAGE);
22
+ return;
23
+ }
24
+
25
+ await waitForPaneClose(paneId);
26
+
27
+ const sf = sessionFile ?? "";
28
+ const sid = sessionId ?? "";
29
+ const summary =
30
+ summarizeViaSessionFileSpark(sf) ??
31
+ (sid ? await summarizeViaResume(sid) : null) ??
32
+ summarizeFromSessionFileFallback(sf) ??
33
+ SUMMARY_UNAVAILABLE_MESSAGE;
34
+
35
+ console.log("\n--- Codex Session Summary ---");
36
+ console.log(summary);
37
+ }
38
+
39
+ main().catch((error) => {
40
+ console.error(`watch-codex error: ${String(error)}`);
41
+ console.log(SUMMARY_UNAVAILABLE_MESSAGE);
42
+ });
@@ -275,7 +275,7 @@
275
275
  "launch": {
276
276
  "aliases": [],
277
277
  "args": {},
278
- "description": "Launch Claude Code or Codex with AIW configuration (sandbox disabled, tmux-first by default)\n\nFLAGS\n --codex/-c: Launch Codex instead of Claude Code (uses --yolo flag)\n --new/-n: Open a new terminal in the current directory and launch there\n --no-tmux/-t: Launch directly in current shell instead of auto-launching tmux\n --tmux-session/-s: tmux session name to reuse when auto-launching tmux (default is fresh session per launch)\n\nEXIT CODES\n 0 Success - AI assistant launched and exited successfully\n 1 General error - unexpected runtime failure\n 2 Invalid usage - check your arguments and flags\n 3 Environment error - CLI/tmux not found (install Claude Code from https://claude.ai/download, Codex from npm, tmux from your package manager)",
278
+ "description": "Launch Claude Code or Codex with AIW configuration (sandbox disabled, tmux-first by default)\n\nFLAGS\n --codex/-c: Launch Codex instead of Claude Code (uses --yolo flag)\n --new/-n: Open a new terminal in the current directory and launch there\n --no-tmux/-t: Launch directly in current shell instead of auto-launching tmux\n --tmux-session/-s: tmux session name to reuse when auto-launching tmux (default is fresh session per launch)\n\nEXIT CODES\n 0 Success - AI assistant launched and exited successfully\n 1 General error - unexpected runtime failure\n 2 Invalid usage - check your arguments and flags\n 3 Environment error - CLI not found (install Claude Code from https://claude.ai/download, Codex from npm)",
279
279
  "examples": [
280
280
  "<%= config.bin %> <%= command.id %> # Auto-launches tmux with a fresh session when not already in tmux",
281
281
  "<%= config.bin %> <%= command.id %> --codex # Launch Codex with --yolo flag",
@@ -434,5 +434,5 @@
434
434
  ]
435
435
  }
436
436
  },
437
- "version": "0.15.1"
437
+ "version": "0.15.3"
438
438
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aiwcli",
3
3
  "description": "AI Workflow CLI - Command-line interface for AI-powered workflows",
4
- "version": "0.15.1",
4
+ "version": "0.15.3",
5
5
  "author": "jofu-tofu",
6
6
  "bin": {
7
7
  "aiw": "bin/run.js"
@@ -1,30 +0,0 @@
1
- # /codex
2
-
3
- | Command | Description |
4
- |---|---|
5
- | `bun launch-codex.ts [--model fast|standard|smart|<model-id>] [--sandbox read-only|workspace-write|danger-full-access] [--no-yolo] [--capture] plan` | Launch Codex REPL with active plan. |
6
- | `bun launch-codex.ts [--model fast|standard|smart|<model-id>] [--sandbox read-only|workspace-write|danger-full-access] [--no-yolo] [--capture] --file <path>` | Launch Codex REPL with file contents. |
7
- | `bun launch-codex.ts [--model fast|standard|smart|<model-id>] [--sandbox read-only|workspace-write|danger-full-access] [--no-yolo] [--capture] <inline text...>` | Launch Codex REPL with inline prompt. |
8
-
9
- - `--model`: model tier (`fast`/`standard`/`smart`) resolves to `gpt-5.3-codex-spark` / `gpt-5.3-codex`, or any explicit Codex model id. Aliases: `spark`, `codex`, `gpt`.
10
- - `--sandbox`: `read-only`, `workspace-write`, or `danger-full-access`. Default is `danger-full-access` for implementation handoffs.
11
- - YOLO mode is **on by default** — bypasses all approvals and sandbox (`--dangerously-bypass-approvals-and-sandbox`). Use `--no-yolo` to disable.
12
- - `--capture`: best-effort session capture. If setup succeeds, launch output includes:
13
- - `CODEX_CAPTURE_PANE=<pane_id>`
14
- - `CODEX_CAPTURE_SESSION_ID=<session_id>`
15
- - `CODEX_CAPTURE_SESSION_FILE=<path>`
16
-
17
- If launch output includes `CODEX_CAPTURE_PANE` and `CODEX_CAPTURE_SESSION_ID`:
18
-
19
- 1. Parse pane/session metadata from stdout.
20
- 2. Start a background watcher:
21
- ```bash
22
- bun .aiwcli/_shared/skills/prompt-codex/scripts/watch-codex.ts <pane_id> <session_id> <session_file>
23
- ```
24
- Use `Bash` with `run_in_background: true`.
25
- 3. Tell the user: `Codex is running in the tmux pane. I'll receive a summary when you exit.`
26
- 4. Continue with other work; the background task output will arrive as a notification.
27
-
28
- Watcher behavior:
29
- - Primary: summarize from `CODEX_CAPTURE_SESSION_FILE` with Spark.
30
- - Fallback: use `codex exec resume <session_id>` if transcript summarization fails.
@@ -1,71 +0,0 @@
1
- # Prompt Codex Skill
2
-
3
- Launch Codex CLI in a tmux pane and inject a prompt into its REPL.
4
-
5
- ## Directory Structure
6
-
7
- ```
8
- prompt-codex/
9
- ├── CLAUDE.md ← This file
10
- └── scripts/
11
- ├── launch-codex.ts ← CLI entry point
12
- └── watch-codex.ts ← Capture watcher and summarizer
13
- ```
14
-
15
- ## Script: launch-codex.ts
16
-
17
- **Usage:**
18
- ```bash
19
- bun .aiwcli/_shared/skills/prompt-codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--full-auto] plan
20
- bun .aiwcli/_shared/skills/prompt-codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--full-auto] --file <path>
21
- bun .aiwcli/_shared/skills/prompt-codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--full-auto] <inline text...>
22
- bun .aiwcli/_shared/skills/prompt-codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--full-auto] [--capture] <mode>
23
- ```
24
-
25
- **Args:**
26
- - `plan` — discover active plan via context system, inject into Codex REPL
27
- - `--file <path>` — inject file contents into Codex REPL
28
- - `<text...>` — join remaining args as inline prompt, write to temp file, inject
29
- - `--model <alias|tier|id>` — Aliases: `spark` → `gpt-5.3-codex-spark`, `codex` → `gpt-5.3-codex`, `gpt` → `gpt-5.2`. Tiers: `fast`/`standard`/`smart` (resolved via `resolveModelForProvider()`). Or any full model ID. Aliases are checked first (local `CODEX_ALIASES` constant in `launch-codex.ts`), then tiers, then pass-through. Omitted = Codex default.
30
- - `--sandbox <mode>` — `read-only`, `workspace-write`, or `danger-full-access`. Default is `danger-full-access` for implementation handoffs.
31
- - `--no-yolo` — Disable YOLO mode (on by default). YOLO maps to Codex CLI's `--dangerously-bypass-approvals-and-sandbox`. Use `--no-yolo` to restore normal approval prompts.
32
- - `--capture` — Best-effort session capture. On success, prints:
33
- - `CODEX_CAPTURE_PANE=<pane_id>`
34
- - `CODEX_CAPTURE_SESSION_ID=<session_id>`
35
- - `CODEX_CAPTURE_SESSION_FILE=<session_file>`
36
- These are consumed by the skill prompt to run `watch-codex.ts` as a background task.
37
-
38
- **Plan discovery order:**
39
- 1. `CLAUDE_SESSION_ID` env → `getContextBySessionId()` → `findLatestPlan(contextId)`
40
- 2. Fallback: scan `_output/contexts/*/plans/*.md` by mtime (inline, no `_cc-native` import)
41
-
42
- **Dependencies (all from `_shared/lib-ts/`):**
43
- - `base/tmux-driver.ts` — `launchDriverInTmuxOrFallback()`, `getTmuxAvailability()`
44
- - `base/cli-args.ts` — `resolveCodexModel()`, `codexReplSpec()`, `buildCliInvocation()`, `isCodexSandbox()`
45
- - `base/logger.ts` — `logDebug()`, `logWarn()` (injection diagnostics)
46
- - `context/context-store.ts` — `getContextBySessionId()`
47
- - `context/context-formatter.ts` — `buildExternalAgentContext()` (orientation header for Codex)
48
- - `context/plan-manager.ts` — `findLatestPlan()`
49
-
50
- **Design decisions:**
51
- - Always creates a new tmux pane (no pane reuse/tracking)
52
- - No exec fallback — REPL mode requires tmux
53
- - `_shared` only — never imports from `_cc-native`
54
- - Temp file cleanup after injection confirmed
55
-
56
- ## Script: watch-codex.ts
57
-
58
- **Usage:**
59
- ```bash
60
- bun .aiwcli/_shared/skills/prompt-codex/scripts/watch-codex.ts <pane_id> <session_id> <session_file>
61
- ```
62
-
63
- **Behavior:**
64
- - Polls tmux until `<pane_id>` closes
65
- - Primary: parses `<session_file>` transcript and summarizes via Spark (`inference()` + `CODEX_MODELS.spark`)
66
- - Fallback: runs `codex exec resume <session_id>` if transcript summarization fails
67
- - Final fallback: emits concise transcript lines directly from `<session_file>`
68
-
69
- **Resilience policy:**
70
- - Capture path is best-effort and never blocks Codex launch
71
- - Watcher exits cleanly on poll/summary/parse failures with fallback text