@sourcepress/cli 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.
Files changed (70) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-test.log +46 -0
  3. package/bin/sourcepress.js +2 -0
  4. package/dist/__tests__/config.test.d.ts +2 -0
  5. package/dist/__tests__/config.test.d.ts.map +1 -0
  6. package/dist/__tests__/config.test.js +70 -0
  7. package/dist/__tests__/config.test.js.map +1 -0
  8. package/dist/commands/build.d.ts +3 -0
  9. package/dist/commands/build.d.ts.map +1 -0
  10. package/dist/commands/build.js +27 -0
  11. package/dist/commands/build.js.map +1 -0
  12. package/dist/commands/dev.d.ts +3 -0
  13. package/dist/commands/dev.d.ts.map +1 -0
  14. package/dist/commands/dev.js +21 -0
  15. package/dist/commands/dev.js.map +1 -0
  16. package/dist/commands/eval.d.ts +3 -0
  17. package/dist/commands/eval.d.ts.map +1 -0
  18. package/dist/commands/eval.js +40 -0
  19. package/dist/commands/eval.js.map +1 -0
  20. package/dist/commands/gaps.d.ts +3 -0
  21. package/dist/commands/gaps.d.ts.map +1 -0
  22. package/dist/commands/gaps.js +31 -0
  23. package/dist/commands/gaps.js.map +1 -0
  24. package/dist/commands/graph.d.ts +3 -0
  25. package/dist/commands/graph.d.ts.map +1 -0
  26. package/dist/commands/graph.js +33 -0
  27. package/dist/commands/graph.js.map +1 -0
  28. package/dist/commands/init.d.ts +2 -0
  29. package/dist/commands/init.d.ts.map +1 -0
  30. package/dist/commands/init.js +117 -0
  31. package/dist/commands/init.js.map +1 -0
  32. package/dist/commands/stale.d.ts +3 -0
  33. package/dist/commands/stale.d.ts.map +1 -0
  34. package/dist/commands/stale.js +35 -0
  35. package/dist/commands/stale.js.map +1 -0
  36. package/dist/commands/status.d.ts +4 -0
  37. package/dist/commands/status.d.ts.map +1 -0
  38. package/dist/commands/status.js +26 -0
  39. package/dist/commands/status.js.map +1 -0
  40. package/dist/commands/sync.d.ts +3 -0
  41. package/dist/commands/sync.d.ts.map +1 -0
  42. package/dist/commands/sync.js +22 -0
  43. package/dist/commands/sync.js.map +1 -0
  44. package/dist/config.d.ts +3 -0
  45. package/dist/config.d.ts.map +1 -0
  46. package/dist/config.js +42 -0
  47. package/dist/config.js.map +1 -0
  48. package/dist/engine-boot.d.ts +4 -0
  49. package/dist/engine-boot.d.ts.map +1 -0
  50. package/dist/engine-boot.js +15 -0
  51. package/dist/engine-boot.js.map +1 -0
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +133 -0
  55. package/dist/index.js.map +1 -0
  56. package/package.json +28 -0
  57. package/src/__tests__/config.test.ts +80 -0
  58. package/src/commands/build.ts +29 -0
  59. package/src/commands/dev.ts +27 -0
  60. package/src/commands/eval.ts +47 -0
  61. package/src/commands/gaps.ts +38 -0
  62. package/src/commands/graph.ts +41 -0
  63. package/src/commands/init.ts +123 -0
  64. package/src/commands/stale.ts +40 -0
  65. package/src/commands/status.ts +37 -0
  66. package/src/commands/sync.ts +28 -0
  67. package/src/config.ts +47 -0
  68. package/src/engine-boot.ts +17 -0
  69. package/src/index.ts +146 -0
  70. package/tsconfig.json +5 -0
@@ -0,0 +1,4 @@
1
+
2
+ > @sourcepress/cli@0.1.0 build /Users/fabianvontiedemann/Developer/org/sourcepress/packages/cli
3
+ > tsc
4
+
@@ -0,0 +1,46 @@
1
+
2
+ > @sourcepress/cli@0.1.0 test /Users/fabianvontiedemann/Developer/org/sourcepress/packages/cli
3
+ > vitest run
4
+
5
+
6
+ RUN v3.2.4 /Users/fabianvontiedemann/Developer/org/sourcepress/packages/cli
7
+
8
+ ❯ src/__tests__/config.test.ts (4 tests | 1 failed) 82ms
9
+ ✓ loadConfig > returns null when no config file exists 1ms
10
+ ✓ loadConfig > returns validated config when sourcepress.config.js exists 2ms
11
+ × loadConfig > prefers sourcepress.config.ts over .js when both exist 77ms
12
+ → Invalid sourcepress config in sourcepress.config.ts:
13
+ - repository: Required
14
+ - ai: Required
15
+ - collections: Required
16
+ - knowledge: Required
17
+ - intent: Required
18
+ ✓ loadConfig > throws on invalid config 3ms
19
+
20
+ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
21
+
22
+ FAIL src/__tests__/config.test.ts > loadConfig > prefers sourcepress.config.ts over .js when both exist
23
+ Error: Invalid sourcepress config in sourcepress.config.ts:
24
+ - repository: Required
25
+ - ai: Required
26
+ - collections: Required
27
+ - knowledge: Required
28
+ - intent: Required
29
+ ❯ loadConfig src/config.ts:35:11
30
+ 33| const result = validateConfig(raw);
31
+ 34| if (!result.success) {
32
+ 35| throw new Error(
33
+ | ^
34
+ 36| `Invalid sourcepress config in ${name}:\n${result.errors.map((e) …
35
+ 37| );
36
+ ❯ src/__tests__/config.test.ts:68:18
37
+
38
+ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
39
+
40
+
41
+ Test Files 1 failed (1)
42
+ Tests 1 failed | 3 passed (4)
43
+ Start at 15:17:13
44
+ Duration 401ms (transform 131ms, setup 0ms, collect 137ms, tests 82ms, environment 0ms, prepare 40ms)
45
+
46
+  ELIFECYCLE  Test failed. See above for more details.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/index.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/config.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
5
+ import { loadConfig } from "../config.js";
6
+ const VALID_CONFIG_JS = `
7
+ export default {
8
+ repository: { owner: "acme", repo: "content", branch: "main" },
9
+ ai: { provider: "anthropic", model: "claude-sonnet-4-5-20250514" },
10
+ collections: {
11
+ posts: {
12
+ name: "posts",
13
+ path: "content/posts/",
14
+ format: "mdx",
15
+ fields: { title: { type: "string", required: true } },
16
+ },
17
+ },
18
+ knowledge: { path: "knowledge/", graph: { backend: "local" } },
19
+ intent: { path: "intent/" },
20
+ };
21
+ `;
22
+ let tmpDir;
23
+ beforeEach(() => {
24
+ tmpDir = mkdtempSync(join(tmpdir(), "sp-cli-test-"));
25
+ });
26
+ afterEach(() => {
27
+ rmSync(tmpDir, { recursive: true, force: true });
28
+ });
29
+ describe("loadConfig", () => {
30
+ it("returns null when no config file exists", async () => {
31
+ const result = await loadConfig(tmpDir);
32
+ expect(result).toBeNull();
33
+ });
34
+ it("returns validated config when sourcepress.config.js exists", async () => {
35
+ writeFileSync(join(tmpDir, "sourcepress.config.js"), VALID_CONFIG_JS);
36
+ const config = await loadConfig(tmpDir);
37
+ expect(config).not.toBeNull();
38
+ expect(config?.repository.owner).toBe("acme");
39
+ expect(config?.repository.repo).toBe("content");
40
+ expect(config?.ai.provider).toBe("anthropic");
41
+ });
42
+ it("prefers sourcepress.config.ts over .js when both exist", async () => {
43
+ // .ts file would be tried first but can't be dynamically imported without tsx in test env,
44
+ // so we write a .ts file that is actually valid JS (no TS-only syntax) to verify ordering.
45
+ const tsContent = `export default {
46
+ repository: { owner: "ts-owner", repo: "ts-repo", branch: "main" },
47
+ ai: { provider: "anthropic", model: "claude-sonnet-4-5-20250514" },
48
+ collections: {
49
+ posts: {
50
+ name: "posts",
51
+ path: "content/posts/",
52
+ format: "mdx",
53
+ fields: { title: { type: "string", required: true } },
54
+ },
55
+ },
56
+ knowledge: { path: "knowledge/", graph: { backend: "local" } },
57
+ intent: { path: "intent/" },
58
+ };`;
59
+ writeFileSync(join(tmpDir, "sourcepress.config.ts"), tsContent);
60
+ writeFileSync(join(tmpDir, "sourcepress.config.js"), VALID_CONFIG_JS);
61
+ const config = await loadConfig(tmpDir);
62
+ // .ts is tried first — should load ts-owner
63
+ expect(config?.repository.owner).toBe("ts-owner");
64
+ });
65
+ it("throws on invalid config", async () => {
66
+ writeFileSync(join(tmpDir, "sourcepress.config.js"), `export default { repository: { owner: "" } };`);
67
+ await expect(loadConfig(tmpDir)).rejects.toThrow(/Invalid sourcepress config/);
68
+ });
69
+ });
70
+ //# sourceMappingURL=config.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.js","sourceRoot":"","sources":["../../src/__tests__/config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;CAevB,CAAC;AAEF,IAAI,MAAc,CAAC;AAEnB,UAAU,CAAC,GAAG,EAAE;IACf,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACd,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,CAAC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,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function build(engine: EngineContext, cwd: string): Promise<void>;
3
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAsB,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB7E"}
@@ -0,0 +1,27 @@
1
+ import { execSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { sync } from "./sync.js";
5
+ export async function build(engine, cwd) {
6
+ // Step 1: sync content from GitHub
7
+ await sync(engine);
8
+ // Step 2: build site if site/ directory exists
9
+ const siteDir = join(cwd, "site");
10
+ if (existsSync(join(siteDir, "package.json"))) {
11
+ console.log("\nBuilding site...");
12
+ try {
13
+ execSync("npm run build", { cwd: siteDir, stdio: "inherit" });
14
+ console.log("Build complete.");
15
+ }
16
+ catch (err) {
17
+ console.error("Site build failed.");
18
+ console.error(err instanceof Error ? err.message : String(err));
19
+ process.exit(1);
20
+ }
21
+ }
22
+ else {
23
+ console.log("\nNo site/ directory found. Sync-only complete.");
24
+ console.log("To build a site, create a site/ directory with a package.json and `build` script.");
25
+ }
26
+ }
27
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAqB,EAAE,GAAW;IAC7D,mCAAmC;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;IAEnB,+CAA+C;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,IAAI,CAAC;YACJ,QAAQ,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACpC,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CACV,mFAAmF,CACnF,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function dev(engine: EngineContext, args: string[]): Promise<void>;
3
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB9E"}
@@ -0,0 +1,21 @@
1
+ import { serve } from "@hono/node-server";
2
+ import { createApp } from "@sourcepress/server";
3
+ export async function dev(engine, args) {
4
+ const portArg = args.find((a) => a.startsWith("--port="))?.split("=")[1];
5
+ const port = Number(process.env.PORT ?? portArg ?? 4321);
6
+ const app = createApp(engine);
7
+ console.log(`SourcePress engine running at http://localhost:${port}`);
8
+ console.log(`Health: http://localhost:${port}/api/health`);
9
+ console.log(`Content: http://localhost:${port}/api/content`);
10
+ console.log("\nMCP: npx sourcepress mcp (in another terminal)");
11
+ console.log("\nPress Ctrl+C to stop.\n");
12
+ const server = serve({ fetch: app.fetch, port });
13
+ process.on("SIGINT", () => {
14
+ console.log("\nShutting down...");
15
+ server.close(() => process.exit(0));
16
+ });
17
+ process.on("SIGTERM", () => {
18
+ server.close(() => process.exit(0));
19
+ });
20
+ }
21
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,MAAqB,EAAE,IAAc;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC,CAAC;IAEzD,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAE9B,OAAO,CAAC,GAAG,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,aAAa,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,cAAc,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function evalCmd(engine: EngineContext, args: string[]): Promise<void>;
3
+ //# sourceMappingURL=eval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/commands/eval.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ClF"}
@@ -0,0 +1,40 @@
1
+ export async function evalCmd(engine, args) {
2
+ const runLoop = args.includes("--run");
3
+ if (runLoop) {
4
+ console.log("Running eval loop (generate → judge → improve)...\n");
5
+ }
6
+ else {
7
+ console.log("Evaluating content quality...\n");
8
+ console.log(" (Use --run to execute the full generate/improve loop)\n");
9
+ }
10
+ const collections = engine.listCollections();
11
+ if (collections.length === 0) {
12
+ console.log("No collections configured. Add collections to sourcepress.config.ts.");
13
+ return;
14
+ }
15
+ for (const name of collections) {
16
+ let files;
17
+ try {
18
+ files = await engine.listContent(name);
19
+ }
20
+ catch (err) {
21
+ console.error(` ${name}: error — ${err instanceof Error ? err.message : String(err)}`);
22
+ continue;
23
+ }
24
+ console.log(`${name}: ${files.length} file${files.length !== 1 ? "s" : ""}`);
25
+ for (const file of files) {
26
+ const score = file.frontmatter?.eval_score;
27
+ if (score !== undefined) {
28
+ const indicator = score >= 70 ? "pass" : "fail";
29
+ console.log(` [${indicator}] ${file.path} — score: ${score}`);
30
+ }
31
+ else {
32
+ console.log(` [---] ${file.path} — not yet evaluated`);
33
+ }
34
+ }
35
+ }
36
+ if (runLoop) {
37
+ console.log("\nEval loop complete. Re-run `sourcepress eval` to see updated scores.");
38
+ }
39
+ }
40
+ //# sourceMappingURL=eval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/commands/eval.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,MAAqB,EAAE,IAAc;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEvC,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC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AI,sBAAsB,CAAC,CAAC;YACzD,CAAC;QACF,CAAC;IACF,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACvF,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function gaps(engine: EngineContext): Promise<void>;
3
+ //# sourceMappingURL=gaps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gaps.d.ts","sourceRoot":"","sources":["../../src/commands/gaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC/D"}
@@ -0,0 +1,31 @@
1
+ export async function gaps(engine) {
2
+ console.log("Scanning for knowledge gaps...\n");
3
+ // Gather all content files across collections
4
+ const collections = engine.listCollections();
5
+ const allContent = [];
6
+ for (const name of collections) {
7
+ try {
8
+ const files = await engine.listContent(name);
9
+ allContent.push(...files);
10
+ }
11
+ catch (err) {
12
+ console.error(` ${name}: error — ${err instanceof Error ? err.message : String(err)}`);
13
+ }
14
+ }
15
+ // Use the knowledge engine to find gaps
16
+ const foundGaps = engine.knowledge.findGaps(allContent);
17
+ if (foundGaps.length === 0) {
18
+ console.log("No knowledge gaps detected. Knowledge coverage looks complete.");
19
+ return;
20
+ }
21
+ console.log(`Found ${foundGaps.length} knowledge gap${foundGaps.length !== 1 ? "s" : ""}:\n`);
22
+ for (const gap of foundGaps) {
23
+ console.log(` ${gap.entity_name} (${gap.entity_type})`);
24
+ console.log(` Knowledge files: ${gap.knowledge_file_count}`);
25
+ console.log(` Content files: ${gap.content_file_count}`);
26
+ console.log(` Reason: ${gap.reason}`);
27
+ console.log("");
28
+ }
29
+ console.log("Add knowledge files to the knowledge/ directory to fill these gaps.");
30
+ }
31
+ //# sourceMappingURL=g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AAW,GAAG,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function graph(engine: EngineContext, args: string[]): Promise<void>;
3
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsChF"}
@@ -0,0 +1,33 @@
1
+ export async function graph(engine, args) {
2
+ const rebuild = args.includes("--rebuild");
3
+ if (rebuild) {
4
+ console.log("Rebuilding knowledge graph...\n");
5
+ try {
6
+ const knowledgeFiles = await engine.knowledgeStore.list();
7
+ console.log(` Found ${knowledgeFiles.length} knowledge file${knowledgeFiles.length !== 1 ? "s" : ""}.`);
8
+ for (const file of knowledgeFiles) {
9
+ await engine.knowledge.ingest(file.path, file.body, file.source, file.source_url);
10
+ console.log(` Ingested: ${file.path}`);
11
+ }
12
+ console.log("\nKnowledge graph rebuilt.");
13
+ }
14
+ catch (err) {
15
+ console.error(`Error rebuilding graph: ${err instanceof Error ? err.message : String(err)}`);
16
+ process.exit(1);
17
+ }
18
+ }
19
+ // Show graph stats
20
+ const g = await engine.knowledgeStore.loadGraph();
21
+ if (!g) {
22
+ console.log("Knowledge graph is empty. Add knowledge files and run `sourcepress graph --rebuild`.");
23
+ return;
24
+ }
25
+ const entityCount = g.entities instanceof Map ? g.entities.size : 0;
26
+ const relationCount = g.relations?.length ?? 0;
27
+ const clusterCount = g.clusters?.length ?? 0;
28
+ console.log("Knowledge graph stats:");
29
+ console.log(` Entities: ${entityCount}`);
30
+ console.log(` Relations: ${relationCount}`);
31
+ console.log(` Clusters: ${clusterCount}`);
32
+ }
33
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAqB,EAAE,IAAc;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE3C,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,IAAI,CAAC;YACJ,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CACV,WAAW,cAAc,CAAC,MAAM,kBAAkB,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAC3F,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBACnC,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClF,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,2BAA2B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC7F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;IAED,mBAAmB;IACnB,MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAClD,IAAI,CAAC,CAAC,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CACV,sFAAsF,CACtF,CAAC;QACF,OAAO;IACR,CAAC;IAED,MAAM,WAAW,GAAG,CAAC,CAAC,QAAQ,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,gBAAgB,aAAa,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function init(targetDir: string): void;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA6FA,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CA6B5C"}
@@ -0,0 +1,117 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const DEFAULT_CONFIG = `import { defineConfig, collection, field, relation } from '@sourcepress/core'
4
+
5
+ export default defineConfig({
6
+ repository: {
7
+ owner: 'OWNER',
8
+ repo: 'REPO',
9
+ branch: 'main',
10
+ },
11
+
12
+ ai: {
13
+ provider: 'anthropic',
14
+ model: 'claude-sonnet-4-5-20250514',
15
+ },
16
+
17
+ collections: {},
18
+
19
+ knowledge: {
20
+ path: 'knowledge/',
21
+ graph: { backend: 'local' },
22
+ },
23
+
24
+ intent: {
25
+ path: 'intent/',
26
+ },
27
+
28
+ media: {
29
+ storage: 'git',
30
+ path: 'assets/',
31
+ registry: 'media.json',
32
+ },
33
+
34
+ jobs: {
35
+ backend: 'in-process',
36
+ },
37
+
38
+ evals: {
39
+ threshold: 70,
40
+ },
41
+
42
+ approval: {
43
+ provider: 'github-pr',
44
+ rules: {
45
+ 'content/*': 'pr',
46
+ 'knowledge/*': 'direct',
47
+ },
48
+ },
49
+
50
+ auth: {
51
+ provider: 'github',
52
+ },
53
+
54
+ cache: {
55
+ backend: 'sqlite',
56
+ },
57
+
58
+ sync: {
59
+ reconciliation_interval: '1h',
60
+ },
61
+ })
62
+ `;
63
+ const DEFAULT_TONE = `# Tone of Voice
64
+
65
+ Describe your brand's tone of voice here. This file guides AI content generation.
66
+
67
+ ## Principles
68
+ - Be clear and concise
69
+ - Use active voice
70
+ - Be professional but approachable
71
+
72
+ ## Forbidden words
73
+ - "revolutionary"
74
+ - "synergies"
75
+ - "holistic"
76
+ `;
77
+ const DEFAULT_JUDGE = `# Content Quality Judge
78
+
79
+ You are evaluating content quality. Score the content 0-100 based on:
80
+
81
+ 1. **Factual grounding** — Every claim should be traceable to a knowledge source
82
+ 2. **Tone match** — Does it follow the intent/tone-of-voice guidelines?
83
+ 3. **Specificity** — Concrete details, names, numbers — not generic filler
84
+ 4. **Structure** — Clear flow, appropriate length, good headings
85
+ 5. **Readability** — Clear language, no jargon without explanation
86
+
87
+ Return a single JSON object:
88
+ { "score": <0-100>, "reasoning": "<one paragraph explaining the score>" }
89
+ `;
90
+ export function init(targetDir) {
91
+ const dirs = ["knowledge", "content", "intent", "evals/standards", "evals/prompts", "assets"];
92
+ for (const dir of dirs) {
93
+ const fullPath = join(targetDir, dir);
94
+ if (!existsSync(fullPath)) {
95
+ mkdirSync(fullPath, { recursive: true });
96
+ console.log(` Created ${dir}/`);
97
+ }
98
+ }
99
+ const files = [
100
+ ["sourcepress.config.ts", DEFAULT_CONFIG],
101
+ ["intent/tone-of-voice.md", DEFAULT_TONE],
102
+ ["evals/judge.md", DEFAULT_JUDGE],
103
+ ["media.json", "{}"],
104
+ ];
105
+ for (const [filePath, content] of files) {
106
+ const fullPath = join(targetDir, filePath);
107
+ if (!existsSync(fullPath)) {
108
+ writeFileSync(fullPath, content, "utf-8");
109
+ console.log(` Created ${filePath}`);
110
+ }
111
+ else {
112
+ console.log(` Skipped ${filePath} (already exists)`);
113
+ }
114
+ }
115
+ console.log("\nSourcePress initialized. Edit sourcepress.config.ts to configure your project.");
116
+ }
117
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DtB,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;CAapB,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;CAYrB,CAAC;AAEF,MAAM,UAAU,IAAI,CAAC,SAAiB;IACrC,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IAE9F,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;IAED,MAAM,KAAK,GAA4B;QACtC,CAAC,uBAAuB,EAAE,cAAc,CAAC;QACzC,CAAC,yBAAyB,EAAE,YAAY,CAAC;QACzC,CAAC,gBAAgB,EAAE,aAAa,CAAC;QACjC,CAAC,YAAY,EAAE,IAAI,CAAC;KACpB,CAAC;IAEF,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,GAAG,CAAC,aAAa,QAAQ,mBAAmB,CAAC,CAAC;QACvD,CAAC;IACF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function stale(engine: EngineContext): Promise<void>;
3
+ //# sourceMappingURL=stale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stale.d.ts","sourceRoot":"","sources":["../../src/commands/stale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoChE"}
@@ -0,0 +1,35 @@
1
+ export async function stale(engine) {
2
+ console.log("Checking for stale content...\n");
3
+ const collections = engine.listCollections();
4
+ let staleCount = 0;
5
+ for (const name of collections) {
6
+ let files;
7
+ try {
8
+ files = await engine.listContent(name);
9
+ }
10
+ catch (err) {
11
+ console.error(` ${name}: error — ${err instanceof Error ? err.message : String(err)}`);
12
+ continue;
13
+ }
14
+ for (const file of files) {
15
+ const generatedAt = file.frontmatter?.generated_at;
16
+ const staleSources = file.frontmatter?.stale_sources;
17
+ if (staleSources && staleSources.length > 0) {
18
+ console.log(` [stale] ${file.path}`);
19
+ console.log(` Stale sources: ${staleSources.join(", ")}`);
20
+ if (generatedAt) {
21
+ console.log(` Generated at: ${generatedAt}`);
22
+ }
23
+ staleCount++;
24
+ }
25
+ }
26
+ }
27
+ if (staleCount === 0) {
28
+ console.log("All content is up to date.");
29
+ }
30
+ else {
31
+ console.log(`\n${staleCount} stale file${staleCount !== 1 ? "s" : ""} found.`);
32
+ console.log("Run `sourcepress eval --run` to regenerate stale content.");
33
+ }
34
+ }
35
+ //# sourceMappingURL=stale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stale.js","sourceRoot":"","sources":["../../src/commands/stale.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAqB;IAChD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAE/C,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC7C,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAoB,CAAC;QACzB,IA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ePressConfig } from "@sourcepress/core";
2
+ import type { EngineContext } from "@sourcepress/server";
3
+ export declare function status(engine: EngineContext, config: SourcePressConfig): Promise<void>;
4
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC5F"}
@@ -0,0 +1,26 @@
1
+ export async function status(engine, config) {
2
+ console.log("SourcePress status\n");
3
+ console.log(` Repository: ${config.repository.owner}/${config.repository.repo}`);
4
+ console.log(` Branch: ${config.repository.branch}`);
5
+ console.log(` AI provider: ${config.ai.provider} (${config.ai.model})`);
6
+ console.log(` GitHub: ${process.env.GITHUB_TOKEN ? "configured" : "MISSING"}`);
7
+ console.log(` AI key: ${process.env.AI_API_KEY ? "configured" : "not set"}`);
8
+ const collections = engine.listCollections();
9
+ console.log(` Collections: ${collections.length}${collections.length > 0 ? ` (${collections.join(", ")})` : ""}`);
10
+ // Knowledge graph summary
11
+ try {
12
+ const knowledgeFiles = await engine.knowledgeStore.list();
13
+ console.log(` Knowledge: ${knowledgeFiles.length} file${knowledgeFiles.length !== 1 ? "s" : ""}`);
14
+ }
15
+ catch {
16
+ console.log(" Knowledge: unavailable");
17
+ }
18
+ // Cache info
19
+ const cacheBackend = config.cache?.backend ?? "memory";
20
+ console.log(` Cache: ${cacheBackend}`);
21
+ // Jobs
22
+ const jobsBackend = config.jobs?.backend ?? "in-process";
23
+ console.log(` Jobs: ${jobsBackend}`);
24
+ console.log("");
25
+ }
26
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sour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AC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACvF,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC3C,CAAC;IAED,aAAa;IACb,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,QAAQ,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,kBAAkB,YAAY,EAAE,CAAC,CAAC;IAE9C,OAAO;IACP,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI,YAAY,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,kBAAkB,WAAW,EAAE,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EngineContext } from "@sourcepress/server";
2
+ export declare function sync(engine: EngineContext): Promise<void>;
3
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAsB,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB/D"}
@@ -0,0 +1,22 @@
1
+ export async function sync(engine) {
2
+ console.log("Syncing content from GitHub...\n");
3
+ const collections = engine.listCollections();
4
+ if (collections.length === 0) {
5
+ console.log(" No collections configured.");
6
+ console.log("\nSync complete.");
7
+ return;
8
+ }
9
+ let total = 0;
10
+ for (const name of collections) {
11
+ try {
12
+ const files = await engine.listContent(name);
13
+ console.log(` ${name}: ${files.length} file${files.length !== 1 ? "s" : ""}`);
14
+ total += files.length;
15
+ }
16
+ catch (err) {
17
+ console.error(` ${name}: error — ${err instanceof Error ? err.message : String(err)}`);
18
+ }
19
+ }
20
+ console.log(`\nSync complete. ${total} file${total !== 1 ? "s" : ""} across ${collections.length} collection${collections.length !== 1 ? "s" : ""}.`);
21
+ }
22
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAAqB;IAC/C,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAEhD,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE7C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO;IACR,CAAC;IAED,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/E,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,aAAa,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzF,CAAC;IACF,CAAC;IAED,OAAO,CAAC,GAAG,CACV,oBAAoB,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,C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