@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
package/dist/types.js DELETED
@@ -1,326 +0,0 @@
1
- /**
2
- * Haystack CLI Types
3
- *
4
- * Zod schemas for .haystack.json configuration + CLI-only types.
5
- * Zod schemas for .haystack.json configuration.
6
- */
7
- import { z } from 'zod';
8
- // =============================================================================
9
- // VERIFICATION COMMANDS
10
- // =============================================================================
11
- const VerificationCommandSchema = z.object({
12
- /** Human-readable name (e.g., "Build", "Lint", "Typecheck") */
13
- name: z.string(),
14
- /** The shell command to run (e.g., "pnpm build", "pnpm lint") */
15
- run: z.string(),
16
- });
17
- // =============================================================================
18
- // FIXTURE SOURCES
19
- // =============================================================================
20
- const FixtureEntrySchema = z.object({
21
- /** Where to load fixture data from */
22
- source: z.string().refine((val) => val === 'passthrough' ||
23
- val.startsWith('file://') ||
24
- val.startsWith('https://') ||
25
- val.startsWith('http://') ||
26
- val.startsWith('s3://') ||
27
- val.startsWith('r2://') ||
28
- val.startsWith('script://'), {
29
- message: 'Source must be passthrough, or start with file://, https://, http://, s3://, r2://, or script://',
30
- }),
31
- /** Headers to include when fetching from remote source */
32
- headers: z.record(z.string(), z.string()).optional(),
33
- /** Cookies to include when fetching from remote source */
34
- cookies: z.string().optional(),
35
- });
36
- // =============================================================================
37
- // DEV SERVER
38
- // =============================================================================
39
- const DevServerSchema = z.object({
40
- /** Command to start dev server (e.g., "pnpm dev") */
41
- command: z.string(),
42
- /** Port the dev server runs on */
43
- port: z.number(),
44
- /** Pattern in stdout that indicates server is ready (e.g., "Local:") */
45
- ready_pattern: z.string().optional(),
46
- /** Environment variables to set when starting the server */
47
- env: z.record(z.string(), z.string()).optional(),
48
- });
49
- // =============================================================================
50
- // BABYSITTER CONFIGURATION
51
- // =============================================================================
52
- /** Valid AI reviewer source identifiers that the merge queue can wait for */
53
- export const AI_REVIEWER_SOURCES = [
54
- 'cursor',
55
- 'coderabbit',
56
- 'copilot',
57
- 'greptile',
58
- 'sourcery',
59
- 'qodo',
60
- 'codeant',
61
- 'ellipsis',
62
- 'korbit',
63
- 'panto',
64
- 'bito',
65
- 'graphite',
66
- 'deepsource',
67
- 'snyk',
68
- 'codacy',
69
- 'sonarcloud',
70
- 'sweep',
71
- 'codeguru',
72
- 'codereviewer',
73
- 'codium',
74
- ];
75
- export const AI_REVIEWER_DISPLAY_NAMES = {
76
- cursor: 'Cursor BugBot',
77
- coderabbit: 'CodeRabbit',
78
- copilot: 'GitHub Copilot',
79
- greptile: 'Greptile',
80
- sourcery: 'Sourcery',
81
- qodo: 'Qodo',
82
- codeant: 'CodeAnt AI',
83
- ellipsis: 'Ellipsis',
84
- korbit: 'Korbit AI',
85
- panto: 'Panto AI',
86
- bito: 'Bito AI',
87
- graphite: 'Graphite',
88
- deepsource: 'DeepSource',
89
- snyk: 'Snyk',
90
- codacy: 'Codacy',
91
- sonarcloud: 'SonarCloud',
92
- sweep: 'Sweep AI',
93
- codeguru: 'Amazon CodeGuru',
94
- codereviewer: 'CodeReviewBot',
95
- codium: 'Codium',
96
- };
97
- /** Maps friendly source names to exact GitHub bot login usernames. */
98
- export const AI_REVIEWER_BOT_USERNAMES = {
99
- cursor: 'cursor-bugbot[bot]',
100
- coderabbit: 'coderabbitai[bot]',
101
- copilot: 'copilot[bot]',
102
- greptile: 'greptile[bot]',
103
- sourcery: 'sourcery-ai[bot]',
104
- qodo: 'qodo-merge-pro[bot]',
105
- codeant: 'codeant-ai[bot]',
106
- ellipsis: 'ellipsis-dev[bot]',
107
- korbit: 'korbit-ai[bot]',
108
- panto: 'pantoaibot[bot]',
109
- bito: 'bito[bot]',
110
- graphite: 'graphite-app[bot]',
111
- deepsource: 'deepsource-io[bot]',
112
- snyk: 'snyk[bot]',
113
- codacy: 'codacy-production[bot]',
114
- sonarcloud: 'sonarcloud[bot]',
115
- sweep: 'sweep-ai[bot]',
116
- codeguru: 'aws-codeguru-reviewer[bot]',
117
- codereviewer: 'codereviewbot[bot]',
118
- codium: 'codiumai[bot]',
119
- };
120
- const MergeQueueConfigSchema = z.object({
121
- /** Enable the Haystack auto-merge queue */
122
- merge_queue: z.boolean().optional(),
123
- /** Automatically rebase PRs that develop merge conflicts after pushes to the base branch */
124
- auto_resolve_conflicts: z.boolean().optional(),
125
- /** Dispatch the Haystack agent to fix failing CI checks. Defaults to true; set
126
- * false to escalate CI failures to the PR author instead of attempting a fix. */
127
- auto_fix_ci_failures: z.boolean().optional(),
128
- /** Grace period configuration before auto-merging */
129
- merge_debounce: z.object({
130
- /** Default wait time in minutes before auto-merging */
131
- default_minutes: z.number().optional(),
132
- /** Per-author wait time overrides (author login → minutes) */
133
- authors: z.record(z.string(), z.number()).optional(),
134
- }).optional(),
135
- /** Batch multiple PRs into one CI run */
136
- batch_merge: z.object({
137
- /** Enable batch merging */
138
- enabled: z.boolean().optional(),
139
- /** Minimum PRs to form a batch */
140
- min_batch_size: z.number().optional(),
141
- /** Maximum PRs per batch (cap: 20) */
142
- max_batch_size: z.number().optional(),
143
- /** Seconds to wait after grace period for more PRs to accumulate (default: 30, 0 to disable) */
144
- batch_window_seconds: z.number().optional(),
145
- }).optional(),
146
- /** Wait for external AI code reviewers before merging — all bots must post */
147
- wait_for_reviewer: z.object({
148
- /** GitHub bot usernames to wait for (e.g. "cursor-bugbot[bot]") */
149
- bots: z.array(z.string()),
150
- /** Give up waiting after this many minutes (default: 30) */
151
- timeout_minutes: z.number().optional(),
152
- }).optional(),
153
- });
154
- // =============================================================================
155
- // SERVICE (for monorepos)
156
- // =============================================================================
157
- const ServiceSchema = z.object({
158
- /** Root directory relative to repo root */
159
- root: z.string().optional(),
160
- /** Command to start the service */
161
- command: z.string(),
162
- /** Port the service runs on (not required for batch jobs) */
163
- port: z.number().optional(),
164
- /** Pattern in stdout that indicates service is ready */
165
- ready_pattern: z.string().optional(),
166
- /** Environment variables to set */
167
- env: z.record(z.string(), z.string()).optional(),
168
- /** Service type: 'server' (default) or 'batch' (run once, no port) */
169
- type: z.enum(['server', 'batch']).optional(),
170
- /** Services that must be started before this service */
171
- depends_on: z.array(z.string()).optional(),
172
- });
173
- // =============================================================================
174
- // VERIFICATION
175
- // =============================================================================
176
- const VerificationSchema = z.object({
177
- /** Commands to run for verification (build, lint, test, etc.) */
178
- commands: z.array(VerificationCommandSchema).optional(),
179
- /** Fixture data sources keyed by endpoint pattern */
180
- fixtures: z.record(z.string(), FixtureEntrySchema).optional(),
181
- });
182
- // =============================================================================
183
- // AUTH CONFIGURATION
184
- // =============================================================================
185
- const AuthStrategySchema = z.enum(['bypass', 'fixture', 'token', 'test_account']);
186
- const TokenInjectionSchema = z.object({
187
- type: z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),
188
- name: z.string(),
189
- secret: z.string(),
190
- cookie_options: z
191
- .object({
192
- path: z.string().optional(),
193
- domain: z.string().optional(),
194
- secure: z.boolean().optional(),
195
- httpOnly: z.boolean().optional(),
196
- sameSite: z.enum(['Strict', 'Lax', 'None']).optional(),
197
- })
198
- .optional(),
199
- });
200
- const LoginStepSchema = z.object({
201
- action: z.enum(['navigate', 'type', 'click', 'wait', 'submit']),
202
- url: z.string().optional(),
203
- selector: z.string().optional(),
204
- value: z.string().optional(),
205
- timeout: z.number().optional(),
206
- });
207
- const TestAccountSchema = z.object({
208
- credentials_secret: z.string(),
209
- login_flow: z.array(LoginStepSchema),
210
- success_selector: z.string().optional(),
211
- failure_selector: z.string().optional(),
212
- });
213
- const AuthConfigSchema = z.object({
214
- strategy: AuthStrategySchema.default('bypass'),
215
- env: z.record(z.string(), z.string()).optional(),
216
- fixture: z
217
- .object({
218
- pattern: z.string(),
219
- source: z.string(),
220
- })
221
- .optional(),
222
- token: TokenInjectionSchema.optional(),
223
- test_account: TestAccountSchema.optional(),
224
- fallback: AuthStrategySchema.optional(),
225
- });
226
- // =============================================================================
227
- // DATABASE CONFIGURATION
228
- // =============================================================================
229
- const DatabaseStrategySchema = z.enum(['fixture', 'memory', 'seed', 'docker', 'remote']);
230
- const DockerServiceSchema = z.object({
231
- image: z.string(),
232
- port: z.number(),
233
- env: z.record(z.string(), z.string()).optional(),
234
- health_check: z.string().optional(),
235
- health_timeout: z.number().optional(),
236
- });
237
- const DatabaseConfigBaseSchema = z.object({
238
- strategy: DatabaseStrategySchema.default('fixture'),
239
- env: z.record(z.string(), z.string()).optional(),
240
- seed_command: z.string().optional(),
241
- migrate_command: z.string().optional(),
242
- services: z.array(DockerServiceSchema).optional(),
243
- read_only: z.boolean().optional(),
244
- ready_timeout: z.number().optional(),
245
- });
246
- const DatabaseConfigSchema = DatabaseConfigBaseSchema.extend({
247
- fallback: DatabaseConfigBaseSchema.optional(),
248
- });
249
- // =============================================================================
250
- // AGENTIC CONFIGURATION
251
- // =============================================================================
252
- const AgenticToolSchema = z.enum(['opencode', 'claude-code', 'codex']);
253
- const AgenticSchema = z.object({
254
- tool: AgenticToolSchema.optional(),
255
- });
256
- // =============================================================================
257
- // NETWORK CONFIGURATION
258
- // =============================================================================
259
- const NetworkConfigSchema = z.object({
260
- /** Additional hosts/domains to allow egress to */
261
- allow: z.array(z.string()).optional(),
262
- });
263
- // =============================================================================
264
- // SECRET DECLARATION
265
- // =============================================================================
266
- const SecretDeclarationSchema = z.object({
267
- description: z.string().optional(),
268
- required: z.boolean().optional(),
269
- services: z.array(z.string()).optional(),
270
- });
271
- // =============================================================================
272
- // TRIAGE CONFIGURATION
273
- // =============================================================================
274
- const TriageConfigSchema = z.object({
275
- /** Abort a checker when its model stream has been silent this long, in milliseconds. */
276
- timeoutMs: z.number().int().positive().optional(),
277
- });
278
- // =============================================================================
279
- // REPOSITORY PREFERENCES
280
- // =============================================================================
281
- const PreferencesSchema = z.object({
282
- /** Run analysis automatically for PR webhook events (default: true) */
283
- automatic_analysis: z.boolean().optional(),
284
- /** Enable sandbox-backed verification for this repository */
285
- sandbox_enabled: z.boolean().optional(),
286
- /** Enroll submitted PRs in auto-merge by default */
287
- auto_merge: z.boolean().optional(),
288
- /** Allow Haystack to attempt automatic fixes */
289
- auto_fix: z.boolean().optional(),
290
- });
291
- // =============================================================================
292
- // MAIN CONFIG
293
- // =============================================================================
294
- export const HaystackConfigSchema = z.object({
295
- /** Config version (must be "1") */
296
- version: z.literal('1'),
297
- /** Hosted crawls of this repository (`haystack verify`, the stop hook): how long one may take, whole minutes from 1 to 30.
298
- * Absent: the service's default (3 minutes). `haystack verify --minutes` overrides it for one run. */
299
- crawl: z.object({ minutes: z.number().int().min(1).max(30).optional() }).strict().optional(),
300
- /** Project name (for display) */
301
- name: z.string().optional(),
302
- /** Repository-level Haystack behavior */
303
- preferences: PreferencesSchema.optional(),
304
- /** Package manager override (auto-detected if not specified) */
305
- package_manager: z.enum(['npm', 'pnpm', 'yarn', 'bun']).optional(),
306
- /** Development server configuration */
307
- dev_server: DevServerSchema.optional(),
308
- /** Multiple services (for monorepos) */
309
- services: z.record(z.string(), ServiceSchema).optional(),
310
- /** Verification configuration (legacy) */
311
- verification: VerificationSchema.optional(),
312
- /** Auth configuration (legacy) */
313
- auth: AuthConfigSchema.optional(),
314
- /** Agentic configuration (project-level override) */
315
- agentic: AgenticSchema.optional(),
316
- /** Database configuration (legacy) */
317
- database: DatabaseConfigSchema.optional(),
318
- /** Network egress configuration */
319
- network: NetworkConfigSchema.optional(),
320
- /** Secrets required by this project */
321
- secrets: z.record(z.string(), SecretDeclarationSchema).optional(),
322
- /** Merge queue configuration for autonomous PR maintenance */
323
- merge_queue: MergeQueueConfigSchema.optional(),
324
- /** Pre-PR triage configuration (stall timeout) */
325
- triage: TriageConfigSchema.optional(),
326
- });
@@ -1,26 +0,0 @@
1
- /**
2
- * Shared machine-readable envelope for the mutating commands
3
- * (dismiss, mark-reviewed, undismiss, request-review, review).
4
- *
5
- * One schema for all of them (`haystack schema action`): every payload
6
- * carries `action`, `status`, and `ref`, so an agent can drive any state
7
- * change with a single parser. Success payloads go to stdout as the only
8
- * stdout content; human/progress output stays on stderr in --json mode.
9
- */
10
- import chalk from 'chalk';
11
- import { withSchema } from '../schema.js';
12
- /** Print the success envelope (JSON mode only — human output is the caller's). */
13
- export function emitActionPayload(payload) {
14
- console.log(JSON.stringify(withSchema('action', payload), null, 2));
15
- }
16
- /**
17
- * Print a failure (JSON error envelope on stdout when --json, red text on
18
- * stderr always) and exit 1.
19
- */
20
- export function failAction(json, action, ref, message) {
21
- if (json) {
22
- process.stdout.write(JSON.stringify(withSchema('action', { action, status: 'error', ref, error: message }), null, 2) + '\n');
23
- }
24
- console.error(chalk.red(`\n${message}\n`));
25
- process.exit(1);
26
- }