@cruxy/cli 1.0.3 → 1.0.5

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 (238) hide show
  1. package/package.json +2 -2
  2. package/dist/agent/budget.d.ts +0 -52
  3. package/dist/agent/index.d.ts +0 -3
  4. package/dist/agent/loop.d.ts +0 -159
  5. package/dist/agent/prompts.d.ts +0 -69
  6. package/dist/agent/session.d.ts +0 -212
  7. package/dist/approval/classify.d.ts +0 -18
  8. package/dist/approval/index.d.ts +0 -6
  9. package/dist/approval/mutex.d.ts +0 -45
  10. package/dist/approval/policy.d.ts +0 -43
  11. package/dist/approval/prompt.d.ts +0 -48
  12. package/dist/approval/service.d.ts +0 -36
  13. package/dist/approval/types.d.ts +0 -82
  14. package/dist/brand/index.d.ts +0 -1
  15. package/dist/brand/voice.d.ts +0 -94
  16. package/dist/checkpoint/capture.d.ts +0 -17
  17. package/dist/checkpoint/gate-hook.d.ts +0 -28
  18. package/dist/checkpoint/gate.d.ts +0 -71
  19. package/dist/checkpoint/git-store.d.ts +0 -61
  20. package/dist/checkpoint/index.d.ts +0 -10
  21. package/dist/checkpoint/restore.d.ts +0 -23
  22. package/dist/checkpoint/service.d.ts +0 -89
  23. package/dist/checkpoint/set-rollback.d.ts +0 -51
  24. package/dist/checkpoint/set.d.ts +0 -44
  25. package/dist/checkpoint/shadow-store.d.ts +0 -23
  26. package/dist/checkpoint/types.d.ts +0 -164
  27. package/dist/cli/commands/checkpoint.d.ts +0 -7
  28. package/dist/cli/commands/config.d.ts +0 -2
  29. package/dist/cli/commands/hooks.d.ts +0 -8
  30. package/dist/cli/commands/index.d.ts +0 -7
  31. package/dist/cli/commands/init.d.ts +0 -7
  32. package/dist/cli/commands/login.d.ts +0 -8
  33. package/dist/cli/commands/mcp.d.ts +0 -9
  34. package/dist/cli/commands/memory.d.ts +0 -8
  35. package/dist/cli/commands/pr.d.ts +0 -8
  36. package/dist/cli/commands/rollback.d.ts +0 -18
  37. package/dist/cli/commands/run.d.ts +0 -2
  38. package/dist/cli/commands/skills.d.ts +0 -8
  39. package/dist/cli/commands/test.d.ts +0 -9
  40. package/dist/cli/commands/usage.d.ts +0 -9
  41. package/dist/cli/onboard.d.ts +0 -25
  42. package/dist/cli/program.d.ts +0 -2
  43. package/dist/cli/repl.d.ts +0 -27
  44. package/dist/cli/session-factory.d.ts +0 -42
  45. package/dist/cli/stream-print.d.ts +0 -14
  46. package/dist/components/autocomplete.d.ts +0 -32
  47. package/dist/components/frame.d.ts +0 -28
  48. package/dist/components/fuzzy.d.ts +0 -61
  49. package/dist/components/index.d.ts +0 -6
  50. package/dist/components/input.d.ts +0 -78
  51. package/dist/components/keys.d.ts +0 -48
  52. package/dist/components/select.d.ts +0 -28
  53. package/dist/config/credentials.d.ts +0 -18
  54. package/dist/config/index.d.ts +0 -5
  55. package/dist/config/manager.d.ts +0 -39
  56. package/dist/config/owner-only.d.ts +0 -19
  57. package/dist/config/paths.d.ts +0 -9
  58. package/dist/config/project.d.ts +0 -10
  59. package/dist/config/schema.d.ts +0 -2143
  60. package/dist/constants.d.ts +0 -65
  61. package/dist/errors/boundary.d.ts +0 -43
  62. package/dist/errors/constructors.d.ts +0 -411
  63. package/dist/errors/format.d.ts +0 -31
  64. package/dist/errors/index.d.ts +0 -4
  65. package/dist/errors/types.d.ts +0 -270
  66. package/dist/hooks/config.d.ts +0 -21
  67. package/dist/hooks/index.d.ts +0 -7
  68. package/dist/hooks/router.d.ts +0 -58
  69. package/dist/hooks/runner.d.ts +0 -88
  70. package/dist/hooks/service.d.ts +0 -38
  71. package/dist/hooks/slash.d.ts +0 -48
  72. package/dist/hooks/trust.d.ts +0 -46
  73. package/dist/hooks/types.d.ts +0 -147
  74. package/dist/index.d.ts +0 -2
  75. package/dist/indexing/chunker.d.ts +0 -28
  76. package/dist/indexing/embedder.d.ts +0 -98
  77. package/dist/indexing/index.d.ts +0 -9
  78. package/dist/indexing/indexer.d.ts +0 -45
  79. package/dist/indexing/retriever.d.ts +0 -61
  80. package/dist/indexing/service.d.ts +0 -49
  81. package/dist/indexing/store.d.ts +0 -103
  82. package/dist/indexing/types.d.ts +0 -78
  83. package/dist/indexing/util.d.ts +0 -34
  84. package/dist/indexing/walker.d.ts +0 -53
  85. package/dist/jobs/approval-queue.d.ts +0 -85
  86. package/dist/jobs/dispatch-tool.d.ts +0 -34
  87. package/dist/jobs/index.d.ts +0 -6
  88. package/dist/jobs/log-buffer.d.ts +0 -31
  89. package/dist/jobs/log-renderer.d.ts +0 -32
  90. package/dist/jobs/manager.d.ts +0 -139
  91. package/dist/jobs/types.d.ts +0 -81
  92. package/dist/lsp/client.d.ts +0 -25
  93. package/dist/lsp/index.d.ts +0 -8
  94. package/dist/lsp/pool.d.ts +0 -48
  95. package/dist/lsp/registry.d.ts +0 -38
  96. package/dist/lsp/server.d.ts +0 -48
  97. package/dist/lsp/service.d.ts +0 -44
  98. package/dist/lsp/tools/common.d.ts +0 -50
  99. package/dist/lsp/tools/find-definition.d.ts +0 -23
  100. package/dist/lsp/tools/find-references.d.ts +0 -23
  101. package/dist/lsp/tools/get-diagnostics.d.ts +0 -17
  102. package/dist/lsp/tools/hover.d.ts +0 -23
  103. package/dist/lsp/tools/index.d.ts +0 -4
  104. package/dist/lsp/transport.d.ts +0 -39
  105. package/dist/lsp/types.d.ts +0 -107
  106. package/dist/mcp/adapter.d.ts +0 -44
  107. package/dist/mcp/bounds.d.ts +0 -35
  108. package/dist/mcp/client.d.ts +0 -19
  109. package/dist/mcp/demarcate.d.ts +0 -12
  110. package/dist/mcp/http-transport.d.ts +0 -89
  111. package/dist/mcp/index.d.ts +0 -12
  112. package/dist/mcp/service.d.ts +0 -71
  113. package/dist/mcp/sibling-banner.d.ts +0 -25
  114. package/dist/mcp/transport.d.ts +0 -30
  115. package/dist/mcp/trust-gate.d.ts +0 -59
  116. package/dist/mcp/trust.d.ts +0 -62
  117. package/dist/mcp/types.d.ts +0 -62
  118. package/dist/mcp/url-guard.d.ts +0 -48
  119. package/dist/memory/index.d.ts +0 -7
  120. package/dist/memory/recall.d.ts +0 -56
  121. package/dist/memory/remember-tool.d.ts +0 -28
  122. package/dist/memory/secrets.d.ts +0 -29
  123. package/dist/memory/service.d.ts +0 -92
  124. package/dist/memory/store.d.ts +0 -32
  125. package/dist/memory/trust.d.ts +0 -52
  126. package/dist/memory/types.d.ts +0 -101
  127. package/dist/net/ip-guard.d.ts +0 -55
  128. package/dist/onboarding/detect.d.ts +0 -26
  129. package/dist/onboarding/flow.d.ts +0 -28
  130. package/dist/onboarding/index.d.ts +0 -5
  131. package/dist/onboarding/io.d.ts +0 -9
  132. package/dist/onboarding/steps.d.ts +0 -17
  133. package/dist/onboarding/types.d.ts +0 -81
  134. package/dist/plan/approve.d.ts +0 -16
  135. package/dist/plan/execute.d.ts +0 -28
  136. package/dist/plan/index.d.ts +0 -7
  137. package/dist/plan/policy.d.ts +0 -26
  138. package/dist/plan/render.d.ts +0 -5
  139. package/dist/plan/service.d.ts +0 -58
  140. package/dist/plan/submit-plan.d.ts +0 -33
  141. package/dist/plan/types.d.ts +0 -60
  142. package/dist/render/capabilities.d.ts +0 -31
  143. package/dist/render/diff.d.ts +0 -18
  144. package/dist/render/highlight.d.ts +0 -47
  145. package/dist/render/index.d.ts +0 -22
  146. package/dist/render/layout.d.ts +0 -59
  147. package/dist/render/motion.d.ts +0 -76
  148. package/dist/render/plain-renderer.d.ts +0 -39
  149. package/dist/render/resize.d.ts +0 -36
  150. package/dist/render/screen-reader-renderer.d.ts +0 -45
  151. package/dist/render/state.d.ts +0 -49
  152. package/dist/render/tty-renderer.d.ts +0 -106
  153. package/dist/render/types.d.ts +0 -201
  154. package/dist/routing/index.d.ts +0 -2
  155. package/dist/routing/resolve.d.ts +0 -17
  156. package/dist/routing/router.d.ts +0 -47
  157. package/dist/routing/types.d.ts +0 -42
  158. package/dist/sandbox/detect.d.ts +0 -22
  159. package/dist/sandbox/docker-runtime.d.ts +0 -32
  160. package/dist/sandbox/index.d.ts +0 -7
  161. package/dist/sandbox/policy.d.ts +0 -26
  162. package/dist/sandbox/service.d.ts +0 -64
  163. package/dist/sandbox/types.d.ts +0 -123
  164. package/dist/skills/index.d.ts +0 -4
  165. package/dist/skills/loader.d.ts +0 -43
  166. package/dist/skills/parser.d.ts +0 -31
  167. package/dist/skills/service.d.ts +0 -41
  168. package/dist/skills/types.d.ts +0 -94
  169. package/dist/subagent/index.d.ts +0 -5
  170. package/dist/subagent/orchestrator.d.ts +0 -169
  171. package/dist/subagent/registry-scope.d.ts +0 -41
  172. package/dist/subagent/semaphore.d.ts +0 -56
  173. package/dist/subagent/spawn-tool.d.ts +0 -86
  174. package/dist/subagent/types.d.ts +0 -65
  175. package/dist/testing/detect.d.ts +0 -3
  176. package/dist/testing/index.d.ts +0 -5
  177. package/dist/testing/parse.d.ts +0 -33
  178. package/dist/testing/run-tests-tool.d.ts +0 -64
  179. package/dist/testing/runner.d.ts +0 -26
  180. package/dist/testing/sandbox-runner.d.ts +0 -16
  181. package/dist/testing/types.d.ts +0 -66
  182. package/dist/theme/index.d.ts +0 -2
  183. package/dist/theme/resolve.d.ts +0 -43
  184. package/dist/theme/tokens.d.ts +0 -125
  185. package/dist/tools/create-pull-request.d.ts +0 -27
  186. package/dist/tools/file/apply-patch.d.ts +0 -94
  187. package/dist/tools/file/edit-file.d.ts +0 -12
  188. package/dist/tools/file/glob.d.ts +0 -17
  189. package/dist/tools/file/grep-files.d.ts +0 -43
  190. package/dist/tools/file/index.d.ts +0 -7
  191. package/dist/tools/file/match.d.ts +0 -43
  192. package/dist/tools/file/paths.d.ts +0 -160
  193. package/dist/tools/file/read-file.d.ts +0 -8
  194. package/dist/tools/file/write-file.d.ts +0 -10
  195. package/dist/tools/git-status.d.ts +0 -15
  196. package/dist/tools/index.d.ts +0 -9
  197. package/dist/tools/list-files.d.ts +0 -13
  198. package/dist/tools/list-skills.d.ts +0 -9
  199. package/dist/tools/load-skill.d.ts +0 -21
  200. package/dist/tools/registry.d.ts +0 -23
  201. package/dist/tools/search-codebase.d.ts +0 -35
  202. package/dist/tools/shell/exec.d.ts +0 -53
  203. package/dist/tools/shell/index.d.ts +0 -1
  204. package/dist/tools/shell/resolve-shell.d.ts +0 -81
  205. package/dist/tools/shell/run-command.d.ts +0 -14
  206. package/dist/tools/types.d.ts +0 -257
  207. package/dist/usage/collect.d.ts +0 -53
  208. package/dist/usage/cost.d.ts +0 -19
  209. package/dist/usage/index.d.ts +0 -15
  210. package/dist/usage/store.d.ts +0 -37
  211. package/dist/usage/summary.d.ts +0 -32
  212. package/dist/usage/types.d.ts +0 -283
  213. package/dist/utils/child-tree.d.ts +0 -33
  214. package/dist/utils/git.d.ts +0 -17
  215. package/dist/utils/logger.d.ts +0 -18
  216. package/dist/utils/process-tree.d.ts +0 -16
  217. package/dist/vcs/auth.d.ts +0 -22
  218. package/dist/vcs/generate.d.ts +0 -74
  219. package/dist/vcs/git.d.ts +0 -60
  220. package/dist/vcs/github.d.ts +0 -50
  221. package/dist/vcs/guidance.d.ts +0 -20
  222. package/dist/vcs/index.d.ts +0 -7
  223. package/dist/vcs/service.d.ts +0 -61
  224. package/dist/vcs/types.d.ts +0 -73
  225. package/dist/web/demarcate.d.ts +0 -13
  226. package/dist/web/fetch.d.ts +0 -11
  227. package/dist/web/index.d.ts +0 -7
  228. package/dist/web/provider.d.ts +0 -29
  229. package/dist/web/search.d.ts +0 -17
  230. package/dist/web/ssrf.d.ts +0 -41
  231. package/dist/web/tools.d.ts +0 -20
  232. package/dist/web/types.d.ts +0 -64
  233. package/dist/workspace/add-root.d.ts +0 -27
  234. package/dist/workspace/index.d.ts +0 -6
  235. package/dist/workspace/resolve.d.ts +0 -54
  236. package/dist/workspace/select.d.ts +0 -41
  237. package/dist/workspace/types.d.ts +0 -30
  238. package/dist/workspace/workspace.d.ts +0 -61
@@ -1,65 +0,0 @@
1
- export declare const APP_NAME = "cruxy";
2
- export declare const APP_PACKAGE: string;
3
- export declare const APP_VERSION: string;
4
- export declare const APP_DESCRIPTION: string;
5
- /** Directory/file names cruxy looks for. */
6
- export declare const GLOBAL_DIR_NAME = ".cruxy";
7
- export declare const CONFIG_FILE_NAME = "config.json";
8
- /** Secret store under the global dir — `0600`, never holds non-secret config. */
9
- export declare const CREDENTIALS_FILE_NAME = "credentials.json";
10
- /** Onboarding state + completion marker under the global dir (U.6). */
11
- export declare const ONBOARDING_FILE_NAME = "onboarding.json";
12
- /** Where a user creates a Cruxy gateway key (printed during onboarding). */
13
- export declare const CREATE_KEY_URL = "https://app.cruxy.in";
14
- /** Project-level config filenames, checked in order. */
15
- export declare const PROJECT_CONFIG_FILENAMES: string[];
16
- /** Project-instruction filenames, checked in order (first match wins). */
17
- export declare const PROJECT_INSTRUCTION_FILENAMES: string[];
18
- /**
19
- * Name of the skills subdirectory, used under the project dir
20
- * (`<cwd>/.cruxy/skills`), the global dir (`~/.cruxy/skills`), and the package
21
- * root for shipped builtins.
22
- */
23
- export declare const SKILLS_DIR_NAME = "skills";
24
- /** Hook definitions file, under the project dir (`<cwd>/.cruxy/hooks.json`) and
25
- * the global dir (`~/.cruxy/hooks.json`). Pure data, validated, never eval'd (C.19). */
26
- export declare const HOOKS_FILE_NAME = "hooks.json";
27
- /** Custom slash-command directory (`<cwd>/.cruxy/commands`, `~/.cruxy/commands`);
28
- * one `<name>.md` per command (frontmatter + template body), mirroring skills. */
29
- export declare const COMMANDS_DIR_NAME = "commands";
30
- /** Per-repo hook-trust record, in the GLOBAL dir only (`~/.cruxy/trust.json`) —
31
- * never in a repo, so cloning carries no trust (C.19 supply-chain safety). */
32
- export declare const TRUST_FILE_NAME = "trust.json";
33
- /**
34
- * Persistent memory (C.29). Structured entries live under the memory subdir of
35
- * the project dir (`<cwd>/.cruxy/memory`) and the global dir (`~/.cruxy/memory`),
36
- * one JSON file per scope — pure data, validated, never eval'd.
37
- */
38
- export declare const MEMORY_DIR_NAME = "memory";
39
- export declare const MEMORY_FILE_NAME = "entries.json";
40
- /** Per-repo PROJECT-memory trust record, in the GLOBAL dir only
41
- * (`~/.cruxy/memory-trust.json`) — its own file, independent of hook trust, so
42
- * cloning a repo carries zero memory trust (C.29 supply-chain safety). */
43
- export declare const MEMORY_TRUST_FILE_NAME = "memory-trust.json";
44
- /**
45
- * MCP server integration (C.27). Per-repo trust for configured MCP servers, in
46
- * the GLOBAL dir only (`~/.cruxy/mcp-trust.json`) — its own file, independent of
47
- * hook and memory trust, so cloning a repo carries zero MCP trust. Trusting a
48
- * server runs its code UNSANDBOXED with your privileges, so this decision is
49
- * fingerprinted and re-checked on every run (C.27 supply-chain safety).
50
- */
51
- export declare const MCP_TRUST_FILE_NAME = "mcp-trust.json";
52
- /**
53
- * Usage telemetry + cost tracking (C.22). Per-run/per-session usage records live
54
- * in the GLOBAL dir only (`~/.cruxy/usage/runs.json`), `0600` — LOCAL accounting
55
- * of your own usage, never transmitted. Pure data, validated, never eval'd.
56
- */
57
- export declare const USAGE_DIR_NAME = "usage";
58
- export declare const USAGE_FILE_NAME = "runs.json";
59
- /**
60
- * Absolute path of the shipped builtin skills directory (`<pkg>/skills`).
61
- * Anchored the same way as the package.json lookup above: both `dist/` and
62
- * `src/` sit one level below the package root, so `../skills` resolves to the
63
- * shipped `skills/` directory in dev, in `dist`, and when published.
64
- */
65
- export declare const BUILTIN_SKILLS_DIR: string;
@@ -1,43 +0,0 @@
1
- import { type Formatter } from "./format.js";
2
- import { CruxyError } from "./types.js";
3
- /**
4
- * The single top-level error boundary. {@link handleFatal} classifies any thrown
5
- * value into a {@link CruxyError}, formats it, writes it to stderr, and exits
6
- * with the error's stable exit code. Nothing escapes to a raw Node stack trace:
7
- * an unknown error becomes {@link internal} (CRUXY_E_INTERNAL) with a
8
- * bug-report hint, and the underlying stack is shown only under `--verbose`.
9
- */
10
- /**
11
- * Normalize any thrown value into a {@link CruxyError}:
12
- * - already a CruxyError → returned as-is;
13
- * - a Commander parse error → a usage error (CRUXY_E_USAGE);
14
- * - a known provider/transport error → its mapped code;
15
- * - anything else → CRUXY_E_INTERNAL, preserving the original as `underlying`.
16
- */
17
- export declare function fromUnknown(err: unknown): CruxyError;
18
- /** A Commander "error" that's actually success (`--help`, `--version`). */
19
- export declare function isCommanderSuccess(err: unknown): boolean;
20
- export interface HandleFatalOptions {
21
- /** Show the underlying error/stack. Defaults to {@link isVerbose}(). */
22
- verbose?: boolean;
23
- /** Override the formatter (e.g. a future JSON formatter). */
24
- formatter?: Formatter;
25
- /** Force color on/off. Defaults to {@link shouldUseColor}(). */
26
- color?: boolean;
27
- /** Sink for the formatted output (default: stderr). For tests. */
28
- write?: (text: string) => void;
29
- /** Process exit (default: process.exit). For tests. */
30
- exit?: (code: number) => never;
31
- }
32
- /**
33
- * Classify → format → print → exit. Install this as the *only* catch at the CLI
34
- * entry. `write`/`exit` are injectable so the boundary is testable without
35
- * touching the real process.
36
- */
37
- export declare function handleFatal(err: unknown, opts?: HandleFatalOptions): never;
38
- /**
39
- * Whether the invocation requested verbose output: `--verbose`,
40
- * `--log-level debug`, `DEBUG`, or `CRUXY_LOG_LEVEL=debug`. Read from argv/env so
41
- * it works even when a failure happens before the CLI finishes parsing flags.
42
- */
43
- export declare function isVerbose(argv?: string[], env?: NodeJS.ProcessEnv): boolean;
@@ -1,411 +0,0 @@
1
- import { CruxyError } from "./types.js";
2
- /** Best-effort human message for an arbitrary thrown value. */
3
- export declare function messageOf(underlying: unknown): string | undefined;
4
- export declare function usageError(title: string, nextSteps?: string[]): CruxyError;
5
- /**
6
- * An interactive component (picker, fuzzy finder) was needed but stdin is not
7
- * an interactive terminal and the caller supplied no default (U.7). Never
8
- * silently picks an option, never blocks on a pipe — same discipline as the
9
- * approval/onboarding layers.
10
- */
11
- export declare function interactiveRequired(what: string, alternatives?: string[]): CruxyError;
12
- export declare function configKeyUnknown(key: string): CruxyError;
13
- export declare function providerUnsupported(provider: string): CruxyError;
14
- /**
15
- * A task class is routed (C.30) to a tier the gateway does not offer. A usage
16
- * error the user fixes in config — cruxy fails loud here rather than silently
17
- * substituting a different tier (which would hand a user a model they never
18
- * asked for). Distinct from runtime unavailability (overload/budget), which
19
- * stays on the U.5 api codes. Params are tier/class NAMES only — never an
20
- * upstream model id — so the message is gag-safe by construction (U.8).
21
- */
22
- export declare function routingTierUnavailable(tier: string, taskClass: string, offered: string[]): CruxyError;
23
- export declare function configParse(path: string, underlying?: unknown): CruxyError;
24
- export declare function configInvalid(issues: string, path?: string): CruxyError;
25
- export declare function authMissingKey(provider: string, envVar: string): CruxyError;
26
- export declare function authInvalid(underlying?: unknown): CruxyError;
27
- /**
28
- * A credential could not be persisted with owner-only permissions, so it was
29
- * NOT written (C.27c). Chiefly a Windows case: the store's ACL could not be
30
- * restricted to the current user (non-NTFS filesystem, `icacls`/SID
31
- * unavailable), and we refuse to leave a secret at inheritable permissions while
32
- * claiming otherwise. Provider keys point at the env-var fallback; MCP tokens
33
- * have no such fallback, so the message says so plainly.
34
- */
35
- export declare function credentialsUnprotected(kind: "provider" | "mcp", path: string, underlying?: unknown): CruxyError;
36
- export declare function gatewayUnreachable(underlying?: unknown): CruxyError;
37
- export declare function apiError(underlying?: unknown): CruxyError;
38
- export declare function apiRateLimit(underlying?: unknown): CruxyError;
39
- export declare function apiOverloaded(underlying?: unknown): CruxyError;
40
- export declare function budgetExhausted(underlying?: unknown): CruxyError;
41
- export declare function fileNotFound(path: string, underlying?: unknown): CruxyError;
42
- export declare function permissionDenied(path: string, underlying?: unknown): CruxyError;
43
- export declare function indexEmbedderUnavailable(underlying?: unknown): CruxyError;
44
- /**
45
- * The fastembed module loaded, but the model could not be brought up at runtime
46
- * — the first-run download/decompress of bge-small-en-v1.5, or the ONNX-runtime
47
- * init, failed. This is the COMMON first-run failure (offline, the model bucket
48
- * is unreachable, a corporate proxy blocks it), and it is deliberately kept
49
- * distinct from both {@link indexEmbedderUnavailable} (a module *load* failure)
50
- * and the generic {@link indexFailed} ("re-run --verbose") so the cause is
51
- * actionable rather than a shrug.
52
- *
53
- * Fail-loud, not degrade: there is no fallback to the lexical hashing embedder
54
- * (a silent quality loss). `cruxy index` treats this as fatal — the user
55
- * explicitly asked to build the index, so a silent no-op index would be the
56
- * exact "reads like success, isn't" trap C.17 forbids. The `search_codebase`
57
- * tool instead surfaces it as a tool error and points the model at `grep_files`.
58
- */
59
- export declare function indexEmbedderDownloadFailed(underlying?: unknown): CruxyError;
60
- export declare function indexStoreUnavailable(underlying?: unknown): CruxyError;
61
- export declare function indexFailed(underlying?: unknown): CruxyError;
62
- /**
63
- * Sandboxing was requested (`--sandbox` / `sandbox.enabled`) but no container
64
- * runtime is available — docker isn't installed, or its daemon isn't running.
65
- * THE CRITICAL RULE: this is fatal. A user who turned on the sandbox must never
66
- * be silently dropped back onto un-sandboxed host execution, so we fail loud
67
- * here rather than run the command anyway.
68
- */
69
- export declare function sandboxUnavailable(runtime?: string, underlying?: unknown): CruxyError;
70
- /**
71
- * The pinned sandbox base image could not be made available (the first-run
72
- * pull failed, or the image does not exist). Fatal — without the image there
73
- * is nothing to execute inside, and we never substitute another image.
74
- */
75
- export declare function sandboxImage(image: string, underlying?: unknown): CruxyError;
76
- /**
77
- * The container itself failed to start or run (a docker-level failure — bad
78
- * flags, daemon error, `docker run` exit 125), as opposed to the command
79
- * inside exiting non-zero (which is an ordinary result). Fatal: a sandbox that
80
- * can't launch is never papered over with a host run.
81
- */
82
- export declare function sandboxExec(underlying?: unknown): CruxyError;
83
- /**
84
- * A blocking hook failed (non-zero exit, gate-declined, or errored). The action
85
- * that fired it is aborted fail-closed — a failing pre-check must stop, never
86
- * proceed. Advisory hooks report but never raise this.
87
- */
88
- export declare function hookFailed(name: string, reason: string, underlying?: unknown): CruxyError;
89
- /**
90
- * A project (a cloned/opened repo) defines hooks that have not been trusted for
91
- * this machine. Cruxy NEVER runs another author's hooks silently — trust is an
92
- * explicit, per-repo decision recorded in your home, not in the repo.
93
- */
94
- export declare function hookUntrusted(root: string, count: number): CruxyError;
95
- /** A malformed hook definition — excluded from the catalog, never eval'd. */
96
- export declare function hookInvalid(reason: string, source?: string): CruxyError;
97
- /** A malformed custom slash-command definition — excluded and surfaced. */
98
- export declare function slashInvalid(reason: string, source?: string): CruxyError;
99
- /**
100
- * A side-effecting action needs approval but cruxy can't ask (non-interactive,
101
- * no policy). Default-deny — never auto-approve. A distinct exit code (10) so CI
102
- * can tell "needed approval" apart from a usage error.
103
- */
104
- export declare function approvalRequired(summary: string): CruxyError;
105
- /**
106
- * No forge token could be resolved (PR generation, C.15). The chain is env →
107
- * `gh auth token` → fail. We never prompt for, store, or persist a token, so the
108
- * fix is always to provide one in the environment.
109
- */
110
- export declare function forgeAuth(host?: string): CruxyError;
111
- /**
112
- * A commit/push was attempted on a protected branch (`main`/`master`/configured).
113
- * The PR flow must branch off first; this is the last-line guard.
114
- */
115
- export declare function gitProtectedBranch(branch: string): CruxyError;
116
- /** The forge REST API returned an error (non-auth) while opening a PR. */
117
- export declare function forgeApi(title: string, underlying?: unknown, meta?: Record<string, unknown>): CruxyError;
118
- /**
119
- * The `origin` remote of the acting root resolved to a DIFFERENT `owner/repo`
120
- * between the U.3 preview (what the human approved) and the moment the pull-request
121
- * API call is made — a concurrent `git remote set-url` on a mutable `.git/config`
122
- * (C.26 Step 4). The PR is NOT opened: we refuse rather than warn-and-proceed,
123
- * because opening it would target a repo the human never saw. Both targets are
124
- * named so the discrepancy is legible. `owner/repo` are already-parsed identifiers
125
- * (never an upstream model id), so the message is gag-safe by construction (U.8).
126
- */
127
- export declare function vcsRemoteChanged(approved: {
128
- host: string;
129
- owner: string;
130
- repo: string;
131
- }, current: {
132
- host: string;
133
- owner: string;
134
- repo: string;
135
- }, rootName: string): CruxyError;
136
- /**
137
- * A pull request was requested for one declared root while a SIBLING declared root
138
- * shares the same git working tree — two non-overlapping roots inside one repo
139
- * (e.g. `packages/a` + `packages/b` under one `.git`), which filesystem-overlap
140
- * refusal does not catch (C.26 Step 4). A commit there `git add -A`s the sibling's
141
- * changes too, so the PR would span both roots. A PR is a single-repo artifact, so
142
- * we refuse (naming both) rather than silently PR one half.
143
- */
144
- export declare function vcsCrossRoot(root: string, sibling: string, repoPath: string): CruxyError;
145
- /**
146
- * `git push` failed — most often the husky `pre-push` verify hook (build ·
147
- * typecheck · lint · test) or a rejected non-fast-forward. We never `--force` or
148
- * `--no-verify`, so the underlying reason is surfaced verbatim.
149
- */
150
- export declare function gitPushFailed(branch: string, stderr?: string): CruxyError;
151
- /** The agent's proposed plan was missing or malformed (plan mode, C.31). */
152
- export declare function planInvalid(reason: string): CruxyError;
153
- /** The plan was rejected too many times without converging (plan mode, C.31). */
154
- export declare function planRevisionLimit(limit: number): CruxyError;
155
- /**
156
- * Plan mode needs interactive approval but cruxy is running non-interactively.
157
- * Default-deny — a plan is never auto-approved. Distinct code (exit 10) so CI can
158
- * tell it apart from a per-action approval requirement.
159
- */
160
- export declare function planApprovalRequired(): CruxyError;
161
- /**
162
- * Creating, reading, or restoring a working-tree checkpoint failed (C.32).
163
- * Fail-loud by design: an agent run never mutates files without its undo
164
- * protection unless the user explicitly disables it.
165
- */
166
- export declare function checkpointFailed(reason: string, underlying?: unknown): CruxyError;
167
- /** The requested checkpoint id doesn't exist (or no checkpoints exist at all). */
168
- export declare function checkpointNotFound(id?: string): CruxyError;
169
- /**
170
- * Rollback needs interactive approval but cruxy is running non-interactively.
171
- * Restoring is destructive and deliberate — there is no auto-rollback path, ever.
172
- */
173
- export declare function rollbackApprovalRequired(): CruxyError;
174
- /**
175
- * A path/selector names a workspace root that is not in the declared set — an
176
- * unknown root name, or an absolute path that lands in no declared root. Fail-loud
177
- * by design and NEVER fuzzy-matched to a nearby root (R1): a silent near-match is
178
- * a cross-root misfire. Refused before any FS access.
179
- */
180
- export declare function rootUnknown(ref: string, known: readonly string[]): CruxyError;
181
- /**
182
- * A path is ambiguous across the declared root set: an absolute path inside ≥2
183
- * declared roots, or a mutating tool given no root when there is no unambiguous
184
- * choice. Writes fail closed rather than guess which repo to touch.
185
- */
186
- export declare function rootAmbiguous(ref: string, candidates: string[]): CruxyError;
187
- /**
188
- * Declaration-time: a declared root nests inside / overlaps another. Refused at
189
- * session start — overlap makes "which root owns this path" ambiguous and lets two
190
- * checkpoints/grants fight over the same bytes.
191
- */
192
- export declare function multirootWriteDeferred(root: string, primary: string): CruxyError;
193
- export declare function rootOverlap(a: string, b: string): CruxyError;
194
- /**
195
- * An interactive add-root was refused: no TTY to confirm, or the user declined the
196
- * confirm/trust prompt. The root set only ever grows by an explicit human act —
197
- * never the model, never a repo-local config.
198
- */
199
- export declare function rootAddRefused(reason: string): CruxyError;
200
- /**
201
- * A multi-root rollback set references a member checkpoint that is missing or
202
- * corrupt, or a touched root has no member. Loud — a partial rollback must never
203
- * masquerade as success.
204
- */
205
- export declare function checkpointSetIncomplete(runId: string, reason: string): CruxyError;
206
- /**
207
- * A multi-root rollback failed mid-apply (R3): it restored some roots and not
208
- * others, and it STOPPED rather than continue best-effort. Carries the exact
209
- * restored-vs-not split; re-running rollback is idempotent and safe.
210
- */
211
- export declare function checkpointSetPartial(runId: string, restored: string[], notRestored: string[], underlying?: unknown): CruxyError;
212
- /**
213
- * A subagent spawn was attempted past the configured nesting cap (C.14). The
214
- * spawn tool is structurally withheld at the cap, so reaching this means the
215
- * orchestrator seam was driven directly — fail loud, never spawn.
216
- */
217
- export declare function subagentDepthExceeded(depth: number, maxDepth: number): CruxyError;
218
- /** One workspace root claimed by two-or-more WRITING children of a single
219
- * `spawn_subagents` call — the unit of a disjoint-scope violation (C.33). */
220
- export interface ScopeConflict {
221
- /** The root name both children declared write scope on. */
222
- root: string;
223
- /** The task labels of every writing child that claimed `root` (always ≥2). */
224
- tasks: string[];
225
- }
226
- /**
227
- * A parallel fan-out (C.33) declared children with overlapping write scope — two
228
- * or more target the SAME workspace root while both hold mutating tools. The
229
- * ENTIRE batch is refused BEFORE any child is dispatched, so concurrent siblings
230
- * can never race on one root's files or checkpoint. Every colliding group is
231
- * named (the conflicting task pairs, per root) so the model can fix all of them
232
- * at once. Surfaced as a tool error to correct (assign distinct roots, or drop
233
- * write tools on all but one child per root).
234
- *
235
- * THE HONEST LIMIT, stated in the message: the check is on DECLARED scope — the
236
- * tools + root each child was granted — NOT the files actually written. Two
237
- * children could still touch disjoint paths under one root; cruxy refuses anyway
238
- * rather than let two potential writers race on that root's single checkpoint.
239
- */
240
- export declare function subagentScopeOverlap(conflicts: readonly ScopeConflict[]): CruxyError;
241
- /**
242
- * A subagent run failed outright (provider error, tool crash) before producing
243
- * a result. Normally folded into the structured `SubagentResult` the parent
244
- * reasons over; thrown only when the orchestrator itself cannot proceed.
245
- */
246
- export declare function subagentFailed(underlying?: unknown): CruxyError;
247
- /**
248
- * A `run_in_background` dispatch was refused because the session already holds
249
- * `jobs.maxJobs` live jobs (queued + running + paused). The MODEL corrects it, so
250
- * this is a coded tool error, not a silent drop: wait for a job to finish (or
251
- * cancel one) and retry, or run the work in the foreground.
252
- */
253
- export declare function jobLimitExceeded(maxJobs: number, live: number): CruxyError;
254
- /**
255
- * `cruxy cancel/logs/rollback <id>` named a job that does not exist in this
256
- * session. Jobs are session-scoped (NOT a daemon), so an id from a prior session
257
- * is legitimately gone — fail loud with the id rather than a silent no-op.
258
- */
259
- export declare function jobNotFound(id: string): CruxyError;
260
- /**
261
- * A background-jobs command was used while the feature is disabled. Surfaced with
262
- * how to enable it rather than pretending there are simply no jobs.
263
- */
264
- export declare function jobsDisabled(): CruxyError;
265
- /**
266
- * No test command could be detected and none is configured (C.13). cruxy never
267
- * invents a test command — the fix is always to declare one.
268
- */
269
- export declare function testCommandNotFound(): CruxyError;
270
- /**
271
- * A memory write was refused because the content matched a known secret shape
272
- * (C.29). Secrets are NEVER persisted to memory — the fix is to remember a
273
- * non-secret description, not the secret itself.
274
- */
275
- export declare function memorySecretRefused(kind: string): CruxyError;
276
- /**
277
- * A repo's project memory is present but has not been trusted on this machine
278
- * (C.29). It is never recalled into the model's context silently — a cloned repo
279
- * cannot inject notes until you review and trust them.
280
- */
281
- export declare function memoryUntrusted(root: string): CruxyError;
282
- /** A malformed memory entry was rejected (C.29) — excluded, never eval'd. */
283
- export declare function memoryInvalid(detail: string): CruxyError;
284
- /**
285
- * The local usage store (`~/.cruxy/usage/runs.json`) is corrupt or unreadable
286
- * (C.22). Never fatal: usage accounting is best-effort, so the read is SKIPPED
287
- * and this is surfaced. The fix is always to reset the file — its only content
288
- * is your own local usage history, so deleting it loses nothing but history.
289
- */
290
- export declare function usageRead(path: string, reason: string, underlying?: unknown): CruxyError;
291
- /**
292
- * No language server is available for a query: either no server is configured
293
- * for the file's language, or the configured/default binary is not installed.
294
- * THE CORE HONESTY RULE for C.12: this is a coded, actionable failure — it must
295
- * NEVER collapse into an empty result, because "no server" would then read as
296
- * "no references found". `installHint` carries the concrete next step.
297
- */
298
- export declare function lspServerNotFound(language: string, reason: "no-spec" | "binary-missing", detail?: {
299
- command?: string;
300
- installHint?: string;
301
- }): CruxyError;
302
- /**
303
- * A language server's `initialize` handshake or a single request exceeded its
304
- * timeout. The process is killed (startup) or the request rejected (per-request)
305
- * — cruxy never hangs waiting on an unresponsive server.
306
- */
307
- export declare function lspTimeout(language: string, phase: "startup" | "request", timeoutMs: number): CruxyError;
308
- /**
309
- * A language server crashed (its process exited unexpectedly) and could not be
310
- * recovered — the single automatic restart also died. Distinct from a server
311
- * that answered with zero results (that is an ordinary, non-error outcome).
312
- */
313
- export declare function lspCrashed(language: string, detail?: string): CruxyError;
314
- /**
315
- * A project configures MCP servers that this repo has not trusted, and cruxy is
316
- * running non-interactively so it cannot ask. Fail closed BEFORE any server is
317
- * spawned: trusting a server runs its code UNSANDBOXED with the user's full
318
- * privileges (a stdio server's own side effects can't be contained by the shell
319
- * sandbox), so an untrusted config must never connect silently. The wording says
320
- * this plainly — it is a real escalation, not a "gated shell in a box".
321
- */
322
- export declare function mcpUntrusted(root: string, servers: string[]): CruxyError;
323
- /**
324
- * A trusted MCP server could not be reached — spawn failed, the `initialize`
325
- * handshake errored/timed out, or `tools/list` failed. That server simply
326
- * contributes no tools (the run continues); the coded reason is surfaced so a
327
- * misconfigured server is visible, not a silent absence. External server text is
328
- * gag-scrubbed (U.8) before it reaches the user-facing cause.
329
- */
330
- export declare function mcpConnect(server: string, underlying?: unknown): CruxyError;
331
- /**
332
- * A network (`url`) MCP server was REFUSED for a security reason (SSRF address
333
- * block, a non-https/non-loopback scheme, or an endpoint redirect) — distinct
334
- * from a transient connect failure. `reason` is our own guard's message (not
335
- * server-controlled), but it is still scrubbed for symmetry with `mcpConnect`.
336
- */
337
- export declare function mcpBlocked(server: string, reason: string): CruxyError;
338
- /**
339
- * A network (`url`) MCP server's CREDENTIAL failed (C.27c) — either the endpoint
340
- * REJECTED it (401/403) or the configured `credentialRef` names no token in the
341
- * `~/.cruxy` store. Distinct from `mcpConnect` (the server was reachable) and from
342
- * `mcpBlocked` (a security refusal before connect). The token is NEVER included in
343
- * this error — only the server name and the credential NAME appear.
344
- */
345
- export declare function mcpAuth(server: string, detail: {
346
- kind: "rejected";
347
- status: number;
348
- } | {
349
- kind: "missing";
350
- ref: string;
351
- }): CruxyError;
352
- /**
353
- * A project-scope config tried to set raw `headers` on an MCP server (C.27c). A
354
- * live header value is a secret, and project scope is a possibly-cloned repo, so
355
- * this is REFUSED at load — never silently dropped (a silent drop would let a repo
356
- * believe auth is configured when it is not). The repo may only NAME a credential
357
- * via `credentialRef`; the value lives solely in the user's `~/.cruxy` store.
358
- */
359
- export declare function mcpProjectHeaders(server: string, file: string): CruxyError;
360
- /**
361
- * `web.enabled` is on but no usable search provider is configured — the API-key
362
- * environment variable is unset (or the provider is unknown). THE HONESTY RULE:
363
- * this is a coded, actionable failure, never an empty result — "no provider"
364
- * must not read as "the web had no results". `apiKeyEnv` names the variable to set.
365
- */
366
- export declare function webUnavailable(provider: string, apiKeyEnv: string): CruxyError;
367
- /**
368
- * A web search did not complete — the provider returned an HTTP error, the network
369
- * failed, or the request timed out. Distinct from a search that ran and found
370
- * nothing (that stays an ordinary `ok:true` empty result). External provider text
371
- * is gag-scrubbed (U.8) before it reaches the user-facing cause.
372
- */
373
- export declare function webSearchFailed(underlying?: unknown): CruxyError;
374
- /**
375
- * A `web_fetch` failed to retrieve a page: network error, timeout, an oversize or
376
- * non-text body, or too many redirects. Distinct from a page that was fetched but
377
- * held no readable text (an ordinary `ok:true` empty result). External response
378
- * text is gag-scrubbed (U.8) before it reaches the user-facing cause.
379
- */
380
- export declare function webFetchFailed(url: string, underlying?: unknown): CruxyError;
381
- /**
382
- * A `web_fetch` was REFUSED before any request went out (SSRF guard): a non-http(s)
383
- * scheme, or a host that resolves into a private/loopback/link-local range
384
- * (127.0.0.1, 169.254.169.254 cloud metadata, 10.x, internal DNS, …). A security
385
- * stop kept distinct from an ordinary fetch failure — the request is never
386
- * dispatched. `web.allowPrivateHosts` is the deliberate escape hatch.
387
- */
388
- export declare function webBlockedHost(url: string, reason: string): CruxyError;
389
- export declare function internal(underlying?: unknown): CruxyError;
390
- /**
391
- * A one-shot `cruxy run` ended without completing: the agent loop hit a hard stop
392
- * — the iteration cap (`max_iterations`) or a token budget (`budget`) — or was
393
- * cancelled (`aborted`). We fail loud with a non-zero exit so CI never reads a
394
- * gave-up run as success; the partial work already streamed to stdout is preserved
395
- * and the specific reason is named. `stop` is taken as a plain string so this
396
- * (low-level) module needn't depend on the agent's result type.
397
- */
398
- export declare function agentIncomplete(info: {
399
- stop: string;
400
- iterations: number;
401
- /** The loop's stopReason (the concrete budget message), when `stop === "budget"`. */
402
- reason?: string;
403
- /** The turn ceiling in force, surfaced for `max_iterations`. */
404
- maxIterations?: number;
405
- }): CruxyError;
406
- /**
407
- * Map a known provider/transport error (from `@cruxy/sdk`) to a typed
408
- * {@link CruxyError}, or `null` if it isn't one. Order matters: specific
409
- * subclasses before the `ApiError` base.
410
- */
411
- export declare function classifyProviderError(underlying: unknown): CruxyError | null;
@@ -1,31 +0,0 @@
1
- import { CruxyError } from "./types.js";
2
- /**
3
- * Rendering for {@link CruxyError}, kept separate from the data so it's testable
4
- * and swappable. {@link TerminalFormatter} renders the human, 4-part terminal
5
- * form; a `JsonFormatter` for headless output can drop in behind the same
6
- * {@link Formatter} interface later (out of scope here — this is the seam).
7
- */
8
- export interface FormatOptions {
9
- /** Append the underlying error's stack/message (hidden by default). */
10
- verbose: boolean;
11
- /** Emit ANSI color. Resolve with {@link shouldUseColor}. */
12
- color: boolean;
13
- }
14
- export interface Formatter {
15
- format(err: CruxyError, opts: FormatOptions): string;
16
- }
17
- /**
18
- * Decide whether to colorize: honor `NO_COLOR` (disable) and `FORCE_COLOR`
19
- * (enable), otherwise color only when writing to a TTY.
20
- */
21
- export declare function shouldUseColor(stream?: {
22
- isTTY?: boolean;
23
- }, env?: NodeJS.ProcessEnv): boolean;
24
- /** The default terminal formatter: title, cause, next steps, code (+ verbose). */
25
- export declare class TerminalFormatter implements Formatter {
26
- format(err: CruxyError, opts: FormatOptions): string;
27
- }
28
- /** The shared default instance. */
29
- export declare const terminalFormatter: TerminalFormatter;
30
- /** Convenience: render with the default terminal formatter. */
31
- export declare function formatError(err: CruxyError, opts: FormatOptions): string;
@@ -1,4 +0,0 @@
1
- export * from "./types.js";
2
- export * from "./format.js";
3
- export * from "./constructors.js";
4
- export * from "./boundary.js";