@haystackeditor/cli 0.25.1 → 0.27.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.
Files changed (109) hide show
  1. package/README.md +39 -463
  2. package/dist/capture/app-config.js +30 -6
  3. package/dist/commands/capture-brief.js +45 -35
  4. package/dist/commands/capture-contract.js +4 -4
  5. package/dist/commands/crawl-report.js +196 -0
  6. package/dist/commands/db-profile-upload.js +3 -3
  7. package/dist/commands/feedback.js +66 -0
  8. package/dist/commands/init-telemetry.js +55 -9
  9. package/dist/commands/init.js +8 -3
  10. package/dist/commands/lockfile-pin.js +307 -0
  11. package/dist/commands/telemetry-token.js +3 -3
  12. package/dist/commands/tokens.js +4 -4
  13. package/dist/commands/verify-explore.js +3 -3
  14. package/dist/commands/verify-history.js +2 -2
  15. package/dist/commands/verify-onboarding.js +13 -16
  16. package/dist/commands/verify-precompute.js +3 -4
  17. package/dist/commands/verify.js +31 -118
  18. package/dist/index.js +55 -968
  19. package/dist/schema.js +4 -10
  20. package/dist/utils/haystack-api.js +8 -36
  21. package/package.json +1 -5
  22. package/schemas/feedback.v1.json +13 -0
  23. package/schemas/pre-verify.v2.json +240 -0
  24. package/schemas/verify-raw.v1.json +1132 -0
  25. package/schemas/verify.v2.json +655 -0
  26. package/dist/assets/hooks/agent-context/detect.ts +0 -316
  27. package/dist/assets/hooks/agent-context/format.ts +0 -100
  28. package/dist/assets/hooks/agent-context/index.ts +0 -41
  29. package/dist/assets/hooks/agent-context/parsers/claude.ts +0 -262
  30. package/dist/assets/hooks/agent-context/parsers/codex.ts +0 -416
  31. package/dist/assets/hooks/agent-context/parsers/gemini.ts +0 -155
  32. package/dist/assets/hooks/agent-context/parsers/opencode.ts +0 -174
  33. package/dist/assets/hooks/agent-context/tsconfig.json +0 -14
  34. package/dist/assets/hooks/agent-context/types.ts +0 -58
  35. package/dist/assets/hooks/llm-rules-template.md +0 -59
  36. package/dist/assets/hooks/package-lock.json +0 -598
  37. package/dist/assets/hooks/package.json +0 -12
  38. package/dist/assets/hooks/scripts/commit-msg.sh +0 -5
  39. package/dist/assets/hooks/scripts/post-commit.sh +0 -5
  40. package/dist/assets/hooks/scripts/pre-commit.sh +0 -175
  41. package/dist/assets/hooks/scripts/pre-push.sh +0 -25
  42. package/dist/assets/hooks/scripts/prepare-commit-msg.sh +0 -5
  43. package/dist/assets/hooks/truncation-checker/ast-analyzer.ts +0 -528
  44. package/dist/assets/hooks/truncation-checker/index.ts +0 -595
  45. package/dist/assets/hooks/truncation-checker/tsconfig.json +0 -13
  46. package/dist/assets/skills/map-cloud-verifier-universe/SKILL.md +0 -2051
  47. package/dist/assets/skills/map-cloud-verifier-universe/agents/openai.yaml +0 -4
  48. package/dist/assets/skills/map-cloud-verifier-universe/references/output-contract.md +0 -3411
  49. package/dist/assets/skills/map-your-system.md +0 -143
  50. package/dist/assets/skills/submit.md +0 -200
  51. package/dist/commands/ask.js +0 -20
  52. package/dist/commands/cloud-verifier-behaviors.js +0 -218
  53. package/dist/commands/cloud-verifier-data-store-census.js +0 -539
  54. package/dist/commands/cloud-verifier-data-store-drift.js +0 -158
  55. package/dist/commands/cloud-verifier-identity-census.js +0 -4060
  56. package/dist/commands/cloud-verifier-materialization.js +0 -704
  57. package/dist/commands/cloud-verifier-pascal-selector-census.js +0 -1382
  58. package/dist/commands/cloud-verifier-python-manifest-selector-census.js +0 -2015
  59. package/dist/commands/cloud-verifier-specialized-operational-census.js +0 -11432
  60. package/dist/commands/cloud-verifier-universe.js +0 -10178
  61. package/dist/commands/config.js +0 -549
  62. package/dist/commands/design-verify.js +0 -311
  63. package/dist/commands/dismiss.js +0 -159
  64. package/dist/commands/hooks.js +0 -226
  65. package/dist/commands/inbox.js +0 -137
  66. package/dist/commands/mcp.js +0 -201
  67. package/dist/commands/policy.js +0 -371
  68. package/dist/commands/pr-status.js +0 -207
  69. package/dist/commands/pr.js +0 -105
  70. package/dist/commands/prepare-universe-review.js +0 -1092
  71. package/dist/commands/production-source-deny-policy.js +0 -100
  72. package/dist/commands/request-review.js +0 -74
  73. package/dist/commands/review.js +0 -191
  74. package/dist/commands/rules.js +0 -98
  75. package/dist/commands/scaffold-provisional-universe.js +0 -806
  76. package/dist/commands/setup.js +0 -1170
  77. package/dist/commands/skills.js +0 -447
  78. package/dist/commands/status.js +0 -35
  79. package/dist/commands/submit.js +0 -745
  80. package/dist/commands/system-map.js +0 -228
  81. package/dist/commands/triage.js +0 -598
  82. package/dist/commands/webhooks.js +0 -241
  83. package/dist/states.js +0 -46
  84. package/dist/tools/detect.js +0 -832
  85. package/dist/triage/astra.js +0 -202
  86. package/dist/triage/prompts.js +0 -188
  87. package/dist/triage/runner.js +0 -200
  88. package/dist/triage/types.js +0 -7
  89. package/dist/types.js +0 -326
  90. package/dist/utils/action-output.js +0 -26
  91. package/dist/utils/analysis-api.js +0 -416
  92. package/dist/utils/config.js +0 -54
  93. package/dist/utils/design-verifier-api.js +0 -294
  94. package/dist/utils/design-verifier-history.js +0 -79
  95. package/dist/utils/design-verifier-result.js +0 -424
  96. package/dist/utils/github-api.js +0 -324
  97. package/dist/utils/pending-state.js +0 -86
  98. package/dist/utils/pr-ref.js +0 -56
  99. package/dist/utils/prompter.js +0 -328
  100. package/schemas/action.v1.json +0 -22
  101. package/schemas/ask.v1.json +0 -40
  102. package/schemas/inbox.v1.json +0 -27
  103. package/schemas/pr-status.v1.json +0 -61
  104. package/schemas/pr.v1.json +0 -97
  105. package/schemas/pr.v3.json +0 -45
  106. package/schemas/setup.v1.json +0 -75
  107. package/schemas/submit.v1.json +0 -90
  108. package/schemas/triage.v1.json +0 -103
  109. package/schemas/triage.v2.json +0 -64
@@ -1,158 +0,0 @@
1
- /**
2
- * Data-store drift check.
3
- *
4
- * A checked-in universe map lists the stores the Cloud Verifier clones. As the
5
- * app changes, that map silently goes stale — a new Redis nobody added to the
6
- * map, or a Mongo the code dropped — and a stale map makes the verifier clone
7
- * the wrong things. The static detector is a pure function of the repo, so the
8
- * only moment repo-derived drift can enter is a change to a file the detector
9
- * reads. This command catches that at the source: re-detect the stores, diff
10
- * against the checked-in baseline, and flag the delta.
11
- *
12
- * It is built to run per-PR and cost almost nothing: given a base ref, it first
13
- * checks whether the diff touches any file the detector reads (the exact gate —
14
- * nothing else can change the result) and exits immediately if not.
15
- */
16
- import { execFileSync } from 'node:child_process';
17
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
18
- import { basename, dirname, resolve } from 'node:path';
19
- import { findGitRoot } from '../utils/hooks.js';
20
- import { collectDataStores, isDataStoreInputName } from './cloud-verifier-identity-census.js';
21
- export const DATA_STORE_BASELINE_PATH = '.haystack/cloud-verifier/data-stores.json';
22
- export const DATA_STORE_BASELINE_SCHEMA = 'cloud-verifier-data-stores-v1';
23
- function snapshot(store) {
24
- return {
25
- engine: store.engine,
26
- category: store.category,
27
- confidence: store.confidence,
28
- clone_strategy: store.clone_strategy,
29
- };
30
- }
31
- /** Diff two store lists by engine. Pure and order-independent. */
32
- export function diffDataStores(baseline, current) {
33
- const baseByEngine = new Map(baseline.map((store) => [store.engine, store]));
34
- const currentByEngine = new Map(current.map((store) => [store.engine, store]));
35
- const added = current.filter((store) => !baseByEngine.has(store.engine));
36
- const removed = baseline.filter((store) => !currentByEngine.has(store.engine));
37
- const changed = [];
38
- for (const store of current) {
39
- const before = baseByEngine.get(store.engine);
40
- if (before && (before.confidence !== store.confidence || before.category !== store.category)) {
41
- changed.push({
42
- engine: store.engine,
43
- from: `${before.category}/${before.confidence}`,
44
- to: `${store.category}/${store.confidence}`,
45
- });
46
- }
47
- }
48
- return { added, removed, changed };
49
- }
50
- export function hasDrift(drift) {
51
- return drift.added.length > 0 || drift.removed.length > 0 || drift.changed.length > 0;
52
- }
53
- function gitTrackedFiles(root) {
54
- return execFileSync('git', ['-C', root, 'ls-files', '-z'], { encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 })
55
- .split('\0')
56
- .filter(Boolean);
57
- }
58
- // Files changed between a base ref and HEAD. Returns null if git cannot resolve
59
- // the ref (e.g. a shallow clone missing the base) so the caller can fall back to
60
- // a full check rather than a false "no store changes" skip.
61
- function changedFiles(root, baseRef) {
62
- try {
63
- const range = `${baseRef}...HEAD`;
64
- // --no-renames so a rename shows both the removed and added path. Otherwise
65
- // renaming an input file to a non-input name (docker-compose.yml -> .bak)
66
- // would report only the irrelevant destination and the gate would wrongly
67
- // skip a change that actually dropped a store.
68
- return execFileSync('git', ['-C', root, 'diff', '--name-only', '--no-renames', range], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 })
69
- .split('\n')
70
- .filter(Boolean);
71
- }
72
- catch {
73
- return null;
74
- }
75
- }
76
- function currentStores(root) {
77
- return collectDataStores(root, gitTrackedFiles(root)).map(snapshot);
78
- }
79
- function readBaseline(path) {
80
- const parsed = JSON.parse(readFileSync(path, 'utf8'));
81
- if (parsed.schema !== DATA_STORE_BASELINE_SCHEMA || !Array.isArray(parsed.stores)) {
82
- throw new Error(`Not a data-store baseline (${DATA_STORE_BASELINE_SCHEMA}): ${path}`);
83
- }
84
- return parsed.stores;
85
- }
86
- function writeBaseline(path, stores) {
87
- mkdirSync(dirname(path), { recursive: true });
88
- writeFileSync(path, `${JSON.stringify({ schema: DATA_STORE_BASELINE_SCHEMA, stores }, null, 2)}\n`);
89
- }
90
- function emit(payload, json) {
91
- if (json) {
92
- process.stdout.write(`${JSON.stringify({ schema: 'cloud-verifier-data-store-drift-v1', ...payload }, null, 2)}\n`);
93
- }
94
- }
95
- export function cloudVerifierDataStoreDriftCommand(options) {
96
- const root = options.root ? resolve(options.root) : (findGitRoot() ?? process.cwd());
97
- // resolve (not join) so an absolute --baseline is honored as-is and a relative
98
- // one resolves against the repo root.
99
- const baselinePath = resolve(root, options.baseline ?? DATA_STORE_BASELINE_PATH);
100
- // Path gate: with a base ref, skip unless the diff touches a file the detector
101
- // reads. This is exact — a file outside that set cannot change the stores.
102
- if (options.baseRef && !options.update) {
103
- const changed = changedFiles(root, options.baseRef);
104
- if (changed !== null) {
105
- const relevant = changed.filter((path) => isDataStoreInputName(basename(path).toLowerCase()));
106
- if (relevant.length === 0) {
107
- emit({ status: 'skipped', reason: 'no-store-relevant-changes', changed_files: changed.length }, options.json ?? false);
108
- if (!options.json) {
109
- process.stdout.write('Data-store drift: no store-relevant files changed — skipped.\n');
110
- }
111
- return;
112
- }
113
- }
114
- }
115
- const current = currentStores(root);
116
- if (options.update) {
117
- writeBaseline(baselinePath, current);
118
- emit({ status: 'updated', baseline: options.baseline ?? DATA_STORE_BASELINE_PATH, stores: current }, options.json ?? false);
119
- if (!options.json) {
120
- process.stdout.write(`Data-store baseline written: ${current.length} stores → ${options.baseline ?? DATA_STORE_BASELINE_PATH}\n`);
121
- }
122
- return;
123
- }
124
- if (!existsSync(baselinePath)) {
125
- // Not opted in yet: a safe no-op so the check can be added to CI broadly
126
- // without breaking repos that have not created a baseline.
127
- emit({ status: 'no-baseline', baseline: options.baseline ?? DATA_STORE_BASELINE_PATH }, options.json ?? false);
128
- if (!options.json) {
129
- process.stdout.write(`Data-store drift: no baseline at ${options.baseline ?? DATA_STORE_BASELINE_PATH}. `
130
- + 'Create one with `--update`.\n');
131
- }
132
- return;
133
- }
134
- const drift = diffDataStores(readBaseline(baselinePath), current);
135
- if (!hasDrift(drift)) {
136
- emit({ status: 'ok', stores: current.length }, options.json ?? false);
137
- if (!options.json) {
138
- process.stdout.write(`Data-store drift: none — map matches ${current.length} detected stores.\n`);
139
- }
140
- return;
141
- }
142
- emit({ status: 'drift', drift }, options.json ?? false);
143
- if (!options.json) {
144
- process.stdout.write('Data-store drift detected — the universe map is out of date:\n');
145
- for (const store of drift.added) {
146
- process.stdout.write(` + ${store.engine} (${store.category}, ${store.confidence}) — detected, not in the map\n`);
147
- }
148
- for (const store of drift.removed) {
149
- process.stdout.write(` - ${store.engine} (${store.category}) — in the map, no longer detected\n`);
150
- }
151
- for (const change of drift.changed) {
152
- process.stdout.write(` ~ ${change.engine}: ${change.from} → ${change.to}\n`);
153
- }
154
- process.stdout.write('Sync the map with `--update`, or update the universe map to match.\n');
155
- }
156
- // Non-zero exit so a CI gate fails until the map is reconciled.
157
- process.exitCode = 1;
158
- }