@gramatr/client 0.5.1 → 0.5.2
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/bin/install.ts +42 -8
- package/package.json +1 -1
package/bin/install.ts
CHANGED
|
@@ -284,19 +284,43 @@ function installClientFiles(): void {
|
|
|
284
284
|
copyFileIfExists(join(SCRIPT_DIR, 'bin/render-claude-hooks.ts'), join(CLIENT_DIR, 'bin/render-claude-hooks.ts'), true);
|
|
285
285
|
|
|
286
286
|
// Bin lib helpers (statusline shim depends on these — see #495)
|
|
287
|
-
//
|
|
287
|
+
// Walks the directory but filters out test files / __tests__ subdir so
|
|
288
|
+
// we don't ship .test.ts to user installs.
|
|
288
289
|
const binLibSrc = join(SCRIPT_DIR, 'bin', 'lib');
|
|
289
290
|
if (existsSync(binLibSrc)) {
|
|
290
|
-
|
|
291
|
-
|
|
291
|
+
mkdirSync(join(CLIENT_DIR, 'bin', 'lib'), { recursive: true });
|
|
292
|
+
let binLibCount = 0;
|
|
293
|
+
for (const f of readdirSync(binLibSrc)) {
|
|
294
|
+
const src = join(binLibSrc, f);
|
|
295
|
+
if (!statSync(src).isFile()) continue;
|
|
296
|
+
if (!f.endsWith('.ts')) continue;
|
|
297
|
+
if (f.endsWith('.test.ts')) continue;
|
|
298
|
+
copyFileIfExists(src, join(CLIENT_DIR, 'bin', 'lib', f));
|
|
299
|
+
binLibCount++;
|
|
300
|
+
}
|
|
301
|
+
log(`OK Installed bin/lib (${binLibCount} statusline shim helpers)`);
|
|
292
302
|
}
|
|
293
303
|
log('OK Installed bin (statusline, gmtr-login, render-claude-hooks)');
|
|
294
304
|
|
|
295
|
-
// Core dependencies
|
|
296
|
-
|
|
297
|
-
|
|
305
|
+
// Core dependencies — directory walk so new hook deps don't silently break.
|
|
306
|
+
// Hook imports include: routing.ts (enricher), session.ts (session-start),
|
|
307
|
+
// version-check.ts (session-start), version.ts (session-start), types.ts (transitive).
|
|
308
|
+
// Past bugs (#495 bin/lib, this same class repeated): hardcoded file lists drift
|
|
309
|
+
// when a hook grows a new core import. Walking the directory + filtering tests
|
|
310
|
+
// makes the installer self-healing.
|
|
311
|
+
const coreSrc = join(SCRIPT_DIR, 'core');
|
|
312
|
+
if (existsSync(coreSrc)) {
|
|
313
|
+
let coreCount = 0;
|
|
314
|
+
for (const f of readdirSync(coreSrc)) {
|
|
315
|
+
const src = join(coreSrc, f);
|
|
316
|
+
if (!statSync(src).isFile()) continue;
|
|
317
|
+
if (!f.endsWith('.ts')) continue;
|
|
318
|
+
if (f.endsWith('.test.ts')) continue;
|
|
319
|
+
copyFileIfExists(src, join(CLIENT_DIR, 'core', f));
|
|
320
|
+
coreCount++;
|
|
321
|
+
}
|
|
322
|
+
log(`OK Installed ${coreCount} core modules`);
|
|
298
323
|
}
|
|
299
|
-
log('OK Installed core modules');
|
|
300
324
|
|
|
301
325
|
// package.json — copied so core/version.ts can resolve the installed
|
|
302
326
|
// version at runtime. Single source of truth; see core/version.ts.
|
|
@@ -594,7 +618,11 @@ function verify(url: string, token: string): boolean {
|
|
|
594
618
|
}
|
|
595
619
|
};
|
|
596
620
|
|
|
597
|
-
// Critical files
|
|
621
|
+
// Critical files — every runtime hook + bin import target must be present.
|
|
622
|
+
// If you add a new ../core/X.ts or ./lib/X.ts import in hooks/ or bin/, add the
|
|
623
|
+
// corresponding entry here so a partial install fails loudly instead of
|
|
624
|
+
// exploding at hook execution time. The hook-imports-shipped.test.ts
|
|
625
|
+
// regression guard catches missing entries at PR review.
|
|
598
626
|
for (const f of [
|
|
599
627
|
'hooks/GMTRToolTracker.hook.ts',
|
|
600
628
|
'hooks/GMTRPromptEnricher.hook.ts',
|
|
@@ -602,8 +630,14 @@ function verify(url: string, token: string): boolean {
|
|
|
602
630
|
'hooks/GMTRSecurityValidator.hook.ts',
|
|
603
631
|
'hooks/lib/notify.ts',
|
|
604
632
|
'core/routing.ts',
|
|
633
|
+
'core/session.ts',
|
|
634
|
+
'core/version.ts',
|
|
635
|
+
'core/version-check.ts',
|
|
636
|
+
'core/types.ts',
|
|
637
|
+
'core/install.ts',
|
|
605
638
|
'bin/statusline.ts',
|
|
606
639
|
'bin/gmtr-login.ts',
|
|
640
|
+
'bin/render-claude-hooks.ts',
|
|
607
641
|
'bin/lib/git.ts',
|
|
608
642
|
'bin/lib/config.ts',
|
|
609
643
|
'bin/lib/stdin.ts',
|