@contentrain/mcp 3.6.8 → 3.8.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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/{annotations-CXHPnS-M.mjs → annotations-BYkjoj2d.mjs} +1 -1
  3. package/dist/{annotations-CXHPnS-M.mjs.map → annotations-BYkjoj2d.mjs.map} +1 -1
  4. package/dist/{apply-manager-llmSyK5K.mjs → apply-manager-B-VMXKiW.mjs} +3 -3
  5. package/dist/{apply-manager-llmSyK5K.mjs.map → apply-manager-B-VMXKiW.mjs.map} +1 -1
  6. package/dist/{astro-parser-dhFgc2wA.mjs → astro-parser-DsGdiUnu.mjs} +3 -3
  7. package/dist/{astro-parser-dhFgc2wA.mjs.map → astro-parser-DsGdiUnu.mjs.map} +1 -1
  8. package/dist/{availability-DYHNoP0_.mjs → availability-CO8Xfx3w.mjs} +1 -1
  9. package/dist/{availability-DYHNoP0_.mjs.map → availability-CO8Xfx3w.mjs.map} +1 -1
  10. package/dist/base-branch-Cw9DWvCC.mjs +121 -0
  11. package/dist/base-branch-Cw9DWvCC.mjs.map +1 -0
  12. package/dist/{branch-lifecycle-f4gI_eGo.mjs → branch-lifecycle-CcsSyfSw.mjs} +3 -68
  13. package/dist/branch-lifecycle-CcsSyfSw.mjs.map +1 -0
  14. package/dist/{branch-lifecycle-DGlgjnC7.d.mts → branch-lifecycle-CirYfTXu.d.mts} +1 -1
  15. package/dist/{branch-lifecycle-DGlgjnC7.d.mts.map → branch-lifecycle-CirYfTXu.d.mts.map} +1 -1
  16. package/dist/{compiler-CR9F0wZZ.mjs → compiler-CKelkozt.mjs} +2 -2
  17. package/dist/{compiler-CR9F0wZZ.mjs.map → compiler-CKelkozt.mjs.map} +1 -1
  18. package/dist/{compiler-sfc.cjs-Cpexs92i.mjs → compiler-sfc.cjs-BH5AEf2z.mjs} +2 -2
  19. package/dist/{compiler-sfc.cjs-Cpexs92i.mjs.map → compiler-sfc.cjs-BH5AEf2z.mjs.map} +1 -1
  20. package/dist/{content-manager-BqaMkMVk.d.mts → content-manager-2g0pkLFh.d.mts} +2 -2
  21. package/dist/{content-manager-BqaMkMVk.d.mts.map → content-manager-2g0pkLFh.d.mts.map} +1 -1
  22. package/dist/core/apply-manager.mjs +5 -4
  23. package/dist/core/config.d.mts +1 -1
  24. package/dist/core/content-manager.d.mts +1 -1
  25. package/dist/core/context.d.mts +1 -1
  26. package/dist/core/contracts/index.d.mts +2 -2
  27. package/dist/core/doctor.mjs +4 -3
  28. package/dist/core/graph-builder.mjs +2 -2
  29. package/dist/core/model-manager.d.mts +1 -1
  30. package/dist/core/ops/index.d.mts +3 -3
  31. package/dist/core/overlay-reader.d.mts +1 -1
  32. package/dist/core/scan-config.mjs +1 -1
  33. package/dist/core/scanner.mjs +3 -3
  34. package/dist/core/validator/index.d.mts +1 -1
  35. package/dist/{detect-DUYFv3-O.mjs → detect-B1QHYA0u.mjs} +1 -1
  36. package/dist/{detect-DUYFv3-O.mjs.map → detect-B1QHYA0u.mjs.map} +1 -1
  37. package/dist/{doctor-fIG4TtsO.mjs → doctor-Du4MVG5w.mjs} +3 -3
  38. package/dist/{doctor-fIG4TtsO.mjs.map → doctor-Du4MVG5w.mjs.map} +1 -1
  39. package/dist/{errors-DLkAWnzQ.mjs → errors-B0NcpPIp.mjs} +1 -1
  40. package/dist/{errors-DLkAWnzQ.mjs.map → errors-B0NcpPIp.mjs.map} +1 -1
  41. package/dist/{errors-BmLE-JSC.mjs → errors-De8Noahk.mjs} +2 -2
  42. package/dist/{errors-BmLE-JSC.mjs.map → errors-De8Noahk.mjs.map} +1 -1
  43. package/dist/git/base-branch.d.mts +61 -0
  44. package/dist/git/base-branch.d.mts.map +1 -0
  45. package/dist/git/base-branch.mjs +2 -0
  46. package/dist/git/branch-lifecycle.d.mts +1 -1
  47. package/dist/git/branch-lifecycle.mjs +2 -1
  48. package/dist/git/errors.mjs +1 -1
  49. package/dist/git/reconcile.d.mts +1 -1
  50. package/dist/git/reconcile.mjs +5 -4
  51. package/dist/git/transaction.d.mts +1 -1
  52. package/dist/git/transaction.mjs +4 -3
  53. package/dist/{graph-builder-CNswWNtb.mjs → graph-builder-BPhi-1KH.mjs} +2 -2
  54. package/dist/{graph-builder-CNswWNtb.mjs.map → graph-builder-BPhi-1KH.mjs.map} +1 -1
  55. package/dist/{id-CjGMPP1k.mjs → id-jrHWdtqn.mjs} +1 -1
  56. package/dist/{id-CjGMPP1k.mjs.map → id-jrHWdtqn.mjs.map} +1 -1
  57. package/dist/{index-DKZNUqpP.d.mts → index-BHpAYYFF.d.mts} +2 -2
  58. package/dist/{index-DKZNUqpP.d.mts.map → index-BHpAYYFF.d.mts.map} +1 -1
  59. package/dist/index-v0N9d4GT.d.mts +2 -0
  60. package/dist/index.mjs +16 -15
  61. package/dist/index.mjs.map +1 -1
  62. package/dist/{local-DkDTrGt_.mjs → local-BXTVAAr-.mjs} +314 -16
  63. package/dist/local-BXTVAAr-.mjs.map +1 -0
  64. package/dist/{node-CpLm3qr6.mjs → node-hrF4BrH2.mjs} +1 -1
  65. package/dist/{node-CpLm3qr6.mjs.map → node-hrF4BrH2.mjs.map} +1 -1
  66. package/dist/{paths-C6_C1gLp.mjs → paths-Dz5v-z00.mjs} +1 -1
  67. package/dist/{paths-C6_C1gLp.mjs.map → paths-Dz5v-z00.mjs.map} +1 -1
  68. package/dist/providers/github/index.d.mts +1 -1
  69. package/dist/providers/github/index.mjs +2 -2
  70. package/dist/providers/gitlab/index.d.mts +1 -1
  71. package/dist/providers/gitlab/index.mjs +2 -2
  72. package/dist/providers/local/index.d.mts +4 -1
  73. package/dist/providers/local/index.d.mts.map +1 -1
  74. package/dist/providers/local/index.mjs +5 -4
  75. package/dist/{reconcile-Cq60cldB.mjs → reconcile-BWbckvbv.mjs} +4 -3
  76. package/dist/{reconcile-Cq60cldB.mjs.map → reconcile-BWbckvbv.mjs.map} +1 -1
  77. package/dist/{scan-config-DkRKu_ON.mjs → scan-config-S5fkzNhL.mjs} +1 -1
  78. package/dist/{scan-config-DkRKu_ON.mjs.map → scan-config-S5fkzNhL.mjs.map} +1 -1
  79. package/dist/{scanner-BLo3ssiF.mjs → scanner-0sc_pARB.mjs} +6 -6
  80. package/dist/{scanner-BLo3ssiF.mjs.map → scanner-0sc_pARB.mjs.map} +1 -1
  81. package/dist/server/http/index.d.mts +1 -1
  82. package/dist/server/http/index.mjs +16 -15
  83. package/dist/server/http/index.mjs.map +1 -1
  84. package/dist/{server-CUtmhlno.d.mts → server-24UHN9Ll.d.mts} +2 -2
  85. package/dist/server-24UHN9Ll.d.mts.map +1 -0
  86. package/dist/{server-BJkE8D5N.mjs → server-Cl3LMiU3.mjs} +71 -44
  87. package/dist/server-Cl3LMiU3.mjs.map +1 -0
  88. package/dist/server.d.mts +1 -1
  89. package/dist/server.mjs +16 -15
  90. package/dist/{source-map-generator-Clb2Eqse.mjs → source-map-generator-DVDSWUZ1.mjs} +1 -1
  91. package/dist/{source-map-generator-Clb2Eqse.mjs.map → source-map-generator-DVDSWUZ1.mjs.map} +1 -1
  92. package/dist/{svelte-parser-CBN7Jxb7.mjs → svelte-parser-CVUIcakb.mjs} +3 -3
  93. package/dist/{svelte-parser-CBN7Jxb7.mjs.map → svelte-parser-CVUIcakb.mjs.map} +1 -1
  94. package/dist/templates/index.mjs +1 -1
  95. package/dist/{templates-BZbohJc8.mjs → templates-Dn-iZyzp.mjs} +1 -1
  96. package/dist/{templates-BZbohJc8.mjs.map → templates-Dn-iZyzp.mjs.map} +1 -1
  97. package/dist/testing/memory-provider.d.mts +1 -1
  98. package/dist/tools/annotations.mjs +1 -1
  99. package/dist/tools/availability.mjs +1 -1
  100. package/dist/{transaction-BWJt1KQb.mjs → transaction-DfrvGIfk.mjs} +4 -3
  101. package/dist/{transaction-BWJt1KQb.mjs.map → transaction-DfrvGIfk.mjs.map} +1 -1
  102. package/dist/{tsx-parser-go5V9zoc.mjs → tsx-parser-DgFdpsea.mjs} +1 -1
  103. package/dist/{tsx-parser-go5V9zoc.mjs.map → tsx-parser-DgFdpsea.mjs.map} +1 -1
  104. package/dist/tsx-parser-v8C-7cZv.mjs +2 -0
  105. package/dist/util/detect.mjs +1 -1
  106. package/dist/util/id.mjs +1 -1
  107. package/dist/{vue-parser-5Mp8w-mb.mjs → vue-parser-DvliI6UE.mjs} +3 -3
  108. package/dist/{vue-parser-5Mp8w-mb.mjs.map → vue-parser-DvliI6UE.mjs.map} +1 -1
  109. package/package.json +8 -4
  110. package/dist/branch-lifecycle-f4gI_eGo.mjs.map +0 -1
  111. package/dist/index-A5iw3yDk.d.mts +0 -2
  112. package/dist/local-DkDTrGt_.mjs.map +0 -1
  113. package/dist/server-BJkE8D5N.mjs.map +0 -1
  114. package/dist/server-CUtmhlno.d.mts.map +0 -1
  115. package/dist/tsx-parser-DOQpJVgK.mjs +0 -2
@@ -0,0 +1,61 @@
1
+ import { ContentrainConfig } from "@contentrain/types";
2
+ import { SimpleGit } from "simple-git";
3
+
4
+ //#region src/git/base-branch.d.ts
5
+ /**
6
+ * Resolve the base branch — the branch a local auto-merge advances with
7
+ * `update-ref`, pushes, and merges into `contentrain` before every write.
8
+ *
9
+ * Precedence, the same at every call site:
10
+ * 1. `CONTENTRAIN_BRANCH` env — a per-process override;
11
+ * 2. `config.repository.default_branch`;
12
+ * 3. the remote's default (`refs/remotes/<remote>/HEAD`), when that branch
13
+ * exists locally;
14
+ * 4. a local `main`, then a local `master`;
15
+ * 5. the checked-out branch — only when none of the above exists;
16
+ * 6. `'main'`.
17
+ *
18
+ * The checked-out branch used to be step 3. That made a developer's feature
19
+ * branch the base of every content write run while it was checked out: its
20
+ * code commits were merged into `contentrain`, the feature branch itself was
21
+ * advanced and pushed, and the code reached the real default branch on the
22
+ * next write by anyone else (#227). The checked-out branch is where the
23
+ * developer happens to be, not where content belongs.
24
+ *
25
+ * `currentBranch` may be passed when the caller already has it, to save a
26
+ * spawn; it is only consulted as the last resort.
27
+ */
28
+ declare function resolveBaseBranch(git: SimpleGit, config: ContentrainConfig | null | undefined, options?: {
29
+ remoteName?: string;
30
+ currentBranch?: string;
31
+ }): Promise<string>;
32
+ /** Which rung of {@link resolveBaseBranch}'s precedence answered. */
33
+ type BaseBranchSource = 'env' | 'config' | 'remote_head' | 'main' | 'master' | 'checked_out' | 'fallback';
34
+ /**
35
+ * {@link resolveBaseBranch}, also saying where the answer came from.
36
+ * `env: false` skips the `CONTENTRAIN_BRANCH` override — for callers that
37
+ * record the result, where a per-process override must not become config.
38
+ */
39
+ declare function resolveBaseBranchSource(git: SimpleGit, config: ContentrainConfig | null | undefined, options?: {
40
+ remoteName?: string;
41
+ currentBranch?: string;
42
+ env?: boolean;
43
+ }): Promise<{
44
+ branch: string;
45
+ source: BaseBranchSource;
46
+ }>;
47
+ /**
48
+ * The branch `init` records as `repository.default_branch`, or `null` when it
49
+ * cannot be told apart from where the developer happens to be (#230).
50
+ *
51
+ * The same precedence as {@link resolveBaseBranch}, minus the env override (a
52
+ * per-process override is not the project's default). The checked-out branch
53
+ * is recorded only when it is the repository's only branch — a fresh
54
+ * `git init` on a host whose `init.defaultBranch` is `develop`/`trunk`.
55
+ * Anywhere else it may be a feature branch, and recording that would make
56
+ * every later write advance it; leaving the field out keeps inference.
57
+ */
58
+ declare function resolveInitDefaultBranch(git: SimpleGit): Promise<string | null>;
59
+ //#endregion
60
+ export { BaseBranchSource, resolveBaseBranch, resolveBaseBranchSource, resolveInitDefaultBranch };
61
+ //# sourceMappingURL=base-branch.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-branch.d.mts","names":[],"sources":["../../src/git/base-branch.ts"],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;AASA;;;iBATsB,iBAAA,CACpB,GAAA,EAAK,SAAA,EACL,MAAA,EAAQ,iBAAA,qBACR,OAAA;EAAW,UAAA;EAAqB,aAAA;AAAA,IAC/B,OAAA;;KAKS,gBAAA;;;;;;iBAOU,uBAAA,CACpB,GAAA,EAAK,SAAA,EACL,MAAA,EAAQ,iBAAA,qBACR,OAAA;EAAW,UAAA;EAAqB,aAAA;EAAwB,GAAA;AAAA,IACvD,OAAA;EAAU,MAAA;EAAgB,MAAA,EAAQ,gBAAA;AAAA;;;;;;;AAiDrC;;;;;iBAAsB,wBAAA,CAAyB,GAAA,EAAK,SAAA,GAAY,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { n as resolveBaseBranchSource, r as resolveInitDefaultBranch, t as resolveBaseBranch } from "../base-branch-Cw9DWvCC.mjs";
2
+ export { resolveBaseBranch, resolveBaseBranchSource, resolveInitDefaultBranch };
@@ -1,2 +1,2 @@
1
- import { _ as pruneMergedRemoteBranches, a as RemoteBranchList, c as branchDiff, d as cleanupMergedBranches, f as contentBranchRelation, g as networkGit, h as listRemoteCrBranches, i as ContentBranchRelation, l as checkBranchHealth, m as isRefMerged, n as BranchHealthCheck, o as RemoteDeleteResult, p as deleteRemoteBranch, r as CleanupResult, s as RemotePruneResult, t as BranchDiffResult, u as classifyMergedBranches } from "../branch-lifecycle-DGlgjnC7.mjs";
1
+ import { _ as pruneMergedRemoteBranches, a as RemoteBranchList, c as branchDiff, d as cleanupMergedBranches, f as contentBranchRelation, g as networkGit, h as listRemoteCrBranches, i as ContentBranchRelation, l as checkBranchHealth, m as isRefMerged, n as BranchHealthCheck, o as RemoteDeleteResult, p as deleteRemoteBranch, r as CleanupResult, s as RemotePruneResult, t as BranchDiffResult, u as classifyMergedBranches } from "../branch-lifecycle-CirYfTXu.mjs";
2
2
  export { BranchDiffResult, BranchHealthCheck, CleanupResult, ContentBranchRelation, RemoteBranchList, RemoteDeleteResult, RemotePruneResult, branchDiff, checkBranchHealth, classifyMergedBranches, cleanupMergedBranches, contentBranchRelation, deleteRemoteBranch, isRefMerged, listRemoteCrBranches, networkGit, pruneMergedRemoteBranches };
@@ -1,5 +1,6 @@
1
1
  import "../fs-BFTuXbbw.mjs";
2
2
  import "../config-BLwZtwlI.mjs";
3
3
  import "../identity-CxAB9Qb8.mjs";
4
- import { a as contentBranchRelation, c as listRemoteCrBranches, i as cleanupMergedBranches, l as networkGit, n as checkBranchHealth, o as deleteRemoteBranch, r as classifyMergedBranches, s as isRefMerged, t as branchDiff, u as pruneMergedRemoteBranches } from "../branch-lifecycle-f4gI_eGo.mjs";
4
+ import "../base-branch-Cw9DWvCC.mjs";
5
+ import { a as contentBranchRelation, c as listRemoteCrBranches, i as cleanupMergedBranches, l as networkGit, n as checkBranchHealth, o as deleteRemoteBranch, r as classifyMergedBranches, s as isRefMerged, t as branchDiff, u as pruneMergedRemoteBranches } from "../branch-lifecycle-CcsSyfSw.mjs";
5
6
  export { branchDiff, checkBranchHealth, classifyMergedBranches, cleanupMergedBranches, contentBranchRelation, deleteRemoteBranch, isRefMerged, listRemoteCrBranches, networkGit, pruneMergedRemoteBranches };
@@ -1,2 +1,2 @@
1
- import { n as stripAnsi, t as normalizeOperationError } from "../errors-BmLE-JSC.mjs";
1
+ import { n as stripAnsi, t as normalizeOperationError } from "../errors-De8Noahk.mjs";
2
2
  export { normalizeOperationError, stripAnsi };
@@ -1,4 +1,4 @@
1
- import { r as ReconcilePlan } from "../index-DKZNUqpP.mjs";
1
+ import { r as ReconcilePlan } from "../index-BHpAYYFF.mjs";
2
2
  import { BaseAdvance, ConflictResolution, ContextSource, RemotePush, SyncResult } from "@contentrain/types";
3
3
 
4
4
  //#region src/git/reconcile.d.ts
@@ -6,8 +6,9 @@ import "../meta-manager-CSpKtjnP.mjs";
6
6
  import "../config-BLwZtwlI.mjs";
7
7
  import "../validator-C08p1OpM.mjs";
8
8
  import "../identity-CxAB9Qb8.mjs";
9
- import "../branch-lifecycle-f4gI_eGo.mjs";
10
- import "../id-CjGMPP1k.mjs";
11
- import "../transaction-BWJt1KQb.mjs";
12
- import { t as reconcileBranches } from "../reconcile-Cq60cldB.mjs";
9
+ import "../base-branch-Cw9DWvCC.mjs";
10
+ import "../branch-lifecycle-CcsSyfSw.mjs";
11
+ import "../id-jrHWdtqn.mjs";
12
+ import "../transaction-DfrvGIfk.mjs";
13
+ import { t as reconcileBranches } from "../reconcile-BWbckvbv.mjs";
13
14
  export { reconcileBranches };
@@ -1,4 +1,4 @@
1
- import { o as RemoteDeleteResult } from "../branch-lifecycle-DGlgjnC7.mjs";
1
+ import { o as RemoteDeleteResult } from "../branch-lifecycle-CirYfTXu.mjs";
2
2
  import { BaseAdvance, RemotePush, SyncResult, WorkflowMode } from "@contentrain/types";
3
3
  import { SimpleGit } from "simple-git";
4
4
 
@@ -4,7 +4,8 @@ import "../fs-BFTuXbbw.mjs";
4
4
  import "../meta-manager-CSpKtjnP.mjs";
5
5
  import "../config-BLwZtwlI.mjs";
6
6
  import "../identity-CxAB9Qb8.mjs";
7
- import "../branch-lifecycle-f4gI_eGo.mjs";
8
- import "../id-CjGMPP1k.mjs";
9
- import { a as isAncestor, c as selectiveSync, i as ensureContentBranch, n as buildBranchName, o as mergeBranch, r as createTransaction, s as pushContentBranches, t as NETWORK_TIMEOUT_MS } from "../transaction-BWJt1KQb.mjs";
7
+ import "../base-branch-Cw9DWvCC.mjs";
8
+ import "../branch-lifecycle-CcsSyfSw.mjs";
9
+ import "../id-jrHWdtqn.mjs";
10
+ import { a as isAncestor, c as selectiveSync, i as ensureContentBranch, n as buildBranchName, o as mergeBranch, r as createTransaction, s as pushContentBranches, t as NETWORK_TIMEOUT_MS } from "../transaction-DfrvGIfk.mjs";
10
11
  export { NETWORK_TIMEOUT_MS, buildBranchName, createTransaction, ensureContentBranch, isAncestor, mergeBranch, pushContentBranches, selectiveSync };
@@ -1,5 +1,5 @@
1
1
  import { o as readText, r as pathExists } from "./fs-BFTuXbbw.mjs";
2
- import { a as classifyFile, i as autoDetectSourceDirs, n as SCAN_EXTENSIONS, o as discoverFiles } from "./scan-config-DkRKu_ON.mjs";
2
+ import { a as classifyFile, i as autoDetectSourceDirs, n as SCAN_EXTENSIONS, o as discoverFiles } from "./scan-config-S5fkzNhL.mjs";
3
3
  import { dirname, extname, join, relative } from "node:path";
4
4
  //#region src/core/graph-builder.ts
5
5
  const MAX_ORPHANS = 10;
@@ -159,4 +159,4 @@ async function buildGraph(projectRoot, options) {
159
159
  //#endregion
160
160
  export { buildGraph as t };
161
161
 
162
- //# sourceMappingURL=graph-builder-CNswWNtb.mjs.map
162
+ //# sourceMappingURL=graph-builder-BPhi-1KH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-builder-CNswWNtb.mjs","names":[],"sources":["../src/core/graph-builder.ts"],"sourcesContent":["import type { FileCategory, GraphNode, ProjectGraph } from '@contentrain/types'\nimport { join, relative, dirname, extname } from 'node:path'\nimport { readText, pathExists } from '../util/fs.js'\nimport {\n SCAN_EXTENSIONS,\n classifyFile,\n autoDetectSourceDirs,\n discoverFiles,\n} from './scan-config.js'\n\nexport interface BuildGraphOptions {\n paths?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst MAX_ORPHANS = 10\n\n// ---------------------------------------------------------------------------\n// Import extraction\n// ---------------------------------------------------------------------------\n\nconst IMPORT_RE = /(?:import|export)\\s+.*?from\\s+['\"]([^'\"]+)['\"]|(?:import|require)\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction extractImportPaths(content: string): string[] {\n const paths: string[] = []\n let m: RegExpExecArray | null\n // Reset lastIndex before use since we reuse the regex\n IMPORT_RE.lastIndex = 0\n while ((m = IMPORT_RE.exec(content)) !== null) {\n const p = m[1] ?? m[2]\n if (p && isLocalImport(p)) {\n paths.push(p)\n }\n }\n return paths\n}\n\nfunction isLocalImport(p: string): boolean {\n return p.startsWith('.') || p.startsWith('/')\n}\n\n// ---------------------------------------------------------------------------\n// Component name extraction from imports\n// ---------------------------------------------------------------------------\n\nconst NAMED_IMPORT_RE = /import\\s+(?:type\\s+)?(?:(\\w+)(?:\\s*,\\s*)?)?(?:\\{([^}]*)\\})?\\s+from\\s+['\"][^'\"]+['\"]/g\nconst DEFAULT_IMPORT_RE = /import\\s+(?:type\\s+)?(\\w+)\\s+from\\s+['\"][^'\"]+['\"]/g\n\nfunction isPascalCase(name: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*$/.test(name)\n}\n\nfunction extractComponentNames(content: string): string[] {\n const names = new Set<string>()\n\n // Default imports: `import Button from '...'`\n DEFAULT_IMPORT_RE.lastIndex = 0\n let m: RegExpExecArray | null\n while ((m = DEFAULT_IMPORT_RE.exec(content)) !== null) {\n const name = m[1]\n if (name && isPascalCase(name)) {\n names.add(name)\n }\n }\n\n // Named imports: `import { Button, useHook } from '...'`\n NAMED_IMPORT_RE.lastIndex = 0\n while ((m = NAMED_IMPORT_RE.exec(content)) !== null) {\n // Default part before destructuring\n const defaultName = m[1]\n if (defaultName && isPascalCase(defaultName)) {\n names.add(defaultName)\n }\n // Destructured names\n const namedPart = m[2]\n if (namedPart) {\n for (const segment of namedPart.split(',')) {\n // Handle `Foo as Bar` — take the local name (Bar)\n const parts = segment.trim().split(/\\s+as\\s+/)\n const localName = (parts[1] ?? parts[0])?.trim()\n if (localName && isPascalCase(localName)) {\n names.add(localName)\n }\n }\n }\n }\n\n return [...names]\n}\n\n// ---------------------------------------------------------------------------\n// String counting (estimate)\n// ---------------------------------------------------------------------------\n\nconst STRING_SINGLE_RE = /'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/g\nconst STRING_DOUBLE_RE = /\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"/g\nconst STRING_TEMPLATE_RE = /`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`/g\n\nfunction countStrings(content: string): number {\n // Strip import/export/require lines first so their string literals don't count\n const stripped = content.replace(/^(?:import|export)\\s+.*$/gm, '')\n .replace(/\\brequire\\s*\\([^)]*\\)/g, '')\n\n const singles = stripped.match(STRING_SINGLE_RE)?.length ?? 0\n const doubles = stripped.match(STRING_DOUBLE_RE)?.length ?? 0\n const templates = stripped.match(STRING_TEMPLATE_RE)?.length ?? 0\n\n return singles + doubles + templates\n}\n\n// ---------------------------------------------------------------------------\n// Import path resolution\n// ---------------------------------------------------------------------------\n\nconst RESOLVE_EXTENSIONS = [...SCAN_EXTENSIONS]\nconst RESOLVE_INDEX_FILES = ['index.ts', 'index.tsx', 'index.js']\n\nasync function resolveImportPath(\n importPath: string,\n importerDir: string,\n projectRoot: string,\n): Promise<string | null> {\n const base = importPath.startsWith('/')\n ? join(projectRoot, importPath)\n : join(importerDir, importPath)\n\n // If it already has an extension, check directly\n if (extname(base)) {\n if (await pathExists(base)) {\n return base\n }\n return null\n }\n\n // Try adding extensions\n for (const ext of RESOLVE_EXTENSIONS) {\n const candidate = base + ext\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n // Try index files inside directory\n for (const idx of RESOLVE_INDEX_FILES) {\n const candidate = join(base, idx)\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Main\n// ---------------------------------------------------------------------------\n\ninterface FileInfo {\n relPath: string\n imports: string[]\n components: string[]\n strings: number\n category: FileCategory\n}\n\nexport async function buildGraph(\n projectRoot: string,\n options?: BuildGraphOptions,\n): Promise<ProjectGraph> {\n const scanDirs = options?.paths ?? await autoDetectSourceDirs(projectRoot)\n\n // ---- File discovery (shared with scanner) ----\n const filePaths = await discoverFiles(projectRoot, {\n paths: scanDirs,\n include: options?.include,\n exclude: options?.exclude,\n })\n\n // ---- Pass 1: Parse each file ----\n const fileMap = new Map<string, FileInfo>()\n\n const parsePromises = filePaths.map(async (relPath) => {\n const absPath = join(projectRoot, relPath)\n const content = await readText(absPath)\n if (content === null) return\n\n const imports = extractImportPaths(content)\n const components = extractComponentNames(content)\n const strings = countStrings(content)\n const category = classifyFile(relPath)\n\n fileMap.set(relPath, { relPath, imports, components, strings, category })\n })\n\n await Promise.all(parsePromises)\n\n // ---- Pass 2: Resolve imports and build reverse lookup ----\n const usedByMap = new Map<string, Set<string>>()\n\n // Initialize usedBy sets\n for (const relPath of fileMap.keys()) {\n usedByMap.set(relPath, new Set())\n }\n\n const resolvePromises: Promise<void>[] = []\n\n for (const [relPath, info] of fileMap) {\n const importerAbsDir = dirname(join(projectRoot, relPath))\n\n for (const rawImport of info.imports) {\n resolvePromises.push(\n resolveImportPath(rawImport, importerAbsDir, projectRoot).then((resolved) => {\n if (!resolved) return\n const resolvedRel = relative(projectRoot, resolved)\n const targetSet = usedByMap.get(resolvedRel)\n if (targetSet) {\n targetSet.add(relPath)\n }\n }),\n )\n }\n }\n\n await Promise.all(resolvePromises)\n\n // ---- Build nodes ----\n const pages: GraphNode[] = []\n const components: GraphNode[] = []\n const layouts: GraphNode[] = []\n const orphanCandidates: string[] = []\n\n let totalStrings = 0\n\n for (const [relPath, info] of fileMap) {\n const usedBy = [...(usedByMap.get(relPath) ?? [])].toSorted((a, b) => a.localeCompare(b))\n totalStrings += info.strings\n\n // Filter out nodes with 0 strings — not relevant for content extraction\n if (info.strings === 0 && info.category !== 'other') continue\n\n const node: GraphNode = {\n file: relPath,\n category: info.category,\n imports: info.imports,\n used_by: usedBy,\n strings: info.strings,\n }\n\n // Only attach components list for pages\n if (info.category === 'page' && info.components.length > 0) {\n node.components = info.components\n }\n\n switch (info.category) {\n case 'page':\n pages.push(node)\n break\n case 'component':\n components.push(node)\n break\n case 'layout':\n layouts.push(node)\n break\n default:\n // Orphan = \"other\" category with no inbound references and no outbound imports\n if (usedBy.length === 0 && info.imports.length === 0) {\n orphanCandidates.push(relPath)\n }\n break\n }\n }\n\n return {\n pages: pages.toSorted((a, b) => a.file.localeCompare(b.file)),\n components: components.toSorted((a, b) => a.file.localeCompare(b.file)),\n layouts: layouts.toSorted((a, b) => a.file.localeCompare(b.file)),\n orphan_files: orphanCandidates.toSorted((a, b) => a.localeCompare(b)).slice(0, MAX_ORPHANS),\n stats: {\n total_files: fileMap.size,\n total_components: components.length,\n total_pages: pages.length,\n total_strings_estimate: totalStrings,\n },\n }\n}\n"],"mappings":";;;;AAgBA,MAAM,cAAc;AAMpB,MAAM,YAAY;AAElB,SAAS,mBAAmB,SAA2B;CACrD,MAA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AAK,QAAQ,WAAW,EACjD,kBAAiB,KAAK,QAAQ;AAEhC;;;AAIN,QAAO;EACL,OAAO,MAAM,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EAC7D,YAAY,WAAW,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EACvE,SAAS,QAAQ,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EACjE,cAAc,iBAAiB,UAAU,GAAG,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,GAAG,YAAY;EAC3F,OAAO;GACL,aAAa,QAAQ;GACrB,kBAAkB,WAAW;GAC7B,aAAa,MAAM;GACnB,wBAAwB;GACzB;EACF"}
1
+ {"version":3,"file":"graph-builder-BPhi-1KH.mjs","names":[],"sources":["../src/core/graph-builder.ts"],"sourcesContent":["import type { FileCategory, GraphNode, ProjectGraph } from '@contentrain/types'\nimport { join, relative, dirname, extname } from 'node:path'\nimport { readText, pathExists } from '../util/fs.js'\nimport {\n SCAN_EXTENSIONS,\n classifyFile,\n autoDetectSourceDirs,\n discoverFiles,\n} from './scan-config.js'\n\nexport interface BuildGraphOptions {\n paths?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst MAX_ORPHANS = 10\n\n// ---------------------------------------------------------------------------\n// Import extraction\n// ---------------------------------------------------------------------------\n\nconst IMPORT_RE = /(?:import|export)\\s+.*?from\\s+['\"]([^'\"]+)['\"]|(?:import|require)\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction extractImportPaths(content: string): string[] {\n const paths: string[] = []\n let m: RegExpExecArray | null\n // Reset lastIndex before use since we reuse the regex\n IMPORT_RE.lastIndex = 0\n while ((m = IMPORT_RE.exec(content)) !== null) {\n const p = m[1] ?? m[2]\n if (p && isLocalImport(p)) {\n paths.push(p)\n }\n }\n return paths\n}\n\nfunction isLocalImport(p: string): boolean {\n return p.startsWith('.') || p.startsWith('/')\n}\n\n// ---------------------------------------------------------------------------\n// Component name extraction from imports\n// ---------------------------------------------------------------------------\n\nconst NAMED_IMPORT_RE = /import\\s+(?:type\\s+)?(?:(\\w+)(?:\\s*,\\s*)?)?(?:\\{([^}]*)\\})?\\s+from\\s+['\"][^'\"]+['\"]/g\nconst DEFAULT_IMPORT_RE = /import\\s+(?:type\\s+)?(\\w+)\\s+from\\s+['\"][^'\"]+['\"]/g\n\nfunction isPascalCase(name: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*$/.test(name)\n}\n\nfunction extractComponentNames(content: string): string[] {\n const names = new Set<string>()\n\n // Default imports: `import Button from '...'`\n DEFAULT_IMPORT_RE.lastIndex = 0\n let m: RegExpExecArray | null\n while ((m = DEFAULT_IMPORT_RE.exec(content)) !== null) {\n const name = m[1]\n if (name && isPascalCase(name)) {\n names.add(name)\n }\n }\n\n // Named imports: `import { Button, useHook } from '...'`\n NAMED_IMPORT_RE.lastIndex = 0\n while ((m = NAMED_IMPORT_RE.exec(content)) !== null) {\n // Default part before destructuring\n const defaultName = m[1]\n if (defaultName && isPascalCase(defaultName)) {\n names.add(defaultName)\n }\n // Destructured names\n const namedPart = m[2]\n if (namedPart) {\n for (const segment of namedPart.split(',')) {\n // Handle `Foo as Bar` — take the local name (Bar)\n const parts = segment.trim().split(/\\s+as\\s+/)\n const localName = (parts[1] ?? parts[0])?.trim()\n if (localName && isPascalCase(localName)) {\n names.add(localName)\n }\n }\n }\n }\n\n return [...names]\n}\n\n// ---------------------------------------------------------------------------\n// String counting (estimate)\n// ---------------------------------------------------------------------------\n\nconst STRING_SINGLE_RE = /'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/g\nconst STRING_DOUBLE_RE = /\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"/g\nconst STRING_TEMPLATE_RE = /`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`/g\n\nfunction countStrings(content: string): number {\n // Strip import/export/require lines first so their string literals don't count\n const stripped = content.replace(/^(?:import|export)\\s+.*$/gm, '')\n .replace(/\\brequire\\s*\\([^)]*\\)/g, '')\n\n const singles = stripped.match(STRING_SINGLE_RE)?.length ?? 0\n const doubles = stripped.match(STRING_DOUBLE_RE)?.length ?? 0\n const templates = stripped.match(STRING_TEMPLATE_RE)?.length ?? 0\n\n return singles + doubles + templates\n}\n\n// ---------------------------------------------------------------------------\n// Import path resolution\n// ---------------------------------------------------------------------------\n\nconst RESOLVE_EXTENSIONS = [...SCAN_EXTENSIONS]\nconst RESOLVE_INDEX_FILES = ['index.ts', 'index.tsx', 'index.js']\n\nasync function resolveImportPath(\n importPath: string,\n importerDir: string,\n projectRoot: string,\n): Promise<string | null> {\n const base = importPath.startsWith('/')\n ? join(projectRoot, importPath)\n : join(importerDir, importPath)\n\n // If it already has an extension, check directly\n if (extname(base)) {\n if (await pathExists(base)) {\n return base\n }\n return null\n }\n\n // Try adding extensions\n for (const ext of RESOLVE_EXTENSIONS) {\n const candidate = base + ext\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n // Try index files inside directory\n for (const idx of RESOLVE_INDEX_FILES) {\n const candidate = join(base, idx)\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Main\n// ---------------------------------------------------------------------------\n\ninterface FileInfo {\n relPath: string\n imports: string[]\n components: string[]\n strings: number\n category: FileCategory\n}\n\nexport async function buildGraph(\n projectRoot: string,\n options?: BuildGraphOptions,\n): Promise<ProjectGraph> {\n const scanDirs = options?.paths ?? await autoDetectSourceDirs(projectRoot)\n\n // ---- File discovery (shared with scanner) ----\n const filePaths = await discoverFiles(projectRoot, {\n paths: scanDirs,\n include: options?.include,\n exclude: options?.exclude,\n })\n\n // ---- Pass 1: Parse each file ----\n const fileMap = new Map<string, FileInfo>()\n\n const parsePromises = filePaths.map(async (relPath) => {\n const absPath = join(projectRoot, relPath)\n const content = await readText(absPath)\n if (content === null) return\n\n const imports = extractImportPaths(content)\n const components = extractComponentNames(content)\n const strings = countStrings(content)\n const category = classifyFile(relPath)\n\n fileMap.set(relPath, { relPath, imports, components, strings, category })\n })\n\n await Promise.all(parsePromises)\n\n // ---- Pass 2: Resolve imports and build reverse lookup ----\n const usedByMap = new Map<string, Set<string>>()\n\n // Initialize usedBy sets\n for (const relPath of fileMap.keys()) {\n usedByMap.set(relPath, new Set())\n }\n\n const resolvePromises: Promise<void>[] = []\n\n for (const [relPath, info] of fileMap) {\n const importerAbsDir = dirname(join(projectRoot, relPath))\n\n for (const rawImport of info.imports) {\n resolvePromises.push(\n resolveImportPath(rawImport, importerAbsDir, projectRoot).then((resolved) => {\n if (!resolved) return\n const resolvedRel = relative(projectRoot, resolved)\n const targetSet = usedByMap.get(resolvedRel)\n if (targetSet) {\n targetSet.add(relPath)\n }\n }),\n )\n }\n }\n\n await Promise.all(resolvePromises)\n\n // ---- Build nodes ----\n const pages: GraphNode[] = []\n const components: GraphNode[] = []\n const layouts: GraphNode[] = []\n const orphanCandidates: string[] = []\n\n let totalStrings = 0\n\n for (const [relPath, info] of fileMap) {\n const usedBy = [...(usedByMap.get(relPath) ?? [])].toSorted((a, b) => a.localeCompare(b))\n totalStrings += info.strings\n\n // Filter out nodes with 0 strings — not relevant for content extraction\n if (info.strings === 0 && info.category !== 'other') continue\n\n const node: GraphNode = {\n file: relPath,\n category: info.category,\n imports: info.imports,\n used_by: usedBy,\n strings: info.strings,\n }\n\n // Only attach components list for pages\n if (info.category === 'page' && info.components.length > 0) {\n node.components = info.components\n }\n\n switch (info.category) {\n case 'page':\n pages.push(node)\n break\n case 'component':\n components.push(node)\n break\n case 'layout':\n layouts.push(node)\n break\n default:\n // Orphan = \"other\" category with no inbound references and no outbound imports\n if (usedBy.length === 0 && info.imports.length === 0) {\n orphanCandidates.push(relPath)\n }\n break\n }\n }\n\n return {\n pages: pages.toSorted((a, b) => a.file.localeCompare(b.file)),\n components: components.toSorted((a, b) => a.file.localeCompare(b.file)),\n layouts: layouts.toSorted((a, b) => a.file.localeCompare(b.file)),\n orphan_files: orphanCandidates.toSorted((a, b) => a.localeCompare(b)).slice(0, MAX_ORPHANS),\n stats: {\n total_files: fileMap.size,\n total_components: components.length,\n total_pages: pages.length,\n total_strings_estimate: totalStrings,\n },\n }\n}\n"],"mappings":";;;;AAgBA,MAAM,cAAc;AAMpB,MAAM,YAAY;AAElB,SAAS,mBAAmB,SAA2B;CACrD,MAAM,QAAkB,EAAE;CAC1B,IAAI;AAEJ,WAAU,YAAY;AACtB,SAAQ,IAAI,UAAU,KAAK,QAAQ,MAAM,MAAM;EAC7C,MAAM,IAAI,EAAE,MAAM,EAAE;AACpB,MAAI,KAAK,cAAc,EAAE,CACvB,OAAM,KAAK,EAAE;;AAGjB,QAAO;;AAGT,SAAS,cAAc,GAAoB;AACzC,QAAO,EAAE,WAAW,IAAI,IAAI,EAAE,WAAW,IAAI;;AAO/C,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,SAAS,aAAa,MAAuB;AAC3C,QAAO,sBAAsB,KAAK,KAAK;;AAGzC,SAAS,sBAAsB,SAA2B;CACxD,MAAM,wBAAQ,IAAI,KAAa;AAG/B,mBAAkB,YAAY;CAC9B,IAAI;AACJ,SAAQ,IAAI,kBAAkB,KAAK,QAAQ,MAAM,MAAM;EACrD,MAAM,OAAO,EAAE;AACf,MAAI,QAAQ,aAAa,KAAK,CAC5B,OAAM,IAAI,KAAK;;AAKnB,iBAAgB,YAAY;AAC5B,SAAQ,IAAI,gBAAgB,KAAK,QAAQ,MAAM,MAAM;EAEnD,MAAM,cAAc,EAAE;AACtB,MAAI,eAAe,aAAa,YAAY,CAC1C,OAAM,IAAI,YAAY;EAGxB,MAAM,YAAY,EAAE;AACpB,MAAI,UACF,MAAK,MAAM,WAAW,UAAU,MAAM,IAAI,EAAE;GAE1C,MAAM,QAAQ,QAAQ,MAAM,CAAC,MAAM,WAAW;GAC9C,MAAM,aAAa,MAAM,MAAM,MAAM,KAAK,MAAM;AAChD,OAAI,aAAa,aAAa,UAAU,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AK,aAAa,UAAU,KAAK,WAAW,SAAS,EACvD,MAAK,aAAa,KAAK;AAGzB,UAAQ,KAAK,UAAb;GACE,KAAK;AACH,UAAM,KAAK,KAAK;AAChB;GACF,KAAK;AACH,eAAW,KAAK,KAAK;AACrB;GACF,KAAK;AACH,YAAQ,KAAK,KAAK;AAClB;GACF;AAEE,QAAI,OAAO,WAAW,KAAK,KAAK,QAAQ,WAAW,EACjD,kBAAiB,KAAK,QAAQ;AAEhC;;;AAIN,QAAO;EACL,OAAO,MAAM,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EAC7D,YAAY,WAAW,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EACvE,SAAS,QAAQ,UAAU,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;EACjE,cAAc,iBAAiB,UAAU,GAAG,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,GAAG,YAAY;EAC3F,OAAO;GACL,aAAa,QAAQ;GACrB,kBAAkB,WAAW;GAC7B,aAAa,MAAM;GACnB,wBAAwB;GACzB;EACF"}
@@ -7,4 +7,4 @@ function branchTimestamp() {
7
7
  //#endregion
8
8
  export { generateEntryId$1 as n, branchTimestamp as t };
9
9
 
10
- //# sourceMappingURL=id-CjGMPP1k.mjs.map
10
+ //# sourceMappingURL=id-jrHWdtqn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-CjGMPP1k.mjs","names":[],"sources":["../src/util/id.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport function branchTimestamp(): string {\n const ts = Math.floor(Date.now() / 1000).toString()\n const suffix = randomUUID().slice(0, 4)\n return `${ts}-${suffix}`\n}\n\n// generateEntryId is now exported from @contentrain/types\nexport { generateEntryId } from '@contentrain/types'\n"],"mappings":";;;AAEA,SAAgB,kBAA0B;AAGxC,QAAO,GAFI,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK,CAAC,UAAU,CAEtC,GADE,YAAY,CAAC,MAAM,GAAG,EAAE"}
1
+ {"version":3,"file":"id-jrHWdtqn.mjs","names":[],"sources":["../src/util/id.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport function branchTimestamp(): string {\n const ts = Math.floor(Date.now() / 1000).toString()\n const suffix = randomUUID().slice(0, 4)\n return `${ts}-${suffix}`\n}\n\n// generateEntryId is now exported from @contentrain/types\nexport { generateEntryId } from '@contentrain/types'\n"],"mappings":";;;AAEA,SAAgB,kBAA0B;AAGxC,QAAO,GAFI,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK,CAAC,UAAU,CAEtC,GADE,YAAY,CAAC,MAAM,GAAG,EAAE"}
@@ -1,4 +1,4 @@
1
- import { _ as RepoReader, a as FileChange } from "./index-A5iw3yDk.mjs";
1
+ import { o as FileChange, v as RepoReader } from "./index-v0N9d4GT.mjs";
2
2
  import { ConflictItem, ConflictResolution, ContextSource } from "@contentrain/types";
3
3
 
4
4
  //#region src/core/ops/types.d.ts
@@ -82,4 +82,4 @@ interface ReconcilePlan extends OpPlan<ReconcileResult> {
82
82
  declare function planReconcile(input: ReconcileInput): Promise<ReconcilePlan>;
83
83
  //#endregion
84
84
  export { ContentSaveEntryResult as a, ReconcileResult as i, ReconcileInput as n, ContentSavePlan as o, ReconcilePlan as r, OpPlan as s, planReconcile as t };
85
- //# sourceMappingURL=index-DKZNUqpP.d.mts.map
85
+ //# sourceMappingURL=index-BHpAYYFF.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DKZNUqpP.d.mts","names":[],"sources":["../src/core/ops/types.ts","../src/core/ops/reconcile/types.ts","../src/core/ops/reconcile/plan.ts"],"mappings":";;;;;;;AAUA;;;;;UAAiB,MAAA;EAEN;EAAT,OAAA,EAAS,UAAA;EAED;EAAR,MAAA,EAAQ,OAAA;EAEE;EAAV,UAAA;AAAA;AAAA,UAGe,sBAAA;EACf,MAAA;EACA,EAAA;EACA,IAAA;EACA,MAAA;EAC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;ADhCb;;;;;;;;;iBEkDsB,aAAA,CAAc,KAAA,EAAO,cAAA,GAAiB,OAAA,CAAQ,aAAA"}
@@ -0,0 +1,2 @@
1
+ import { ApplyPlanInput as ApplyPlanInput$1, Branch, Commit as Commit$1, CommitAuthor, ContentReadSource, FileChange, FileDiff, LOCAL_CAPABILITIES, MediaAsset, MediaIngestInput, MediaListOptions, MediaListResult, MediaProvider, MediaUpdateInput, MergeResult, ProviderCapabilities as ProviderCapabilities$1, RepoProvider as RepoProvider$1, RepoReader, RepoWriter as RepoWriter$1, WriteReadiness } from "@contentrain/types";
2
+ export { RepoProvider$1 as _, ContentReadSource as a, WriteReadiness as b, LOCAL_CAPABILITIES as c, MediaListOptions as d, MediaListResult as f, ProviderCapabilities$1 as g, MergeResult as h, CommitAuthor as i, MediaAsset as l, MediaUpdateInput as m, Branch as n, FileChange as o, MediaProvider as p, Commit$1 as r, FileDiff as s, ApplyPlanInput$1 as t, MediaIngestInput as u, RepoReader as v, RepoWriter$1 as y };
package/dist/index.mjs CHANGED
@@ -9,21 +9,22 @@ import "./meta-manager-CSpKtjnP.mjs";
9
9
  import "./config-BLwZtwlI.mjs";
10
10
  import "./validator-C08p1OpM.mjs";
11
11
  import "./identity-CxAB9Qb8.mjs";
12
- import "./branch-lifecycle-f4gI_eGo.mjs";
13
- import "./id-CjGMPP1k.mjs";
14
- import "./transaction-BWJt1KQb.mjs";
15
- import "./local-DkDTrGt_.mjs";
16
- import "./detect-DUYFv3-O.mjs";
17
- import "./annotations-CXHPnS-M.mjs";
18
- import { n as createServer } from "./server-BJkE8D5N.mjs";
19
- import "./errors-BmLE-JSC.mjs";
20
- import "./reconcile-Cq60cldB.mjs";
21
- import "./scan-config-DkRKu_ON.mjs";
22
- import "./graph-builder-CNswWNtb.mjs";
23
- import "./scanner-BLo3ssiF.mjs";
24
- import "./tsx-parser-go5V9zoc.mjs";
25
- import "./apply-manager-llmSyK5K.mjs";
26
- import "./doctor-fIG4TtsO.mjs";
12
+ import "./base-branch-Cw9DWvCC.mjs";
13
+ import "./branch-lifecycle-CcsSyfSw.mjs";
14
+ import "./id-jrHWdtqn.mjs";
15
+ import "./transaction-DfrvGIfk.mjs";
16
+ import "./local-BXTVAAr-.mjs";
17
+ import "./detect-B1QHYA0u.mjs";
18
+ import "./annotations-BYkjoj2d.mjs";
19
+ import { n as createServer } from "./server-Cl3LMiU3.mjs";
20
+ import "./errors-De8Noahk.mjs";
21
+ import "./reconcile-BWbckvbv.mjs";
22
+ import "./scan-config-S5fkzNhL.mjs";
23
+ import "./graph-builder-BPhi-1KH.mjs";
24
+ import "./scanner-0sc_pARB.mjs";
25
+ import "./tsx-parser-DgFdpsea.mjs";
26
+ import "./apply-manager-B-VMXKiW.mjs";
27
+ import "./doctor-Du4MVG5w.mjs";
27
28
  import { resolve } from "node:path";
28
29
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
29
30
  //#region src/index.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { resolve } from 'node:path'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { createServer } from './server.js'\n\nconst projectRoot = resolve(process.env['CONTENTRAIN_PROJECT_ROOT'] ?? process.cwd())\nconst server = createServer(projectRoot)\nconst transport = new StdioServerTransport()\n\nawait server.connect(transport)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,SAAS,aADK,QAAQ,QAAQ,IAAI,+BAA+B,QAAQ,KAAK,CAAC,CAC7C;AACxC,MAAM,YAAY,IAAI,sBAAsB;AAE5C,MAAM,OAAO,QAAQ,UAAU"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { resolve } from 'node:path'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { createServer } from './server.js'\n\nconst projectRoot = resolve(process.env['CONTENTRAIN_PROJECT_ROOT'] ?? process.cwd())\nconst server = createServer(projectRoot)\nconst transport = new StdioServerTransport()\n\nawait server.connect(transport)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,SAAS,aADK,QAAQ,QAAQ,IAAI,+BAA+B,QAAQ,KAAK,CAAC,CAC7C;AACxC,MAAM,YAAY,IAAI,sBAAsB;AAE5C,MAAM,OAAO,QAAQ,UAAU"}