@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,175 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Haystack's own hooks never need the push credential the CLI exports for
3
- # `git push`; drop it so nothing these hooks run can read it.
4
- unset HAYSTACK_GIT_TOKEN
5
- HOOKS_DIR="$(cd "$(dirname "$0")" && pwd)"
6
- REPO_ROOT="$(cd "$HOOKS_DIR/.." && pwd)"
7
- TSX_IMPORT="$HOOKS_DIR/node_modules/tsx/dist/loader.mjs"
8
- TSX_BIN="$HOOKS_DIR/node_modules/.bin/tsx"
9
-
10
- if [ ! -f "$TSX_IMPORT" ]; then
11
- TSX_IMPORT="tsx"
12
- fi
13
-
14
- node_version() {
15
- node -v 2>/dev/null | sed 's/^v//'
16
- }
17
-
18
- node_version_major() {
19
- node_version | cut -d. -f1
20
- }
21
-
22
- node_version_minor() {
23
- node_version | cut -d. -f2
24
- }
25
-
26
- node_supports_import() {
27
- major=$(node_version_major)
28
- minor=$(node_version_minor)
29
-
30
- if [ -z "$major" ] || [ -z "$minor" ]; then
31
- return 1
32
- fi
33
-
34
- if [ "$major" -gt 20 ]; then
35
- return 0
36
- fi
37
-
38
- if [ "$major" -eq 20 ] && [ "$minor" -ge 6 ]; then
39
- return 0
40
- fi
41
-
42
- if [ "$major" -eq 19 ]; then
43
- return 0
44
- fi
45
-
46
- if [ "$major" -eq 18 ] && [ "$minor" -ge 19 ]; then
47
- return 0
48
- fi
49
-
50
- return 1
51
- }
52
-
53
- node_supports_loader() {
54
- major=$(node_version_major)
55
-
56
- if [ -z "$major" ]; then
57
- return 1
58
- fi
59
-
60
- if [ "$major" -lt 18 ]; then
61
- return 1
62
- fi
63
-
64
- ! node_supports_import
65
- }
66
-
67
- run_tsx() {
68
- if node_supports_import; then
69
- node --import "$TSX_IMPORT" "$@"
70
- return
71
- fi
72
-
73
- if node_supports_loader; then
74
- node --loader "$TSX_IMPORT" "$@"
75
- return
76
- fi
77
-
78
- "$TSX_BIN" "$@"
79
- }
80
-
81
- # No network fallback: without a supported Node or the installed hook
82
- # dependencies, fail rather than fetch an unpinned tsx with npx.
83
- if ! node_supports_import && ! node_supports_loader && [ ! -x "$TSX_BIN" ]; then
84
- echo "Haystack pre-commit: needs Node 18 or later, or hooks/node_modules (run npm ci in hooks/)." >&2
85
- exit 1
86
- fi
87
-
88
- # Extract agent context if running under an AI agent
89
- # Capture stderr to detect whether an AI agent is present
90
- AGENT_OUTPUT=$(run_tsx "$HOOKS_DIR/agent-context/index.ts" "$REPO_ROOT" 2>&1) || true
91
-
92
- # Print the agent context to stderr so it still appears in the commit output
93
- if [ -n "$AGENT_OUTPUT" ]; then
94
- echo "$AGENT_OUTPUT" >&2
95
- fi
96
-
97
- # If no agent detected, this is a human commit — pass through
98
- if ! echo "$AGENT_OUTPUT" | grep -q "AGENT CONTEXT DETECTED"; then
99
- exit 0
100
- fi
101
-
102
- # --- AI agent detected: run automated checks ---
103
-
104
- # Check for truncation violations in staged changes
105
- TRUNCATION_OUTPUT=$(run_tsx "$HOOKS_DIR/truncation-checker/index.ts" 2>&1)
106
- TRUNCATION_EXIT=$?
107
-
108
- if [ -n "$TRUNCATION_OUTPUT" ]; then
109
- echo "$TRUNCATION_OUTPUT" >&2
110
- fi
111
-
112
- if [ $TRUNCATION_EXIT -ne 0 ]; then
113
- echo "" >&2
114
- echo "========================================" >&2
115
- echo " COMMIT BLOCKED: TRUNCATION VIOLATIONS" >&2
116
- echo "========================================" >&2
117
- echo "" >&2
118
- echo "Your staged changes contain truncation patterns that violate LLM_RULES.md." >&2
119
- echo "Review the violations above and either:" >&2
120
- echo " 1. Remove the truncation code" >&2
121
- echo " 2. Add a comment with 'intentional' explaining why it's needed" >&2
122
- echo " 3. Get explicit user permission for the truncation" >&2
123
- echo "" >&2
124
- exit 1
125
- fi
126
-
127
- # --- Enforce LLM rules review ---
128
-
129
- GIT_DIR=$(git rev-parse --git-dir)
130
- BYPASS_TOKEN_FILE="$GIT_DIR/llm-rules-reviewed"
131
- RULES_FILE="$REPO_ROOT/LLM_RULES.md"
132
-
133
- # Get the SHA of the current staged tree
134
- STAGED_TREE_SHA=$(git write-tree)
135
-
136
- # Check for a valid bypass token (written on a previous failed attempt)
137
- if [ -f "$BYPASS_TOKEN_FILE" ]; then
138
- STORED_SHA=$(cat "$BYPASS_TOKEN_FILE")
139
- if [ "$STORED_SHA" = "$STAGED_TREE_SHA" ]; then
140
- # Agent has already been shown the rules for this exact set of changes
141
- rm -f "$BYPASS_TOKEN_FILE"
142
- exit 0
143
- fi
144
- fi
145
-
146
- # First attempt — block the commit and inject the rules into the agent's context
147
-
148
- echo "" >&2
149
- echo "========================================" >&2
150
- echo " LLM RULES — REVIEW BEFORE COMMITTING" >&2
151
- echo "========================================" >&2
152
- echo "" >&2
153
-
154
- if [ -f "$RULES_FILE" ]; then
155
- cat "$RULES_FILE" >&2
156
- else
157
- echo "(LLM_RULES.md not found at $RULES_FILE)" >&2
158
- fi
159
-
160
- echo "" >&2
161
- echo "========================================" >&2
162
- echo " STAGED CHANGES" >&2
163
- echo "========================================" >&2
164
- echo "" >&2
165
- git diff --cached --stat >&2
166
-
167
- echo "" >&2
168
- echo "========================================" >&2
169
- echo "PRE-COMMIT CHECK: You must confirm your changes comply with the above rules. The rules have been re-injected into your context. Review your staged changes against each rule, then retry the commit. A bypass token has been written." >&2
170
- echo "========================================" >&2
171
-
172
- # Write the bypass token so the next attempt with the same staged tree passes
173
- echo "$STAGED_TREE_SHA" > "$BYPASS_TOKEN_FILE"
174
-
175
- exit 1
@@ -1,25 +0,0 @@
1
- #!/bin/sh
2
- # Haystack pre-push hook
3
- # Haystack's own hooks never need the push credential the CLI exports for
4
- # `git push`; drop it so nothing these hooks run can read it.
5
- unset HAYSTACK_GIT_TOKEN
6
- # $1 is the remote name (e.g., "origin")
7
-
8
- # Check if pushing a non-haystack branch and remind about haystack submit
9
- current_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
10
- if [ -n "$current_branch" ] && [ "$current_branch" != "main" ] && [ "$current_branch" != "master" ]; then
11
- case "$current_branch" in
12
- haystack/*)
13
- # Already a haystack branch, no reminder needed
14
- ;;
15
- *)
16
- # Check if this is an AI agent session (set by agent-context detector)
17
- if [ -n "$HAYSTACK_AGENT_SESSION" ] || [ -n "$CLAUDE_CODE" ] || [ -n "$CODEX_CLI" ] || [ -n "$CODEX_SHELL" ] || [ -n "$CODEX_THREAD_ID" ] || [ -n "$CODEX_CI" ]; then
18
- echo ""
19
- echo "💡 Tip: Use 'haystack submit' to create PRs through Haystack's submit workflow."
20
- echo " This enables automatic analysis and merge when approved."
21
- echo ""
22
- fi
23
- ;;
24
- esac
25
- fi
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
- # Haystack prepare-commit-msg hook
3
- # Haystack's own hooks never need the push credential the CLI exports for
4
- # `git push`; drop it so nothing these hooks run can read it.
5
- unset HAYSTACK_GIT_TOKEN