@ngockhoale/ukit 2.4.2 → 2.4.3

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 (43) hide show
  1. package/manifests/platform.full.yaml +19 -111
  2. package/package.json +2 -1
  3. package/scripts/index/refresh-index.mjs +47 -22
  4. package/src/core/compact/threshold.js +36 -6
  5. package/src/diagnostics/classifyHang.js +246 -0
  6. package/src/index/buildIndex.js +1033 -62
  7. package/templates/.claude/hooks/auto-allow-bash.sh +82 -93
  8. package/templates/.claude/hooks/block-dangerous.sh +31 -5
  9. package/templates/.claude/hooks/completion-gate.sh +51 -10
  10. package/templates/.claude/hooks/compress-output.sh +38 -6
  11. package/templates/.claude/hooks/context-hardcap-gate.sh +35 -6
  12. package/templates/.claude/hooks/context-window-guard.sh +128 -18
  13. package/templates/.claude/hooks/handoff-model-guard.sh +31 -5
  14. package/templates/.claude/hooks/handoff-resume.sh +31 -5
  15. package/templates/.claude/hooks/post-edit-verify.sh +31 -5
  16. package/templates/.claude/hooks/pre-edit-backup.sh +31 -5
  17. package/templates/.claude/hooks/protect-files.sh +31 -5
  18. package/templates/.claude/hooks/record-execution.sh +31 -5
  19. package/templates/.claude/hooks/sensitive-data-guard.sh +44 -8
  20. package/templates/.claude/hooks/skill-router.sh +31 -5
  21. package/templates/.claude/hooks/stale-spec-guard.sh +31 -5
  22. package/templates/.claude/hooks/task-watchdog.sh +108 -123
  23. package/templates/.claude/hooks/verification-guard.sh +107 -112
  24. package/templates/.claude/hooks/vision-router.sh +49 -13
  25. package/templates/.claude/settings.json +0 -5
  26. package/templates/.claude/ukit/index/lib/index-core.mjs +960 -63
  27. package/templates/.claude/ukit/index/refresh-index.mjs +47 -22
  28. package/templates/.claude/ukit/index/route-task.mjs +610 -4
  29. package/templates/.claude/ukit/runtime/async-lock.mjs +340 -0
  30. package/templates/.claude/ukit/runtime/compact-threshold.mjs +73 -24
  31. package/templates/.claude/ukit/runtime/context-capacity.mjs +144 -0
  32. package/templates/.claude/ukit/runtime/execution-ledger.mjs +664 -170
  33. package/templates/.claude/ukit/runtime/hook-chain-budget.mjs +92 -0
  34. package/templates/.claude/ukit/runtime/hook-chain-runner.mjs +84 -29
  35. package/templates/.claude/ukit/runtime/hook-input.sh +85 -5
  36. package/templates/.claude/ukit/runtime/hook-payload-store.mjs +160 -0
  37. package/templates/.claude/ukit/runtime/hook-process.mjs +250 -0
  38. package/templates/.claude/ukit/runtime/hook-telemetry.mjs +255 -0
  39. package/templates/.claude/ukit/runtime/hook-telemetry.sh +60 -0
  40. package/templates/.claude/ukit/runtime/stop-coordinator.mjs +509 -0
  41. package/templates/.claude/ukit/runtime/task-watchdog.mjs +180 -6
  42. package/templates/.claude/ukit/runtime/transcript-tail.mjs +1 -1
  43. package/templates/.omp/hooks/pre/ukit-bridge.js +171 -57
@@ -14,39 +14,64 @@ const changedFiles = changedArg ? changedArg.split(',').map((x) => x.trim()).fil
14
14
  const force = args.includes('--force');
15
15
 
16
16
  const lastRefreshMs = await getIndexArtifactGeneratedAt({ rootDir });
17
- const staleness = force
18
- ? null
19
- : await inspectIndexStaleness({ rootDir, maxAgeMs: DEFAULT_INDEX_CACHE_MAX_AGE_MS, generatedAtMs: lastRefreshMs });
20
- const stale = force || staleness.stale;
21
17
 
22
- if (!stale) {
23
- console.log('[ukit:index:refresh] skipped (cache fresh)');
24
- if (lastRefreshMs !== null) {
25
- console.log(`lastRefresh: ${new Date(lastRefreshMs).toISOString()}`);
26
- }
27
- if (changedFiles.length > 0) {
28
- console.log(`changed-files-hint: ${changedFiles.join(', ')}`);
29
- }
30
- console.log(`root: ${rootDir}`);
31
- } else {
32
- // Reuse the staleness check's discovery snapshot: one enumeration per refresh.
33
- const summary = await buildCodeIndex({
34
- rootDir,
35
- discoverySnapshot: staleness ? staleness.snapshot : null,
36
- });
18
+ if (changedFiles.length > 0 && !force) {
19
+ // Hints carry the change set, so no staleness enumeration is needed:
20
+ // buildCodeIndex merges the hinted paths into the existing artifacts and
21
+ // falls back to the bounded full discovery path on its own when the hints
22
+ // are unsafe or the previous artifacts cannot be merged (TASK-023).
23
+ const summary = await buildCodeIndex({ rootDir, changedFiles });
37
24
 
38
25
  console.log('[ukit:index:refresh] completed');
26
+ console.log(`mode: ${summary.mode}`);
39
27
  if (lastRefreshMs !== null) {
40
28
  console.log(`lastRefreshBefore: ${new Date(lastRefreshMs).toISOString()}`);
41
29
  }
42
- if (changedFiles.length > 0) {
43
- console.log(`changed-files-hint: ${changedFiles.join(', ')}`);
44
- }
30
+ console.log(`changed-files-hint: ${changedFiles.join(', ')}`);
45
31
  console.log(`root: ${rootDir}`);
46
32
  console.log(`files: ${summary.fileCount}`);
47
33
  console.log(`parsed: ${summary.parsedCodeFileCount}`);
48
34
  console.log(`reused: ${summary.reusedCodeFileCount}`);
35
+ if (summary.removedFiles.length > 0) {
36
+ console.log(`removed: ${summary.removedFiles.length}`);
37
+ }
49
38
  console.log(`indexDir: ${summary.indexDir}`);
39
+ } else {
40
+ const staleness = force
41
+ ? null
42
+ : await inspectIndexStaleness({ rootDir, maxAgeMs: DEFAULT_INDEX_CACHE_MAX_AGE_MS, generatedAtMs: lastRefreshMs });
43
+ const stale = force || staleness.stale;
44
+
45
+ if (!stale) {
46
+ console.log('[ukit:index:refresh] skipped (cache fresh)');
47
+ if (lastRefreshMs !== null) {
48
+ console.log(`lastRefresh: ${new Date(lastRefreshMs).toISOString()}`);
49
+ }
50
+ if (changedFiles.length > 0) {
51
+ console.log(`changed-files-hint: ${changedFiles.join(', ')}`);
52
+ }
53
+ console.log(`root: ${rootDir}`);
54
+ } else {
55
+ // Reuse the staleness check's discovery snapshot: one enumeration per refresh.
56
+ const summary = await buildCodeIndex({
57
+ rootDir,
58
+ discoverySnapshot: staleness ? staleness.snapshot : null,
59
+ });
60
+
61
+ console.log('[ukit:index:refresh] completed');
62
+ console.log(`mode: ${summary.mode}`);
63
+ if (lastRefreshMs !== null) {
64
+ console.log(`lastRefreshBefore: ${new Date(lastRefreshMs).toISOString()}`);
65
+ }
66
+ if (changedFiles.length > 0) {
67
+ console.log(`changed-files-hint: ${changedFiles.join(', ')}`);
68
+ }
69
+ console.log(`root: ${rootDir}`);
70
+ console.log(`files: ${summary.fileCount}`);
71
+ console.log(`parsed: ${summary.parsedCodeFileCount}`);
72
+ console.log(`reused: ${summary.reusedCodeFileCount}`);
73
+ console.log(`indexDir: ${summary.indexDir}`);
74
+ }
50
75
  }
51
76
 
52
77
  function getRootDir(argv) {