@glrs-dev/cli 2.0.1 → 2.2.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 (48) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunk-SB3MLROC.js +113 -0
  3. package/dist/cli.js +21 -0
  4. package/dist/lib/auto-update.d.ts +23 -0
  5. package/dist/lib/auto-update.js +7 -0
  6. package/dist/vendor/harness-opencode/dist/agents/prompts/build.md +18 -4
  7. package/dist/vendor/harness-opencode/dist/agents/prompts/build.open.md +18 -4
  8. package/dist/vendor/harness-opencode/dist/agents/prompts/{qa-thorough.md → code-reviewer-thorough.md} +34 -19
  9. package/dist/vendor/harness-opencode/dist/agents/prompts/code-reviewer.md +80 -0
  10. package/dist/vendor/harness-opencode/dist/agents/prompts/code-reviewer.open.md +68 -0
  11. package/dist/vendor/harness-opencode/dist/agents/prompts/gap-analyzer.md +2 -0
  12. package/dist/vendor/harness-opencode/dist/agents/prompts/plan-reviewer.md +3 -0
  13. package/dist/vendor/harness-opencode/dist/agents/prompts/plan.md +23 -4
  14. package/dist/vendor/harness-opencode/dist/agents/prompts/prime.md +146 -87
  15. package/dist/vendor/harness-opencode/dist/agents/prompts/research-auto.md +1 -1
  16. package/dist/vendor/harness-opencode/dist/agents/prompts/research-local.md +1 -1
  17. package/dist/vendor/harness-opencode/dist/agents/prompts/research-web.md +1 -1
  18. package/dist/vendor/harness-opencode/dist/agents/prompts/research.md +2 -0
  19. package/dist/vendor/harness-opencode/dist/agents/prompts/spec-reviewer.md +54 -0
  20. package/dist/vendor/harness-opencode/dist/agents/prompts/spec-reviewer.open.md +57 -0
  21. package/dist/vendor/harness-opencode/dist/agents/shared/index.ts +1 -0
  22. package/dist/vendor/harness-opencode/dist/agents/shared/ui-evaluation-ladder.md +50 -0
  23. package/dist/vendor/harness-opencode/dist/agents/shared/workflow-mechanics.md +5 -5
  24. package/dist/vendor/harness-opencode/dist/autopilot/prompt-template.md +80 -0
  25. package/dist/vendor/harness-opencode/dist/{chunk-VJUETC6A.js → chunk-PDMXYZM4.js} +53 -1
  26. package/dist/vendor/harness-opencode/dist/cli.js +1333 -1646
  27. package/dist/vendor/harness-opencode/dist/commands/prompts/fresh.md +27 -24
  28. package/dist/vendor/harness-opencode/dist/commands/prompts/review.md +3 -3
  29. package/dist/vendor/harness-opencode/dist/commands/prompts/ship.md +2 -0
  30. package/dist/vendor/harness-opencode/dist/index.js +106 -627
  31. package/dist/vendor/harness-opencode/dist/skills/adversarial-review-rubric/SKILL.md +47 -0
  32. package/dist/vendor/harness-opencode/dist/skills/code-quality/SKILL.md +1 -1
  33. package/dist/vendor/harness-opencode/dist/skills/root-cause-diagnosis/SKILL.md +24 -0
  34. package/dist/vendor/harness-opencode/dist/skills/spear-protocol/SKILL.md +166 -0
  35. package/dist/vendor/harness-opencode/package.json +1 -1
  36. package/package.json +1 -1
  37. package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-assessor.md +0 -77
  38. package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-builder.md +0 -40
  39. package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-planner.md +0 -56
  40. package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-scoper.md +0 -58
  41. package/dist/vendor/harness-opencode/dist/agents/prompts/qa-reviewer.md +0 -68
  42. package/dist/vendor/harness-opencode/dist/agents/prompts/qa-reviewer.open.md +0 -58
  43. package/dist/vendor/harness-opencode/dist/chunk-6CZPRUMJ.js +0 -869
  44. package/dist/vendor/harness-opencode/dist/chunk-DZG4D3OH.js +0 -54
  45. package/dist/vendor/harness-opencode/dist/chunk-OYRKOEXK.js +0 -88
  46. package/dist/vendor/harness-opencode/dist/commands/prompts/autopilot.md +0 -96
  47. package/dist/vendor/harness-opencode/dist/install-6775ZBDG.js +0 -13
  48. package/dist/vendor/harness-opencode/dist/paths-WZ23ZQOV.js +0 -18
@@ -1,54 +0,0 @@
1
- // src/model-validator.ts
2
- var CATWALK_PROVIDER_PATTERN = /^(?:bedrock|vertex|vertexai)\//;
3
- var LEGACY_PRE_100_PATTERN = /^(bedrock|vertex|vertexai)\/claude-(opus|sonnet|haiku)(-\d+)?$/;
4
- var LEGACY_TO_MODELS_DEV = {
5
- // --- Pre-PR-#100 Bedrock (no subpath) ---
6
- "bedrock/claude-opus": "amazon-bedrock/global.anthropic.claude-opus-4-7",
7
- "bedrock/claude-opus-4": "amazon-bedrock/global.anthropic.claude-opus-4-7",
8
- "bedrock/claude-sonnet": "amazon-bedrock/global.anthropic.claude-sonnet-4-6",
9
- "bedrock/claude-sonnet-4": "amazon-bedrock/global.anthropic.claude-sonnet-4-6",
10
- "bedrock/claude-haiku": "amazon-bedrock/global.anthropic.claude-haiku-4-5-20251001-v1:0",
11
- "bedrock/claude-haiku-4": "amazon-bedrock/global.anthropic.claude-haiku-4-5-20251001-v1:0",
12
- // --- Pre-Models.dev Bedrock (had subpath, but wrong provider prefix) ---
13
- "bedrock/anthropic.claude-opus-4-6": "amazon-bedrock/global.anthropic.claude-opus-4-7",
14
- "bedrock/anthropic.claude-opus-4-7": "amazon-bedrock/global.anthropic.claude-opus-4-7",
15
- "bedrock/anthropic.claude-sonnet-4-6": "amazon-bedrock/global.anthropic.claude-sonnet-4-6",
16
- "bedrock/anthropic.claude-haiku-4-5-20251001-v1:0": "amazon-bedrock/global.anthropic.claude-haiku-4-5-20251001-v1:0",
17
- // --- Pre-PR-#100 Vertex (no @date suffix) ---
18
- "vertex/claude-opus": "google-vertex-anthropic/claude-opus-4-7@default",
19
- "vertex/claude-opus-4": "google-vertex-anthropic/claude-opus-4-7@default",
20
- "vertex/claude-sonnet": "google-vertex-anthropic/claude-sonnet-4-6@default",
21
- "vertex/claude-sonnet-4": "google-vertex-anthropic/claude-sonnet-4-6@default",
22
- "vertex/claude-haiku": "google-vertex-anthropic/claude-haiku-4-5@20251001",
23
- "vertex/claude-haiku-4": "google-vertex-anthropic/claude-haiku-4-5@20251001",
24
- "vertexai/claude-opus": "google-vertex-anthropic/claude-opus-4-7@default",
25
- "vertexai/claude-opus-4": "google-vertex-anthropic/claude-opus-4-7@default",
26
- "vertexai/claude-sonnet": "google-vertex-anthropic/claude-sonnet-4-6@default",
27
- "vertexai/claude-sonnet-4": "google-vertex-anthropic/claude-sonnet-4-6@default",
28
- "vertexai/claude-haiku": "google-vertex-anthropic/claude-haiku-4-5@20251001",
29
- "vertexai/claude-haiku-4": "google-vertex-anthropic/claude-haiku-4-5@20251001",
30
- // --- Pre-Models.dev Vertex (had @date suffix, wrong provider prefix) ---
31
- "vertexai/claude-opus-4-6@20250610": "google-vertex-anthropic/claude-opus-4-6@default",
32
- "vertexai/claude-opus-4-7@20250610": "google-vertex-anthropic/claude-opus-4-7@default",
33
- "vertexai/claude-sonnet-4-6@20250725": "google-vertex-anthropic/claude-sonnet-4-6@default",
34
- "vertexai/claude-haiku-4-5@20251001": "google-vertex-anthropic/claude-haiku-4-5@20251001"
35
- };
36
- function validateModelOverride(id) {
37
- if (typeof id !== "string") return { valid: true };
38
- if (id.length === 0) return { valid: true };
39
- if (CATWALK_PROVIDER_PATTERN.test(id)) {
40
- const suggestion = LEGACY_TO_MODELS_DEV[id] ?? "run `bunx @glrs-dev/harness-plugin-opencode install` to pick a current preset";
41
- const reason = LEGACY_PRE_100_PATTERN.test(id) ? `"${id}" is a pre-PR-#100 model ID format that does not resolve in OpenCode. Bedrock IDs need the \`amazon-bedrock\` provider prefix (not \`bedrock\`); Vertex Claude IDs need the \`google-vertex-anthropic\` provider prefix (not \`vertex\` / \`vertexai\`).` : `"${id}" uses a provider prefix (\`${id.split("/")[0]}\`) that does not exist in OpenCode's runtime. AWS Bedrock's provider ID is \`amazon-bedrock\`; Vertex Claude's is \`google-vertex-anthropic\`.`;
42
- return { valid: false, reason, suggestion };
43
- }
44
- return { valid: true };
45
- }
46
- function formatModelOverrideWarning(id, source, suggestion) {
47
- const suggestionText = suggestion ? ` Suggested replacement: \`${suggestion}\`.` : "";
48
- return `[@glrs-dev/harness-plugin-opencode] Warning: invalid model override "${id}" (from ${source}).${suggestionText} Run \`bunx @glrs-dev/harness-plugin-opencode doctor\` for details.`;
49
- }
50
-
51
- export {
52
- validateModelOverride,
53
- formatModelOverrideWarning
54
- };
@@ -1,88 +0,0 @@
1
- // src/pilot/paths.ts
2
- import { execFile } from "child_process";
3
- import * as fs from "fs/promises";
4
- import * as os from "os";
5
- import * as path from "path";
6
- function execFileP(file, args, opts = {}) {
7
- const { cwd, timeoutMs = 5e3 } = opts;
8
- return new Promise((resolve2, reject) => {
9
- const controller = new AbortController();
10
- const timer = setTimeout(() => controller.abort(), timeoutMs);
11
- execFile(
12
- file,
13
- args,
14
- { signal: controller.signal, cwd, encoding: "utf8" },
15
- (err, stdout) => {
16
- clearTimeout(timer);
17
- if (err) {
18
- reject(err);
19
- return;
20
- }
21
- resolve2(stdout ?? "");
22
- }
23
- );
24
- });
25
- }
26
- function expandTilde(p) {
27
- if (p === "~") return os.homedir();
28
- if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2));
29
- return p;
30
- }
31
- async function getRepoFolder(cwd) {
32
- let stdout;
33
- try {
34
- stdout = await execFileP("git", ["rev-parse", "--git-common-dir"], { cwd });
35
- } catch (err) {
36
- throw new Error(
37
- `pilot paths: could not determine repo folder from ${JSON.stringify(cwd)}: ${err instanceof Error ? err.message : String(err)}`
38
- );
39
- }
40
- const gitCommonDir = stdout.trim();
41
- const abs = path.isAbsolute(gitCommonDir) ? gitCommonDir : path.resolve(cwd, gitCommonDir);
42
- return path.basename(path.dirname(abs));
43
- }
44
- async function getPilotDir(cwd) {
45
- const override = process.env["GLORIOUS_PILOT_DIR"];
46
- if (override) {
47
- const dir = expandTilde(override);
48
- await fs.mkdir(dir, { recursive: true });
49
- return dir;
50
- }
51
- const repoFolder = await getRepoFolder(cwd);
52
- const base = path.join(os.homedir(), ".glorious", "opencode", repoFolder, "pilot");
53
- await fs.mkdir(base, { recursive: true });
54
- return base;
55
- }
56
- async function getStateDbPath(cwd) {
57
- const base = await getPilotDir(cwd);
58
- return path.join(base, "state.sqlite");
59
- }
60
- async function getCurrentScopePath(cwd) {
61
- const base = await getPilotDir(cwd);
62
- return path.join(base, "current-scope.json");
63
- }
64
- async function getScopeArtifactPath(cwd, workflowId) {
65
- const base = await getPilotDir(cwd);
66
- const dir = path.join(base, "scopes", workflowId);
67
- await fs.mkdir(dir, { recursive: true });
68
- return path.join(dir, "scope.json");
69
- }
70
- async function getPlanArtifactPath(cwd, workflowId) {
71
- const base = await getPilotDir(cwd);
72
- const dir = path.join(base, "scopes", workflowId);
73
- await fs.mkdir(dir, { recursive: true });
74
- return path.join(dir, "plan.json");
75
- }
76
- function getPilotConfigPath(cwd) {
77
- return path.join(cwd, ".glrs", "pilot.json");
78
- }
79
-
80
- export {
81
- getRepoFolder,
82
- getPilotDir,
83
- getStateDbPath,
84
- getCurrentScopePath,
85
- getScopeArtifactPath,
86
- getPlanArtifactPath,
87
- getPilotConfigPath
88
- };
@@ -1,96 +0,0 @@
1
- ---
2
- description: Self-driving PRIME run. Accepts an issue-tracker reference, a free-form task description, or a question.
3
- ---
4
-
5
- This invocation is in AUTOPILOT mode. You are the PRIME, running hands-off: the user invoked `/autopilot` intending to walk away. Work through the normal five-phase workflow (see `prime.md`) until the plan's `## Acceptance criteria` boxes are all checked, then print the Phase 5 handoff and stop. The user runs `/ship` manually — that's the human gate.
6
-
7
- **Activation signal.** The literal phrase `AUTOPILOT mode` above is what the autopilot plugin scans for in the session's FIRST user message. Do not remove the phrase or the plugin will not enable nudges for this session.
8
-
9
- **Keep going on idle.** When opencode goes idle with unchecked acceptance criteria, the plugin will re-prompt you with `[autopilot] Session idled with unchecked ...`. Treat that as a "keep going" signal, not a command to restart from scratch. Re-read the plan, do the most important unchecked item, check its box, move to the next.
10
-
11
- **Stop conditions.**
12
- - All `## Acceptance criteria` boxes are `[x]` → print the Phase 5 handoff message and stop. The plugin sees zero unchecked boxes and stops firing nudges.
13
- - Max 20 iterations → the plugin sends one "stopped, something's stuck" message. If this fires, something is genuinely wrong — the user reviews manually. Do not try to pre-empt the cap by cutting corners.
14
- - User types anything → iteration counter resets; treat the user's message as a correction or halt instruction.
15
- - Plan is classified as umbrella / measurement-gated / opted-out → plugin stops nudging silently for this session (see "Plan shape contract" below).
16
- - Current branch doesn't contain the Linear ID cited in the plan's `## Goal` → plugin stops nudging (branch mismatch — work belongs on another branch).
17
- - The current branch has a merged PR → plugin stops nudging (work is shipped).
18
- - File `.agent/autopilot-disable` exists in the worktree → plugin stops nudging (kill switch). Create this file with `touch .agent/autopilot-disable` to stop autopilot from any terminal; delete it to re-enable future sessions.
19
- - Two consecutive STOP reports from you (messages starting with `STOP:` or `STOP —`) → plugin stops nudging (you've signaled a structural block; nudging through it is counterproductive).
20
-
21
- **No special tokens.** You do not emit `<promise>DONE</promise>`, `<autopilot>EXIT</autopilot>`, or any other sentinel. You do not delegate to `@autopilot-verifier`. Completion is visible: the plan's boxes are all `[x]` on disk. That's the contract.
22
-
23
- **Plan shape contract.** The autopilot plugin only nudges on **unit plans** — single-goal, single-branch, file-level acceptance criteria. The plugin classifies the plan before nudging and silently stops on:
24
- - **Umbrella plans.** Tracks multiple Linear issues (3+ distinct ticket IDs), has `## Chunks` / `## Milestones` / `## Workstreams` sections, or exceeds ~500 lines.
25
- - **Measurement-gated plans.** An AC that requires a production window, post-deploy measurement, SLO check, or bake time. Phrases like `7-day`, `post-deploy`, `SLO`, `success rate reaches`, `bake time` anywhere in `## Acceptance criteria` trigger this.
26
- - **Opt-out plans.** The plan contains a magic comment `<!-- autopilot: skip -->` anywhere in the file. Author-controlled override.
27
-
28
- If you encounter one of these shapes, do NOT try to work against it directly. Write a proper unit plan for the next actionable chunk (single branch, tickable ACs) and proceed against that plan.
29
-
30
- **Non-actionable acceptance criteria.** If an AC you planned cannot be completed in-session — blocked on an external event, requires prod measurement, belongs on a different branch — mark it:
31
- - `- [~]` for in-progress / measurement-pending
32
- - `- [-]` for blocked / conditional / deferred
33
-
34
- Do NOT leave these as `- [ ]`. The plugin counts `- [ ]` as "not started, keep nudging"; `- [~]` and `- [-]` are ignored. Mis-marking wedges the loop.
35
-
36
- The user wants autopilot to process: $ARGUMENTS
37
-
38
- ## 0. Workflow-mechanics: decide before anything else
39
-
40
- Before classifying the argument, apply the workflow-mechanics heuristic from `prime.md` § `# Workflow-mechanics decisions`. Autopilot is lights-out: the rule fires automatically and silently (single line of chat, no `question` tool). Never ask the user whether to open a fresh worktree, switch branches, or stack on current — the heuristic decides.
41
-
42
- Abort paths (dirty tree on default branch; dirty tree on feature branch with unrelated work) mean STOP and report the one-sentence reason. The user resolves and re-runs.
43
-
44
- If you auto-invoke `/fresh`, do NOT pass `--clean`. Cleanup stays user-triggered.
45
-
46
- ## 1. Classify the argument
47
-
48
- Pick ONE of these paths:
49
-
50
- - **Issue-tracker reference** (single issue) — match any of:
51
- - `<PROJECT>-<NUMBER>` where PROJECT is 2–10 uppercase letters (e.g. `ENG-1234`, `GEN-1114`) — Linear, Jira, YouTrack, Shortcut, etc.
52
- - `#<NUMBER>` alone (e.g. `#1234`) — GitHub shorthand
53
- - A URL to a recognized tracker (`github.com/.../issues/123`, `linear.app/.../issue/...`, `*.atlassian.net/browse/...`)
54
- - **Free-form task description** — any natural-language request that isn't a recognized issue ref
55
- - **Question** — starts with what/why/how/when/where/which/who, or ends with `?`
56
-
57
- ## 2. Fetch issue content (only if step 1 returned an issue ref)
58
-
59
- Probe in order, stop at the first that returns real content:
60
-
61
- 1. **Linear MCP** — if configured and the arg matches `<PROJECT>-<NUMBER>` shape OR is a `linear.app` URL: `linear_get_issue`.
62
- 2. **GitHub MCP** — if configured OR the arg is a `github.com/.../issues/...` URL OR is `#<NUMBER>` and `gh` CLI is available.
63
- 3. **Jira / Atlassian MCP** — if configured and the arg matches `<PROJECT>-<NUMBER>` OR is an `*.atlassian.net` URL.
64
-
65
- If no probe resolves, report once: *"I see a ref that looks like a ticket (`<arg>`), but no issue-tracker MCP is configured. Treating as free-form — paste the issue body if you want me to ground in it."* Then proceed as free-form.
66
-
67
- Treat the fetched issue's title + description + acceptance criteria as the intent baseline. Map to the plan's `## Acceptance criteria` 1:1, in order. Do not invent entries.
68
-
69
- ## 3. Run the PRIME arc
70
-
71
- Run the normal five-phase workflow from `prime.md`. Key adaptations for autopilot mode:
72
-
73
- - **Phase 1 (Intent).** Already classified; skip redundant classification.
74
- - **Phase 1.5 (Frame).** Announce the frame as `→ Frame:` and proceed — do NOT use the `question` tool to confirm. The user is walked away.
75
- - **Phase 2 (Plan).** Delegate to `@plan`. For ref-originated requests, cite the issue ID in the plan's `## Goal`. The plan's `## Acceptance criteria` maps 1:1 to the ticket's Changes / Definition of Done list.
76
- - **Phase 3 (Execute).** Delegate to `@build`. `@build` executes file-by-file and returns a summary; PRIME relays progress. Acceptance boxes get checked during `@build`'s execution.
77
- - **Phase 4 (Verify).** Full suite pass + `@qa-reviewer` → iterate to `[PASS]`. No sentinel tokens.
78
- - **Phase 5 (Handoff).** Print "Done. Run `/ship <plan-path>` when ready." and stop.
79
-
80
- ## 4. Guardrails
81
-
82
- - **Never ask scoping questions.** The issue's acceptance list IS the authoritative scope. If you're tempted to ask whether to include X, the answer is: if the ticket didn't ask for it, don't include it. The `question` tool is forbidden in autopilot mode except for one narrow case: an architectural fork that blocks all progress AFTER codebase inspection, `@gap-analyzer` consultation, and precedent search (`git log`) have ALL failed to determine a default.
83
- - **Precedent defaults.** For helper-file location, naming, logging verbosity, error-wrapper style: search `git log` for a recent similar PR and mirror its structure. Cite the precedent commit in `## Constraints`.
84
- - **Plan-revision budget.** After `@plan-reviewer` returns `[REJECT]`: 1st REJECT → fix listed issues, resubmit. 2nd REJECT → narrow scope (move disputed items to `## Out of scope`). 3rd REJECT → escalate to `@architecture-advisor`.
85
- - **Never commit, push, or open a PR.** That's the human gate via `/ship`.
86
- - **Never invoke `/ship` yourself.** Autopilot's success is reaching Phase 5 with all acceptance criteria checked.
87
- - **Circular failure.** If the same test fails after the same fix twice, delegate to `@architecture-advisor` before a third attempt.
88
- - **STOP when stuck, don't churn.** If the plan is structurally wrong for this session (wrong branch, un-tickable AC, missing upstream work), emit a single line starting with `STOP:` followed by the specific reason. Do not re-attempt. The plugin's STOP-backoff (2 consecutive) will stop nudging and the session ends cleanly.
89
-
90
- ## 5. Reporting
91
-
92
- Your single handoff message should include:
93
- - What was classified — the resolved tracker reference or free-form summary
94
- - Plan path if created
95
- - 1-2 sentence summary of changes
96
- - Exact command to ship: `/ship <plan-path>` (the absolute path the plan agent returned)
@@ -1,13 +0,0 @@
1
- import {
2
- MODEL_PRESETS,
3
- install,
4
- writeMcpToggles,
5
- writePluginOption
6
- } from "./chunk-6CZPRUMJ.js";
7
- import "./chunk-VJUETC6A.js";
8
- export {
9
- MODEL_PRESETS,
10
- install,
11
- writeMcpToggles,
12
- writePluginOption
13
- };
@@ -1,18 +0,0 @@
1
- import {
2
- getCurrentScopePath,
3
- getPilotConfigPath,
4
- getPilotDir,
5
- getPlanArtifactPath,
6
- getRepoFolder,
7
- getScopeArtifactPath,
8
- getStateDbPath
9
- } from "./chunk-OYRKOEXK.js";
10
- export {
11
- getCurrentScopePath,
12
- getPilotConfigPath,
13
- getPilotDir,
14
- getPlanArtifactPath,
15
- getRepoFolder,
16
- getScopeArtifactPath,
17
- getStateDbPath
18
- };