@claudexor/util 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 +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +220 -0
- package/dist/index.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +37 -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/util
|
|
2
|
+
|
|
3
|
+
Internal package of [Claudexor](https://github.com/razzant/claudexor) — Low-level utilities (ids, hashing, fs, redaction) with no Claudexor deps.
|
|
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,48 @@
|
|
|
1
|
+
export { CLAUDEXOR_VERSION } from "./version.js";
|
|
2
|
+
/** Generate a short unique id, optionally prefixed (e.g. "run-3f2a...."). */
|
|
3
|
+
export declare function newId(prefix?: string): string;
|
|
4
|
+
/** Current time as an ISO-8601 string. */
|
|
5
|
+
export declare function nowIso(): string;
|
|
6
|
+
/** sha256 of a string, returned as "sha256:<hex>". */
|
|
7
|
+
export declare function sha256(data: string): string;
|
|
8
|
+
/** Deterministic hash of a JSON-serializable value (stable key ordering). */
|
|
9
|
+
export declare function hashJson(value: unknown): string;
|
|
10
|
+
/** JSON.stringify with sorted object keys for stable hashing. */
|
|
11
|
+
export declare function stableStringify(value: unknown): string;
|
|
12
|
+
export declare function ensureDir(path: string): void;
|
|
13
|
+
export declare function writeText(path: string, text: string): void;
|
|
14
|
+
export declare function writeJson(path: string, value: unknown): void;
|
|
15
|
+
export declare function appendLine(path: string, line: string): void;
|
|
16
|
+
/** Read a text file; null on ANY error. BY DESIGN missing and unreadable/
|
|
17
|
+
* corrupt are indistinguishable — callers that must tell them apart (e.g.
|
|
18
|
+
* daemon load salvage) check existence first. */
|
|
19
|
+
export declare function readTextSafe(path: string): string | null;
|
|
20
|
+
/** Read+parse JSON; null on ANY error (same by-design contract as readTextSafe). */
|
|
21
|
+
export declare function readJsonSafe<T = unknown>(path: string): T | null;
|
|
22
|
+
export declare function pathExists(path: string): boolean;
|
|
23
|
+
export declare function listDir(path: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Best-effort per-user home for GUI-launched daemons. macOS launch contexts can
|
|
26
|
+
* have a sparse environment; never let a missing/invalid home collapse storage
|
|
27
|
+
* to `/.claudexor`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function userHomeDir(): string;
|
|
30
|
+
export declare function userConfigDir(): string;
|
|
31
|
+
export declare function noProjectRepoRoot(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Best-effort redaction of obvious secret tokens from text destined for logs or
|
|
34
|
+
* artifacts. This is defense-in-depth, never the primary control: secrets must
|
|
35
|
+
* not reach this layer in the first place.
|
|
36
|
+
*/
|
|
37
|
+
export declare function redactSecrets(text: string): string;
|
|
38
|
+
export declare function containsSecretLikeToken(text: string): boolean;
|
|
39
|
+
export declare function assertNoInlineSecretValues(value: unknown, path?: string, context?: string): void;
|
|
40
|
+
/** The machine-readable `code` a typed error carries (e.g. inline_secret_rejected), if any. */
|
|
41
|
+
export declare function errorCode(err: unknown): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Invoke an optional observer callback without letting its errors affect the
|
|
44
|
+
* caller. Observers (GUI/service event sinks, run-start hooks) are untrusted:
|
|
45
|
+
* a throwing observer must never change canonical run state or terminal status.
|
|
46
|
+
*/
|
|
47
|
+
export declare function safeInvoke<T>(fn: ((arg: T) => void) | undefined, arg: T): void;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAYjD,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,MAAM,SAAK,GAAG,MAAM,CAGzC;AAED,0CAA0C;AAC1C,wBAAgB,MAAM,IAAI,MAAM,CAE/B;AAED,sDAAsD;AACtD,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,6EAA6E;AAC7E,w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AAG,MAAM,GAAG,SAAS,CAK1D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAO9E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
export { CLAUDEXOR_VERSION } from "./version.js";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
6
|
+
/** Generate a short unique id, optionally prefixed (e.g. "run-3f2a...."). */
|
|
7
|
+
export function newId(prefix = "") {
|
|
8
|
+
const id = randomUUID().replace(/-/g, "").slice(0, 12);
|
|
9
|
+
return prefix ? `${prefix}-${id}` : id;
|
|
10
|
+
}
|
|
11
|
+
/** Current time as an ISO-8601 string. */
|
|
12
|
+
export function nowIso() {
|
|
13
|
+
return new Date().toISOString();
|
|
14
|
+
}
|
|
15
|
+
/** sha256 of a string, returned as "sha256:<hex>". */
|
|
16
|
+
export function sha256(data) {
|
|
17
|
+
return "sha256:" + createHash("sha256").update(data).digest("hex");
|
|
18
|
+
}
|
|
19
|
+
/** Deterministic hash of a JSON-serializable value (stable key ordering). */
|
|
20
|
+
export function hashJson(value) {
|
|
21
|
+
return sha256(stableStringify(value));
|
|
22
|
+
}
|
|
23
|
+
/** JSON.stringify with sorted object keys for stable hashing. */
|
|
24
|
+
export function stableStringify(value) {
|
|
25
|
+
return JSON.stringify(sortKeys(value));
|
|
26
|
+
}
|
|
27
|
+
function sortKeys(value) {
|
|
28
|
+
if (Array.isArray(value))
|
|
29
|
+
return value.map(sortKeys);
|
|
30
|
+
if (value && typeof value === "object") {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const key of Object.keys(value).sort()) {
|
|
33
|
+
out[key] = sortKeys(value[key]);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
export function ensureDir(path) {
|
|
40
|
+
// DECIDED TRADEOFF: `mode` applies only at creation (POSIX). These helpers
|
|
41
|
+
// also write into USER-CHOSEN locations (benchmark outputs, project dirs),
|
|
42
|
+
// so re-chmodding a PRE-EXISTING directory here would silently lock down
|
|
43
|
+
// directories Claudexor does not own. Claudexor-owned SENSITIVE stores
|
|
44
|
+
// (secrets, daemon token) assert their own permissions at their writers.
|
|
45
|
+
mkdirSync(path, { recursive: true, mode: 0o700 });
|
|
46
|
+
}
|
|
47
|
+
export function writeText(path, text) {
|
|
48
|
+
ensureDir(dirname(path));
|
|
49
|
+
writeFileSync(path, text, { encoding: "utf8", mode: 0o600 });
|
|
50
|
+
}
|
|
51
|
+
export function writeJson(path, value) {
|
|
52
|
+
writeText(path, JSON.stringify(value, null, 2) + "\n");
|
|
53
|
+
}
|
|
54
|
+
export function appendLine(path, line) {
|
|
55
|
+
ensureDir(dirname(path));
|
|
56
|
+
writeFileSync(path, line.endsWith("\n") ? line : line + "\n", { flag: "a", mode: 0o600 });
|
|
57
|
+
}
|
|
58
|
+
/** Read a text file; null on ANY error. BY DESIGN missing and unreadable/
|
|
59
|
+
* corrupt are indistinguishable — callers that must tell them apart (e.g.
|
|
60
|
+
* daemon load salvage) check existence first. */
|
|
61
|
+
export function readTextSafe(path) {
|
|
62
|
+
try {
|
|
63
|
+
return readFileSync(path, "utf8");
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Read+parse JSON; null on ANY error (same by-design contract as readTextSafe). */
|
|
70
|
+
export function readJsonSafe(path) {
|
|
71
|
+
const text = readTextSafe(path);
|
|
72
|
+
if (text === null)
|
|
73
|
+
return null;
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(text);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function pathExists(path) {
|
|
82
|
+
return existsSync(path);
|
|
83
|
+
}
|
|
84
|
+
export function listDir(path) {
|
|
85
|
+
try {
|
|
86
|
+
return readdirSync(path);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function usableAbsoluteDir(raw) {
|
|
93
|
+
const value = raw?.trim();
|
|
94
|
+
if (!value || value === "/" || value === "." || value === "~" || !isAbsolute(value))
|
|
95
|
+
return null;
|
|
96
|
+
return value.replace(/\/+$/, "");
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Best-effort per-user home for GUI-launched daemons. macOS launch contexts can
|
|
100
|
+
* have a sparse environment; never let a missing/invalid home collapse storage
|
|
101
|
+
* to `/.claudexor`.
|
|
102
|
+
*/
|
|
103
|
+
export function userHomeDir() {
|
|
104
|
+
const home = usableAbsoluteDir(process.env.HOME) ??
|
|
105
|
+
usableAbsoluteDir(process.env.USERPROFILE) ??
|
|
106
|
+
usableAbsoluteDir(homedir());
|
|
107
|
+
if (!home) {
|
|
108
|
+
throw new Error("Unable to resolve a safe user home directory; set HOME or CLAUDEXOR_CONFIG_DIR");
|
|
109
|
+
}
|
|
110
|
+
return home;
|
|
111
|
+
}
|
|
112
|
+
export function userConfigDir() {
|
|
113
|
+
const override = process.env.CLAUDEXOR_CONFIG_DIR?.trim();
|
|
114
|
+
if (override) {
|
|
115
|
+
const safe = usableAbsoluteDir(override);
|
|
116
|
+
if (!safe)
|
|
117
|
+
throw new Error("CLAUDEXOR_CONFIG_DIR must be a safe absolute path");
|
|
118
|
+
return safe;
|
|
119
|
+
}
|
|
120
|
+
return join(userHomeDir(), ".claudexor");
|
|
121
|
+
}
|
|
122
|
+
export function noProjectRepoRoot() {
|
|
123
|
+
return join(userHomeDir(), ".cache", "claudexor", "no-project");
|
|
124
|
+
}
|
|
125
|
+
const SECRET_PATTERNS = [
|
|
126
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,
|
|
127
|
+
/\bghp_[A-Za-z0-9]{20,}\b/g,
|
|
128
|
+
/\bgho_[A-Za-z0-9]{20,}\b/g,
|
|
129
|
+
/\bghs_[A-Za-z0-9]{20,}\b/g,
|
|
130
|
+
/\bghu_[A-Za-z0-9]{20,}\b/g,
|
|
131
|
+
/\bglpat-[A-Za-z0-9_-]{16,}\b/g,
|
|
132
|
+
/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g,
|
|
133
|
+
/\bsk-or-v1-[A-Za-z0-9]{20,}\b/g,
|
|
134
|
+
/\bsk-[A-Za-z0-9_-]{20,}\b/g,
|
|
135
|
+
/\bAIza[A-Za-z0-9_-]{30,}\b/g,
|
|
136
|
+
/\bxai-[A-Za-z0-9_-]{20,}\b/g,
|
|
137
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
138
|
+
// Slack tokens incl. xoxe (refresh) and xoxc (session) classes.
|
|
139
|
+
/\bxox[abceprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
140
|
+
// Cursor API keys (key_<hex>); OpenRouter keys (sk-or-v1-... handled above).
|
|
141
|
+
/\bkey_[A-Za-z0-9]{20,}\b/g,
|
|
142
|
+
// Google OAuth access tokens.
|
|
143
|
+
/\bya29\.[A-Za-z0-9._-]{20,}\b/g,
|
|
144
|
+
// npm granular access tokens.
|
|
145
|
+
/\bnpm_[A-Za-z0-9]{20,}\b/g,
|
|
146
|
+
// PEM private key blocks (RSA/EC/OPENSSH/PKCS8 headers all match).
|
|
147
|
+
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
|
|
148
|
+
// Bearer tokens (length-gated to avoid redacting prose like "Bearer of news").
|
|
149
|
+
/\bBearer\s+[A-Za-z0-9._~+/-]{20,}=*/gi,
|
|
150
|
+
// JWTs (header.payload.signature) — anthropic/cursor/openai OAuth tokens.
|
|
151
|
+
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}\b/g,
|
|
152
|
+
];
|
|
153
|
+
/**
|
|
154
|
+
* Best-effort redaction of obvious secret tokens from text destined for logs or
|
|
155
|
+
* artifacts. This is defense-in-depth, never the primary control: secrets must
|
|
156
|
+
* not reach this layer in the first place.
|
|
157
|
+
*/
|
|
158
|
+
export function redactSecrets(text) {
|
|
159
|
+
let out = text;
|
|
160
|
+
for (const pattern of SECRET_PATTERNS)
|
|
161
|
+
out = out.replace(pattern, "[redacted]");
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
export function containsSecretLikeToken(text) {
|
|
165
|
+
return redactSecrets(text) !== text;
|
|
166
|
+
}
|
|
167
|
+
export function assertNoInlineSecretValues(value, path = "$", context = "run params") {
|
|
168
|
+
if (typeof value === "string") {
|
|
169
|
+
if (containsSecretLikeToken(value)) {
|
|
170
|
+
// Prompts get a tailored remediation: they are DURABLE run artifacts
|
|
171
|
+
// (task contracts, transcripts, review packets), so a pasted live
|
|
172
|
+
// credential would outlive the run. There is deliberately NO bypass
|
|
173
|
+
// flag for this fence.
|
|
174
|
+
const inPrompt = /\.prompt(\[|\.|$)/.test(path);
|
|
175
|
+
const remediation = inPrompt
|
|
176
|
+
? "the prompt contains a secret-like value; prompts are durable run artifacts — remove the credential (store it with `claudexor secrets set` and reference it instead) and retry"
|
|
177
|
+
: "store values via secrets and pass refs/profiles";
|
|
178
|
+
throw Object.assign(new Error(`secret-like value is not accepted in ${context} (${path}); ${remediation}`), {
|
|
179
|
+
status: 400,
|
|
180
|
+
code: "inline_secret_rejected",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!value || typeof value !== "object")
|
|
186
|
+
return;
|
|
187
|
+
if (Array.isArray(value)) {
|
|
188
|
+
value.forEach((v, i) => assertNoInlineSecretValues(v, `${path}[${i}]`, context));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
for (const [key, child] of Object.entries(value)) {
|
|
192
|
+
if (key === "env" || key === "secrets" || /(^|[_-])(secret|token|password|api[_-]?key)($|[_-])/i.test(key)) {
|
|
193
|
+
throw Object.assign(new Error(`inline secrets/env are not accepted in ${context} (${path}.${key}); store values via secrets and pass refs/profiles`), { status: 400, code: "inline_secret_rejected" });
|
|
194
|
+
}
|
|
195
|
+
assertNoInlineSecretValues(child, `${path}.${key}`, context);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/** The machine-readable `code` a typed error carries (e.g. inline_secret_rejected), if any. */
|
|
199
|
+
export function errorCode(err) {
|
|
200
|
+
if (err && typeof err === "object" && "code" in err && typeof err.code === "string") {
|
|
201
|
+
return err.code;
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Invoke an optional observer callback without letting its errors affect the
|
|
207
|
+
* caller. Observers (GUI/service event sinks, run-start hooks) are untrusted:
|
|
208
|
+
* a throwing observer must never change canonical run state or terminal status.
|
|
209
|
+
*/
|
|
210
|
+
export function safeInvoke(fn, arg) {
|
|
211
|
+
if (!fn)
|
|
212
|
+
return;
|
|
213
|
+
try {
|
|
214
|
+
fn(arg);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
/* observer errors are isolated from control-plane state */
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,Y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5E,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,SAAS,IAAI,sDAAsD,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3G,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,KAAK,CAAC,0CAA0C,OAAO,KAAK,IAAI,IAAI,GAAG,oDAAoD,CAAC,EAChI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAChD,CAAC;QACJ,CAAC;QACD,0BAA0B,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,OAAQ,GAAyB,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3G,OAAQ,GAAwB,CAAC,IAAI,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAI,EAAkC,EAAE,GAAM;IACtE,IAAI,CAAC,EAAE;QAAE,OAAO;IAChB,IAAI,CAAC;QACH,EAAE,CAAC,GAAG,CAAC,CAAC;IACV,CAAC;IAAC,MAAM,CAAC;QACP,2DAA2D;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// GENERATED by scripts/gen-version.mjs from the root package.json — do not edit by hand.
|
|
2
|
+
// Run `pnpm gen:version` after bumping the root version (changesets keeps the
|
|
3
|
+
// workspace manifests in lockstep). The docs-truth gate enforces parity.
|
|
4
|
+
export const CLAUDEXOR_VERSION = "1.0.0";
|
|
5
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8EAA8E;AAC9E,yEAAyE;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudexor/util",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Low-level utilities (ids, hashing, fs, redaction) with no Claudexor deps.",
|
|
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
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/razzant/claudexor.git",
|
|
21
|
+
"directory": "packages/util"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/razzant/claudexor#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/razzant/claudexor/issues"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.19"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"typecheck": "tsc --noEmit"
|
|
36
|
+
}
|
|
37
|
+
}
|