ftown-bridge 0.19.39 → 0.19.41

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 (116) hide show
  1. package/dist/cli-client.d.ts +17 -0
  2. package/dist/cli-client.js +76 -0
  3. package/dist/cli-client.js.map +1 -0
  4. package/dist/cli-entry.d.ts +2 -0
  5. package/dist/cli-entry.js +22 -0
  6. package/dist/cli-entry.js.map +1 -0
  7. package/dist/codex-installer.d.ts +1 -1
  8. package/dist/codex-installer.js +7 -6
  9. package/dist/codex-installer.js.map +1 -1
  10. package/dist/command-rpc.js +0 -1
  11. package/dist/command-rpc.js.map +1 -1
  12. package/dist/create-ftown-session.d.ts +1 -6
  13. package/dist/create-ftown-session.js +3 -25
  14. package/dist/create-ftown-session.js.map +1 -1
  15. package/dist/cursor-hook-installer.d.ts +1 -1
  16. package/dist/cursor-hook-installer.js +6 -5
  17. package/dist/cursor-hook-installer.js.map +1 -1
  18. package/dist/ensure-ftown-path.js +1 -1
  19. package/dist/env-commands.d.ts +32 -0
  20. package/dist/env-commands.js +162 -0
  21. package/dist/env-commands.js.map +1 -0
  22. package/dist/ftown-cli.d.ts +2 -6
  23. package/dist/ftown-cli.js +25 -79
  24. package/dist/ftown-cli.js.map +1 -1
  25. package/dist/ftown-env-cli.d.ts +2 -31
  26. package/dist/ftown-env-cli.js +7 -176
  27. package/dist/ftown-env-cli.js.map +1 -1
  28. package/dist/ftown-home.d.ts +24 -10
  29. package/dist/ftown-home.js +19 -41
  30. package/dist/ftown-home.js.map +1 -1
  31. package/dist/ftown-sessions-cli.d.ts +1 -1
  32. package/dist/ftown-sessions-cli.js +6 -499
  33. package/dist/ftown-sessions-cli.js.map +1 -1
  34. package/dist/harness-cli.d.ts +1 -1
  35. package/dist/harness-cli.js +6 -626
  36. package/dist/harness-cli.js.map +1 -1
  37. package/dist/harness-commands.d.ts +2 -0
  38. package/dist/harness-commands.js +576 -0
  39. package/dist/harness-commands.js.map +1 -0
  40. package/dist/harness-installer.d.ts +1 -10
  41. package/dist/harness-installer.js +13 -166
  42. package/dist/harness-installer.js.map +1 -1
  43. package/dist/harness-registry.d.ts +1 -27
  44. package/dist/harness-registry.js +1 -20
  45. package/dist/harness-registry.js.map +1 -1
  46. package/dist/hook-installer.d.ts +1 -1
  47. package/dist/hook-installer.js +5 -4
  48. package/dist/hook-installer.js.map +1 -1
  49. package/dist/index.js +10 -108
  50. package/dist/index.js.map +1 -1
  51. package/dist/install-ftown-command-cli.d.ts +3 -3
  52. package/dist/install-ftown-command-cli.js +67 -22
  53. package/dist/install-ftown-command-cli.js.map +1 -1
  54. package/dist/install-ftown-skill.d.ts +6 -0
  55. package/dist/install-ftown-skill.js +111 -10
  56. package/dist/install-ftown-skill.js.map +1 -1
  57. package/dist/install-notify-script.d.ts +1 -1
  58. package/dist/install-notify-script.js +7 -6
  59. package/dist/install-notify-script.js.map +1 -1
  60. package/dist/mail-delivery.d.ts +1 -1
  61. package/dist/mail-delivery.js +3 -5
  62. package/dist/mail-delivery.js.map +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/server.js.map +1 -1
  65. package/dist/muse-plugin-installer.js +4 -0
  66. package/dist/muse-plugin-installer.js.map +1 -1
  67. package/dist/opencode-plugin-installer.d.ts +1 -2
  68. package/dist/opencode-plugin-installer.js +1 -2
  69. package/dist/opencode-plugin-installer.js.map +1 -1
  70. package/dist/provider-env-store.js +1 -1
  71. package/dist/provider-env-store.js.map +1 -1
  72. package/dist/retired-skill-assets.d.ts +3 -0
  73. package/dist/retired-skill-assets.js +11 -0
  74. package/dist/retired-skill-assets.js.map +1 -1
  75. package/dist/sessions-commands.d.ts +2 -0
  76. package/dist/sessions-commands.js +445 -0
  77. package/dist/sessions-commands.js.map +1 -0
  78. package/dist/setup-migrations.d.ts +6 -0
  79. package/dist/setup-migrations.js +28 -0
  80. package/dist/setup-migrations.js.map +1 -0
  81. package/dist/setup-state.d.ts +16 -0
  82. package/dist/setup-state.js +163 -0
  83. package/dist/setup-state.js.map +1 -0
  84. package/dist/setup.d.ts +25 -0
  85. package/dist/setup.js +120 -0
  86. package/dist/setup.js.map +1 -0
  87. package/dist/types.d.ts +1 -0
  88. package/dist/wire-types.js +1 -8
  89. package/dist/wire-types.js.map +1 -1
  90. package/package.json +2 -3
  91. package/pi-extension/API.md +4 -0
  92. package/pi-extension/ftown.js +1 -2
  93. package/skills/ftown/SKILL.md +71 -19
  94. package/skills/ftown/references/orchestrator.md +23 -99
  95. package/skills/ftown/references/sessions.md +37 -42
  96. package/dist/claude-trust.d.ts +0 -11
  97. package/dist/claude-trust.js +0 -47
  98. package/dist/claude-trust.js.map +0 -1
  99. package/dist/install-ftown-cli.d.ts +0 -3
  100. package/dist/install-ftown-cli.js +0 -29
  101. package/dist/install-ftown-cli.js.map +0 -1
  102. package/dist/install-ftown-env-cli.d.ts +0 -3
  103. package/dist/install-ftown-env-cli.js +0 -30
  104. package/dist/install-ftown-env-cli.js.map +0 -1
  105. package/dist/install-ftown-workflows-cli.d.ts +0 -3
  106. package/dist/install-ftown-workflows-cli.js +0 -33
  107. package/dist/install-ftown-workflows-cli.js.map +0 -1
  108. package/dist/workflow-runner-cli.d.ts +0 -2
  109. package/dist/workflow-runner-cli.js +0 -376
  110. package/dist/workflow-runner-cli.js.map +0 -1
  111. package/dist/workflow-runner.d.ts +0 -163
  112. package/dist/workflow-runner.js +0 -307
  113. package/dist/workflow-runner.js.map +0 -1
  114. package/skills/fticket/SKILL.md +0 -166
  115. package/skills/ftown/references/workflows.md +0 -470
  116. package/skills/ftown/scripts/example.flow.mjs +0 -170
@@ -1,106 +1,30 @@
1
- # ftown orchestrator playbook
1
+ # Worker coordination examples
2
2
 
3
- You are running inside an ftown session (your id is in `$FTOWN_SESSION_ID`) and
4
- can coordinate worker agent sessions on this machine using the
5
- `~/.ftown/ftown-sessions` CLI.
3
+ Read `../SKILL.md` for identity, reporting and cleanup behavior, and
4
+ `sessions.md` for the command reference. These examples add only coordination
5
+ steps. Use an ordinary session with the requested task and parent link; no
6
+ special orchestrator mode is needed.
6
7
 
7
- See `references/sessions.md` for the full session CLI reference.
8
-
9
- ## Spawning workers
10
-
11
- Omit `--shell` to inherit the orchestrator's current harness. Use `--shell` only
12
- when the user or task explicitly requests a different harness (`claude`, `cursor`,
13
- `codex`, `grok`, `muse`, `pi`, `kimi-code`, `shell`, `opencode`, or a Claude Code provider
14
- flavor such as `zai`, `kimi`, `deepseek`, `fireworks`). `--parent` sets the worker's
15
- parent to `$FTOWN_SESSION_ID`.
16
-
17
- ```bash
18
- ~/.ftown/ftown-sessions create \
19
- --parent \
20
- --workdir /path/to/repo \
21
- --name review-auth \
22
- --prompt "Review the auth module and summarize findings"
23
- ```
24
-
25
- Returns JSON containing `session.id` — save it to inspect the worker later.
26
- Workers spawned with `--parent` are auto-briefed about reporting results and
27
- escalations through mail, then removing themselves when finished.
28
- Provider-flavored workers require a bridge-host token configured with
29
- `ftown env set <flavor> <token>`; the bridge supplies their endpoint/model
30
- environment when it spawns them.
31
-
32
- ## Monitoring workers
8
+ List existing sessions before creating another worker. Give each worker a
9
+ bounded task, clear writable files and acceptance checks; save the returned
10
+ `session.id` for follow-up. Omit `--shell` to inherit your current harness, or
11
+ set it when the task calls for a different harness. Provider flavors require a
12
+ bridge-host token configured with `ftown env set <flavor>`.
33
13
 
34
14
  ```bash
35
- # See what's on screen right now
36
- ~/.ftown/ftown-sessions screen <session-id> --limit 100
37
-
38
- # Search for errors / completion markers
39
- ~/.ftown/ftown-sessions grep <session-id> --pattern 'FAIL|done|error'
40
-
41
- # Check if the process is still alive
42
- ~/.ftown/ftown-sessions running <session-id>
15
+ ftown sessions list
16
+ ftown sessions create --parent --workdir /path/to/repo --name review-auth \
17
+ --prompt "Review auth; read-only. Report concrete findings and validation."
18
+ ftown sessions screen <worker-id> --limit 100
19
+ ftown sessions running <worker-id>
20
+ ftown harness mail send <worker-id> --type task "Check the expired-token case too"
21
+ ftown sessions tell --children "Pause and report status"
43
22
  ```
44
23
 
45
- Use `screen` / `grep` to investigate a worker that has gone quiet. When waiting for
46
- results, end your turn and let mail wake you instead of running a polling loop.
47
-
48
- ## Messaging (mail)
49
-
50
- Each session has an inbox. Claude and codex receive mail automatically at turn
51
- boundaries via hooks. Pi's bundled extension maintains a long-poll and wakes idle
52
- Pi sessions with a native follow-up turn. Muse's installed `ftown` plugin
53
- reports the native session id on SessionStart and pumps pending mail as
54
- context on Stop. None of these paths inject terminal
55
- keystrokes. Cursor and shell sessions have no hooks: when idle they get a one-line
56
- nudge telling them to run `ftown-harness mail read`, so expect slightly slower
57
- pickup there.
58
-
59
- ```bash
60
- # Send work / instructions to a child
61
- ftown-harness mail send <child> --type task "implement the API client"
62
-
63
- # Reply in a thread, or escalate
64
- ftown-harness mail send <child> --thread <id> "use the v2 endpoint"
65
-
66
- # Read your own inbox on demand (you also get mail automatically)
67
- ftown-harness mail read
68
- ```
69
-
70
- Children report back with `mail send --parent --type result` (or
71
- `--type escalation` when blocked). Fan-out works via
72
- `~/.ftown/ftown-sessions tell --children "pause and report status"` (now mail
73
- under the hood; one of `--parent | --children | --siblings`).
74
-
75
- If a worker is idle and must be woken right now, terminal keystroke injection
76
- (`ftown-harness send <id> "..." -s` or `tell --keys`) is the **last resort** —
77
- prefer mail, which arrives at the next turn boundary.
78
-
79
- ## Cleanup
80
-
81
- ```bash
82
- # Archive a finished worker (kept as a tombstone)
83
- ~/.ftown/ftown-sessions remove <session-id>
84
-
85
- # Bring it back — resumes the agent conversation if its agent session id was
86
- # recorded before removal; otherwise restarts fresh with a new id
87
- ~/.ftown/ftown-sessions revive <session-id>
88
- ```
89
-
90
- Child briefings normally make workers report first and then remove themselves. Explicitly
91
- ask a worker to stay open when you need follow-up interaction; otherwise, clean up any
92
- worker that exits without honoring the self-removal instruction.
93
-
94
- ## Practical guidance
95
-
96
- - **Parallelize** independent tasks: spawn multiple workers before waiting for any.
97
- - **Follow worker results**: read incoming mail and use `screen` / `grep` for diagnosis.
98
- - **Name workers clearly**: `--name` shows in `list` output and as the sender
99
- name on incoming mail.
100
- - **Check `list` first**: see what's already running before spawning duplicates.
101
-
102
- ## If the CLI is missing
24
+ Use terminal output to investigate a quiet worker. Mail handles results and
25
+ escalations; read them with `ftown harness mail read`. When waiting, let incoming
26
+ mail resume the conversation rather than repeatedly polling. Parallel tasks need
27
+ disjoint write ownership and serialized shared resources.
103
28
 
104
- Start or restart **ftown-bridge** on this machine. It installs
105
- `~/.ftown/ftown-sessions` and updates the unified skill under
106
- `~/.ftown/skills/ftown/` (linked into ~/.agents/skills and ~/.claude/skills).
29
+ After accepting a worker's result, request any concrete follow-up before
30
+ explicit cleanup with `ftown sessions remove <worker-id>`.
@@ -1,9 +1,9 @@
1
1
  # ftown cross-session CLI
2
2
 
3
- **Prefer the CLI** — installed to `~/.ftown/ftown-sessions` whenever `ftown-bridge` is running. It reads `~/.ftown/bridge.json` automatically.
3
+ Use `ftown sessions`, installed by explicit `ftown setup` before the bridge starts. It reads `~/.ftown/bridge.json` automatically.
4
4
 
5
5
  ```bash
6
- ~/.ftown/ftown-sessions --help
6
+ ftown sessions --help
7
7
  ```
8
8
 
9
9
  Unified skill wrapper: `scripts/ftown` in this skill directory delegates to the
@@ -15,40 +15,40 @@ top-level `~/.ftown/ftown` dispatcher.
15
15
 
16
16
  ```bash
17
17
  # List sessions (JSON)
18
- ~/.ftown/ftown-sessions list
18
+ ftown sessions list
19
19
 
20
20
  # Spawn a child agent (uses FTOWN_SESSION_ID for --parent)
21
- ~/.ftown/ftown-sessions create \
21
+ ftown sessions create \
22
22
  --prompt "Review the auth module and summarize" \
23
23
  --workdir /path/to/repo \
24
24
  --name auth-review \
25
25
  --parent
26
26
 
27
27
  # Metadata
28
- ~/.ftown/ftown-sessions get <session-id>
28
+ ftown sessions get <session-id>
29
29
 
30
30
  # Terminal output (JSON by default; add --plain for raw lines)
31
- ~/.ftown/ftown-sessions screen <session-id> --limit 200
31
+ ftown sessions screen <session-id> --limit 200
32
32
 
33
33
  # Search output (--offset/--limit paginate screen and grep)
34
- ~/.ftown/ftown-sessions grep <session-id> --pattern 'error|failed' --offset 0 --limit 100
34
+ ftown sessions grep <session-id> --pattern 'error|failed' --offset 0 --limit 100
35
35
 
36
36
  # Type into another running session
37
- ~/.ftown/ftown-sessions keys <session-id> 'y'
37
+ ftown sessions keys <session-id> 'y'
38
38
 
39
39
  # Liveness
40
- ~/.ftown/ftown-sessions running <session-id>
40
+ ftown sessions running <session-id>
41
41
 
42
42
  # Stop and remove a session (kept as a tombstone in the archive)
43
- ~/.ftown/ftown-sessions remove <session-id>
43
+ ftown sessions remove <session-id>
44
44
 
45
45
  # List archived (removed) sessions: id, name, removedAt, shellType
46
- ~/.ftown/ftown-sessions archive
46
+ ftown sessions archive
47
47
 
48
48
  # Recreate a removed session from its tombstone (resumes the agent
49
49
  # conversation when a claude/cursor/codex/Pi session id was recorded; Kimi Code
50
50
  # continues by working directory; the revived session gets a NEW id)
51
- ~/.ftown/ftown-sessions revive <session-id>
51
+ ftown sessions revive <session-id>
52
52
  ```
53
53
 
54
54
  ## Messaging (mail)
@@ -61,27 +61,27 @@ follow-up turn when mail arrives, including while Pi is idle. opencode's
61
61
  installed plugin delivers pending mail as a new prompt when a turn goes idle.
62
62
  Muse's installed `ftown` plugin reports the native session id on SessionStart
63
63
  and pumps pending mail as context on Stop.
64
- Cursor and shell sessions rely on an idle one-line nudge to run `ftown-harness
64
+ Cursor and shell sessions rely on an idle one-line nudge to run `ftown harness
65
65
  mail read` instead.
66
66
 
67
67
  ```bash
68
68
  # Tell a specific session
69
- ~/.ftown/ftown-sessions tell <session-id> "tests are green, ship it"
69
+ ftown sessions tell <session-id> "tests are green, ship it"
70
70
 
71
71
  # Mail type / threading
72
- ~/.ftown/ftown-sessions tell <session-id> --type task "implement the API client"
73
- ~/.ftown/ftown-sessions tell <session-id> --type result --thread <id> "done, 0 failures"
72
+ ftown sessions tell <session-id> --type task "implement the API client"
73
+ ftown sessions tell <session-id> --type result --thread <id> "done, 0 failures"
74
74
 
75
75
  # Tell my parent / children / siblings (resolved via FTOWN_SESSION_ID)
76
- ~/.ftown/ftown-sessions tell --parent "child finished phase 1"
77
- ~/.ftown/ftown-sessions tell --children "pause and report status"
78
- ~/.ftown/ftown-sessions tell --siblings "I grabbed the lock, stand by"
76
+ ftown sessions tell --parent "child finished phase 1"
77
+ ftown sessions tell --children "pause and report status"
78
+ ftown sessions tell --siblings "I grabbed the lock, stand by"
79
79
 
80
80
  # Last resort: inject as terminal keystrokes instead of mail
81
- ~/.ftown/ftown-sessions tell <session-id> --keys "wake up"
81
+ ftown sessions tell <session-id> --keys "wake up"
82
82
 
83
83
  # Read my own inbox (requires FTOWN_SESSION_ID; alias: mail)
84
- ~/.ftown/ftown-sessions inbox # --peek / --limit N / --all / --json
84
+ ftown sessions inbox # --peek / --limit N / --all / --json
85
85
  ```
86
86
 
87
87
  Sender is resolved from `FTOWN_SESSION_ID` (omitted when unset).
@@ -98,7 +98,6 @@ Fan-out targets are messaged sequentially, one JSON result line per target.
98
98
  | `--command` | Full command override (skips `--shell` builder) |
99
99
  | `--parent` | Set parent to `$FTOWN_SESSION_ID` |
100
100
  | `--parent-id` | Explicit parent session UUID |
101
- | `--orchestrator` | Brief the new agent (non-`shell`) to spawn and coordinate sibling sessions |
102
101
  | `--model` | Harness model name or provider/model pattern (when supported) |
103
102
 
104
103
  Provider-flavored shells (`zai`, `kimi`, `deepseek`, `fireworks`) run Claude
@@ -110,14 +109,12 @@ Returns JSON with the new `session.id` — use that id for `screen` / `grep` / `
110
109
  ## Typical workflow
111
110
 
112
111
  ```bash
113
- CLI=~/.ftown/ftown-sessions
114
-
115
- $CLI list
116
- $CLI create --prompt "Run tests and report" --workdir "$PWD" --parent
112
+ ftown sessions list
113
+ ftown sessions create --prompt "Run tests and report" --workdir "$PWD" --parent
117
114
  # -> note session.id from JSON
118
115
 
119
- $CLI screen <child-id> --limit 100
120
- $CLI grep <child-id> --pattern 'FAIL|Error'
116
+ ftown sessions screen <child-id> --limit 100
117
+ ftown sessions grep <child-id> --pattern 'FAIL|Error'
121
118
  ```
122
119
 
123
120
  ## Environment
@@ -126,23 +123,19 @@ Spawned ftown sessions receive:
126
123
 
127
124
  - `FTOWN_SESSION_ID` — this session (use with `--parent`)
128
125
  - `FTOWN_PARENT_SESSION_ID` — the parent session id, set on children spawned with `--parent` / `--parent-id`
129
- - `FTOWN_ORCHESTRATOR` — set to `1` on sessions created with `--orchestrator`
130
126
  - `FTOWN_HOOK_PORT` / `FTOWN_HOOK_TOKEN` — hook forwarding (not for cross-session control)
131
127
 
132
128
  Agent children (any `--shell` except `shell`) spawned with a parent also get an
133
129
  automatic one-paragraph briefing prepended to their first input: it states their
134
130
  name/id and parent name/id. It explains how to report via
135
- `ftown-harness mail send --parent --type result` (or `--type escalation` when blocked).
136
- After reporting the outcome, the child is instructed to remove itself as
137
- its final command unless the user explicitly asked it to stay open. The creator's
138
- `--prompt` follows after a `Task:` line.
139
-
140
- An agent session created with `--orchestrator` additionally gets `FTOWN_ORCHESTRATOR=1`
141
- in its environment and a compact pointer briefing directing it to the unified
142
- **ftown** skill, whose `references/orchestrator.md` contains the full
143
- orchestrator playbook for spawning workers, monitoring them, and cleaning up.
144
- When both apply, the child paragraph comes first, then the orchestrator pointer,
145
- separated by a blank line.
131
+ `ftown harness mail send --parent --type result` (or `--type escalation` when blocked).
132
+ The creator's `--prompt` follows after a `Task:` line. Session cleanup is an
133
+ explicit user or orchestrator action; see the ftown skill.
134
+
135
+ A task and optional parent link are sufficient for coordination. Legacy
136
+ `--orchestrator` and request booleans are accepted as ignored compatibility inputs;
137
+ there is no role briefing or injected role environment. Explicit user-supplied
138
+ environment variables remain untouched.
146
139
 
147
140
  ## HTTP API (optional)
148
141
 
@@ -175,7 +168,9 @@ back to the bridge root. Parent and child must belong to the same bridge.
175
168
 
176
169
  ## If the CLI is missing
177
170
 
178
- Start or restart **ftown-bridge** on this machine. It installs
179
- `~/.ftown/ftown-sessions`, `~/.ftown/notify.sh`, and updates the unified skill
171
+ Run `npm exec --yes --package ftown-bridge@<version> -- ftown setup`, using the
172
+ version in the bridge readiness hint. This works before the installed alias
173
+ exists and installs the `ftown` command, compatible
174
+ launchers, `~/.ftown/notify.sh`, and updates the unified skill
180
175
  under `~/.ftown/skills/ftown/` (linked into ~/.agents/skills and
181
176
  ~/.claude/skills).
@@ -1,11 +0,0 @@
1
- /**
2
- * Pre-trust `dir` for Claude Code so a spawned worker does not block on the
3
- * interactive "Do you trust this folder?" dialog — which `--dangerously-skip-permissions`
4
- * does NOT dismiss. Sets `projects[dir].hasTrustDialogAccepted = true` in `~/.claude.json`,
5
- * preserving every other field, via an atomic temp+rename. Best-effort: never throws.
6
- *
7
- * Scoped to ftown-workflows workers (non-interactive automation). The claude config keys
8
- * projects by REAL path (e.g. `/private/tmp`, not `/tmp`), so we trust the realpath.
9
- * Mirrors the bridge's `ensureCodexWorkdirTrust`.
10
- */
11
- export declare function ensureClaudeWorkdirTrust(dir: string): void;
@@ -1,47 +0,0 @@
1
- import { readFileSync, realpathSync, renameSync, writeFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { join } from 'node:path';
4
- /**
5
- * Pre-trust `dir` for Claude Code so a spawned worker does not block on the
6
- * interactive "Do you trust this folder?" dialog — which `--dangerously-skip-permissions`
7
- * does NOT dismiss. Sets `projects[dir].hasTrustDialogAccepted = true` in `~/.claude.json`,
8
- * preserving every other field, via an atomic temp+rename. Best-effort: never throws.
9
- *
10
- * Scoped to ftown-workflows workers (non-interactive automation). The claude config keys
11
- * projects by REAL path (e.g. `/private/tmp`, not `/tmp`), so we trust the realpath.
12
- * Mirrors the bridge's `ensureCodexWorkdirTrust`.
13
- */
14
- export function ensureClaudeWorkdirTrust(dir) {
15
- let real = dir;
16
- try {
17
- real = realpathSync(dir);
18
- }
19
- catch {
20
- // Path may not exist yet; fall back to the input verbatim.
21
- }
22
- const configPath = join(homedir(), '.claude.json');
23
- let cfg = {};
24
- try {
25
- cfg = JSON.parse(readFileSync(configPath, 'utf8'));
26
- }
27
- catch {
28
- // Missing or unreadable — start fresh; claude fills in the rest on launch.
29
- cfg = {};
30
- }
31
- if (!cfg.projects || typeof cfg.projects !== 'object')
32
- cfg.projects = {};
33
- const existing = cfg.projects[real];
34
- if (existing && existing.hasTrustDialogAccepted === true)
35
- return; // already trusted
36
- cfg.projects[real] = { ...(existing ?? {}), hasTrustDialogAccepted: true };
37
- const tmpPath = `${configPath}.ftw-tmp`;
38
- try {
39
- writeFileSync(tmpPath, JSON.stringify(cfg, null, 2));
40
- renameSync(tmpPath, configPath);
41
- }
42
- catch {
43
- // Best-effort: if we cannot persist trust the worker may hit the dialog, but the
44
- // workflow run must not crash.
45
- }
46
- }
47
- //# sourceMappingURL=claude-trust.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude-trust.js","sourceRoot":"","sources":["../src/claude-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,2DAA2D;IAC7D,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;IAEnD,IAAI,GAAG,GAAiB,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAiB,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,GAAG,GAAG,EAAE,CAAC;IACX,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;IAEzE,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,IAAI,QAAQ,CAAC,sBAAsB,KAAK,IAAI;QAAE,OAAO,CAAC,kBAAkB;IAEpF,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC;IAE3E,MAAM,OAAO,GAAG,GAAG,UAAU,UAAU,CAAC;IACxC,IAAI,CAAC;QACH,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;QACjF,+BAA+B;IACjC,CAAC;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const CANONICAL_CLI_PATH: string;
2
- /** Copy CLI bundle and install ~/.ftown/ftown-sessions launcher. */
3
- export declare function installFtownSessionsCli(compiledCliPath: string): string;
@@ -1,29 +0,0 @@
1
- import { chmodSync, copyFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { dirname, join } from 'node:path';
4
- export const CANONICAL_CLI_PATH = join(homedir(), '.ftown', 'ftown-sessions');
5
- /** Copy CLI bundle and install ~/.ftown/ftown-sessions launcher. */
6
- export function installFtownSessionsCli(compiledCliPath) {
7
- const ftownDir = join(homedir(), '.ftown');
8
- const cliJsPath = join(ftownDir, 'ftown-sessions-cli.js');
9
- // Resolve the launcher path from ftownDir (not the module-level constant) so the
10
- // whole install is consistent with homedir() at call time and HOME-override-safe.
11
- const launcherPath = join(ftownDir, 'ftown-sessions');
12
- mkdirSync(ftownDir, { recursive: true, mode: 0o700 });
13
- writeFileSync(join(ftownDir, 'package.json'), '{"type":"module"}\n', { mode: 0o644 });
14
- copyFileSync(compiledCliPath, cliJsPath);
15
- chmodSync(cliJsPath, 0o644);
16
- // The compiled CLI imports the shared wire-types module at runtime, so it must sit
17
- // alongside it in ~/.ftown.
18
- const wireTypesSrc = join(dirname(compiledCliPath), 'wire-types.js');
19
- const wireTypesDest = join(ftownDir, 'wire-types.js');
20
- copyFileSync(wireTypesSrc, wireTypesDest);
21
- chmodSync(wireTypesDest, 0o644);
22
- const launcher = `#!/usr/bin/env bash
23
- set -euo pipefail
24
- exec node "${cliJsPath}" "$@"
25
- `;
26
- writeFileSync(launcherPath, launcher, { mode: 0o755 });
27
- return launcherPath;
28
- }
29
- //# sourceMappingURL=install-ftown-cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-ftown-cli.js","sourceRoot":"","sources":["../src/install-ftown-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAE9E,oEAAoE;AACpE,MAAM,UAAU,uBAAuB,CAAC,eAAuB;IAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;IAC1D,iFAAiF;IACjF,kFAAkF;IAClF,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEtD,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE5B,mFAAmF;IACnF,4BAA4B;IAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;IACrE,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACtD,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAC1C,SAAS,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAEhC,MAAM,QAAQ,GAAG;;aAEN,SAAS;CACrB,CAAC;IACA,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const CANONICAL_ENV_CLI_PATH: string;
2
- /** Copy the CLI bundle and install the ~/.ftown/ftown-env launcher. */
3
- export declare function installFtownEnvCli(compiledCliPath: string): string;
@@ -1,30 +0,0 @@
1
- import { chmodSync, copyFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { dirname, join } from 'node:path';
4
- export const CANONICAL_ENV_CLI_PATH = join(homedir(), '.ftown', 'ftown-env');
5
- /** Copy the CLI bundle and install the ~/.ftown/ftown-env launcher. */
6
- export function installFtownEnvCli(compiledCliPath) {
7
- const ftownDir = join(homedir(), '.ftown');
8
- const cliJsPath = join(ftownDir, 'ftown-env-cli.js');
9
- // Resolve the launcher path from ftownDir (not the module-level constant) so the
10
- // whole install is consistent with homedir() at call time and HOME-override-safe.
11
- const launcherPath = join(ftownDir, 'ftown-env');
12
- mkdirSync(ftownDir, { recursive: true, mode: 0o700 });
13
- writeFileSync(join(ftownDir, 'package.json'), '{"type":"module"}\n', { mode: 0o644 });
14
- copyFileSync(compiledCliPath, cliJsPath);
15
- chmodSync(cliJsPath, 0o644);
16
- // The compiled CLI does `import './provider-env-store.js'` at runtime, so the
17
- // store module must sit alongside it. The store has no further local imports,
18
- // so a single sibling copy is sufficient.
19
- const storeSrc = join(dirname(compiledCliPath), 'provider-env-store.js');
20
- const storeDest = join(ftownDir, 'provider-env-store.js');
21
- copyFileSync(storeSrc, storeDest);
22
- chmodSync(storeDest, 0o644);
23
- const launcher = `#!/usr/bin/env bash
24
- set -euo pipefail
25
- exec node "${cliJsPath}" "$@"
26
- `;
27
- writeFileSync(launcherPath, launcher, { mode: 0o755 });
28
- return launcherPath;
29
- }
30
- //# sourceMappingURL=install-ftown-env-cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-ftown-env-cli.js","sourceRoot":"","sources":["../src/install-ftown-env-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE7E,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,eAAuB;IACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACrD,iFAAiF;IACjF,kFAAkF;IAClF,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAEjD,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtF,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE5B,8EAA8E;IAC9E,8EAA8E;IAC9E,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,uBAAuB,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;IAC1D,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAClC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE5B,MAAM,QAAQ,GAAG;;aAEN,SAAS;CACrB,CAAC;IACA,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const CANONICAL_WORKFLOWS_CLI_PATH: string;
2
- /** Copy CLI bundle and install ~/.ftown/ftown-workflows launcher. */
3
- export declare function installFtownWorkflowsCli(compiledCliPath: string): string;
@@ -1,33 +0,0 @@
1
- import { chmodSync, copyFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { dirname, join } from 'node:path';
4
- export const CANONICAL_WORKFLOWS_CLI_PATH = join(homedir(), '.ftown', 'ftown-workflows');
5
- /** Copy CLI bundle and install ~/.ftown/ftown-workflows launcher. */
6
- export function installFtownWorkflowsCli(compiledCliPath) {
7
- const ftownDir = join(homedir(), '.ftown');
8
- const cliJsPath = join(ftownDir, 'ftown-workflows-cli.js');
9
- // Resolve the launcher path from ftownDir (not the module-level constant) so the
10
- // whole install is consistent with homedir() at call time and HOME-override-safe.
11
- const launcherPath = join(ftownDir, 'ftown-workflows');
12
- mkdirSync(ftownDir, { recursive: true, mode: 0o700 });
13
- writeFileSync(join(ftownDir, 'package.json'), '{"type":"module"}\n', { mode: 0o644 });
14
- copyFileSync(compiledCliPath, cliJsPath);
15
- chmodSync(cliJsPath, 0o644);
16
- // The compiled CLI imports sibling modules at runtime, so each local dependency
17
- // must sit alongside it in ~/.ftown.
18
- const engineSrc = join(dirname(compiledCliPath), 'workflow-runner.js');
19
- const engineDest = join(ftownDir, 'workflow-runner.js');
20
- copyFileSync(engineSrc, engineDest);
21
- chmodSync(engineDest, 0o644);
22
- const claudeTrustSrc = join(dirname(compiledCliPath), 'claude-trust.js');
23
- const claudeTrustDest = join(ftownDir, 'claude-trust.js');
24
- copyFileSync(claudeTrustSrc, claudeTrustDest);
25
- chmodSync(claudeTrustDest, 0o644);
26
- const launcher = `#!/usr/bin/env bash
27
- set -euo pipefail
28
- exec node "${cliJsPath}" "$@"
29
- `;
30
- writeFileSync(launcherPath, launcher, { mode: 0o755 });
31
- return launcherPath;
32
- }
33
- //# sourceMappingURL=install-ftown-workflows-cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-ftown-workflows-cli.js","sourceRoot":"","sources":["../src/install-ftown-workflows-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAEzF,qEAAqE;AACrE,MAAM,UAAU,wBAAwB,CAAC,eAAuB;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IAC3D,iFAAiF;IACjF,kFAAkF;IAClF,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAEvD,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE5B,gFAAgF;IAChF,qCAAqC;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,oBAAoB,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACxD,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACpC,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC,CAAC;IACzE,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC1D,YAAY,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC9C,SAAS,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAElC,MAAM,QAAQ,GAAG;;aAEN,SAAS;CACrB,CAAC;IACA,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};