agentrinse 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -26
- package/dist/adapters/cursor-maintenance.d.ts +54 -0
- package/dist/adapters/cursor-maintenance.d.ts.map +1 -0
- package/dist/adapters/cursor-maintenance.js +138 -0
- package/dist/adapters/cursor-maintenance.js.map +1 -0
- package/dist/adapters/docker/adapter.d.ts +13 -4
- package/dist/adapters/docker/adapter.d.ts.map +1 -1
- package/dist/adapters/docker/adapter.js +254 -45
- package/dist/adapters/docker/adapter.js.map +1 -1
- package/dist/adapters/docker/owner.d.ts +70 -0
- package/dist/adapters/docker/owner.d.ts.map +1 -0
- package/dist/adapters/docker/owner.js +359 -0
- package/dist/adapters/docker/owner.js.map +1 -0
- package/dist/adapters/grok-maintenance.d.ts +67 -0
- package/dist/adapters/grok-maintenance.d.ts.map +1 -0
- package/dist/adapters/grok-maintenance.js +193 -0
- package/dist/adapters/grok-maintenance.js.map +1 -0
- package/dist/adapters/opencode-maintenance.d.ts +23 -0
- package/dist/adapters/opencode-maintenance.d.ts.map +1 -0
- package/dist/adapters/opencode-maintenance.js +53 -0
- package/dist/adapters/opencode-maintenance.js.map +1 -0
- package/dist/adapters/provider-adapter.d.ts +2 -0
- package/dist/adapters/provider-adapter.d.ts.map +1 -1
- package/dist/adapters/provider-adapter.js +236 -53
- package/dist/adapters/provider-adapter.js.map +1 -1
- package/dist/adapters/provider-root.d.ts.map +1 -1
- package/dist/adapters/provider-root.js +24 -1
- package/dist/adapters/provider-root.js.map +1 -1
- package/dist/adapters/provider-specs.d.ts.map +1 -1
- package/dist/adapters/provider-specs.js +29 -4
- package/dist/adapters/provider-specs.js.map +1 -1
- package/dist/adapters/registry.d.ts.map +1 -1
- package/dist/adapters/registry.js +6 -1
- package/dist/adapters/registry.js.map +1 -1
- package/dist/adapters/zed-logs.d.ts +8 -0
- package/dist/adapters/zed-logs.d.ts.map +1 -0
- package/dist/adapters/zed-logs.js +103 -0
- package/dist/adapters/zed-logs.js.map +1 -0
- package/dist/commands/adapters.js +1 -1
- package/dist/commands/adapters.js.map +1 -1
- package/dist/core/provider-file-policy.d.ts +20 -0
- package/dist/core/provider-file-policy.d.ts.map +1 -1
- package/dist/core/provider-file-policy.js +65 -6
- package/dist/core/provider-file-policy.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,13 +15,15 @@ protected or eligible, creates a content-addressed plan, and revalidates the
|
|
|
15
15
|
same facts immediately before mutation.
|
|
16
16
|
|
|
17
17
|
agentrinse is not audit-only. audit establishes the evidence; apply performs
|
|
18
|
-
the approved filesystem, Git metadata, and offline database changes. `0.
|
|
18
|
+
the approved filesystem, Git metadata, and offline database changes. `0.6.0`
|
|
19
19
|
removes exact configured rebuildable artifacts, quarantines proven inactive
|
|
20
20
|
linked worktrees, repairs and locks their Git registrations, restores
|
|
21
21
|
quarantined worktrees, permanently purges explicitly selected quarantine
|
|
22
22
|
entries, and compacts supported Codex SQLite state with a retained rollback
|
|
23
23
|
copy. It also quarantines exact stale Claude debug logs and changelog cache
|
|
24
|
-
files
|
|
24
|
+
files plus Zed's exact stale `Zed.log.old` rotated application log with a
|
|
25
|
+
seven-day undo window. OpenCode, Cursor, version-gated Docker Buildx, and
|
|
26
|
+
version-gated Grok owner maintenance remain report-only.
|
|
25
27
|
|
|
26
28
|
the point is confidence: make real cleanup changes without deleting the
|
|
27
29
|
session, branch, worktree, database content, or cache that another agent still
|
|
@@ -47,12 +49,17 @@ optional external handoff for broader macOS and project debris.
|
|
|
47
49
|
| 🔒 lock recovery | operational | removes only a stale AgentRinse lock after proving its process is gone | rerun the interrupted command |
|
|
48
50
|
|
|
49
51
|
provider sessions, transcripts, credentials, configuration, and logical
|
|
50
|
-
database records remain report-only. `0.
|
|
52
|
+
database records remain report-only. `0.6.0` supports explicit offline
|
|
51
53
|
compaction for the exact current Codex `state_5`, `logs_2`, `goals_1`, and
|
|
52
54
|
`memories_1` SQLite contracts. Claude cleanup is limited to exact old debug
|
|
53
55
|
text files and its rebuildable changelog cache. AgentRinse also reports
|
|
54
56
|
Claude's native retention policy and Copilot's native session and process-log
|
|
55
|
-
maintenance.
|
|
57
|
+
maintenance. It also reports OpenCode's owner-run snapshot compaction and its
|
|
58
|
+
separate append-only server log, plus Cursor's owner-run state database
|
|
59
|
+
maintenance. Docker inventories images, containers, and supported Buildx cache
|
|
60
|
+
records but remains audit-only. Grok inventory is pinned to the inspected
|
|
61
|
+
`0.2.112` version and build revision from the audited root's canonical
|
|
62
|
+
executable, and reports its session-start memory GC without invoking it.
|
|
56
63
|
|
|
57
64
|
## agent integrations
|
|
58
65
|
|
|
@@ -64,25 +71,29 @@ logical memory records.
|
|
|
64
71
|
| --------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------- |
|
|
65
72
|
| <img width="48px" src="docs/client-openai.jpg" alt="OpenAI Codex" /> | [OpenAI Codex](https://github.com/openai/codex) | audit + offline vacuum | sessions, workspace roots, reachability, and supported SQLite state |
|
|
66
73
|
| <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | [Claude Code](https://code.claude.com/docs/en/overview) | retention + quarantine | sessions, caches, roots, native retention, and exact old files |
|
|
67
|
-
| <img width="48px" src="docs/client-cursor.jpg" alt="Cursor" /> | [Cursor](https://cursor.com/docs) | audit
|
|
74
|
+
| <img width="48px" src="docs/client-cursor.jpg" alt="Cursor" /> | [Cursor](https://cursor.com/docs) | audit + native guidance | workspace state, DB companions, and owner maintenance |
|
|
68
75
|
| <img width="48px" src="docs/client-copilot.png" alt="GitHub Copilot CLI" /> | [GitHub Copilot CLI](https://github.com/github/copilot-cli) | audit + native guidance | local sessions, process logs, and provider-owned maintenance |
|
|
69
|
-
| <img width="48px" src="docs/client-zed.svg" alt="Zed" /> | [Zed](https://zed.dev/docs/ai/overview) | audit
|
|
70
|
-
| <img width="48px" src="docs/client-opencode.png" alt="OpenCode" /> | [OpenCode](https://opencode.ai/) | audit
|
|
71
|
-
| <img width="48px" src="docs/client-grok-build.svg" alt="Grok Build" /> | [Grok Build](https://docs.x.ai/build/overview) | audit
|
|
76
|
+
| <img width="48px" src="docs/client-zed.svg" alt="Zed" /> | [Zed](https://zed.dev/docs/ai/overview) | audit + quarantine | local agent state and the exact stale rotated application log |
|
|
77
|
+
| <img width="48px" src="docs/client-opencode.png" alt="OpenCode" /> | [OpenCode](https://opencode.ai/) | audit + native guidance | local state, snapshot GC, and server-log retention |
|
|
78
|
+
| <img width="48px" src="docs/client-grok-build.svg" alt="Grok Build" /> | [Grok Build](https://docs.x.ai/build/overview) | audit + native guidance | sessions, memory, logs, worktrees, caches, and owner maintenance |
|
|
72
79
|
|
|
73
80
|
## cleanup surfaces
|
|
74
81
|
|
|
75
82
|
| Icon | Surface | Mode | What it understands |
|
|
76
83
|
| --------------------------------------------------------------------------- | ------------------------------------ | ------------------ | ----------------------------------------------------------------------- |
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
84
|
+
| <img width="48px" src="docs/icon-git-branch.svg" alt="Git branch" /> | Git worktrees | audit + quarantine | linked worktrees, refs, dirtiness, locks, processes, and provider roots |
|
|
85
|
+
| <img width="48px" src="docs/icon-file.svg" alt="Build artifact file" /> | Build artifacts | safe-clean | exact configured rebuildable directories |
|
|
86
|
+
| <img width="48px" src="docs/client-openai.jpg" alt="OpenAI Codex" /> | Codex SQLite state | experimental | schema versions, free pages, sidecars, owner processes, and rollback |
|
|
80
87
|
| <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | Claude native retention | report-only | default or user retention, settings validity, and provider ownership |
|
|
81
88
|
| <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | Claude logs and changelog cache | recoverable | exact old files, provider liveness, seven-day undo, and explicit purge |
|
|
82
89
|
| <img width="48px" src="docs/client-copilot.png" alt="GitHub Copilot CLI" /> | Copilot native maintenance | report-only | local session pruning and versioned process-log retention |
|
|
83
|
-
|
|
|
84
|
-
| <img width="48px" src="docs/client-
|
|
85
|
-
|
|
|
90
|
+
| <img width="48px" src="docs/client-zed.svg" alt="Zed" /> | Zed rotated application log | recoverable | exact `Zed.log.old`, provider liveness, seven-day undo, and purge |
|
|
91
|
+
| <img width="48px" src="docs/client-opencode.png" alt="OpenCode" /> | OpenCode native maintenance | report-only | hourly snapshot GC and the append-only server-log contract |
|
|
92
|
+
| <img width="48px" src="docs/client-cursor.jpg" alt="Cursor" /> | Cursor database maintenance | report-only | exact DB companions, orphan KV GC, and destructive chat cleanup |
|
|
93
|
+
| <img width="48px" src="docs/client-grok-build.svg" alt="Grok Build" /> | Grok native memory GC | report-only | session-start orphan cleanup, source version, and explicit refusal |
|
|
94
|
+
| <img width="48px" src="docs/icon-terminal.svg" alt="Terminal runtime" /> | Agent runtimes | audit-only, opt-in | installed agent executables and versions |
|
|
95
|
+
| <img width="48px" src="docs/client-docker-agent.svg" alt="Docker" /> | [Docker](https://docs.docker.com/) | audit-only, opt-in | images, containers, and versioned Buildx cache |
|
|
96
|
+
| <img width="48px" src="docs/icon-search.svg" alt="Cleanup search" /> | [Mole](https://github.com/tw93/Mole) | suggestions only | external dry-run cleanup opportunities on macOS |
|
|
86
97
|
|
|
87
98
|
## install
|
|
88
99
|
|
|
@@ -101,7 +112,7 @@ brew install vincentkoc/tap/agentrinse
|
|
|
101
112
|
one-off use:
|
|
102
113
|
|
|
103
114
|
```bash
|
|
104
|
-
npx agentrinse@0.
|
|
115
|
+
npx agentrinse@0.6.0 doctor
|
|
105
116
|
```
|
|
106
117
|
|
|
107
118
|
then:
|
|
@@ -221,7 +232,7 @@ agentrinse is built around refusal:
|
|
|
221
232
|
|
|
222
233
|
there is no generic `--force` escape hatch.
|
|
223
234
|
|
|
224
|
-
agentrinse `0.
|
|
235
|
+
agentrinse `0.6.0` never removes:
|
|
225
236
|
|
|
226
237
|
- provider sessions, transcripts, logical database rows, credentials, or configuration
|
|
227
238
|
- unsupported provider databases or Codex databases with unknown migrations
|
|
@@ -331,12 +342,12 @@ it can be verified before apply.
|
|
|
331
342
|
|
|
332
343
|
## platform support
|
|
333
344
|
|
|
334
|
-
| Platform | `0.
|
|
335
|
-
| -------------- |
|
|
336
|
-
| macOS | audit, artifact/worktree/Claude cleanup, DB vacuum, undo, purge |
|
|
337
|
-
| Linux | audit, artifact/worktree/Claude cleanup, DB vacuum, undo, purge |
|
|
338
|
-
| WSL | Linux contract inside the WSL filesystem
|
|
339
|
-
| native Windows | audit-only; mutation remains blocked before `1.0.0`
|
|
345
|
+
| Platform | `0.6.0` support |
|
|
346
|
+
| -------------- | ------------------------------------------------------------------- |
|
|
347
|
+
| macOS | audit, artifact/worktree/Claude/Zed cleanup, DB vacuum, undo, purge |
|
|
348
|
+
| Linux | audit, artifact/worktree/Claude/Zed cleanup, DB vacuum, undo, purge |
|
|
349
|
+
| WSL | Linux contract inside the WSL filesystem |
|
|
350
|
+
| native Windows | audit-only; mutation remains blocked before `1.0.0` |
|
|
340
351
|
|
|
341
352
|
Git and `lsof` are required for the complete diagnostic and process-ownership
|
|
342
353
|
contract. Codex DB maintenance additionally requires `sqlite3`. Docker is
|
|
@@ -371,9 +382,12 @@ unreleased build at real developer state.
|
|
|
371
382
|
|
|
372
383
|
## status
|
|
373
384
|
|
|
374
|
-
`0.
|
|
375
|
-
configured artifact cleanup, recoverable Git worktree
|
|
376
|
-
quarantine,
|
|
377
|
-
OpenCode
|
|
385
|
+
`0.6.0` ships the complete audit → plan → revalidate → apply loop, safe
|
|
386
|
+
configured artifact cleanup, recoverable Git worktree, Claude file, and exact
|
|
387
|
+
Zed rotated-log quarantine, plus recoverable offline Codex database
|
|
388
|
+
compaction. It reports OpenCode's native maintenance contract, Cursor's owner
|
|
389
|
+
database commands, Docker Buildx cache facts, and Grok's version-gated
|
|
390
|
+
session-start memory GC. Grok Build, Docker, and all other Cursor, Zed, and
|
|
391
|
+
OpenCode state remain non-mutating.
|
|
378
392
|
|
|
379
393
|
MIT licensed. built by [Vincent Koc](https://github.com/vincentkoc).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const cursorNativeMaintenanceFactsSchema: z.ZodObject<{
|
|
3
|
+
provider: z.ZodLiteral<"cursor">;
|
|
4
|
+
kind: z.ZodLiteral<"database-maintenance">;
|
|
5
|
+
evidenceDate: z.ZodLiteral<"2026-07-13">;
|
|
6
|
+
automaticRetention: z.ZodLiteral<false>;
|
|
7
|
+
installedSupportKnown: z.ZodLiteral<false>;
|
|
8
|
+
commands: z.ZodTuple<[z.ZodObject<{
|
|
9
|
+
interface: z.ZodLiteral<"command-palette">;
|
|
10
|
+
runsVacuum: z.ZodLiteral<true>;
|
|
11
|
+
command: z.ZodLiteral<"Developer: GC Agent KV Blobs">;
|
|
12
|
+
destructive: z.ZodLiteral<false>;
|
|
13
|
+
scope: z.ZodLiteral<"orphaned-agent-kv-blobs">;
|
|
14
|
+
preservesExistingChats: z.ZodLiteral<true>;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
interface: z.ZodLiteral<"command-palette">;
|
|
17
|
+
runsVacuum: z.ZodLiteral<true>;
|
|
18
|
+
command: z.ZodLiteral<"Developer: Delete Old Chats...">;
|
|
19
|
+
destructive: z.ZodLiteral<true>;
|
|
20
|
+
scope: z.ZodLiteral<"chat-history-by-age">;
|
|
21
|
+
userChoosesCutoff: z.ZodLiteral<true>;
|
|
22
|
+
}, z.core.$strip>], null>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type CursorNativeMaintenanceFacts = z.infer<typeof cursorNativeMaintenanceFactsSchema>;
|
|
25
|
+
export declare const cursorDatabaseCompanionsSchema: z.ZodArray<z.ZodObject<{
|
|
26
|
+
suffix: z.ZodEnum<{
|
|
27
|
+
"-shm": "-shm";
|
|
28
|
+
"-wal": "-wal";
|
|
29
|
+
".backup": ".backup";
|
|
30
|
+
}>;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
missing: "missing";
|
|
33
|
+
other: "other";
|
|
34
|
+
regular: "regular";
|
|
35
|
+
symlink: "symlink";
|
|
36
|
+
unknown: "unknown";
|
|
37
|
+
}>;
|
|
38
|
+
measuredBytes: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
export type CursorDatabaseCompanions = z.infer<typeof cursorDatabaseCompanionsSchema>;
|
|
42
|
+
export type CursorDatabaseParentInspection = {
|
|
43
|
+
status: "safe";
|
|
44
|
+
} | {
|
|
45
|
+
status: "missing";
|
|
46
|
+
} | {
|
|
47
|
+
status: "blocked";
|
|
48
|
+
code: "symlink" | "not-directory" | "unreadable";
|
|
49
|
+
reason: string;
|
|
50
|
+
};
|
|
51
|
+
export declare function cursorNativeMaintenanceFor(relativePath: string): CursorNativeMaintenanceFacts | undefined;
|
|
52
|
+
export declare function inspectCursorDatabaseParents(ownerRoot: string, relativePath: string): Promise<CursorDatabaseParentInspection>;
|
|
53
|
+
export declare function inspectCursorDatabaseCompanions(databasePath: string, measureBytes: boolean): Promise<CursorDatabaseCompanions>;
|
|
54
|
+
//# sourceMappingURL=cursor-maintenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-maintenance.d.ts","sourceRoot":"","sources":["../../src/adapters/cursor-maintenance.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;iBAoB7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAS9F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;kBAAmD,CAAC;AAE/F,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,MAAM,MAAM,8BAA8B,GACtC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,eAAe,GAAG,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAM5F,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,4BAA4B,GAAG,SAAS,CA6B1C;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,8BAA8B,CAAC,CAqCzC;AAED,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,wBAAwB,CAAC,CAgCnC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { lstat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
const cursorOwnerCommandSchema = z.object({
|
|
5
|
+
command: z.string().min(1),
|
|
6
|
+
interface: z.literal("command-palette"),
|
|
7
|
+
destructive: z.boolean(),
|
|
8
|
+
runsVacuum: z.literal(true),
|
|
9
|
+
});
|
|
10
|
+
export const cursorNativeMaintenanceFactsSchema = z.object({
|
|
11
|
+
provider: z.literal("cursor"),
|
|
12
|
+
kind: z.literal("database-maintenance"),
|
|
13
|
+
evidenceDate: z.literal("2026-07-13"),
|
|
14
|
+
automaticRetention: z.literal(false),
|
|
15
|
+
installedSupportKnown: z.literal(false),
|
|
16
|
+
commands: z.tuple([
|
|
17
|
+
cursorOwnerCommandSchema.extend({
|
|
18
|
+
command: z.literal("Developer: GC Agent KV Blobs"),
|
|
19
|
+
destructive: z.literal(false),
|
|
20
|
+
scope: z.literal("orphaned-agent-kv-blobs"),
|
|
21
|
+
preservesExistingChats: z.literal(true),
|
|
22
|
+
}),
|
|
23
|
+
cursorOwnerCommandSchema.extend({
|
|
24
|
+
command: z.literal("Developer: Delete Old Chats..."),
|
|
25
|
+
destructive: z.literal(true),
|
|
26
|
+
scope: z.literal("chat-history-by-age"),
|
|
27
|
+
userChoosesCutoff: z.literal(true),
|
|
28
|
+
}),
|
|
29
|
+
]),
|
|
30
|
+
});
|
|
31
|
+
const cursorDatabaseCompanionSchema = z.object({
|
|
32
|
+
suffix: z.enum([".backup", "-wal", "-shm"]),
|
|
33
|
+
status: z.enum(["missing", "regular", "symlink", "other", "unknown"]),
|
|
34
|
+
measuredBytes: z.number().int().nonnegative().optional(),
|
|
35
|
+
reason: z.string().min(1).optional(),
|
|
36
|
+
});
|
|
37
|
+
export const cursorDatabaseCompanionsSchema = z.array(cursorDatabaseCompanionSchema).length(3);
|
|
38
|
+
function relativePathParts(relativePath) {
|
|
39
|
+
return relativePath.split(/[\\/]+/u).filter(Boolean);
|
|
40
|
+
}
|
|
41
|
+
export function cursorNativeMaintenanceFor(relativePath) {
|
|
42
|
+
if (relativePathParts(relativePath).join("/") !== "User/globalStorage/state.vscdb") {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
provider: "cursor",
|
|
47
|
+
kind: "database-maintenance",
|
|
48
|
+
evidenceDate: "2026-07-13",
|
|
49
|
+
automaticRetention: false,
|
|
50
|
+
installedSupportKnown: false,
|
|
51
|
+
commands: [
|
|
52
|
+
{
|
|
53
|
+
command: "Developer: GC Agent KV Blobs",
|
|
54
|
+
interface: "command-palette",
|
|
55
|
+
destructive: false,
|
|
56
|
+
runsVacuum: true,
|
|
57
|
+
scope: "orphaned-agent-kv-blobs",
|
|
58
|
+
preservesExistingChats: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
command: "Developer: Delete Old Chats...",
|
|
62
|
+
interface: "command-palette",
|
|
63
|
+
destructive: true,
|
|
64
|
+
runsVacuum: true,
|
|
65
|
+
scope: "chat-history-by-age",
|
|
66
|
+
userChoosesCutoff: true,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export async function inspectCursorDatabaseParents(ownerRoot, relativePath) {
|
|
72
|
+
const parents = relativePathParts(relativePath).slice(0, -1);
|
|
73
|
+
let current = ownerRoot;
|
|
74
|
+
for (const part of parents) {
|
|
75
|
+
current = join(current, part);
|
|
76
|
+
try {
|
|
77
|
+
const stats = await lstat(current);
|
|
78
|
+
if (stats.isSymbolicLink()) {
|
|
79
|
+
return {
|
|
80
|
+
status: "blocked",
|
|
81
|
+
code: "symlink",
|
|
82
|
+
reason: "A Cursor database parent directory is a symlink.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (!stats.isDirectory()) {
|
|
86
|
+
return {
|
|
87
|
+
status: "blocked",
|
|
88
|
+
code: "not-directory",
|
|
89
|
+
reason: "A Cursor database parent path is not a directory.",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (error instanceof Error &&
|
|
95
|
+
"code" in error &&
|
|
96
|
+
error.code === "ENOENT") {
|
|
97
|
+
return { status: "missing" };
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
status: "blocked",
|
|
101
|
+
code: "unreadable",
|
|
102
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { status: "safe" };
|
|
107
|
+
}
|
|
108
|
+
export async function inspectCursorDatabaseCompanions(databasePath, measureBytes) {
|
|
109
|
+
return Promise.all([".backup", "-wal", "-shm"].map(async (suffix) => {
|
|
110
|
+
try {
|
|
111
|
+
const stats = await lstat(`${databasePath}${suffix}`);
|
|
112
|
+
if (stats.isSymbolicLink()) {
|
|
113
|
+
return { suffix, status: "symlink" };
|
|
114
|
+
}
|
|
115
|
+
if (!stats.isFile()) {
|
|
116
|
+
return { suffix, status: "other" };
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
suffix,
|
|
120
|
+
status: "regular",
|
|
121
|
+
...(measureBytes ? { measuredBytes: stats.size } : {}),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (error instanceof Error &&
|
|
126
|
+
"code" in error &&
|
|
127
|
+
error.code === "ENOENT") {
|
|
128
|
+
return { suffix, status: "missing" };
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
suffix,
|
|
132
|
+
status: "unknown",
|
|
133
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=cursor-maintenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-maintenance.js","sourceRoot":"","sources":["../../src/adapters/cursor-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IACvC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC7B,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IACv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,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC;YAChD,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAgB,EAAE,CAAC;YAC9C,CAAC;YACD,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE,SAAkB;gBAC1B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IACE,KAAK,YAAY,KAAK;gBACtB,MAAM,IAAI,KAAK;gBACd,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAClD,CAAC;gBACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC;YAChD,CAAC;YACD,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE,SAAkB;gBAC1B,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC/D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -2,14 +2,23 @@ import type { AuditAdapter, AuditContext, CollectionResult } from "../../contrac
|
|
|
2
2
|
import type { Finding } from "../../contracts/finding.js";
|
|
3
3
|
import type { AdapterProbe } from "../../contracts/report.js";
|
|
4
4
|
import type { ResourceSnapshot } from "../../contracts/resource.js";
|
|
5
|
-
|
|
5
|
+
import { type DockerRunner } from "./owner.js";
|
|
6
|
+
export type DockerAuditAdapterOptions = {
|
|
7
|
+
builderOverride?: string | undefined;
|
|
8
|
+
environment?: NodeJS.ProcessEnv | undefined;
|
|
9
|
+
};
|
|
6
10
|
export declare class DockerAuditAdapter implements AuditAdapter {
|
|
7
|
-
private readonly runDocker;
|
|
8
11
|
readonly id = "docker";
|
|
9
|
-
|
|
12
|
+
private dockerContext;
|
|
13
|
+
private buildxScope;
|
|
14
|
+
private readonly runDocker;
|
|
15
|
+
private readonly options;
|
|
16
|
+
constructor(runDocker?: DockerRunner, options?: DockerAuditAdapterOptions);
|
|
10
17
|
probe(_context: AuditContext): Promise<AdapterProbe>;
|
|
11
18
|
collect(context: AuditContext, probe: AdapterProbe): Promise<CollectionResult>;
|
|
12
|
-
private
|
|
19
|
+
private toDockerResource;
|
|
20
|
+
private toBuildCacheResource;
|
|
13
21
|
classify(context: AuditContext, resource: ResourceSnapshot): Promise<Finding>;
|
|
22
|
+
private buildCacheRoot;
|
|
14
23
|
}
|
|
15
24
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/docker/adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/docker/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAQL,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;CAC7C,CAAC;AAyCF,qBAAa,kBAAmB,YAAW,YAA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