@bitcobblers/wod-wiki-tools 0.36.2136 → 0.37.2139

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 (60) hide show
  1. package/dist/bin/wod.cjs +522 -246
  2. package/dist/bin/wod.cjs.map +1 -1
  3. package/dist/bin/wod.mjs +4 -3
  4. package/dist/bin/wod.mjs.map +1 -1
  5. package/dist/{chunk-FZKXOYMJ.mjs → chunk-CVFMFD7D.mjs} +153 -188
  6. package/dist/chunk-CVFMFD7D.mjs.map +1 -0
  7. package/dist/{chunk-6QNX4FED.mjs → chunk-HRFOKCYI.mjs} +139 -47
  8. package/dist/chunk-HRFOKCYI.mjs.map +1 -0
  9. package/dist/{chunk-CYKNTEGY.mjs → chunk-IWT7U3WX.mjs} +8 -3
  10. package/dist/chunk-IWT7U3WX.mjs.map +1 -0
  11. package/dist/chunk-JUBKCRNV.mjs +12 -0
  12. package/dist/chunk-JUBKCRNV.mjs.map +1 -0
  13. package/dist/{chunk-MA6BBTWC.mjs → chunk-RWNL6APX.mjs} +3 -3
  14. package/dist/{chunk-MA6BBTWC.mjs.map → chunk-RWNL6APX.mjs.map} +1 -1
  15. package/dist/compiler-OXEXGIZG.mjs +9 -0
  16. package/dist/{compiler-CTPLIZJK.mjs.map → compiler-OXEXGIZG.mjs.map} +1 -1
  17. package/dist/index.cjs +522 -246
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.mjs +5 -4
  22. package/dist/scaffoldCatalog-OIU4FEKJ.mjs +205 -0
  23. package/dist/scaffoldCatalog-OIU4FEKJ.mjs.map +1 -0
  24. package/dist/{server-JXECWS4A.mjs → server-2DVBA35J.mjs} +4 -4
  25. package/dist/{server-JXECWS4A.mjs.map → server-2DVBA35J.mjs.map} +1 -1
  26. package/dist/web/playground/assets/main-2qCz3_0z.js +194 -0
  27. package/dist/web/playground/assets/main-BUcjhK2w.css +2 -0
  28. package/dist/web/playground/assets/{statementBuilderFlow-ugwi0fu0.js → statementBuilderFlow-DKhL-YLz.js} +2 -2
  29. package/dist/web/playground/assets/{vendor-g-NJOjvC.js → vendor-DaJxNU_W.js} +3 -3
  30. package/dist/web/playground/assets/{vendor-codemirror-C41SFn-r.js → vendor-codemirror-BtDM22HA.js} +2 -2
  31. package/dist/web/playground/index.html +4 -4
  32. package/dist/web/playground/seed/core/chunks/canvas.a45c409e.json +1 -0
  33. package/dist/web/playground/seed/core/chunks/efforts.e68f2093.json +1 -0
  34. package/dist/web/playground/seed/core/chunks/equipment.c4fb1d64.json +1 -0
  35. package/dist/web/playground/seed/core/chunks/{template.e5e0e82d.json → template.0120276c.json} +1 -1
  36. package/dist/web/playground/seed/core/manifest.json +27 -10
  37. package/dist/web/playground/seed/core/report.html +15 -13
  38. package/dist/web/server/assets/main-BUcjhK2w.css +2 -0
  39. package/dist/web/server/assets/main-DxsZ-yOz.js +193 -0
  40. package/dist/web/server/assets/{statementBuilderFlow-40WaYjdq.js → statementBuilderFlow-CI5vrd60.js} +2 -2
  41. package/dist/web/server/assets/{vendor-g-NJOjvC.js → vendor-DaJxNU_W.js} +3 -3
  42. package/dist/web/server/assets/{vendor-codemirror-C41SFn-r.js → vendor-codemirror-BtDM22HA.js} +2 -2
  43. package/dist/web/server/index.html +4 -4
  44. package/dist/web/server/seed/core/chunks/canvas.a45c409e.json +1 -0
  45. package/dist/web/server/seed/core/chunks/efforts.e68f2093.json +1 -0
  46. package/dist/web/server/seed/core/chunks/equipment.c4fb1d64.json +1 -0
  47. package/dist/web/server/seed/core/chunks/{template.e5e0e82d.json → template.0120276c.json} +1 -1
  48. package/dist/web/server/seed/core/manifest.json +27 -10
  49. package/dist/web/server/seed/core/report.html +15 -13
  50. package/package.json +6 -6
  51. package/dist/chunk-6QNX4FED.mjs.map +0 -1
  52. package/dist/chunk-CYKNTEGY.mjs.map +0 -1
  53. package/dist/chunk-FZKXOYMJ.mjs.map +0 -1
  54. package/dist/compiler-CTPLIZJK.mjs +0 -9
  55. package/dist/web/playground/assets/main-B-bffxwE.css +0 -2
  56. package/dist/web/playground/assets/main-iLSeEl2E.js +0 -188
  57. package/dist/web/playground/seed/core/chunks/canvas.20048125.json +0 -1
  58. package/dist/web/server/assets/main-B-bffxwE.css +0 -2
  59. package/dist/web/server/assets/main-CRyLxlPN.js +0 -187
  60. package/dist/web/server/seed/core/chunks/canvas.20048125.json +0 -1
package/dist/index.d.cts CHANGED
@@ -144,7 +144,7 @@ declare function formatQueryOutput(ir: WodWikiIRFile<QueryResult | RowsQueryResu
144
144
  */
145
145
 
146
146
  interface CliParsedArgs {
147
- subcommand?: 'parse' | 'run' | 'query' | 'download' | 'export' | 'import' | 'publish' | 'build' | 'seed' | 'reset' | 'init' | 'server' | 'serve' | 'playground' | 'help' | 'version';
147
+ subcommand?: 'parse' | 'run' | 'query' | 'download' | 'export' | 'import' | 'publish' | 'build' | 'seed' | 'reset' | 'init' | 'server' | 'serve' | 'playground' | 'init-catalog' | 'help' | 'version';
148
148
  target?: string;
149
149
  /** Second positional: the id (download) or file (import) after the kind. */
150
150
  target2?: string;
package/dist/index.d.ts CHANGED
@@ -144,7 +144,7 @@ declare function formatQueryOutput(ir: WodWikiIRFile<QueryResult | RowsQueryResu
144
144
  */
145
145
 
146
146
  interface CliParsedArgs {
147
- subcommand?: 'parse' | 'run' | 'query' | 'download' | 'export' | 'import' | 'publish' | 'build' | 'seed' | 'reset' | 'init' | 'server' | 'serve' | 'playground' | 'help' | 'version';
147
+ subcommand?: 'parse' | 'run' | 'query' | 'download' | 'export' | 'import' | 'publish' | 'build' | 'seed' | 'reset' | 'init' | 'server' | 'serve' | 'playground' | 'init-catalog' | 'help' | 'version';
148
148
  target?: string;
149
149
  /** Second positional: the id (download) or file (import) after the kind. */
150
150
  target2?: string;
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { createRequire } from 'module';
2
- export { PackLoadError, ParseSyntaxError, WqlSyntaxError, cliMain, formatExecutionOutput, formatParseOutput, formatQueryOutput, loadCliEnvironment, loadLanguagePack, loadQueryData, parseCliArgs, readStdin, resolveDatabaseConfig, runExecution, runParse, runQueryCli } from './chunk-6QNX4FED.mjs';
3
- import './chunk-FZKXOYMJ.mjs';
4
- export { runCliServer } from './chunk-MA6BBTWC.mjs';
5
- export { openCliDb } from './chunk-CYKNTEGY.mjs';
2
+ export { PackLoadError, ParseSyntaxError, WqlSyntaxError, cliMain, formatExecutionOutput, formatParseOutput, formatQueryOutput, loadCliEnvironment, loadLanguagePack, loadQueryData, parseCliArgs, readStdin, resolveDatabaseConfig, runExecution, runParse, runQueryCli } from './chunk-HRFOKCYI.mjs';
3
+ import './chunk-CVFMFD7D.mjs';
4
+ import './chunk-JUBKCRNV.mjs';
5
+ export { runCliServer } from './chunk-RWNL6APX.mjs';
6
+ export { openCliDb } from './chunk-IWT7U3WX.mjs';
6
7
  import './chunk-V23POHG2.mjs';
7
8
  import './chunk-6L5ZDZJ7.mjs';
8
9
 
@@ -0,0 +1,205 @@
1
+ import { createRequire } from 'module';
2
+ import { VERSION } from './chunk-JUBKCRNV.mjs';
3
+ import './chunk-6L5ZDZJ7.mjs';
4
+ import { mkdirSync, writeFileSync, rmSync } from 'fs';
5
+ import { resolve, join, dirname } from 'path';
6
+
7
+ if (typeof globalThis.require === 'undefined') {
8
+ try { globalThis.require = createRequire(import.meta.url); } catch {}
9
+ }
10
+ function validateCatalogName(name) {
11
+ if (name.length === 0 || name === "." || name === "..") {
12
+ throw new Error("Catalog name must be a single non-empty directory name");
13
+ }
14
+ if (name.includes("/") || name.includes("\\") || name.includes("\0")) {
15
+ throw new Error(`Invalid catalog name '${name}': must be a single directory name (no path separators or traversal)`);
16
+ }
17
+ if (/^(?:[A-Za-z]:)?[/\\]/.test(name)) {
18
+ throw new Error(`Invalid catalog name '${name}': absolute paths are not allowed`);
19
+ }
20
+ if (name.length > 214 || !/^[a-z0-9][a-z0-9._-]*$/.test(name)) {
21
+ throw new Error(
22
+ `Invalid catalog name '${name}': must be a valid npm package name (lowercase letters, digits, dots, hyphens, underscores; no leading dot/hyphen)`
23
+ );
24
+ }
25
+ return name;
26
+ }
27
+ var publishWorkflow = () => `name: Publish catalog
28
+
29
+ # Compile the catalog with the wod CLI and deploy dist/ to GitHub Pages.
30
+ # Requires Pages enabled: repo Settings \u2192 Pages \u2192 Source: "GitHub Actions".
31
+
32
+ on:
33
+ push:
34
+ branches: [main]
35
+ workflow_dispatch:
36
+
37
+ permissions:
38
+ contents: read
39
+ pages: write
40
+ id-token: write
41
+
42
+ concurrency:
43
+ group: pages
44
+ cancel-in-progress: true
45
+
46
+ jobs:
47
+ publish:
48
+ runs-on: ubuntu-latest
49
+ environment:
50
+ name: github-pages
51
+ url: \${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+ with:
55
+ # Full history: seed manifest version stamps derive from git commit count.
56
+ fetch-depth: 0
57
+
58
+ - name: Set up Bun
59
+ uses: oven-sh/setup-bun@v2
60
+ with:
61
+ bun-version: 1.4.x
62
+
63
+ - name: Install dependencies
64
+ run: bun install
65
+
66
+ - name: Build seed
67
+ run: bunx wod build . --output dist
68
+
69
+ - uses: actions/configure-pages@v5
70
+
71
+ - name: Upload dist
72
+ uses: actions/upload-pages-artifact@v3
73
+ with:
74
+ path: dist
75
+
76
+ - id: deployment
77
+ uses: actions/deploy-pages@v4
78
+ `;
79
+ var collectionReadme = (name) => `# ${name}
80
+
81
+ Example benchmark collection. Each \`.md\` file in this directory becomes part of
82
+ the \`example\` collection chunk; \`README.md\` is the collection's landing page.
83
+
84
+ Add one file per workout:
85
+
86
+ \`\`\`\`markdown
87
+ ---
88
+ title: My workout
89
+ date: 2026-01-01
90
+ ---
91
+
92
+ # My workout
93
+
94
+ \`\`\`time
95
+ (21-15-9)
96
+ Thrusters @95lb
97
+ Pull-ups
98
+ \`\`\`
99
+ \`\`\`\`
100
+
101
+ The \`date:\` frontmatter field sets the workout's chronological placement
102
+ (regardless of filename or directory).
103
+ `;
104
+ var exampleWorkout = (date) => `---
105
+ title: Morning session
106
+ date: ${date}
107
+ ---
108
+
109
+ # Morning session
110
+
111
+ \`\`\`time
112
+ (21-15-9)
113
+ Thrusters @95lb
114
+ Pull-ups
115
+ \`\`\`
116
+ `;
117
+ var catalogReadme = (name) => `# ${name}
118
+
119
+ A [WOD Wiki](https://github.com/bitcobblers/wod-wiki) workout catalog: plain
120
+ Markdown workouts compiled to static, version-stamped seed chunks and published
121
+ via GitHub Pages.
122
+
123
+ ## Develop
124
+
125
+ \`\`\`sh
126
+ bun install
127
+ bunx wod build . --output dist
128
+ \`\`\`
129
+
130
+ Workouts live under \`markdown/\` \u2014 this scaffold starts with one example
131
+ collection. Validate everything with \`bunx wod build\`: it gates every file on
132
+ the Whiteboard grammar and corpus layout before writing \`dist/\`.
133
+
134
+ ## Publish
135
+
136
+ Push to GitHub and enable Pages (**Settings \u2192 Pages \u2192 Source: GitHub
137
+ Actions**). The bundled workflow (\`.github/workflows/publish-catalog.yml\`)
138
+ builds the catalog on every push to \`main\` and deploys \`dist/\`.
139
+
140
+ ## Share
141
+
142
+ Once published, anyone can subscribe to this catalog from a WOD Wiki instance
143
+ at:
144
+
145
+ \`\`\`
146
+ <app-url>/subscribe?source=<url-encoded published catalog URL>
147
+ \`\`\`
148
+
149
+ For \`owner\`/\`repo\` on GitHub Pages the catalog URL is the deployed
150
+ directory, \`https://owner.github.io/repo/\`, e.g.
151
+ \`/subscribe?source=https%3A%2F%2Fowner.github.io%2Frepo%2F\`.
152
+ `;
153
+ function scaffoldCatalog(name, opts = {}) {
154
+ validateCatalogName(name);
155
+ const dir = resolve(opts.cwd ?? process.cwd(), name);
156
+ try {
157
+ mkdirSync(dir);
158
+ } catch (error) {
159
+ if (error.code === "EEXIST") {
160
+ throw new Error(`Refusing to overwrite '${dir}': destination already exists`, { cause: error });
161
+ }
162
+ throw error;
163
+ }
164
+ const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
165
+ const files = [
166
+ ["package.json", `${JSON.stringify(
167
+ {
168
+ name,
169
+ version: "0.1.0",
170
+ private: true,
171
+ type: "module",
172
+ description: `WOD Wiki workout catalog: ${name}`,
173
+ scripts: {
174
+ build: "wod build . --output dist"
175
+ },
176
+ devDependencies: {
177
+ "@bitcobblers/wod-wiki-tools": `^${VERSION}`
178
+ }
179
+ },
180
+ null,
181
+ 2
182
+ )}
183
+ `],
184
+ [".gitignore", "node_modules/\ndist/\n"],
185
+ [".github/workflows/publish-catalog.yml", publishWorkflow()],
186
+ ["markdown/collections/example/README.md", collectionReadme(name)],
187
+ [`markdown/collections/example/morning-session.md`, exampleWorkout(date)],
188
+ ["README.md", catalogReadme(name)]
189
+ ];
190
+ try {
191
+ for (const [rel, content] of files) {
192
+ const target = join(dir, rel);
193
+ mkdirSync(dirname(target), { recursive: true });
194
+ writeFileSync(target, content, "utf-8");
195
+ }
196
+ } catch (error) {
197
+ rmSync(dir, { recursive: true, force: true });
198
+ throw error;
199
+ }
200
+ return { dir, files: files.map(([rel]) => rel) };
201
+ }
202
+
203
+ export { scaffoldCatalog, validateCatalogName };
204
+ //# sourceMappingURL=scaffoldCatalog-OIU4FEKJ.mjs.map
205
+ //# sourceMappingURL=scaffoldCatalog-OIU4FEKJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/scaffoldCatalog.ts"],"names":[],"mappings":";;;;;;;;;AAsBO,SAAS,oBAAoB,IAAA,EAAsB;AACxD,EAAA,IAAI,KAAK,MAAA,KAAW,CAAA,IAAK,IAAA,KAAS,GAAA,IAAO,SAAS,IAAA,EAAM;AACtD,IAAA,MAAM,IAAI,MAAM,wDAAwD,CAAA;AAAA,EAC1E;AACA,EAAA,IAAI,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,EAAG;AACpE,IAAA,MAAM,IA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A,EAA0C,gBAAA,CAAiB,IAAI,CAAC,CAAA;AAAA,IACjE,CAAC,CAAA,+CAAA,CAAA,EAAmD,cAAA,CAAe,IAAI,CAAC,CAAA;AAAA,IACxE,CAAC,WAAA,EAAa,aAAA,CAAc,IAAI,CAAC;AAAA,GACnC;AAEA,EAAA,IAAI;AACF,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,OAAO,CAAA,IAAK,KAAA,EAAO;AAClC,MAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,EAAK,GAAG,CAAA;AAC5B,MAAA,SAAA,CAAU,QAAQ,MAAM,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAC9C,MAAA,aAAA,CAAc,MAAA,EAAQ,SAAS,OAAO,CAAA;AAAA,IACxC;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,MAAA,CAAO,KAAK,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,MAAM,CAAA;AAC5C,IAAA,MAAM,KAAA;AAAA,EACR;AACA,EAAA,OAAO,EAAE,GAAA,EAAK,KAAA,EAAO,KAAA,CAAM,GAAA,CAAI,CAAC,CAAC,GAAG,CAAA,KAAM,GAAG,CAAA,EAAE;AACjD","file":"scaffoldCatalog-OIU4FEKJ.mjs","sourcesContent":["/**\n * `wod init-catalog <name>` — scaffold a ready-to-publish WOD Wiki catalog\n * repository skeleton (docs/catalogs-and-distributed-seed-model.html §repo-creation,\n * roadmap Phase 4): markdown collections example, package.json, GitHub Actions\n * Pages workflow, README. Creates a new directory only; refuses an existing\n * destination without touching it.\n *\n * Lazily imported by cli/runner.ts (dynamic import), so static node:fs/node:path\n * imports stay out of browser bundles.\n */\nimport { mkdirSync, rmSync, writeFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { VERSION } from '../version';\n\nexport interface ScaffoldCatalogResult {\n /** Absolute path of the created catalog root. */\n dir: string;\n /** Created files, POSIX-relative to the catalog root. */\n files: string[];\n}\n\n/** npm package name + single-directory-segment validation for `<name>`. */\nexport function validateCatalogName(name: string): string {\n if (name.length === 0 || name === '.' || name === '..') {\n throw new Error('Catalog name must be a single non-empty directory name');\n }\n if (name.includes('/') || name.includes('\\\\') || name.includes('\\0')) {\n throw new Error(`Invalid catalog name '${name}': must be a single directory name (no path separators or traversal)`);\n }\n if (/^(?:[A-Za-z]:)?[/\\\\]/.test(name)) {\n throw new Error(`Invalid catalog name '${name}': absolute paths are not allowed`);\n }\n if (name.length > 214 || !/^[a-z0-9][a-z0-9._-]*$/.test(name)) {\n throw new Error(\n `Invalid catalog name '${name}': must be a valid npm package name ` +\n '(lowercase letters, digits, dots, hyphens, underscores; no leading dot/hyphen)',\n );\n }\n return name;\n}\n\nconst publishWorkflow = (): string => `name: Publish catalog\n\n# Compile the catalog with the wod CLI and deploy dist/ to GitHub Pages.\n# Requires Pages enabled: repo Settings → Pages → Source: \"GitHub Actions\".\n\non:\n push:\n branches: [main]\n workflow_dispatch:\n\npermissions:\n contents: read\n pages: write\n id-token: write\n\nconcurrency:\n group: pages\n cancel-in-progress: true\n\njobs:\n publish:\n runs-on: ubuntu-latest\n environment:\n name: github-pages\n url: \\${{ steps.deployment.outputs.page_url }}\n steps:\n - uses: actions/checkout@v4\n with:\n # Full history: seed manifest version stamps derive from git commit count.\n fetch-depth: 0\n\n - name: Set up Bun\n uses: oven-sh/setup-bun@v2\n with:\n bun-version: 1.4.x\n\n - name: Install dependencies\n run: bun install\n\n - name: Build seed\n run: bunx wod build . --output dist\n\n - uses: actions/configure-pages@v5\n\n - name: Upload dist\n uses: actions/upload-pages-artifact@v3\n with:\n path: dist\n\n - id: deployment\n uses: actions/deploy-pages@v4\n`;\n\nconst collectionReadme = (name: string): string => `# ${name}\n\nExample benchmark collection. Each \\`.md\\` file in this directory becomes part of\nthe \\`example\\` collection chunk; \\`README.md\\` is the collection's landing page.\n\nAdd one file per workout:\n\n\\`\\`\\`\\`markdown\n---\ntitle: My workout\ndate: 2026-01-01\n---\n\n# My workout\n\n\\`\\`\\`time\n(21-15-9)\n Thrusters @95lb\n Pull-ups\n\\`\\`\\`\n\\`\\`\\`\\`\n\nThe \\`date:\\` frontmatter field sets the workout's chronological placement\n(regardless of filename or directory).\n`;\n\nconst exampleWorkout = (date: string): string => `---\ntitle: Morning session\ndate: ${date}\n---\n\n# Morning session\n\n\\`\\`\\`time\n(21-15-9)\n Thrusters @95lb\n Pull-ups\n\\`\\`\\`\n`;\n\nconst catalogReadme = (name: string): string => `# ${name}\n\nA [WOD Wiki](https://github.com/bitcobblers/wod-wiki) workout catalog: plain\nMarkdown workouts compiled to static, version-stamped seed chunks and published\nvia GitHub Pages.\n\n## Develop\n\n\\`\\`\\`sh\nbun install\nbunx wod build . --output dist\n\\`\\`\\`\n\nWorkouts live under \\`markdown/\\` — this scaffold starts with one example\ncollection. Validate everything with \\`bunx wod build\\`: it gates every file on\nthe Whiteboard grammar and corpus layout before writing \\`dist/\\`.\n\n## Publish\n\nPush to GitHub and enable Pages (**Settings → Pages → Source: GitHub\nActions**). The bundled workflow (\\`.github/workflows/publish-catalog.yml\\`)\nbuilds the catalog on every push to \\`main\\` and deploys \\`dist/\\`.\n\n## Share\n\nOnce published, anyone can subscribe to this catalog from a WOD Wiki instance\nat:\n\n\\`\\`\\`\n<app-url>/subscribe?source=<url-encoded published catalog URL>\n\\`\\`\\`\n\nFor \\`owner\\`/\\`repo\\` on GitHub Pages the catalog URL is the deployed\ndirectory, \\`https://owner.github.io/repo/\\`, e.g.\n\\`/subscribe?source=https%3A%2F%2Fowner.github.io%2Frepo%2F\\`.\n`;\n\n/**\n * Scaffold a new catalog repository at `<cwd>/<name>`. Throws when the name is\n * invalid or the destination already exists; partial failure removes created files.\n */\nexport function scaffoldCatalog(name: string, opts: { cwd?: string } = {}): ScaffoldCatalogResult {\n validateCatalogName(name);\n const dir = resolve(opts.cwd ?? process.cwd(), name);\n // Atomic acquire: EEXIST is the refusal signal — no exists-check/create race,\n // and an existing destination is never removed or written.\n try {\n mkdirSync(dir);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'EEXIST') {\n throw new Error(`Refusing to overwrite '${dir}': destination already exists`, { cause: error });\n }\n throw error;\n }\n\n const date = new Date().toISOString().slice(0, 10);\n const files: Array<[rel: string, content: string]> = [\n ['package.json', `${JSON.stringify(\n {\n name,\n version: '0.1.0',\n private: true,\n type: 'module',\n description: `WOD Wiki workout catalog: ${name}`,\n scripts: {\n build: 'wod build . --output dist',\n },\n devDependencies: {\n '@bitcobblers/wod-wiki-tools': `^${VERSION}`,\n },\n },\n null,\n 2,\n )}\\n`],\n ['.gitignore', 'node_modules/\\ndist/\\n'],\n ['.github/workflows/publish-catalog.yml', publishWorkflow()],\n ['markdown/collections/example/README.md', collectionReadme(name)],\n [`markdown/collections/example/morning-session.md`, exampleWorkout(date)],\n ['README.md', catalogReadme(name)],\n ];\n\n try {\n for (const [rel, content] of files) {\n const target = join(dir, rel);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, content, 'utf-8');\n }\n } catch (error) {\n rmSync(dir, { recursive: true, force: true });\n throw error;\n }\n return { dir, files: files.map(([rel]) => rel) };\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import { createRequire } from 'module';
2
- export { runCliServer } from './chunk-MA6BBTWC.mjs';
3
- import './chunk-CYKNTEGY.mjs';
2
+ export { runCliServer } from './chunk-RWNL6APX.mjs';
3
+ import './chunk-IWT7U3WX.mjs';
4
4
  import './chunk-V23POHG2.mjs';
5
5
  import './chunk-6L5ZDZJ7.mjs';
6
6
 
7
7
  if (typeof globalThis.require === 'undefined') {
8
8
  try { globalThis.require = createRequire(import.meta.url); } catch {}
9
9
  }
10
- //# sourceMappingURL=server-JXECWS4A.mjs.map
11
- //# sourceMappingURL=server-JXECWS4A.mjs.map
10
+ //# sourceMappingURL=server-2DVBA35J.mjs.map
11
+ //# sourceMappingURL=server-2DVBA35J.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"server-JXECWS4A.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"server-2DVBA35J.mjs"}