@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.
- package/README.md +39 -455
- package/dist/capture/app-config.js +25 -1
- package/dist/commands/capture-brief.js +41 -32
- package/dist/commands/feedback.js +66 -0
- package/dist/commands/init-telemetry.js +53 -7
- package/dist/commands/init.js +7 -2
- package/dist/commands/lockfile-pin.js +307 -0
- package/dist/commands/verify.js +68 -13
- package/dist/index.js +27 -923
- package/dist/schema.js +4 -10
- package/dist/utils/haystack-api.js +0 -36
- package/package.json +1 -5
- package/schemas/feedback.v1.json +13 -0
- package/schemas/pre-verify.v2.json +240 -0
- package/schemas/verify-raw.v1.json +1132 -0
- package/schemas/verify.v2.json +655 -0
- package/dist/assets/hooks/agent-context/detect.ts +0 -316
- package/dist/assets/hooks/agent-context/format.ts +0 -100
- package/dist/assets/hooks/agent-context/index.ts +0 -41
- package/dist/assets/hooks/agent-context/parsers/claude.ts +0 -262
- package/dist/assets/hooks/agent-context/parsers/codex.ts +0 -416
- package/dist/assets/hooks/agent-context/parsers/gemini.ts +0 -155
- package/dist/assets/hooks/agent-context/parsers/opencode.ts +0 -174
- package/dist/assets/hooks/agent-context/tsconfig.json +0 -14
- package/dist/assets/hooks/agent-context/types.ts +0 -58
- package/dist/assets/hooks/llm-rules-template.md +0 -59
- package/dist/assets/hooks/package-lock.json +0 -598
- package/dist/assets/hooks/package.json +0 -12
- package/dist/assets/hooks/scripts/commit-msg.sh +0 -5
- package/dist/assets/hooks/scripts/post-commit.sh +0 -5
- package/dist/assets/hooks/scripts/pre-commit.sh +0 -175
- package/dist/assets/hooks/scripts/pre-push.sh +0 -25
- package/dist/assets/hooks/scripts/prepare-commit-msg.sh +0 -5
- package/dist/assets/hooks/truncation-checker/ast-analyzer.ts +0 -528
- package/dist/assets/hooks/truncation-checker/index.ts +0 -595
- package/dist/assets/hooks/truncation-checker/tsconfig.json +0 -13
- package/dist/assets/skills/map-cloud-verifier-universe/SKILL.md +0 -2051
- package/dist/assets/skills/map-cloud-verifier-universe/agents/openai.yaml +0 -4
- package/dist/assets/skills/map-cloud-verifier-universe/references/output-contract.md +0 -3411
- package/dist/assets/skills/map-your-system.md +0 -143
- package/dist/assets/skills/submit.md +0 -200
- package/dist/commands/ask.js +0 -20
- package/dist/commands/cloud-verifier-behaviors.js +0 -218
- package/dist/commands/cloud-verifier-data-store-census.js +0 -539
- package/dist/commands/cloud-verifier-data-store-drift.js +0 -158
- package/dist/commands/cloud-verifier-identity-census.js +0 -4060
- package/dist/commands/cloud-verifier-materialization.js +0 -704
- package/dist/commands/cloud-verifier-pascal-selector-census.js +0 -1382
- package/dist/commands/cloud-verifier-python-manifest-selector-census.js +0 -2015
- package/dist/commands/cloud-verifier-specialized-operational-census.js +0 -11432
- package/dist/commands/cloud-verifier-universe.js +0 -10178
- package/dist/commands/config.js +0 -549
- package/dist/commands/design-verify.js +0 -311
- package/dist/commands/dismiss.js +0 -159
- package/dist/commands/hooks.js +0 -226
- package/dist/commands/inbox.js +0 -137
- package/dist/commands/mcp.js +0 -201
- package/dist/commands/policy.js +0 -371
- package/dist/commands/pr-status.js +0 -207
- package/dist/commands/pr.js +0 -105
- package/dist/commands/prepare-universe-review.js +0 -1092
- package/dist/commands/production-source-deny-policy.js +0 -100
- package/dist/commands/request-review.js +0 -74
- package/dist/commands/review.js +0 -191
- package/dist/commands/rules.js +0 -98
- package/dist/commands/scaffold-provisional-universe.js +0 -806
- package/dist/commands/setup.js +0 -1170
- package/dist/commands/skills.js +0 -447
- package/dist/commands/submit.js +0 -745
- package/dist/commands/system-map.js +0 -228
- package/dist/commands/triage.js +0 -598
- package/dist/commands/webhooks.js +0 -241
- package/dist/states.js +0 -46
- package/dist/tools/detect.js +0 -832
- package/dist/triage/astra.js +0 -202
- package/dist/triage/prompts.js +0 -188
- package/dist/triage/runner.js +0 -200
- package/dist/triage/types.js +0 -7
- package/dist/utils/action-output.js +0 -26
- package/dist/utils/analysis-api.js +0 -416
- package/dist/utils/design-verifier-api.js +0 -294
- package/dist/utils/design-verifier-history.js +0 -79
- package/dist/utils/design-verifier-result.js +0 -424
- package/dist/utils/github-api.js +0 -324
- package/dist/utils/pending-state.js +0 -86
- package/dist/utils/pr-ref.js +0 -56
- package/dist/utils/prompter.js +0 -328
- package/schemas/action.v1.json +0 -22
- package/schemas/ask.v1.json +0 -40
- package/schemas/inbox.v1.json +0 -27
- package/schemas/pr-status.v1.json +0 -61
- package/schemas/pr.v1.json +0 -97
- package/schemas/pr.v3.json +0 -45
- package/schemas/setup.v1.json +0 -75
- package/schemas/submit.v1.json +0 -90
- package/schemas/triage.v1.json +0 -103
- 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
|