@claudexor/artifact-store 1.0.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 joi-lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @claudexor/artifact-store
|
|
2
|
+
|
|
3
|
+
Internal package of [Claudexor](https://github.com/razzant/claudexor) — Files-first canonical artifact store (repo-local .claudexor/runs layout).
|
|
4
|
+
|
|
5
|
+
Published as part of the Claudexor toolchain; it follows the monorepo's
|
|
6
|
+
lockstep version and has no separate semver contract. Use the `claudexor`
|
|
7
|
+
CLI (or `@claudexor/cli`) as the supported entry point.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface RunPaths {
|
|
2
|
+
runId: string;
|
|
3
|
+
root: string;
|
|
4
|
+
contextDir: string;
|
|
5
|
+
attemptsDir: string;
|
|
6
|
+
reviewsDir: string;
|
|
7
|
+
findingsDir: string;
|
|
8
|
+
arbitrationDir: string;
|
|
9
|
+
finalDir: string;
|
|
10
|
+
eventsPath: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Files-first artifact store. Canonical artifacts live under
|
|
14
|
+
* `<repo>/.claudexor/`. Nothing here is a database; an optional SQLite index can
|
|
15
|
+
* be rebuilt from these files later.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ArtifactStore {
|
|
18
|
+
readonly repoRoot: string;
|
|
19
|
+
readonly claudexorDir: string;
|
|
20
|
+
constructor(repoRoot: string, options?: {
|
|
21
|
+
claudexorDir?: string;
|
|
22
|
+
});
|
|
23
|
+
runsDir(): string;
|
|
24
|
+
workspacesDir(): string;
|
|
25
|
+
runPaths(runId: string): RunPaths;
|
|
26
|
+
/** Create the on-disk layout for a new run and return its paths. */
|
|
27
|
+
createRun(runId: string): RunPaths;
|
|
28
|
+
writeYaml(path: string, value: unknown): void;
|
|
29
|
+
writeJson(path: string, value: unknown): void;
|
|
30
|
+
writeText(path: string, text: string): void;
|
|
31
|
+
readYaml<T = unknown>(path: string): T | null;
|
|
32
|
+
/** List existing run ids (most-recent ordering is the caller's concern). */
|
|
33
|
+
listRuns(): string[];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,aAAa;aAGI,QAAQ,EAAE,MAAM;IAF5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAEF,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO;IAIrF,OAAO,IAAI,MAAM;IAIjB,aAAa,IAAI,MAAM;IAIvB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAuBjC,oEAAoE;IACpE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAgBlC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAI7C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAI7C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3C,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAU7C,4EAA4E;IAC5E,QAAQ,IAAI,MAAM,EAAE;CAGrB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
3
|
+
import { ensureDir, listDir, readTextSafe, writeJson, writeText } from "@claudexor/util";
|
|
4
|
+
/**
|
|
5
|
+
* Files-first artifact store. Canonical artifacts live under
|
|
6
|
+
* `<repo>/.claudexor/`. Nothing here is a database; an optional SQLite index can
|
|
7
|
+
* be rebuilt from these files later.
|
|
8
|
+
*/
|
|
9
|
+
export class ArtifactStore {
|
|
10
|
+
repoRoot;
|
|
11
|
+
claudexorDir;
|
|
12
|
+
constructor(repoRoot, options = {}) {
|
|
13
|
+
this.repoRoot = repoRoot;
|
|
14
|
+
this.claudexorDir = options.claudexorDir ?? join(repoRoot, ".claudexor");
|
|
15
|
+
}
|
|
16
|
+
runsDir() {
|
|
17
|
+
return join(this.claudexorDir, "runs");
|
|
18
|
+
}
|
|
19
|
+
workspacesDir() {
|
|
20
|
+
return join(this.claudexorDir, "workspaces");
|
|
21
|
+
}
|
|
22
|
+
runPaths(runId) {
|
|
23
|
+
// Id-shape fence at the single owner of run-dir layout: a runId is one
|
|
24
|
+
// path SEGMENT, never a path. This blocks `../`-style ids from escaping
|
|
25
|
+
// `.claudexor/runs` for every caller (HTTP surfaces already resolve ids
|
|
26
|
+
// via registry lookup — this is the defense-in-depth floor beneath them,
|
|
27
|
+
// the same reasoning as the envelope-id validation in dispose()).
|
|
28
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(runId)) {
|
|
29
|
+
throw new Error(`invalid run id '${runId}': a run id is a single path segment ([A-Za-z0-9._-], no separators)`);
|
|
30
|
+
}
|
|
31
|
+
const root = join(this.runsDir(), runId);
|
|
32
|
+
return {
|
|
33
|
+
runId,
|
|
34
|
+
root,
|
|
35
|
+
contextDir: join(root, "context"),
|
|
36
|
+
attemptsDir: join(root, "attempts"),
|
|
37
|
+
reviewsDir: join(root, "reviews"),
|
|
38
|
+
findingsDir: join(root, "findings"),
|
|
39
|
+
arbitrationDir: join(root, "arbitration"),
|
|
40
|
+
finalDir: join(root, "final"),
|
|
41
|
+
eventsPath: join(root, "events.jsonl"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Create the on-disk layout for a new run and return its paths. */
|
|
45
|
+
createRun(runId) {
|
|
46
|
+
const paths = this.runPaths(runId);
|
|
47
|
+
for (const dir of [
|
|
48
|
+
paths.root,
|
|
49
|
+
paths.contextDir,
|
|
50
|
+
paths.attemptsDir,
|
|
51
|
+
paths.reviewsDir,
|
|
52
|
+
paths.findingsDir,
|
|
53
|
+
paths.arbitrationDir,
|
|
54
|
+
paths.finalDir,
|
|
55
|
+
]) {
|
|
56
|
+
ensureDir(dir);
|
|
57
|
+
}
|
|
58
|
+
return paths;
|
|
59
|
+
}
|
|
60
|
+
writeYaml(path, value) {
|
|
61
|
+
writeText(path, yamlStringify(value));
|
|
62
|
+
}
|
|
63
|
+
writeJson(path, value) {
|
|
64
|
+
writeJson(path, value);
|
|
65
|
+
}
|
|
66
|
+
writeText(path, text) {
|
|
67
|
+
writeText(path, text);
|
|
68
|
+
}
|
|
69
|
+
readYaml(path) {
|
|
70
|
+
const text = readTextSafe(path);
|
|
71
|
+
if (text === null)
|
|
72
|
+
return null;
|
|
73
|
+
try {
|
|
74
|
+
return yamlParse(text);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** List existing run ids (most-recent ordering is the caller's concern). */
|
|
81
|
+
listRuns() {
|
|
82
|
+
return listDir(this.runsDir());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS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;IACpE,SAAS,CAAC,KAAa;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,MAAM,GAAG,IAAI;YAChB,KAAK,CAAC,IAAI;YACV,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,cAAc;YACpB,KAAK,CAAC,QAAQ;SACf,EAAE,CAAC;YACF,SAAS,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,KAAc;QACpC,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,KAAc;QACpC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,IAAY;QAClC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,QAAQ,CAAc,IAAY;QAChC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/B,IAAI,CAAC;YACH,OAAO,SAAS,CAAC,IAAI,CAAM,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,QAAQ;QACN,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudexor/artifact-store",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Files-first canonical artifact store (repo-local .claudexor/runs layout).",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"yaml": "^2.6.1",
|
|
20
|
+
"@claudexor/util": "1.0.0"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/razzant/claudexor.git",
|
|
25
|
+
"directory": "packages/artifact-store"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/razzant/claudexor#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/razzant/claudexor/issues"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.19"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc",
|
|
39
|
+
"typecheck": "tsc --noEmit"
|
|
40
|
+
}
|
|
41
|
+
}
|