@haystackeditor/cli 0.15.31 → 0.17.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 +141 -61
- package/dist/assets/hooks/scripts/commit-msg.sh +3 -0
- package/dist/assets/hooks/scripts/post-commit.sh +3 -0
- package/dist/assets/hooks/scripts/pre-commit.sh +11 -6
- package/dist/assets/hooks/scripts/pre-push.sh +3 -0
- package/dist/assets/hooks/scripts/prepare-commit-msg.sh +3 -0
- package/dist/commands/case-batch-contract.js +694 -0
- package/dist/commands/case-batch.js +1011 -0
- package/dist/commands/cloud-verifier-identity-census.js +5 -2
- package/dist/commands/combination-search-hook.js +139 -0
- package/dist/commands/dismiss.js +2 -1
- package/dist/commands/hooks.js +66 -7
- package/dist/commands/install-session-hooks.js +131 -44
- package/dist/commands/policy.js +32 -45
- package/dist/commands/precompute-delivery.js +6 -1
- package/dist/commands/scaffold-provisional-universe.js +8 -10
- package/dist/commands/setup.js +32 -10
- package/dist/commands/submit.js +39 -71
- package/dist/commands/telemetry.js +17 -2
- package/dist/commands/triage.js +2 -1
- package/dist/commands/verify-explore.js +1 -0
- package/dist/commands/verify-hosted-mcp.js +3 -12
- package/dist/commands/verify-hosted-reproducibility.js +49 -547
- package/dist/commands/verify-hosted.js +66 -168
- package/dist/commands/verify-precompute.js +64 -11
- package/dist/commands/verify.js +51 -139
- package/dist/index.js +290 -366
- package/dist/lazy.js +8 -0
- package/dist/schema.js +2 -1
- package/dist/tools/detect.js +3 -24
- package/dist/triage/astra.js +199 -0
- package/dist/triage/prompts.js +145 -179
- package/dist/triage/runner.js +104 -300
- package/dist/triage/types.js +2 -2
- package/dist/types.js +2 -6
- package/dist/utils/auth.js +14 -2
- package/dist/utils/git.js +60 -29
- package/dist/utils/github-api.js +14 -1
- package/dist/utils/haystack-api.js +38 -7
- package/dist/utils/hooks.js +43 -6
- package/dist/utils/prompter.js +25 -10
- package/dist/utils/safe-write.js +31 -0
- package/dist/utils/secret-paths.js +115 -0
- package/dist/utils/secrets.js +0 -1
- package/dist/utils/telemetry.js +34 -14
- package/dist/utils/update-check.js +151 -0
- package/package.json +19 -14
- package/schemas/case-batch.v1.json +235 -0
- package/schemas/cloud-verifier.v1.json +55 -100
- package/schemas/submit.v1.json +4 -2
- package/dist/commands/ask.d.ts +0 -14
- package/dist/commands/cloud-verifier-behaviors.d.ts +0 -27
- package/dist/commands/cloud-verifier-data-store-census.d.ts +0 -47
- package/dist/commands/cloud-verifier-data-store-drift.d.ts +0 -42
- package/dist/commands/cloud-verifier-identity-census.d.ts +0 -88
- package/dist/commands/cloud-verifier-materialization.d.ts +0 -16
- package/dist/commands/cloud-verifier-pascal-selector-census.d.ts +0 -29
- package/dist/commands/cloud-verifier-python-manifest-selector-census.d.ts +0 -27
- package/dist/commands/cloud-verifier-specialized-operational-census.d.ts +0 -51
- package/dist/commands/cloud-verifier-universe.d.ts +0 -31
- package/dist/commands/config.d.ts +0 -46
- package/dist/commands/design-verify.d.ts +0 -33
- package/dist/commands/dismiss.d.ts +0 -29
- package/dist/commands/hooks.d.ts +0 -13
- package/dist/commands/inbox.d.ts +0 -65
- package/dist/commands/init.d.ts +0 -10
- package/dist/commands/install-session-hooks.d.ts +0 -17
- package/dist/commands/login.d.ts +0 -8
- package/dist/commands/mcp.d.ts +0 -1
- package/dist/commands/policy.d.ts +0 -31
- package/dist/commands/pr-status.d.ts +0 -144
- package/dist/commands/pr.d.ts +0 -40
- package/dist/commands/precompute-delivery-contract.d.ts +0 -68
- package/dist/commands/precompute-delivery.d.ts +0 -20
- package/dist/commands/prepare-universe-review.d.ts +0 -115
- package/dist/commands/production-source-deny-policy.d.ts +0 -15
- package/dist/commands/request-review.d.ts +0 -26
- package/dist/commands/review.d.ts +0 -25
- package/dist/commands/rules.d.ts +0 -4
- package/dist/commands/scaffold-provisional-universe.d.ts +0 -468
- package/dist/commands/schema-cmd.d.ts +0 -2
- package/dist/commands/setup.d.ts +0 -28
- package/dist/commands/skills.d.ts +0 -8
- package/dist/commands/status.d.ts +0 -4
- package/dist/commands/submit.d.ts +0 -30
- package/dist/commands/system-map.d.ts +0 -42
- package/dist/commands/telemetry.d.ts +0 -53
- package/dist/commands/tokens.d.ts +0 -14
- package/dist/commands/triage.d.ts +0 -35
- package/dist/commands/verify-core.d.ts +0 -449
- package/dist/commands/verify-core.js +0 -789
- package/dist/commands/verify-explore.d.ts +0 -14
- package/dist/commands/verify-history.d.ts +0 -14
- package/dist/commands/verify-hosted-mcp.d.ts +0 -12
- package/dist/commands/verify-hosted-reproducibility.d.ts +0 -90
- package/dist/commands/verify-hosted.d.ts +0 -92
- package/dist/commands/verify-mcp.d.ts +0 -8
- package/dist/commands/verify-mcp.js +0 -517
- package/dist/commands/verify-ops.d.ts +0 -158
- package/dist/commands/verify-ops.js +0 -1148
- package/dist/commands/verify-precompute.d.ts +0 -30
- package/dist/commands/verify-reproducibility.d.ts +0 -85
- package/dist/commands/verify-reproducibility.js +0 -494
- package/dist/commands/verify-reseal.d.ts +0 -9
- package/dist/commands/verify-reseal.js +0 -148
- package/dist/commands/verify-sandboxes.d.ts +0 -95
- package/dist/commands/verify-sandboxes.js +0 -352
- package/dist/commands/verify.d.ts +0 -28
- package/dist/commands/webhooks.d.ts +0 -30
- package/dist/index.d.ts +0 -22
- package/dist/schema.d.ts +0 -28
- package/dist/states.d.ts +0 -29
- package/dist/tools/detect.d.ts +0 -50
- package/dist/triage/prompts.d.ts +0 -24
- package/dist/triage/runner.d.ts +0 -34
- package/dist/triage/types.d.ts +0 -42
- package/dist/types/verify-history.d.ts +0 -38
- package/dist/types.d.ts +0 -1684
- package/dist/utils/action-output.d.ts +0 -24
- package/dist/utils/analysis-api.d.ts +0 -187
- package/dist/utils/auth.d.ts +0 -79
- package/dist/utils/config.d.ts +0 -24
- package/dist/utils/design-verifier-api.d.ts +0 -208
- package/dist/utils/design-verifier-history.d.ts +0 -46
- package/dist/utils/design-verifier-result.d.ts +0 -74
- package/dist/utils/detect.d.ts +0 -43
- package/dist/utils/git.d.ts +0 -135
- package/dist/utils/github-api.d.ts +0 -104
- package/dist/utils/haystack-api.d.ts +0 -37
- package/dist/utils/hooks.d.ts +0 -12
- package/dist/utils/pending-state.d.ts +0 -40
- package/dist/utils/pr-ref.d.ts +0 -27
- package/dist/utils/prompter.d.ts +0 -85
- package/dist/utils/secrets.d.ts +0 -47
- package/dist/utils/telemetry.d.ts +0 -19
- /package/dist/commands/{precompute-delivery-worker.d.ts → combination-search-hook-contract.js} +0 -0
|
@@ -1,24 +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
|
-
export type ActionName = 'dismiss' | 'mark_reviewed' | 'undismiss' | 'request_review' | 'trigger_review' | 'clear_pending';
|
|
11
|
-
export interface ActionPayload extends Record<string, unknown> {
|
|
12
|
-
action: ActionName;
|
|
13
|
-
status: 'ok';
|
|
14
|
-
ref: string;
|
|
15
|
-
/** Human-readable statement of what changed. */
|
|
16
|
-
detail: string;
|
|
17
|
-
}
|
|
18
|
-
/** Print the success envelope (JSON mode only — human output is the caller's). */
|
|
19
|
-
export declare function emitActionPayload(payload: ActionPayload): void;
|
|
20
|
-
/**
|
|
21
|
-
* Print a failure (JSON error envelope on stdout when --json, red text on
|
|
22
|
-
* stderr always) and exit 1.
|
|
23
|
-
*/
|
|
24
|
-
export declare function failAction(json: boolean | undefined, action: ActionName, ref: string | null, message: string): never;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Haystack Analysis API client.
|
|
3
|
-
*
|
|
4
|
-
* Polls the result endpoint by PR identifier to check if analysis is ready,
|
|
5
|
-
* then fetches detailed results (bug detection + rule violations).
|
|
6
|
-
*
|
|
7
|
-
* Analysis is triggered automatically by the GitHub App webhook when a PR
|
|
8
|
-
* is created or updated — the CLI does not need to trigger it directly.
|
|
9
|
-
*/
|
|
10
|
-
export interface AnalysisVerdict {
|
|
11
|
-
state: 'good-to-merge' | 'needs-input' | 'failed';
|
|
12
|
-
bugCount: number;
|
|
13
|
-
warningCount: number;
|
|
14
|
-
ruleViolationCount: number;
|
|
15
|
-
summary: string;
|
|
16
|
-
issues: AnalysisIssue[];
|
|
17
|
-
reviewUrl: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the PR has actually been merged on GitHub. Read from the GH
|
|
20
|
-
* REST PR endpoint — NOT inferred from review policy / canAutoMerge /
|
|
21
|
-
* haystackRating, all of which mean "eligible", not "merged".
|
|
22
|
-
*/
|
|
23
|
-
autoMerged?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Whether the rating synthesis flagged that a human reviewer is required
|
|
26
|
-
* (review policy, security-sensitive paths, etc.). Distinct from
|
|
27
|
-
* `state === 'needs-input'` — analysis can be clean AND still need a human.
|
|
28
|
-
*/
|
|
29
|
-
needsHumanReview?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface AnalysisIssue {
|
|
32
|
-
file: string;
|
|
33
|
-
line?: number;
|
|
34
|
-
message: string;
|
|
35
|
-
severity: 'error' | 'warning' | 'info';
|
|
36
|
-
source: 'bug-detection' | 'rule-violation';
|
|
37
|
-
}
|
|
38
|
-
export interface SynthesisDisplayIssue {
|
|
39
|
-
/** Stable finding id (assigned at synthesis). Used to correlate with the
|
|
40
|
-
* auto-fix manifest by exact match instead of comparing text. */
|
|
41
|
-
id?: string;
|
|
42
|
-
category: string;
|
|
43
|
-
summary: string;
|
|
44
|
-
detail: string;
|
|
45
|
-
agentFixPrompt?: string;
|
|
46
|
-
source?: string;
|
|
47
|
-
changeKey?: string;
|
|
48
|
-
filePath?: string;
|
|
49
|
-
startLine?: number;
|
|
50
|
-
endLine?: number;
|
|
51
|
-
severity?: 'critical' | 'high' | 'medium' | 'low';
|
|
52
|
-
mechanicalFix?: boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface VerifiedBug {
|
|
55
|
-
originalTitle: string;
|
|
56
|
-
verified: boolean;
|
|
57
|
-
assessedSeverity: 'low' | 'medium' | 'high' | 'critical';
|
|
58
|
-
likelihood?: 'rare' | 'uncommon' | 'common';
|
|
59
|
-
rationale: string;
|
|
60
|
-
source?: {
|
|
61
|
-
type: string;
|
|
62
|
-
commentId?: number;
|
|
63
|
-
author?: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
export interface HumanReviewReason {
|
|
67
|
-
type: string;
|
|
68
|
-
severity: string;
|
|
69
|
-
reason: string;
|
|
70
|
-
source?: string;
|
|
71
|
-
}
|
|
72
|
-
export interface RatingSynthesis {
|
|
73
|
-
haystackRating: 1 | 2 | 3 | 4 | 5;
|
|
74
|
-
analysisVerdict?: 'clean' | 'has-issues' | 'needs-review';
|
|
75
|
-
synthesis: string;
|
|
76
|
-
synthesisDisplay?: SynthesisDisplayIssue[];
|
|
77
|
-
verifiedBugs: VerifiedBug[];
|
|
78
|
-
reviewRecommendation: {
|
|
79
|
-
canAutoMerge: boolean;
|
|
80
|
-
};
|
|
81
|
-
needsHumanReview?: boolean;
|
|
82
|
-
humanReviewReasons?: HumanReviewReason[];
|
|
83
|
-
phase?: 1 | 2;
|
|
84
|
-
verificationImpact?: string;
|
|
85
|
-
verificationConfidence?: {
|
|
86
|
-
level: 'high' | 'medium' | 'low' | 'none';
|
|
87
|
-
summary: string;
|
|
88
|
-
};
|
|
89
|
-
verification?: {
|
|
90
|
-
success: boolean;
|
|
91
|
-
lint?: {
|
|
92
|
-
success: boolean;
|
|
93
|
-
output?: string;
|
|
94
|
-
};
|
|
95
|
-
test?: {
|
|
96
|
-
success: boolean;
|
|
97
|
-
output?: string;
|
|
98
|
-
};
|
|
99
|
-
build?: {
|
|
100
|
-
success: boolean;
|
|
101
|
-
output?: string;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
export type AnalysisReadyResult = {
|
|
106
|
-
status: 'ready';
|
|
107
|
-
} | {
|
|
108
|
-
status: 'pending';
|
|
109
|
-
} | {
|
|
110
|
-
status: 'error';
|
|
111
|
-
message: string;
|
|
112
|
-
};
|
|
113
|
-
export type TriggerAnalysisResult = {
|
|
114
|
-
status: 'started';
|
|
115
|
-
requestId: string;
|
|
116
|
-
} | {
|
|
117
|
-
status: 'already_processing';
|
|
118
|
-
requestId: string;
|
|
119
|
-
} | {
|
|
120
|
-
status: 'rate_limited';
|
|
121
|
-
message: string;
|
|
122
|
-
retryAfterSeconds?: number;
|
|
123
|
-
} | {
|
|
124
|
-
status: 'denied';
|
|
125
|
-
message: string;
|
|
126
|
-
} | {
|
|
127
|
-
status: 'error';
|
|
128
|
-
message: string;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Trigger a fresh full analysis for a PR via the auth-worker
|
|
132
|
-
* (`/api/analysis-trigger/{owner}/{repo}/{pr}`). Requires auth — triggers
|
|
133
|
-
* start a real analysis run. Returns the request id to wait on.
|
|
134
|
-
*/
|
|
135
|
-
export declare function triggerAnalysis(owner: string, repo: string, prNumber: number, token: string, headSha?: string): Promise<TriggerAnalysisResult>;
|
|
136
|
-
export type TriggerRunStatus = 'pending' | 'COMPLETED' | 'FAILED' | 'SUPERSEDED' | 'error';
|
|
137
|
-
/**
|
|
138
|
-
* Poll the status of a triggered run by request id. The PR-level result
|
|
139
|
-
* endpoint can't distinguish a fresh re-run on the same head from the
|
|
140
|
-
* previous completed analysis — the request id can.
|
|
141
|
-
*/
|
|
142
|
-
export declare function fetchTriggerStatus(requestId: string, token: string): Promise<{
|
|
143
|
-
status: TriggerRunStatus;
|
|
144
|
-
message?: string;
|
|
145
|
-
}>;
|
|
146
|
-
/**
|
|
147
|
-
* Check if analysis results are available for a PR by polling the result endpoint.
|
|
148
|
-
* Returns 'ready' if complete, 'pending' if not yet available, or 'error' for server failures.
|
|
149
|
-
*/
|
|
150
|
-
export declare function checkAnalysisReady(owner: string, repo: string, prNumber: number, token?: string): Promise<AnalysisReadyResult>;
|
|
151
|
-
export declare function fetchAnalysisResults(owner: string, repo: string, prNumber: number, token?: string): Promise<AnalysisVerdict>;
|
|
152
|
-
/**
|
|
153
|
-
* Fetch the full rating synthesis for a PR.
|
|
154
|
-
* This is the rich analysis data shown on the Haystack feed — includes
|
|
155
|
-
* verdict, rating, structured findings, verified bugs, and agent fix prompts.
|
|
156
|
-
*/
|
|
157
|
-
export interface AutoFixManifest {
|
|
158
|
-
jobId: string;
|
|
159
|
-
repo: string;
|
|
160
|
-
prNumber: number;
|
|
161
|
-
fixedItems: Array<{
|
|
162
|
-
id?: string;
|
|
163
|
-
category: string;
|
|
164
|
-
summary: string;
|
|
165
|
-
}>;
|
|
166
|
-
leftForReview: Array<{
|
|
167
|
-
id?: string;
|
|
168
|
-
category: string;
|
|
169
|
-
summary: string;
|
|
170
|
-
reason: string;
|
|
171
|
-
}>;
|
|
172
|
-
timestamp: string;
|
|
173
|
-
resultSha?: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Null means "artifact does not exist (yet)" — 404s and transient
|
|
177
|
-
* network/parse failures. Auth failures (401/403) THROW a classified
|
|
178
|
-
* HaystackApiError instead: collapsing them into null used to make an
|
|
179
|
-
* expired token read as "not available yet — try again in a moment",
|
|
180
|
-
* sending agents into a retry loop when the fix was `haystack login`.
|
|
181
|
-
*/
|
|
182
|
-
export declare function fetchAutoFixManifest(owner: string, repo: string, prNumber: number, token?: string): Promise<AutoFixManifest | null>;
|
|
183
|
-
/**
|
|
184
|
-
* Null means "synthesis does not exist (yet)". Auth failures (401/403) THROW
|
|
185
|
-
* a classified HaystackApiError — see fetchAutoFixManifest for why.
|
|
186
|
-
*/
|
|
187
|
-
export declare function fetchRatingSynthesis(owner: string, repo: string, prNumber: number, token?: string): Promise<RatingSynthesis | null>;
|
package/dist/utils/auth.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Path to a long-lived `hsk_live_*` token created by `haystack login --headless`.
|
|
3
|
-
* If present (or HAYSTACK_CLI_TOKEN is set), it takes priority over the
|
|
4
|
-
* regular OAuth credentials. CI environments use this exclusively.
|
|
5
|
-
*
|
|
6
|
-
* Why a separate file (not just an entry in credentials.json):
|
|
7
|
-
* 1. Different lifecycle — the OAuth flow renews + refreshes; hsk_live
|
|
8
|
-
* tokens are mint-once-revoke-never until explicit revocation.
|
|
9
|
-
* 2. Easier to commit accidentally and easier to .gitignore (one file).
|
|
10
|
-
* 3. Different shape — hsk_live tokens carry server-side scope that the
|
|
11
|
-
* OAuth token doesn't, and we don't want to model both in one schema.
|
|
12
|
-
*/
|
|
13
|
-
export declare const HEADLESS_TOKEN_FILE: string;
|
|
14
|
-
interface HeadlessTokenFile {
|
|
15
|
-
token: string;
|
|
16
|
-
id?: string;
|
|
17
|
-
label?: string;
|
|
18
|
-
created_at?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface StoredAccount {
|
|
21
|
-
github_token: string;
|
|
22
|
-
created_at: string;
|
|
23
|
-
}
|
|
24
|
-
export interface CredentialsStore {
|
|
25
|
-
version: 2;
|
|
26
|
-
activeLogin: string | null;
|
|
27
|
-
accounts: Record<string, StoredAccount>;
|
|
28
|
-
repoDefaults: Record<string, string>;
|
|
29
|
-
}
|
|
30
|
-
export interface GitHubUser {
|
|
31
|
-
login: string;
|
|
32
|
-
id: number;
|
|
33
|
-
}
|
|
34
|
-
export type VerifyGitHubTokenResult = {
|
|
35
|
-
status: 'ok';
|
|
36
|
-
user: GitHubUser;
|
|
37
|
-
} | {
|
|
38
|
-
status: 'invalid';
|
|
39
|
-
} | {
|
|
40
|
-
status: 'error';
|
|
41
|
-
message: string;
|
|
42
|
-
};
|
|
43
|
-
export interface ResolveAuthOptions {
|
|
44
|
-
preferredLogin?: string;
|
|
45
|
-
owner?: string;
|
|
46
|
-
repo?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface ResolvedAuthContext {
|
|
49
|
-
login: string;
|
|
50
|
-
token: string;
|
|
51
|
-
source: 'preferred' | 'repo-default' | 'active';
|
|
52
|
-
}
|
|
53
|
-
export interface AccountSummary {
|
|
54
|
-
login: string;
|
|
55
|
-
createdAt: string;
|
|
56
|
-
isActive: boolean;
|
|
57
|
-
repoDefaultCount: number;
|
|
58
|
-
}
|
|
59
|
-
export declare function verifyGitHubToken(token: string): Promise<VerifyGitHubTokenResult>;
|
|
60
|
-
export declare function loadCredentialsStore(): Promise<CredentialsStore>;
|
|
61
|
-
export declare function saveAuthenticatedToken(token: string): Promise<GitHubUser>;
|
|
62
|
-
export declare function listStoredAccounts(): Promise<AccountSummary[]>;
|
|
63
|
-
export declare function setActiveAccount(login: string): Promise<void>;
|
|
64
|
-
export declare function removeAccount(login?: string): Promise<string | null>;
|
|
65
|
-
export declare function getActiveLogin(): Promise<string | null>;
|
|
66
|
-
export declare function getRepoDefaultAccount(owner: string, repo: string): Promise<string | null>;
|
|
67
|
-
export declare function setRepoDefaultAccount(owner: string, repo: string, login: string): Promise<void>;
|
|
68
|
-
/** Thrown by {@link resolveAuthContext} when no usable credential is found. */
|
|
69
|
-
export declare class NotLoggedInError extends Error {
|
|
70
|
-
constructor(message?: string);
|
|
71
|
-
}
|
|
72
|
-
/** Read the headless CLI token if one is configured. Env var wins over the
|
|
73
|
-
* on-disk file so CI can override without touching the home directory. */
|
|
74
|
-
export declare function readHeadlessToken(): Promise<HeadlessTokenFile | null>;
|
|
75
|
-
export declare function writeHeadlessToken(record: HeadlessTokenFile): Promise<string>;
|
|
76
|
-
export declare function clearHeadlessToken(): Promise<void>;
|
|
77
|
-
export declare function resolveAuthContext(options?: ResolveAuthOptions): Promise<ResolvedAuthContext>;
|
|
78
|
-
export declare function loadToken(options?: ResolveAuthOptions): Promise<string | null>;
|
|
79
|
-
export {};
|
package/dist/utils/config.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration file utilities
|
|
3
|
-
*/
|
|
4
|
-
import type { HaystackConfig } from '../types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Find the config file by walking up the directory tree
|
|
7
|
-
*/
|
|
8
|
-
export declare function findConfigPath(startDir?: string): Promise<string | null>;
|
|
9
|
-
/**
|
|
10
|
-
* Load and parse the config file
|
|
11
|
-
*/
|
|
12
|
-
export declare function loadConfig(configPath?: string): Promise<HaystackConfig | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Save config to file
|
|
15
|
-
*/
|
|
16
|
-
export declare function saveConfig(config: HaystackConfig, configPath?: string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Check if config exists
|
|
19
|
-
*/
|
|
20
|
-
export declare function configExists(startDir?: string): Promise<boolean>;
|
|
21
|
-
/**
|
|
22
|
-
* Get the project root (directory containing .haystack.json or current dir)
|
|
23
|
-
*/
|
|
24
|
-
export declare function getProjectRoot(): Promise<string>;
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client for the design-verifier trigger route on the auth worker.
|
|
3
|
-
*
|
|
4
|
-
* The worker owns everything sensitive: it authenticates the CLI token,
|
|
5
|
-
* enforces hsk_live repo scope, resolves the PR's base/head SHAs via the
|
|
6
|
-
* GitHub App install token, and forwards to the AWS design-verifier API with
|
|
7
|
-
* the server-side shared secret. This client just POSTs and interprets the
|
|
8
|
-
* response.
|
|
9
|
-
*/
|
|
10
|
-
import { type DesignVerifierHistoryReport } from './design-verifier-history.js';
|
|
11
|
-
export type DesignVerifierTriggerResult = {
|
|
12
|
-
status: 'started' | 'queued' | 'duplicate';
|
|
13
|
-
runId: string;
|
|
14
|
-
} | {
|
|
15
|
-
status: 'denied';
|
|
16
|
-
message: string;
|
|
17
|
-
} | {
|
|
18
|
-
status: 'rate_limited';
|
|
19
|
-
message: string;
|
|
20
|
-
} | {
|
|
21
|
-
status: 'unavailable';
|
|
22
|
-
message: string;
|
|
23
|
-
} | {
|
|
24
|
-
status: 'error';
|
|
25
|
-
message: string;
|
|
26
|
-
};
|
|
27
|
-
export interface DesignVerifierCommandSpec {
|
|
28
|
-
cwd: string;
|
|
29
|
-
argv: string[];
|
|
30
|
-
env: Record<string, string>;
|
|
31
|
-
timeoutMs?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface DesignVerifierExecutionDiagnostic {
|
|
34
|
-
diagnosticId: string;
|
|
35
|
-
kind: string;
|
|
36
|
-
message: string;
|
|
37
|
-
type?: string;
|
|
38
|
-
code?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface DesignVerifierExecutionSummary {
|
|
41
|
-
side: 'base1' | 'base2' | 'head';
|
|
42
|
-
status: 'completed' | 'failed' | 'missing';
|
|
43
|
-
commandExitCode: number | null;
|
|
44
|
-
durationMs: number | null;
|
|
45
|
-
scenarioError: string | null;
|
|
46
|
-
diagnostics: DesignVerifierExecutionDiagnostic[];
|
|
47
|
-
diagnosticsOmitted: number;
|
|
48
|
-
outputExcerpt: Array<{
|
|
49
|
-
stream: 'stdout' | 'stderr' | 'system' | 'output';
|
|
50
|
-
text: string;
|
|
51
|
-
}>;
|
|
52
|
-
outputLinesOmitted: number;
|
|
53
|
-
traceArtifact: string;
|
|
54
|
-
outputArtifact: string;
|
|
55
|
-
}
|
|
56
|
-
export type DesignVerifierUniverseRole = 'control-before' | 'before' | 'after';
|
|
57
|
-
export interface DesignVerifierUniverseSummary {
|
|
58
|
-
version: 'dv-case-universe-summary-v1';
|
|
59
|
-
universeId: string;
|
|
60
|
-
caseRunId: string;
|
|
61
|
-
caseId: string;
|
|
62
|
-
role: DesignVerifierUniverseRole;
|
|
63
|
-
revision: string;
|
|
64
|
-
capabilities: Array<'inspect' | 'query' | 'replay' | 'exec'>;
|
|
65
|
-
lease: {
|
|
66
|
-
state: 'leased' | 'released';
|
|
67
|
-
expiresAt: string | null;
|
|
68
|
-
available: boolean;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export interface DesignVerifierUniverseAction {
|
|
72
|
-
version: 'dv-universe-action-v1';
|
|
73
|
-
actionId: string;
|
|
74
|
-
runId: string;
|
|
75
|
-
caseId: string;
|
|
76
|
-
universe: DesignVerifierUniverseRole;
|
|
77
|
-
universeId: string;
|
|
78
|
-
action: 'replay' | 'exec';
|
|
79
|
-
command: {
|
|
80
|
-
cwd: string;
|
|
81
|
-
argv: string[];
|
|
82
|
-
timeoutMs: number;
|
|
83
|
-
};
|
|
84
|
-
status: 'queued' | 'running' | 'completed' | 'failed';
|
|
85
|
-
createdAt: string;
|
|
86
|
-
startedAt: string | null;
|
|
87
|
-
finishedAt: string | null;
|
|
88
|
-
result: {
|
|
89
|
-
exitCode: number | null;
|
|
90
|
-
stdout: string;
|
|
91
|
-
stderr: string;
|
|
92
|
-
stdoutOmittedBytes: number;
|
|
93
|
-
stderrOmittedBytes: number;
|
|
94
|
-
durationMs: number;
|
|
95
|
-
} | null;
|
|
96
|
-
error: string | null;
|
|
97
|
-
}
|
|
98
|
-
export interface DesignVerifierStageTiming {
|
|
99
|
-
stage: 'prepare' | 'bake' | 'blast-radius' | 'prefetch' | 'case-design' | 'verdict';
|
|
100
|
-
status: string;
|
|
101
|
-
durationMs: number | null;
|
|
102
|
-
completedAt: string | null;
|
|
103
|
-
source: 'phase-artifact' | 'phase-artifact-clock' | 'cache-hit' | 'missing';
|
|
104
|
-
breakdownMs: Record<string, number>;
|
|
105
|
-
pollCount?: number;
|
|
106
|
-
}
|
|
107
|
-
export interface DesignVerifierTimingSummary {
|
|
108
|
-
admissionMs: number | null;
|
|
109
|
-
pipelineDurationMs: number | null;
|
|
110
|
-
recordedStageMs: number;
|
|
111
|
-
unattributedMs: number | null;
|
|
112
|
-
stages: DesignVerifierStageTiming[];
|
|
113
|
-
}
|
|
114
|
-
export interface DesignVerifierStatusResult {
|
|
115
|
-
version: 'dv-cli-status-v1';
|
|
116
|
-
runId: string;
|
|
117
|
-
owner: string;
|
|
118
|
-
repo: string;
|
|
119
|
-
pr: number;
|
|
120
|
-
baseSha: string | null;
|
|
121
|
-
headSha: string | null;
|
|
122
|
-
status: string;
|
|
123
|
-
stage: string | null;
|
|
124
|
-
createdAt: string | null;
|
|
125
|
-
startedAt: string | null;
|
|
126
|
-
finishedAt: string | null;
|
|
127
|
-
durationMs: number | null;
|
|
128
|
-
error: string | null;
|
|
129
|
-
result?: {
|
|
130
|
-
verdict: Record<string, any>;
|
|
131
|
-
cases: Array<Record<string, any>>;
|
|
132
|
-
scenarios: Array<Record<string, any> & {
|
|
133
|
-
executions?: DesignVerifierExecutionSummary[];
|
|
134
|
-
universes?: DesignVerifierUniverseSummary[];
|
|
135
|
-
}>;
|
|
136
|
-
changedFiles: string[];
|
|
137
|
-
timings?: DesignVerifierTimingSummary;
|
|
138
|
-
probes: Array<{
|
|
139
|
-
caseId: string;
|
|
140
|
-
title: string;
|
|
141
|
-
files: string[];
|
|
142
|
-
validate: DesignVerifierCommandSpec | null;
|
|
143
|
-
run: DesignVerifierCommandSpec | null;
|
|
144
|
-
}>;
|
|
145
|
-
replay: {
|
|
146
|
-
artifactPrefix: string;
|
|
147
|
-
keys: Record<string, string>;
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
export type DesignVerifierStatusFetchResult = {
|
|
152
|
-
status: 'ok';
|
|
153
|
-
run: DesignVerifierStatusResult;
|
|
154
|
-
} | {
|
|
155
|
-
status: 'not_found' | 'denied' | 'unavailable' | 'error';
|
|
156
|
-
message: string;
|
|
157
|
-
};
|
|
158
|
-
export type DesignVerifierUniverseActionFetchResult = {
|
|
159
|
-
status: 'ok';
|
|
160
|
-
action: DesignVerifierUniverseAction;
|
|
161
|
-
} | {
|
|
162
|
-
status: 'not_found' | 'denied' | 'unavailable' | 'error';
|
|
163
|
-
message: string;
|
|
164
|
-
};
|
|
165
|
-
export declare function startDesignVerifierUniverseAction(owner: string, repo: string, prNumber: number, runId: string, token: string, request: {
|
|
166
|
-
caseId: string;
|
|
167
|
-
universe: DesignVerifierUniverseRole;
|
|
168
|
-
action: 'replay' | 'exec';
|
|
169
|
-
argv?: string[];
|
|
170
|
-
cwd?: string;
|
|
171
|
-
timeoutMs?: number;
|
|
172
|
-
}): Promise<DesignVerifierUniverseActionFetchResult>;
|
|
173
|
-
export declare function getDesignVerifierUniverseAction(owner: string, repo: string, prNumber: number, runId: string, actionId: string, token: string): Promise<DesignVerifierUniverseActionFetchResult>;
|
|
174
|
-
export declare function waitForDesignVerifierUniverseAction(owner: string, repo: string, prNumber: number, runId: string, actionId: string, token: string, options?: {
|
|
175
|
-
intervalMs?: number;
|
|
176
|
-
timeoutMs?: number;
|
|
177
|
-
}): Promise<{
|
|
178
|
-
status: 'terminal';
|
|
179
|
-
action: DesignVerifierUniverseAction;
|
|
180
|
-
} | {
|
|
181
|
-
status: 'timeout';
|
|
182
|
-
} | {
|
|
183
|
-
status: 'error';
|
|
184
|
-
message: string;
|
|
185
|
-
}>;
|
|
186
|
-
export declare function triggerDesignVerifier(owner: string, repo: string, prNumber: number, token: string): Promise<DesignVerifierTriggerResult>;
|
|
187
|
-
export declare function getDesignVerifierStatus(owner: string, repo: string, prNumber: number, runId: string, token: string): Promise<DesignVerifierStatusFetchResult>;
|
|
188
|
-
export declare function getDesignVerifierHistory(owner: string, repo: string, token: string, limit?: number): Promise<{
|
|
189
|
-
status: 'ok';
|
|
190
|
-
history: DesignVerifierHistoryReport;
|
|
191
|
-
} | {
|
|
192
|
-
status: 'denied' | 'unavailable' | 'error';
|
|
193
|
-
message: string;
|
|
194
|
-
}>;
|
|
195
|
-
export declare function waitForDesignVerifier(owner: string, repo: string, prNumber: number, runId: string, token: string, options?: {
|
|
196
|
-
intervalMs?: number;
|
|
197
|
-
timeoutMs?: number;
|
|
198
|
-
onProgress?: (run: DesignVerifierStatusResult) => void;
|
|
199
|
-
sleep?: (ms: number) => Promise<void>;
|
|
200
|
-
}): Promise<{
|
|
201
|
-
status: 'terminal';
|
|
202
|
-
run: DesignVerifierStatusResult;
|
|
203
|
-
} | {
|
|
204
|
-
status: 'timeout';
|
|
205
|
-
} | {
|
|
206
|
-
status: 'error';
|
|
207
|
-
message: string;
|
|
208
|
-
}>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** FIXED CONTRACT: historical execution health, never a score for bug-detection accuracy. */
|
|
2
|
-
export type DesignVerifierHistoryOutcome = 'healthy' | 'degraded' | 'invalid' | 'failed' | 'unknown';
|
|
3
|
-
export interface DesignVerifierHistoryRun {
|
|
4
|
-
runId: string;
|
|
5
|
-
pr: number;
|
|
6
|
-
baseSha: string | null;
|
|
7
|
-
headSha: string | null;
|
|
8
|
-
createdAt: string;
|
|
9
|
-
finishedAt: string | null;
|
|
10
|
-
status: string;
|
|
11
|
-
outcome: DesignVerifierHistoryOutcome;
|
|
12
|
-
admitted: number | null;
|
|
13
|
-
losses: Array<{
|
|
14
|
-
code: string;
|
|
15
|
-
owner: string;
|
|
16
|
-
impact: 'degraded' | 'invalid';
|
|
17
|
-
count: number;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
export interface DesignVerifierHistoryReport {
|
|
21
|
-
version: 'dv-cli-history-v1';
|
|
22
|
-
owner: string;
|
|
23
|
-
repo: string;
|
|
24
|
-
retentionDays: number;
|
|
25
|
-
limit: number;
|
|
26
|
-
runs: DesignVerifierHistoryRun[];
|
|
27
|
-
summary: {
|
|
28
|
-
total: number;
|
|
29
|
-
healthy: number;
|
|
30
|
-
degraded: number;
|
|
31
|
-
invalid: number;
|
|
32
|
-
failed: number;
|
|
33
|
-
unknown: number;
|
|
34
|
-
usableRate: number | null;
|
|
35
|
-
topBlockers: Array<{
|
|
36
|
-
code: string;
|
|
37
|
-
affectedRuns: number;
|
|
38
|
-
}>;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export declare function isDesignVerifierHistoryReport(value: unknown, expected: {
|
|
42
|
-
owner: string;
|
|
43
|
-
repo: string;
|
|
44
|
-
limit: number;
|
|
45
|
-
}): value is DesignVerifierHistoryReport;
|
|
46
|
-
export declare function formatDesignVerifierHistory(report: DesignVerifierHistoryReport): string;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { DesignVerifierCommandSpec, DesignVerifierExecutionSummary, DesignVerifierStatusResult, DesignVerifierTimingSummary, DesignVerifierUniverseSummary } from './design-verifier-api.js';
|
|
2
|
-
export type DesignVerifierAgentVerdict = 'fix_confirmed' | 'anomaly_candidate' | 'no_unexpected_change' | 'inconclusive';
|
|
3
|
-
export interface DesignVerifierAgentCase {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
story: string;
|
|
7
|
-
expectedHead: string;
|
|
8
|
-
verdict: 'confirmed' | 'finding' | 'clean' | 'inconclusive';
|
|
9
|
-
findingKind: string | null;
|
|
10
|
-
findingKinds: string[];
|
|
11
|
-
baseStable: boolean | null;
|
|
12
|
-
observations: Array<{
|
|
13
|
-
path: string;
|
|
14
|
-
base: unknown;
|
|
15
|
-
baseRepeat: unknown;
|
|
16
|
-
head: unknown;
|
|
17
|
-
controlObservedAtSamePath: boolean;
|
|
18
|
-
controlObservedAtAncestorPath: boolean;
|
|
19
|
-
controlObservedAtDescendantPath: boolean;
|
|
20
|
-
}>;
|
|
21
|
-
generatedFiles: string[];
|
|
22
|
-
executedCommand: DesignVerifierCommandSpec | null;
|
|
23
|
-
executions: DesignVerifierExecutionSummary[];
|
|
24
|
-
universes: DesignVerifierUniverseSummary[];
|
|
25
|
-
infrastructure: {
|
|
26
|
-
verified: boolean;
|
|
27
|
-
recipeId: string | null;
|
|
28
|
-
freshInstances: number;
|
|
29
|
-
baseRepeat: string | null;
|
|
30
|
-
errors: string[];
|
|
31
|
-
} | null;
|
|
32
|
-
}
|
|
33
|
-
export interface DesignVerifierRunHealthLoss {
|
|
34
|
-
code: string;
|
|
35
|
-
owner: 'harness' | 'case';
|
|
36
|
-
impact: 'degraded' | 'invalid';
|
|
37
|
-
count: number;
|
|
38
|
-
caseIds: string[];
|
|
39
|
-
obligationIds: string[];
|
|
40
|
-
slotIds: string[];
|
|
41
|
-
sides: string[];
|
|
42
|
-
}
|
|
43
|
-
export interface DesignVerifierRunHealth {
|
|
44
|
-
version: 'dv-run-health-v1';
|
|
45
|
-
status: 'healthy' | 'degraded' | 'invalid';
|
|
46
|
-
admitted: number;
|
|
47
|
-
losses: DesignVerifierRunHealthLoss[];
|
|
48
|
-
}
|
|
49
|
-
export interface DesignVerifierAgentReport {
|
|
50
|
-
ok: boolean;
|
|
51
|
-
status: 'complete' | 'failed';
|
|
52
|
-
verdict: DesignVerifierAgentVerdict;
|
|
53
|
-
headline: string;
|
|
54
|
-
explanation: string;
|
|
55
|
-
runId: string;
|
|
56
|
-
repository: string;
|
|
57
|
-
pullRequest: number;
|
|
58
|
-
revisions: {
|
|
59
|
-
base: string | null;
|
|
60
|
-
head: string | null;
|
|
61
|
-
};
|
|
62
|
-
durationMs: number | null;
|
|
63
|
-
timings: DesignVerifierTimingSummary | null;
|
|
64
|
-
changedFiles: string[];
|
|
65
|
-
cases: DesignVerifierAgentCase[];
|
|
66
|
-
runHealth: DesignVerifierRunHealth | null;
|
|
67
|
-
inspectCommand: string;
|
|
68
|
-
replay: Record<string, unknown> | null;
|
|
69
|
-
error: string | null;
|
|
70
|
-
exitCode: 0 | 1 | 2;
|
|
71
|
-
}
|
|
72
|
-
export declare function buildDesignVerifierAgentReport(run: DesignVerifierStatusResult): DesignVerifierAgentReport;
|
|
73
|
-
export declare function formatDesignVerifierAgentReport(report: DesignVerifierAgentReport): string;
|
|
74
|
-
export declare function designVerifierStageLabel(stage: string | null): string;
|
package/dist/utils/detect.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project detection utilities
|
|
3
|
-
*
|
|
4
|
-
* Auto-detects framework, package manager, monorepo structure, services,
|
|
5
|
-
* and inter-service dependencies from proxy configurations.
|
|
6
|
-
*/
|
|
7
|
-
import type { DetectedProject, DetectedService, ProxyDependency } from '../types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Detect project configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare function detectProject(rootDir?: string): Promise<DetectedProject>;
|
|
12
|
-
/**
|
|
13
|
-
* Detect proxy dependencies from vite.config.ts/js
|
|
14
|
-
*
|
|
15
|
-
* Parses the vite config file to find proxy targets that point to localhost,
|
|
16
|
-
* which indicate dependencies on other local services.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // vite.config.ts with proxy
|
|
20
|
-
* server: {
|
|
21
|
-
* proxy: {
|
|
22
|
-
* '/api/review-chat': {
|
|
23
|
-
* target: 'http://localhost:8787',
|
|
24
|
-
* }
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* // Returns: [{ path: '/api/review-chat', port: 8787, host: 'localhost' }]
|
|
28
|
-
*/
|
|
29
|
-
export declare function detectProxyDependencies(rootDir: string): Promise<ProxyDependency[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Match proxy dependencies to detected services
|
|
32
|
-
*
|
|
33
|
-
* Given a list of proxy targets (ports) and detected services,
|
|
34
|
-
* determines which services are dependencies based on port matching.
|
|
35
|
-
*/
|
|
36
|
-
export declare function matchProxyToServices(proxyDeps: ProxyDependency[], services: DetectedService[]): Map<string, string[]>;
|
|
37
|
-
/**
|
|
38
|
-
* Suggest depends_on for services based on proxy configuration
|
|
39
|
-
*
|
|
40
|
-
* For the main service (usually frontend), detect if it proxies to other local services
|
|
41
|
-
* and suggest those as dependencies.
|
|
42
|
-
*/
|
|
43
|
-
export declare function suggestServiceDependencies(rootDir: string, services: DetectedService[]): Promise<DetectedService[]>;
|