@byline/cli 0.1.1

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 (251) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +23 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +72 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/doctor.d.ts +2 -0
  8. package/dist/commands/doctor.d.ts.map +1 -0
  9. package/dist/commands/doctor.js +36 -0
  10. package/dist/commands/doctor.js.map +1 -0
  11. package/dist/commands/init.d.ts +16 -0
  12. package/dist/commands/init.d.ts.map +1 -0
  13. package/dist/commands/init.js +76 -0
  14. package/dist/commands/init.js.map +1 -0
  15. package/dist/context.d.ts +38 -0
  16. package/dist/context.d.ts.map +1 -0
  17. package/dist/context.js +37 -0
  18. package/dist/context.js.map +1 -0
  19. package/dist/index.d.ts +5 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +4 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/lib/pg-url.d.ts +11 -0
  24. package/dist/lib/pg-url.d.ts.map +1 -0
  25. package/dist/lib/pg-url.js +22 -0
  26. package/dist/lib/pg-url.js.map +1 -0
  27. package/dist/manifest/deps.d.ts +29 -0
  28. package/dist/manifest/deps.d.ts.map +1 -0
  29. package/dist/manifest/deps.js +97 -0
  30. package/dist/manifest/deps.js.map +1 -0
  31. package/dist/manifest/env.d.ts +18 -0
  32. package/dist/manifest/env.d.ts.map +1 -0
  33. package/dist/manifest/env.js +38 -0
  34. package/dist/manifest/env.js.map +1 -0
  35. package/dist/phases/db-init.d.ts +3 -0
  36. package/dist/phases/db-init.d.ts.map +1 -0
  37. package/dist/phases/db-init.js +163 -0
  38. package/dist/phases/db-init.js.map +1 -0
  39. package/dist/phases/db.d.ts +11 -0
  40. package/dist/phases/db.d.ts.map +1 -0
  41. package/dist/phases/db.js +93 -0
  42. package/dist/phases/db.js.map +1 -0
  43. package/dist/phases/deps.d.ts +3 -0
  44. package/dist/phases/deps.d.ts.map +1 -0
  45. package/dist/phases/deps.js +115 -0
  46. package/dist/phases/deps.js.map +1 -0
  47. package/dist/phases/env.d.ts +3 -0
  48. package/dist/phases/env.d.ts.map +1 -0
  49. package/dist/phases/env.js +172 -0
  50. package/dist/phases/env.js.map +1 -0
  51. package/dist/phases/host.d.ts +3 -0
  52. package/dist/phases/host.d.ts.map +1 -0
  53. package/dist/phases/host.js +99 -0
  54. package/dist/phases/host.js.map +1 -0
  55. package/dist/phases/index.d.ts +7 -0
  56. package/dist/phases/index.d.ts.map +1 -0
  57. package/dist/phases/index.js +40 -0
  58. package/dist/phases/index.js.map +1 -0
  59. package/dist/phases/preflight.d.ts +4 -0
  60. package/dist/phases/preflight.d.ts.map +1 -0
  61. package/dist/phases/preflight.js +81 -0
  62. package/dist/phases/preflight.js.map +1 -0
  63. package/dist/phases/routes.d.ts +3 -0
  64. package/dist/phases/routes.d.ts.map +1 -0
  65. package/dist/phases/routes.js +145 -0
  66. package/dist/phases/routes.js.map +1 -0
  67. package/dist/phases/scaffold.d.ts +3 -0
  68. package/dist/phases/scaffold.d.ts.map +1 -0
  69. package/dist/phases/scaffold.js +113 -0
  70. package/dist/phases/scaffold.js.map +1 -0
  71. package/dist/phases/stub.d.ts +3 -0
  72. package/dist/phases/stub.d.ts.map +1 -0
  73. package/dist/phases/stub.js +25 -0
  74. package/dist/phases/stub.js.map +1 -0
  75. package/dist/phases/ui.d.ts +3 -0
  76. package/dist/phases/ui.d.ts.map +1 -0
  77. package/dist/phases/ui.js +93 -0
  78. package/dist/phases/ui.js.map +1 -0
  79. package/dist/phases/wire/index.d.ts +3 -0
  80. package/dist/phases/wire/index.d.ts.map +1 -0
  81. package/dist/phases/wire/index.js +67 -0
  82. package/dist/phases/wire/index.js.map +1 -0
  83. package/dist/phases/wire/root-tsx.d.ts +3 -0
  84. package/dist/phases/wire/root-tsx.d.ts.map +1 -0
  85. package/dist/phases/wire/root-tsx.js +57 -0
  86. package/dist/phases/wire/root-tsx.js.map +1 -0
  87. package/dist/phases/wire/server-ts.d.ts +3 -0
  88. package/dist/phases/wire/server-ts.d.ts.map +1 -0
  89. package/dist/phases/wire/server-ts.js +54 -0
  90. package/dist/phases/wire/server-ts.js.map +1 -0
  91. package/dist/phases/wire/shared.d.ts +34 -0
  92. package/dist/phases/wire/shared.d.ts.map +1 -0
  93. package/dist/phases/wire/shared.js +2 -0
  94. package/dist/phases/wire/shared.js.map +1 -0
  95. package/dist/phases/wire/start-ts.d.ts +3 -0
  96. package/dist/phases/wire/start-ts.d.ts.map +1 -0
  97. package/dist/phases/wire/start-ts.js +149 -0
  98. package/dist/phases/wire/start-ts.js.map +1 -0
  99. package/dist/phases/wire/tsconfig.d.ts +3 -0
  100. package/dist/phases/wire/tsconfig.d.ts.map +1 -0
  101. package/dist/phases/wire/tsconfig.js +105 -0
  102. package/dist/phases/wire/tsconfig.js.map +1 -0
  103. package/dist/phases/wire/vite-config.d.ts +3 -0
  104. package/dist/phases/wire/vite-config.d.ts.map +1 -0
  105. package/dist/phases/wire/vite-config.js +46 -0
  106. package/dist/phases/wire/vite-config.js.map +1 -0
  107. package/dist/prompts.d.ts +34 -0
  108. package/dist/prompts.d.ts.map +1 -0
  109. package/dist/prompts.js +49 -0
  110. package/dist/prompts.js.map +1 -0
  111. package/dist/runner.d.ts +5 -0
  112. package/dist/runner.d.ts.map +1 -0
  113. package/dist/runner.js +91 -0
  114. package/dist/runner.js.map +1 -0
  115. package/dist/state.d.ts +18 -0
  116. package/dist/state.d.ts.map +1 -0
  117. package/dist/state.js +68 -0
  118. package/dist/state.js.map +1 -0
  119. package/dist/templates/byline/admin.config.ts +41 -0
  120. package/dist/templates/byline/i18n.ts +47 -0
  121. package/dist/templates/byline/routes.ts +28 -0
  122. package/dist/templates/byline/seed.ts +19 -0
  123. package/dist/templates/byline/seeds/admin.ts +62 -0
  124. package/dist/templates/byline/server.config.ts +92 -0
  125. package/dist/templates/byline-examples/admin.config.ts +74 -0
  126. package/dist/templates/byline-examples/blocks/photo-block.ts +59 -0
  127. package/dist/templates/byline-examples/blocks/richtext-block.ts +35 -0
  128. package/dist/templates/byline-examples/collections/doc-example-flat-locale-all.ts +373 -0
  129. package/dist/templates/byline-examples/collections/doc-example-flat-locale-en.ts +283 -0
  130. package/dist/templates/byline-examples/collections/doc-example-tree-locale-all.ts +278 -0
  131. package/dist/templates/byline-examples/collections/doc-example-tree-locale-en.ts +205 -0
  132. package/dist/templates/byline-examples/collections/docs/admin.tsx +204 -0
  133. package/dist/templates/byline-examples/collections/docs/components/.gitkeep +0 -0
  134. package/dist/templates/byline-examples/collections/docs/components/feature-formatter.tsx +10 -0
  135. package/dist/templates/byline-examples/collections/docs/hooks/.gitkeep +0 -0
  136. package/dist/templates/byline-examples/collections/docs/index.ts +10 -0
  137. package/dist/templates/byline-examples/collections/docs/schema.ts +209 -0
  138. package/dist/templates/byline-examples/collections/docs-categories/admin.tsx +78 -0
  139. package/dist/templates/byline-examples/collections/docs-categories/components/.gitkeep +0 -0
  140. package/dist/templates/byline-examples/collections/docs-categories/hooks/.gitkeep +0 -0
  141. package/dist/templates/byline-examples/collections/docs-categories/index.ts +10 -0
  142. package/dist/templates/byline-examples/collections/docs-categories/schema.ts +33 -0
  143. package/dist/templates/byline-examples/collections/media/admin.tsx +188 -0
  144. package/dist/templates/byline-examples/collections/media/components/media-list-view.tsx +330 -0
  145. package/dist/templates/byline-examples/collections/media/components/media-thumbnail.tsx +63 -0
  146. package/dist/templates/byline-examples/collections/media/hooks/.gitkeep +0 -0
  147. package/dist/templates/byline-examples/collections/media/index.ts +10 -0
  148. package/dist/templates/byline-examples/collections/media/schema.ts +157 -0
  149. package/dist/templates/byline-examples/collections/news/admin.tsx +192 -0
  150. package/dist/templates/byline-examples/collections/news/components/.gitkeep +0 -0
  151. package/dist/templates/byline-examples/collections/news/hooks/.gitkeep +0 -0
  152. package/dist/templates/byline-examples/collections/news/index.ts +10 -0
  153. package/dist/templates/byline-examples/collections/news/schema.ts +91 -0
  154. package/dist/templates/byline-examples/collections/news-categories/admin.tsx +78 -0
  155. package/dist/templates/byline-examples/collections/news-categories/components/.gitkeep +0 -0
  156. package/dist/templates/byline-examples/collections/news-categories/hooks/.gitkeep +0 -0
  157. package/dist/templates/byline-examples/collections/news-categories/index.ts +10 -0
  158. package/dist/templates/byline-examples/collections/news-categories/schema.ts +33 -0
  159. package/dist/templates/byline-examples/collections/pages/admin.tsx +183 -0
  160. package/dist/templates/byline-examples/collections/pages/components/.gitkeep +0 -0
  161. package/dist/templates/byline-examples/collections/pages/hooks/.gitkeep +0 -0
  162. package/dist/templates/byline-examples/collections/pages/index.ts +10 -0
  163. package/dist/templates/byline-examples/collections/pages/schema.ts +96 -0
  164. package/dist/templates/byline-examples/components/length-indicator.tsx +138 -0
  165. package/dist/templates/byline-examples/components/pill.tsx +38 -0
  166. package/dist/templates/byline-examples/components/summary-length.tsx +39 -0
  167. package/dist/templates/byline-examples/fields/available-languages-field.ts +90 -0
  168. package/dist/templates/byline-examples/fields/lexical-richtext-compact.ts +88 -0
  169. package/dist/templates/byline-examples/i18n.ts +47 -0
  170. package/dist/templates/byline-examples/routes.ts +28 -0
  171. package/dist/templates/byline-examples/scripts/regenerate-media.ts +275 -0
  172. package/dist/templates/byline-examples/seed.ts +25 -0
  173. package/dist/templates/byline-examples/seeds/admin.ts +62 -0
  174. package/dist/templates/byline-examples/seeds/doc-categories.ts +71 -0
  175. package/dist/templates/byline-examples/seeds/docs.ts +293 -0
  176. package/dist/templates/byline-examples/seeds/news-categories.ts +71 -0
  177. package/dist/templates/byline-examples/server.config.ts +179 -0
  178. package/dist/templates/host/vite.config.ts +41 -0
  179. package/dist/templates/migrations/0000_condemned_kronos.sql +324 -0
  180. package/dist/templates/migrations/0001_sudden_phantom_reporter.sql +1 -0
  181. package/dist/templates/migrations/meta/0000_snapshot.json +2793 -0
  182. package/dist/templates/migrations/meta/0001_snapshot.json +2799 -0
  183. package/dist/templates/migrations/meta/_journal.json +20 -0
  184. package/dist/templates/routes/(byline)/admin/account/index.tsx +11 -0
  185. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/api.tsx +16 -0
  186. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/history.tsx +19 -0
  187. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/index.tsx +16 -0
  188. package/dist/templates/routes/(byline)/admin/collections/$collection/create.tsx +11 -0
  189. package/dist/templates/routes/(byline)/admin/collections/$collection/index.tsx +11 -0
  190. package/dist/templates/routes/(byline)/admin/index.tsx +11 -0
  191. package/dist/templates/routes/(byline)/admin/permissions/index.tsx +11 -0
  192. package/dist/templates/routes/(byline)/admin/roles/$id/index.tsx +11 -0
  193. package/dist/templates/routes/(byline)/admin/roles/index.tsx +11 -0
  194. package/dist/templates/routes/(byline)/admin/route.tsx +11 -0
  195. package/dist/templates/routes/(byline)/admin/users/$id/index.tsx +11 -0
  196. package/dist/templates/routes/(byline)/admin/users/index.tsx +11 -0
  197. package/dist/templates/routes/(byline)/sign-in.tsx +11 -0
  198. package/dist/templates/ui-byline/blocks/photo-block/index.tsx +80 -0
  199. package/dist/templates/ui-byline/blocks/richtext-block/index.tsx +46 -0
  200. package/dist/templates/ui-byline/components/admonition/index.tsx +40 -0
  201. package/dist/templates/ui-byline/components/code/code-serializer.tsx +20 -0
  202. package/dist/templates/ui-byline/components/code/code.tsx +50 -0
  203. package/dist/templates/ui-byline/components/code/index.module.scss +137 -0
  204. package/dist/templates/ui-byline/components/code/index.ts +2 -0
  205. package/dist/templates/ui-byline/components/code/types.ts +5 -0
  206. package/dist/templates/ui-byline/components/code/utils.ts +20 -0
  207. package/dist/templates/ui-byline/components/heading-anchor/heading-anchor.tsx +69 -0
  208. package/dist/templates/ui-byline/components/heading-anchor/index.ts +1 -0
  209. package/dist/templates/ui-byline/components/heading-anchor/utils.ts +15 -0
  210. package/dist/templates/ui-byline/components/inline-image/index.tsx +109 -0
  211. package/dist/templates/ui-byline/components/layout/index.tsx +63 -0
  212. package/dist/templates/ui-byline/components/link/lang-link.tsx +70 -0
  213. package/dist/templates/ui-byline/components/link/link-field.tsx +298 -0
  214. package/dist/templates/ui-byline/components/link/link-lexical.tsx +191 -0
  215. package/dist/templates/ui-byline/components/list/index.ts +2 -0
  216. package/dist/templates/ui-byline/components/list/list-item.tsx +32 -0
  217. package/dist/templates/ui-byline/components/list/list.tsx +17 -0
  218. package/dist/templates/ui-byline/components/responsive-image/index.tsx +205 -0
  219. package/dist/templates/ui-byline/components/richtext-lexical/index.tsx +31 -0
  220. package/dist/templates/ui-byline/components/richtext-lexical/serialize/index.tsx +249 -0
  221. package/dist/templates/ui-byline/components/richtext-lexical/serialize/richtext-node-formats.ts +66 -0
  222. package/dist/templates/ui-byline/components/richtext-lexical/serialize/types.ts +48 -0
  223. package/dist/templates/ui-byline/components/richtext-lexical/serialize/utils.ts +15 -0
  224. package/dist/templates/ui-byline/components/table-cell/index.tsx +36 -0
  225. package/dist/templates/ui-byline/components/vimeo/index.tsx +21 -0
  226. package/dist/templates/ui-byline/components/youtube/index.tsx +22 -0
  227. package/dist/templates/ui-byline/render-blocks.tsx +71 -0
  228. package/dist/templates/ui-byline/types/i18n.ts +14 -0
  229. package/dist/templates/ui-byline/utils/image-sources.ts +102 -0
  230. package/dist/templates/ui-byline/utils/to-kebab-case.ts +5 -0
  231. package/dist/types.d.ts +54 -0
  232. package/dist/types.d.ts.map +1 -0
  233. package/dist/types.js +2 -0
  234. package/dist/types.js.map +1 -0
  235. package/dist/ui/diff.d.ts +4 -0
  236. package/dist/ui/diff.d.ts.map +1 -0
  237. package/dist/ui/diff.js +23 -0
  238. package/dist/ui/diff.js.map +1 -0
  239. package/dist/ui/grid.d.ts +7 -0
  240. package/dist/ui/grid.d.ts.map +1 -0
  241. package/dist/ui/grid.js +24 -0
  242. package/dist/ui/grid.js.map +1 -0
  243. package/dist/ui/logger.d.ts +14 -0
  244. package/dist/ui/logger.d.ts.map +1 -0
  245. package/dist/ui/logger.js +30 -0
  246. package/dist/ui/logger.js.map +1 -0
  247. package/dist/ui/snippet.d.ts +2 -0
  248. package/dist/ui/snippet.d.ts.map +1 -0
  249. package/dist/ui/snippet.js +7 -0
  250. package/dist/ui/snippet.js.map +1 -0
  251. package/package.json +69 -0
@@ -0,0 +1,145 @@
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join, relative } from 'node:path';
3
+ const TEMPLATE_DIR = 'routes/(byline)';
4
+ const TARGET_GROUP_DIR = 'src/routes/(byline)';
5
+ const DEFAULT_ADMIN_PATH = '/admin';
6
+ const ADMIN_SLUG_REGEX = /^[a-z][a-z0-9-]*$/;
7
+ export const routesPhase = {
8
+ id: 'routes',
9
+ title: 'Routes — drop (byline)/admin route stubs into src/routes/',
10
+ defaultMode: 'confirm',
11
+ async detect(ctx) {
12
+ if (ctx.state.isComplete('routes'))
13
+ return 'done';
14
+ return 'pending';
15
+ },
16
+ async plan(ctx) {
17
+ const adminPath = ctx.state.get().answers.adminPath ?? DEFAULT_ADMIN_PATH;
18
+ const slug = pathToSlug(adminPath);
19
+ if (slug === null) {
20
+ return {
21
+ writes: [],
22
+ commands: [],
23
+ notes: [
24
+ `invalid admin path "${adminPath}" — must be a single URL segment matching ${ADMIN_SLUG_REGEX}`,
25
+ ],
26
+ };
27
+ }
28
+ const entries = collectEntries(ctx, slug);
29
+ const created = entries.filter((e) => e.status === 'create').length;
30
+ const skipped = entries.filter((e) => e.status === 'skip-already-exists').length;
31
+ const notes = [
32
+ `target: ${ctx.resolve(TARGET_GROUP_DIR)}/`,
33
+ `admin path: ${ctx.state.get().answers.adminPath === undefined ? `will prompt (default ${DEFAULT_ADMIN_PATH})` : adminPath}`,
34
+ slug !== 'admin'
35
+ ? `route group: (byline)/${slug} (renamed from (byline)/admin)`
36
+ : 'route group: (byline)/admin',
37
+ `${created} file(s) to create, ${skipped} already-existing skipped`,
38
+ ];
39
+ return { writes: [], commands: [], notes };
40
+ },
41
+ async apply(_plan, ctx) {
42
+ let adminPath = ctx.state.get().answers.adminPath;
43
+ if (adminPath === undefined) {
44
+ adminPath = await ctx.prompter.text({
45
+ message: 'Where should the admin UI be mounted?',
46
+ defaultValue: DEFAULT_ADMIN_PATH,
47
+ placeholder: DEFAULT_ADMIN_PATH,
48
+ });
49
+ adminPath = adminPath.startsWith('/') ? adminPath : `/${adminPath}`;
50
+ }
51
+ const slug = pathToSlug(adminPath);
52
+ if (!slug) {
53
+ ctx.logger.error(`invalid admin path "${adminPath}" — must be a single URL segment matching ${ADMIN_SLUG_REGEX}`);
54
+ return { state: 'blocked' };
55
+ }
56
+ ctx.state.patchAnswers({ adminPath });
57
+ const entries = collectEntries(ctx, slug);
58
+ if (entries.length === 0) {
59
+ ctx.logger.error('no route templates found — was the cli built with templates copied to dist?');
60
+ return { state: 'blocked' };
61
+ }
62
+ let written = 0;
63
+ let skipped = 0;
64
+ for (const entry of entries) {
65
+ if (entry.status === 'skip-already-exists') {
66
+ skipped++;
67
+ continue;
68
+ }
69
+ mkdirSync(dirname(entry.toAbs), { recursive: true });
70
+ const raw = readFileSync(entry.fromAbs, 'utf8');
71
+ writeFileSync(entry.toAbs, rewriteRouteIds(raw, slug), 'utf8');
72
+ written++;
73
+ }
74
+ ctx.logger.success(`wrote ${written} route file(s) under ${ctx.resolve(TARGET_GROUP_DIR)}/`);
75
+ if (skipped > 0) {
76
+ ctx.logger.info(`${skipped} file(s) already existed and were left untouched — re-running routes is non-destructive`);
77
+ }
78
+ return { state: 'done' };
79
+ },
80
+ };
81
+ function pathToSlug(adminPath) {
82
+ const trimmed = adminPath.replace(/^\/+|\/+$/g, '');
83
+ if (!trimmed || trimmed.includes('/'))
84
+ return null;
85
+ return ADMIN_SLUG_REGEX.test(trimmed) ? trimmed : null;
86
+ }
87
+ function collectEntries(ctx, slug) {
88
+ const templateRoot = join(ctx.templatesDir(), TEMPLATE_DIR);
89
+ if (!existsSync(templateRoot))
90
+ return [];
91
+ const targetRoot = ctx.resolve(TARGET_GROUP_DIR);
92
+ const entries = [];
93
+ for (const abs of walkFiles(templateRoot)) {
94
+ const rel = relative(templateRoot, abs);
95
+ const renamed = slug === 'admin' ? rel : renameAdminSegment(rel, slug);
96
+ const toAbs = join(targetRoot, renamed);
97
+ entries.push({
98
+ fromAbs: abs,
99
+ rel: renamed,
100
+ toAbs,
101
+ status: existsSync(toAbs) ? 'skip-already-exists' : 'create',
102
+ });
103
+ }
104
+ return entries;
105
+ }
106
+ /**
107
+ * Replace the leading `admin/` (or exactly `admin`) directory segment with `<slug>/`.
108
+ * Files outside the admin/ subtree (e.g. `sign-in.tsx`) are returned unchanged.
109
+ */
110
+ function renameAdminSegment(rel, slug) {
111
+ if (rel === 'admin' || rel.startsWith('admin/')) {
112
+ return `${slug}${rel.slice('admin'.length)}`;
113
+ }
114
+ return rel;
115
+ }
116
+ /**
117
+ * Rewrite route-id strings inside the file contents. Route ids are passed
118
+ * positionally to the `create*Route(...)` factories from
119
+ * `@byline/host-tanstack-start/routes` and look like `/(byline)/admin/...`.
120
+ *
121
+ * We match the literal `/(byline)/admin` prefix only — we do not touch
122
+ * other occurrences of "admin" elsewhere in the file (comments, prop
123
+ * names, etc.).
124
+ */
125
+ function rewriteRouteIds(source, slug) {
126
+ if (slug === 'admin')
127
+ return source;
128
+ return source.replace(/(['"])\/\(byline\)\/admin\b/g, `$1/(byline)/${slug}`);
129
+ }
130
+ function walkFiles(root) {
131
+ const out = [];
132
+ function walk(dir) {
133
+ for (const name of readdirSync(dir)) {
134
+ const abs = join(dir, name);
135
+ const st = statSync(abs);
136
+ if (st.isDirectory())
137
+ walk(abs);
138
+ else if (st.isFile())
139
+ out.push(abs);
140
+ }
141
+ }
142
+ walk(root);
143
+ return out;
144
+ }
145
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/phases/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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W,EAAE,IAAY;IACnD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChD,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,MAAc,EAAE,IAAY;IACnD,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,MAAM,CAAA;IACnC,OAAO,MAAM,CAAC,OAAO,CAAC,8BAA8B,EAAE,eAAe,IAAI,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,SAAS,IAAI,CAAC,GAAW;QACvB,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;YACxB,IAAI,EAAE,CAAC,WAAW,EAAE;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAA;iBAC1B,IAAI,EAAE,CAAC,MAAM,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Phase } from '../types.js';
2
+ export declare const scaffoldPhase: Phase;
3
+ //# sourceMappingURL=scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/phases/scaffold.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAcxC,eAAO,MAAM,aAAa,EAAE,KAgE3B,CAAA"}
@@ -0,0 +1,113 @@
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join, relative } from 'node:path';
3
+ const TARGET_DIR = 'byline';
4
+ const BASE_TEMPLATE = 'byline';
5
+ const EXAMPLES_TEMPLATE = 'byline-examples';
6
+ export const scaffoldPhase = {
7
+ id: 'scaffold',
8
+ title: 'Scaffold — copy byline/ config tree into the app root',
9
+ defaultMode: 'auto',
10
+ async detect(ctx) {
11
+ if (ctx.state.isComplete('scaffold'))
12
+ return 'done';
13
+ return 'pending';
14
+ },
15
+ async plan(ctx) {
16
+ const examples = ctx.state.get().answers.examples;
17
+ const entries = collectEntries(ctx, examples ?? true);
18
+ const fromBase = entries.filter((e) => e.source === 'base' && e.status === 'create').length;
19
+ const fromExamples = entries.filter((e) => e.source === 'examples' && e.status === 'create').length;
20
+ const skipped = entries.filter((e) => e.status === 'skip-already-exists').length;
21
+ const notes = [
22
+ `target: ${ctx.resolve(TARGET_DIR)}/`,
23
+ `examples overlay: ${examples === undefined ? 'will prompt (default yes)' : examples ? 'yes' : 'no'}`,
24
+ `${fromBase} base file(s), ${fromExamples} examples file(s), ${skipped} already-existing skipped`,
25
+ ];
26
+ return { writes: [], commands: [], notes };
27
+ },
28
+ async apply(_plan, ctx) {
29
+ let examples = ctx.state.get().answers.examples;
30
+ if (examples === undefined) {
31
+ examples = await ctx.prompter.confirm({
32
+ message: 'Include the example collections, blocks, and fields?',
33
+ defaultValue: true,
34
+ });
35
+ ctx.state.patchAnswers({ examples });
36
+ }
37
+ const entries = collectEntries(ctx, examples);
38
+ if (entries.length === 0) {
39
+ ctx.logger.error('no template files found — was the cli built with templates copied to dist?');
40
+ return { state: 'blocked' };
41
+ }
42
+ let written = 0;
43
+ let skipped = 0;
44
+ for (const entry of entries) {
45
+ if (entry.status === 'skip-already-exists') {
46
+ skipped++;
47
+ continue;
48
+ }
49
+ mkdirSync(dirname(entry.toAbs), { recursive: true });
50
+ writeFileSync(entry.toAbs, readFileSync(entry.fromAbs, 'utf8'), 'utf8');
51
+ written++;
52
+ }
53
+ ctx.logger.success(`wrote ${written} file(s) under ${ctx.resolve(TARGET_DIR)}/`);
54
+ if (skipped > 0) {
55
+ ctx.logger.info(`${skipped} file(s) already existed and were left untouched — re-running scaffold is non-destructive`);
56
+ }
57
+ return { state: 'done' };
58
+ },
59
+ };
60
+ function collectEntries(ctx, examples) {
61
+ const targetRoot = ctx.resolve(TARGET_DIR);
62
+ const baseRoot = join(ctx.templatesDir(), BASE_TEMPLATE);
63
+ const examplesRoot = join(ctx.templatesDir(), EXAMPLES_TEMPLATE);
64
+ const examplesFiles = examples && existsSync(examplesRoot) ? walkFiles(examplesRoot) : [];
65
+ const examplesRels = new Set(examplesFiles.map((abs) => relative(examplesRoot, abs)));
66
+ const entries = [];
67
+ if (existsSync(baseRoot)) {
68
+ for (const abs of walkFiles(baseRoot)) {
69
+ const rel = relative(baseRoot, abs);
70
+ // The examples tree supersedes the base for any path the two share
71
+ // (e.g. server.config.ts, admin.config.ts, seed.ts). Skip the base
72
+ // entry so we don't queue two writes for the same target file.
73
+ if (examplesRels.has(rel))
74
+ continue;
75
+ const toAbs = join(targetRoot, rel);
76
+ entries.push({
77
+ fromAbs: abs,
78
+ rel,
79
+ toAbs,
80
+ source: 'base',
81
+ status: existsSync(toAbs) ? 'skip-already-exists' : 'create',
82
+ });
83
+ }
84
+ }
85
+ for (const abs of examplesFiles) {
86
+ const rel = relative(examplesRoot, abs);
87
+ const toAbs = join(targetRoot, rel);
88
+ entries.push({
89
+ fromAbs: abs,
90
+ rel,
91
+ toAbs,
92
+ source: 'examples',
93
+ status: existsSync(toAbs) ? 'skip-already-exists' : 'create',
94
+ });
95
+ }
96
+ return entries;
97
+ }
98
+ function walkFiles(root) {
99
+ const out = [];
100
+ function walk(dir) {
101
+ for (const name of readdirSync(dir)) {
102
+ const abs = join(dir, name);
103
+ const st = statSync(abs);
104
+ if (st.isDirectory())
105
+ walk(abs);
106
+ else if (st.isFile())
107
+ out.push(abs);
108
+ }
109
+ }
110
+ walk(root);
111
+ return out;
112
+ }
113
+ //# sourceMappingURL=scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/phases/scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAKnD,MAAM,UAAU,GAAG,QAAQ,CAAA;AAC3B,MAAM,aAAa,GAAG,QAAQ,CAAA;AAC9B,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAU3C,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,uDAAuD;IAC9D,WAAW,EAAE,MAAM;IAEnB,KAAK,CAAC,MAAM,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,MAAM,CAAA;QACnD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG;QACZ,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAA;QACjD,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAA;QAErD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAA;QAC3F,MAAM,YAAY,GAAG,OAAO,CAAC,MAA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IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,SAAS,IAAI,CAAC,GAAW;QACvB,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;YACxB,IAAI,EAAE,CAAC,WAAW,EAAE;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAA;iBAC1B,IAAI,EAAE,CAAC,MAAM,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Phase, PhaseId } from '../types.js';
2
+ export declare function stubPhase(id: PhaseId, title: string): Phase;
3
+ //# sourceMappingURL=stub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAoB3D"}
@@ -0,0 +1,25 @@
1
+ export function stubPhase(id, title) {
2
+ return {
3
+ id,
4
+ title,
5
+ defaultMode: 'confirm',
6
+ async detect(ctx) {
7
+ return ctx.state.isComplete(id) ? 'done' : 'pending';
8
+ },
9
+ async plan() {
10
+ return {
11
+ writes: [],
12
+ commands: [],
13
+ notes: [`${id}: not yet implemented in @byline/cli ${currentVersion()}`],
14
+ };
15
+ },
16
+ async apply(_plan, ctx) {
17
+ ctx.logger.warn(`${id} — phase is stubbed; please follow the manual instructions in docs`);
18
+ return { state: 'pending' };
19
+ },
20
+ };
21
+ }
22
+ function currentVersion() {
23
+ return '0.1.0';
24
+ }
25
+ //# sourceMappingURL=stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAC,EAAW,EAAE,KAAa;IAClD,OAAO;QACL,EAAE;QACF,KAAK;QACL,WAAW,EAAE,SAAS;QACtB,KAAK,CAAC,MAAM,CAAC,GAAY;YACvB,OAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QACtD,CAAC;QACD,KAAK,CAAC,IAAI;YACR,OAAO;gBACL,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,KAAK,EAAE,CAAC,GAAG,EAAE,wCAAwC,cAAc,EAAE,EAAE,CAAC;aACzE,CAAA;QACH,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,oEAAoE,CAAC,CAAA;YAC1F,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Phase } from '../types.js';
2
+ export declare const uiPhase: Phase;
3
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/phases/ui.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAWxC,eAAO,MAAM,OAAO,EAAE,KAgErB,CAAA"}
@@ -0,0 +1,93 @@
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join, relative } from 'node:path';
3
+ const TEMPLATE_DIR = 'ui-byline';
4
+ const TARGET_DIR = 'src/ui/byline';
5
+ export const uiPhase = {
6
+ id: 'ui',
7
+ title: 'UI — copy serialization components into src/ui/byline/',
8
+ defaultMode: 'auto',
9
+ async detect(ctx) {
10
+ if (ctx.state.isComplete('ui'))
11
+ return 'done';
12
+ return 'pending';
13
+ },
14
+ async plan(ctx) {
15
+ const entries = collectEntries(ctx);
16
+ const created = entries.filter((e) => e.status === 'create').length;
17
+ const skipped = entries.filter((e) => e.status === 'skip-already-exists').length;
18
+ const notes = [
19
+ `target: ${ctx.resolve(TARGET_DIR)}/`,
20
+ `${created} file(s) to create, ${skipped} already-existing skipped`,
21
+ ];
22
+ if (entries.length === 0)
23
+ notes.push('(no template files — was the cli built with templates?)');
24
+ return { writes: [], commands: [], notes };
25
+ },
26
+ async apply(_plan, ctx) {
27
+ const entries = collectEntries(ctx);
28
+ if (entries.length === 0) {
29
+ ctx.logger.error('no template files found — was the cli built with templates copied to dist?');
30
+ return { state: 'blocked' };
31
+ }
32
+ let written = 0;
33
+ let skipped = 0;
34
+ for (const entry of entries) {
35
+ if (entry.status === 'skip-already-exists') {
36
+ skipped++;
37
+ continue;
38
+ }
39
+ mkdirSync(dirname(entry.toAbs), { recursive: true });
40
+ writeFileSync(entry.toAbs, readFileSync(entry.fromAbs, 'utf8'), 'utf8');
41
+ written++;
42
+ }
43
+ ctx.logger.success(`wrote ${written} file(s) under ${ctx.resolve(TARGET_DIR)}/`);
44
+ if (skipped > 0) {
45
+ ctx.logger.info(`${skipped} file(s) already existed and were left untouched — re-running ui is non-destructive`);
46
+ }
47
+ ctx.prompter.note([
48
+ 'src/ui/byline/types/i18n.ts — `Locale = string` stub. Replace with your',
49
+ ' narrower locale union if you have one.',
50
+ 'src/ui/byline/components/link/ — `LangLink` is a single-locale pass-through.',
51
+ ' lang-link.tsx Replace if you use a multi-locale strategy.',
52
+ 'src/ui/byline/render-blocks.tsx — Sample renderer wired to the example PhotoBlock /',
53
+ ' RichTextBlock schemas. Adapt to your own block',
54
+ ' definitions, or delete if not using examples.',
55
+ '',
56
+ 'Reference implementations live in https://github.com/Byline-CMS/bylinecms.dev',
57
+ ].join('\n'), 'UI: customisation pointers');
58
+ return { state: 'done' };
59
+ },
60
+ };
61
+ function collectEntries(ctx) {
62
+ const templateRoot = join(ctx.templatesDir(), TEMPLATE_DIR);
63
+ if (!existsSync(templateRoot))
64
+ return [];
65
+ const targetRoot = ctx.resolve(TARGET_DIR);
66
+ const entries = [];
67
+ for (const abs of walkFiles(templateRoot)) {
68
+ const rel = relative(templateRoot, abs);
69
+ const toAbs = join(targetRoot, rel);
70
+ entries.push({
71
+ fromAbs: abs,
72
+ toAbs,
73
+ status: existsSync(toAbs) ? 'skip-already-exists' : 'create',
74
+ });
75
+ }
76
+ return entries;
77
+ }
78
+ function walkFiles(root) {
79
+ const out = [];
80
+ function walk(dir) {
81
+ for (const name of readdirSync(dir)) {
82
+ const abs = join(dir, name);
83
+ const st = statSync(abs);
84
+ if (st.isDirectory())
85
+ walk(abs);
86
+ else if (st.isFile())
87
+ out.push(abs);
88
+ }
89
+ }
90
+ walk(root);
91
+ return out;
92
+ }
93
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/phases/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAKnD,MAAM,YAAY,GAAG,WAAW,CAAA;AAChC,MAAM,UAAU,GAAG,eAAe,CAAA;AAQlC,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,EAAE,E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GAAgB,EAAE,CAAA;IAC/B,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QACnC,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,EAAE,GAAG;YACZ,KAAK;YACL,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ;SAC7D,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,SAAS,IAAI,CAAC,GAAW;QACvB,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;YACxB,IAAI,EAAE,CAAC,WAAW,EAAE;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAA;iBAC1B,IAAI,EAAE,CAAC,MAAM,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Phase } from '../../types.js';
2
+ export declare const wirePhase: Phase;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phases/wire/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAA2B,MAAM,gBAAgB,CAAA;AAKpE,eAAO,MAAM,SAAS,EAAE,KA+CvB,CAAA"}
@@ -0,0 +1,67 @@
1
+ import { wireRootTsx } from './root-tsx.js';
2
+ import { wireServerTs } from './server-ts.js';
3
+ import { wireStartTs } from './start-ts.js';
4
+ import { wireTsconfig } from './tsconfig.js';
5
+ import { wireViteConfig } from './vite-config.js';
6
+ const SUB_EDITS = [wireServerTs, wireStartTs, wireRootTsx, wireTsconfig, wireViteConfig];
7
+ export const wirePhase = {
8
+ id: 'wire',
9
+ title: 'Wire — inject imports + path mappings + verify vite.config.ts',
10
+ defaultMode: 'confirm',
11
+ async detect(ctx) {
12
+ if (ctx.state.isComplete('wire'))
13
+ return 'done';
14
+ return 'pending';
15
+ },
16
+ async plan(ctx) {
17
+ const notes = [];
18
+ for (const sub of SUB_EDITS) {
19
+ const r = await sub.preview(ctx);
20
+ notes.push(formatNote(sub.key, r));
21
+ }
22
+ return { writes: [], commands: [], notes };
23
+ },
24
+ async apply(_plan, ctx) {
25
+ const results = [];
26
+ for (const sub of SUB_EDITS) {
27
+ const r = await sub.apply(ctx);
28
+ results.push({ key: sub.key, result: r });
29
+ ctx.state.setWireSubEdit(sub.key, persistableStatus(r.status));
30
+ switch (r.status) {
31
+ case 'done':
32
+ ctx.logger.success(` ${sub.key}: ${r.message}`);
33
+ break;
34
+ case 'skipped':
35
+ ctx.logger.info(` ${sub.key}: ${r.message}`);
36
+ break;
37
+ case 'manual':
38
+ ctx.logger.warn(` ${sub.key}: ${r.message}`);
39
+ if (r.snippet) {
40
+ ctx.prompter.note(r.snippet, `${sub.key}: paste this manually`);
41
+ }
42
+ break;
43
+ case 'blocked':
44
+ ctx.logger.error(` ${sub.key}: ${r.message}`);
45
+ break;
46
+ }
47
+ }
48
+ return { state: aggregateState(results.map((r) => r.result)) };
49
+ },
50
+ };
51
+ function formatNote(key, r) {
52
+ const tag = r.status === 'done' ? '+' : r.status === 'skipped' ? '✓' : r.status === 'manual' ? '!' : '✗';
53
+ return ` ${tag} ${key}: ${r.message}`;
54
+ }
55
+ function persistableStatus(s) {
56
+ if (s === 'blocked')
57
+ return 'pending';
58
+ return s;
59
+ }
60
+ function aggregateState(results) {
61
+ if (results.some((r) => r.status === 'blocked'))
62
+ return 'blocked';
63
+ if (results.some((r) => r.status === 'manual'))
64
+ return 'partial';
65
+ return 'done';
66
+ }
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/phases/wire/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIjD,MAAM,SAAS,GAAc,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAA;AAEnG,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,+DAA+D;IACtE,WAAW,EAAE,SAAS;IAEtB,KAAK,CAAC,MAAM,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAA;QAC/C,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG;QACZ,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAChC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;QACpC,CAA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.d.ts","sourceRoot":"","sources":["../../../src/phases/wire/root-tsx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAA;AASzD,eAAO,MAAM,WAAW,EAAE,OASzB,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { Project } from 'ts-morph';
3
+ const REL = 'src/routes/__root.tsx';
4
+ const IMPORT_SPECIFIER = '../../byline/admin.config';
5
+ const SNIPPET = `// Initialize Byline admin config — must be imported here so it runs in both
6
+ // the SSR rendering and client module graphs (see byline/admin.config.ts).
7
+ import '${IMPORT_SPECIFIER}'
8
+ `;
9
+ export const wireRootTsx = {
10
+ key: 'root-tsx',
11
+ title: `Inject side-effect import into ${REL}`,
12
+ async preview(ctx) {
13
+ return run(ctx, true);
14
+ },
15
+ async apply(ctx) {
16
+ return run(ctx, false);
17
+ },
18
+ };
19
+ async function run(ctx, dryRun) {
20
+ const path = ctx.resolve(REL);
21
+ if (!existsSync(path)) {
22
+ return { status: 'blocked', message: `${REL} not found — host phase should have caught this` };
23
+ }
24
+ const text = readFileSync(path, 'utf8');
25
+ if (hasImport(text, IMPORT_SPECIFIER)) {
26
+ return { status: 'skipped', message: `${REL}: admin config import already present` };
27
+ }
28
+ if (dryRun) {
29
+ return { status: 'done', message: `${REL}: will inject \`import '${IMPORT_SPECIFIER}'\`` };
30
+ }
31
+ const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
32
+ let source;
33
+ try {
34
+ source = project.addSourceFileAtPath(path);
35
+ }
36
+ catch {
37
+ return {
38
+ status: 'manual',
39
+ message: `${REL}: could not parse — please add the import manually`,
40
+ snippet: SNIPPET,
41
+ };
42
+ }
43
+ // Place after the last existing import — admin config registration only
44
+ // needs to run once at module load; ordering with other side-effect
45
+ // imports doesn't matter as long as it lands in the route module graph.
46
+ const imports = source.getImportDeclarations();
47
+ const insertIndex = imports.length;
48
+ source.insertImportDeclaration(insertIndex, { moduleSpecifier: IMPORT_SPECIFIER });
49
+ source.saveSync();
50
+ return { status: 'done', message: `${REL}: injected \`import '${IMPORT_SPECIFIER}'\`` };
51
+ }
52
+ function hasImport(source, specifier) {
53
+ const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
54
+ const re = new RegExp(`import\\s+['"]${escaped}(?:\\.ts|\\.tsx)?['"]`);
55
+ return re.test(source);
56
+ }
57
+ //# sourceMappingURL=root-tsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-tsx.js","sourceRoot":"","sources":["../../../src/phases/wire/root-tsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAA;AAKnD,MAAM,GAAG,GAAG,uBAAuB,CAAA;AACnC,MAAM,gBAAgB,GAAG,2BAA2B,CAAA;AACpD,MAAM,OAAO,GAAG;;UAEN,gBAAgB;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,kCAAkC,GAAG,EAAE;IAC9C,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACvB,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,GAAG;QACb,OAAO,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACxB,CAAC;CACF,CAAA;AAED,KAAK,UAAU,GAAG,CAAC,GAAY,EAAE,MAAe;IAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,iDAAiD,EAAE,CAAA;IAChG,CAAC;IAED,MAAM,IAAI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IAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,iBAAiB,OAAO,uBAAuB,CAAC,CAAA;IACtE,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SubEdit } from './shared.js';
2
+ export declare const wireServerTs: SubEdit;
3
+ //# sourceMappingURL=server-ts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-ts.d.ts","sourceRoot":"","sources":["../../../src/phases/wire/server-ts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAA;AAQzD,eAAO,MAAM,YAAY,EAAE,OAS1B,CAAA"}