@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.
- package/CHANGELOG.md +34 -0
- package/dist/{chunk-HQUCVJ4G.js → chunk-FBXSGZAA.js} +4 -0
- package/dist/chunk-J3FXSHMA.js +263 -0
- package/dist/{chunk-5ZVUFNCP.js → chunk-S6N5E2GG.js} +8 -1
- package/dist/{chunk-2VMFXAJH.js → chunk-UO7WHIKY.js} +18 -5
- package/dist/cli.js +10 -3
- package/dist/commands/autopilot-tui.d.ts +11 -1
- package/dist/commands/autopilot-tui.js +2 -1
- package/dist/commands/autopilot.d.ts +2 -0
- package/dist/commands/autopilot.js +62 -21
- package/dist/commands/debrief.d.ts +2 -0
- package/dist/commands/debrief.js +1 -1
- package/dist/commands/loop.d.ts +2 -0
- package/dist/commands/loop.js +33 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node_modules/@glrs-dev/adapter-opencode/dist/index.d.ts +9 -0
- package/dist/node_modules/@glrs-dev/adapter-opencode/dist/index.js +33 -15
- package/dist/node_modules/@glrs-dev/adapter-opencode/package.json +1 -1
- package/dist/node_modules/@glrs-dev/autopilot/dist/auto-ship-EVLBKHUZ.js +7 -0
- package/dist/node_modules/@glrs-dev/autopilot/dist/{changeset-generator-DG3MVWVV.js → changeset-generator-HAHYSSUR.js} +2 -2
- package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-VITL2Z45.js → chunk-2X3CWH47.js} +578 -62
- package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-Q4ULU6ER.js → chunk-2ZQ6SBV3.js} +4 -2
- package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-6JZQLIRP.js +781 -0
- package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-E7PWTRFO.js → chunk-AWRK6S6G.js} +2 -2
- package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-M2ZVBPWL.js → chunk-BLEIZHET.js} +1 -1
- package/dist/node_modules/@glrs-dev/autopilot/dist/{chunk-7OSEI5TF.js → chunk-GXXCEGDD.js} +3 -1
- package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-S34HOCZ4.js +44 -0
- package/dist/node_modules/@glrs-dev/autopilot/dist/index.d.ts +159 -9
- package/dist/node_modules/@glrs-dev/autopilot/dist/index.js +115 -35
- package/dist/node_modules/@glrs-dev/autopilot/dist/{logger-UITJGIZE.js → logger-3XLFMXLN.js} +1 -1
- package/dist/node_modules/@glrs-dev/autopilot/dist/loop-session-YLCVJGPV.js +9 -0
- package/dist/node_modules/@glrs-dev/autopilot/dist/plan-enrichment-4SQYV5FC.js +17 -0
- package/dist/node_modules/@glrs-dev/autopilot/package.json +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/agents-md-writer.md +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/architecture-advisor.md +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/code-searcher.md +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/docs-maintainer.md +0 -8
- package/dist/vendor/harness-opencode/dist/agents/prompts/gap-analyzer.md +1 -3
- package/dist/vendor/harness-opencode/dist/agents/prompts/lib-reader.md +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/plan-reviewer.md +0 -2
- package/dist/vendor/harness-opencode/dist/agents/prompts/plan.md +1 -1
- package/dist/vendor/harness-opencode/dist/agents/prompts/prime.md +78 -262
- package/dist/vendor/harness-opencode/dist/agents/prompts/research.md +5 -14
- package/dist/vendor/harness-opencode/dist/agents/prompts/scoper.md +7 -2
- package/dist/vendor/harness-opencode/dist/autopilot/strategies/default.md +29 -0
- package/dist/vendor/harness-opencode/dist/index.js +112 -82
- package/dist/vendor/harness-opencode/package.json +1 -1
- package/package.json +1 -1
- package/dist/node_modules/@glrs-dev/autopilot/dist/auto-ship-LCT6LIH7.js +0 -7
- package/dist/node_modules/@glrs-dev/autopilot/dist/chunk-ZNJWARTM.js +0 -449
- package/dist/node_modules/@glrs-dev/autopilot/dist/loop-session-XKL3NHUA.js +0 -8
- package/dist/node_modules/@glrs-dev/autopilot/dist/plan-enrichment-D3RPJR2J.js +0 -14
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
You are generating a YAML spec file from a markdown plan phase, enriched with codebase context.
|
|
2
|
+
|
|
3
|
+
Read the markdown plan content below and write `${specPath}` (relative to the plan directory: ${planDir}) using the write/edit tool.
|
|
4
|
+
|
|
5
|
+
The output file should follow this schema:
|
|
6
|
+
|
|
7
|
+
${schemaExample}
|
|
8
|
+
|
|
9
|
+
For each acceptance-criteria item in the plan:
|
|
10
|
+
1. Extract `id`, `intent`, `files`, `tests`, `verify` from the markdown.
|
|
11
|
+
2. Set `checked: false` for all items.
|
|
12
|
+
3. Add enrichment fields by reading the actual codebase:
|
|
13
|
+
- **mirror**: Find the most similar existing file in the codebase and set `mirror: <path>`. This is the pattern-match target the executor will follow.
|
|
14
|
+
- **context**: For each file being MODIFIED (not NEW), read the relevant function/section and add 10-20 lines of the current code. For NEW files, add the key function signatures the file should export.
|
|
15
|
+
- **conventions**: List project-specific patterns: import style (named vs default), export pattern, test framework (vitest/jest/bun:test), naming conventions, error handling pattern.
|
|
16
|
+
|
|
17
|
+
Rules:
|
|
18
|
+
- Read actual files from the codebase to get accurate code pointers. Do not hallucinate file contents.
|
|
19
|
+
- Be concise — 10-20 lines of context per file, not the whole file.
|
|
20
|
+
- Only add enrichment fields you can verify from the codebase.
|
|
21
|
+
|
|
22
|
+
Here is the plan file to convert:
|
|
23
|
+
|
|
24
|
+
### {{file}}
|
|
25
|
+
```markdown
|
|
26
|
+
{{content}}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Write the file `${planDir}/${specPath}` using the write/edit tool, then respond with "SPEC_COMPLETE" when done.
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
// src/config-hook.ts
|
|
10
10
|
import * as fs from "fs";
|
|
11
|
-
import * as
|
|
11
|
+
import * as path2 from "path";
|
|
12
12
|
import * as os from "os";
|
|
13
13
|
|
|
14
14
|
// src/agents/shared/index.ts
|
|
@@ -39,15 +39,16 @@ var UI_EVALUATION_LADDER = readMd("ui-evaluation-ladder.md");
|
|
|
39
39
|
// src/agents/index.ts
|
|
40
40
|
import { readFileSync as readFileSync2 } from "fs";
|
|
41
41
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
42
|
-
import
|
|
42
|
+
import * as path from "path";
|
|
43
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
43
44
|
var HERE2 = dirname2(fileURLToPath2(import.meta.url));
|
|
44
45
|
function readPrompt(name) {
|
|
45
46
|
const candidates = [
|
|
46
|
-
|
|
47
|
+
join3(HERE2, "prompts", name),
|
|
47
48
|
// dev: src/agents/prompts/
|
|
48
|
-
|
|
49
|
+
join3(HERE2, "agents", "prompts", name),
|
|
49
50
|
// dist: dist/ → dist/agents/prompts/
|
|
50
|
-
|
|
51
|
+
join3(HERE2, "..", "..", "src", "agents", "prompts", name)
|
|
51
52
|
// fallback dev
|
|
52
53
|
];
|
|
53
54
|
for (const p of candidates) {
|
|
@@ -244,6 +245,18 @@ var CORE_DESTRUCTIVE_BASH_DENIES = {
|
|
|
244
245
|
"git push --force-with-lease*": "allow",
|
|
245
246
|
"git push * --force-with-lease*": "allow"
|
|
246
247
|
};
|
|
248
|
+
var AUTOPILOT_BASH_DENIES = {
|
|
249
|
+
...CORE_DESTRUCTIVE_BASH_DENIES,
|
|
250
|
+
"git checkout *": "deny",
|
|
251
|
+
"git switch *": "deny",
|
|
252
|
+
"git push*": "deny",
|
|
253
|
+
"gh pr *": "deny",
|
|
254
|
+
// Allow checkout of individual files (git checkout <ref> -- <path>)
|
|
255
|
+
"git checkout * -- *": "allow",
|
|
256
|
+
// Allow git checkout for creating new branches from current HEAD only
|
|
257
|
+
// (but NOT switching to existing branches)
|
|
258
|
+
"git checkout -b *": "allow"
|
|
259
|
+
};
|
|
247
260
|
var PRIME_PERMISSIONS = {
|
|
248
261
|
edit: "allow",
|
|
249
262
|
bash: {
|
|
@@ -337,47 +350,7 @@ var BUILD_PERMISSIONS = {
|
|
|
337
350
|
playwright: "allow",
|
|
338
351
|
linear: "allow"
|
|
339
352
|
};
|
|
340
|
-
var
|
|
341
|
-
edit: "deny",
|
|
342
|
-
bash: {
|
|
343
|
-
"*": "allow",
|
|
344
|
-
...CORE_BASH_ALLOW_LIST,
|
|
345
|
-
...CORE_DESTRUCTIVE_BASH_DENIES
|
|
346
|
-
},
|
|
347
|
-
webfetch: "deny",
|
|
348
|
-
ast_grep: "allow",
|
|
349
|
-
tsc_check: "allow",
|
|
350
|
-
eslint_check: "allow",
|
|
351
|
-
todo_scan: "allow",
|
|
352
|
-
comment_check: "allow",
|
|
353
|
-
question: "allow",
|
|
354
|
-
serena: "allow",
|
|
355
|
-
memory: "deny",
|
|
356
|
-
git: "allow",
|
|
357
|
-
playwright: "allow",
|
|
358
|
-
linear: "deny"
|
|
359
|
-
};
|
|
360
|
-
var CODE_REVIEWER_PERMISSIONS = {
|
|
361
|
-
edit: "deny",
|
|
362
|
-
bash: {
|
|
363
|
-
"*": "allow",
|
|
364
|
-
...CORE_BASH_ALLOW_LIST,
|
|
365
|
-
...CORE_DESTRUCTIVE_BASH_DENIES
|
|
366
|
-
},
|
|
367
|
-
webfetch: "deny",
|
|
368
|
-
ast_grep: "allow",
|
|
369
|
-
tsc_check: "allow",
|
|
370
|
-
eslint_check: "allow",
|
|
371
|
-
todo_scan: "allow",
|
|
372
|
-
comment_check: "allow",
|
|
373
|
-
question: "allow",
|
|
374
|
-
serena: "allow",
|
|
375
|
-
memory: "deny",
|
|
376
|
-
git: "allow",
|
|
377
|
-
playwright: "allow",
|
|
378
|
-
linear: "deny"
|
|
379
|
-
};
|
|
380
|
-
var CODE_REVIEWER_THOROUGH_PERMISSIONS = {
|
|
353
|
+
var REVIEWER_PERMISSIONS = {
|
|
381
354
|
edit: "deny",
|
|
382
355
|
bash: {
|
|
383
356
|
"*": "allow",
|
|
@@ -591,6 +564,10 @@ function createAgents() {
|
|
|
591
564
|
temperature: 0.2,
|
|
592
565
|
permission: {
|
|
593
566
|
...PRIME_PERMISSIONS,
|
|
567
|
+
bash: {
|
|
568
|
+
...typeof PRIME_PERMISSIONS.bash === "object" ? PRIME_PERMISSIONS.bash : { "*": "allow" },
|
|
569
|
+
...AUTOPILOT_BASH_DENIES
|
|
570
|
+
},
|
|
594
571
|
question: "deny"
|
|
595
572
|
},
|
|
596
573
|
tools: AUTOPILOT_PRIME_DISABLED_TOOLS
|
|
@@ -602,6 +579,10 @@ function createAgents() {
|
|
|
602
579
|
temperature: 0.1,
|
|
603
580
|
permission: {
|
|
604
581
|
...PRIME_PERMISSIONS,
|
|
582
|
+
bash: {
|
|
583
|
+
...typeof PRIME_PERMISSIONS.bash === "object" ? PRIME_PERMISSIONS.bash : { "*": "allow" },
|
|
584
|
+
...AUTOPILOT_BASH_DENIES
|
|
585
|
+
},
|
|
605
586
|
question: "deny"
|
|
606
587
|
},
|
|
607
588
|
tools: AUTOPILOT_PRIME_DISABLED_TOOLS
|
|
@@ -628,13 +609,13 @@ function createAgents() {
|
|
|
628
609
|
// via overrides (see permission blocks above). docs-maintainer has no
|
|
629
610
|
// frontmatter permission declaration and keeps that behavior.
|
|
630
611
|
"spec-reviewer": agentFromPrompt(specReviewerPrompt, {
|
|
631
|
-
permission:
|
|
612
|
+
permission: REVIEWER_PERMISSIONS
|
|
632
613
|
}),
|
|
633
614
|
"code-reviewer": agentFromPrompt(codeReviewerPrompt, {
|
|
634
|
-
permission:
|
|
615
|
+
permission: REVIEWER_PERMISSIONS
|
|
635
616
|
}),
|
|
636
617
|
"code-reviewer-thorough": agentFromPrompt(codeReviewerThoroughPrompt, {
|
|
637
|
-
permission:
|
|
618
|
+
permission: REVIEWER_PERMISSIONS
|
|
638
619
|
}),
|
|
639
620
|
"plan-reviewer": agentFromPrompt(planReviewerPrompt, {
|
|
640
621
|
permission: PLAN_REVIEWER_PERMISSIONS
|
|
@@ -700,19 +681,53 @@ function createAgents() {
|
|
|
700
681
|
})
|
|
701
682
|
};
|
|
702
683
|
}
|
|
684
|
+
function applyAgentOverrides(agents, overrides, repoRoot) {
|
|
685
|
+
if (!overrides) return agents;
|
|
686
|
+
for (const [agentName, override] of Object.entries(overrides)) {
|
|
687
|
+
const agent = agents[agentName];
|
|
688
|
+
if (!agent) {
|
|
689
|
+
console.warn(`applyAgentOverrides: unknown agent "${agentName}" \u2014 ignoring`);
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
if (override.model !== void 0) {
|
|
693
|
+
agent.model = override.model;
|
|
694
|
+
}
|
|
695
|
+
if (override.prompt !== void 0) {
|
|
696
|
+
if (path.isAbsolute(override.prompt)) {
|
|
697
|
+
throw new Error(
|
|
698
|
+
`applyAgentOverrides: absolute path not allowed for agent "${agentName}"; got "${override.prompt}". Paths must be relative to repo root.`
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
const promptPath = path.join(repoRoot, override.prompt);
|
|
702
|
+
try {
|
|
703
|
+
const rawPrompt = readFileSync2(promptPath, "utf8");
|
|
704
|
+
const processedPrompt = injectUIEvaluationLadder(
|
|
705
|
+
injectWorkflowMechanics(rawPrompt)
|
|
706
|
+
);
|
|
707
|
+
agent.prompt = processedPrompt;
|
|
708
|
+
} catch (err) {
|
|
709
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
710
|
+
throw new Error(
|
|
711
|
+
`applyAgentOverrides: failed to read prompt file for agent "${agentName}": "${promptPath}" \u2014 ${message}`
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return agents;
|
|
717
|
+
}
|
|
703
718
|
|
|
704
719
|
// src/commands/index.ts
|
|
705
720
|
import { readFileSync as readFileSync3 } from "fs";
|
|
706
721
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
707
|
-
import { dirname as dirname3, join as
|
|
722
|
+
import { dirname as dirname3, join as join4 } from "path";
|
|
708
723
|
var HERE3 = dirname3(fileURLToPath3(import.meta.url));
|
|
709
724
|
function readPrompt2(name) {
|
|
710
725
|
const candidates = [
|
|
711
|
-
|
|
726
|
+
join4(HERE3, "prompts", name),
|
|
712
727
|
// dev: src/commands/prompts/
|
|
713
|
-
|
|
728
|
+
join4(HERE3, "commands", "prompts", name),
|
|
714
729
|
// dist: dist/ → dist/commands/prompts/
|
|
715
|
-
|
|
730
|
+
join4(HERE3, "..", "..", "src", "commands", "prompts", name)
|
|
716
731
|
// fallback dev
|
|
717
732
|
];
|
|
718
733
|
for (const p of candidates) {
|
|
@@ -808,19 +823,19 @@ function createMcpConfig() {
|
|
|
808
823
|
|
|
809
824
|
// src/skills/paths.ts
|
|
810
825
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
811
|
-
import { dirname as dirname4, join as
|
|
826
|
+
import { dirname as dirname4, join as join5 } from "path";
|
|
812
827
|
function getSkillsRoot() {
|
|
813
828
|
const here = dirname4(fileURLToPath4(import.meta.url));
|
|
814
|
-
return
|
|
829
|
+
return join5(here, "skills");
|
|
815
830
|
}
|
|
816
831
|
|
|
817
832
|
// src/config-hook.ts
|
|
818
833
|
function writePermDebugSnapshot(config) {
|
|
819
834
|
if (process.env["HARNESS_OPENCODE_PERM_DEBUG"] !== "1") return;
|
|
820
835
|
try {
|
|
821
|
-
const stateDir = process.env["XDG_STATE_HOME"] ||
|
|
822
|
-
const targetDir =
|
|
823
|
-
const targetFile =
|
|
836
|
+
const stateDir = process.env["XDG_STATE_HOME"] || path2.join(os.homedir(), ".local", "state");
|
|
837
|
+
const targetDir = path2.join(stateDir, "harness-opencode");
|
|
838
|
+
const targetFile = path2.join(targetDir, "perm-debug.json");
|
|
824
839
|
const version = readOurPackageVersion(import.meta.url);
|
|
825
840
|
const agentBlock = config.agent ?? {};
|
|
826
841
|
const agentPerms = {};
|
|
@@ -893,6 +908,21 @@ function resolveHarnessModels(agents, config, pluginOptions) {
|
|
|
893
908
|
function applyConfig(config, pluginOptions) {
|
|
894
909
|
const ourAgents = createAgents();
|
|
895
910
|
resolveHarnessModels(ourAgents, config, pluginOptions);
|
|
911
|
+
const agentOverrides = pluginOptions?.agents;
|
|
912
|
+
if (agentOverrides) {
|
|
913
|
+
applyAgentOverrides(ourAgents, agentOverrides, process.cwd());
|
|
914
|
+
}
|
|
915
|
+
const envOverrides = process.env["GLRS_AGENT_OVERRIDES"];
|
|
916
|
+
if (envOverrides) {
|
|
917
|
+
try {
|
|
918
|
+
const parsed = JSON.parse(envOverrides);
|
|
919
|
+
if (parsed && typeof parsed === "object") {
|
|
920
|
+
applyAgentOverrides(ourAgents, parsed, process.cwd());
|
|
921
|
+
}
|
|
922
|
+
} catch {
|
|
923
|
+
console.warn(`Failed to parse GLRS_AGENT_OVERRIDES env var: ignoring`);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
896
926
|
config.agent = { ...ourAgents, ...config.agent ?? {} };
|
|
897
927
|
const ourCommands = createCommands();
|
|
898
928
|
config.command = {
|
|
@@ -1389,7 +1419,7 @@ function createTools() {
|
|
|
1389
1419
|
|
|
1390
1420
|
// src/plugins/dotenv.ts
|
|
1391
1421
|
import * as fs2 from "fs";
|
|
1392
|
-
import * as
|
|
1422
|
+
import * as path3 from "path";
|
|
1393
1423
|
var DOTENV_FILES = [".env", ".env.local"];
|
|
1394
1424
|
function parseDotenv(content) {
|
|
1395
1425
|
const out = {};
|
|
@@ -1422,7 +1452,7 @@ function loadDotenv(directory) {
|
|
|
1422
1452
|
const merged = {};
|
|
1423
1453
|
const filesLoaded = [];
|
|
1424
1454
|
for (const name of DOTENV_FILES) {
|
|
1425
|
-
const filePath =
|
|
1455
|
+
const filePath = path3.join(directory, name);
|
|
1426
1456
|
let content;
|
|
1427
1457
|
try {
|
|
1428
1458
|
content = fs2.readFileSync(filePath, "utf8");
|
|
@@ -1477,7 +1507,7 @@ var notify_default = plugin;
|
|
|
1477
1507
|
|
|
1478
1508
|
// src/plugins/cost-tracker.ts
|
|
1479
1509
|
import * as fs3 from "fs/promises";
|
|
1480
|
-
import * as
|
|
1510
|
+
import * as path4 from "path";
|
|
1481
1511
|
import * as os2 from "os";
|
|
1482
1512
|
var MAX_LINE_BYTES = 2048;
|
|
1483
1513
|
var ROLLUP_DEBOUNCE_MS = 5e3;
|
|
@@ -1485,11 +1515,11 @@ function resolveDataDir() {
|
|
|
1485
1515
|
const override = process.env.GLORIOUS_COST_TRACKER_DIR;
|
|
1486
1516
|
if (override) {
|
|
1487
1517
|
if (override.startsWith("~")) {
|
|
1488
|
-
return
|
|
1518
|
+
return path4.join(os2.homedir(), override.slice(1));
|
|
1489
1519
|
}
|
|
1490
1520
|
return override;
|
|
1491
1521
|
}
|
|
1492
|
-
return
|
|
1522
|
+
return path4.join(os2.homedir(), ".glorious", "opencode");
|
|
1493
1523
|
}
|
|
1494
1524
|
function zeroTokens() {
|
|
1495
1525
|
return {
|
|
@@ -1561,8 +1591,8 @@ var plugin2 = async () => {
|
|
|
1561
1591
|
return {};
|
|
1562
1592
|
}
|
|
1563
1593
|
const dataDir = resolveDataDir();
|
|
1564
|
-
const jsonlPath =
|
|
1565
|
-
const rollupPath =
|
|
1594
|
+
const jsonlPath = path4.join(dataDir, "costs.jsonl");
|
|
1595
|
+
const rollupPath = path4.join(dataDir, "costs.json");
|
|
1566
1596
|
const lastSeen = /* @__PURE__ */ new Map();
|
|
1567
1597
|
const messageMeta = /* @__PURE__ */ new Map();
|
|
1568
1598
|
const rollup = emptyRollup();
|
|
@@ -1799,7 +1829,7 @@ var cost_tracker_default = plugin2;
|
|
|
1799
1829
|
// src/plugins/tool-hooks.ts
|
|
1800
1830
|
import * as crypto from "crypto";
|
|
1801
1831
|
import * as fs4 from "fs";
|
|
1802
|
-
import * as
|
|
1832
|
+
import * as path5 from "path";
|
|
1803
1833
|
import * as os3 from "os";
|
|
1804
1834
|
import { execFile as execFileCb } from "child_process";
|
|
1805
1835
|
import { promisify as promisify6 } from "util";
|
|
@@ -1886,8 +1916,8 @@ function resolveConfig(config, pluginOptions) {
|
|
|
1886
1916
|
};
|
|
1887
1917
|
}
|
|
1888
1918
|
function getToolOutputDir() {
|
|
1889
|
-
const stateHome = process.env["XDG_STATE_HOME"] ||
|
|
1890
|
-
return
|
|
1919
|
+
const stateHome = process.env["XDG_STATE_HOME"] || path5.join(os3.homedir(), ".local", "state");
|
|
1920
|
+
return path5.join(stateHome, "harness-opencode", "tool-output");
|
|
1891
1921
|
}
|
|
1892
1922
|
function hashContent(content) {
|
|
1893
1923
|
return crypto.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
@@ -1920,9 +1950,9 @@ async function resolveSessionDir(client, sess, sessionID) {
|
|
|
1920
1950
|
}
|
|
1921
1951
|
function isUnderToolOutputDir(filePath) {
|
|
1922
1952
|
try {
|
|
1923
|
-
const abs =
|
|
1924
|
-
const spillDir =
|
|
1925
|
-
return abs === spillDir || abs.startsWith(spillDir +
|
|
1953
|
+
const abs = path5.resolve(filePath);
|
|
1954
|
+
const spillDir = path5.resolve(getToolOutputDir());
|
|
1955
|
+
return abs === spillDir || abs.startsWith(spillDir + path5.sep);
|
|
1926
1956
|
} catch {
|
|
1927
1957
|
return false;
|
|
1928
1958
|
}
|
|
@@ -1957,7 +1987,7 @@ function applyBackpressure(cfg, toolName, callID, output, args) {
|
|
|
1957
1987
|
try {
|
|
1958
1988
|
const dir = getToolOutputDir();
|
|
1959
1989
|
fs4.mkdirSync(dir, { recursive: true });
|
|
1960
|
-
diskPath =
|
|
1990
|
+
diskPath = path5.join(dir, `${callID}.txt`);
|
|
1961
1991
|
fs4.writeFileSync(diskPath, text);
|
|
1962
1992
|
} catch {
|
|
1963
1993
|
}
|
|
@@ -2004,7 +2034,7 @@ ${tail}`;
|
|
|
2004
2034
|
}
|
|
2005
2035
|
async function runPostEditVerify(cfg, client, sess, sessionID, filePath, output) {
|
|
2006
2036
|
if (!cfg.enabled) return;
|
|
2007
|
-
const ext =
|
|
2037
|
+
const ext = path5.extname(filePath).toLowerCase();
|
|
2008
2038
|
if (!TS_EXTENSIONS.has(ext)) return;
|
|
2009
2039
|
const now = Date.now();
|
|
2010
2040
|
if (now - sess.lastVerifyTs < 2e3) return;
|
|
@@ -2037,17 +2067,17 @@ ${String(stderr)}`;
|
|
|
2037
2067
|
}
|
|
2038
2068
|
if (!raw.trim()) return;
|
|
2039
2069
|
const errors = parseTscOutput(raw);
|
|
2040
|
-
const normPath =
|
|
2070
|
+
const normPath = path5.resolve(cwd, filePath);
|
|
2041
2071
|
const fileErrors = errors.filter((e) => {
|
|
2042
|
-
const errPath =
|
|
2043
|
-
return
|
|
2072
|
+
const errPath = path5.isAbsolute(e.file) ? e.file : path5.resolve(cwd, e.file);
|
|
2073
|
+
return path5.normalize(errPath) === path5.normalize(normPath);
|
|
2044
2074
|
});
|
|
2045
2075
|
if (fileErrors.length === 0) return;
|
|
2046
2076
|
const { rows } = dedupeAndCap(fileErrors, VERIFY_MAX_ERRORS);
|
|
2047
2077
|
const lines = rows.map(formatRow);
|
|
2048
2078
|
output.output += `
|
|
2049
2079
|
|
|
2050
|
-
--- POST-EDIT DIAGNOSTICS (${fileErrors.length} error${fileErrors.length !== 1 ? "s" : ""} in ${
|
|
2080
|
+
--- POST-EDIT DIAGNOSTICS (${fileErrors.length} error${fileErrors.length !== 1 ? "s" : ""} in ${path5.basename(filePath)}) ---
|
|
2051
2081
|
` + lines.join("\n") + `
|
|
2052
2082
|
--- Fix these before proceeding ---`;
|
|
2053
2083
|
} catch {
|
|
@@ -2061,7 +2091,7 @@ function checkEditLoop(cfg, sess, filePath, output) {
|
|
|
2061
2091
|
output.output += `
|
|
2062
2092
|
|
|
2063
2093
|
--- LOOP WARNING ---
|
|
2064
|
-
You've edited ${
|
|
2094
|
+
You've edited ${path5.basename(filePath)} ${count} times this session. Consider reconsidering your approach \u2014 are you stuck in a loop? Step back and think about whether a different strategy would be more effective.
|
|
2065
2095
|
---`;
|
|
2066
2096
|
}
|
|
2067
2097
|
}
|
|
@@ -2121,16 +2151,16 @@ import { extname as extname2 } from "path";
|
|
|
2121
2151
|
import { createHash as createHash2, randomUUID } from "crypto";
|
|
2122
2152
|
import { homedir as homedir4 } from "os";
|
|
2123
2153
|
import { mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync } from "fs";
|
|
2124
|
-
import { join as
|
|
2154
|
+
import { join as join10 } from "path";
|
|
2125
2155
|
var APP_KEY = "A-US-3617699429";
|
|
2126
2156
|
var ENDPOINT = "https://us.aptabase.com/api/v0/event";
|
|
2127
2157
|
var PKG_NAME = "@glrs-dev/harness-plugin-opencode";
|
|
2128
|
-
var PKG_VERSION = true ? "2.
|
|
2158
|
+
var PKG_VERSION = true ? "2.6.0" : "dev";
|
|
2129
2159
|
var DISABLED = process.env.HARNESS_OPENCODE_TELEMETRY === "0" || process.env.HARNESS_OPENCODE_TELEMETRY === "false" || process.env.DO_NOT_TRACK === "1" || process.env.CI === "true";
|
|
2130
2160
|
var SESSION_ID = randomUUID();
|
|
2131
2161
|
function getInstallId() {
|
|
2132
|
-
const dir =
|
|
2133
|
-
const file =
|
|
2162
|
+
const dir = join10(homedir4(), ".config", "harness-opencode");
|
|
2163
|
+
const file = join10(dir, "install-id");
|
|
2134
2164
|
try {
|
|
2135
2165
|
if (existsSync(file)) return readFileSync5(file, "utf8").trim();
|
|
2136
2166
|
mkdirSync3(dir, { recursive: true });
|
package/package.json
CHANGED