@wrongstack/cli 1.0.24 → 1.0.26

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 (124) hide show
  1. package/data/providers.json +44 -0
  2. package/dist/{acp-AJWSKWE5.js → acp-LI665LO2.js} +5 -5
  3. package/dist/ascii-mode-SG4PRNLP.js +7 -0
  4. package/dist/{auth-GRBZ7Y3D.js → auth-TE55JF4Z.js} +14 -14
  5. package/dist/{bench-N5K7Z5O3.js → bench-GTLPM22B.js} +2 -2
  6. package/dist/boot/append-system-prompt.d.ts +10 -0
  7. package/dist/boot/ascii-mode.d.ts +12 -0
  8. package/dist/boot/container-wiring.d.ts +4 -2
  9. package/dist/boot/dispatch-singleshot.d.ts +4 -1
  10. package/dist/boot/mcp-config-flag.d.ts +22 -0
  11. package/dist/boot/piped-stdin.d.ts +40 -0
  12. package/dist/boot/restricted-mode.d.ts +15 -0
  13. package/dist/boot/safe-mode.d.ts +30 -0
  14. package/dist/boot/single-shot-budget.d.ts +30 -0
  15. package/dist/boot/stream-json.d.ts +36 -0
  16. package/dist/boot/structured-output.d.ts +16 -0
  17. package/dist/boot/system-prompt-builder.d.ts +2 -0
  18. package/dist/boot/tool-restriction-flags.d.ts +36 -0
  19. package/dist/boot/worktree-sessions.d.ts +21 -0
  20. package/dist/boot-provider-selection.d.ts +67 -0
  21. package/dist/boot.d.ts +1 -38
  22. package/dist/{chunk-LFMVHT3R.js → chunk-2ERX3RPN.js} +11 -13
  23. package/dist/chunk-4TVYGG6G.js +62 -0
  24. package/dist/chunk-5JYDKG5B.js +154 -0
  25. package/dist/{chunk-3VXYY5JC.js → chunk-5UZBUV2H.js} +3 -19
  26. package/dist/chunk-BEHGRNOQ.js +58 -0
  27. package/dist/chunk-CZTXF6HY.js +140 -0
  28. package/dist/{chunk-SKPDE62W.js → chunk-EPR42SWM.js} +36 -6
  29. package/dist/{chunk-YBUCXXYZ.js → chunk-F5DCFAKI.js} +1 -1
  30. package/dist/chunk-HLSHFXTO.js +97 -0
  31. package/dist/{chunk-BLD5DSVA.js → chunk-KJS5543T.js} +2 -2
  32. package/dist/{chunk-QFPQXKCG.js → chunk-KOEO4CJG.js} +21 -6
  33. package/dist/chunk-LBPLTTZ6.js +105 -0
  34. package/dist/{chunk-3OCUS3VN.js → chunk-LDCGZJTC.js} +4 -4
  35. package/dist/chunk-LKPEBZBE.js +143 -0
  36. package/dist/{chunk-DRM7PSW7.js → chunk-OAVBM55Q.js} +3 -3
  37. package/dist/chunk-PZQBGUVZ.js +18 -0
  38. package/dist/{chunk-MHEBWVXL.js → chunk-Q4INH2DG.js} +46 -2
  39. package/dist/{chunk-ZZRSG7VK.js → chunk-RZ4ZDRYA.js} +3 -3
  40. package/dist/{chunk-U46QR4WR.js → chunk-TI7KLHYX.js} +132 -3
  41. package/dist/{chunk-PGKJ2OQP.js → chunk-WQV2NP57.js} +5 -5
  42. package/dist/chunk-X756ZS72.js +329 -0
  43. package/dist/{chunk-JF2MULWF.js → chunk-YHYINL47.js} +47 -15
  44. package/dist/{cli-context-34Q5IJRA.js → cli-context-UVGAN3NO.js} +407 -327
  45. package/dist/{cli-main-AELJDBGU.js → cli-main-TN3KZ2P6.js} +2652 -1978
  46. package/dist/cli-update-notice.d.ts +2 -1
  47. package/dist/config-doctor.d.ts +1 -1
  48. package/dist/{diag-doctor-WIFJH3XH.js → diag-doctor-BIZAFIAT.js} +2 -2
  49. package/dist/{execution-PYC5FCS4.js → execution-7QIP6GRY.js} +1948 -1666
  50. package/dist/fleet/host-types.d.ts +3 -1
  51. package/dist/goal-commands.d.ts +47 -0
  52. package/dist/goal-host.d.ts +1 -14
  53. package/dist/{hq-JTUTFI4L.js → hq-GLZ7QESM.js} +6 -6
  54. package/dist/{hq-server-PC7GZMPT.js → hq-server-YTKDVQPY.js} +2 -2
  55. package/dist/{hq-service-NW56MUP2.js → hq-service-BMMJAHRT.js} +4 -4
  56. package/dist/import-claude-code-32PCSIQI.js +236 -0
  57. package/dist/index.js +12 -8
  58. package/dist/{mailbox-serve-WDOCH6KR.js → mailbox-serve-NW5VZG7R.js} +3 -3
  59. package/dist/{modeldiag-36OGAL5C.js → modeldiag-36VODVIH.js} +8 -8
  60. package/dist/{per-subcommand-help-XE77MTGJ.js → per-subcommand-help-QDAQASPZ.js} +2 -2
  61. package/dist/permission-prompt.d.ts +14 -0
  62. package/dist/permission-rules-view.d.ts +18 -0
  63. package/dist/{permissions-CFDLXETM.js → permissions-PL27UHYD.js} +67 -45
  64. package/dist/{plugin-usage-S5LVGMBW.js → plugin-usage-CIGOOTX3.js} +2 -2
  65. package/dist/{plugins-RHBIVLI7.js → plugins-HQTXUD6A.js} +4 -2
  66. package/dist/preflight.d.ts +1 -1
  67. package/dist/{projects-LMNAGGEU.js → projects-T4CZCA25.js} +3 -6
  68. package/dist/provider-helpers.d.ts +7 -11
  69. package/dist/{providers-models-2CFG46RD.js → providers-models-5Z2PJTEW.js} +5 -5
  70. package/dist/release-asset-download.d.ts +10 -0
  71. package/dist/release-attestation.d.ts +28 -0
  72. package/dist/remote/remote-session.d.ts +64 -0
  73. package/dist/remote/remote-target.d.ts +69 -0
  74. package/dist/remote-O5WXHLWV.js +561 -0
  75. package/dist/{replay-Z3FTJEMM.js → replay-DEI566CW.js} +2 -2
  76. package/dist/services/commit-message.d.ts +2 -1
  77. package/dist/session-move-P2EC2COA.js +44 -0
  78. package/dist/session-move.d.ts +20 -0
  79. package/dist/session-stats.d.ts +10 -0
  80. package/dist/{sessions-config-IQUH2GXT.js → sessions-config-SXTTLNXA.js} +35 -5
  81. package/dist/short-circuit-flags-74Y5N6CF.js +10 -0
  82. package/dist/slash-commands/command-context.d.ts +15 -5
  83. package/dist/slash-commands/goal-refiner.d.ts +4 -49
  84. package/dist/slash-commands/mcp.d.ts +2 -1
  85. package/dist/slash-commands/permissions.d.ts +4 -0
  86. package/dist/slash-commands/settings-context-mutations.d.ts +5 -0
  87. package/dist/slash-commands/settings-limits-mutations.d.ts +12 -0
  88. package/dist/standalone-auto-update-TOTRGCSA.js +249 -0
  89. package/dist/standalone-auto-update.d.ts +65 -0
  90. package/dist/standalone-update-LZO3MNLH.js +24 -0
  91. package/dist/standalone-update.d.ts +37 -1
  92. package/dist/subcommands/handlers/import-claude-code.d.ts +42 -0
  93. package/dist/subcommands/handlers/permissions.d.ts +9 -3
  94. package/dist/subcommands/handlers/remote.d.ts +6 -0
  95. package/dist/subcommands/handlers/version-help.d.ts +5 -0
  96. package/dist/{subcommands-ZTSIN7LG.js → subcommands-Q6ORSB2E.js} +2 -2
  97. package/dist/tui-resume-callback.d.ts +18 -0
  98. package/dist/{typesafe-HVEVPA6R.js → typesafe-U7YB2RRV.js} +5 -5
  99. package/dist/{typesafe-topic-replay-4W73BOLV.js → typesafe-topic-replay-ZILIU3WS.js} +18 -2
  100. package/dist/{update-7XIOEXTD.js → update-TDZX4IL2.js} +4 -4
  101. package/dist/{update-check-2POMBHFB.js → update-check-J5ZVKS73.js} +3 -3
  102. package/dist/version-JB2UAV2A.js +11 -0
  103. package/dist/version-help-XJJQ7YSH.js +10 -0
  104. package/dist/webui-server/route-contexts.d.ts +1 -1
  105. package/dist/webui-server/session-start-payload.d.ts +5 -1
  106. package/dist/{webui-server-L2SICPTB.js → webui-server-YTHLRFD2.js} +509 -366
  107. package/dist/webui-server-lifecycle.d.ts +57 -0
  108. package/dist/webui-server.d.ts +0 -14
  109. package/dist/wiring/brain-and-orchestration.d.ts +3 -1
  110. package/dist/wiring/cli-prompt-and-tools-setup.d.ts +9 -0
  111. package/dist/wiring/cli-slash-commands-setup.d.ts +1 -0
  112. package/dist/wiring/lifecycle-plugins.d.ts +4 -2
  113. package/dist/wiring/metrics.d.ts +9 -1
  114. package/dist/wiring/pipeline.d.ts +2 -7
  115. package/dist/wiring/plugins.d.ts +3 -0
  116. package/dist/wiring/provider-status.d.ts +1 -0
  117. package/dist/wiring/provider-utility-tools.d.ts +3 -1
  118. package/package.json +28 -28
  119. package/dist/chunk-2BKFWIER.js +0 -98
  120. package/dist/chunk-424ORSE7.js +0 -56
  121. package/dist/chunk-QBBF7GIK.js +0 -65
  122. package/dist/short-circuit-flags-SDT53OML.js +0 -10
  123. package/dist/standalone-update-MW47J3AK.js +0 -164
  124. package/dist/version-help-WZ623NWM.js +0 -10
@@ -3,7 +3,7 @@ import type { BrainArbiter, ProviderModelStatusTracker } from '@wrongstack/core/
3
3
  import type { HookRunner } from '@wrongstack/core/hooks';
4
4
  import type { Container, EventBus } from '@wrongstack/core/kernel';
5
5
  import type { ProviderRegistry, ToolRegistry } from '@wrongstack/core/registry';
6
- import type { ConfigStore, ModelsRegistry, Renderer, SecretScrubber, SessionWriter, SkillLoader, SystemPromptBuilder, TokenCounter } from '@wrongstack/core/types';
6
+ import type { ConfigStore, ModelsRegistry, Renderer, SecretScrubber, SessionWriter, SkillLoader, SystemPromptBuilder, TokenCounter, Tracer } from '@wrongstack/core/types';
7
7
  export interface MultiAgentDeps {
8
8
  container: Container;
9
9
  toolRegistry: ToolRegistry;
@@ -23,6 +23,8 @@ export interface MultiAgentDeps {
23
23
  projectRoot: string;
24
24
  cwd: string;
25
25
  secretScrubber: SecretScrubber;
26
+ /** OTLP tracer shared with the leader, so worker runs join its traces. */
27
+ tracer?: Tracer | undefined;
26
28
  /** Loader used to resolve the roster's per-role skill names. */
27
29
  skillLoader?: SkillLoader | undefined;
28
30
  renderer?: Renderer | undefined;
@@ -0,0 +1,47 @@
1
+ /** Async `fs.access`-style existence check — never throws. */
2
+ export declare function pathExists(p: string): Promise<boolean>;
3
+ /**
4
+ * Cap on captured command output. Verification commands (`pnpm test` across
5
+ * a large monorepo) can emit tens of MB on a verbose run — accumulating the
6
+ * full transcript spikes the host heap for output nothing ever reads in
7
+ * full. runCmd keeps the TAIL (the failure summary lives at the end of a
8
+ * test run); gitText keeps the head (its commands are tiny).
9
+ */
10
+ export declare const MAX_CMD_OUTPUT = 200000;
11
+ /** Run a git command, returning trimmed stdout (empty string on failure). */
12
+ export declare function gitText(args: string[], cwd: string): Promise<{
13
+ code: number;
14
+ out: string;
15
+ }>;
16
+ export declare function isGitRepo(cwd: string): Promise<boolean>;
17
+ export declare const GOAL_BASE_SAFE_CMDS: ReadonlySet<string>;
18
+ export declare let goalAllowed: Set<string>;
19
+ /**
20
+ * Extend/trim the autonomous goal command allowlist from the user's exec
21
+ * policy. Mirrors `configureExecPolicy` but keeps goal's narrower base.
22
+ * Idempotent (always rebuilt from the base).
23
+ */
24
+ export declare function configureGoalPolicy(opts?: {
25
+ allow?: readonly string[] | undefined;
26
+ deny?: readonly string[] | undefined;
27
+ }): void;
28
+ /** Reset the goal allowlist to its built-in base (tests / re-init). */
29
+ export declare function resetGoalPolicy(): void;
30
+ /** Whether `cmd` may run in autonomous goal verification. */
31
+ export declare function isGoalCommandAllowed(cmd: string): boolean;
32
+ export declare const DESTRUCTIVE_PATTERNS: readonly RegExp[];
33
+ /** Run an arbitrary command, capturing combined stdout+stderr. */
34
+ export declare function runCmd(cmd: string, args: string[], cwd: string, shell?: boolean): Promise<{
35
+ code: number;
36
+ out: string;
37
+ }>;
38
+ /**
39
+ * Detect the project's package manager from lockfiles at the repo root.
40
+ * Async so the verify-step boot path doesn't block the event loop on `stat`
41
+ * for missing files in CWD or in monorepo setups where the lockfile lives
42
+ * several levels up.
43
+ */
44
+ export declare function detectPackageManager(root: string): Promise<string>;
45
+ /** Read package.json scripts for a directory (empty on any failure). */
46
+ export declare function readScripts(cwd: string): Promise<Record<string, string>>;
47
+ //# sourceMappingURL=goal-commands.d.ts.map
@@ -1,3 +1,4 @@
1
+ export { configureGoalPolicy, isGoalCommandAllowed, resetGoalPolicy } from './goal-commands.js';
1
2
  /**
2
3
  * Goal host wiring for the CLI.
3
4
  *
@@ -20,19 +21,6 @@ import { type PhaseGraph, type PhaseProgress } from '@wrongstack/core/goal';
20
21
  import type { EventBus } from '@wrongstack/core/kernel';
21
22
  import type { Config, TaskNode } from '@wrongstack/core/types';
22
23
  import type { MultiAgentHost } from './multi-agent.js';
23
- /**
24
- * Extend/trim the autonomous goal command allowlist from the user's exec
25
- * policy. Mirrors `configureExecPolicy` but keeps goal's narrower base.
26
- * Idempotent (always rebuilt from the base).
27
- */
28
- export declare function configureGoalPolicy(opts?: {
29
- allow?: readonly string[] | undefined;
30
- deny?: readonly string[] | undefined;
31
- }): void;
32
- /** Reset the goal allowlist to its built-in base (tests / re-init). */
33
- export declare function resetGoalPolicy(): void;
34
- /** Whether `cmd` may run in autonomous goal verification. */
35
- export declare function isGoalCommandAllowed(cmd: string): boolean;
36
24
  export interface GoalHostDeps {
37
25
  multiAgentHost: MultiAgentHost;
38
26
  /** Read the *current* Config lazily (it may be patched, e.g. YOLO toggles). */
@@ -103,5 +91,4 @@ export interface GoalHostHooks {
103
91
  onWorktree: (action: 'list' | 'merge' | 'prune' | 'clean', target?: string) => Promise<string>;
104
92
  }
105
93
  export declare function createGoalHost(deps: GoalHostDeps): GoalHostHooks;
106
- export {};
107
94
  //# sourceMappingURL=goal-host.d.ts.map
@@ -1,6 +1,3 @@
1
- import {
2
- parseTokenTtlValue
3
- } from "./chunk-UZ2TMHNH.js";
4
1
  import {
5
2
  resolveHqPasswordInput
6
3
  } from "./chunk-AUQDGU5D.js";
@@ -11,6 +8,9 @@ import {
11
8
  import {
12
9
  parseHqIpAllowlist
13
10
  } from "./chunk-Q7E3BPDU.js";
11
+ import {
12
+ parseTokenTtlValue
13
+ } from "./chunk-UZ2TMHNH.js";
14
14
 
15
15
  // src/subcommands/handlers/hq.ts
16
16
  import {
@@ -316,7 +316,7 @@ var hqCmd = async (args, deps) => {
316
316
  return hqAlertsCmd(args.slice(1), deps);
317
317
  }
318
318
  if (sub === "service") {
319
- const { hqServiceCmd } = await import("./hq-service-NW56MUP2.js");
319
+ const { hqServiceCmd } = await import("./hq-service-BMMJAHRT.js");
320
320
  return hqServiceCmd(args.slice(1), deps);
321
321
  }
322
322
  if (sub === "help" || sub === "--help") {
@@ -329,7 +329,7 @@ var hqCmd = async (args, deps) => {
329
329
  return 1;
330
330
  };
331
331
  async function startServer(deps) {
332
- const { startHqServer } = await import("./hq-server-PC7GZMPT.js");
332
+ const { startHqServer } = await import("./hq-server-YTKDVQPY.js");
333
333
  const dataDir = resolveDataDir(deps);
334
334
  const flags = deps.flags ?? {};
335
335
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
@@ -1003,4 +1003,4 @@ export {
1003
1003
  hqCmd,
1004
1004
  resolveAuditActor
1005
1005
  };
1006
- //# sourceMappingURL=hq-JTUTFI4L.js.map
1006
+ //# sourceMappingURL=hq-GLZ7QESM.js.map
@@ -10,7 +10,7 @@ import {
10
10
  readLocalSubagentTranscript,
11
11
  sanitizeApiError,
12
12
  startHqServer
13
- } from "./chunk-DRM7PSW7.js";
13
+ } from "./chunk-OAVBM55Q.js";
14
14
  import "./chunk-HXJYHAR4.js";
15
15
  import "./chunk-5EA6OTLJ.js";
16
16
  import "./chunk-Q7E3BPDU.js";
@@ -27,4 +27,4 @@ export {
27
27
  sanitizeApiError,
28
28
  startHqServer
29
29
  };
30
- //# sourceMappingURL=hq-server-PC7GZMPT.js.map
30
+ //# sourceMappingURL=hq-server-YTKDVQPY.js.map
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  detectUpdatePackageManager,
6
6
  detectUpdatePackageName
7
- } from "./chunk-QFPQXKCG.js";
7
+ } from "./chunk-KOEO4CJG.js";
8
8
  import "./chunk-U3SS4NRH.js";
9
- import "./chunk-ZZRSG7VK.js";
10
- import "./chunk-YBUCXXYZ.js";
9
+ import "./chunk-RZ4ZDRYA.js";
10
+ import "./chunk-F5DCFAKI.js";
11
11
 
12
12
  // src/hq-service.ts
13
13
  import { spawn } from "node:child_process";
@@ -511,4 +511,4 @@ export {
511
511
  hqServiceCmd,
512
512
  renderHqServiceAssets
513
513
  };
514
- //# sourceMappingURL=hq-service-NW56MUP2.js.map
514
+ //# sourceMappingURL=hq-service-BMMJAHRT.js.map
@@ -0,0 +1,236 @@
1
+ import {
2
+ normalizeMcpServerEntry
3
+ } from "./chunk-HLSHFXTO.js";
4
+ import {
5
+ activeProfileConfigPath
6
+ } from "./chunk-YMXXOOFN.js";
7
+ import {
8
+ restoreFlags
9
+ } from "./chunk-CSAPOCBP.js";
10
+
11
+ // src/subcommands/handlers/import-claude-code.ts
12
+ import * as fs from "node:fs/promises";
13
+ import * as os from "node:os";
14
+ import * as path from "node:path";
15
+ import { readJsonObjectFile, setJsonPath, updateJsonObjectFile } from "@wrongstack/core/utils";
16
+ import { mcpEnvPlaceholders } from "@wrongstack/mcp";
17
+ function isRecord(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19
+ }
20
+ function samePath(a, b) {
21
+ const norm = (p) => {
22
+ const resolved = path.resolve(p).replace(/[\\/]+$/, "");
23
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
24
+ };
25
+ return norm(a) === norm(b);
26
+ }
27
+ function projectEntry(userState, projectRoot) {
28
+ const projects = userState?.["projects"];
29
+ if (!isRecord(projects)) return void 0;
30
+ for (const [key, value] of Object.entries(projects)) {
31
+ if (isRecord(value) && samePath(key, projectRoot)) return value;
32
+ }
33
+ return void 0;
34
+ }
35
+ function planClaudeCodeImport(opts) {
36
+ const { sources } = opts;
37
+ const mcp = [];
38
+ const seen = /* @__PURE__ */ new Set();
39
+ const collect = (servers, source) => {
40
+ if (!isRecord(servers)) return;
41
+ for (const [name, raw] of Object.entries(servers)) {
42
+ if (seen.has(name)) continue;
43
+ seen.add(name);
44
+ let config;
45
+ try {
46
+ config = normalizeMcpServerEntry(name, raw);
47
+ } catch (err) {
48
+ mcp.push({
49
+ name,
50
+ source,
51
+ config: {},
52
+ action: "skip-invalid",
53
+ enabled: false,
54
+ note: err.message
55
+ });
56
+ continue;
57
+ }
58
+ const exists2 = Object.hasOwn(opts.existingServers, name);
59
+ const repository = source === "repository";
60
+ const enabled = !repository || opts.enableProjectServers;
61
+ const reads = mcpEnvPlaceholders(config);
62
+ const notes2 = [
63
+ repository && !enabled ? "from the repository \u2014 imported disabled; review, then `/mcp enable`" : void 0,
64
+ reads.length > 0 ? `reads environment: ${reads.join(", ")}` : void 0
65
+ ].filter((note) => note !== void 0);
66
+ mcp.push({
67
+ name,
68
+ source,
69
+ config,
70
+ action: exists2 ? opts.overwrite ? "overwrite" : "skip-exists" : "add",
71
+ enabled,
72
+ ...notes2.length > 0 ? { note: notes2.join("; ") } : {}
73
+ });
74
+ }
75
+ };
76
+ collect(
77
+ projectEntry(sources.userState, opts.projectRoot)?.["mcpServers"],
78
+ "claude-project-local"
79
+ );
80
+ collect(sources.projectMcp?.["mcpServers"] ?? sources.projectMcp, "repository");
81
+ collect(sources.userState?.["mcpServers"], "claude-user");
82
+ const notes = [];
83
+ if (sources.skillDirs.length > 0) {
84
+ notes.push(
85
+ `Skills: ${sources.skillDirs.join(", ")} \u2014 already loaded in place (skills.readClaudeSkills); nothing to copy.`
86
+ );
87
+ }
88
+ let hookCount = 0;
89
+ let ruleCount = 0;
90
+ for (const { content } of sources.settings) {
91
+ const hooks = content["hooks"];
92
+ if (isRecord(hooks)) {
93
+ for (const list of Object.values(hooks)) if (Array.isArray(list)) hookCount += list.length;
94
+ }
95
+ const permissions = content["permissions"];
96
+ if (isRecord(permissions)) {
97
+ for (const key of ["allow", "deny", "ask"]) {
98
+ const list = permissions[key];
99
+ if (Array.isArray(list)) ruleCount += list.length;
100
+ }
101
+ }
102
+ }
103
+ if (hookCount > 0) {
104
+ notes.push(
105
+ `Hooks: ${hookCount} found \u2014 not imported (matcher semantics differ). Recreate under config.hooks; see docs/hooks.md.`
106
+ );
107
+ }
108
+ if (ruleCount > 0) {
109
+ notes.push(
110
+ `Permission rules: ${ruleCount} found \u2014 not imported (a mistranslated deny is worse than none). Use /permissions or --allowed-tools/--disallowed-tools.`
111
+ );
112
+ }
113
+ for (const file of sources.instructionFiles) {
114
+ notes.push(
115
+ `Instructions: ${file} \u2014 not imported. Project context lives in .wrongstack/AGENTS.md; merge what applies there.`
116
+ );
117
+ }
118
+ return { mcp, notes };
119
+ }
120
+ async function readJson(file) {
121
+ let raw;
122
+ try {
123
+ raw = await fs.readFile(file, "utf8");
124
+ } catch {
125
+ return void 0;
126
+ }
127
+ try {
128
+ const parsed = JSON.parse(raw);
129
+ return isRecord(parsed) ? parsed : void 0;
130
+ } catch {
131
+ throw new Error(`${file} is not valid JSON`);
132
+ }
133
+ }
134
+ async function exists(p) {
135
+ try {
136
+ await fs.access(p);
137
+ return true;
138
+ } catch {
139
+ return false;
140
+ }
141
+ }
142
+ async function readClaudeCodeSources(projectRoot, userHome = os.homedir()) {
143
+ const settingsFiles = [
144
+ path.join(userHome, ".claude", "settings.json"),
145
+ path.join(projectRoot, ".claude", "settings.json"),
146
+ path.join(projectRoot, ".claude", "settings.local.json")
147
+ ];
148
+ const settings = [];
149
+ for (const file of settingsFiles) {
150
+ const content = await readJson(file);
151
+ if (content) settings.push({ file, content });
152
+ }
153
+ const instructionCandidates = [
154
+ path.join(userHome, ".claude", "CLAUDE.md"),
155
+ path.join(projectRoot, "CLAUDE.md"),
156
+ path.join(projectRoot, ".claude", "CLAUDE.md")
157
+ ];
158
+ const skillCandidates = [
159
+ path.join(userHome, ".claude", "skills"),
160
+ path.join(projectRoot, ".claude", "skills")
161
+ ];
162
+ return {
163
+ userState: await readJson(path.join(userHome, ".claude.json")),
164
+ projectMcp: await readJson(path.join(projectRoot, ".mcp.json")),
165
+ settings,
166
+ instructionFiles: (await Promise.all(instructionCandidates.map(async (f) => await exists(f) ? f : null))).filter((f) => f !== null),
167
+ skillDirs: (await Promise.all(skillCandidates.map(async (d) => await exists(d) ? d : null))).filter((d) => d !== null)
168
+ };
169
+ }
170
+ var SOURCE_LABEL = {
171
+ "claude-user": "~/.claude.json (user)",
172
+ "claude-project-local": "~/.claude.json (this project)",
173
+ repository: ".mcp.json (repository)"
174
+ };
175
+ var importClaudeCodeCmd = async (args, deps) => {
176
+ args = restoreFlags(args, deps, ["apply", "overwrite", "enable-project-servers"]);
177
+ const apply = args.includes("--apply");
178
+ const overwrite = args.includes("--overwrite");
179
+ const enableProjectServers = args.includes("--enable-project-servers");
180
+ let sources;
181
+ try {
182
+ sources = await readClaudeCodeSources(deps.projectRoot, deps.userHome);
183
+ } catch (err) {
184
+ deps.renderer.writeError(`import-claude-code: ${err.message}`);
185
+ return 1;
186
+ }
187
+ const configPath = activeProfileConfigPath(deps.paths, deps.config);
188
+ const current = await readJsonObjectFile(configPath);
189
+ const existingServers = isRecord(current["mcpServers"]) ? current["mcpServers"] : {};
190
+ const plan = planClaudeCodeImport({
191
+ sources,
192
+ projectRoot: deps.projectRoot,
193
+ existingServers,
194
+ overwrite,
195
+ enableProjectServers
196
+ });
197
+ const out = (line) => deps.renderer.write(`${line}
198
+ `);
199
+ out(apply ? "Importing from Claude Code:" : "Claude Code import preview (nothing written):");
200
+ if (plan.mcp.length === 0) out(" MCP servers: none found");
201
+ for (const c of plan.mcp) {
202
+ const state = c.action.startsWith("skip") ? "" : c.enabled ? " [enabled]" : " [disabled]";
203
+ const verb = {
204
+ add: "add",
205
+ overwrite: "overwrite",
206
+ "skip-exists": "skip (exists; --overwrite to replace)",
207
+ "skip-invalid": "skip (invalid)"
208
+ }[c.action];
209
+ out(` MCP ${c.name} \u2014 ${verb}${state} \u2014 ${SOURCE_LABEL[c.source]}`);
210
+ if (c.note) out(` ${c.note}`);
211
+ }
212
+ for (const note of plan.notes) out(` ${note}`);
213
+ const writes = plan.mcp.filter((c) => c.action === "add" || c.action === "overwrite");
214
+ if (!apply) {
215
+ if (writes.length > 0)
216
+ out(`
217
+ Run with --apply to write ${writes.length} server(s) to ${configPath}.`);
218
+ return 0;
219
+ }
220
+ if (writes.length > 0) {
221
+ await updateJsonObjectFile(configPath, (config) => {
222
+ for (const c of writes) {
223
+ setJsonPath(config, ["mcpServers", c.name], { ...c.config, enabled: c.enabled });
224
+ }
225
+ });
226
+ }
227
+ out(`
228
+ Wrote ${writes.length} server(s) to ${configPath}.`);
229
+ return 0;
230
+ };
231
+ export {
232
+ importClaudeCodeCmd,
233
+ planClaudeCodeImport,
234
+ readClaudeCodeSources
235
+ };
236
+ //# sourceMappingURL=import-claude-code-32PCSIQI.js.map
package/dist/index.js CHANGED
@@ -2,28 +2,32 @@
2
2
  import {
3
3
  applyNodeEnvDefault,
4
4
  applySessionShellDefault
5
- } from "./chunk-QBBF7GIK.js";
6
- import {
7
- parseArgs
8
- } from "./chunk-MHEBWVXL.js";
5
+ } from "./chunk-LBPLTTZ6.js";
9
6
  import {
10
7
  CLI_VERSION
11
- } from "./chunk-YBUCXXYZ.js";
8
+ } from "./chunk-F5DCFAKI.js";
9
+ import {
10
+ parseArgs
11
+ } from "./chunk-Q4INH2DG.js";
12
12
 
13
13
  // src/cli-entry-main.ts
14
14
  async function main(argv) {
15
15
  applyNodeEnvDefault();
16
16
  applySessionShellDefault();
17
17
  const earlyFlags = parseArgs(argv).flags;
18
+ if (earlyFlags["ascii"] === true || process.env["WRONGSTACK_TUI_ICON_STYLE"]) {
19
+ const { applyAsciiMode } = await import("./ascii-mode-SG4PRNLP.js");
20
+ applyAsciiMode(earlyFlags);
21
+ }
18
22
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
19
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-SDT53OML.js");
23
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-74Y5N6CF.js");
20
24
  const earlyExit = await handleHelpVersionShortCircuit(argv);
21
25
  if (earlyExit !== null) return earlyExit;
22
26
  }
23
- const { initializeCli } = await import("./cli-context-34Q5IJRA.js");
27
+ const { initializeCli } = await import("./cli-context-UVGAN3NO.js");
24
28
  const cliCtx = await initializeCli(argv);
25
29
  if (typeof cliCtx === "number") return cliCtx;
26
- const { runInteractive } = await import("./cli-main-AELJDBGU.js");
30
+ const { runInteractive } = await import("./cli-main-TN3KZ2P6.js");
27
31
  return runInteractive(cliCtx);
28
32
  }
29
33
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  startCliHqConnection
3
- } from "./chunk-BLD5DSVA.js";
4
- import "./chunk-YBUCXXYZ.js";
3
+ } from "./chunk-KJS5543T.js";
4
+ import "./chunk-F5DCFAKI.js";
5
5
 
6
6
  // src/subcommands/handlers/mailbox-serve.ts
7
7
  import { createServer } from "node:http";
@@ -361,4 +361,4 @@ function printHelp(deps) {
361
361
  export {
362
362
  mailboxServeCmd
363
363
  };
364
- //# sourceMappingURL=mailbox-serve-WDOCH6KR.js.map
364
+ //# sourceMappingURL=mailbox-serve-NW5VZG7R.js.map
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  applyProviderOAuthRefresh
3
- } from "./chunk-3OCUS3VN.js";
3
+ } from "./chunk-LDCGZJTC.js";
4
+ import {
5
+ discoverAndMergeProviders
6
+ } from "./chunk-D5GB5MHA.js";
4
7
  import {
5
8
  checkMark,
6
9
  costLabel,
@@ -15,18 +18,15 @@ import {
15
18
  scoreBar,
16
19
  speedLabel
17
20
  } from "./chunk-BBHWW6LR.js";
18
- import {
19
- discoverAndMergeProviders
20
- } from "./chunk-D5GB5MHA.js";
21
- import {
22
- activeProfileConfigPath
23
- } from "./chunk-YMXXOOFN.js";
24
21
  import {
25
22
  resolveRawProviderConnection
26
23
  } from "./chunk-S4FFHDJG.js";
27
24
  import {
28
25
  mutateConfigProviders
29
26
  } from "./chunk-LUMETJFO.js";
27
+ import {
28
+ activeProfileConfigPath
29
+ } from "./chunk-YMXXOOFN.js";
30
30
 
31
31
  // src/subcommands/handlers/modeldiag.ts
32
32
  import * as fs from "node:fs/promises";
@@ -825,4 +825,4 @@ var modeldiagCmd = async (args, deps) => {
825
825
  export {
826
826
  modeldiagCmd
827
827
  };
828
- //# sourceMappingURL=modeldiag-36OGAL5C.js.map
828
+ //# sourceMappingURL=modeldiag-36VODVIH.js.map
@@ -7,7 +7,7 @@ import {
7
7
  renderFocusedHelpToString,
8
8
  renderGenericHelp,
9
9
  subcommandsWithFocusedHelp
10
- } from "./chunk-SKPDE62W.js";
10
+ } from "./chunk-EPR42SWM.js";
11
11
  import "./chunk-YTEOAWOJ.js";
12
12
  export {
13
13
  deepSubcommandsWithFocusedHelp,
@@ -19,4 +19,4 @@ export {
19
19
  renderGenericHelp,
20
20
  subcommandsWithFocusedHelp
21
21
  };
22
- //# sourceMappingURL=per-subcommand-help-XE77MTGJ.js.map
22
+ //# sourceMappingURL=per-subcommand-help-QDAQASPZ.js.map
@@ -2,6 +2,14 @@ import type { InputReader, Tool } from '@wrongstack/core/types';
2
2
  type PromptDecision = 'yes' | 'no' | 'always' | 'always-exact' | 'always-command' | 'always-tool' | 'deny';
3
3
  /** Signature the Agent expects for confirming tool calls. */
4
4
  export type ConfirmAwaiter = (tool: Tool, input: unknown, toolUseId: string, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'always-exact' | 'always-command' | 'always-tool' | 'deny'>;
5
+ /**
6
+ * Approval "prompt" for a process with no terminal on stdin — a script, CI,
7
+ * `wstack "task" < /dev/null`, piped input. Nobody can answer, and the
8
+ * terminal prompt used to wait for a key that never came, so the run hung
9
+ * until it was killed. Refuse instead, and say on stderr (stdout may be a
10
+ * JSON payload) how to grant it up front.
11
+ */
12
+ export declare function makeHeadlessPromptDelegate(write?: (text: string) => void): (tool: Tool) => Promise<PromptDecision>;
5
13
  /**
6
14
  * The terminal approval prompt.
7
15
  *
@@ -16,6 +24,12 @@ export declare function makePromptDelegate(reader: InputReader): (tool: Tool, in
16
24
  * Create a ConfirmAwaiter for the CLI path. Wraps makePromptDelegate
17
25
  * with the ConfirmAwaiter type signature expected by the Agent.
18
26
  */
27
+ /**
28
+ * The terminal prompt when stdin is a terminal, the headless refusal
29
+ * otherwise. Both approval paths (policy prompt and executor confirm) go
30
+ * through this, so neither can wait on a keypress nobody can make.
31
+ */
32
+ export declare function makeStdinPromptDelegate(reader: InputReader, stdinIsTTY?: boolean): ReturnType<typeof makePromptDelegate>;
19
33
  export declare function makeConfirmAwaiter(reader: InputReader): ConfirmAwaiter;
20
34
  export {};
21
35
  //# sourceMappingURL=permission-prompt.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Text views of the permission rule list and of one explained call, shared by
3
+ * `wstack permissions` and the in-session `/permissions` command.
4
+ */
5
+ import type { Context } from '@wrongstack/core/agent';
6
+ import type { PermissionPolicy, PermissionRule, PermissionTrace, Tool } from '@wrongstack/core/types';
7
+ export interface ExplainedCall {
8
+ trace: PermissionTrace;
9
+ rules: PermissionRule[];
10
+ /** The rule that decided the call. */
11
+ rule: PermissionRule | undefined;
12
+ }
13
+ /** Trace one call through the policy and the executor's gate, and name its rule. */
14
+ export declare function explainCall(policy: Pick<PermissionPolicy, 'explain' | 'listRules'>, tool: Tool, input: unknown, ctx: Context, yolo: boolean): Promise<ExplainedCall>;
15
+ export declare function describePermissionRule(rule: PermissionRule): string;
16
+ export declare function formatPermissionRules(rules: readonly PermissionRule[]): string;
17
+ export declare function formatExplainedCall({ trace, rule }: ExplainedCall): string;
18
+ //# sourceMappingURL=permission-rules-view.d.ts.map