@agentworkforce/cli 0.2.1 → 0.4.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/CHANGELOG.md CHANGED
@@ -6,3 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
+
10
+ ## [0.3.0] - 2026-04-23
11
+
12
+ ### Added
13
+
14
+ - **Opencode interactive sessions** — launch opencode as an alternative runtime alongside Claude Code, with full mount/sync parity and agent abstraction (#20, #23)
15
+ - **Persona maker** — create and edit personas from the CLI (#22)
16
+ - **Animated sync spinner** on the SIGINT exit path — 1st Ctrl-C starts an ora spinner with "Syncing… (Ctrl-C again to skip)", 2nd Ctrl-C aborts, 3rd force-exits (#24)
17
+
18
+ ### Fixed
19
+
20
+ - Opencode agent now defaults to `permission: 'allow'` so it can actually edit files
21
+ - `configFiles` written by `onBeforeLaunch` are hidden from the mount-mirror in both directions — prevents masking a user's existing `opencode.json` on the way in and polluting the working tree on the way out (#23)
22
+ - Sync-exit line no longer misreports direction: "Synced N change(s) back to the repo" → "N file event(s) during session", since `onAfterSync`'s count is bidirectional and includes inbound initial-mirror events (#24)
23
+
24
+ ### Changed
25
+
26
+ - Safe-path validation on persona `configFiles` materialization — rejects empty, absolute, and `..`-traversal paths so a malformed persona can't escape the mount (#23)
27
+ - Exhaustiveness guard in `buildInteractiveSpec` so future `Harness` union additions fail at compile time rather than silently at runtime (#23)
28
+
package/README.md CHANGED
@@ -529,7 +529,7 @@ agent-workforce agent --clean <persona>[@<tier>]
529
529
 
530
530
  ### Session layout
531
531
 
532
- Both the skill install root and the clean mount live under a single
532
+ Both the skill install root and the sandbox mount live under a single
533
533
  session directory. The session id (`<personaId>-<base36-timestamp>-<hex>`)
534
534
  is generated once and both paths are derived from it:
535
535
 
package/dist/cli.d.ts CHANGED
@@ -1,17 +1,73 @@
1
1
  #!/usr/bin/env node
2
2
  import { type Harness } from '@agentworkforce/workload-router';
3
+ /**
4
+ * Resolve the `<harness>` placeholder used in persona systemPrompts.
5
+ * Personas embed `<harness>` inside example install commands (e.g.
6
+ * `npx prpm install <ref> --as <harness>`) so the docstring stays
7
+ * harness-agnostic in source. The active harness is known at selection
8
+ * time, so swap it in here to give the model a concrete command.
9
+ *
10
+ * Exported for test coverage. Only `<harness>` is resolved today; other
11
+ * angle-bracketed tokens in the prompt (e.g. `<ref>`, `<repo-url>`,
12
+ * `<query>`) are deliberately left as LLM-facing placeholders.
13
+ */
14
+ export declare function resolveSystemPromptPlaceholders(prompt: string, harness: Harness): string;
15
+ /**
16
+ * Remove every `--agent <id>` pair from a harness argv. Used on the non-mount
17
+ * opencode path where we cannot safely materialize the persona's
18
+ * opencode.json (it would land in the user's real repo), so we fall back to
19
+ * launching opencode without a persona-specific agent selection.
20
+ *
21
+ * Strips all occurrences rather than just the first — the current producer
22
+ * (harness-kit's opencode branch) emits exactly one pair, so both behaviors
23
+ * are equivalent today, but "remove all" is idempotent and safer if a future
24
+ * caller ever appends a second `--agent` for any reason. A trailing `--agent`
25
+ * with no following value is preserved so the malformed argv surfaces at the
26
+ * harness rather than getting silently swallowed here.
27
+ */
28
+ export declare function stripAgentFlag(args: readonly string[]): string[];
29
+ /**
30
+ * Validate that a configFile's relative path is safe to resolve under a
31
+ * sandbox/session directory. Rejects absolute paths and any segment equal to
32
+ * `..` so a malformed or adversarial persona cannot escape the mount via
33
+ * `join()` and overwrite files elsewhere. Called at materialization time so
34
+ * the failure surfaces with a clear path before any disk write happens.
35
+ */
36
+ export declare function assertSafeRelativePath(relPath: string): void;
3
37
  /** Patterns hidden from an interactive claude session when `--clean` is set.
4
38
  * Applied by `@relayfile/local-mount` with gitignore semantics, so bare names
5
39
  * match at any depth in the project tree (e.g. `.claude` hides both
6
40
  * `./.claude/` and `./packages/foo/.claude/`). */
7
41
  export declare const CLEAN_IGNORED_PATTERNS: readonly ["CLAUDE.md", "CLAUDE.local.md", ".claude", ".mcp.json"];
8
42
  /**
9
- * Decide whether `--clean` should engage for this run. Returns a warning
10
- * string when the flag was requested but cannot apply (e.g. non-claude
11
- * harness); callers emit the warning to stderr and proceed with
12
- * `useClean: false`. Pure no side effects, trivially testable.
43
+ * Skill-install artifacts that should never be copied into the mount nor
44
+ * synced back to the real repo. Applied to non-claude interactive sessions
45
+ * that rely on the mount to keep `npx skills add` / `npx prpm install`
46
+ * writes out of the user's project tree. Covers every per-provider output
47
+ * root that skill.sh / prpm scatter into on install — missing one here
48
+ * re-introduces repo pollution, so this list is deliberately superset-y.
49
+ * Claude sessions use `installRoot` for out-of-repo staging instead, so
50
+ * these patterns don't apply there.
51
+ */
52
+ export declare const SKILL_INSTALL_IGNORED_PATTERNS: readonly [".agents", ".claude/skills", ".factory/skills", ".kiro/skills", "skills", ".opencode", ".skills", "prpm.lock", "skills-lock.json"];
53
+ /**
54
+ * Decide whether to run the interactive session inside a
55
+ * `@relayfile/local-mount` sandbox.
56
+ *
57
+ * - Claude: mount only engages when the user passes `--clean` explicitly
58
+ * (its purpose there is to hide CLAUDE.md / .claude / .mcp.json from the
59
+ * session). Out-of-repo skill staging is handled separately via
60
+ * `installRoot` + `--plugin-dir`.
61
+ * - Opencode: the SDK cannot stage skills out-of-repo for this harness
62
+ * (there is no `installRoot` support), so the mount is the only way to
63
+ * keep `npx prpm install` / `npx skills add` writes out of the project.
64
+ * Default to mount unless the user opts in with `--install-in-repo`.
65
+ * - Codex: no auto-mount yet. `--clean` still emits the existing
66
+ * "claude-only" warning so current behavior is preserved.
67
+ *
68
+ * Pure — no side effects, trivially testable.
13
69
  */
14
- export declare function decideCleanMode(harness: Harness, clean: boolean): {
70
+ export declare function decideCleanMode(harness: Harness, clean: boolean, installInRepo?: boolean): {
15
71
  useClean: boolean;
16
72
  warning?: string;
17
73
  };
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAOA,OAAO,EAOL,KAAK,OAAO,EAMb,MAAM,iCAAiC,CAAC;AA8OzC;;;kDAGkD;AAClD,eAAO,MAAM,sBAAsB,mEAKzB,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,GACb;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CASzC;AAidD,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IACvD,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAmCA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAOL,KAAK,OAAO,EAMb,MAAM,iCAAiC,CAAC;AAwIzC;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAExF;AAkLD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAUhE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAe5D;AAED;;;kDAGkD;AAClD,eAAO,MAAM,sBAAsB,mEAKzB,CAAC;AAEX;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,8IAajC,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,aAAa,UAAQ,GACpB;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAezC;AAy1BD,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IACvD,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAmCA"}