@supportpages.io/wtfm 0.0.0-stage → 0.3.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 (275) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +23 -0
  3. package/README.md +392 -2
  4. package/dist/actions.d.ts +98 -0
  5. package/dist/actions.js +86 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/agent-settings.d.ts +22 -0
  8. package/dist/agent-settings.js +35 -0
  9. package/dist/agent-settings.js.map +1 -0
  10. package/dist/api.d.ts +14 -0
  11. package/dist/api.js +159 -0
  12. package/dist/api.js.map +1 -0
  13. package/dist/article-link.d.ts +16 -0
  14. package/dist/article-link.js +25 -0
  15. package/dist/article-link.js.map +1 -0
  16. package/dist/artifacts.d.ts +45 -0
  17. package/dist/artifacts.js +144 -0
  18. package/dist/artifacts.js.map +1 -0
  19. package/dist/brand.d.ts +4 -0
  20. package/dist/brand.js +9 -0
  21. package/dist/brand.js.map +1 -0
  22. package/dist/bridge.d.ts +2964 -0
  23. package/dist/bridge.js +1036 -0
  24. package/dist/bridge.js.map +1 -0
  25. package/dist/capacity.d.ts +5 -0
  26. package/dist/capacity.js +11 -0
  27. package/dist/capacity.js.map +1 -0
  28. package/dist/credentials.d.ts +13 -0
  29. package/dist/credentials.js +88 -0
  30. package/dist/credentials.js.map +1 -0
  31. package/dist/development-tls.d.ts +8 -0
  32. package/dist/development-tls.js +38 -0
  33. package/dist/development-tls.js.map +1 -0
  34. package/dist/errors.d.ts +15 -0
  35. package/dist/errors.js +18 -0
  36. package/dist/errors.js.map +1 -0
  37. package/dist/export.d.ts +11 -0
  38. package/dist/export.js +91 -0
  39. package/dist/export.js.map +1 -0
  40. package/dist/hosted-operations.d.ts +108 -0
  41. package/dist/hosted-operations.js +120 -0
  42. package/dist/hosted-operations.js.map +1 -0
  43. package/dist/hosting-benefits.d.ts +66 -0
  44. package/dist/hosting-benefits.js +67 -0
  45. package/dist/hosting-benefits.js.map +1 -0
  46. package/dist/index.d.ts +2 -0
  47. package/dist/index.js +49 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/local-inventory.d.ts +22 -0
  50. package/dist/local-inventory.js +59 -0
  51. package/dist/local-inventory.js.map +1 -0
  52. package/dist/local-setup.d.ts +208 -0
  53. package/dist/local-setup.js +140 -0
  54. package/dist/local-setup.js.map +1 -0
  55. package/dist/pairing.d.ts +71 -0
  56. package/dist/pairing.js +235 -0
  57. package/dist/pairing.js.map +1 -0
  58. package/dist/preferences.d.ts +18 -0
  59. package/dist/preferences.js +44 -0
  60. package/dist/preferences.js.map +1 -0
  61. package/dist/progress.d.ts +205 -0
  62. package/dist/progress.js +224 -0
  63. package/dist/progress.js.map +1 -0
  64. package/dist/reminders.d.ts +31 -0
  65. package/dist/reminders.js +73 -0
  66. package/dist/reminders.js.map +1 -0
  67. package/dist/replace-connection.d.ts +6 -0
  68. package/dist/replace-connection.js +77 -0
  69. package/dist/replace-connection.js.map +1 -0
  70. package/dist/repository-actions.d.ts +18 -0
  71. package/dist/repository-actions.js +9 -0
  72. package/dist/repository-actions.js.map +1 -0
  73. package/dist/repository-benefits.d.ts +96 -0
  74. package/dist/repository-benefits.js +64 -0
  75. package/dist/repository-benefits.js.map +1 -0
  76. package/dist/run-update.d.ts +17 -0
  77. package/dist/run-update.js +27 -0
  78. package/dist/run-update.js.map +1 -0
  79. package/dist/runs.d.ts +541 -0
  80. package/dist/runs.js +146 -0
  81. package/dist/runs.js.map +1 -0
  82. package/dist/runtime.d.ts +12 -0
  83. package/dist/runtime.js +58 -0
  84. package/dist/runtime.js.map +1 -0
  85. package/dist/schema.d.ts +277 -0
  86. package/dist/schema.js +66 -0
  87. package/dist/schema.js.map +1 -0
  88. package/dist/server.d.ts +4 -0
  89. package/dist/server.js +298 -0
  90. package/dist/server.js.map +1 -0
  91. package/dist/session.d.ts +1714 -0
  92. package/dist/session.js +619 -0
  93. package/dist/session.js.map +1 -0
  94. package/dist/settings.d.ts +9 -0
  95. package/dist/settings.js +21 -0
  96. package/dist/settings.js.map +1 -0
  97. package/dist/sync.d.ts +495 -0
  98. package/dist/sync.js +191 -0
  99. package/dist/sync.js.map +1 -0
  100. package/dist/telemetry-scrub.d.ts +13 -0
  101. package/dist/telemetry-scrub.js +51 -0
  102. package/dist/telemetry-scrub.js.map +1 -0
  103. package/dist/telemetry.d.ts +73 -0
  104. package/dist/telemetry.js +173 -0
  105. package/dist/telemetry.js.map +1 -0
  106. package/dist/walkthroughs.d.ts +224 -0
  107. package/dist/walkthroughs.js +109 -0
  108. package/dist/walkthroughs.js.map +1 -0
  109. package/dist/workspace.d.ts +14 -0
  110. package/dist/workspace.js +127 -0
  111. package/dist/workspace.js.map +1 -0
  112. package/dist/writer-agent.d.ts +21 -0
  113. package/dist/writer-agent.js +27 -0
  114. package/dist/writer-agent.js.map +1 -0
  115. package/dist/writer-entry.d.ts +171 -0
  116. package/dist/writer-entry.js +233 -0
  117. package/dist/writer-entry.js.map +1 -0
  118. package/dist/writing-style.d.ts +7 -0
  119. package/dist/writing-style.js +52 -0
  120. package/dist/writing-style.js.map +1 -0
  121. package/engine/SYNC.json +4 -0
  122. package/engine/VERSION +1 -0
  123. package/engine/detect-project/README.md +141 -0
  124. package/engine/detect-project/SKILL.md +1421 -0
  125. package/engine/detect-project/assets/desktop/desktop-frame.css +428 -0
  126. package/engine/detect-project/assets/game/game-frame.css +132 -0
  127. package/engine/detect-project/assets/macosui/LICENSE-puppertino.txt +21 -0
  128. package/engine/detect-project/assets/macosui/VERSIONS.txt +1 -0
  129. package/engine/detect-project/assets/macosui/fonts.css +15 -0
  130. package/engine/detect-project/assets/macosui/macos-frame.css +481 -0
  131. package/engine/detect-project/assets/macosui/puppertino.css +2153 -0
  132. package/engine/detect-project/assets/mobileui/LICENSE-fonts.txt +13 -0
  133. package/engine/detect-project/assets/mobileui/LICENSE-framework7.txt +52 -0
  134. package/engine/detect-project/assets/mobileui/VERSIONS.txt +6 -0
  135. package/engine/detect-project/assets/mobileui/device-frame.css +316 -0
  136. package/engine/detect-project/assets/mobileui/f7-color-theme.mjs +1345 -0
  137. package/engine/detect-project/assets/mobileui/f7-icons-names.json +1254 -0
  138. package/engine/detect-project/assets/mobileui/fonts.css +16 -0
  139. package/engine/detect-project/assets/mobileui/framework7-components.css +39 -0
  140. package/engine/detect-project/assets/mobileui/framework7-core.css +5245 -0
  141. package/engine/detect-project/assets/mobileui/icons.css +31 -0
  142. package/engine/detect-project/assets/mobileui/md3-defaults.css +89 -0
  143. package/engine/detect-project/assets/mobileui/platforms.json +46 -0
  144. package/engine/detect-project/assets/tailwind-fallback.css +1729 -0
  145. package/engine/detect-project/assets/webtui/LICENSE-webtui.txt +28 -0
  146. package/engine/detect-project/assets/webtui/VERSIONS.txt +7 -0
  147. package/engine/detect-project/assets/webtui/terminal-frame.css +195 -0
  148. package/engine/detect-project/assets/webtui/theme-catppuccin.css +1 -0
  149. package/engine/detect-project/assets/webtui/theme-everforest.css +1 -0
  150. package/engine/detect-project/assets/webtui/theme-gruvbox.css +1 -0
  151. package/engine/detect-project/assets/webtui/theme-nord.css +1 -0
  152. package/engine/detect-project/assets/webtui/theme-vitesse.css +1 -0
  153. package/engine/detect-project/assets/webtui/themes.json +37 -0
  154. package/engine/detect-project/assets/webtui/webtui-core.css +1 -0
  155. package/engine/detect-project/assets/win32ui/7css.css +2 -0
  156. package/engine/detect-project/assets/win32ui/LICENSE-7css.txt +21 -0
  157. package/engine/detect-project/assets/win32ui/VERSIONS.txt +1 -0
  158. package/engine/detect-project/assets/win32ui/win32-frame.css +278 -0
  159. package/engine/detect-project/package-lock.json +12 -0
  160. package/engine/detect-project/package.json +10 -0
  161. package/engine/detect-project/scripts/apply_runtime_profiles.js +313 -0
  162. package/engine/detect-project/scripts/check_css_health.js +412 -0
  163. package/engine/detect-project/scripts/check_project_map.js +150 -0
  164. package/engine/detect-project/scripts/check_runtime_coverage.js +311 -0
  165. package/engine/detect-project/scripts/check_runtime_recipe_quality.js +184 -0
  166. package/engine/detect-project/scripts/classify_app_type.sh +246 -0
  167. package/engine/detect-project/scripts/classify_surface.sh +95 -0
  168. package/engine/detect-project/scripts/classify_workspace.js +39 -0
  169. package/engine/detect-project/scripts/compile_css.sh +447 -0
  170. package/engine/detect-project/scripts/detect_static.js +645 -0
  171. package/engine/detect-project/scripts/detect_structure.js +187 -0
  172. package/engine/detect-project/scripts/include_census.js +451 -0
  173. package/engine/detect-project/scripts/json_get.js +142 -0
  174. package/engine/detect-project/scripts/merge_json.js +52 -0
  175. package/engine/detect-project/scripts/recommend_model_tier.js +252 -0
  176. package/engine/detect-project/scripts/resolve_route_chains.js +135 -0
  177. package/engine/detect-project/scripts/run_css_build.sh +40 -0
  178. package/engine/detect-project/scripts/sanitize_css.js +83 -0
  179. package/engine/detect-project/scripts/test_classify_surface.js +108 -0
  180. package/engine/detect-project/scripts/test_node_helpers.js +142 -0
  181. package/engine/detect-project/scripts/test_recommend_model_tier.js +119 -0
  182. package/engine/detect-project/scripts/test_resolve_route_chains.js +182 -0
  183. package/engine/detect-project/scripts/test_runtime_coverage.js +323 -0
  184. package/engine/detect-project/scripts/test_runtime_recipe_quality.js +187 -0
  185. package/engine/detect-project/scripts/theme_overrides.js +169 -0
  186. package/engine/detect-project/scripts/write_branding.js +129 -0
  187. package/engine/generate-illustrated-article/SKILL.md +461 -0
  188. package/engine/generate-illustrated-article/contracts/desktop.md +90 -0
  189. package/engine/generate-illustrated-article/contracts/game.md +38 -0
  190. package/engine/generate-illustrated-article/contracts/label-evidence.md +38 -0
  191. package/engine/generate-illustrated-article/contracts/macos.md +79 -0
  192. package/engine/generate-illustrated-article/contracts/mobile.md +40 -0
  193. package/engine/generate-illustrated-article/contracts/terminal.md +29 -0
  194. package/engine/generate-illustrated-article/contracts/win32.md +43 -0
  195. package/engine/generate-illustrated-article/package-lock.json +366 -0
  196. package/engine/generate-illustrated-article/package.json +15 -0
  197. package/engine/generate-illustrated-article/scripts/article_blocks.js +34 -0
  198. package/engine/generate-illustrated-article/scripts/check_article_json.js +105 -0
  199. package/engine/generate-illustrated-article/scripts/emit_walkthrough_signals.js +100 -0
  200. package/engine/generate-illustrated-article/scripts/extract_images.js +187 -0
  201. package/engine/generate-illustrated-article/scripts/generate_content_images.js +376 -0
  202. package/engine/generate-illustrated-article/scripts/include_census.js +451 -0
  203. package/engine/generate-illustrated-article/scripts/inject_assets.js +1691 -0
  204. package/engine/generate-illustrated-article/scripts/jit_mockup_css.js +191 -0
  205. package/engine/generate-illustrated-article/scripts/label_evidence.js +87 -0
  206. package/engine/generate-illustrated-article/scripts/lint_article_copy.js +252 -0
  207. package/engine/generate-illustrated-article/scripts/lint_mockup_fidelity.js +2403 -0
  208. package/engine/generate-illustrated-article/scripts/polish_tickets.js +1148 -0
  209. package/engine/generate-illustrated-article/scripts/related_repos.sh +52 -0
  210. package/engine/generate-illustrated-article/scripts/render_all.js +177 -0
  211. package/engine/generate-illustrated-article/scripts/render_mockup.js +665 -0
  212. package/engine/generate-illustrated-article/scripts/render_ready.js +164 -0
  213. package/engine/generate-illustrated-article/scripts/resolve_workspace.sh +86 -0
  214. package/engine/generate-illustrated-article/scripts/runtime_region_geometry.js +55 -0
  215. package/engine/generate-illustrated-article/scripts/source_paths.js +49 -0
  216. package/engine/generate-illustrated-article/scripts/test_control_visibility.js +30 -0
  217. package/engine/generate-illustrated-article/scripts/test_emit_walkthrough_signals.js +157 -0
  218. package/engine/generate-illustrated-article/scripts/test_generate_content_images.js +168 -0
  219. package/engine/generate-illustrated-article/scripts/test_include_census.js +126 -0
  220. package/engine/generate-illustrated-article/scripts/test_label_evidence.js +49 -0
  221. package/engine/generate-illustrated-article/scripts/test_lint_article_copy.js +138 -0
  222. package/engine/generate-illustrated-article/scripts/test_lint_mockup_fidelity.js +653 -0
  223. package/engine/generate-illustrated-article/scripts/test_node_ports.js +152 -0
  224. package/engine/generate-illustrated-article/scripts/test_polish_tickets.js +481 -0
  225. package/engine/generate-illustrated-article/scripts/test_related_repos.js +64 -0
  226. package/engine/generate-illustrated-article/scripts/test_render_ready.js +85 -0
  227. package/engine/generate-illustrated-article/scripts/test_source_paths.js +68 -0
  228. package/engine/generate-illustrated-article/scripts/trace_hook.js +79 -0
  229. package/engine/generate-illustrated-article/scripts/trace_hook.sh +4 -0
  230. package/engine/generate-illustrated-article/scripts/validate_html.js +114 -0
  231. package/engine/generate-illustrated-article/scripts/watermark.js +69 -0
  232. package/install.sh +14 -0
  233. package/package.json +57 -4
  234. package/scripts/auth.mjs +33 -0
  235. package/scripts/auto-update.mjs +7 -0
  236. package/scripts/build-plugin.mjs +58 -0
  237. package/scripts/build-release.mjs +94 -0
  238. package/scripts/check-release.mjs +40 -0
  239. package/scripts/check-runtime.mjs +10 -0
  240. package/scripts/cli.mjs +8 -0
  241. package/scripts/install.mjs +64 -0
  242. package/scripts/lib/agent-runner.mjs +181 -0
  243. package/scripts/lib/agent-settings.mjs +215 -0
  244. package/scripts/lib/article-skills.mjs +82 -0
  245. package/scripts/lib/auto-update.mjs +50 -0
  246. package/scripts/lib/brand.mjs +9 -0
  247. package/scripts/lib/browser.mjs +12 -0
  248. package/scripts/lib/claude-connection.mjs +33 -0
  249. package/scripts/lib/claude-permissions.mjs +47 -0
  250. package/scripts/lib/claude-plugin.mjs +15 -0
  251. package/scripts/lib/claude-writer.mjs +10 -0
  252. package/scripts/lib/cli-main.mjs +85 -0
  253. package/scripts/lib/cli.mjs +888 -0
  254. package/scripts/lib/codex-config.mjs +51 -0
  255. package/scripts/lib/codex-integration.mjs +61 -0
  256. package/scripts/lib/codex-skill.mjs +34 -0
  257. package/scripts/lib/harness-models.mjs +109 -0
  258. package/scripts/lib/install.mjs +269 -0
  259. package/scripts/lib/managed-writer.mjs +38 -0
  260. package/scripts/lib/planning.mjs +263 -0
  261. package/scripts/lib/prepare-update.mjs +85 -0
  262. package/scripts/lib/refresh-writers.mjs +12 -0
  263. package/scripts/lib/remove.mjs +167 -0
  264. package/scripts/lib/renderer.mjs +34 -0
  265. package/scripts/lib/terminal.mjs +252 -0
  266. package/scripts/lib/uninit.mjs +72 -0
  267. package/scripts/lib/update.mjs +55 -0
  268. package/scripts/lib/writer-recovery.mjs +35 -0
  269. package/scripts/lib/yolo.mjs +362 -0
  270. package/scripts/plugin-session.mjs +65 -0
  271. package/scripts/prepare-update.mjs +12 -0
  272. package/scripts/publish-release.mjs +92 -0
  273. package/scripts/skills/supportpages/SKILL.md +120 -0
  274. package/scripts/smoke-release.mjs +101 -0
  275. package/server.json +27 -0
@@ -0,0 +1,313 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Deterministically enrich well-known runtime applications whose built UI is
5
+ // not present in the checkout. Profiles provide stable chrome anatomy; repo
6
+ // evidence still supplies the active/default content, labels, and assets.
7
+ //
8
+ // Usage:
9
+ // node apply_runtime_profiles.js <project_map.json> <project_dir> [--json report.json]
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ function fail(message) {
15
+ console.error(`ERROR: ${message}`);
16
+ process.exit(2);
17
+ }
18
+
19
+ const [mapArg, projectArg] = process.argv.slice(2);
20
+ const jsonIndex = process.argv.indexOf('--json');
21
+ const reportArg = jsonIndex >= 0 ? process.argv[jsonIndex + 1] : null;
22
+ if (!mapArg || !projectArg) fail('usage: apply_runtime_profiles.js <project_map.json> <project_dir> [--json report.json]');
23
+
24
+ const mapPath = path.resolve(mapArg);
25
+ const projectDir = path.resolve(projectArg);
26
+ let projectMap;
27
+ try {
28
+ projectMap = JSON.parse(fs.readFileSync(mapPath, 'utf8'));
29
+ } catch (error) {
30
+ fail(`cannot read project map: ${error.message}`);
31
+ }
32
+
33
+ function relFile(rel) {
34
+ if (typeof rel !== 'string' || !rel.trim()) return null;
35
+ const clean = rel.replace(/^\.\//, '').split(/[?#]/, 1)[0];
36
+ const absolute = path.resolve(projectDir, clean);
37
+ const root = `${projectDir}${path.sep}`;
38
+ if (!absolute.startsWith(root)) return null;
39
+ try {
40
+ if (!fs.statSync(absolute).isFile()) return null;
41
+ } catch (_) {
42
+ return null;
43
+ }
44
+ return path.relative(projectDir, absolute).split(path.sep).join('/');
45
+ }
46
+
47
+ function read(rel) {
48
+ const file = relFile(rel);
49
+ if (!file) return '';
50
+ try { return fs.readFileSync(path.join(projectDir, file), 'utf8'); } catch (_) { return ''; }
51
+ }
52
+
53
+ function existing(values) {
54
+ return [...new Set(values.map(relFile).filter(Boolean))];
55
+ }
56
+
57
+ function titleFromSlug(slug) {
58
+ return String(slug || '').split(/[-_]/).filter(Boolean)
59
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
60
+ }
61
+
62
+ function profileWordPressSiteEditor() {
63
+ const mount = relFile('src/wp-admin/site-editor.php');
64
+ if (!mount) return null;
65
+ const layouts = Array.isArray(projectMap.layouts) ? projectMap.layouts : [];
66
+ let layout = layouts.find(item => item && (
67
+ relFile(item.path) === mount || item.name === 'site-editor'
68
+ || /site editor/i.test(String(item.area || ''))));
69
+ if (!layout) {
70
+ layout = { name: 'site-editor', path: mount, area: 'WordPress Site Editor', chrome: [] };
71
+ layouts.push(layout);
72
+ projectMap.layouts = layouts;
73
+ }
74
+
75
+ const constants = read('src/wp-includes/default-constants.php');
76
+ const themeSlug = (constants.match(/define\(\s*['"]WP_DEFAULT_THEME['"]\s*,\s*['"]([^'"]+)['"]\s*\)/) || [])[1];
77
+ if (!themeSlug) return { id: 'wordpress-site-editor', applied: false, reason: 'WP_DEFAULT_THEME was not resolved' };
78
+ const themeRoot = `src/wp-content/themes/${themeSlug}`;
79
+ const home = relFile(`${themeRoot}/templates/home.html`);
80
+ if (!home) return { id: 'wordpress-site-editor', applied: false, reason: `default theme ${themeSlug} has no templates/home.html` };
81
+
82
+ const style = read(`${themeRoot}/style.css`);
83
+ const themeName = ((style.match(/^\s*Theme Name:\s*(.+?)\s*$/mi) || [])[1] || titleFromSlug(themeSlug)).trim();
84
+ const templateUtils = relFile('src/wp-includes/block-template-utils.php');
85
+ const templateUtilsText = read('src/wp-includes/block-template-utils.php');
86
+ const homeTemplateBlock = (templateUtilsText.match(/['"]home['"]\s*=>\s*array\s*\([\s\S]{0,1600}?\n\s*\),/) || [])[0] || '';
87
+ const templateTitle = ((homeTemplateBlock.match(/['"]title['"]\s*=>\s*_x\(\s*['"]([^'"]+)['"]\s*,\s*['"]Template name['"]/) || [])[1] || 'Blog Home').trim();
88
+ const templateDescription = ((homeTemplateBlock.match(/['"]description['"]\s*=>\s*__\(\s*['"]([^'"]*latest posts[^'"]*)['"]/) || [])[1]
89
+ || 'Displays the latest posts').trim();
90
+
91
+ const themeSources = existing([
92
+ `${themeRoot}/templates/home.html`,
93
+ `${themeRoot}/parts/header.html`,
94
+ `${themeRoot}/parts/footer.html`,
95
+ `${themeRoot}/patterns/header.php`,
96
+ `${themeRoot}/patterns/footer.php`,
97
+ `${themeRoot}/patterns/hidden-blog-heading.php`,
98
+ `${themeRoot}/patterns/template-query-loop.php`,
99
+ `${themeRoot}/theme.json`,
100
+ 'src/wp-includes/block-template-utils.php',
101
+ ]);
102
+ const canvasSources = existing([
103
+ `${themeRoot}/templates/home.html`,
104
+ `${themeRoot}/parts/header.html`,
105
+ `${themeRoot}/parts/footer.html`,
106
+ `${themeRoot}/patterns/header.php`,
107
+ `${themeRoot}/patterns/footer.php`,
108
+ `${themeRoot}/patterns/template-query-loop.php`,
109
+ ]);
110
+ const preferredAssets = existing([
111
+ `${themeRoot}/assets/images/botany-flowers.webp`,
112
+ `${themeRoot}/assets/images/category-sunflowers.webp`,
113
+ ]);
114
+ if (!preferredAssets.length) {
115
+ const assetRoot = path.join(projectDir, themeRoot, 'assets/images');
116
+ try {
117
+ for (const name of fs.readdirSync(assetRoot).sort()) {
118
+ const asset = relFile(`${themeRoot}/assets/images/${name}`);
119
+ if (asset && /\.(?:avif|jpe?g|png|webp)$/i.test(asset)) preferredAssets.push(asset);
120
+ if (preferredAssets.length === 2) break;
121
+ }
122
+ } catch (_) { /* an image-free theme is valid */ }
123
+ }
124
+
125
+ const chromeSource = [mount];
126
+ const contentSources = existing([...canvasSources, templateUtils]);
127
+ const stateSources = existing([...contentSources]);
128
+ layout.name = 'site-editor';
129
+ layout.path = mount;
130
+ layout.area = 'site editor (Appearance > Editor) for block themes; fullscreen runtime app with no classic admin menu or toolbar';
131
+ layout.chrome = [];
132
+ layout.root_classes = {
133
+ html: [],
134
+ body: ['wp-admin', 'wp-core-ui', 'js', 'site-editor-php', 'is-fullscreen-mode', 'admin-color-modern'],
135
+ };
136
+ layout.runtime_chrome = {
137
+ app: 'WordPress Site Editor (Gutenberg @wordpress/edit-site app)',
138
+ mode_note: 'Always fullscreen: the runtime app replaces the classic admin menu and toolbar with its own editor chrome.',
139
+ source_kind: 'knowledge',
140
+ source: 'Stable Gutenberg Site Editor chrome profile, grounded to the repo mount, default-theme template chain, core template metadata, and bundled theme assets because the built @wordpress/edit-site package is not committed in this source checkout.',
141
+ source_files: chromeSource,
142
+ regions: [
143
+ {
144
+ id: 'navigation', region: 'design navigation sidebar', placement: 'left', required: false,
145
+ appearance: 'dark #1e1e1e sidebar occupying about one quarter of the viewport on a matching dark workspace; compact unboxed rows with chevrons beside a floating white framed site preview',
146
+ items: [
147
+ { id: 'identity', kind: 'identity', description: 'site icon, concrete site title, and back-to-dashboard affordance', required_strings: [] },
148
+ { id: 'destinations', kind: 'navigation-list', description: 'complete ordered design destinations with chevrons', required_strings: ['Navigation', 'Styles', 'Pages', 'Templates', 'Patterns'] },
149
+ ],
150
+ ui_strings: ['Design', 'Navigation', 'Styles', 'Pages', 'Templates', 'Patterns'],
151
+ required_strings: ['Styles', 'Templates', 'Patterns'], source_files: chromeSource,
152
+ },
153
+ {
154
+ id: 'toolbar', region: 'editing toolbar', placement: 'top', required: false,
155
+ appearance: 'light compact full-width Gutenberg toolbar with the WordPress W identity at left, complete icon tool groups, centered document context, and blue Save action at right',
156
+ items: [
157
+ { id: 'back-identity', kind: 'identity', description: 'WordPress W identity button returning to the Site Editor', required_strings: [] },
158
+ { id: 'inserter-tools', kind: 'control-group', description: 'block inserter plus editing-mode/tools controls', required_strings: [] },
159
+ { id: 'history-tools', kind: 'control-group', description: 'undo and redo icon controls', required_strings: [] },
160
+ { id: 'document-overview', kind: 'control-group', description: 'document overview and list-view icon controls', required_strings: [] },
161
+ { id: 'document-title', kind: 'document-context', description: `open template title (${templateTitle}), never a generic feature name`, required_strings: [templateTitle] },
162
+ { id: 'view-options', kind: 'control-group', description: 'preview/device, settings, styles, and more-options icon controls', required_strings: [] },
163
+ { id: 'primary-action', kind: 'primary-action', description: 'emphasized blue primary Save action', required_strings: ['Save'] },
164
+ ],
165
+ ui_strings: ['Save', templateTitle], required_strings: ['Save', templateTitle], source_files: chromeSource,
166
+ },
167
+ {
168
+ id: 'canvas', region: 'site preview and editing canvas', placement: 'canvas', required: true,
169
+ appearance: `largest white #fff region rendering the ${themeName} ${templateTitle} template with a real header, populated post query, imagery, and footer; never a blank card or skeleton`,
170
+ content_mode: 'populated', media_expectation: preferredAssets.length ? 'required' : 'optional',
171
+ max_selected_outlines: 1, representative_assets: preferredAssets,
172
+ items: [
173
+ { id: 'header', kind: 'content-section', description: 'real site header template part with site title at left and horizontal navigation at right', required_strings: [] },
174
+ { id: 'main-content', kind: 'content-section', description: 'populated recent-post query loop with heading, image, title, excerpt, and date', required_strings: [] },
175
+ { id: 'footer', kind: 'content-section', description: 'real footer template part with the WordPress credit', required_strings: ['Designed with WordPress'] },
176
+ ],
177
+ ui_strings: ['Designed with WordPress'], required_strings: ['Designed with WordPress'], source_files: canvasSources,
178
+ },
179
+ {
180
+ id: 'styles-inspector', region: 'styles inspector', placement: 'right', required: false,
181
+ appearance: 'light right sidebar separated from the white canvas by a border; Styles heading, Aa and colour-dot preview tile, then flat icon rows rather than generic cards',
182
+ items: [
183
+ { id: 'heading-tools', kind: 'panel-heading', description: 'Styles heading with revisions and style-book tools', required_strings: ['Styles'] },
184
+ { id: 'style-preview', kind: 'visual-preview', description: 'large Aa typography preview with the active palette shown as colour dots', required_strings: ['Aa'] },
185
+ { id: 'browse-styles', kind: 'action-card', description: 'style variation browser row', required_strings: ['Browse styles'] },
186
+ { id: 'typography', kind: 'panel-row', description: 'Typography settings row with its icon and chevron', required_strings: ['Typography'] },
187
+ { id: 'colors', kind: 'panel-row', description: 'Colors settings row with its icon and chevron', required_strings: ['Colors'] },
188
+ { id: 'background', kind: 'panel-row', description: 'Background settings row with its icon and chevron', required_strings: ['Background'] },
189
+ { id: 'shadows', kind: 'panel-row', description: 'Shadows settings row with its icon and chevron', required_strings: ['Shadows'] },
190
+ { id: 'layout', kind: 'panel-row', description: 'Layout settings row with its icon and chevron', required_strings: ['Layout'] },
191
+ ],
192
+ ui_strings: ['Styles', 'Aa', 'Browse styles', 'Typography', 'Colors', 'Background', 'Shadows', 'Layout'],
193
+ required_strings: ['Styles', 'Aa', 'Browse styles', 'Typography', 'Colors'], source_files: chromeSource,
194
+ },
195
+ {
196
+ id: 'template-inspector', region: 'template inspector', placement: 'right', required: false,
197
+ appearance: 'light right sidebar separated from the canvas by a border; Template and Block tabs above template summary and area rows',
198
+ items: [
199
+ { id: 'tabs', kind: 'tabs', description: 'Template and Block inspector tabs', required_strings: ['Template', 'Block'] },
200
+ { id: 'template-summary', kind: 'settings-list', description: `${templateTitle} template name and its source-backed description`, required_strings: [templateTitle, 'Displays the latest posts'] },
201
+ { id: 'header-area', kind: 'panel-row', description: 'Header template-part area row', required_strings: ['Header'] },
202
+ { id: 'footer-area', kind: 'panel-row', description: 'Footer template-part area row', required_strings: ['Footer'] },
203
+ ],
204
+ ui_strings: ['Template', 'Block', templateTitle, 'Header', 'Footer'], required_strings: ['Template', 'Block', templateTitle],
205
+ source_files: existing([mount, templateUtils]),
206
+ },
207
+ {
208
+ id: 'confirm', region: 'save confirmation panel', placement: 'overlay-right', required: false,
209
+ appearance: 'light right-side panel over the still-visible undimmed editing canvas; heading, explanatory copy, grouped checked entity rows, and actions anchored at the bottom',
210
+ items: [
211
+ { id: 'heading-close', kind: 'panel-heading', description: 'confirmation heading and close affordance', required_strings: ['Are you ready to save?'] },
212
+ { id: 'explanation', kind: 'supporting-copy', description: 'explanation of the pending changes', required_strings: ['The following changes have been made to your site, templates, and content.'] },
213
+ { id: 'styles-group', kind: 'group-heading', description: 'Styles entity group heading', required_strings: ['Styles'] },
214
+ { id: 'styles-change', kind: 'selection-row', description: 'checked row for the edited global styles and concrete theme name', required_strings: [themeName] },
215
+ { id: 'templates-group', kind: 'group-heading', description: 'Templates entity group heading', required_strings: ['Templates'] },
216
+ { id: 'template-change', kind: 'selection-row', description: `checked row for ${templateTitle} with its template description`, required_strings: [templateTitle, 'Displays the latest posts'] },
217
+ { id: 'footer-actions', kind: 'actions', description: 'anchored secondary Cancel and blue primary Save actions', required_strings: ['Cancel', 'Save'] },
218
+ ],
219
+ ui_strings: ['Are you ready to save?', 'Styles', themeName, 'Templates', templateTitle, 'Displays the latest posts', 'Cancel', 'Save'],
220
+ required_strings: ['Are you ready to save?', themeName, templateTitle, 'Cancel', 'Save'], source_files: chromeSource,
221
+ },
222
+ ],
223
+ states: [
224
+ {
225
+ id: 'overview', name: 'overview', kind: 'overview', topic_tags: ['open', 'navigate', 'site editor', 'design'],
226
+ instructional_priority: 'orientation', screenshot_required: false,
227
+ canvas_presentation: 'dark full-height workspace with the near-black Design navigation at left and a large floating white framed live site preview',
228
+ entered_by: 'open Appearance > Editor in wp-admin',
229
+ shows: `dark Design navigation beside a populated scaled preview of the ${templateTitle} template`,
230
+ visible_regions: ['navigation', 'canvas'], required_regions: [],
231
+ required_strings: ['Styles', 'Templates', 'Designed with WordPress'], source_files: stateSources,
232
+ },
233
+ {
234
+ id: 'styles-editing', name: 'editing visual styles', kind: 'action', topic_tags: ['styles', 'design', 'colors', 'typography'],
235
+ instructional_priority: 'primary-action', context_label: templateTitle, screenshot_required: false,
236
+ canvas_presentation: `full white editing canvas showing the populated ${templateTitle} template with style changes previewed live`,
237
+ entered_by: 'choose Styles in the Design navigation',
238
+ shows: `the complete Gutenberg toolbar and Styles inspector, including the Aa palette preview and every settings row, beside the populated ${templateTitle} canvas`,
239
+ visible_regions: ['toolbar', 'canvas', 'styles-inspector'], required_regions: ['toolbar', 'styles-inspector'],
240
+ required_strings: ['Save', templateTitle, 'Aa', 'Browse styles', 'Colors'], source_files: stateSources,
241
+ },
242
+ {
243
+ id: 'template-editing', name: 'editing a template', kind: 'action', topic_tags: ['template', 'layout', 'structure', 'edit'],
244
+ instructional_priority: 'secondary-action', context_label: templateTitle, screenshot_required: false,
245
+ canvas_presentation: `full white editing canvas with the populated ${templateTitle} template open for block-level editing`,
246
+ entered_by: `open Templates in the navigation and choose ${templateTitle}`,
247
+ shows: `the complete Gutenberg toolbar and Template inspector beside the populated ${templateTitle} canvas`,
248
+ visible_regions: ['toolbar', 'canvas', 'template-inspector'], required_regions: ['toolbar', 'template-inspector'],
249
+ required_strings: ['Save', templateTitle, 'Template', 'Block'], source_files: stateSources,
250
+ },
251
+ {
252
+ id: 'confirm-save', name: 'confirm save', kind: 'confirm', topic_tags: ['save', 'confirm', 'apply changes'],
253
+ instructional_priority: 'terminal-action', context_label: templateTitle, screenshot_required: true,
254
+ canvas_presentation: 'the preceding populated white editing canvas and complete toolbar remain undimmed and visible beneath the right-side save panel',
255
+ entered_by: 'press Save in the toolbar',
256
+ shows: `the save panel with explanatory copy, checked Styles/${themeName} and Templates/${templateTitle} groups, template subtitle, Cancel, and Save`,
257
+ visible_regions: ['toolbar', 'canvas', 'confirm'], required_regions: ['confirm'],
258
+ required_strings: [templateTitle, 'Are you ready to save?', themeName, 'Displays the latest posts', 'Cancel', 'Save'], source_files: stateSources,
259
+ },
260
+ ],
261
+ };
262
+
263
+ const routes = projectMap.route_index && typeof projectMap.route_index === 'object' ? projectMap.route_index : {};
264
+ let routeKey = Object.keys(routes).find(key => {
265
+ const route = routes[key];
266
+ return route && (route.path === '/wp-admin/site-editor.php' || relFile(route.primary_view) === mount || key === 'site-editor');
267
+ });
268
+ if (!routeKey) routeKey = 'site-editor';
269
+ routes[routeKey] = {
270
+ ...(routes[routeKey] || {}), method: 'GET', path: '/wp-admin/site-editor.php',
271
+ controller: mount, primary_view: mount, layout: 'site-editor', controller_action: mount,
272
+ partials_expanded: themeSources,
273
+ };
274
+ projectMap.route_index = routes;
275
+
276
+ const assumptions = new Set(Array.isArray(projectMap.default_user_assumptions)
277
+ ? projectMap.default_user_assumptions.filter(value => typeof value === 'string') : []);
278
+ assumptions.add('JavaScript enabled: no-JS fallback notices never render');
279
+ assumptions.add('No plugins active, so plugin-registered editor panels, notices, and patterns do not render');
280
+ assumptions.add(`Default ${themeName} block theme active on a single-site, non-multisite install`);
281
+ projectMap.default_user_assumptions = [...assumptions];
282
+
283
+ return {
284
+ id: 'wordpress-site-editor', applied: true, layout: 'site-editor', mount,
285
+ theme_slug: themeSlug, theme_name: themeName, template_title: templateTitle,
286
+ route_sources: themeSources.length, canvas_sources: canvasSources.length,
287
+ representative_assets: preferredAssets,
288
+ };
289
+ }
290
+
291
+ const profiles = [profileWordPressSiteEditor];
292
+ const results = profiles.map(profile => profile()).filter(Boolean);
293
+ if (results.some(item => item && item.id === 'wordpress-site-editor' && item.applied)) {
294
+ for (const layout of Array.isArray(projectMap.layouts) ? projectMap.layouts : []) {
295
+ if (!layout || !layout.runtime_chrome || !layout.root_classes) continue;
296
+ const mode = `${layout.area || ''} ${layout.runtime_chrome.mode_note || ''}`;
297
+ if (!/fullscreen|full-screen|(?:menu|toolbar|admin bar)[^.;]{0,30}hidden/i.test(mode)) continue;
298
+ const html = Array.isArray(layout.root_classes.html) ? layout.root_classes.html : [];
299
+ layout.root_classes.html = html.filter(token => !/^(?:wp-)?toolbar$|admin-?bar/i.test(token));
300
+ }
301
+ }
302
+ fs.writeFileSync(mapPath, `${JSON.stringify(projectMap, null, 2)}\n`);
303
+ const report = { checked: true, applied: results.filter(item => item.applied), skipped: results.filter(item => !item.applied) };
304
+ if (reportArg) {
305
+ const reportPath = path.resolve(reportArg);
306
+ fs.mkdirSync(path.dirname(reportPath), { recursive: true });
307
+ fs.writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`);
308
+ }
309
+ if (report.applied.length) {
310
+ console.log(`Runtime profiles: applied ${report.applied.map(item => item.id).join(', ')}`);
311
+ } else {
312
+ console.log('Runtime profiles: no matching profile');
313
+ }