@lorepack/cli 0.0.0-stage → 0.1.0-alpha.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 (229) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/commands/activate.d.ts +20 -0
  3. package/dist/commands/activate.d.ts.map +1 -0
  4. package/dist/commands/activate.js +171 -0
  5. package/dist/commands/activate.js.map +1 -0
  6. package/dist/commands/build.d.ts +3 -0
  7. package/dist/commands/build.d.ts.map +1 -0
  8. package/dist/commands/build.js +53 -0
  9. package/dist/commands/build.js.map +1 -0
  10. package/dist/commands/config.d.ts +14 -0
  11. package/dist/commands/config.d.ts.map +1 -0
  12. package/dist/commands/config.js +109 -0
  13. package/dist/commands/config.js.map +1 -0
  14. package/dist/commands/connect.d.ts +5 -0
  15. package/dist/commands/connect.d.ts.map +1 -0
  16. package/dist/commands/connect.js +196 -0
  17. package/dist/commands/connect.js.map +1 -0
  18. package/dist/commands/deploy.d.ts +14 -0
  19. package/dist/commands/deploy.d.ts.map +1 -0
  20. package/dist/commands/deploy.js +248 -0
  21. package/dist/commands/deploy.js.map +1 -0
  22. package/dist/commands/dev.d.ts +25 -0
  23. package/dist/commands/dev.d.ts.map +1 -0
  24. package/dist/commands/dev.js +227 -0
  25. package/dist/commands/dev.js.map +1 -0
  26. package/dist/commands/diff.d.ts +3 -0
  27. package/dist/commands/diff.d.ts.map +1 -0
  28. package/dist/commands/diff.js +75 -0
  29. package/dist/commands/diff.js.map +1 -0
  30. package/dist/commands/doctor.d.ts +14 -0
  31. package/dist/commands/doctor.d.ts.map +1 -0
  32. package/dist/commands/doctor.js +96 -0
  33. package/dist/commands/doctor.js.map +1 -0
  34. package/dist/commands/export.d.ts +3 -0
  35. package/dist/commands/export.d.ts.map +1 -0
  36. package/dist/commands/export.js +126 -0
  37. package/dist/commands/export.js.map +1 -0
  38. package/dist/commands/index.d.ts +8 -0
  39. package/dist/commands/index.d.ts.map +1 -0
  40. package/dist/commands/index.js +51 -0
  41. package/dist/commands/index.js.map +1 -0
  42. package/dist/commands/init.d.ts +3 -0
  43. package/dist/commands/init.d.ts.map +1 -0
  44. package/dist/commands/init.js +95 -0
  45. package/dist/commands/init.js.map +1 -0
  46. package/dist/commands/inspect.d.ts +15 -0
  47. package/dist/commands/inspect.d.ts.map +1 -0
  48. package/dist/commands/inspect.js +527 -0
  49. package/dist/commands/inspect.js.map +1 -0
  50. package/dist/commands/mcp.d.ts +12 -0
  51. package/dist/commands/mcp.d.ts.map +1 -0
  52. package/dist/commands/mcp.js +219 -0
  53. package/dist/commands/mcp.js.map +1 -0
  54. package/dist/commands/pack.d.ts +9 -0
  55. package/dist/commands/pack.d.ts.map +1 -0
  56. package/dist/commands/pack.js +57 -0
  57. package/dist/commands/pack.js.map +1 -0
  58. package/dist/commands/plan.d.ts +3 -0
  59. package/dist/commands/plan.d.ts.map +1 -0
  60. package/dist/commands/plan.js +44 -0
  61. package/dist/commands/plan.js.map +1 -0
  62. package/dist/commands/prune.d.ts +7 -0
  63. package/dist/commands/prune.d.ts.map +1 -0
  64. package/dist/commands/prune.js +341 -0
  65. package/dist/commands/prune.js.map +1 -0
  66. package/dist/commands/search.d.ts +3 -0
  67. package/dist/commands/search.d.ts.map +1 -0
  68. package/dist/commands/search.js +84 -0
  69. package/dist/commands/search.js.map +1 -0
  70. package/dist/commands/serve.d.ts +20 -0
  71. package/dist/commands/serve.d.ts.map +1 -0
  72. package/dist/commands/serve.js +66 -0
  73. package/dist/commands/serve.js.map +1 -0
  74. package/dist/commands/status.d.ts +3 -0
  75. package/dist/commands/status.d.ts.map +1 -0
  76. package/dist/commands/status.js +27 -0
  77. package/dist/commands/status.js.map +1 -0
  78. package/dist/commands/target.d.ts +71 -0
  79. package/dist/commands/target.d.ts.map +1 -0
  80. package/dist/commands/target.js +945 -0
  81. package/dist/commands/target.js.map +1 -0
  82. package/dist/entry.d.ts +3 -0
  83. package/dist/entry.d.ts.map +1 -0
  84. package/dist/entry.js +19 -0
  85. package/dist/entry.js.map +1 -0
  86. package/dist/framework/context.d.ts +49 -0
  87. package/dist/framework/context.d.ts.map +1 -0
  88. package/dist/framework/context.js +47 -0
  89. package/dist/framework/context.js.map +1 -0
  90. package/dist/framework/exit.d.ts +36 -0
  91. package/dist/framework/exit.d.ts.map +1 -0
  92. package/dist/framework/exit.js +57 -0
  93. package/dist/framework/exit.js.map +1 -0
  94. package/dist/framework/metadata.d.ts +38 -0
  95. package/dist/framework/metadata.d.ts.map +1 -0
  96. package/dist/framework/metadata.js +47 -0
  97. package/dist/framework/metadata.js.map +1 -0
  98. package/dist/framework/program.d.ts +47 -0
  99. package/dist/framework/program.d.ts.map +1 -0
  100. package/dist/framework/program.js +189 -0
  101. package/dist/framework/program.js.map +1 -0
  102. package/dist/index.d.ts +7 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +7 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/migrations/README.md +7 -0
  107. package/dist/migrations/build/0001_catalog.sql +85 -0
  108. package/dist/migrations/build/0002_tables.sql +43 -0
  109. package/dist/migrations/build/0003_table-cell-range.sql +13 -0
  110. package/dist/migrations/build/0004_chunk-page.sql +11 -0
  111. package/dist/migrations/state/0001_state.sql +40 -0
  112. package/dist/public-entry.js +38563 -0
  113. package/dist/public-entry.js.map +7 -0
  114. package/dist/public-index.js +36428 -0
  115. package/dist/public-index.js.map +7 -0
  116. package/dist/services/build.d.ts +48 -0
  117. package/dist/services/build.d.ts.map +1 -0
  118. package/dist/services/build.js +499 -0
  119. package/dist/services/build.js.map +1 -0
  120. package/dist/services/builds.d.ts +40 -0
  121. package/dist/services/builds.d.ts.map +1 -0
  122. package/dist/services/builds.js +184 -0
  123. package/dist/services/builds.js.map +1 -0
  124. package/dist/services/cancellation.d.ts +27 -0
  125. package/dist/services/cancellation.d.ts.map +1 -0
  126. package/dist/services/cancellation.js +41 -0
  127. package/dist/services/cancellation.js.map +1 -0
  128. package/dist/services/cloudflare-target.d.ts +38 -0
  129. package/dist/services/cloudflare-target.d.ts.map +1 -0
  130. package/dist/services/cloudflare-target.js +471 -0
  131. package/dist/services/cloudflare-target.js.map +1 -0
  132. package/dist/services/comparer.d.ts +15 -0
  133. package/dist/services/comparer.d.ts.map +1 -0
  134. package/dist/services/comparer.js +43 -0
  135. package/dist/services/comparer.js.map +1 -0
  136. package/dist/services/config-resolve.d.ts +60 -0
  137. package/dist/services/config-resolve.d.ts.map +1 -0
  138. package/dist/services/config-resolve.js +178 -0
  139. package/dist/services/config-resolve.js.map +1 -0
  140. package/dist/services/deploy.d.ts +70 -0
  141. package/dist/services/deploy.d.ts.map +1 -0
  142. package/dist/services/deploy.js +260 -0
  143. package/dist/services/deploy.js.map +1 -0
  144. package/dist/services/dev-session.d.ts +52 -0
  145. package/dist/services/dev-session.d.ts.map +1 -0
  146. package/dist/services/dev-session.js +102 -0
  147. package/dist/services/dev-session.js.map +1 -0
  148. package/dist/services/doctor.d.ts +35 -0
  149. package/dist/services/doctor.d.ts.map +1 -0
  150. package/dist/services/doctor.js +389 -0
  151. package/dist/services/doctor.js.map +1 -0
  152. package/dist/services/export.d.ts +20 -0
  153. package/dist/services/export.d.ts.map +1 -0
  154. package/dist/services/export.js +129 -0
  155. package/dist/services/export.js.map +1 -0
  156. package/dist/services/init.d.ts +46 -0
  157. package/dist/services/init.d.ts.map +1 -0
  158. package/dist/services/init.js +231 -0
  159. package/dist/services/init.js.map +1 -0
  160. package/dist/services/packing.d.ts +25 -0
  161. package/dist/services/packing.d.ts.map +1 -0
  162. package/dist/services/packing.js +69 -0
  163. package/dist/services/packing.js.map +1 -0
  164. package/dist/services/parse-cache.d.ts +47 -0
  165. package/dist/services/parse-cache.d.ts.map +1 -0
  166. package/dist/services/parse-cache.js +65 -0
  167. package/dist/services/parse-cache.js.map +1 -0
  168. package/dist/services/project.d.ts +49 -0
  169. package/dist/services/project.d.ts.map +1 -0
  170. package/dist/services/project.js +119 -0
  171. package/dist/services/project.js.map +1 -0
  172. package/dist/services/remote-prune.d.ts +7 -0
  173. package/dist/services/remote-prune.d.ts.map +1 -0
  174. package/dist/services/remote-prune.js +34 -0
  175. package/dist/services/remote-prune.js.map +1 -0
  176. package/dist/services/retention.d.ts +20 -0
  177. package/dist/services/retention.d.ts.map +1 -0
  178. package/dist/services/retention.js +106 -0
  179. package/dist/services/retention.js.map +1 -0
  180. package/dist/services/revalidate.d.ts +36 -0
  181. package/dist/services/revalidate.d.ts.map +1 -0
  182. package/dist/services/revalidate.js +73 -0
  183. package/dist/services/revalidate.js.map +1 -0
  184. package/dist/services/search.d.ts +25 -0
  185. package/dist/services/search.d.ts.map +1 -0
  186. package/dist/services/search.js +88 -0
  187. package/dist/services/search.js.map +1 -0
  188. package/dist/services/serving.d.ts +70 -0
  189. package/dist/services/serving.d.ts.map +1 -0
  190. package/dist/services/serving.js +240 -0
  191. package/dist/services/serving.js.map +1 -0
  192. package/dist/services/status.d.ts +54 -0
  193. package/dist/services/status.d.ts.map +1 -0
  194. package/dist/services/status.js +203 -0
  195. package/dist/services/status.js.map +1 -0
  196. package/dist/services/studio-assets.d.ts +13 -0
  197. package/dist/services/studio-assets.d.ts.map +1 -0
  198. package/dist/services/studio-assets.js +94 -0
  199. package/dist/services/studio-assets.js.map +1 -0
  200. package/dist/services/studio-diagnostics.d.ts +28 -0
  201. package/dist/services/studio-diagnostics.d.ts.map +1 -0
  202. package/dist/services/studio-diagnostics.js +88 -0
  203. package/dist/services/studio-diagnostics.js.map +1 -0
  204. package/dist/services/studio-endpoints.d.ts +61 -0
  205. package/dist/services/studio-endpoints.d.ts.map +1 -0
  206. package/dist/services/studio-endpoints.js +88 -0
  207. package/dist/services/studio-endpoints.js.map +1 -0
  208. package/dist/services/studio-mutations.d.ts +32 -0
  209. package/dist/services/studio-mutations.d.ts.map +1 -0
  210. package/dist/services/studio-mutations.js +149 -0
  211. package/dist/services/studio-mutations.js.map +1 -0
  212. package/dist/services/versions.d.ts +38 -0
  213. package/dist/services/versions.d.ts.map +1 -0
  214. package/dist/services/versions.js +46 -0
  215. package/dist/services/versions.js.map +1 -0
  216. package/dist/services/watch.d.ts +103 -0
  217. package/dist/services/watch.d.ts.map +1 -0
  218. package/dist/services/watch.js +420 -0
  219. package/dist/services/watch.js.map +1 -0
  220. package/package.json +73 -4
  221. package/studio-dist/assets/ibm-plex-mono-latin-400-normal-Dm_PoFIZ.woff2 +0 -0
  222. package/studio-dist/assets/ibm-plex-mono-latin-500-normal-C_OblDzq.woff2 +0 -0
  223. package/studio-dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  224. package/studio-dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
  225. package/studio-dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  226. package/studio-dist/assets/index-BuAYbQVX.js +66 -0
  227. package/studio-dist/assets/index-C_3XEUt4.css +1 -0
  228. package/studio-dist/index.html +30 -0
  229. package/README.md +0 -3
@@ -0,0 +1,219 @@
1
+ import { createLocalRuntimeBackend } from '@lorepack/backend-local';
2
+ import { count, LoreError, loadConfig, ProgressBus, ProgressRenderer, } from '@lorepack/core';
3
+ import { createMcpServer } from '@lorepack/mcp';
4
+ import { createRuntime } from '@lorepack/runtime';
5
+ import { serveStdio } from '@modelcontextprotocol/server/stdio';
6
+ import { runBuild } from '../services/build.js';
7
+ import { createLocalComparer } from '../services/comparer.js';
8
+ import { createRevalidator, DEFAULT_REVALIDATE_INTERVAL_MS } from '../services/revalidate.js';
9
+ import { readFreshness, readStatus } from '../services/status.js';
10
+ /**
11
+ * `lorepack mcp`: the stdio server a coding agent launches.
12
+ *
13
+ * The startup sequence is architecture 14.3, and its order is the whole point. Freshness is
14
+ * reconciled **before the first protocol byte**, so a client that launched against a dirty
15
+ * project never sees stale context and never has to ask. Once the protocol starts, stdout
16
+ * belongs to it: every diagnostic goes to stderr, and a stray `console.log` here would
17
+ * corrupt a frame and give the client a parse error with no explanation.
18
+ */
19
+ export function mcpCommand() {
20
+ return {
21
+ name: 'mcp',
22
+ description: 'Serve the active build to an AI client over MCP on stdio.',
23
+ flags: [
24
+ {
25
+ flags: '--ensure-current',
26
+ description: 'rebuild first when the sources have changed (the default)',
27
+ },
28
+ { flags: '--allow-stale', description: 'serve the existing build even when sources changed' },
29
+ { flags: '--active-only', description: 'skip source checks entirely, for pinned or CI use' },
30
+ { flags: '--project <path>', description: 'the project to serve' },
31
+ {
32
+ flags: '--revalidate-interval <ms>',
33
+ description: 'how often to recheck the sources while serving (default 5000, 0 every request, off never)',
34
+ },
35
+ ],
36
+ handler: async (_args, flags, context) => {
37
+ const cwd = typeof flags.project === 'string' ? flags.project : context.options.cwd;
38
+ const config = loadConfig({ cwd });
39
+ const mode = resolveMode(flags);
40
+ const sourceState = await reconcile({ config, mode, warn: context.warn });
41
+ // Freshness while serving, not only at startup. An open connection is not a session
42
+ // (2026-07-28), so a process can run for an hour and would otherwise report the state
43
+ // it saw in its first second for all of it (#112).
44
+ const revalidator = createRevalidator({
45
+ config,
46
+ intervalMs: parseInterval(flags.revalidateInterval),
47
+ frozen: mode !== 'ensure-current',
48
+ });
49
+ const backend = createLocalRuntimeBackend({
50
+ projectRoot: config.projectRoot,
51
+ freshness: mode === 'ensure-current' ? () => revalidator.freshness() : async () => sourceState,
52
+ });
53
+ if ((await backend.provider.current()) === null) {
54
+ backend.close();
55
+ throw new LoreError('LORE_E_BUILD_NOT_FOUND', 'This project has no build to serve.', {
56
+ remediation: 'Run `lorepack build` first, or start the server with --ensure-current.',
57
+ });
58
+ }
59
+ // A factory, not a single server, because the opening message decides the protocol
60
+ // era and `serveStdio` pins one instance from this factory for the connection.
61
+ //
62
+ // Hand-wiring a `StdioServerTransport` instead, which is the shape most examples
63
+ // show, skips that decision entirely: the connection stays in the 2025 era, and
64
+ // `server/discover` (a MUST in 2026-07-28) is answered with `Method not found` even
65
+ // though the handler is registered. That is #189, and it was invisible because the
66
+ // HTTP surface reaches the same decision through `createMcpHandler`.
67
+ const runtime = createRuntime(backend);
68
+ const comparer = createLocalComparer(config.projectRoot);
69
+ const factory = () => createMcpServer({ runtime, comparer });
70
+ // The lock and the databases have to be released however the process ends, including
71
+ // on a signal. A client that kills the server should not leave a project locked.
72
+ //
73
+ // Idempotent, because every one of these paths can fire: a clean shutdown closes
74
+ // explicitly and `exit` fires afterwards. A second close used to reach a closed
75
+ // database and end the process with a stack trace, on the way out of a session that
76
+ // had worked perfectly.
77
+ let closed = false;
78
+ const close = () => {
79
+ if (closed)
80
+ return;
81
+ closed = true;
82
+ backend.close();
83
+ };
84
+ process.once('SIGINT', close);
85
+ process.once('SIGTERM', close);
86
+ process.once('exit', close);
87
+ context.warn(`Serving ${config.config.name} over MCP on stdio. Sources are ${sourceState}.\n`);
88
+ const handle = serveStdio(factory, {
89
+ onerror: (error) => context.warn(`${error.message}\n`),
90
+ });
91
+ // Resolves when the client goes away.
92
+ //
93
+ // Standard input ending is the ordinary route: a client exits, or the pipe closes.
94
+ // It has to be handled explicitly, because without it the await never settles, Node
95
+ // notices an empty event loop with a pending top-level await, and prints a warning
96
+ // into the agent's log that looks like a defect in Lorepack (#183).
97
+ //
98
+ // `serveStdio` owns the transport and overwrites its `onclose`, so this is the one
99
+ // observation point left, which is fine: it is the route a real client takes.
100
+ await new Promise((resolve) => {
101
+ let done = false;
102
+ const finish = () => {
103
+ if (done)
104
+ return;
105
+ done = true;
106
+ resolve();
107
+ };
108
+ process.stdin.once('end', finish);
109
+ process.stdin.once('close', finish);
110
+ });
111
+ await handle.close();
112
+ close();
113
+ // Nothing structured on stdout: it carried protocol, and it is now finished.
114
+ return { human: '', json: undefined };
115
+ },
116
+ };
117
+ }
118
+ /**
119
+ * How often to recheck while serving. `off` is the startup-only behaviour, kept because a
120
+ * pinned deployment may want it, and named rather than implied.
121
+ */
122
+ function parseInterval(raw) {
123
+ if (raw === undefined)
124
+ return DEFAULT_REVALIDATE_INTERVAL_MS;
125
+ if (raw === 'off')
126
+ return Number.POSITIVE_INFINITY;
127
+ // `Number('')` is 0, which here means "recheck every request", the most expensive setting
128
+ // there is. An unset shell variable must not be able to select it (#195).
129
+ const blank = typeof raw === 'string' && raw.trim() === '';
130
+ const value = blank ? Number.NaN : Number(raw);
131
+ if (!Number.isFinite(value) || value < 0) {
132
+ throw new LoreError('LORE_E_INVALID_ARGUMENT', `--revalidate-interval must be milliseconds, 0, or off, got ${raw}.`, { remediation: 'Pass a number of milliseconds, 0 to check every request, or off.' });
133
+ }
134
+ return value;
135
+ }
136
+ function resolveMode(flags) {
137
+ const stale = flags.allowStale === true;
138
+ const activeOnly = flags.activeOnly === true;
139
+ if (stale && activeOnly) {
140
+ throw new LoreError('LORE_E_INVALID_ARGUMENT', '--allow-stale and --active-only cannot both be given.', { remediation: 'Pick one: --allow-stale serves a dirty project, --active-only ignores it.' });
141
+ }
142
+ if (activeOnly)
143
+ return 'active-only';
144
+ if (stale)
145
+ return 'allow-stale';
146
+ return 'ensure-current';
147
+ }
148
+ /**
149
+ * Reconciles the build with the sources, before any protocol output.
150
+ *
151
+ * The three modes are three different promises to the client:
152
+ *
153
+ * - `ensure-current` (the default) rebuilds a dirty project, so the first tool call reads
154
+ * what is on disk now. A failed rebuild exits without serving: stale context delivered
155
+ * confidently is worse than no context.
156
+ * - `allow-stale` serves what exists and labels every result `dirty`, which is honest and
157
+ * is what a user asking for it wants.
158
+ * - `active-only` does not look at the sources at all, for a pinned build in CI or a
159
+ * forensic read of an old one.
160
+ */
161
+ async function reconcile(options) {
162
+ if (options.mode === 'active-only')
163
+ return 'unknown';
164
+ const started = Date.now();
165
+ const status = await readStatus({ config: options.config, allowLargeProject: true }).catch(() => null);
166
+ // No build at all is a different situation from a stale one, and only one of the three
167
+ // modes can do anything about it. `--ensure-current` means exactly this: make the served
168
+ // build match the sources, and there being none yet is the strongest form of not
169
+ // matching. The other two modes have nothing to serve and say so.
170
+ if (status?.sourceState === 'unbuilt') {
171
+ if (options.mode !== 'ensure-current') {
172
+ throw new LoreError('LORE_E_BUILD_NOT_FOUND', 'This project has no build to serve.', {
173
+ remediation: 'Run `lorepack build`, or start the server with --ensure-current.',
174
+ });
175
+ }
176
+ options.warn('No build yet. Building before serving.\n');
177
+ await rebuild(options);
178
+ return 'clean';
179
+ }
180
+ const freshness = await readFreshness({ config: options.config });
181
+ const elapsed = Date.now() - started;
182
+ if (elapsed > 250) {
183
+ // Architecture 4.10: a check a person can notice has to say what it is doing, and the
184
+ // only place it may say anything is stderr.
185
+ options.warn(`Checked sources in ${elapsed} ms.\n`);
186
+ }
187
+ if (freshness.sourceState !== 'dirty')
188
+ return freshness.sourceState;
189
+ if (options.mode === 'allow-stale') {
190
+ options.warn('Sources have changed since this build. Serving it anyway: every result is labelled dirty.\n');
191
+ return 'dirty';
192
+ }
193
+ options.warn(`Sources have changed: ${count((status?.artifacts.changed ?? 0) + (status?.artifacts.added ?? 0), 'source')}. Rebuilding before serving.\n`);
194
+ await rebuild(options);
195
+ return 'clean';
196
+ }
197
+ /**
198
+ * Builds, with progress on stderr and nothing at all on stdout.
199
+ *
200
+ * stdout is about to carry protocol frames, and a progress line in the middle of one is a
201
+ * parse error the client cannot explain to anyone (architecture 14.3).
202
+ */
203
+ async function rebuild(options) {
204
+ const progress = new ProgressBus();
205
+ const renderer = new ProgressRenderer({ write: options.warn, isTty: false });
206
+ progress.subscribe((event) => renderer.handle(event));
207
+ try {
208
+ await runBuild({ config: options.config, progress, allowLargeProject: true });
209
+ }
210
+ catch (cause) {
211
+ // A failed build leaves the previous pointer where it was and serves nothing. Stale
212
+ // context delivered confidently is worse than an error a person can act on (6.9).
213
+ throw new LoreError('LORE_E_STALE_SOURCES', 'The project could not be built, so nothing was served.', {
214
+ remediation: 'Run `lorepack build` to see the failure, or start with --allow-stale to serve the existing build.',
215
+ cause,
216
+ });
217
+ }
218
+ }
219
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"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, inspectable ZIP.
4
+ *
5
+ * Nothing about it is clever, and that is the feature. Section 22.3 promises no lock-in,
6
+ * which only means something if a plain `unzip` can open the file without Lorepack.
7
+ */
8
+ export declare function packCommand(): CommandDefinition;
9
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAGhF;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAyB/C"}
@@ -0,0 +1,57 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { verifyArchive } from '@lorepack/backend-local';
4
+ import { count, LoreError, loadConfig } from '@lorepack/core';
5
+ import { packBuild } from '../services/packing.js';
6
+ /**
7
+ * `lorepack pack` writes a `.lorepack` archive: a standard, inspectable ZIP.
8
+ *
9
+ * Nothing about it is clever, and that is the feature. Section 22.3 promises no lock-in,
10
+ * which only means something if a plain `unzip` can open the file without Lorepack.
11
+ */
12
+ export function packCommand() {
13
+ return {
14
+ name: 'pack',
15
+ description: 'Write a portable .lorepack archive of a build.',
16
+ arguments: [{ name: 'build', description: 'build id or prefix', required: false }],
17
+ flags: [
18
+ { flags: '--verify <file>', description: 'check an existing archive instead of writing one' },
19
+ { flags: '--out <file>', description: 'archive path to write' },
20
+ ],
21
+ handler: async (args, flags, context) => {
22
+ if (typeof flags.verify === 'string')
23
+ return verify(flags.verify, context.options.cwd);
24
+ const config = loadConfig({ cwd: context.options.cwd });
25
+ const result = await packBuild(config, {
26
+ build: args[0],
27
+ out: typeof flags.out === 'string' ? flags.out : undefined,
28
+ relativeTo: context.options.cwd,
29
+ });
30
+ return {
31
+ human: `Wrote ${result.archive}\n ${count(result.members, 'member')}, including the checksum index.`,
32
+ json: { ...result },
33
+ };
34
+ },
35
+ };
36
+ }
37
+ async function verify(file, cwd) {
38
+ const path = resolve(cwd, file);
39
+ if (!existsSync(path)) {
40
+ throw new LoreError('LORE_E_INVALID_ARGUMENT', `${file} does not exist.`, {
41
+ remediation: 'Pass the path to a .lorepack archive.',
42
+ });
43
+ }
44
+ const result = await verifyArchive(path);
45
+ if (result.ok) {
46
+ return {
47
+ human: `${path} is intact. ${count(result.memberCount, 'member')} verified.`,
48
+ json: { archive: path, ...result },
49
+ };
50
+ }
51
+ const first = result.failures[0];
52
+ throw new LoreError('LORE_E_OBJECT_CORRUPT', `${path} failed verification: ${first?.member} is ${first?.reason}.`, {
53
+ remediation: 'Download or pack the archive again. Its contents cannot be trusted.',
54
+ details: { failures: result.failures },
55
+ });
56
+ }
57
+ //# sourceMappingURL=pack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gDAAgD;QAC7D,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAClF,KAAK,EAAE;YACL,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kDAAkD,EAAE;YAC7F,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,uBAAuB,EAAE;SAChE;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE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,QAAQ,CAAC,YAAY;YAC5E,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE;SACnC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,IAAI,SAAS,CACjB,uBAAuB,EACvB,GAAG,IAAI,yBAAyB,KAAK,EAAE,MAAM,OAAO,KAAK,EAAE,MAAM,GAAG,EACpE;QACE,WAAW,EAAE,qEAAqE;QAClF,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;KACvC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CommandDefinition } from '../framework/program.js';
2
+ export declare function planCommand(): CommandDefinition;
3
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAIhF,wBAAgB,WAAW,IAAI,iBAAiB,CA2C/C"}
@@ -0,0 +1,44 @@
1
+ import { createPlan, readLockfile, renderPlan } from '@lorepack/compiler';
2
+ import { loadConfig } from '@lorepack/core';
3
+ import { readPreviousBuild } from '../services/project.js';
4
+ import { lockInputs } from '../services/versions.js';
5
+ export function planCommand() {
6
+ return {
7
+ name: 'plan',
8
+ description: 'Preview what a build would change. Makes no changes itself.',
9
+ flags: [
10
+ { flags: '--allow-large-project', description: 'continue past the supported file count' },
11
+ { flags: '--exit-code', description: 'exit 2 when there are changes, for CI gating' },
12
+ ],
13
+ handler: async (_args, flags, context) => {
14
+ const config = loadConfig({ cwd: context.options.cwd });
15
+ const { state, previous } = readPreviousBuild(config);
16
+ try {
17
+ const { plan } = await createPlan({
18
+ config,
19
+ previous,
20
+ previousLock: readLockfile(config.projectRoot),
21
+ lockInputs: lockInputs(),
22
+ progress: context.progress,
23
+ allowLargeProject: flags.allowLargeProject === true,
24
+ });
25
+ const hasChanges = plan.artifacts.added + plan.artifacts.changed + plan.artifacts.removed > 0 ||
26
+ plan.lock.changed ||
27
+ plan.rules.length > 0 ||
28
+ plan.tables.length > 0 ||
29
+ plan.warnings.some((warning) => ['configuration-change-unknown', 'table-change-unknown'].includes(warning.code));
30
+ return {
31
+ human: renderPlan(plan),
32
+ json: plan,
33
+ // Exit 0 by default whether or not there are changes: a plan reporting work is
34
+ // a normal outcome, not a failure. CI opts into the gate explicitly.
35
+ ...(flags.exitCode === true && hasChanges ? { exitCode: 2 } : {}),
36
+ };
37
+ }
38
+ finally {
39
+ state?.close();
40
+ }
41
+ },
42
+ };
43
+ }
44
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,UAAU,WAAW;IACzB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,6DAA6D;QAC1E,KAAK,EAAE;YACL,EAAE,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,wCAAwC,EAAE;YACzF,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,8CAA8C,EAAE;SACtF;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAA0B,EAAE;YAC/D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACxD,MAAM,EAAE,KA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2
+ import { type CloudflareResolverAdapter } from '../services/cloudflare-target.js';
3
+ export interface PruneCommandOptions {
4
+ readonly cloudflareAdapter?: CloudflareResolverAdapter;
5
+ }
6
+ export declare function pruneCommand(options?: PruneCommandOptions): CommandDefinition;
7
+ //# sourceMappingURL=prune.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../src/commands/prune.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,kCAAkC,CAAC;AAc1C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;CACxD;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,iBAAiB,CAoFjF"}