token-goat 2.9.28 → 2.9.30
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/README.md +36 -40
- package/SECURITY.md +28 -10
- package/THIRD_PARTY_NOTICES.md +40 -3
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/token-goat-chunk-3CHUNJ2O.mjs +53 -0
- package/dist/token-goat-chunk-3Z5S4KGM.mjs +918 -0
- package/dist/token-goat-chunk-4FVIAHSI.mjs +211 -0
- package/dist/{token-goat-chunk-66LODAUT.mjs → token-goat-chunk-4JJS54TR.mjs} +4 -3
- package/dist/token-goat-chunk-4LCCNRTG.mjs +313 -0
- package/dist/token-goat-chunk-54K3EUV3.mjs +35 -0
- package/dist/token-goat-chunk-56EIMS3E.mjs +159 -0
- package/dist/token-goat-chunk-5BCIJXMO.mjs +609 -0
- package/dist/token-goat-chunk-5KDMCMF2.mjs +362 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/{token-goat-chunk-NILVK7XM.mjs → token-goat-chunk-64FBPDTK.mjs} +12 -6
- package/dist/{token-goat-chunk-LEG3JNJ6.mjs → token-goat-chunk-664RTTUV.mjs} +31 -15
- package/dist/token-goat-chunk-67TQJ76B.mjs +57 -0
- package/dist/token-goat-chunk-6QMAS7AB.mjs +42 -0
- package/dist/token-goat-chunk-7BXSNBY5.mjs +253 -0
- package/dist/{token-goat-chunk-F7QZRIWM.mjs → token-goat-chunk-7F2UBPD3.mjs} +42 -35
- package/dist/{token-goat-chunk-CC2PYJM7.mjs → token-goat-chunk-7IN2MKDS.mjs} +718 -595
- package/dist/token-goat-chunk-7NADEDKJ.mjs +124 -0
- package/dist/{token-goat-chunk-6SGLIPQB.mjs → token-goat-chunk-A3CK6N5Z.mjs} +621 -72
- package/dist/{token-goat-chunk-HXNAC4ZF.mjs → token-goat-chunk-AFLYLHDH.mjs} +48 -33
- package/dist/token-goat-chunk-AM5V6GSX.mjs +367 -0
- package/dist/{token-goat-chunk-I7CB3X4K.mjs → token-goat-chunk-APGZXSPS.mjs} +44 -148
- package/dist/{token-goat-chunk-BJBRGPBX.mjs → token-goat-chunk-ARDNEC2U.mjs} +11 -7
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +134 -0
- package/dist/token-goat-chunk-B2RZZCSS.mjs +354 -0
- package/dist/{token-goat-chunk-QM76S6YS.mjs → token-goat-chunk-B45VMIIH.mjs} +6 -5
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/{token-goat-chunk-GGLEE35R.mjs → token-goat-chunk-C63JQV5K.mjs} +49 -10
- package/dist/{token-goat-chunk-RJH64KQH.mjs → token-goat-chunk-COBQGL5S.mjs} +2661 -2440
- package/dist/token-goat-chunk-COTXZHTS.mjs +39 -0
- package/dist/token-goat-chunk-CYCEYAEO.mjs +265 -0
- package/dist/token-goat-chunk-CZ3LUXYZ.mjs +4115 -0
- package/dist/token-goat-chunk-DZX2YDPT.mjs +15 -0
- package/dist/token-goat-chunk-E3OQX2XT.mjs +824 -0
- package/dist/token-goat-chunk-EFHMMIGP.mjs +68 -0
- package/dist/token-goat-chunk-ETBHVDB6.mjs +328 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-6Z5ULNE5.mjs → token-goat-chunk-FBNQNSJK.mjs} +2490 -4957
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/{token-goat-chunk-XI2VFAV6.mjs → token-goat-chunk-FZ3NEW5O.mjs} +33 -19
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/{token-goat-chunk-VE27HPIF.mjs → token-goat-chunk-GFBSN7BD.mjs} +30 -398
- package/dist/{token-goat-chunk-L45ZQRT7.mjs → token-goat-chunk-GOLEOXZP.mjs} +780 -786
- package/dist/token-goat-chunk-H2K3QP6H.mjs +24 -0
- package/dist/token-goat-chunk-H2PHHGM5.mjs +188 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HG45AF2B.mjs +2228 -0
- package/dist/{token-goat-chunk-CBMY2FGI.mjs → token-goat-chunk-HOJLCGDP.mjs} +17113 -15554
- package/dist/{token-goat-chunk-HUDC5GS5.mjs → token-goat-chunk-HYBFA5X3.mjs} +120 -19
- package/dist/token-goat-chunk-IVALLT3S.mjs +48 -0
- package/dist/token-goat-chunk-IVE6U7KV.mjs +53 -0
- package/dist/{token-goat-chunk-UBUKHVYW.mjs → token-goat-chunk-IVKIZWAB.mjs} +3 -3
- package/dist/{token-goat-chunk-4JMWPWCS.mjs → token-goat-chunk-JB6QN6VF.mjs} +6 -4
- package/dist/{token-goat-chunk-Q4S3UQGO.mjs → token-goat-chunk-JDHE26RP.mjs} +10 -3
- package/dist/{token-goat-chunk-7R2XYKC5.mjs → token-goat-chunk-JDU3EXSU.mjs} +14 -10
- package/dist/token-goat-chunk-JDWCRD6M.mjs +253 -0
- package/dist/{token-goat-chunk-XBESNWEX.mjs → token-goat-chunk-JN4XMLSD.mjs} +7 -4
- package/dist/token-goat-chunk-JTQQGXZH.mjs +733 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQNZDCBD.mjs +47 -0
- package/dist/{token-goat-chunk-4RN64ZND.mjs → token-goat-chunk-KWPNJBDH.mjs} +28 -3
- package/dist/token-goat-chunk-LOBGHXPB.mjs +242 -0
- package/dist/token-goat-chunk-MKPF4CL5.mjs +37 -0
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/{token-goat-chunk-YWSP6IU7.mjs → token-goat-chunk-N2NMER56.mjs} +25 -15
- package/dist/token-goat-chunk-NYKZLXMK.mjs +218 -0
- package/dist/token-goat-chunk-OJBNYTJP.mjs +3087 -0
- package/dist/token-goat-chunk-P4QMM4WK.mjs +295 -0
- package/dist/token-goat-chunk-PD5VKH46.mjs +184 -0
- package/dist/token-goat-chunk-PEPTHRFF.mjs +129 -0
- package/dist/{token-goat-chunk-VWZKZPSR.mjs → token-goat-chunk-PU7V3FD6.mjs} +8752 -11098
- package/dist/token-goat-chunk-PY533T7F.mjs +46 -0
- package/dist/token-goat-chunk-Q5VTGRH7.mjs +761 -0
- package/dist/{token-goat-chunk-IHKZ3QNA.mjs → token-goat-chunk-QCLDAQTS.mjs} +33 -19
- package/dist/{token-goat-chunk-LKSXAMJB.mjs → token-goat-chunk-QSBRTGM2.mjs} +9 -2
- package/dist/{token-goat-chunk-4STDIGYC.mjs → token-goat-chunk-RC35RBUL.mjs} +7 -5
- package/dist/{token-goat-chunk-D5ICEPSB.mjs → token-goat-chunk-RHXKCZX3.mjs} +887 -507
- package/dist/{token-goat-chunk-RSS3TLXU.mjs → token-goat-chunk-RZRTDST7.mjs} +17 -7
- package/dist/{token-goat-chunk-MAMQPC43.mjs → token-goat-chunk-SJHWVNDQ.mjs} +15 -21
- package/dist/token-goat-chunk-SMVRN2HU.mjs +188 -0
- package/dist/{token-goat-chunk-EL7M26WP.mjs → token-goat-chunk-SQSSNQPE.mjs} +2100 -1442
- package/dist/{token-goat-chunk-OZRSREKR.mjs → token-goat-chunk-T4FK7VOV.mjs} +3 -3
- package/dist/token-goat-chunk-U4N3BN2W.mjs +92 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/{token-goat-chunk-XKY4VKJ4.mjs → token-goat-chunk-UQ5UK2T7.mjs} +15 -4
- package/dist/token-goat-chunk-USILZ3T3.mjs +53 -0
- package/dist/token-goat-chunk-VES7EL7O.mjs +205 -0
- package/dist/{token-goat-chunk-M56BWPBN.mjs → token-goat-chunk-VL3YIFHZ.mjs} +550 -49
- package/dist/{token-goat-chunk-IZXKVT4A.mjs → token-goat-chunk-VPBBTSJR.mjs} +362 -128
- package/dist/{token-goat-chunk-F2ARFHLJ.mjs → token-goat-chunk-W3QCJS6G.mjs} +10 -2
- package/dist/{token-goat-chunk-FSTWAOW6.mjs → token-goat-chunk-WY3L4DVT.mjs} +11 -5
- package/dist/{token-goat-chunk-OSUFN2FV.mjs → token-goat-chunk-XB5KKOCG.mjs} +5 -25
- package/dist/token-goat-chunk-XKI4SEMX.mjs +66 -0
- package/dist/token-goat-chunk-XU4P6Z24.mjs +133 -0
- package/dist/{token-goat-chunk-6CCQDAYY.mjs → token-goat-chunk-Y776AENC.mjs} +138 -33
- package/dist/token-goat-chunk-YARZFCZS.mjs +359 -0
- package/dist/{token-goat-chunk-EEIDFMEM.mjs → token-goat-chunk-YZAAZU2S.mjs} +12 -3
- package/dist/{token-goat-chunk-E3K3BTEQ.mjs → token-goat-chunk-Z44YO3QZ.mjs} +12 -6
- package/dist/token-goat-chunk-Z57YODA2.mjs +35 -0
- package/dist/{token-goat-chunk-DA43OE7L.mjs → token-goat-chunk-ZCDTCVIS.mjs} +49 -30
- package/dist/token-goat-chunk-ZEJVMUQH.mjs +48 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/{token-goat-chunk-SJEKA7Y2.mjs → token-goat-chunk-ZQSJMO2R.mjs} +381 -201
- package/dist/token-goat-hook-client.cjs +539 -0
- package/dist/token-goat-hook-client.mjs +26 -0
- package/dist/token-goat-hook.mjs +48 -28
- package/dist/token-goat.core.mjs +10 -45
- package/docs/C4_RUNTIME_ARCHITECTURE.md +3 -3
- package/docs/cli.md +82 -47
- package/docs/install.md +58 -23
- package/docs/security.md +7 -7
- package/package.json +17 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-4JJBFT7V.mjs +0 -20
- package/dist/token-goat-chunk-5NNYIUGV.mjs +0 -143
- package/dist/token-goat-chunk-6DQNNFJ6.mjs +0 -294
- package/dist/token-goat-chunk-7MAFDRVR.mjs +0 -47
- package/dist/token-goat-chunk-BCN2YQC6.mjs +0 -32
- package/dist/token-goat-chunk-D7GHQKQD.mjs +0 -30
- package/dist/token-goat-chunk-GMOUBOX4.mjs +0 -386
- package/dist/token-goat-chunk-IFORDBGC.mjs +0 -192
- package/dist/token-goat-chunk-JXK2HQXS.mjs +0 -318
- package/dist/token-goat-chunk-L7SDVGBT.mjs +0 -430
- package/dist/token-goat-chunk-MMLMALWK.mjs +0 -1381
- package/dist/token-goat-chunk-MVSWBNMD.mjs +0 -1985
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
buildGuidanceBlock,
|
|
5
|
+
claudeMdPath,
|
|
6
|
+
codexAgentsPath,
|
|
7
|
+
copilotCliInstructionsPath,
|
|
8
|
+
isCodexInstalled,
|
|
9
|
+
isCopilotCliInstalled,
|
|
10
|
+
isInstalled
|
|
11
|
+
} from "./token-goat-chunk-OJBNYTJP.mjs";
|
|
12
|
+
import {
|
|
13
|
+
loadConfig
|
|
14
|
+
} from "./token-goat-chunk-7IN2MKDS.mjs";
|
|
15
|
+
import {
|
|
16
|
+
recordCreatedBy,
|
|
17
|
+
upsertDelimitedBlock
|
|
18
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
19
|
+
import {
|
|
20
|
+
init_define_import_meta_env
|
|
21
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
22
|
+
|
|
23
|
+
// src/cli_doctor_guidance.ts
|
|
24
|
+
init_define_import_meta_env();
|
|
25
|
+
import * as fs from "node:fs";
|
|
26
|
+
import * as path from "node:path";
|
|
27
|
+
var INSTRUCTION_GATE_BEGIN = "<!-- token-goat-begin -->";
|
|
28
|
+
var INSTRUCTION_GATE_END = "<!-- token-goat-end -->";
|
|
29
|
+
var CODEX_GATE_BEGIN = "<!-- token-goat-codex-begin -->";
|
|
30
|
+
var CODEX_GATE_END = "<!-- token-goat-codex-end -->";
|
|
31
|
+
function findInstructionGateCandidates(rootDir = process.cwd()) {
|
|
32
|
+
const candidates = [];
|
|
33
|
+
const claudeMdPath2 = path.join(rootDir, "CLAUDE.md");
|
|
34
|
+
const claudeMdExists = fs.existsSync(claudeMdPath2);
|
|
35
|
+
let claudeMdHasGate = false;
|
|
36
|
+
if (claudeMdExists) {
|
|
37
|
+
try {
|
|
38
|
+
const content = fs.readFileSync(claudeMdPath2, "utf8");
|
|
39
|
+
claudeMdHasGate = content.includes(INSTRUCTION_GATE_BEGIN) && content.includes(INSTRUCTION_GATE_END);
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
candidates.push({
|
|
44
|
+
filename: "CLAUDE.md",
|
|
45
|
+
relativePath: "CLAUDE.md",
|
|
46
|
+
fullPath: claudeMdPath2,
|
|
47
|
+
harnessName: "Claude Code",
|
|
48
|
+
exists: claudeMdExists,
|
|
49
|
+
hasGate: claudeMdHasGate,
|
|
50
|
+
beginMarker: INSTRUCTION_GATE_BEGIN,
|
|
51
|
+
endMarker: INSTRUCTION_GATE_END,
|
|
52
|
+
fallbackToolClause: "Claude Code's own Read, Grep, and Glob preference rules"
|
|
53
|
+
});
|
|
54
|
+
const agentsMdPath = path.join(rootDir, "AGENTS.md");
|
|
55
|
+
const agentsMdExists = fs.existsSync(agentsMdPath);
|
|
56
|
+
let agentsMdHasGate = false;
|
|
57
|
+
if (agentsMdExists) {
|
|
58
|
+
try {
|
|
59
|
+
const content = fs.readFileSync(agentsMdPath, "utf8");
|
|
60
|
+
agentsMdHasGate = content.includes(CODEX_GATE_BEGIN) && content.includes(CODEX_GATE_END) || content.includes(INSTRUCTION_GATE_BEGIN) && content.includes(INSTRUCTION_GATE_END);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
candidates.push({
|
|
65
|
+
filename: "AGENTS.md",
|
|
66
|
+
relativePath: "AGENTS.md",
|
|
67
|
+
fullPath: agentsMdPath,
|
|
68
|
+
harnessName: "Codex / AGENTS.md",
|
|
69
|
+
exists: agentsMdExists,
|
|
70
|
+
hasGate: agentsMdHasGate,
|
|
71
|
+
beginMarker: CODEX_GATE_BEGIN,
|
|
72
|
+
endMarker: CODEX_GATE_END,
|
|
73
|
+
fallbackToolClause: "Codex's native `exec`, `apply_patch`, and `view_image` tools (shell commands like `cat`/`type` run inside `exec`)"
|
|
74
|
+
});
|
|
75
|
+
const copilotInstructionsPath = path.join(rootDir, ".github", "copilot-instructions.md");
|
|
76
|
+
const copilotInstructionsExists = fs.existsSync(copilotInstructionsPath);
|
|
77
|
+
let copilotInstructionsHasGate = false;
|
|
78
|
+
if (copilotInstructionsExists) {
|
|
79
|
+
try {
|
|
80
|
+
const content = fs.readFileSync(copilotInstructionsPath, "utf8");
|
|
81
|
+
copilotInstructionsHasGate = content.includes(INSTRUCTION_GATE_BEGIN) && content.includes(INSTRUCTION_GATE_END);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
candidates.push({
|
|
86
|
+
filename: "copilot-instructions.md",
|
|
87
|
+
relativePath: path.join(".github", "copilot-instructions.md"),
|
|
88
|
+
fullPath: copilotInstructionsPath,
|
|
89
|
+
harnessName: "GitHub Copilot CLI",
|
|
90
|
+
exists: copilotInstructionsExists,
|
|
91
|
+
hasGate: copilotInstructionsHasGate,
|
|
92
|
+
beginMarker: INSTRUCTION_GATE_BEGIN,
|
|
93
|
+
endMarker: INSTRUCTION_GATE_END,
|
|
94
|
+
fallbackToolClause: "Copilot CLI's native `view`, `grep`, and `glob` tools (with PowerShell commands `Get-Content`/`Select-String` as search fallbacks)"
|
|
95
|
+
});
|
|
96
|
+
return candidates;
|
|
97
|
+
}
|
|
98
|
+
function fileHasGate(fullPath, markers) {
|
|
99
|
+
let content;
|
|
100
|
+
try {
|
|
101
|
+
content = fs.readFileSync(fullPath, "utf8");
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return markers.some(([begin, end]) => content.includes(begin) && content.includes(end));
|
|
106
|
+
}
|
|
107
|
+
function findActiveGlobalGates() {
|
|
108
|
+
const globals = [
|
|
109
|
+
{ fullPath: claudeMdPath(), markers: [[INSTRUCTION_GATE_BEGIN, INSTRUCTION_GATE_END]] },
|
|
110
|
+
{ fullPath: codexAgentsPath(), markers: [[CODEX_GATE_BEGIN, CODEX_GATE_END], [INSTRUCTION_GATE_BEGIN, INSTRUCTION_GATE_END]] },
|
|
111
|
+
{ fullPath: copilotCliInstructionsPath(), markers: [[INSTRUCTION_GATE_BEGIN, INSTRUCTION_GATE_END]] }
|
|
112
|
+
];
|
|
113
|
+
return globals.filter((g) => fileHasGate(g.fullPath, g.markers)).map((g) => g.fullPath);
|
|
114
|
+
}
|
|
115
|
+
function checkInstructionGates(rootDir = process.cwd()) {
|
|
116
|
+
const candidates = findInstructionGateCandidates(rootDir);
|
|
117
|
+
const existingFiles = candidates.filter((c) => c.exists);
|
|
118
|
+
const gatedFiles = existingFiles.filter((c) => c.hasGate);
|
|
119
|
+
const activeGlobal = findActiveGlobalGates();
|
|
120
|
+
if (gatedFiles.length > 0 || activeGlobal.length > 0) {
|
|
121
|
+
const names = [...activeGlobal, ...gatedFiles.map((c) => c.relativePath)].join(", ");
|
|
122
|
+
return {
|
|
123
|
+
name: "Instruction gate",
|
|
124
|
+
status: "ok",
|
|
125
|
+
message: `active in ${names}`
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (existingFiles.length > 0) {
|
|
129
|
+
const unGated = existingFiles.map((c) => c.relativePath).join(", ");
|
|
130
|
+
return {
|
|
131
|
+
name: "Instruction gate",
|
|
132
|
+
status: "warn",
|
|
133
|
+
message: `missing in ${unGated} and in the user-level instruction files 'token-goat install' writes (agents will bypass token-goat and read whole files). Run 'token-goat doctor --fix' to inject automatically.`
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
name: "Instruction gate",
|
|
138
|
+
status: "warn",
|
|
139
|
+
message: "missing: no user-level instruction file carries it and no project instruction file was found (CLAUDE.md, AGENTS.md, or .github/copilot-instructions.md). Run 'token-goat install', or 'token-goat doctor --fix' to create CLAUDE.md with the routing gate."
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function repairInstructionGates(rootDir = process.cwd()) {
|
|
143
|
+
const repairs = [];
|
|
144
|
+
const errors = [];
|
|
145
|
+
const candidates = findInstructionGateCandidates(rootDir);
|
|
146
|
+
if (candidates.some((c) => c.hasGate) || findActiveGlobalGates().length > 0) return { repairs, errors };
|
|
147
|
+
const existingUngated = candidates.filter((c) => c.exists);
|
|
148
|
+
const fallback = candidates[0];
|
|
149
|
+
if (!fallback) return { repairs, errors };
|
|
150
|
+
const targets = existingUngated.length > 0 ? existingUngated : [fallback];
|
|
151
|
+
const cfg = loadConfig(rootDir);
|
|
152
|
+
const gdrive = cfg.gdrive?.enabled ?? true;
|
|
153
|
+
for (const target of targets) {
|
|
154
|
+
try {
|
|
155
|
+
const block = buildGuidanceBlock({
|
|
156
|
+
beginMarker: target.beginMarker,
|
|
157
|
+
endMarker: target.endMarker,
|
|
158
|
+
fallbackToolClause: target.fallbackToolClause,
|
|
159
|
+
gdrive
|
|
160
|
+
});
|
|
161
|
+
recordCreatedBy([target.fullPath], () => {
|
|
162
|
+
fs.mkdirSync(path.dirname(target.fullPath), { recursive: true });
|
|
163
|
+
upsertDelimitedBlock(target.fullPath, target.beginMarker, target.endMarker, block);
|
|
164
|
+
});
|
|
165
|
+
repairs.push(`Injected token-goat routing gate into ${target.relativePath}`);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
errors.push(`Failed to inject routing gate into ${target.relativePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { repairs, errors };
|
|
171
|
+
}
|
|
172
|
+
function checkHarnessCacheEfficiency(rootDir = process.cwd()) {
|
|
173
|
+
const hasVscode = fs.existsSync(path.join(rootDir, ".vscode"));
|
|
174
|
+
const hasIdea = fs.existsSync(path.join(rootDir, ".idea"));
|
|
175
|
+
const hasCursor = fs.existsSync(path.join(rootDir, ".cursor")) || fs.existsSync(path.join(rootDir, ".cursorrules"));
|
|
176
|
+
const hasVs = fs.existsSync(path.join(rootDir, ".vs"));
|
|
177
|
+
const ideDetected = [
|
|
178
|
+
hasVscode && "VS Code",
|
|
179
|
+
hasIdea && "JetBrains",
|
|
180
|
+
hasCursor && "Cursor",
|
|
181
|
+
hasVs && "Visual Studio"
|
|
182
|
+
].filter(Boolean);
|
|
183
|
+
const hasClaude = fs.existsSync(path.join(rootDir, ".claude")) || fs.existsSync(path.join(rootDir, "CLAUDE.md"));
|
|
184
|
+
const hasCopilot = fs.existsSync(path.join(rootDir, ".github", "hooks")) || fs.existsSync(path.join(rootDir, ".github", "copilot-instructions.md"));
|
|
185
|
+
const hasCodex = fs.existsSync(path.join(rootDir, ".codex")) || fs.existsSync(path.join(rootDir, "AGENTS.md"));
|
|
186
|
+
const cliDetected = [
|
|
187
|
+
(hasClaude || isInstalled("user")) && "Claude Code",
|
|
188
|
+
(hasCopilot || isCopilotCliInstalled()) && "Copilot CLI",
|
|
189
|
+
(hasCodex || isCodexInstalled()) && "Codex"
|
|
190
|
+
].filter(Boolean);
|
|
191
|
+
if (ideDetected.length > 0 && cliDetected.length === 0) {
|
|
192
|
+
return {
|
|
193
|
+
name: "Harness efficiency",
|
|
194
|
+
status: "warn",
|
|
195
|
+
message: `${ideDetected.join(", ")} workspace detected without CLI harness config. IDE hooks cannot fold/trim built-in reads. If you also use a CLI agent, run 'token-goat install' for Claude Code, or 'token-goat install --codex' or '--copilot' for those.`
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (cliDetected.length > 0) {
|
|
199
|
+
return {
|
|
200
|
+
name: "Harness efficiency",
|
|
201
|
+
status: "ok",
|
|
202
|
+
message: `CLI harness configured (${cliDetected.join(", ")})`
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
INSTRUCTION_GATE_BEGIN,
|
|
210
|
+
INSTRUCTION_GATE_END,
|
|
211
|
+
CODEX_GATE_BEGIN,
|
|
212
|
+
CODEX_GATE_END,
|
|
213
|
+
findInstructionGateCandidates,
|
|
214
|
+
findActiveGlobalGates,
|
|
215
|
+
checkInstructionGates,
|
|
216
|
+
repairInstructionGates,
|
|
217
|
+
checkHarnessCacheEfficiency
|
|
218
|
+
};
|