@glrs-dev/cli 2.4.1 → 2.6.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{chunk-HQUCVJ4G.js → chunk-FBXSGZAA.js} +4 -0
  3. package/dist/chunk-J3FXSHMA.js +263 -0
  4. package/dist/{chunk-5ZVUFNCP.js → chunk-S6N5E2GG.js} +8 -1
  5. package/dist/{chunk-2VMFXAJH.js → chunk-UO7WHIKY.js} +18 -5
  6. package/dist/cli.js +10 -3
  7. package/dist/commands/autopilot-tui.d.ts +11 -1
  8. package/dist/commands/autopilot-tui.js +2 -1
  9. package/dist/commands/autopilot.d.ts +2 -0
  10. package/dist/commands/autopilot.js +62 -21
  11. package/dist/commands/debrief.d.ts +2 -0
  12. package/dist/commands/debrief.js +1 -1
  13. package/dist/commands/loop.d.ts +2 -0
  14. package/dist/commands/loop.js +33 -12
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/node_modules/@glrs-dev/adapter-opencode/dist/index.d.ts +9 -0
  18. package/dist/node_modules/@glrs-dev/adapter-opencode/dist/index.js +33 -15
  19. package/dist/node_modules/@glrs-dev/adapter-opencode/package.json +1 -1
  20. package/dist/node_modules/@glrs-dev/autopilot/dist/auto-ship-EVLBKHUZ.js +7 -0
  21. package/dist/node_modules/@glrs-dev/autopilot/dist/{changeset-generator-DG3MVWVV.js → changeset-generator-HAHYSSUR.js} +2 -2
  22. package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-VITL2Z45.js → chunk-2X3CWH47.js} +578 -62
  23. package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-Q4ULU6ER.js → chunk-2ZQ6SBV3.js} +4 -2
  24. package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-6JZQLIRP.js +781 -0
  25. package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-E7PWTRFO.js → chunk-AWRK6S6G.js} +2 -2
  26. package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-M2ZVBPWL.js → chunk-BLEIZHET.js} +1 -1
  27. package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-7OSEI5TF.js → chunk-GXXCEGDD.js} +3 -1
  28. package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-S34HOCZ4.js +44 -0
  29. package/dist/node_modules/@glrs-dev/autopilot/dist/index.d.ts +159 -9
  30. package/dist/node_modules/@glrs-dev/autopilot/dist/index.js +115 -35
  31. package/dist/node_modules/@glrs-dev/autopilot/dist/{logger-UITJGIZE.js → logger-3XLFMXLN.js} +1 -1
  32. package/dist/node_modules/@glrs-dev/autopilot/dist/loop-session-YLCVJGPV.js +9 -0
  33. package/dist/node_modules/@glrs-dev/autopilot/dist/plan-enrichment-4SQYV5FC.js +17 -0
  34. package/dist/node_modules/@glrs-dev/autopilot/package.json +1 -1
  35. package/dist/vendor/harness-opencode/dist/agents/prompts/agents-md-writer.md +1 -1
  36. package/dist/vendor/harness-opencode/dist/agents/prompts/architecture-advisor.md +1 -1
  37. package/dist/vendor/harness-opencode/dist/agents/prompts/code-searcher.md +1 -1
  38. package/dist/vendor/harness-opencode/dist/agents/prompts/docs-maintainer.md +0 -8
  39. package/dist/vendor/harness-opencode/dist/agents/prompts/gap-analyzer.md +1 -3
  40. package/dist/vendor/harness-opencode/dist/agents/prompts/lib-reader.md +1 -1
  41. package/dist/vendor/harness-opencode/dist/agents/prompts/plan-reviewer.md +0 -2
  42. package/dist/vendor/harness-opencode/dist/agents/prompts/plan.md +1 -1
  43. package/dist/vendor/harness-opencode/dist/agents/prompts/prime.md +78 -262
  44. package/dist/vendor/harness-opencode/dist/agents/prompts/research.md +5 -14
  45. package/dist/vendor/harness-opencode/dist/agents/prompts/scoper.md +7 -2
  46. package/dist/vendor/harness-opencode/dist/autopilot/strategies/default.md +29 -0
  47. package/dist/vendor/harness-opencode/dist/index.js +112 -82
  48. package/dist/vendor/harness-opencode/package.json +1 -1
  49. package/package.json +1 -1
  50. package/dist/node_modules/@glrs-dev/autopilot/dist/auto-ship-LCT6LIH7.js +0 -7
  51. package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-ZNJWARTM.js +0 -449
  52. package/dist/node_modules/@glrs-dev/autopilot/dist/loop-session-XKL3NHUA.js +0 -8
  53. package/dist/node_modules/@glrs-dev/autopilot/dist/plan-enrichment-D3RPJR2J.js +0 -14
@@ -1,12 +1,18 @@
1
1
  import {
2
2
  runDebrief,
3
3
  shouldRunDebrief
4
- } from "../chunk-5ZVUFNCP.js";
4
+ } from "../chunk-S6N5E2GG.js";
5
+ import {
6
+ ADAPTER_NAMES,
7
+ DEFAULT_ADAPTER,
8
+ createAdapter,
9
+ resolveConfig
10
+ } from "../chunk-J3FXSHMA.js";
5
11
  import "../chunk-3RG5ZIWI.js";
6
12
 
7
13
  // src/commands/loop.ts
8
- import { command, option, positional, string as stringType, optional, number as numberType, flag } from "cmd-ts";
9
- import { runRalphLoop, MAX_ITERATIONS, TIMEOUT_MS } from "@glrs-dev/autopilot";
14
+ import { command, option, positional, string as stringType, optional, number as numberType, flag, oneOf } from "cmd-ts";
15
+ import { runRalphLoop, MAX_ITERATIONS, TIMEOUT_MS, applyCLIOverrides } from "@glrs-dev/autopilot";
10
16
  var loopCmd = command({
11
17
  name: "loop",
12
18
  description: "Run the Ralph loop: send a prompt to PRIME repeatedly until it emits <autopilot-done> or a budget is exhausted.",
@@ -43,9 +49,15 @@ var loopCmd = command({
43
49
  debriefOnly: flag({
44
50
  long: "debrief-only",
45
51
  description: "Run the debrief against the most recent log file without re-executing the loop. (Not yet implemented \u2014 requires log-directory discovery.)"
52
+ }),
53
+ adapter: option({
54
+ long: "adapter",
55
+ short: "a",
56
+ type: optional(oneOf(ADAPTER_NAMES)),
57
+ description: `Agent adapter to use (default: ${DEFAULT_ADAPTER}). Available: ${ADAPTER_NAMES.join(", ")}`
46
58
  })
47
59
  },
48
- handler: async ({ prompt, maxIterations, timeout, stallTimeout, noDebrief, notify, debriefOnly }) => {
60
+ handler: async ({ prompt, maxIterations, timeout, stallTimeout, noDebrief, notify, debriefOnly, adapter: adapterName }) => {
49
61
  const cwd = process.cwd();
50
62
  let loopStarted = false;
51
63
  const earlyExit = (signal) => {
@@ -66,17 +78,24 @@ ${signal} received before loop start \u2014 exiting
66
78
  process.exit(1);
67
79
  }
68
80
  const willDebrief = shouldRunDebrief({ noDebrief, env: process.env });
69
- const { OpenCodeAdapter } = await import("@glrs-dev/adapter-opencode");
70
- const adapter = new OpenCodeAdapter();
81
+ const resolvedConfig = resolveConfig(cwd);
82
+ const config = applyCLIOverrides(resolvedConfig, {
83
+ adapter: adapterName,
84
+ stallTimeout,
85
+ notify
86
+ });
87
+ const finalAdapterName = config.adapter ?? DEFAULT_ADAPTER;
88
+ const adapter = await createAdapter(finalAdapterName, config);
71
89
  const result = await runRalphLoop({
72
90
  prompt,
73
91
  cwd,
74
92
  maxIterations: maxIterations ?? void 0,
75
93
  timeoutMs: timeout ?? void 0,
76
- stallMs: stallTimeout ?? void 0,
77
- notifyUrl: notify ?? void 0,
94
+ stallMs: config.stall_timeout ?? void 0,
95
+ notifyUrl: config.notify_url ?? void 0,
78
96
  keepAlive: willDebrief,
79
- adapter
97
+ adapter,
98
+ config
80
99
  });
81
100
  loopStarted = true;
82
101
  process.removeListener("SIGINT", earlySigint);
@@ -96,7 +115,8 @@ ${icon} ${result.message}
96
115
  agentHandle: loopHandle,
97
116
  loopResult: result,
98
117
  prompt,
99
- cwd
118
+ cwd,
119
+ config
100
120
  });
101
121
  } catch {
102
122
  process.stderr.write("\x1B[33m\u26A0 Debrief failed (non-fatal)\x1B[0m\n");
@@ -105,14 +125,15 @@ ${icon} ${result.message}
105
125
  });
106
126
  }
107
127
  } else {
108
- const debriefAdapter = new OpenCodeAdapter();
128
+ const debriefAdapter = await createAdapter(config.adapter ?? DEFAULT_ADAPTER, config);
109
129
  const debriefHandle = await debriefAdapter.start({ cwd });
110
130
  try {
111
131
  await runDebrief({
112
132
  agentHandle: { adapter: debriefAdapter, handle: debriefHandle },
113
133
  loopResult: result,
114
134
  prompt,
115
- cwd
135
+ cwd,
136
+ config
116
137
  });
117
138
  } catch {
118
139
  process.stderr.write("\x1B[33m\u26A0 Debrief agent failed to start (non-fatal)\x1B[0m\n");
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ interface ResolvedBin {
24
24
  }
25
25
  declare function resolveSubcommand(sub: Subcommand): ResolvedBin;
26
26
  declare const SUBCOMMANDS: Subcommand[];
27
- declare const HELP_TEXT = "glrs \u2014 unified CLI for the @glrs-dev ecosystem\n\nUSAGE\n glrs <subcommand> [args...]\n\nSUBCOMMANDS\n oc OpenCode agent harness (install, pilot, etc.)\n wt Worktree management (create, list, switch, delete, cleanup)\n dashboard Live TUI dashboard for all running autopilot sessions\n\nRun 'glrs <subcommand> --help' for per-command help.\n\nEXAMPLES\n glrs oc install\n glrs wt new\n glrs wt list\n glrs wt switch\n glrs dashboard\n\nREQUIREMENTS\n Bun >= 1.2.0 on PATH (install: https://bun.sh)\n\nDOCS https://glrs.dev\nISSUES https://github.com/iceglober/glrs/issues\n";
27
+ declare const HELP_TEXT = "glrs \u2014 unified CLI for the @glrs-dev ecosystem\n\nUSAGE\n glrs <subcommand> [args...]\n\nSUBCOMMANDS\n oc OpenCode agent harness (install, pilot, etc.)\n wt Worktree management (create, list, switch, delete, cleanup)\n autopilot Run the autopilot orchestrator (scope \u2192 plan \u2192 execute)\n loop Run the Ralph loop with a raw prompt\n dashboard Live TUI dashboard for all running autopilot sessions\n\nRun 'glrs <subcommand> --help' for per-command help.\n\nEXAMPLES\n glrs oc install\n glrs wt new\n glrs wt list\n glrs wt switch\n glrs autopilot --plan docs/plans/my-plan/\n glrs loop \"implement the auth middleware\"\n glrs dashboard\n\nREQUIREMENTS\n Bun >= 1.2.0 on PATH (install: https://bun.sh)\n\nDOCS https://glrs.dev\nISSUES https://github.com/iceglober/glrs/issues\n";
28
28
  declare const WORKTREE_HELP_TEXT = "glrs wt \u2014 worktree management\n\nUSAGE\n glrs wt <command> [args...]\n\nCOMMANDS\n new Create a new worktree (auto-named from origin/default)\n list, ls List all worktrees across repos\n switch, sw Interactively select and switch to a worktree\n delete, rm Remove worktrees (interactive or by name)\n cleanup Delete merged/stale worktrees\n\nEXAMPLES\n glrs wt new # Create worktree in current repo\n glrs wt new myrepo # Create worktree for named repo\n glrs wt list # Show all worktrees\n glrs wt list -i # Interactive picker\n glrs wt switch # Interactive switcher\n glrs wt delete my-branch # Delete specific worktree\n glrs wt cleanup # Clean up merged worktrees\n\nWorktrees are stored in ~/.glrs/worktrees/<repo>/<name>/\n";
29
29
 
30
30
  export { HELP_TEXT, type ResolvedBin, SUBCOMMANDS, type Subcommand, WORKTREE_HELP_TEXT, resolveSubcommand };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  SUBCOMMANDS,
4
4
  WORKTREE_HELP_TEXT,
5
5
  resolveSubcommand
6
- } from "./chunk-HQUCVJ4G.js";
6
+ } from "./chunk-FBXSGZAA.js";
7
7
  import "./chunk-3RG5ZIWI.js";
8
8
  export {
9
9
  HELP_TEXT,
@@ -42,11 +42,19 @@ declare const DEFAULT_STARTUP_TIMEOUT_MS = 30000;
42
42
  * Uses createOpencode() which spawns the server process and creates
43
43
  * a connected client. The server inherits process.cwd() as its project
44
44
  * directory.
45
+ *
46
+ * When `agentOverrides` is provided, sets GLRS_AGENT_OVERRIDES in the
47
+ * server environment before startup, and restores the prior value on
48
+ * shutdown to keep the parent process clean.
45
49
  */
46
50
  declare function startServer(opts: {
47
51
  cwd: string;
48
52
  port?: number;
49
53
  timeoutMs?: number;
54
+ agentOverrides?: Record<string, {
55
+ model?: string;
56
+ prompt?: string;
57
+ }>;
50
58
  }): Promise<StartedServer>;
51
59
  /**
52
60
  * Verify the server is responsive by listing sessions.
@@ -231,6 +239,7 @@ declare class OpenCodeAdapter implements AgentAdapter {
231
239
  readonly name = "opencode";
232
240
  start(opts: {
233
241
  cwd: string;
242
+ agents?: Record<string, unknown>;
234
243
  }): Promise<AgentHandle>;
235
244
  createSession(handle: AgentHandle, opts: {
236
245
  agentName?: string;
@@ -20,21 +20,39 @@ async function startServer(opts) {
20
20
  await ensureOpencodeOnPath();
21
21
  const timeoutMs = opts.timeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS;
22
22
  const port = opts.port ?? 0;
23
- const { client, server } = await createOpencode({
24
- port,
25
- timeout: timeoutMs,
26
- hostname: "127.0.0.1"
27
- });
28
- let shutdownCalled = false;
29
- const shutdown = async () => {
30
- if (shutdownCalled) return;
31
- shutdownCalled = true;
32
- try {
33
- server.close();
34
- } catch {
23
+ const priorEnvValue = process.env["GLRS_AGENT_OVERRIDES"];
24
+ try {
25
+ if (opts.agentOverrides) {
26
+ process.env["GLRS_AGENT_OVERRIDES"] = JSON.stringify(opts.agentOverrides);
35
27
  }
36
- };
37
- return { url: server.url, client, shutdown };
28
+ const { client, server } = await createOpencode({
29
+ port,
30
+ timeout: timeoutMs,
31
+ hostname: "127.0.0.1"
32
+ });
33
+ let shutdownCalled = false;
34
+ const shutdown = async () => {
35
+ if (shutdownCalled) return;
36
+ shutdownCalled = true;
37
+ try {
38
+ server.close();
39
+ } catch {
40
+ }
41
+ if (priorEnvValue === void 0) {
42
+ delete process.env["GLRS_AGENT_OVERRIDES"];
43
+ } else {
44
+ process.env["GLRS_AGENT_OVERRIDES"] = priorEnvValue;
45
+ }
46
+ };
47
+ return { url: server.url, client, shutdown };
48
+ } catch (err) {
49
+ if (priorEnvValue === void 0) {
50
+ delete process.env["GLRS_AGENT_OVERRIDES"];
51
+ } else {
52
+ process.env["GLRS_AGENT_OVERRIDES"] = priorEnvValue;
53
+ }
54
+ throw err;
55
+ }
38
56
  }
39
57
  async function selfTest(client) {
40
58
  try {
@@ -426,7 +444,7 @@ var OpenCodeHandle = class {
426
444
  var OpenCodeAdapter = class {
427
445
  name = "opencode";
428
446
  async start(opts) {
429
- const server = await startServer({ cwd: opts.cwd });
447
+ const server = await startServer({ cwd: opts.cwd, agentOverrides: opts.agents });
430
448
  return new OpenCodeHandle(server, opts.cwd);
431
449
  }
432
450
  async createSession(handle, opts) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glrs-dev/adapter-opencode",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -0,0 +1,7 @@
1
+ import {
2
+ autoShip
3
+ } from "./chunk-BLEIZHET.js";
4
+ import "./chunk-GXXCEGDD.js";
5
+ export {
6
+ autoShip
7
+ };
@@ -4,8 +4,8 @@ import {
4
4
  readPlanGoal,
5
5
  readPlanTitle,
6
6
  slugifyTitle
7
- } from "./chunk-E7PWTRFO.js";
8
- import "./chunk-7OSEI5TF.js";
7
+ } from "./chunk-AWRK6S6G.js";
8
+ import "./chunk-GXXCEGDD.js";
9
9
  export {
10
10
  generateChangeset,
11
11
  inferBumpLevel,