@shapeshift-labs/loom 0.1.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 +248 -0
- package/dist/args.d.ts +9 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +52 -0
- package/dist/args.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +83 -0
- package/dist/cli.js.map +1 -0
- package/dist/common.d.ts +15 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +82 -0
- package/dist/common.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/diff.d.ts +5 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +24 -0
- package/dist/diff.js.map +1 -0
- package/dist/glob.d.ts +3 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +58 -0
- package/dist/glob.js.map +1 -0
- package/dist/graph.d.ts +5 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +11 -0
- package/dist/graph.js.map +1 -0
- package/dist/help.d.ts +2 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +25 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +3 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +43 -0
- package/dist/init.js.map +1 -0
- package/dist/output.d.ts +2 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +45 -0
- package/dist/output.js.map +1 -0
- package/dist/project.d.ts +7 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +33 -0
- package/dist/project.js.map +1 -0
- package/dist/scan.d.ts +8 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +174 -0
- package/dist/scan.js.map +1 -0
- package/dist/snapshot.d.ts +7 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +59 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/status.d.ts +8 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +51 -0
- package/dist/status.js.map +1 -0
- package/dist/store.d.ts +14 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +66 -0
- package/dist/store.js.map +1 -0
- package/dist/swarm.d.ts +2 -0
- package/dist/swarm.d.ts.map +1 -0
- package/dist/swarm.js +14 -0
- package/dist/swarm.js.map +1 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/frontier.source-policy.json +6 -0
- package/package.json +76 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { abs, pathExists, readJson, resolveRoot, writeJson } from './common.js';
|
|
4
|
+
export const loomConfigFile = 'loom.json';
|
|
5
|
+
export const defaultIncludes = [
|
|
6
|
+
'src/**/*.js',
|
|
7
|
+
'src/**/*.mjs',
|
|
8
|
+
'src/**/*.cjs',
|
|
9
|
+
'src/**/*.ts',
|
|
10
|
+
'test/**/*.js',
|
|
11
|
+
'test/**/*.mjs',
|
|
12
|
+
'packages/**/*.js',
|
|
13
|
+
'packages/**/*.ts'
|
|
14
|
+
];
|
|
15
|
+
export const defaultExcludes = [
|
|
16
|
+
'node_modules/**',
|
|
17
|
+
'dist/**',
|
|
18
|
+
'coverage/**',
|
|
19
|
+
'.git/**',
|
|
20
|
+
'.loom/**'
|
|
21
|
+
];
|
|
22
|
+
export function createLoomConfig(options = {}) {
|
|
23
|
+
const root = resolveRoot(options.root);
|
|
24
|
+
return {
|
|
25
|
+
kind: 'loom.config',
|
|
26
|
+
version: 1,
|
|
27
|
+
name: options.name ?? path.basename(root),
|
|
28
|
+
root: '.',
|
|
29
|
+
source: {
|
|
30
|
+
include: options.include?.length ? options.include : defaultIncludes,
|
|
31
|
+
exclude: options.exclude?.length ? [...defaultExcludes, ...options.exclude] : defaultExcludes,
|
|
32
|
+
languages: options.languages?.length ? options.languages : defaultLanguages(),
|
|
33
|
+
maxFileBytes: 512_000
|
|
34
|
+
},
|
|
35
|
+
generated: {
|
|
36
|
+
dir: '.loom',
|
|
37
|
+
graph: '.loom/graph',
|
|
38
|
+
objects: '.loom/objects',
|
|
39
|
+
refs: '.loom/refs',
|
|
40
|
+
logs: '.loom/logs',
|
|
41
|
+
info: '.loom/info',
|
|
42
|
+
hooks: '.loom/hooks',
|
|
43
|
+
runs: '.loom/runs',
|
|
44
|
+
queues: '.loom/queues',
|
|
45
|
+
evidence: '.loom/evidence',
|
|
46
|
+
projections: '.loom/projections',
|
|
47
|
+
locks: '.loom/locks'
|
|
48
|
+
},
|
|
49
|
+
frontier: {
|
|
50
|
+
semanticImport: true,
|
|
51
|
+
semanticImportMaxFiles: 400,
|
|
52
|
+
semanticImportMaxBytes: 2_000_000
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export async function readLoomConfig(root = process.cwd()) {
|
|
57
|
+
const file = abs(resolveRoot(root), loomConfigFile);
|
|
58
|
+
if (!(await pathExists(file)))
|
|
59
|
+
throw new Error(`missing ${loomConfigFile}; run loom init first`);
|
|
60
|
+
return readJson(file);
|
|
61
|
+
}
|
|
62
|
+
export async function writeLoomConfig(root, config, force = false) {
|
|
63
|
+
const file = abs(root, loomConfigFile);
|
|
64
|
+
if (!force && await pathExists(file))
|
|
65
|
+
throw new Error(`${loomConfigFile} already exists; use --force to overwrite`);
|
|
66
|
+
await writeJson(file, config);
|
|
67
|
+
return file;
|
|
68
|
+
}
|
|
69
|
+
export async function readLoomIgnore(root) {
|
|
70
|
+
const file = abs(root, '.loomignore');
|
|
71
|
+
if (!(await pathExists(file)))
|
|
72
|
+
return [];
|
|
73
|
+
const text = await fs.readFile(file, 'utf8');
|
|
74
|
+
return text.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith('#'));
|
|
75
|
+
}
|
|
76
|
+
function defaultLanguages() {
|
|
77
|
+
return ['javascript', 'typescript', 'python', 'rust', 'c', 'csharp', 'go', 'java', 'kotlin', 'swift'];
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGhF,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,kBAAkB;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,iBAAiB;IACjB,SAAS;IACT,aAAa;IACb,SAAS;IACT,UAAU;CACX,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,UAA2B,EAAE;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,IAAI,EAAE,GAAG;QACT,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;YAC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/diff.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveRoot } from './common.js';
|
|
2
|
+
import { readLoomGraph } from './graph.js';
|
|
3
|
+
import { scanLoomProject } from './scan.js';
|
|
4
|
+
export async function diffLoomProject(options = {}) {
|
|
5
|
+
const root = resolveRoot(options.root);
|
|
6
|
+
const graph = await readLoomGraph({ root });
|
|
7
|
+
const saved = new Map(graph.files.map((file) => [file.path, file]));
|
|
8
|
+
const fresh = await scanLoomProject({ root, write: false });
|
|
9
|
+
const current = new Map(fresh.graph.files.map((file) => [file.path, file]));
|
|
10
|
+
const added = [...current.keys()].filter((file) => !saved.has(file)).sort();
|
|
11
|
+
const deleted = [...saved.keys()].filter((file) => !current.has(file)).sort();
|
|
12
|
+
const changed = [...current.entries()]
|
|
13
|
+
.filter(([file, row]) => saved.has(file) && saved.get(file)?.sha256 !== row.sha256)
|
|
14
|
+
.map(([file]) => file)
|
|
15
|
+
.sort();
|
|
16
|
+
return {
|
|
17
|
+
ok: true,
|
|
18
|
+
message: `${added.length} added, ${changed.length} changed, ${deleted.length} deleted`,
|
|
19
|
+
added,
|
|
20
|
+
changed,
|
|
21
|
+
deleted
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=diff.js.map
|
package/dist/diff.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAA6B,EAAE;IACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,EAAE,IAAI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;QACR,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,WAAW,OAAO,CAAC,MAAM,aAAa,OAAO,CAAC,MAAM,UAAU;QACtF,KAAK;QACL,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/glob.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAI/D;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAGxE"}
|
package/dist/glob.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { rel } from './common.js';
|
|
4
|
+
export async function listFiles(root) {
|
|
5
|
+
const out = [];
|
|
6
|
+
await walk(root, root, out);
|
|
7
|
+
return out.sort();
|
|
8
|
+
}
|
|
9
|
+
export function matchesAny(relative, patterns) {
|
|
10
|
+
const normalized = relative.replaceAll('\\', '/');
|
|
11
|
+
return patterns.some((pattern) => globToRegExp(pattern).test(normalized));
|
|
12
|
+
}
|
|
13
|
+
async function walk(root, dir, out) {
|
|
14
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const file = path.join(dir, entry.name);
|
|
17
|
+
const relative = rel(root, file);
|
|
18
|
+
if (entry.isDirectory()) {
|
|
19
|
+
if (['.git', '.loom', 'node_modules', 'dist', 'coverage'].includes(entry.name))
|
|
20
|
+
continue;
|
|
21
|
+
await walk(root, file, out);
|
|
22
|
+
}
|
|
23
|
+
else if (entry.isFile() && !relative.startsWith('.')) {
|
|
24
|
+
out.push(file);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function globToRegExp(pattern) {
|
|
29
|
+
const normalized = pattern.replaceAll('\\', '/');
|
|
30
|
+
let source = '';
|
|
31
|
+
for (let index = 0; index < normalized.length; index += 1) {
|
|
32
|
+
const char = normalized[index];
|
|
33
|
+
const next = normalized[index + 1];
|
|
34
|
+
const afterNext = normalized[index + 2];
|
|
35
|
+
if (char === '*' && next === '*' && afterNext === '/') {
|
|
36
|
+
source += '(?:.*/)?';
|
|
37
|
+
index += 2;
|
|
38
|
+
}
|
|
39
|
+
else if (char === '*' && next === '*') {
|
|
40
|
+
source += '.*';
|
|
41
|
+
index += 1;
|
|
42
|
+
}
|
|
43
|
+
else if (char === '*') {
|
|
44
|
+
source += '[^/]*';
|
|
45
|
+
}
|
|
46
|
+
else if (char === '?') {
|
|
47
|
+
source += '[^/]';
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
source += escapeRegExp(char ?? '');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return new RegExp(`^${source}$`);
|
|
54
|
+
}
|
|
55
|
+
function escapeRegExp(value) {
|
|
56
|
+
return value.replace(/[\\^$+?.()|[\]{}]/g, '\\$&');
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=glob.js.map
|
package/dist/glob.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY;IAC1C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5B,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,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AAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAMvF"}
|
package/dist/graph.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { abs, pathExists, readJson, resolveRoot } from './common.js';
|
|
2
|
+
import { readLoomConfig } from './config.js';
|
|
3
|
+
export async function readLoomGraph(options = {}) {
|
|
4
|
+
const root = resolveRoot(options.root);
|
|
5
|
+
const config = await readLoomConfig(root);
|
|
6
|
+
const file = abs(root, `${config.generated.graph}/current.json`);
|
|
7
|
+
if (!(await pathExists(file)))
|
|
8
|
+
throw new Error('missing .loom graph; run loom scan first');
|
|
9
|
+
return readJson(file);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAA6B,EAAE;IACjE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,eAAe,CAAC,CAAC;IACjE,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC3F,OAAO,QAAQ,CAAY,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,IAAI,MAAM,CAuBjC"}
|
package/dist/help.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function helpText() {
|
|
2
|
+
return `loom - semantic repo collaboration over Frontier
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
loom init [--name <name>] [--source <glob>] [--exclude <glob>] [--force]
|
|
6
|
+
loom scan [--json]
|
|
7
|
+
loom status [--json]
|
|
8
|
+
loom graph [--json]
|
|
9
|
+
loom diff [--json]
|
|
10
|
+
loom snapshot [-m <message>] [--json]
|
|
11
|
+
loom cat-file <object-id> [--json]
|
|
12
|
+
loom project --to <target> [--out <dir>] [--json]
|
|
13
|
+
loom doctor [--json]
|
|
14
|
+
loom swarm <frontier-swarm-codex args...>
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
loom init --name emulator --source "src/**/*.ts"
|
|
18
|
+
loom scan
|
|
19
|
+
loom snapshot -m "source graph checkpoint"
|
|
20
|
+
loom cat-file <object-id> --json
|
|
21
|
+
loom project --to rust
|
|
22
|
+
loom swarm collect --run agent-runs/my-run
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=help.js.map
|
package/dist/help.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;CAqBR,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { parseArgs } from './args.js';
|
|
2
|
+
export { createLoomConfig, readLoomConfig, writeLoomConfig } from './config.js';
|
|
3
|
+
export { diffLoomProject } from './diff.js';
|
|
4
|
+
export { readLoomGraph } from './graph.js';
|
|
5
|
+
export { initLoomProject } from './init.js';
|
|
6
|
+
export { createLoomProjectionPlan } from './project.js';
|
|
7
|
+
export { scanLoomProject, languageForPath } from './scan.js';
|
|
8
|
+
export { catLoomObject, snapshotLoomProject } from './snapshot.js';
|
|
9
|
+
export { doctorLoomProject, readLoomStatus } from './status.js';
|
|
10
|
+
export { readLoomObject, writeLoomObject, readHeadRef, readRef } from './store.js';
|
|
11
|
+
export { runSwarmCommand } from './swarm.js';
|
|
12
|
+
export type { JsonValue, LoomCommandResult, LoomConfig, LoomFileRecord, LoomGeneratedConfig, LoomGraph, LoomGraphSummary, LoomInitOptions, LoomLanguage, LoomScanOptions, LoomSemanticSummary, LoomSnapshotOptions, LoomSourceConfig } from './types.js';
|
|
13
|
+
//# 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,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { parseArgs } from './args.js';
|
|
2
|
+
export { createLoomConfig, readLoomConfig, writeLoomConfig } from './config.js';
|
|
3
|
+
export { diffLoomProject } from './diff.js';
|
|
4
|
+
export { readLoomGraph } from './graph.js';
|
|
5
|
+
export { initLoomProject } from './init.js';
|
|
6
|
+
export { createLoomProjectionPlan } from './project.js';
|
|
7
|
+
export { scanLoomProject, languageForPath } from './scan.js';
|
|
8
|
+
export { catLoomObject, snapshotLoomProject } from './snapshot.js';
|
|
9
|
+
export { doctorLoomProject, readLoomStatus } from './status.js';
|
|
10
|
+
export { readLoomObject, writeLoomObject, readHeadRef, readRef } from './store.js';
|
|
11
|
+
export { runSwarmCommand } from './swarm.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyC/F"}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { appendLineIfMissing, ensureDir, nowIso, resolveRoot, writeJson } from './common.js';
|
|
3
|
+
import { createLoomConfig, writeLoomConfig } from './config.js';
|
|
4
|
+
import { writeSymbolicHead } from './store.js';
|
|
5
|
+
export async function initLoomProject(options = {}) {
|
|
6
|
+
const root = resolveRoot(options.root);
|
|
7
|
+
const config = createLoomConfig({ ...options, root });
|
|
8
|
+
const configPath = await writeLoomConfig(root, config, options.force === true);
|
|
9
|
+
for (const dir of Object.values(config.generated)) {
|
|
10
|
+
await ensureDir(`${root}/${dir}`);
|
|
11
|
+
}
|
|
12
|
+
await ensureDir(`${root}/.loom/objects/pack`);
|
|
13
|
+
await ensureDir(`${root}/.loom/objects/info`);
|
|
14
|
+
await ensureDir(`${root}/.loom/refs/heads`);
|
|
15
|
+
await ensureDir(`${root}/.loom/refs/tags`);
|
|
16
|
+
await ensureDir(`${root}/.loom/logs/refs/heads`);
|
|
17
|
+
await writeSymbolicHead(root, 'refs/heads/main');
|
|
18
|
+
await writeJson(`${root}/.loom/repo.json`, {
|
|
19
|
+
kind: 'loom.repo',
|
|
20
|
+
version: 1,
|
|
21
|
+
name: config.name,
|
|
22
|
+
generatedAt: nowIso(),
|
|
23
|
+
configPath: 'loom.json',
|
|
24
|
+
graphPath: '.loom/graph/current.json'
|
|
25
|
+
});
|
|
26
|
+
await writeJson(`${root}/.loom/index.json`, {
|
|
27
|
+
kind: 'loom.index',
|
|
28
|
+
version: 1,
|
|
29
|
+
generatedAt: nowIso(),
|
|
30
|
+
entries: []
|
|
31
|
+
});
|
|
32
|
+
await fs.writeFile(`${root}/.loomignore`, `${[
|
|
33
|
+
'# Loom scan ignores',
|
|
34
|
+
'node_modules/**',
|
|
35
|
+
'dist/**',
|
|
36
|
+
'coverage/**',
|
|
37
|
+
'.git/**',
|
|
38
|
+
'.loom/**'
|
|
39
|
+
].join('\n')}\n`);
|
|
40
|
+
await appendLineIfMissing(`${root}/.gitignore`, '.loom/');
|
|
41
|
+
return { ok: true, message: `initialized ${config.name}`, path: configPath, config };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAA2B,EAAE;IACjE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,I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,CAAC,CAAC;IAE1D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AACvF,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAe/D"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function printResult(value, json) {
|
|
2
|
+
if (json) {
|
|
3
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (isGraph(value)) {
|
|
7
|
+
printGraph(value);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (isResult(value)) {
|
|
11
|
+
process.stdout.write(`${value.ok ? 'ok' : 'error'}: ${value.message}\n`);
|
|
12
|
+
printKnownFields(value);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
process.stdout.write(`${String(value)}\n`);
|
|
16
|
+
}
|
|
17
|
+
function printGraph(graph) {
|
|
18
|
+
const summary = graph.summary;
|
|
19
|
+
process.stdout.write(`loom graph: ${summary.files} files, ${summary.bytes} bytes\n`);
|
|
20
|
+
process.stdout.write(`semantic: ${summary.semanticImports} imported, ${summary.semanticFailures} failed\n`);
|
|
21
|
+
process.stdout.write(`symbols: ${summary.semanticSymbols}, regions: ${summary.semanticOwnershipRegions}, hints: ${summary.semanticPatchHints}\n`);
|
|
22
|
+
}
|
|
23
|
+
function printKnownFields(result) {
|
|
24
|
+
if (typeof result.path === 'string')
|
|
25
|
+
process.stdout.write(`path: ${result.path}\n`);
|
|
26
|
+
if (typeof result.objectId === 'string')
|
|
27
|
+
process.stdout.write(`object: ${result.objectId}\n`);
|
|
28
|
+
if (typeof result.ref === 'string')
|
|
29
|
+
process.stdout.write(`ref: ${result.ref}\n`);
|
|
30
|
+
if (result.graphSummary)
|
|
31
|
+
process.stdout.write(`graph: ${JSON.stringify(result.graphSummary)}\n`);
|
|
32
|
+
if (Array.isArray(result.added) || Array.isArray(result.changed) || Array.isArray(result.deleted)) {
|
|
33
|
+
process.stdout.write(`added: ${arrayCount(result.added)}, changed: ${arrayCount(result.changed)}, deleted: ${arrayCount(result.deleted)}\n`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function isGraph(value) {
|
|
37
|
+
return Boolean(value && typeof value === 'object' && value.kind === 'loom.graph');
|
|
38
|
+
}
|
|
39
|
+
function isResult(value) {
|
|
40
|
+
return Boolean(value && typeof value === 'object' && typeof value.ok === 'boolean');
|
|
41
|
+
}
|
|
42
|
+
function arrayCount(value) {
|
|
43
|
+
return Array.isArray(value) ? value.length : 0;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,IAAa;IACvD,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC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project.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { nowIso, resolveRoot, writeJson } from './common.js';
|
|
2
|
+
import { readLoomConfig } from './config.js';
|
|
3
|
+
import { readLoomGraph } from './graph.js';
|
|
4
|
+
export async function createLoomProjectionPlan(options) {
|
|
5
|
+
const root = resolveRoot(options.root);
|
|
6
|
+
const config = await readLoomConfig(root);
|
|
7
|
+
const graph = await readLoomGraph({ root });
|
|
8
|
+
const target = options.target.trim();
|
|
9
|
+
if (!target)
|
|
10
|
+
throw new Error('project requires --to <target>');
|
|
11
|
+
const plan = {
|
|
12
|
+
kind: 'loom.projectionPlan',
|
|
13
|
+
version: 1,
|
|
14
|
+
generatedAt: nowIso(),
|
|
15
|
+
target,
|
|
16
|
+
sourceGraph: `${config.generated.graph}/current.json`,
|
|
17
|
+
sourceGitHead: graph.gitHead,
|
|
18
|
+
summary: graph.summary,
|
|
19
|
+
routes: graph.files.map((file) => ({
|
|
20
|
+
sourcePath: file.path,
|
|
21
|
+
sourceLanguage: file.language,
|
|
22
|
+
sourceHash: file.sha256,
|
|
23
|
+
target,
|
|
24
|
+
status: file.semantic?.ok ? 'semantic-imported' : 'hash-only',
|
|
25
|
+
semantic: file.semantic
|
|
26
|
+
}))
|
|
27
|
+
};
|
|
28
|
+
const outDir = options.outDir ?? config.generated.projections;
|
|
29
|
+
const outFile = `${root}/${outDir}/${target}.json`;
|
|
30
|
+
await writeJson(outFile, plan);
|
|
31
|
+
return { ok: true, message: `wrote ${target} projection plan`, path: outFile, plan };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aA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,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,MAAM,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACvF,CAAC"}
|
package/dist/scan.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LoomGraph, LoomLanguage, LoomScanOptions } from './types.js';
|
|
2
|
+
export declare function scanLoomProject(options?: LoomScanOptions): Promise<{
|
|
3
|
+
ok: boolean;
|
|
4
|
+
graph: LoomGraph;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function collectSourceFiles(root: string): Promise<string[]>;
|
|
7
|
+
export declare function languageForPath(file: string): LoomLanguage;
|
|
8
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAkB,SAAS,EAAE,YAAY,EAAE,eAAe,EAAuB,MAAM,YAAY,CAAC;AAMhH,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC,CAsD/G;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAExE;AAuFD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAY1D"}
|