@cruxy/cli 1.0.2 → 1.0.4
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/dist/agent/loop.js +3 -0
- package/dist/agent/session.js +2 -1
- package/dist/theme/tokens.js +3 -0
- package/dist/usage/collect.js +41 -2
- package/dist/usage/index.js +1 -1
- package/dist/usage/summary.js +19 -0
- package/dist/usage/types.js +9 -0
- package/package.json +1 -1
- package/dist/agent/budget.d.ts +0 -52
- package/dist/agent/index.d.ts +0 -3
- package/dist/agent/loop.d.ts +0 -159
- package/dist/agent/prompts.d.ts +0 -69
- package/dist/agent/session.d.ts +0 -212
- package/dist/approval/classify.d.ts +0 -18
- package/dist/approval/index.d.ts +0 -6
- package/dist/approval/mutex.d.ts +0 -45
- package/dist/approval/policy.d.ts +0 -43
- package/dist/approval/prompt.d.ts +0 -48
- package/dist/approval/service.d.ts +0 -36
- package/dist/approval/types.d.ts +0 -82
- package/dist/brand/index.d.ts +0 -1
- package/dist/brand/voice.d.ts +0 -94
- package/dist/checkpoint/capture.d.ts +0 -17
- package/dist/checkpoint/gate-hook.d.ts +0 -28
- package/dist/checkpoint/gate.d.ts +0 -71
- package/dist/checkpoint/git-store.d.ts +0 -61
- package/dist/checkpoint/index.d.ts +0 -10
- package/dist/checkpoint/restore.d.ts +0 -23
- package/dist/checkpoint/service.d.ts +0 -89
- package/dist/checkpoint/set-rollback.d.ts +0 -51
- package/dist/checkpoint/set.d.ts +0 -44
- package/dist/checkpoint/shadow-store.d.ts +0 -23
- package/dist/checkpoint/types.d.ts +0 -164
- package/dist/cli/commands/checkpoint.d.ts +0 -7
- package/dist/cli/commands/config.d.ts +0 -2
- package/dist/cli/commands/hooks.d.ts +0 -8
- package/dist/cli/commands/index.d.ts +0 -7
- package/dist/cli/commands/init.d.ts +0 -7
- package/dist/cli/commands/login.d.ts +0 -8
- package/dist/cli/commands/mcp.d.ts +0 -9
- package/dist/cli/commands/memory.d.ts +0 -8
- package/dist/cli/commands/pr.d.ts +0 -8
- package/dist/cli/commands/rollback.d.ts +0 -18
- package/dist/cli/commands/run.d.ts +0 -2
- package/dist/cli/commands/skills.d.ts +0 -8
- package/dist/cli/commands/test.d.ts +0 -9
- package/dist/cli/commands/usage.d.ts +0 -9
- package/dist/cli/onboard.d.ts +0 -25
- package/dist/cli/program.d.ts +0 -2
- package/dist/cli/repl.d.ts +0 -27
- package/dist/cli/session-factory.d.ts +0 -42
- package/dist/cli/stream-print.d.ts +0 -14
- package/dist/components/autocomplete.d.ts +0 -32
- package/dist/components/frame.d.ts +0 -28
- package/dist/components/fuzzy.d.ts +0 -61
- package/dist/components/index.d.ts +0 -6
- package/dist/components/input.d.ts +0 -78
- package/dist/components/keys.d.ts +0 -48
- package/dist/components/select.d.ts +0 -28
- package/dist/config/credentials.d.ts +0 -18
- package/dist/config/index.d.ts +0 -5
- package/dist/config/manager.d.ts +0 -39
- package/dist/config/owner-only.d.ts +0 -19
- package/dist/config/paths.d.ts +0 -9
- package/dist/config/project.d.ts +0 -10
- package/dist/config/schema.d.ts +0 -2143
- package/dist/constants.d.ts +0 -65
- package/dist/errors/boundary.d.ts +0 -43
- package/dist/errors/constructors.d.ts +0 -411
- package/dist/errors/format.d.ts +0 -31
- package/dist/errors/index.d.ts +0 -4
- package/dist/errors/types.d.ts +0 -270
- package/dist/hooks/config.d.ts +0 -21
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/router.d.ts +0 -58
- package/dist/hooks/runner.d.ts +0 -88
- package/dist/hooks/service.d.ts +0 -38
- package/dist/hooks/slash.d.ts +0 -48
- package/dist/hooks/trust.d.ts +0 -46
- package/dist/hooks/types.d.ts +0 -147
- package/dist/index.d.ts +0 -2
- package/dist/indexing/chunker.d.ts +0 -28
- package/dist/indexing/embedder.d.ts +0 -98
- package/dist/indexing/index.d.ts +0 -9
- package/dist/indexing/indexer.d.ts +0 -45
- package/dist/indexing/retriever.d.ts +0 -61
- package/dist/indexing/service.d.ts +0 -49
- package/dist/indexing/store.d.ts +0 -103
- package/dist/indexing/types.d.ts +0 -78
- package/dist/indexing/util.d.ts +0 -34
- package/dist/indexing/walker.d.ts +0 -53
- package/dist/jobs/approval-queue.d.ts +0 -85
- package/dist/jobs/dispatch-tool.d.ts +0 -34
- package/dist/jobs/index.d.ts +0 -6
- package/dist/jobs/log-buffer.d.ts +0 -31
- package/dist/jobs/log-renderer.d.ts +0 -32
- package/dist/jobs/manager.d.ts +0 -139
- package/dist/jobs/types.d.ts +0 -81
- package/dist/lsp/client.d.ts +0 -25
- package/dist/lsp/index.d.ts +0 -8
- package/dist/lsp/pool.d.ts +0 -48
- package/dist/lsp/registry.d.ts +0 -38
- package/dist/lsp/server.d.ts +0 -48
- package/dist/lsp/service.d.ts +0 -44
- package/dist/lsp/tools/common.d.ts +0 -50
- package/dist/lsp/tools/find-definition.d.ts +0 -23
- package/dist/lsp/tools/find-references.d.ts +0 -23
- package/dist/lsp/tools/get-diagnostics.d.ts +0 -17
- package/dist/lsp/tools/hover.d.ts +0 -23
- package/dist/lsp/tools/index.d.ts +0 -4
- package/dist/lsp/transport.d.ts +0 -39
- package/dist/lsp/types.d.ts +0 -107
- package/dist/mcp/adapter.d.ts +0 -44
- package/dist/mcp/bounds.d.ts +0 -35
- package/dist/mcp/client.d.ts +0 -19
- package/dist/mcp/demarcate.d.ts +0 -12
- package/dist/mcp/http-transport.d.ts +0 -89
- package/dist/mcp/index.d.ts +0 -12
- package/dist/mcp/service.d.ts +0 -71
- package/dist/mcp/sibling-banner.d.ts +0 -25
- package/dist/mcp/transport.d.ts +0 -30
- package/dist/mcp/trust-gate.d.ts +0 -59
- package/dist/mcp/trust.d.ts +0 -62
- package/dist/mcp/types.d.ts +0 -62
- package/dist/mcp/url-guard.d.ts +0 -48
- package/dist/memory/index.d.ts +0 -7
- package/dist/memory/recall.d.ts +0 -56
- package/dist/memory/remember-tool.d.ts +0 -28
- package/dist/memory/secrets.d.ts +0 -29
- package/dist/memory/service.d.ts +0 -92
- package/dist/memory/store.d.ts +0 -32
- package/dist/memory/trust.d.ts +0 -52
- package/dist/memory/types.d.ts +0 -101
- package/dist/net/ip-guard.d.ts +0 -55
- package/dist/onboarding/detect.d.ts +0 -26
- package/dist/onboarding/flow.d.ts +0 -28
- package/dist/onboarding/index.d.ts +0 -5
- package/dist/onboarding/io.d.ts +0 -9
- package/dist/onboarding/steps.d.ts +0 -17
- package/dist/onboarding/types.d.ts +0 -81
- package/dist/plan/approve.d.ts +0 -16
- package/dist/plan/execute.d.ts +0 -28
- package/dist/plan/index.d.ts +0 -7
- package/dist/plan/policy.d.ts +0 -26
- package/dist/plan/render.d.ts +0 -5
- package/dist/plan/service.d.ts +0 -58
- package/dist/plan/submit-plan.d.ts +0 -33
- package/dist/plan/types.d.ts +0 -60
- package/dist/render/capabilities.d.ts +0 -31
- package/dist/render/diff.d.ts +0 -18
- package/dist/render/highlight.d.ts +0 -47
- package/dist/render/index.d.ts +0 -22
- package/dist/render/layout.d.ts +0 -59
- package/dist/render/motion.d.ts +0 -76
- package/dist/render/plain-renderer.d.ts +0 -39
- package/dist/render/resize.d.ts +0 -36
- package/dist/render/screen-reader-renderer.d.ts +0 -45
- package/dist/render/state.d.ts +0 -49
- package/dist/render/tty-renderer.d.ts +0 -106
- package/dist/render/types.d.ts +0 -201
- package/dist/routing/index.d.ts +0 -2
- package/dist/routing/resolve.d.ts +0 -17
- package/dist/routing/router.d.ts +0 -47
- package/dist/routing/types.d.ts +0 -42
- package/dist/sandbox/detect.d.ts +0 -22
- package/dist/sandbox/docker-runtime.d.ts +0 -32
- package/dist/sandbox/index.d.ts +0 -7
- package/dist/sandbox/policy.d.ts +0 -26
- package/dist/sandbox/service.d.ts +0 -64
- package/dist/sandbox/types.d.ts +0 -123
- package/dist/skills/index.d.ts +0 -4
- package/dist/skills/loader.d.ts +0 -43
- package/dist/skills/parser.d.ts +0 -31
- package/dist/skills/service.d.ts +0 -41
- package/dist/skills/types.d.ts +0 -94
- package/dist/subagent/index.d.ts +0 -5
- package/dist/subagent/orchestrator.d.ts +0 -169
- package/dist/subagent/registry-scope.d.ts +0 -41
- package/dist/subagent/semaphore.d.ts +0 -56
- package/dist/subagent/spawn-tool.d.ts +0 -86
- package/dist/subagent/types.d.ts +0 -65
- package/dist/testing/detect.d.ts +0 -3
- package/dist/testing/index.d.ts +0 -5
- package/dist/testing/parse.d.ts +0 -33
- package/dist/testing/run-tests-tool.d.ts +0 -64
- package/dist/testing/runner.d.ts +0 -26
- package/dist/testing/sandbox-runner.d.ts +0 -16
- package/dist/testing/types.d.ts +0 -66
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/resolve.d.ts +0 -43
- package/dist/theme/tokens.d.ts +0 -119
- package/dist/tools/create-pull-request.d.ts +0 -27
- package/dist/tools/file/apply-patch.d.ts +0 -94
- package/dist/tools/file/edit-file.d.ts +0 -12
- package/dist/tools/file/glob.d.ts +0 -17
- package/dist/tools/file/grep-files.d.ts +0 -43
- package/dist/tools/file/index.d.ts +0 -7
- package/dist/tools/file/match.d.ts +0 -43
- package/dist/tools/file/paths.d.ts +0 -160
- package/dist/tools/file/read-file.d.ts +0 -8
- package/dist/tools/file/write-file.d.ts +0 -10
- package/dist/tools/git-status.d.ts +0 -15
- package/dist/tools/index.d.ts +0 -9
- package/dist/tools/list-files.d.ts +0 -13
- package/dist/tools/list-skills.d.ts +0 -9
- package/dist/tools/load-skill.d.ts +0 -21
- package/dist/tools/registry.d.ts +0 -23
- package/dist/tools/search-codebase.d.ts +0 -35
- package/dist/tools/shell/exec.d.ts +0 -53
- package/dist/tools/shell/index.d.ts +0 -1
- package/dist/tools/shell/resolve-shell.d.ts +0 -81
- package/dist/tools/shell/run-command.d.ts +0 -14
- package/dist/tools/types.d.ts +0 -257
- package/dist/usage/collect.d.ts +0 -40
- package/dist/usage/cost.d.ts +0 -19
- package/dist/usage/index.d.ts +0 -15
- package/dist/usage/store.d.ts +0 -37
- package/dist/usage/summary.d.ts +0 -32
- package/dist/usage/types.d.ts +0 -220
- package/dist/utils/child-tree.d.ts +0 -33
- package/dist/utils/git.d.ts +0 -17
- package/dist/utils/logger.d.ts +0 -18
- package/dist/utils/process-tree.d.ts +0 -16
- package/dist/vcs/auth.d.ts +0 -22
- package/dist/vcs/generate.d.ts +0 -74
- package/dist/vcs/git.d.ts +0 -60
- package/dist/vcs/github.d.ts +0 -50
- package/dist/vcs/guidance.d.ts +0 -20
- package/dist/vcs/index.d.ts +0 -7
- package/dist/vcs/service.d.ts +0 -61
- package/dist/vcs/types.d.ts +0 -73
- package/dist/web/demarcate.d.ts +0 -13
- package/dist/web/fetch.d.ts +0 -11
- package/dist/web/index.d.ts +0 -7
- package/dist/web/provider.d.ts +0 -29
- package/dist/web/search.d.ts +0 -17
- package/dist/web/ssrf.d.ts +0 -41
- package/dist/web/tools.d.ts +0 -20
- package/dist/web/types.d.ts +0 -64
- package/dist/workspace/add-root.d.ts +0 -27
- package/dist/workspace/index.d.ts +0 -6
- package/dist/workspace/resolve.d.ts +0 -54
- package/dist/workspace/select.d.ts +0 -41
- package/dist/workspace/types.d.ts +0 -30
- package/dist/workspace/workspace.d.ts +0 -61
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { CruxyConfig } from "../config/index.js";
|
|
2
|
-
import { CheckpointService } from "./service.js";
|
|
3
|
-
import type { CheckpointSet } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Per-root checkpoint gate (C.26 step 3). One run may mutate several declared
|
|
6
|
-
* roots; this owns one {@link CheckpointService} PER touched root (created lazily
|
|
7
|
-
* the first time a mutation is gated for that root) plus the run's
|
|
8
|
-
* {@link CheckpointSet} accumulator, so `cruxy rollback` can restore exactly the
|
|
9
|
-
* roots the run touched — no more, no less.
|
|
10
|
-
*
|
|
11
|
-
* Two invariants live here:
|
|
12
|
-
* • **exactly-touched** — {@link serviceFor} is the ONLY construction site for a
|
|
13
|
-
* per-root service, and it is called only when a mutation is actually gated for
|
|
14
|
-
* that root, so an untouched root's service is never constructed and never
|
|
15
|
-
* appears in the set.
|
|
16
|
-
* • **one set per run, shared across subagents** — the parent and every subagent
|
|
17
|
-
* share this one gate (C.14 wires the child gate over the same object), so a
|
|
18
|
-
* subagent's writes join the run's single set and are covered by the run's
|
|
19
|
-
* rollback (⚖︎JC-δ). The set manifest lives under the PRIMARY root (⚖︎#7).
|
|
20
|
-
*/
|
|
21
|
-
export type CreateCheckpointService = (root: string, config: CruxyConfig) => CheckpointService;
|
|
22
|
-
export interface CheckpointGateOptions {
|
|
23
|
-
config: CruxyConfig;
|
|
24
|
-
/** Absolute path of the primary root — home of the set manifest (⚖︎#7). */
|
|
25
|
-
primaryRoot: string;
|
|
26
|
-
/**
|
|
27
|
-
* Test seam: the sole factory for per-root services. A constructor spy passed
|
|
28
|
-
* here proves an untouched root's service is never built.
|
|
29
|
-
*/
|
|
30
|
-
createService?: CreateCheckpointService;
|
|
31
|
-
}
|
|
32
|
-
export declare class CheckpointGate {
|
|
33
|
-
private readonly config;
|
|
34
|
-
private readonly primaryRoot;
|
|
35
|
-
private readonly create;
|
|
36
|
-
private readonly services;
|
|
37
|
-
private runId;
|
|
38
|
-
private summary;
|
|
39
|
-
private set;
|
|
40
|
-
constructor(opts: CheckpointGateOptions);
|
|
41
|
-
/**
|
|
42
|
-
* Start a new undo unit for the WHOLE run (every root + the set). Resets each
|
|
43
|
-
* existing per-root service's once-per-run latch and clears the set so the next
|
|
44
|
-
* mutation begins a fresh run. The set is materialized lazily on the first member
|
|
45
|
-
* (so its `createdAt` marks the run's first mutation, and a no-mutation run
|
|
46
|
-
* writes no manifest).
|
|
47
|
-
*
|
|
48
|
-
* `runId` may be supplied to key the set manifest by a caller-chosen id (C.28: a
|
|
49
|
-
* background job passes its OWN id, so `cruxy rollback <jobId>` maps straight to
|
|
50
|
-
* that job's set and reverts exactly the job — pre- AND post-pause mutations,
|
|
51
|
-
* because a job calls this ONCE at start and never again on resume). Omitted → a
|
|
52
|
-
* fresh generated `run-…` id, unchanged from C.26.
|
|
53
|
-
*/
|
|
54
|
-
beginRun(summary: string, runId?: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Get-or-create the per-root service. The first time a root is touched this
|
|
57
|
-
* process, its service is constructed and joined to the current run; an untouched
|
|
58
|
-
* root's service is never built.
|
|
59
|
-
*/
|
|
60
|
-
serviceFor(rootName: string, rootAbsPath: string): CheckpointService;
|
|
61
|
-
/**
|
|
62
|
-
* Record that `rootName` was checkpointed this run: append its member to the set
|
|
63
|
-
* and persist the manifest under the primary root. Idempotent — later mutations
|
|
64
|
-
* to the same root this run are no-ops (the root already has exactly one member).
|
|
65
|
-
*/
|
|
66
|
-
recordMember(rootName: string, rootAbsPath: string, checkpointId: string): Promise<void>;
|
|
67
|
-
/** Root names that got a per-root service this process (inspection/tests). */
|
|
68
|
-
get touchedRoots(): readonly string[];
|
|
69
|
-
/** The current run's set, or null before its first mutation (inspection/tests). */
|
|
70
|
-
get currentSet(): CheckpointSet | null;
|
|
71
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { CaptureFile, CheckpointStore, FileEntry } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Git-object-backed checkpoint content store (C.32 primary substrate).
|
|
4
|
-
*
|
|
5
|
-
* How a snapshot works — and exactly why it can never disturb the user's git
|
|
6
|
-
* state. Every git invocation is one of these five, and nothing else:
|
|
7
|
-
*
|
|
8
|
-
* 1. `git rev-parse --absolute-git-dir` (read-only)
|
|
9
|
-
* 2. `git update-index --add -z --stdin`, with `GIT_INDEX_FILE` pointing at a
|
|
10
|
-
* **temporary index file in os.tmpdir()**. Git hashes each captured file
|
|
11
|
-
* into `.git/objects` as loose blobs and stages them *in the temp index*.
|
|
12
|
-
* The user's `.git/index` is never opened for writing.
|
|
13
|
-
* 3. `git write-tree`, same `GIT_INDEX_FILE` — writes tree objects, returns
|
|
14
|
-
* the root tree oid.
|
|
15
|
-
* 4. `git ls-files --stage -z`, same `GIT_INDEX_FILE` — reads back
|
|
16
|
-
* `mode oid stage\tpath` per file for the manifest. The temp index is then
|
|
17
|
-
* deleted.
|
|
18
|
-
* 5. `git cat-file blob <oid>` on restore/preview (read-only)
|
|
19
|
-
*
|
|
20
|
-
* No `commit-tree`, no `update-ref`, no `stash`, no branch: **no ref is ever
|
|
21
|
-
* created or moved, and HEAD / the index / the stash are never written.** The
|
|
22
|
-
* blobs and trees are deliberately *dangling* — referenced only by the manifest
|
|
23
|
-
* JSON under `.cruxy/checkpoints/`.
|
|
24
|
-
*
|
|
25
|
-
* Enforced, not assumed: {@link snapshot} fingerprints the user-visible state
|
|
26
|
-
* (raw `.git/HEAD` bytes, a hash of `.git/index`, `git for-each-ref`, and
|
|
27
|
-
* `git stash list`) before and after, and throws CRUXY_E_CHECKPOINT_FAILED
|
|
28
|
-
* naming what moved if anything drifted.
|
|
29
|
-
*
|
|
30
|
-
* Accepted trade-off: dangling objects are subject to `git gc --prune`. The
|
|
31
|
-
* default two-week grace plus retention pruning makes that a non-issue, but a
|
|
32
|
-
* user running `git gc --prune=now` can orphan a manifest — then rollback fails
|
|
33
|
-
* loudly (never restores partial state), and the shadow store remains the
|
|
34
|
-
* fallback substrate for new checkpoints.
|
|
35
|
-
*/
|
|
36
|
-
export declare class GitCheckpointStore implements CheckpointStore {
|
|
37
|
-
private readonly root;
|
|
38
|
-
readonly kind: "git";
|
|
39
|
-
constructor(root: string);
|
|
40
|
-
/** Git blob sha-1: `sha1("blob <len>\0" + content)` — matches `git hash-object`. */
|
|
41
|
-
hashContent(content: Buffer): string;
|
|
42
|
-
snapshot(files: CaptureFile[]): Promise<FileEntry[]>;
|
|
43
|
-
readContent(entry: FileEntry): Promise<Buffer>;
|
|
44
|
-
/** Dangling objects belong to git's own gc; nothing for us to sweep. */
|
|
45
|
-
collect(): Promise<void>;
|
|
46
|
-
/** Parse `git ls-files --stage -z` from the temp index into manifest entries. */
|
|
47
|
-
private readStagedEntries;
|
|
48
|
-
/**
|
|
49
|
-
* Run git with binary-safe stdout (restore must round-trip arbitrary bytes),
|
|
50
|
-
* optional stdin, and optional extra env. Local to this store on purpose —
|
|
51
|
-
* `runGitCapture` is text-mode and env-less, and the rest of the CLI should
|
|
52
|
-
* stay that way.
|
|
53
|
-
*/
|
|
54
|
-
private git;
|
|
55
|
-
/**
|
|
56
|
-
* Everything a user can observe of their git state, byte-for-byte: HEAD file,
|
|
57
|
-
* index contents, every ref (branches, tags, remotes, stash tip — packed or
|
|
58
|
-
* loose, via for-each-ref), and the full stash reflog (stash list).
|
|
59
|
-
*/
|
|
60
|
-
private fingerprint;
|
|
61
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./types.js";
|
|
2
|
-
export * from "./capture.js";
|
|
3
|
-
export * from "./git-store.js";
|
|
4
|
-
export * from "./shadow-store.js";
|
|
5
|
-
export * from "./restore.js";
|
|
6
|
-
export * from "./service.js";
|
|
7
|
-
export * from "./set.js";
|
|
8
|
-
export * from "./set-rollback.js";
|
|
9
|
-
export * from "./gate.js";
|
|
10
|
-
export * from "./gate-hook.js";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ActionPreview } from "../tools/types.js";
|
|
2
|
-
import type { Checkpoint, CheckpointStore, RollbackApplied, RollbackPlan } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Diff the current working tree against a checkpoint by content address.
|
|
5
|
-
* External attribution: a differing path the tracked run never touched is
|
|
6
|
-
* flagged `external` — unless the run executed shell commands, in which case
|
|
7
|
-
* attribution is unknowable and the plan says so instead of guessing.
|
|
8
|
-
*/
|
|
9
|
-
export declare function computeRollbackPlan(root: string, checkpoint: Checkpoint, store: CheckpointStore, gitWorkTree: boolean): Promise<RollbackPlan>;
|
|
10
|
-
/**
|
|
11
|
-
* Build the U.2 preview for a plan: patch-style entries (byte-identical with
|
|
12
|
-
* apply_patch previews) plus the external-change and boundary annotations that
|
|
13
|
-
* `renderActionPreview` places *above* the diff.
|
|
14
|
-
*/
|
|
15
|
-
export declare function buildRollbackPreview(root: string, plan: RollbackPlan, store: CheckpointStore): Promise<Extract<ActionPreview, {
|
|
16
|
-
type: "rollback";
|
|
17
|
-
}>>;
|
|
18
|
-
/**
|
|
19
|
-
* Apply a plan: recreate deleted files, revert edited ones (content and mode),
|
|
20
|
-
* then remove run-created files (and any directories that emptied out). Any
|
|
21
|
-
* failure is a loud CRUXY_E_CHECKPOINT_FAILED; re-running rollback resumes.
|
|
22
|
-
*/
|
|
23
|
-
export declare function applyRollback(root: string, plan: RollbackPlan, store: CheckpointStore): Promise<RollbackApplied>;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { CruxyConfig } from "../config/index.js";
|
|
2
|
-
import type { ApprovalDecision } from "../approval/types.js";
|
|
3
|
-
import type { ApproveAction } from "../tools/types.js";
|
|
4
|
-
import type { Checkpoint, CheckpointStore, CheckpointStoreKind, RollbackApplied } from "./types.js";
|
|
5
|
-
/** Is `root` inside a git working tree? (Decides the checkpoint substrate.) */
|
|
6
|
-
export declare function isGitWorkTree(root: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* The substrate factory: git-object store inside a repo, shadow store outside.
|
|
9
|
-
* Pass `kind` to pin the substrate (rollback must read a checkpoint back with
|
|
10
|
-
* the store that wrote it, recorded in its manifest).
|
|
11
|
-
*/
|
|
12
|
-
export declare function createCheckpointStore(root: string, kind?: CheckpointStoreKind): CheckpointStore;
|
|
13
|
-
export interface CheckpointServiceOptions {
|
|
14
|
-
root: string;
|
|
15
|
-
config: CruxyConfig;
|
|
16
|
-
/** Test seam: pin the content store (disables the git→shadow fallback). */
|
|
17
|
-
store?: CheckpointStore;
|
|
18
|
-
}
|
|
19
|
-
/** What `rollback()` needs from the caller: the U.3 gate and TTY interactivity. */
|
|
20
|
-
export interface RollbackDeps {
|
|
21
|
-
requestApproval(action: ApproveAction): Promise<ApprovalDecision>;
|
|
22
|
-
interactive: boolean;
|
|
23
|
-
}
|
|
24
|
-
export type RollbackResult =
|
|
25
|
-
/** The working tree already matches the checkpoint — nothing to do. */
|
|
26
|
-
{
|
|
27
|
-
kind: "noop";
|
|
28
|
-
checkpoint: Checkpoint;
|
|
29
|
-
}
|
|
30
|
-
/** The user saw the preview and declined; nothing was applied. */
|
|
31
|
-
| {
|
|
32
|
-
kind: "rejected";
|
|
33
|
-
feedback?: string;
|
|
34
|
-
} | {
|
|
35
|
-
kind: "applied";
|
|
36
|
-
checkpoint: Checkpoint;
|
|
37
|
-
applied: RollbackApplied;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Checkpoint lifecycle (C.32): create once before a run's first mutation,
|
|
41
|
-
* record what the run touches, list/prune, and drive the gated rollback.
|
|
42
|
-
* Manifests are JSON under `.cruxy/checkpoints/` — they survive process exit,
|
|
43
|
-
* so `cruxy rollback` works in a later invocation.
|
|
44
|
-
*/
|
|
45
|
-
export declare class CheckpointService {
|
|
46
|
-
private readonly root;
|
|
47
|
-
private readonly config;
|
|
48
|
-
private readonly pinnedStore?;
|
|
49
|
-
private runSummary;
|
|
50
|
-
private active;
|
|
51
|
-
/** In-flight `ensureCheckpoint` construction (C.33). PROMISE-latched, not
|
|
52
|
-
* value-latched: two concurrent gated writes to this root await the SAME
|
|
53
|
-
* snapshot instead of each taking one (the once-per-run latch `this.active`
|
|
54
|
-
* is only set AFTER several awaits, so a boolean/value latch would let a
|
|
55
|
-
* second caller slip through and double-snapshot). The approval mutex already
|
|
56
|
-
* serializes gated writes, so this is defense-in-depth — but it makes the
|
|
57
|
-
* service correct on its own, independent of the caller's discipline. */
|
|
58
|
-
private pending;
|
|
59
|
-
constructor(opts: CheckpointServiceOptions);
|
|
60
|
-
/** Start a new undo unit: reset the once-per-run latch and name the run. */
|
|
61
|
-
beginRun(summary: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* The auto-checkpoint hook, called from the approval seam after every allowed
|
|
64
|
-
* mutating action and latched to fire once per run — before the first
|
|
65
|
-
* mutation ever reaches disk. Returns the run's checkpoint, or `null` when
|
|
66
|
-
* the feature is disabled. Fail-loud: if a checkpoint cannot be written by
|
|
67
|
-
* either substrate, the run must not mutate without its undo protection.
|
|
68
|
-
*/
|
|
69
|
-
ensureCheckpoint(): Promise<Checkpoint | null>;
|
|
70
|
-
private buildCheckpoint;
|
|
71
|
-
/** Attribute mutated paths to the current run (persisted for later rollback). */
|
|
72
|
-
recordTouched(absPaths: string[]): Promise<void>;
|
|
73
|
-
/** The run ran a shell command: per-path attribution is no longer possible. */
|
|
74
|
-
recordShellMutation(): Promise<void>;
|
|
75
|
-
/** All checkpoints, newest first. Corrupt manifests are warned about, not fatal. */
|
|
76
|
-
list(): Promise<Checkpoint[]>;
|
|
77
|
-
/** One checkpoint by id, or the newest when `id` is omitted. Fail-loud. */
|
|
78
|
-
read(id?: string): Promise<Checkpoint>;
|
|
79
|
-
/**
|
|
80
|
-
* The whole gated restore: preview → U.3 destructive approval → apply.
|
|
81
|
-
* Non-interactive callers are refused up front — there is no auto-rollback.
|
|
82
|
-
*/
|
|
83
|
-
rollback(id: string | undefined, deps: RollbackDeps): Promise<RollbackResult>;
|
|
84
|
-
/** Enforce `checkpoint.retention`: drop oldest manifests, then GC content. */
|
|
85
|
-
prune(): Promise<void>;
|
|
86
|
-
private dir;
|
|
87
|
-
private writeManifest;
|
|
88
|
-
private readManifestFile;
|
|
89
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { CruxyConfig } from "../config/index.js";
|
|
2
|
-
import type { ActionPreview } from "../tools/types.js";
|
|
3
|
-
import { CheckpointService } from "./service.js";
|
|
4
|
-
import type { CheckpointSet, CheckpointStore, RollbackPlan, SetRollbackApplied } from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Set-based rollback orchestration (C.26 step 3). Restore every member of a run's
|
|
7
|
-
* {@link CheckpointSet} as one gated operation, with the R3/⚖︎#8 guarantees:
|
|
8
|
-
* 1. **validate-all before any apply** — every member's checkpoint must load and
|
|
9
|
-
* plan cleanly first ({@link validateSet}); a missing/corrupt one throws
|
|
10
|
-
* `CRUXY_E_CHECKPOINT_SET_INCOMPLETE` and NOTHING is applied.
|
|
11
|
-
* 2. **one combined preview** grouped by root ({@link buildSetPreview}), each with
|
|
12
|
-
* its own external-change warnings, behind one U.3 approval (⚖︎JC-ι).
|
|
13
|
-
* 3. **sequential apply, stop on first failure** ({@link applySet}) →
|
|
14
|
-
* `CRUXY_E_CHECKPOINT_SET_PARTIAL` carrying restored-vs-not; the plan is
|
|
15
|
-
* recomputed from disk each run, so an idempotent re-run finishes the job.
|
|
16
|
-
*/
|
|
17
|
-
export type CreateService = (root: string, config: CruxyConfig) => CheckpointService;
|
|
18
|
-
/** A member whose rollback has been fully validated + planned, ready to apply. */
|
|
19
|
-
export interface ValidatedMember {
|
|
20
|
-
rootName: string;
|
|
21
|
-
rootPath: string;
|
|
22
|
-
checkpointId: string;
|
|
23
|
-
plan: RollbackPlan;
|
|
24
|
-
store: CheckpointStore;
|
|
25
|
-
preview: Extract<ActionPreview, {
|
|
26
|
-
type: "rollback";
|
|
27
|
-
}>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Validate + plan EVERY member up front (R3 gate #1). Loads each root's checkpoint
|
|
31
|
-
* and computes its rollback plan/preview; the first member that cannot be loaded
|
|
32
|
-
* throws `CRUXY_E_CHECKPOINT_SET_INCOMPLETE` — before any filesystem apply — so a
|
|
33
|
-
* partial rollback can never masquerade as success.
|
|
34
|
-
*/
|
|
35
|
-
export declare function validateSet(set: CheckpointSet, config: CruxyConfig, createService?: CreateService): Promise<ValidatedMember[]>;
|
|
36
|
-
/**
|
|
37
|
-
* One combined preview grouped by root (⚖︎JC-ι): each root keeps its own file diffs
|
|
38
|
-
* and external-change warnings, so a single U.3 approval covers the whole set.
|
|
39
|
-
*/
|
|
40
|
-
export declare function buildSetPreview(set: CheckpointSet, members: ValidatedMember[]): Extract<ActionPreview, {
|
|
41
|
-
type: "rollback-set";
|
|
42
|
-
}>;
|
|
43
|
-
/**
|
|
44
|
-
* Apply the validated set sequentially, stopping on the first failure (R3/⚖︎#8).
|
|
45
|
-
* On any member's failure this throws `CRUXY_E_CHECKPOINT_SET_PARTIAL` with the
|
|
46
|
-
* restored-vs-not split; re-running (which recomputes each plan from disk) safely
|
|
47
|
-
* finishes the job.
|
|
48
|
-
*/
|
|
49
|
-
export declare function applySet(set: CheckpointSet, members: ValidatedMember[]): Promise<SetRollbackApplied>;
|
|
50
|
-
/** Is a validated set a no-op (every member's plan is empty)? */
|
|
51
|
-
export declare function setIsNoop(members: ValidatedMember[]): boolean;
|
package/dist/checkpoint/set.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { CheckpointSet, RollbackApplied, SetRollbackApplied } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Multi-root rollback sets (C.26). A run that mutates N repos produces one
|
|
4
|
-
* per-root checkpoint plus a {@link CheckpointSet} that ties them together, so
|
|
5
|
-
* `cruxy rollback` restores exactly the touched roots as one gated operation.
|
|
6
|
-
*
|
|
7
|
-
* Two guarantees live here:
|
|
8
|
-
* • **exactly the touched roots** — the applier iterates ONLY `set.members`, so
|
|
9
|
-
* an untouched root (absent from the set) is never opened;
|
|
10
|
-
* • **stop-and-report, never silent partial** (R3) — validate every member up
|
|
11
|
-
* front (missing/corrupt → `CHECKPOINT_SET_INCOMPLETE`), then apply
|
|
12
|
-
* sequentially and STOP on the first failure, throwing
|
|
13
|
-
* `CHECKPOINT_SET_PARTIAL` with the exact restored-vs-not split.
|
|
14
|
-
*/
|
|
15
|
-
/** `run-<utc-stamp>-<rand>` — sortable, collision-safe enough for a local CLI. */
|
|
16
|
-
export declare function newRunId(): string;
|
|
17
|
-
/** The set-manifest directory under the PRIMARY root (⚖︎#7). */
|
|
18
|
-
export declare function setDir(primaryRoot: string): string;
|
|
19
|
-
/** Persist a set manifest (atomic temp-then-rename), self-ignoring from git. */
|
|
20
|
-
export declare function writeSet(primaryRoot: string, set: CheckpointSet): Promise<void>;
|
|
21
|
-
/** Read a set manifest, or throw `CHECKPOINT_SET_INCOMPLETE` if missing/corrupt. */
|
|
22
|
-
export declare function readSet(primaryRoot: string, runId: string): Promise<CheckpointSet>;
|
|
23
|
-
/** List all set manifests under the primary root, newest first. */
|
|
24
|
-
export declare function listSets(primaryRoot: string): Promise<CheckpointSet[]>;
|
|
25
|
-
/**
|
|
26
|
-
* One root's rollback, pre-validated (its plan already computed): `restore`
|
|
27
|
-
* actually applies it. The orchestrator builds one per member.
|
|
28
|
-
*/
|
|
29
|
-
export interface MemberRollback {
|
|
30
|
-
rootName: string;
|
|
31
|
-
restore: () => Promise<RollbackApplied>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Apply an all-roots rollback: run each member's `restore` in order and STOP on
|
|
35
|
-
* the first failure (R3). On success, returns the restored-vs-per-root summary.
|
|
36
|
-
* On failure, throws `CHECKPOINT_SET_PARTIAL` naming the roots restored (before
|
|
37
|
-
* the failure) and those not restored (the failing one + all not-yet-attempted)
|
|
38
|
-
* — so a partial rollback can never be reported as success, and re-running (which
|
|
39
|
-
* recomputes each root from disk) safely finishes the job.
|
|
40
|
-
*
|
|
41
|
-
* The applier only ever touches roots present in `rollbacks`; an untouched root
|
|
42
|
-
* (never added to the set) is structurally impossible to open here.
|
|
43
|
-
*/
|
|
44
|
-
export declare function applySetRollback(runId: string, rollbacks: readonly MemberRollback[]): Promise<SetRollbackApplied>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CaptureFile, CheckpointStore, FileEntry } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Shadow-copy checkpoint content store (C.32 fallback substrate): used outside
|
|
4
|
-
* a git repo, or when git plumbing fails mid-snapshot. File contents live in a
|
|
5
|
-
* content-addressed pool at `.cruxy/checkpoints/objects/<sha256>` — identical
|
|
6
|
-
* content across files or checkpoints is stored once, and pruning sweeps
|
|
7
|
-
* objects no longer referenced by any surviving manifest.
|
|
8
|
-
*
|
|
9
|
-
* Writes are temp-file-then-rename so a crash can never leave a torn object; a
|
|
10
|
-
* torn *read* is impossible because an object either exists complete or not at
|
|
11
|
-
* all, and a missing object fails loudly.
|
|
12
|
-
*/
|
|
13
|
-
export declare class ShadowCheckpointStore implements CheckpointStore {
|
|
14
|
-
readonly kind: "shadow";
|
|
15
|
-
private readonly objectsDir;
|
|
16
|
-
constructor(root: string);
|
|
17
|
-
hashContent(content: Buffer): string;
|
|
18
|
-
snapshot(files: CaptureFile[]): Promise<FileEntry[]>;
|
|
19
|
-
readContent(entry: FileEntry): Promise<Buffer>;
|
|
20
|
-
collect(referenced: ReadonlySet<string>): Promise<void>;
|
|
21
|
-
/** Content-addressed write: skip if present, else temp-then-rename (atomic). */
|
|
22
|
-
private writeObject;
|
|
23
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Working-tree checkpoints (C.32): a complete snapshot of everything the agent
|
|
3
|
-
* could touch, captured before a run's first mutation, so `cruxy rollback` can
|
|
4
|
-
* undo the entire run — creates, edits, deletes — in one gated operation.
|
|
5
|
-
*
|
|
6
|
-
* Two layers, deliberately separated:
|
|
7
|
-
* • {@link CheckpointStore} — the *content substrate* (where file bytes
|
|
8
|
-
* live), swappable like VectorStore: git-object-backed in a repo, a
|
|
9
|
-
* content-addressed shadow copy otherwise.
|
|
10
|
-
* • The manifest — uniform JSON under `.cruxy/checkpoints/`, owned by the
|
|
11
|
-
* service regardless of substrate, so list/prune/rollback never care which
|
|
12
|
-
* store wrote a checkpoint.
|
|
13
|
-
*
|
|
14
|
-
* Explicit boundary: checkpoints cover WORKING-TREE file state only. They can
|
|
15
|
-
* never undo git commits, pushes, or PRs made during a run (C.15) — that is
|
|
16
|
-
* stated in the rollback preview, not silently implied.
|
|
17
|
-
*/
|
|
18
|
-
/** A file selected for capture: project-relative POSIX path + where it is on disk. */
|
|
19
|
-
export interface CaptureFile {
|
|
20
|
-
path: string;
|
|
21
|
-
absPath: string;
|
|
22
|
-
}
|
|
23
|
-
/** Which content substrate a checkpoint was written with. */
|
|
24
|
-
export type CheckpointStoreKind = "git" | "shadow";
|
|
25
|
-
/**
|
|
26
|
-
* One captured file in a checkpoint manifest. `oid` is the content address in
|
|
27
|
-
* the store that wrote it: a git blob sha-1 for the git store, a sha-256 for
|
|
28
|
-
* the shadow store. `mode` preserves the executable bit across restore.
|
|
29
|
-
*/
|
|
30
|
-
export interface FileEntry {
|
|
31
|
-
path: string;
|
|
32
|
-
mode: "100644" | "100755";
|
|
33
|
-
oid: string;
|
|
34
|
-
}
|
|
35
|
-
/** A persisted checkpoint: identity, provenance, and the full pre-run manifest. */
|
|
36
|
-
export interface Checkpoint {
|
|
37
|
-
/** Stable id, e.g. `ck-20260703T141530-a4f2`. */
|
|
38
|
-
id: string;
|
|
39
|
-
/** ISO-8601 creation time. */
|
|
40
|
-
createdAt: string;
|
|
41
|
-
/** One line describing the run this checkpoint protects. */
|
|
42
|
-
runSummary: string;
|
|
43
|
-
store: CheckpointStoreKind;
|
|
44
|
-
/** Every file that existed (and was capturable) before the run's first mutation. */
|
|
45
|
-
files: FileEntry[];
|
|
46
|
-
/**
|
|
47
|
-
* Project-relative paths the tracked run mutated through file tools, recorded
|
|
48
|
-
* as the run proceeds. At rollback time, a difference on a path NOT in this
|
|
49
|
-
* list is an *external* change — surfaced loudly in the preview.
|
|
50
|
-
*/
|
|
51
|
-
touchedPaths: string[];
|
|
52
|
-
/**
|
|
53
|
-
* True when the run executed approved shell commands: a shell command can
|
|
54
|
-
* touch any path, so per-file attribution becomes impossible and the preview
|
|
55
|
-
* says so instead of guessing.
|
|
56
|
-
*/
|
|
57
|
-
hasShellMutations: boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The content substrate seam. Implementations persist and retrieve file
|
|
61
|
-
* *contents* only — manifests are the service's job.
|
|
62
|
-
*
|
|
63
|
-
* THE invariant (git store): snapshot/read must never disturb user-visible git
|
|
64
|
-
* state — HEAD, the index, the stash, or any ref. The git store self-checks
|
|
65
|
-
* this at runtime and fails loudly on drift.
|
|
66
|
-
*/
|
|
67
|
-
export interface CheckpointStore {
|
|
68
|
-
readonly kind: CheckpointStoreKind;
|
|
69
|
-
/** Persist the current contents of `files`; returns the manifest entries. */
|
|
70
|
-
snapshot(files: CaptureFile[]): Promise<FileEntry[]>;
|
|
71
|
-
/** The content address `snapshot` would give this buffer (for diffing). */
|
|
72
|
-
hashContent(content: Buffer): string;
|
|
73
|
-
/** Read one captured file's bytes back. Throws CRUXY_E_CHECKPOINT_FAILED if gone. */
|
|
74
|
-
readContent(entry: FileEntry): Promise<Buffer>;
|
|
75
|
-
/**
|
|
76
|
-
* Best-effort GC after prune: drop stored content whose oid is no longer
|
|
77
|
-
* referenced by any surviving manifest. The git store is a no-op (dangling
|
|
78
|
-
* objects belong to git's own gc); the shadow store sweeps its object pool.
|
|
79
|
-
*/
|
|
80
|
-
collect(referenced: ReadonlySet<string>): Promise<void>;
|
|
81
|
-
}
|
|
82
|
-
/** What rollback will do to one path. */
|
|
83
|
-
export type RollbackAction =
|
|
84
|
-
/** The run deleted it — recreate from the checkpoint. */
|
|
85
|
-
"recreate"
|
|
86
|
-
/** The run edited it — revert content (and mode) to the checkpoint. */
|
|
87
|
-
| "revert"
|
|
88
|
-
/** The run created it — delete it. */
|
|
89
|
-
| "delete";
|
|
90
|
-
export interface RollbackEntry {
|
|
91
|
-
path: string;
|
|
92
|
-
action: RollbackAction;
|
|
93
|
-
/**
|
|
94
|
-
* True when this path changed since the checkpoint but the tracked run never
|
|
95
|
-
* touched it — concurrent user (or other-tool) work that rollback would
|
|
96
|
-
* clobber. Always surfaced in the preview; never overwritten silently.
|
|
97
|
-
*/
|
|
98
|
-
external: boolean;
|
|
99
|
-
/** Checkpoint-side content to restore (recreate/revert; absent for delete). */
|
|
100
|
-
entry?: FileEntry;
|
|
101
|
-
}
|
|
102
|
-
/** The computed diff between the current working tree and a checkpoint. */
|
|
103
|
-
export interface RollbackPlan {
|
|
104
|
-
checkpoint: Checkpoint;
|
|
105
|
-
/** Sorted by path; empty means the tree already matches the checkpoint. */
|
|
106
|
-
entries: RollbackEntry[];
|
|
107
|
-
/** The `external: true` paths, for the preview's warning block. */
|
|
108
|
-
externalPaths: string[];
|
|
109
|
-
/** Mirrors {@link Checkpoint.hasShellMutations}: attribution is unknowable. */
|
|
110
|
-
attributionUnknown: boolean;
|
|
111
|
-
}
|
|
112
|
-
/** Counts of what a successful rollback actually did. */
|
|
113
|
-
export interface RollbackApplied {
|
|
114
|
-
recreated: number;
|
|
115
|
-
reverted: number;
|
|
116
|
-
deleted: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* One touched root inside a {@link CheckpointSet}: the declared root's name (for
|
|
120
|
-
* attribution in the preview), its absolute path, and the id of the per-root
|
|
121
|
-
* checkpoint that protects it. There is exactly ONE member per root the run
|
|
122
|
-
* mutated — an untouched root has no member and is never opened at rollback.
|
|
123
|
-
*/
|
|
124
|
-
export interface CheckpointSetMember {
|
|
125
|
-
/** Declared workspace-root name (shown in the grouped preview). */
|
|
126
|
-
rootName: string;
|
|
127
|
-
/** Absolute path of the root (where its `.cruxy/checkpoints/` live). */
|
|
128
|
-
rootPath: string;
|
|
129
|
-
/** The checkpoint id within that root. */
|
|
130
|
-
checkpointId: string;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* A run's rollback unit across N repos (C.26). `cruxy rollback` restores **all
|
|
134
|
-
* members** of a set as one gated operation — exactly the roots the run touched,
|
|
135
|
-
* no more (untouched roots are absent) and no less (a touched root missing its
|
|
136
|
-
* member is a loud `CRUXY_E_CHECKPOINT_SET_INCOMPLETE`, never a silent partial).
|
|
137
|
-
*
|
|
138
|
-
* The set manifest lives under the PRIMARY root's `.cruxy/checkpoints/sets/`, so
|
|
139
|
-
* it travels with the workspace and survives `rm -rf ~/.cruxy`. The member
|
|
140
|
-
* checkpoints themselves live in each root, exactly as in the single-root case.
|
|
141
|
-
*/
|
|
142
|
-
export interface CheckpointSet {
|
|
143
|
-
/** Stable run id, e.g. `run-20260708T031500-a4f2`. */
|
|
144
|
-
runId: string;
|
|
145
|
-
/** ISO-8601 creation time (of the set, i.e. the run's first mutation). */
|
|
146
|
-
createdAt: string;
|
|
147
|
-
/** One line describing the run this set protects. */
|
|
148
|
-
runSummary: string;
|
|
149
|
-
/** One entry per TOUCHED root. */
|
|
150
|
-
members: CheckpointSetMember[];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* The outcome of a successful all-roots rollback: which roots were restored and
|
|
154
|
-
* what each did. On a mid-apply failure this is NOT returned — a
|
|
155
|
-
* `CRUXY_E_CHECKPOINT_SET_PARTIAL` is thrown instead, carrying the restored-vs-not
|
|
156
|
-
* split (R3), so a partial can never read as success.
|
|
157
|
-
*/
|
|
158
|
-
export interface SetRollbackApplied {
|
|
159
|
-
runId: string;
|
|
160
|
-
/** Root names restored, in apply order. */
|
|
161
|
-
restored: string[];
|
|
162
|
-
/** Per-root counts, keyed by root name. */
|
|
163
|
-
perRoot: Record<string, RollbackApplied>;
|
|
164
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy checkpoint` (C.32) — inspect the working-tree snapshots that back
|
|
4
|
-
* `cruxy rollback`. Creation is automatic (before a run's first mutation);
|
|
5
|
-
* this command only lists.
|
|
6
|
-
*/
|
|
7
|
-
export declare function checkpointCommand(): Command;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy hooks` — inspect and trust hooks + custom slash commands (C.19).
|
|
4
|
-
* `list` shows the resolved catalog (including which project hooks are trusted
|
|
5
|
-
* and any malformed definitions); `trust <path>` records the explicit,
|
|
6
|
-
* reviewed decision to run a project's hooks, bound to their current fingerprint.
|
|
7
|
-
*/
|
|
8
|
-
export declare function hooksCommand(): Command;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy index` — build or refresh the local codebase search index that backs
|
|
4
|
-
* the `search_codebase` tool. `--status` reports the current state without
|
|
5
|
-
* modifying it; `--force` re-embeds every file regardless of content hashes.
|
|
6
|
-
*/
|
|
7
|
-
export declare function indexCommand(): Command;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy init` — set up a project (U.6): ensure a key (acquired only if missing),
|
|
4
|
-
* offer to scaffold a project `CRUXY.md`, and offer a first-win demo run. Like
|
|
5
|
-
* `login`, it's interactive-only.
|
|
6
|
-
*/
|
|
7
|
-
export declare function initCommand(): Command;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy login` — set or replace the API key on demand (U.6). Runs the key step
|
|
4
|
-
* of onboarding (always, even if a key already resolves — this is how you
|
|
5
|
-
* re-key / switch), validates it live, and persists it to the credentials store.
|
|
6
|
-
* Non-interactive invocations fail loud rather than hang.
|
|
7
|
-
*/
|
|
8
|
-
export declare function loginCommand(): Command;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy mcp` — inspect and control MCP server integration (C.27). `list` shows
|
|
4
|
-
* the configured servers and whether this repo's config is trusted; `trust`
|
|
5
|
-
* records the explicit decision to connect them, bound to the current config
|
|
6
|
-
* fingerprint. Trusting a server runs its code UNSANDBOXED with your privileges,
|
|
7
|
-
* so `trust` restates that plainly before recording.
|
|
8
|
-
*/
|
|
9
|
-
export declare function mcpCommand(): Command;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy memory` — inspect and control persistent memory (C.29). `list` shows
|
|
4
|
-
* user + project entries and whether project memory is trusted (recalled);
|
|
5
|
-
* `forget`/`clear` remove entries; `trust` records the explicit decision to
|
|
6
|
-
* recall a repo's project memory, bound to its current fingerprint.
|
|
7
|
-
*/
|
|
8
|
-
export declare function memoryCommand(): Command;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy pr` — turn the current changes into a pull request (C.15). Generates the
|
|
4
|
-
* branch name, conventional commit, and PR title/body from the diff with the
|
|
5
|
-
* model, then runs branch → commit → push → open-PR behind the one U.3 approval.
|
|
6
|
-
* The forge token comes from the environment / `gh`; it's never prompted or stored.
|
|
7
|
-
*/
|
|
8
|
-
export declare function prCommand(): Command;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `cruxy rollback [id]` (C.32/C.26) — restore the working tree to a run's
|
|
4
|
-
* checkpoint(s), undoing everything an agent run changed in one operation.
|
|
5
|
-
* Destructive by definition, so it is preview-first and gated through U.3 at the
|
|
6
|
-
* destructive tier, ungrantable; non-TTY is refused with a coded error before
|
|
7
|
-
* anything is computed. Out of scope, stated in the preview: commits, pushes, and
|
|
8
|
-
* PRs made during the run are not undone.
|
|
9
|
-
*
|
|
10
|
-
* Routing:
|
|
11
|
-
* • an explicit `<id>` that names a run/JOB set (C.28: a background job's id) →
|
|
12
|
-
* set-based rollback of exactly that run, restoring every root it touched;
|
|
13
|
-
* • an explicit `<id>` that is a checkpoint id → single-root rollback (escape
|
|
14
|
-
* hatch; also the recovery route if the primary root's set index was removed);
|
|
15
|
-
* • no id, a set manifest exists → set-based rollback of the latest run;
|
|
16
|
-
* • no id, no set manifest → JC-F fallback to legacy single-root, logged.
|
|
17
|
-
*/
|
|
18
|
-
export declare function rollbackCommand(): Command;
|