token-goat 2.9.29 → 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 +34 -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-PGTH2U4C.mjs → token-goat-chunk-4JJS54TR.mjs} +4 -3
- package/dist/token-goat-chunk-4LCCNRTG.mjs +313 -0
- package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-54K3EUV3.mjs} +1 -1
- 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-GLXRTTLE.mjs → token-goat-chunk-64FBPDTK.mjs} +12 -8
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-664RTTUV.mjs} +28 -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-IVWI2OCK.mjs → token-goat-chunk-7F2UBPD3.mjs} +40 -11
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7IN2MKDS.mjs} +682 -501
- package/dist/token-goat-chunk-7NADEDKJ.mjs +124 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-A3CK6N5Z.mjs} +618 -72
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-AFLYLHDH.mjs} +44 -31
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-APGZXSPS.mjs} +39 -146
- package/dist/{token-goat-chunk-D4ETHJD6.mjs → token-goat-chunk-ARDNEC2U.mjs} +9 -7
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +134 -0
- package/dist/token-goat-chunk-B2RZZCSS.mjs +354 -0
- package/dist/{token-goat-chunk-BGYOZ6DO.mjs → token-goat-chunk-B45VMIIH.mjs} +6 -7
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-C63JQV5K.mjs} +45 -6
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-COBQGL5S.mjs} +2661 -2440
- package/dist/token-goat-chunk-COTXZHTS.mjs +39 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-CYCEYAEO.mjs} +76 -16
- package/dist/token-goat-chunk-CZ3LUXYZ.mjs +4115 -0
- package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-DZX2YDPT.mjs} +2 -1
- 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-RTMVLHWX.mjs → token-goat-chunk-FBNQNSJK.mjs} +2555 -5127
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-FZ3NEW5O.mjs} +33 -19
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/{token-goat-chunk-DNRPXHYH.mjs → token-goat-chunk-GFBSN7BD.mjs} +29 -401
- package/dist/{token-goat-chunk-XYWPOSCN.mjs → token-goat-chunk-GOLEOXZP.mjs} +763 -211
- 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-HUYUHODZ.mjs → token-goat-chunk-HOJLCGDP.mjs} +12965 -11748
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-HYBFA5X3.mjs} +118 -19
- package/dist/token-goat-chunk-IVALLT3S.mjs +48 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-IVKIZWAB.mjs} +3 -3
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-JB6QN6VF.mjs} +6 -4
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-JDHE26RP.mjs} +10 -3
- package/dist/{token-goat-chunk-FTP4U4QA.mjs → token-goat-chunk-JDU3EXSU.mjs} +12 -11
- package/dist/token-goat-chunk-JDWCRD6M.mjs +253 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-JN4XMLSD.mjs} +5 -1
- 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-2WOUYWLM.mjs → token-goat-chunk-KWPNJBDH.mjs} +27 -3
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-LOBGHXPB.mjs} +30 -8
- package/dist/token-goat-chunk-MKPF4CL5.mjs +37 -0
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.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-NMBWLRHW.mjs → token-goat-chunk-PU7V3FD6.mjs} +8721 -11104
- package/dist/token-goat-chunk-PY533T7F.mjs +46 -0
- package/dist/token-goat-chunk-Q5VTGRH7.mjs +761 -0
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-QCLDAQTS.mjs} +31 -20
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-QSBRTGM2.mjs} +9 -2
- package/dist/{token-goat-chunk-VZQEWRVH.mjs → token-goat-chunk-RC35RBUL.mjs} +4 -4
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-RHXKCZX3.mjs} +873 -504
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-RZRTDST7.mjs} +17 -7
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-SJHWVNDQ.mjs} +15 -21
- package/dist/token-goat-chunk-SMVRN2HU.mjs +188 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-SQSSNQPE.mjs} +2295 -1718
- package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-T4FK7VOV.mjs} +2 -2
- package/dist/token-goat-chunk-U4N3BN2W.mjs +92 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-UQ5UK2T7.mjs} +15 -4
- package/dist/token-goat-chunk-USILZ3T3.mjs +53 -0
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-VES7EL7O.mjs} +7 -1
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-VL3YIFHZ.mjs} +389 -14
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-VPBBTSJR.mjs} +356 -129
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-W3QCJS6G.mjs} +10 -2
- package/dist/{token-goat-chunk-LZNBQTDK.mjs → token-goat-chunk-WY3L4DVT.mjs} +11 -7
- package/dist/token-goat-chunk-XKI4SEMX.mjs +66 -0
- package/dist/token-goat-chunk-XU4P6Z24.mjs +133 -0
- package/dist/{token-goat-chunk-H5J3C56Q.mjs → token-goat-chunk-Y776AENC.mjs} +112 -26
- package/dist/token-goat-chunk-YARZFCZS.mjs +359 -0
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-Z44YO3QZ.mjs} +4 -0
- package/dist/token-goat-chunk-Z57YODA2.mjs +35 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-ZCDTCVIS.mjs} +48 -29
- 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-PKRWMHVP.mjs → token-goat-chunk-ZQSJMO2R.mjs} +338 -170
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +46 -30
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +80 -46
- package/docs/install.md +47 -14
- package/docs/security.md +7 -7
- package/package.json +17 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
reconcileProject
|
|
5
|
+
} from "./token-goat-chunk-7BXSNBY5.mjs";
|
|
6
|
+
import {
|
|
7
|
+
MAX_FILES_SCANNED,
|
|
8
|
+
getTrackedFiles,
|
|
9
|
+
walkProject
|
|
10
|
+
} from "./token-goat-chunk-FBNQNSJK.mjs";
|
|
11
|
+
import {
|
|
12
|
+
countSymbols
|
|
13
|
+
} from "./token-goat-chunk-HYBFA5X3.mjs";
|
|
14
|
+
import {
|
|
15
|
+
isDotenvPath
|
|
16
|
+
} from "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
17
|
+
import {
|
|
18
|
+
findProject,
|
|
19
|
+
isUnderSystemTemp,
|
|
20
|
+
loadConfig
|
|
21
|
+
} from "./token-goat-chunk-7IN2MKDS.mjs";
|
|
22
|
+
import {
|
|
23
|
+
envBool
|
|
24
|
+
} from "./token-goat-chunk-IVE6U7KV.mjs";
|
|
25
|
+
import {
|
|
26
|
+
countNoun,
|
|
27
|
+
extractErrorMessage,
|
|
28
|
+
isUnderBlockedRoot,
|
|
29
|
+
runGit
|
|
30
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
31
|
+
import {
|
|
32
|
+
canonicalize,
|
|
33
|
+
foldPath
|
|
34
|
+
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
35
|
+
import {
|
|
36
|
+
normalizePath
|
|
37
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
38
|
+
import {
|
|
39
|
+
globalDbPath
|
|
40
|
+
} from "./token-goat-chunk-VES7EL7O.mjs";
|
|
41
|
+
import {
|
|
42
|
+
init_define_import_meta_env
|
|
43
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
44
|
+
|
|
45
|
+
// src/install_index.ts
|
|
46
|
+
init_define_import_meta_env();
|
|
47
|
+
import * as fs2 from "node:fs";
|
|
48
|
+
|
|
49
|
+
// src/walk_index.ts
|
|
50
|
+
init_define_import_meta_env();
|
|
51
|
+
import * as fs from "node:fs";
|
|
52
|
+
import * as os from "node:os";
|
|
53
|
+
import * as path from "node:path";
|
|
54
|
+
function isWalkExcluded(file) {
|
|
55
|
+
if (isDotenvPath(file)) return true;
|
|
56
|
+
const base = path.basename(file).toLowerCase();
|
|
57
|
+
if (base.endsWith(".d.ts")) return true;
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
function assertWalkableRoot(root) {
|
|
61
|
+
let resolved = path.resolve(root);
|
|
62
|
+
try {
|
|
63
|
+
resolved = fs.realpathSync.native(resolved);
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
const norm = foldPath(normalizePath(resolved));
|
|
67
|
+
const fsRoot = foldPath(normalizePath(path.parse(resolved).root));
|
|
68
|
+
if (norm === fsRoot) {
|
|
69
|
+
throw new Error(`refusing to walk-index a filesystem root: ${resolved}`);
|
|
70
|
+
}
|
|
71
|
+
const home = os.homedir();
|
|
72
|
+
if (home) {
|
|
73
|
+
const normHome = foldPath(normalizePath(path.resolve(home)));
|
|
74
|
+
if (norm === normHome) {
|
|
75
|
+
throw new Error(`refusing to walk-index the home directory: ${resolved}`);
|
|
76
|
+
}
|
|
77
|
+
const boundary = norm.endsWith("/") ? norm : `${norm}/`;
|
|
78
|
+
if (normHome.startsWith(boundary)) {
|
|
79
|
+
throw new Error(`refusing to walk-index '${resolved}' \u2014 it contains the home directory`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
var MAX_FILES_SCANNED_FORCED = 5e5;
|
|
84
|
+
function collectWalkIndexFiles(root, opts = {}) {
|
|
85
|
+
const resolved = path.resolve(root);
|
|
86
|
+
assertWalkableRoot(resolved);
|
|
87
|
+
const force = opts.force === true;
|
|
88
|
+
const ceiling = force ? MAX_FILES_SCANNED_FORCED : MAX_FILES_SCANNED;
|
|
89
|
+
const { files } = walkProject(resolved, { includeEmbeddableDocuments: true, maxFiles: ceiling });
|
|
90
|
+
if (files.length >= ceiling) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`'${resolved}' has too many source files (walk stopped at ${ceiling}; the real total is at least that). ` + (force ? "Even --force-walk will not walk a tree this large \u2014 point at a narrower path." : `Index a git repo, point at a narrower path, or pass --force-walk to raise the cap to ${MAX_FILES_SCANNED_FORCED}.`)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return files.filter((f) => !isWalkExcluded(f));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/install_index.ts
|
|
99
|
+
var INSTALL_INDEX_BUDGET_MS = 1e4;
|
|
100
|
+
var INSTALL_INDEX_ENV = "TOKEN_GOAT_INSTALL_INDEX";
|
|
101
|
+
function isOwnGitToplevel(root) {
|
|
102
|
+
const toplevel = runGit(["rev-parse", "--show-toplevel"], { cwd: root });
|
|
103
|
+
if (toplevel.exitCode !== 0 || toplevel.stdout.trim() === "") return false;
|
|
104
|
+
return foldPath(canonicalize(fs2.realpathSync(toplevel.stdout.trim()))) === foldPath(canonicalize(fs2.realpathSync(root)));
|
|
105
|
+
}
|
|
106
|
+
function queueInstallIndex(cwd, opts = {}) {
|
|
107
|
+
try {
|
|
108
|
+
if (opts.enabled === false || !envBool(INSTALL_INDEX_ENV, true)) return { status: "skipped", reason: "disabled" };
|
|
109
|
+
const project = findProject(cwd);
|
|
110
|
+
if (project === null) return { status: "skipped", reason: "no-project" };
|
|
111
|
+
const root = project.root;
|
|
112
|
+
try {
|
|
113
|
+
assertWalkableRoot(root);
|
|
114
|
+
} catch {
|
|
115
|
+
return { status: "skipped", reason: "broad-root", root };
|
|
116
|
+
}
|
|
117
|
+
if (isUnderSystemTemp(root)) return { status: "skipped", reason: "temp", root };
|
|
118
|
+
if (isUnderBlockedRoot(root, loadConfig().worker.blocked_roots)) return { status: "skipped", reason: "blocked", root };
|
|
119
|
+
if (countSymbols({ rootDir: root }, globalDbPath()) > 0) return { status: "skipped", reason: "indexed", root };
|
|
120
|
+
if (getTrackedFiles(root).length === 0) return { status: "skipped", reason: isOwnGitToplevel(root) ? "untracked" : "not-git", root };
|
|
121
|
+
const result = reconcileProject({ cwd: root, budgetMs: INSTALL_INDEX_BUDGET_MS });
|
|
122
|
+
if (result.enqueued === 0) return { status: "skipped", reason: "nothing-queued", root };
|
|
123
|
+
return { status: "queued", root, files: result.enqueued };
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return { status: "failed", error: extractErrorMessage(e) };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function formatInstallIndexResult(result) {
|
|
129
|
+
if (result.status === "queued") {
|
|
130
|
+
return `Indexing ${result.root} in the background (${countNoun(result.files, "file")} queued); \`token-goat doctor\` shows progress.`;
|
|
131
|
+
}
|
|
132
|
+
if (result.status === "failed") {
|
|
133
|
+
return `Could not queue this project for indexing (${result.error}); run \`token-goat index\` inside it instead.`;
|
|
134
|
+
}
|
|
135
|
+
switch (result.reason) {
|
|
136
|
+
case "no-project":
|
|
137
|
+
return "No project here to index. Run `token-goat index` inside a project, or start a session in one after it has been indexed.";
|
|
138
|
+
case "broad-root":
|
|
139
|
+
return `${result.root ?? "This folder"} is too broad to index automatically (a home or drive root); run \`token-goat index\` inside a specific project.`;
|
|
140
|
+
case "temp":
|
|
141
|
+
return `${result.root ?? "This folder"} is under the system temp directory, so install does not index it automatically; run \`token-goat index\` there to index it.`;
|
|
142
|
+
case "not-git":
|
|
143
|
+
return `${result.root ?? "This folder"} is not a git repository, so it was not indexed. Run \`token-goat index --walk\` inside it to index it anyway.`;
|
|
144
|
+
case "untracked":
|
|
145
|
+
return `${result.root ?? "This folder"} is a git repository with no tracked files yet, so it was not indexed. Run \`token-goat index --walk\` inside it, or \`git add\` the files and run \`token-goat index\`.`;
|
|
146
|
+
case "blocked":
|
|
147
|
+
return `${result.root ?? "This folder"} is excluded by worker.blocked_roots, so it was not indexed.`;
|
|
148
|
+
default:
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export {
|
|
154
|
+
MAX_FILES_SCANNED_FORCED,
|
|
155
|
+
collectWalkIndexFiles,
|
|
156
|
+
INSTALL_INDEX_ENV,
|
|
157
|
+
queueInstallIndex,
|
|
158
|
+
formatInstallIndexResult
|
|
159
|
+
};
|