ftown-bridge 0.19.39 → 0.19.40

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 (47) hide show
  1. package/dist/create-ftown-session.js +3 -8
  2. package/dist/create-ftown-session.js.map +1 -1
  3. package/dist/ftown-cli.d.ts +1 -0
  4. package/dist/ftown-cli.js +15 -7
  5. package/dist/ftown-cli.js.map +1 -1
  6. package/dist/ftown-env-cli.d.ts +1 -0
  7. package/dist/ftown-env-cli.js +15 -4
  8. package/dist/ftown-env-cli.js.map +1 -1
  9. package/dist/ftown-home.js +1 -1
  10. package/dist/ftown-sessions-cli.js +3 -3
  11. package/dist/harness-cli.js +3 -3
  12. package/dist/harness-installer.js +8 -75
  13. package/dist/harness-installer.js.map +1 -1
  14. package/dist/harness-registry.d.ts +2 -23
  15. package/dist/harness-registry.js +2 -16
  16. package/dist/harness-registry.js.map +1 -1
  17. package/dist/index.js +2 -8
  18. package/dist/index.js.map +1 -1
  19. package/dist/install-ftown-skill.d.ts +6 -0
  20. package/dist/install-ftown-skill.js +78 -3
  21. package/dist/install-ftown-skill.js.map +1 -1
  22. package/dist/mail-delivery.js +1 -1
  23. package/dist/mail-delivery.js.map +1 -1
  24. package/dist/provider-env-store.js +1 -1
  25. package/dist/provider-env-store.js.map +1 -1
  26. package/dist/retired-skill-assets.d.ts +3 -0
  27. package/dist/retired-skill-assets.js +11 -0
  28. package/dist/retired-skill-assets.js.map +1 -1
  29. package/package.json +2 -3
  30. package/skills/ftown/SKILL.md +54 -19
  31. package/skills/ftown/references/orchestrator.md +22 -99
  32. package/skills/ftown/references/sessions.md +32 -35
  33. package/dist/claude-trust.d.ts +0 -11
  34. package/dist/claude-trust.js +0 -47
  35. package/dist/claude-trust.js.map +0 -1
  36. package/dist/install-ftown-workflows-cli.d.ts +0 -3
  37. package/dist/install-ftown-workflows-cli.js +0 -33
  38. package/dist/install-ftown-workflows-cli.js.map +0 -1
  39. package/dist/workflow-runner-cli.d.ts +0 -2
  40. package/dist/workflow-runner-cli.js +0 -376
  41. package/dist/workflow-runner-cli.js.map +0 -1
  42. package/dist/workflow-runner.d.ts +0 -163
  43. package/dist/workflow-runner.js +0 -307
  44. package/dist/workflow-runner.js.map +0 -1
  45. package/skills/fticket/SKILL.md +0 -166
  46. package/skills/ftown/references/workflows.md +0 -470
  47. package/skills/ftown/scripts/example.flow.mjs +0 -170
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ftown-bridge",
3
- "version": "0.19.39",
3
+ "version": "0.19.40",
4
4
  "description": "CLI bridge for ftown — generic PTY-over-Centrifugo relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,7 +10,6 @@
10
10
  "ftown-harness": "dist/harness-cli.js",
11
11
  "ftown-env": "dist/ftown-env-cli.js",
12
12
  "ftown-sessions": "bin/ftown-sessions",
13
- "ftown-workflows": "dist/workflow-runner-cli.js",
14
13
  "ftown-mcp": "dist/mcp-cli.js"
15
14
  },
16
15
  "files": [
@@ -23,7 +22,7 @@
23
22
  "skills"
24
23
  ],
25
24
  "scripts": {
26
- "build": "tsc",
25
+ "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
27
26
  "test": "node --import tsx --test \"src/**/*.test.ts\"",
28
27
  "prepublishOnly": "npm run build",
29
28
  "start": "tsx src/index.ts",
@@ -1,33 +1,68 @@
1
1
  ---
2
2
  name: ftown
3
3
  description: >-
4
- Control ftown from inside agent sessions: create/list/read/drive sibling
5
- sessions, send ftown mail, and coordinate worker agent sessions. Use when a task
6
- mentions ftown, ftown sessions, bridge sessions, child/sibling agents, mail/inbox,
7
- orchestration, or fan-out.
4
+ Control ftown sessions: create/list/read/drive sibling sessions, send ftown
5
+ mail, and coordinate worker agents. Use for ftown sessions, child/sibling
6
+ agents, bridge mail/inbox, or explicitly requested orchestration.
8
7
  ---
9
8
 
10
9
  # ftown
11
10
 
12
- Use the local bridge CLIs installed under `~/.ftown`. They read
13
- `~/.ftown/bridge.json`; anyone who can read that file can control the bridge's
14
- sessions.
11
+ Use `ftown sessions`, `ftown harness`, and `ftown env`. Run `ftown --help`
12
+ for command discovery; if it is missing from PATH, use `~/.ftown/ftown`.
13
+ The bridge installs this skill at `~/.ftown/skills/ftown`, linked from the agent
14
+ skill directories. Start or restart ftown-bridge to update it and the CLIs.
15
15
 
16
- ## Pick The Reference
16
+ ## Commands and references
17
17
 
18
- - Session control, mail, terminal output, archive/revive, or local API:
19
- read `references/sessions.md`.
20
- - Ad-hoc multi-agent coordination from an orchestrator session:
21
- read `references/orchestrator.md`.
18
+ ```bash
19
+ ftown sessions list
20
+ ftown sessions create --prompt "Review the auth module" --workdir "$PWD" --parent
21
+ ftown sessions screen <session-id> --limit 200
22
+ ftown harness mail send <session-id> --type task "review the API client"
23
+ ftown harness mail read
24
+ ftown env --help
25
+ ```
26
+
27
+ Read `references/sessions.md` for the session, mail and terminal command
28
+ reference. Read `references/orchestrator.md` for practical worker coordination
29
+ examples. Each command group also has `--help`.
30
+
31
+ ## Identity and reporting
32
+
33
+ Your id is `$FTOWN_SESSION_ID`; children also receive `$FTOWN_PARENT_SESSION_ID`.
34
+ A child's initial briefing identifies it and its parent and explains reporting:
35
+
36
+ ```bash
37
+ ftown harness mail send --parent --type result "Done; checks passed"
38
+ ftown harness mail send --parent --type escalation "Blocked: need the API contract"
39
+ ```
40
+
41
+ Mail arrives as `[ftown mail]` context through harness hooks/extensions where
42
+ available. Cursor and shell sessions receive an idle nudge to read their inbox.
43
+ Prefer mail for agent communication; use terminal key injection only when the
44
+ task needs it. Inspect peers with `ftown sessions list` and
45
+ `ftown sessions screen <id> --limit 100`.
22
46
 
23
- ## Quick Commands
47
+ ## Cleanup
48
+
49
+ Session cleanup is an explicit user or orchestrator action. Reporting a result
50
+ does not remove a child automatically. Keep sessions available for follow-up
51
+ until cleanup is requested or the coordinating task calls for it.
24
52
 
25
53
  ```bash
26
- # Sessions
27
- ~/.ftown/ftown-sessions list
28
- ~/.ftown/ftown-sessions create --prompt "Run tests" --workdir "$PWD" --parent
29
- ~/.ftown/ftown-sessions screen <session-id> --limit 200
30
- ~/.ftown/ftown-sessions tell <session-id> --type task "continue with the API client"
54
+ ftown sessions remove <finished-session-id>
55
+ ftown sessions archive
56
+ ftown sessions revive <archived-session-id>
31
57
  ```
32
58
 
33
- Use orchestrator guidance for ad-hoc multi-agent coordination.
59
+ Removal archives the session; revival creates a new session id and resumes its
60
+ agent conversation when supported. Preserve useful results before cleanup.
61
+
62
+ ## Connection and compatibility
63
+
64
+ The commands read `~/.ftown/bridge.json`. Anyone who can read that file can
65
+ control the bridge's sessions. Existing `ftown-sessions`, `ftown-harness`, and
66
+ `ftown-env` launchers remain compatible; use the grouped commands above in new
67
+ instructions. ftown does not install a ticket system or provide a workflow
68
+ runner. Independently installed coordination tools remain yours to manage.
@@ -1,106 +1,29 @@
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.
6
6
 
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
7
+ List existing sessions before creating another worker. Give each worker a
8
+ bounded task, clear writable files and acceptance checks; save the returned
9
+ `session.id` for follow-up. Omit `--shell` to inherit your current harness, or
10
+ set it when the task calls for a different harness. Provider flavors require a
11
+ bridge-host token configured with `ftown env set <flavor>`.
33
12
 
34
13
  ```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>
14
+ ftown sessions list
15
+ ftown sessions create --parent --workdir /path/to/repo --name review-auth \
16
+ --prompt "Review auth; read-only. Report concrete findings and validation."
17
+ ftown sessions screen <worker-id> --limit 100
18
+ ftown sessions running <worker-id>
19
+ ftown harness mail send <worker-id> --type task "Check the expired-token case too"
20
+ ftown sessions tell --children "Pause and report status"
43
21
  ```
44
22
 
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
23
+ Use terminal output to investigate a quiet worker. Mail handles results and
24
+ escalations; read them with `ftown harness mail read`. When waiting, let incoming
25
+ mail resume the conversation rather than repeatedly polling. Parallel tasks need
26
+ disjoint write ownership and serialized shared resources.
103
27
 
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).
28
+ After accepting a worker's result, request any concrete follow-up before
29
+ 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 whenever `ftown-bridge` is running. 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).
@@ -110,14 +110,12 @@ Returns JSON with the new `session.id` — use that id for `screen` / `grep` / `
110
110
  ## Typical workflow
111
111
 
112
112
  ```bash
113
- CLI=~/.ftown/ftown-sessions
114
-
115
- $CLI list
116
- $CLI create --prompt "Run tests and report" --workdir "$PWD" --parent
113
+ ftown sessions list
114
+ ftown sessions create --prompt "Run tests and report" --workdir "$PWD" --parent
117
115
  # -> note session.id from JSON
118
116
 
119
- $CLI screen <child-id> --limit 100
120
- $CLI grep <child-id> --pattern 'FAIL|Error'
117
+ ftown sessions screen <child-id> --limit 100
118
+ ftown sessions grep <child-id> --pattern 'FAIL|Error'
121
119
  ```
122
120
 
123
121
  ## Environment
@@ -132,15 +130,14 @@ Spawned ftown sessions receive:
132
130
  Agent children (any `--shell` except `shell`) spawned with a parent also get an
133
131
  automatic one-paragraph briefing prepended to their first input: it states their
134
132
  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.
133
+ `ftown harness mail send --parent --type result` (or `--type escalation` when blocked).
134
+ The creator's `--prompt` follows after a `Task:` line. Session cleanup is an
135
+ explicit user or orchestrator action; see the ftown skill.
139
136
 
140
137
  An agent session created with `--orchestrator` additionally gets `FTOWN_ORCHESTRATOR=1`
141
138
  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.
139
+ **ftown** skill, whose `references/orchestrator.md` adds practical
140
+ coordination examples for spawning workers, monitoring them, and cleaning up.
144
141
  When both apply, the child paragraph comes first, then the orchestrator pointer,
145
142
  separated by a blank line.
146
143
 
@@ -175,7 +172,7 @@ back to the bridge root. Parent and child must belong to the same bridge.
175
172
 
176
173
  ## If the CLI is missing
177
174
 
178
- Start or restart **ftown-bridge** on this machine. It installs
179
- `~/.ftown/ftown-sessions`, `~/.ftown/notify.sh`, and updates the unified skill
175
+ Start or restart **ftown-bridge** on this machine. It installs the `ftown` command, compatible launchers, `~/.ftown/notify.sh`,
176
+ and updates the unified skill
180
177
  under `~/.ftown/skills/ftown/` (linked into ~/.agents/skills and
181
178
  ~/.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_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 {};