@haystackeditor/cli 0.15.30 → 0.16.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 (135) hide show
  1. package/README.md +111 -60
  2. package/dist/assets/hooks/scripts/commit-msg.sh +3 -0
  3. package/dist/assets/hooks/scripts/post-commit.sh +3 -0
  4. package/dist/assets/hooks/scripts/pre-commit.sh +11 -6
  5. package/dist/assets/hooks/scripts/pre-push.sh +3 -0
  6. package/dist/assets/hooks/scripts/prepare-commit-msg.sh +3 -0
  7. package/dist/commands/case-batch-contract.js +608 -0
  8. package/dist/commands/case-batch.js +713 -0
  9. package/dist/commands/cloud-verifier-identity-census.js +5 -2
  10. package/dist/commands/combination-search-hook.js +139 -0
  11. package/dist/commands/design-verify.js +27 -1
  12. package/dist/commands/dismiss.js +2 -1
  13. package/dist/commands/hooks.js +66 -7
  14. package/dist/commands/install-session-hooks.js +131 -44
  15. package/dist/commands/policy.js +32 -45
  16. package/dist/commands/precompute-delivery.js +6 -1
  17. package/dist/commands/scaffold-provisional-universe.js +8 -10
  18. package/dist/commands/setup.js +32 -10
  19. package/dist/commands/submit.js +7 -2
  20. package/dist/commands/telemetry.js +17 -2
  21. package/dist/commands/triage.js +2 -1
  22. package/dist/commands/verify-explore.js +1 -0
  23. package/dist/commands/verify-history.js +152 -0
  24. package/dist/commands/verify-hosted-mcp.js +3 -12
  25. package/dist/commands/verify-hosted-reproducibility.js +49 -547
  26. package/dist/commands/verify-hosted.js +180 -163
  27. package/dist/commands/verify-precompute.js +57 -10
  28. package/dist/commands/verify.js +51 -139
  29. package/dist/index.js +264 -348
  30. package/dist/lazy.js +8 -0
  31. package/dist/schema.js +1 -0
  32. package/dist/tools/detect.js +3 -24
  33. package/dist/triage/prompts.js +46 -45
  34. package/dist/triage/runner.js +119 -33
  35. package/dist/types/verify-history.js +1 -0
  36. package/dist/types.js +3 -3
  37. package/dist/utils/auth.js +14 -2
  38. package/dist/utils/design-verifier-api.js +23 -0
  39. package/dist/utils/design-verifier-history.js +79 -0
  40. package/dist/utils/git.js +60 -29
  41. package/dist/utils/github-api.js +14 -1
  42. package/dist/utils/haystack-api.js +26 -7
  43. package/dist/utils/hooks.js +43 -6
  44. package/dist/utils/prompter.js +25 -10
  45. package/dist/utils/safe-write.js +31 -0
  46. package/dist/utils/secret-paths.js +115 -0
  47. package/dist/utils/secrets.js +0 -1
  48. package/dist/utils/telemetry.js +34 -14
  49. package/dist/utils/update-check.js +151 -0
  50. package/package.json +18 -14
  51. package/schemas/case-batch.v1.json +184 -0
  52. package/schemas/cloud-verifier.v1.json +55 -100
  53. package/dist/commands/ask.d.ts +0 -14
  54. package/dist/commands/cloud-verifier-behaviors.d.ts +0 -27
  55. package/dist/commands/cloud-verifier-data-store-census.d.ts +0 -47
  56. package/dist/commands/cloud-verifier-data-store-drift.d.ts +0 -42
  57. package/dist/commands/cloud-verifier-identity-census.d.ts +0 -88
  58. package/dist/commands/cloud-verifier-materialization.d.ts +0 -16
  59. package/dist/commands/cloud-verifier-pascal-selector-census.d.ts +0 -29
  60. package/dist/commands/cloud-verifier-python-manifest-selector-census.d.ts +0 -27
  61. package/dist/commands/cloud-verifier-specialized-operational-census.d.ts +0 -51
  62. package/dist/commands/cloud-verifier-universe.d.ts +0 -31
  63. package/dist/commands/config.d.ts +0 -46
  64. package/dist/commands/design-verify.d.ts +0 -31
  65. package/dist/commands/dismiss.d.ts +0 -29
  66. package/dist/commands/hooks.d.ts +0 -13
  67. package/dist/commands/inbox.d.ts +0 -65
  68. package/dist/commands/init.d.ts +0 -10
  69. package/dist/commands/install-session-hooks.d.ts +0 -17
  70. package/dist/commands/login.d.ts +0 -8
  71. package/dist/commands/mcp.d.ts +0 -1
  72. package/dist/commands/policy.d.ts +0 -31
  73. package/dist/commands/pr-status.d.ts +0 -144
  74. package/dist/commands/pr.d.ts +0 -40
  75. package/dist/commands/precompute-delivery-contract.d.ts +0 -68
  76. package/dist/commands/precompute-delivery.d.ts +0 -20
  77. package/dist/commands/prepare-universe-review.d.ts +0 -115
  78. package/dist/commands/production-source-deny-policy.d.ts +0 -15
  79. package/dist/commands/request-review.d.ts +0 -26
  80. package/dist/commands/review.d.ts +0 -25
  81. package/dist/commands/rules.d.ts +0 -4
  82. package/dist/commands/scaffold-provisional-universe.d.ts +0 -468
  83. package/dist/commands/schema-cmd.d.ts +0 -2
  84. package/dist/commands/setup.d.ts +0 -28
  85. package/dist/commands/skills.d.ts +0 -8
  86. package/dist/commands/status.d.ts +0 -4
  87. package/dist/commands/submit.d.ts +0 -30
  88. package/dist/commands/system-map.d.ts +0 -42
  89. package/dist/commands/telemetry.d.ts +0 -53
  90. package/dist/commands/tokens.d.ts +0 -14
  91. package/dist/commands/triage.d.ts +0 -35
  92. package/dist/commands/verify-core.d.ts +0 -449
  93. package/dist/commands/verify-core.js +0 -789
  94. package/dist/commands/verify-explore.d.ts +0 -14
  95. package/dist/commands/verify-hosted-mcp.d.ts +0 -12
  96. package/dist/commands/verify-hosted-reproducibility.d.ts +0 -90
  97. package/dist/commands/verify-hosted.d.ts +0 -92
  98. package/dist/commands/verify-mcp.d.ts +0 -8
  99. package/dist/commands/verify-mcp.js +0 -517
  100. package/dist/commands/verify-ops.d.ts +0 -158
  101. package/dist/commands/verify-ops.js +0 -1148
  102. package/dist/commands/verify-precompute.d.ts +0 -30
  103. package/dist/commands/verify-reproducibility.d.ts +0 -85
  104. package/dist/commands/verify-reproducibility.js +0 -494
  105. package/dist/commands/verify-reseal.d.ts +0 -9
  106. package/dist/commands/verify-reseal.js +0 -148
  107. package/dist/commands/verify-sandboxes.d.ts +0 -95
  108. package/dist/commands/verify-sandboxes.js +0 -352
  109. package/dist/commands/verify.d.ts +0 -28
  110. package/dist/commands/webhooks.d.ts +0 -30
  111. package/dist/index.d.ts +0 -22
  112. package/dist/schema.d.ts +0 -28
  113. package/dist/states.d.ts +0 -29
  114. package/dist/tools/detect.d.ts +0 -50
  115. package/dist/triage/prompts.d.ts +0 -24
  116. package/dist/triage/runner.d.ts +0 -34
  117. package/dist/triage/types.d.ts +0 -42
  118. package/dist/types.d.ts +0 -1684
  119. package/dist/utils/action-output.d.ts +0 -24
  120. package/dist/utils/analysis-api.d.ts +0 -187
  121. package/dist/utils/auth.d.ts +0 -79
  122. package/dist/utils/config.d.ts +0 -24
  123. package/dist/utils/design-verifier-api.d.ts +0 -200
  124. package/dist/utils/design-verifier-result.d.ts +0 -74
  125. package/dist/utils/detect.d.ts +0 -43
  126. package/dist/utils/git.d.ts +0 -135
  127. package/dist/utils/github-api.d.ts +0 -104
  128. package/dist/utils/haystack-api.d.ts +0 -37
  129. package/dist/utils/hooks.d.ts +0 -12
  130. package/dist/utils/pending-state.d.ts +0 -40
  131. package/dist/utils/pr-ref.d.ts +0 -27
  132. package/dist/utils/prompter.d.ts +0 -85
  133. package/dist/utils/secrets.d.ts +0 -47
  134. package/dist/utils/telemetry.d.ts +0 -19
  135. /package/dist/commands/{precompute-delivery-worker.d.ts → combination-search-hook-contract.js} +0 -0
@@ -1,135 +0,0 @@
1
- /**
2
- * Git utilities for haystack submit command.
3
- *
4
- * Provides functions for git operations: branch management, push, remote parsing.
5
- */
6
- export { findGitRoot } from './hooks.js';
7
- export interface GitRemoteInfo {
8
- owner: string;
9
- repo: string;
10
- remoteName: string;
11
- }
12
- export interface GitBranchInfo {
13
- currentBranch: string;
14
- defaultBranch: string;
15
- isClean: boolean;
16
- hasUncommittedChanges: boolean;
17
- hasUnpushedCommits: boolean;
18
- }
19
- /**
20
- * Get the current branch name
21
- */
22
- export declare function getCurrentBranch(): string;
23
- /**
24
- * Get the default branch (main or master)
25
- */
26
- export declare function getDefaultBranch(): string;
27
- /**
28
- * Check if working directory has uncommitted changes
29
- */
30
- export declare function hasUncommittedChanges(): boolean;
31
- /**
32
- * Check if current branch has unpushed commits
33
- */
34
- export declare function hasUnpushedCommits(): boolean;
35
- /**
36
- * Get comprehensive branch info
37
- */
38
- export declare function getBranchInfo(): GitBranchInfo;
39
- /**
40
- * Create a new branch from current HEAD
41
- */
42
- export declare function createBranch(branchName: string): void;
43
- /**
44
- * Check if a branch exists locally
45
- */
46
- export declare function branchExists(branchName: string): boolean;
47
- /**
48
- * Check if a branch exists on remote
49
- */
50
- export declare function remoteBranchExists(remoteName: string, branchName: string): boolean;
51
- /**
52
- * Checkout an existing branch
53
- */
54
- export declare function checkoutBranch(branchName: string): void;
55
- export interface PushAuth {
56
- token: string;
57
- }
58
- /**
59
- * Push current branch to remote with upstream tracking.
60
- *
61
- * When `auth` is provided, the push is authenticated with the given GitHub
62
- * token via GIT_ASKPASS against an explicit HTTPS URL, independent of the
63
- * user's ambient git credential helper and independent of whatever
64
- * `remote.<name>.url` / `pushurl` they have configured. Remote-tracking
65
- * refs are then seeded locally so upstream tracking (`-u`-style) works on
66
- * first push. `.git/config` is never touched.
67
- *
68
- * Without `auth`, falls back to `git push -u <remote>` using ambient creds.
69
- */
70
- export declare function pushBranch(remoteName: string, branchName: string, auth?: PushAuth): void;
71
- /** Thrown when a git remote URL is not a recognized GitHub SSH/HTTPS URL. */
72
- export declare class UnsupportedRemoteUrlError extends Error {
73
- constructor(url: string);
74
- }
75
- /**
76
- * Parse remote URL to extract owner and repo
77
- * Supports both SSH and HTTPS URLs
78
- */
79
- export declare function parseRemoteUrl(remoteName?: string): GitRemoteInfo;
80
- /**
81
- * Get the last commit message (first line only).
82
- *
83
- * Throws instead of guessing: this feeds the default PR title, and the old
84
- * silent fallback ('Update') shipped meaningless titles when git failed.
85
- */
86
- export declare function getLastCommitMessage(): string;
87
- /**
88
- * Get the last commit SHA (short)
89
- */
90
- export declare function getLastCommitSha(): string;
91
- /**
92
- * Get full commit messages (subject + body) for all commits since base branch.
93
- * Returns the combined log, or empty string if no commits or on error.
94
- */
95
- export declare function getCommitMessagesSinceBase(baseBranch: string): string;
96
- interface ResolveDiffBaseRefOptions {
97
- cwd?: string;
98
- timeoutMs?: number;
99
- }
100
- /**
101
- * Resolve the git ref to diff a PR branch against for review.
102
- *
103
- * A bare local `<base>` ref is frequently stale (not checked out or pulled in a
104
- * while). When it sits behind HEAD's true fork point, the three-dot merge-base
105
- * jumps far back in history and inflates the review diff to include code from
106
- * already-merged PRs — reviewers then mis-attribute pre-existing code to this
107
- * PR. So we prefer the freshly-fetched remote base. This mirrors
108
- * getCommitMessagesSinceBase, which already compares against the remote base.
109
- *
110
- * Returns a fully-qualified ref (`refs/remotes/origin/<base>` or
111
- * `refs/heads/<base>`) so a tag that happens to share the name can never shadow
112
- * the ref we mean — `git rev-parse <name>` prefers refs/tags/* over both
113
- * refs/heads/* and refs/remotes/*. The bare `<base>` name is only returned as a
114
- * last resort when nothing qualified resolves (the eventual `git diff` then
115
- * errors and the caller falls back to running it itself).
116
- *
117
- * Resolution:
118
- * 1. Best-effort fetch the remote base (`haystack submit` is already online —
119
- * it pushes and opens a PR — so one ref fetch is cheap).
120
- * 2. If the fetch succeeded, the remote-tracking ref is the authoritative
121
- * remote tip — use it (even over a local <base> with unpushed commits; the
122
- * PR will merge into the remote base, not the local one).
123
- * 3. If the fetch failed (offline, private origin without ambient git creds,
124
- * base not on remote), don't blindly trust a possibly-stale *cached*
125
- * remote-tracking ref — pick whichever of it and local <base> is more
126
- * advanced (the one that is not an ancestor of the other), since a base
127
- * behind HEAD's fork point is exactly what balloons the diff.
128
- * 4. Fall back to whatever single qualified ref resolves, then the bare
129
- * <base> name (preserves prior behavior rather than breaking triage).
130
- */
131
- export declare function resolveDiffBaseRef(baseBranch: string, options?: ResolveDiffBaseRefOptions): string;
132
- /**
133
- * Get the number of commits ahead of base branch
134
- */
135
- export declare function getCommitsAhead(baseBranch: string): number;
@@ -1,104 +0,0 @@
1
- /**
2
- * GitHub API utilities for haystack submit command.
3
- *
4
- * Provides functions for creating PRs, managing labels, etc.
5
- */
6
- export interface CreatePROptions {
7
- owner: string;
8
- repo: string;
9
- title: string;
10
- head: string;
11
- base: string;
12
- body?: string;
13
- draft?: boolean;
14
- token?: string;
15
- }
16
- export interface PRResponse {
17
- number: number;
18
- html_url: string;
19
- title: string;
20
- state: string;
21
- head: {
22
- ref: string;
23
- };
24
- base: {
25
- ref: string;
26
- };
27
- }
28
- export interface LabelInfo {
29
- name: string;
30
- color: string;
31
- description?: string;
32
- }
33
- export interface GitHubUser {
34
- login: string;
35
- id: number;
36
- }
37
- export interface RepositoryPermissions {
38
- admin?: boolean;
39
- maintain?: boolean;
40
- push?: boolean;
41
- triage?: boolean;
42
- pull?: boolean;
43
- }
44
- export interface RepositoryAccess {
45
- full_name: string;
46
- owner: {
47
- login: string;
48
- };
49
- permissions?: RepositoryPermissions;
50
- }
51
- export declare const HAYSTACK_LABELS: Record<string, LabelInfo>;
52
- /**
53
- * Get a GitHub token, throw if not authenticated
54
- */
55
- export declare function requireGitHubAuth(options?: {
56
- preferredLogin?: string;
57
- owner?: string;
58
- repo?: string;
59
- }): Promise<string>;
60
- /**
61
- * Create a pull request
62
- */
63
- export declare function createPullRequest(options: CreatePROptions): Promise<PRResponse>;
64
- /**
65
- * Check if a PR already exists for a branch
66
- */
67
- export declare function findExistingPR(owner: string, repo: string, head: string, token?: string): Promise<PRResponse | null>;
68
- /**
69
- * Add labels to an issue/PR
70
- */
71
- export declare function addLabelsToIssue(owner: string, repo: string, issueNumber: number, labels: string[], token?: string): Promise<void>;
72
- /**
73
- * Get all labels from an issue/PR
74
- */
75
- export declare function getLabelsFromIssue(owner: string, repo: string, issueNumber: number, token?: string): Promise<string[]>;
76
- /**
77
- * Remove a label from an issue/PR
78
- */
79
- export declare function removeLabelFromIssue(owner: string, repo: string, issueNumber: number, labelName: string, token?: string): Promise<void>;
80
- /**
81
- * Check if a label exists in the repo
82
- */
83
- export declare function labelExists(owner: string, repo: string, labelName: string, token?: string): Promise<boolean>;
84
- /**
85
- * Create a label in the repo
86
- */
87
- export declare function createLabel(owner: string, repo: string, label: LabelInfo, token?: string): Promise<void>;
88
- /**
89
- * Ensure all required Haystack labels exist in the repo
90
- */
91
- export declare function ensureHaystackLabels(owner: string, repo: string, labelNames: string[], token?: string): Promise<void>;
92
- /**
93
- * Request reviewers on a pull request
94
- */
95
- export declare function requestReviewers(owner: string, repo: string, prNumber: number, reviewers: string[], token?: string): Promise<void>;
96
- /**
97
- * Get the authenticated user's info
98
- */
99
- export declare function getCurrentUser(token?: string): Promise<GitHubUser>;
100
- export declare function getRepositoryAccess(owner: string, repo: string, token?: string): Promise<RepositoryAccess>;
101
- /**
102
- * Check if user has push access to a repo
103
- */
104
- export declare function hasPushAccess(owner: string, repo: string, token?: string): Promise<boolean>;
@@ -1,37 +0,0 @@
1
- export declare function haystackApiBase(): string;
2
- export declare function haystackApiUrl(path: string): string;
3
- export interface UserInstallation {
4
- id: number;
5
- account?: {
6
- login?: string;
7
- } | null;
8
- repositories?: Array<{
9
- full_name: string;
10
- pushed_at?: string | null;
11
- }>;
12
- }
13
- export interface CliIdentity {
14
- login: string;
15
- id: number;
16
- }
17
- /**
18
- * Typed error for non-OK Haystack API responses. Callers classify by
19
- * `status` (never by message substring) and the message always carries a
20
- * remediation an agent can act on.
21
- */
22
- export declare class HaystackApiError extends Error {
23
- readonly status: number;
24
- constructor(status: number, message: string);
25
- get isAuthError(): boolean;
26
- }
27
- /**
28
- * Build an actionable error for a non-OK response: what failed, the HTTP
29
- * class it failed with, and the next command to run.
30
- */
31
- export declare function classifyHttpError(response: Response, context: string): Promise<HaystackApiError>;
32
- export declare function haystackJson<T>(path: string, token: string, init?: RequestInit, acceptedStatuses?: readonly number[]): Promise<T>;
33
- export declare function fetchCliIdentity(token: string): Promise<CliIdentity>;
34
- export declare function fetchHaystackInstallations(token: string): Promise<UserInstallation[]>;
35
- export declare function fetchGitHubJson<T>(path: string, token: string, init?: RequestInit): Promise<T>;
36
- export declare function fetchAnalysisArtifact<T>(owner: string, repo: string, prNumber: number, file: string, token: string): Promise<T | null>;
37
- export declare function postAskHaystack<T>(owner: string, repo: string, prNumber: number, question: string, sessionId: string | undefined, token: string): Promise<T>;
@@ -1,12 +0,0 @@
1
- /**
2
- * Utilities for haystack hooks install/status commands.
3
- */
4
- export declare function findGitRoot(): string | null;
5
- /** Resolves the path to dist/assets/hooks/ (or src/assets/hooks/ in dev) */
6
- export declare function getAssetsDir(): string;
7
- /** Copy hook scripts and TypeScript modules into the target hooks directory */
8
- export declare function copyHookFiles(hooksDir: string): Promise<void>;
9
- /** Install npm dependencies in the hooks directory */
10
- export declare function installHookDeps(hooksDir: string): Promise<void>;
11
- /** Copy LLM rules template if none exists */
12
- export declare function copyLlmRulesTemplate(repoRoot: string): Promise<boolean>;
@@ -1,40 +0,0 @@
1
- /**
2
- * Pending submit state persistence.
3
- *
4
- * Manages `.haystack/pending-submit.json` in the git root directory.
5
- * This file persists across CLI sessions so that analysis results
6
- * can be retrieved after disconnection.
7
- */
8
- import type { AnalysisVerdict } from './analysis-api.js';
9
- export interface PendingSubmit {
10
- version: 1;
11
- prNumber: number;
12
- prUrl: string;
13
- owner: string;
14
- repo: string;
15
- branch: string;
16
- baseBranch: string;
17
- submittedAt: string;
18
- status: 'polling' | 'completed' | 'failed' | 'stale';
19
- analysisResult?: AnalysisVerdict;
20
- resolvedAt?: string;
21
- autoFix?: boolean;
22
- autoFixStatus?: 'pending' | 'fixing' | 'fixed' | 'failed' | 'timed_out';
23
- }
24
- /**
25
- * Save pending submit state to disk.
26
- */
27
- export declare function savePendingSubmit(state: PendingSubmit, gitRoot?: string): void;
28
- /**
29
- * Load pending submit state from disk.
30
- * Returns null if no pending state exists or if it's stale.
31
- */
32
- export declare function loadPendingSubmit(gitRoot?: string): PendingSubmit | null;
33
- /**
34
- * Clear pending submit state (delete the file).
35
- */
36
- export declare function clearPendingSubmit(gitRoot?: string): void;
37
- /**
38
- * Update the status and optionally the analysis result of a pending submit.
39
- */
40
- export declare function updatePendingSubmit(updates: Partial<Pick<PendingSubmit, 'status' | 'analysisResult' | 'resolvedAt'>>, gitRoot?: string): void;
@@ -1,27 +0,0 @@
1
- /**
2
- * Shared PR-identifier parsing for every command that takes a PR ref.
3
- *
4
- * One grammar, one error message, one repo-inference path. This used to be
5
- * duplicated per command, and the copies drifted: different "accepted formats"
6
- * lists (none mentioned the `#123` form the regex accepted), and one copy let
7
- * a raw git error escape where the others gave a friendly hint. Commands must
8
- * import from here rather than reimplementing the grammar.
9
- *
10
- * Accepted formats, in the order they are tried:
11
- * https://github.com/owner/repo/pull/123 GitHub URL
12
- * owner/repo#123 Fully qualified
13
- * 123 or #123 PR number (repo inferred from the `origin` remote)
14
- */
15
- export interface ParsedPR {
16
- owner: string;
17
- repo: string;
18
- prNumber: number;
19
- }
20
- /** The accepted-formats block used in parse errors and help text. */
21
- export declare function acceptedPrRefFormats(commandName: string): string;
22
- /**
23
- * Parse a PR identifier. `commandName` is interpolated into error messages so
24
- * the agent can copy a corrected invocation verbatim (e.g. "triage",
25
- * "pr get", "traces list").
26
- */
27
- export declare function parsePrRef(identifier: string, commandName: string): ParsedPR;
@@ -1,85 +0,0 @@
1
- /**
2
- * Prompter — decouples a wizard's *decisions* from *how they're answered*.
3
- *
4
- * `haystack setup` historically welded every decision to inquirer/TTY, so it
5
- * couldn't run headless, in CI, or under a coding agent. The Prompter is the
6
- * seam: step code calls `confirm` / `multiselect` / `action`, and the
7
- * implementation decides how to source the answer.
8
- *
9
- * Three modes, one mechanism:
10
- * - TtyPrompter — humans in a terminal (inquirer). Default.
11
- * - JsonPrompter — a coding agent: NDJSON events on stdout, answers on stdin.
12
- * The agent can relay a `question` to the user OR auto-answer.
13
- * - Pre-supplied answers (flags / --answers file) short-circuit any question
14
- * by id, so the same code runs fully autonomously when every answer is known.
15
- *
16
- * Human-facing chrome stays as `console.*`; in JSON mode the JsonPrompter
17
- * redirects `console.*` to stderr so stdout carries only NDJSON.
18
- */
19
- /** A selectable option. A `{ separator }` entry renders a non-selectable group
20
- * header in TTY mode and is ignored in JSON mode. */
21
- export type Choice<T> = {
22
- name: string;
23
- value: T;
24
- checked?: boolean;
25
- } | {
26
- separator: string;
27
- };
28
- /** Thrown when an agent explicitly rejects/cancels a prompt (vs. answering it),
29
- * so callers can distinguish a cancellation from a valid empty answer. */
30
- export declare class PromptCancelledError extends Error {
31
- readonly requestID: string;
32
- constructor(requestID: string);
33
- }
34
- /** Outcome of an `action`: satisfied, intentionally skipped, or timed out —
35
- * distinct so callers don't report a skip as a timeout. */
36
- export type ActionResult = 'ok' | 'skip' | 'timeout';
37
- export interface Prompter {
38
- /** True for the human TTY prompter — gates side effects like opening a browser
39
- * that only make sense for a local interactive user. */
40
- readonly interactive: boolean;
41
- /** Whether an answer for `id` was pre-supplied (flag / --answers), so the
42
- * prompt is skipped. Callers use this to avoid re-prompting a fixed answer. */
43
- hasPreset(id: string): boolean;
44
- /** Yes/no decision. */
45
- confirm(q: {
46
- id: string;
47
- message: string;
48
- default?: boolean;
49
- }): Promise<boolean>;
50
- /** Pick zero-or-more values. Items default-checked via `checked: true`. */
51
- multiselect<T>(q: {
52
- id: string;
53
- message: string;
54
- choices: Choice<T>[];
55
- }): Promise<T[]>;
56
- /**
57
- * An action the user must take out-of-band (e.g. install the GitHub App).
58
- * Polls `check()` until it returns true (`'ok'`) or `timeoutMs` elapses
59
- * (`'timeout'`). A pre-supplied / stdin "skip"/reject resolves `'skip'`.
60
- */
61
- action(q: {
62
- id: string;
63
- message: string;
64
- url?: string;
65
- check: () => Promise<boolean>;
66
- pollIntervalMs?: number;
67
- timeoutMs?: number;
68
- }): Promise<ActionResult>;
69
- /** Transient progress line (scan ticker, per-repo write status). */
70
- progress(message: string, detail?: string): void;
71
- /** Clear the current progress line. */
72
- clearProgress(): void;
73
- /** Final structured outcome (emitted as a `result` event in JSON mode). */
74
- result(data: Record<string, unknown>): void;
75
- /** Release stdin/readline so the process can exit. */
76
- close(): void;
77
- }
78
- /** Answers known up-front (from flags or an --answers file), keyed by question id. */
79
- export type AnswerMap = Record<string, unknown>;
80
- export declare function loadAnswersFile(path: string): AnswerMap;
81
- export interface PrompterOptions {
82
- json?: boolean;
83
- answers?: AnswerMap;
84
- }
85
- export declare function createPrompter(options?: PrompterOptions): Prompter;
@@ -1,47 +0,0 @@
1
- /**
2
- * Secret Scanning & Validation
3
- *
4
- * Detects potential hardcoded secrets in configuration files
5
- * before they can be committed to version control.
6
- *
7
- * Based on patterns from:
8
- * - GitHub secret scanning
9
- * - detect-secrets
10
- * - truffleHog
11
- */
12
- /**
13
- * Detected secret finding
14
- */
15
- export interface SecretFinding {
16
- pattern: string;
17
- description: string;
18
- severity: 'high' | 'medium' | 'low';
19
- line: number;
20
- column: number;
21
- match: string;
22
- file: string;
23
- }
24
- /**
25
- * Scan content for potential secrets
26
- */
27
- export declare function scanForSecrets(content: string, filename: string): SecretFinding[];
28
- /**
29
- * Scan a file for secrets
30
- */
31
- export declare function scanFile(filePath: string): Promise<SecretFinding[]>;
32
- /**
33
- * Scan .haystack.json specifically for secrets
34
- */
35
- export declare function scanHaystackConfig(configPath: string): Promise<SecretFinding[]>;
36
- /**
37
- * Validate that a config doesn't contain hardcoded secrets
38
- * Returns true if safe, false if secrets detected
39
- */
40
- export declare function validateConfigSecurity(configPath: string): Promise<{
41
- safe: boolean;
42
- findings: SecretFinding[];
43
- }>;
44
- /**
45
- * Get a security report string for display
46
- */
47
- export declare function formatSecurityReport(findings: SecretFinding[]): string;
@@ -1,19 +0,0 @@
1
- /**
2
- * Lightweight CLI telemetry — fire-and-forget error tracking via PostHog HTTP API.
3
- *
4
- * Events go to the same PostHog project as the web app, enabling unified
5
- * alerting across frontend, CLI, and backend.
6
- *
7
- * All calls are non-blocking and never throw — telemetry failures must not
8
- * break CLI commands.
9
- */
10
- /**
11
- * Track an error event. Fire-and-forget — never throws.
12
- */
13
- export declare function trackError(errorType: string, metadata?: Record<string, unknown>): void;
14
- /**
15
- * Track a setup event (non-error). Fire-and-forget.
16
- */
17
- export declare function trackSetupEvent(step: string, metadata?: Record<string, unknown>): void;
18
- /** Track one bounded front-half precompute result per CLI invocation. */
19
- export declare function trackPrecomputeEvent(outcome: string, wallMs: number, timeoutMs: number): void;