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