@haystackeditor/cli 0.25.1 → 0.26.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 (97) hide show
  1. package/README.md +39 -455
  2. package/dist/capture/app-config.js +25 -1
  3. package/dist/commands/capture-brief.js +41 -32
  4. package/dist/commands/feedback.js +66 -0
  5. package/dist/commands/init-telemetry.js +53 -7
  6. package/dist/commands/init.js +7 -2
  7. package/dist/commands/lockfile-pin.js +307 -0
  8. package/dist/commands/verify.js +68 -13
  9. package/dist/index.js +27 -923
  10. package/dist/schema.js +4 -10
  11. package/dist/utils/haystack-api.js +0 -36
  12. package/package.json +1 -5
  13. package/schemas/feedback.v1.json +13 -0
  14. package/schemas/pre-verify.v2.json +240 -0
  15. package/schemas/verify-raw.v1.json +1132 -0
  16. package/schemas/verify.v2.json +655 -0
  17. package/dist/assets/hooks/agent-context/detect.ts +0 -316
  18. package/dist/assets/hooks/agent-context/format.ts +0 -100
  19. package/dist/assets/hooks/agent-context/index.ts +0 -41
  20. package/dist/assets/hooks/agent-context/parsers/claude.ts +0 -262
  21. package/dist/assets/hooks/agent-context/parsers/codex.ts +0 -416
  22. package/dist/assets/hooks/agent-context/parsers/gemini.ts +0 -155
  23. package/dist/assets/hooks/agent-context/parsers/opencode.ts +0 -174
  24. package/dist/assets/hooks/agent-context/tsconfig.json +0 -14
  25. package/dist/assets/hooks/agent-context/types.ts +0 -58
  26. package/dist/assets/hooks/llm-rules-template.md +0 -59
  27. package/dist/assets/hooks/package-lock.json +0 -598
  28. package/dist/assets/hooks/package.json +0 -12
  29. package/dist/assets/hooks/scripts/commit-msg.sh +0 -5
  30. package/dist/assets/hooks/scripts/post-commit.sh +0 -5
  31. package/dist/assets/hooks/scripts/pre-commit.sh +0 -175
  32. package/dist/assets/hooks/scripts/pre-push.sh +0 -25
  33. package/dist/assets/hooks/scripts/prepare-commit-msg.sh +0 -5
  34. package/dist/assets/hooks/truncation-checker/ast-analyzer.ts +0 -528
  35. package/dist/assets/hooks/truncation-checker/index.ts +0 -595
  36. package/dist/assets/hooks/truncation-checker/tsconfig.json +0 -13
  37. package/dist/assets/skills/map-cloud-verifier-universe/SKILL.md +0 -2051
  38. package/dist/assets/skills/map-cloud-verifier-universe/agents/openai.yaml +0 -4
  39. package/dist/assets/skills/map-cloud-verifier-universe/references/output-contract.md +0 -3411
  40. package/dist/assets/skills/map-your-system.md +0 -143
  41. package/dist/assets/skills/submit.md +0 -200
  42. package/dist/commands/ask.js +0 -20
  43. package/dist/commands/cloud-verifier-behaviors.js +0 -218
  44. package/dist/commands/cloud-verifier-data-store-census.js +0 -539
  45. package/dist/commands/cloud-verifier-data-store-drift.js +0 -158
  46. package/dist/commands/cloud-verifier-identity-census.js +0 -4060
  47. package/dist/commands/cloud-verifier-materialization.js +0 -704
  48. package/dist/commands/cloud-verifier-pascal-selector-census.js +0 -1382
  49. package/dist/commands/cloud-verifier-python-manifest-selector-census.js +0 -2015
  50. package/dist/commands/cloud-verifier-specialized-operational-census.js +0 -11432
  51. package/dist/commands/cloud-verifier-universe.js +0 -10178
  52. package/dist/commands/config.js +0 -549
  53. package/dist/commands/design-verify.js +0 -311
  54. package/dist/commands/dismiss.js +0 -159
  55. package/dist/commands/hooks.js +0 -226
  56. package/dist/commands/inbox.js +0 -137
  57. package/dist/commands/mcp.js +0 -201
  58. package/dist/commands/policy.js +0 -371
  59. package/dist/commands/pr-status.js +0 -207
  60. package/dist/commands/pr.js +0 -105
  61. package/dist/commands/prepare-universe-review.js +0 -1092
  62. package/dist/commands/production-source-deny-policy.js +0 -100
  63. package/dist/commands/request-review.js +0 -74
  64. package/dist/commands/review.js +0 -191
  65. package/dist/commands/rules.js +0 -98
  66. package/dist/commands/scaffold-provisional-universe.js +0 -806
  67. package/dist/commands/setup.js +0 -1170
  68. package/dist/commands/skills.js +0 -447
  69. package/dist/commands/submit.js +0 -745
  70. package/dist/commands/system-map.js +0 -228
  71. package/dist/commands/triage.js +0 -598
  72. package/dist/commands/webhooks.js +0 -241
  73. package/dist/states.js +0 -46
  74. package/dist/tools/detect.js +0 -832
  75. package/dist/triage/astra.js +0 -202
  76. package/dist/triage/prompts.js +0 -188
  77. package/dist/triage/runner.js +0 -200
  78. package/dist/triage/types.js +0 -7
  79. package/dist/utils/action-output.js +0 -26
  80. package/dist/utils/analysis-api.js +0 -416
  81. package/dist/utils/design-verifier-api.js +0 -294
  82. package/dist/utils/design-verifier-history.js +0 -79
  83. package/dist/utils/design-verifier-result.js +0 -424
  84. package/dist/utils/github-api.js +0 -324
  85. package/dist/utils/pending-state.js +0 -86
  86. package/dist/utils/pr-ref.js +0 -56
  87. package/dist/utils/prompter.js +0 -328
  88. package/schemas/action.v1.json +0 -22
  89. package/schemas/ask.v1.json +0 -40
  90. package/schemas/inbox.v1.json +0 -27
  91. package/schemas/pr-status.v1.json +0 -61
  92. package/schemas/pr.v1.json +0 -97
  93. package/schemas/pr.v3.json +0 -45
  94. package/schemas/setup.v1.json +0 -75
  95. package/schemas/submit.v1.json +0 -90
  96. package/schemas/triage.v1.json +0 -103
  97. 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
- }