@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
@@ -555,6 +555,52 @@ export function formatCrawl(view) {
555
555
  }
556
556
  return lines.join('\n');
557
557
  }
558
+ export function verifyReport(view) {
559
+ const status = reportedStatus(view);
560
+ const published = results(view);
561
+ const error = published?.error ?? view.error;
562
+ const explored = published !== null && view.clocks.crawlStartedAt !== null;
563
+ const findings = explored ? VERDICTS.flatMap(verdict => published.findings.filter(finding => finding.verdict === verdict)) : [];
564
+ const ideaWords = { covered: 'tried', blocked: 'could not try', unfinished: 'not finished' };
565
+ return {
566
+ runId: view.runId,
567
+ repository: view.repository,
568
+ title: view.changeTitle,
569
+ baseCommit: view.baseCommit,
570
+ workCommit: view.workCommit,
571
+ status,
572
+ headline: headline(view),
573
+ bugs: published?.bugs ?? view.totals.bugs,
574
+ findings: findings.map(finding => ({
575
+ id: finding.id,
576
+ verdict: finding.verdict,
577
+ why: finding.why,
578
+ start: finding.start,
579
+ steps: finding.steps,
580
+ outsideServices: finding.standIns && (finding.standIns.old.length > 0 || finding.standIns.new.length > 0)
581
+ ? { withoutChange: finding.standIns.old, withChange: finding.standIns.new }
582
+ : null,
583
+ })),
584
+ spots: explored ? published.reach.spots.map(spot => ({
585
+ file: spot.file,
586
+ line: spot.line,
587
+ reached: spot.furthest === null ? 'never reached' : SPOT_WORDS[spot.furthest],
588
+ reachedBy: spot.reachedBy && { start: spot.reachedBy.start, steps: spot.reachedBy.steps, page: spot.reachedBy.page },
589
+ findingIds: spot.findingIds,
590
+ })) : [],
591
+ ideas: explored && published.ideas !== undefined
592
+ ? published.ideas.map(idea => ({ text: idea.text, result: ideaWords[idea.state], reason: idea.reason, findingIds: idea.findingIds }))
593
+ : null,
594
+ neverRan: explored ? {
595
+ files: published.reach.unreachedChangedFiles,
596
+ functions: published.reach.blast === null ? null : { ran: published.reach.blast.ran, total: published.reach.blast.functions },
597
+ } : null,
598
+ notFinishedInTime: explored ? published.notFinishedInTime : 0,
599
+ outsideServiceGaps: explored ? published.standIns?.gaps ?? [] : [],
600
+ error: error ? { code: error.code, message: error.message } : null,
601
+ machinesNotProvenShutDown: TERMINAL.has(view.status) ? view.totals.cleanupUnproven : 0,
602
+ };
603
+ }
558
604
  /** Case-batch status conventions: 0 finished (or answered: amendment 9, its work
559
605
  * is done and only its shutdown remains), or still running with --no-wait;
560
606
  * 2 ended without finishing (incomplete, cancelled) or finished with cleanup
@@ -791,9 +837,9 @@ function checkedLine(change) {
791
837
  }
792
838
  /** Prints the onboarding (and nothing else) as the command's answer: `--json`
793
839
  * carries OnboardingStatusV1. A block exits 3: its ask says what to do. */
794
- function finishWithOnboarding(status, json, change) {
795
- if (json)
796
- process.stdout.write(`${JSON.stringify(withSchema('verify', { change, onboarding: status, crawl: null }), null, 2)}\n`);
840
+ function finishWithOnboarding(status, options, change) {
841
+ if (options.json || options.raw)
842
+ printVerifyJson(options, change, status, null);
797
843
  else
798
844
  console.log(formatOnboarding(status));
799
845
  process.exitCode = onboardingExitCode(status);
@@ -997,7 +1043,7 @@ export async function preVerifyCommand(options) {
997
1043
  if (options.wait !== false && briefOf(view) === null && !TERMINAL.has(reportedStatus(view)))
998
1044
  view = await waitForBrief(view, identity, auth.token);
999
1045
  const brief = briefOf(view);
1000
- // CAPTURE-V1 rule 7b: the routes the change touches, with their share of captured sessions; null without capture set up.
1046
+ // CAPTURE-V1 rule 7b: the routes the change touches, with their share of captured sessions, per app; null without capture set up.
1001
1047
  const captured = await readPreVerifyCapture(findGitRoot(), identity.repository, auth.token, [...new Set([...(brief?.functions.map(fn => fn.file) ?? []), ...change.files])], new Date());
1002
1048
  if (options.json)
1003
1049
  finish(onboarding, view, captured);
@@ -1014,13 +1060,22 @@ export async function preVerifyCommand(options) {
1014
1060
  : view.status === 'completed' ? 'It was checked before briefs existed and is not run again: change anything in the checkout and run `haystack pre-verify` again.'
1015
1061
  : 'Run `haystack pre-verify` again to prepare it again.'));
1016
1062
  if (!options.json && captured !== null)
1017
- console.log(`\n${formatCapture(captured)}`);
1063
+ for (const section of captured)
1064
+ console.log(`\n${formatCapture(section)}`);
1018
1065
  if (brief === null && TERMINAL.has(reportedStatus(view)))
1019
1066
  process.exitCode = 2;
1020
1067
  }
1068
+ /** verify's one JSON document: the report (`--json`) or the service's whole record (`--raw`). */
1069
+ function printVerifyJson(options, change, onboarding, view) {
1070
+ const document = options.raw
1071
+ ? withSchema('verify-raw', { change, onboarding, crawl: view })
1072
+ : withSchema('verify', { change, onboarding, crawl: view === null ? null : verifyReport(view) });
1073
+ process.stdout.write(`${JSON.stringify(document, null, 2)}\n`);
1074
+ }
1021
1075
  export async function verifyCommand(options) {
1076
+ const json = options.json || options.raw;
1022
1077
  // In --json mode stdout carries the one document; every other line goes to stderr.
1023
- const note = (line) => { if (options.json)
1078
+ const note = (line) => { if (json)
1024
1079
  console.error(line);
1025
1080
  else
1026
1081
  console.log(line); };
@@ -1030,8 +1085,8 @@ export async function verifyCommand(options) {
1030
1085
  const change = checkedChange(request.baseCommit, request.workCommit);
1031
1086
  if (!request.crawl) {
1032
1087
  note(`Nothing to verify: this checkout has no changes against ${request.baseCommit.slice(0, 12)}.`);
1033
- if (options.json)
1034
- process.stdout.write(`${JSON.stringify(withSchema('verify', { change, onboarding: null, crawl: null }), null, 2)}\n`);
1088
+ if (json)
1089
+ printVerifyJson(options, change, null, null);
1035
1090
  return;
1036
1091
  }
1037
1092
  note(checkedLine(change));
@@ -1065,7 +1120,7 @@ export async function verifyCommand(options) {
1065
1120
  reportOnboardingState(onboarding);
1066
1121
  }
1067
1122
  if (onboarding.state !== 'ready') {
1068
- finishWithOnboarding(onboarding, options.json, change);
1123
+ finishWithOnboarding(onboarding, options, change);
1069
1124
  return;
1070
1125
  }
1071
1126
  // Ready: the service admitted the waiting crawl when the record published; this
@@ -1075,8 +1130,8 @@ export async function verifyCommand(options) {
1075
1130
  note(submitted.line);
1076
1131
  }
1077
1132
  if (submitted.runId === null) {
1078
- if (options.json)
1079
- process.stdout.write(`${JSON.stringify(withSchema('verify', { change, onboarding, crawl: null }), null, 2)}\n`);
1133
+ if (json)
1134
+ printVerifyJson(options, change, onboarding, null);
1080
1135
  process.exitCode = 1;
1081
1136
  return;
1082
1137
  }
@@ -1089,8 +1144,8 @@ export async function verifyCommand(options) {
1089
1144
  if (options.wait !== false && !TERMINAL.has(reportedStatus(view))) {
1090
1145
  view = await waitForCrawl(view, identity, auth.token);
1091
1146
  }
1092
- if (options.json)
1093
- process.stdout.write(`${JSON.stringify(withSchema('verify', { change, onboarding, crawl: view }), null, 2)}\n`);
1147
+ if (json)
1148
+ printVerifyJson(options, change, onboarding, view);
1094
1149
  else {
1095
1150
  console.log(formatCrawl(view));
1096
1151
  const notes = [...(onboarding?.dataAbsences ?? []), ...(onboarding?.versionChoices ?? []), ...(onboarding?.standIns ?? []),