@agimon-ai/doompi-build 0.0.1-alpha.2

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 (140) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +82 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist/browserFile.cjs +1 -0
  5. package/dist/browserFile.d.cts +2 -0
  6. package/dist/browserFile.d.mts +2 -0
  7. package/dist/browserFile.mjs +1 -0
  8. package/dist/constants/contributions.cjs +2 -0
  9. package/dist/constants/contributions.cjs.map +1 -0
  10. package/dist/constants/contributions.mjs +2 -0
  11. package/dist/constants/contributions.mjs.map +1 -0
  12. package/dist/constants/layout.cjs +2 -0
  13. package/dist/constants/layout.cjs.map +1 -0
  14. package/dist/constants/layout.d.cts +59 -0
  15. package/dist/constants/layout.d.cts.map +1 -0
  16. package/dist/constants/layout.d.mts +59 -0
  17. package/dist/constants/layout.d.mts.map +1 -0
  18. package/dist/constants/layout.mjs +2 -0
  19. package/dist/constants/layout.mjs.map +1 -0
  20. package/dist/index.cjs +1 -0
  21. package/dist/index.d.cts +16 -0
  22. package/dist/index.d.mts +16 -0
  23. package/dist/index.mjs +1 -0
  24. package/dist/services/browserFile/index.cjs +2 -0
  25. package/dist/services/browserFile/index.cjs.map +1 -0
  26. package/dist/services/browserFile/index.d.cts +28 -0
  27. package/dist/services/browserFile/index.d.cts.map +1 -0
  28. package/dist/services/browserFile/index.d.mts +28 -0
  29. package/dist/services/browserFile/index.d.mts.map +1 -0
  30. package/dist/services/browserFile/index.mjs +2 -0
  31. package/dist/services/browserFile/index.mjs.map +1 -0
  32. package/dist/services/filename/index.cjs +2 -0
  33. package/dist/services/filename/index.cjs.map +1 -0
  34. package/dist/services/filename/index.d.cts +29 -0
  35. package/dist/services/filename/index.d.cts.map +1 -0
  36. package/dist/services/filename/index.d.mts +29 -0
  37. package/dist/services/filename/index.d.mts.map +1 -0
  38. package/dist/services/filename/index.mjs +2 -0
  39. package/dist/services/filename/index.mjs.map +1 -0
  40. package/dist/services/generate/index.cjs +2 -0
  41. package/dist/services/generate/index.cjs.map +1 -0
  42. package/dist/services/generate/index.d.cts +15 -0
  43. package/dist/services/generate/index.d.cts.map +1 -0
  44. package/dist/services/generate/index.d.mts +15 -0
  45. package/dist/services/generate/index.d.mts.map +1 -0
  46. package/dist/services/generate/index.mjs +2 -0
  47. package/dist/services/generate/index.mjs.map +1 -0
  48. package/dist/services/generate/type.d.cts +26 -0
  49. package/dist/services/generate/type.d.cts.map +1 -0
  50. package/dist/services/generate/type.d.mts +26 -0
  51. package/dist/services/generate/type.d.mts.map +1 -0
  52. package/dist/services/identity/index.cjs +2 -0
  53. package/dist/services/identity/index.cjs.map +1 -0
  54. package/dist/services/identity/index.mjs +2 -0
  55. package/dist/services/identity/index.mjs.map +1 -0
  56. package/dist/services/renderClient/index.cjs +3 -0
  57. package/dist/services/renderClient/index.cjs.map +1 -0
  58. package/dist/services/renderClient/index.mjs +3 -0
  59. package/dist/services/renderClient/index.mjs.map +1 -0
  60. package/dist/services/renderEntry/index.cjs +7 -0
  61. package/dist/services/renderEntry/index.cjs.map +1 -0
  62. package/dist/services/renderEntry/index.d.cts +24 -0
  63. package/dist/services/renderEntry/index.d.cts.map +1 -0
  64. package/dist/services/renderEntry/index.d.mts +24 -0
  65. package/dist/services/renderEntry/index.d.mts.map +1 -0
  66. package/dist/services/renderEntry/index.mjs +7 -0
  67. package/dist/services/renderEntry/index.mjs.map +1 -0
  68. package/dist/services/renderEntry/type.d.cts +14 -0
  69. package/dist/services/renderEntry/type.d.cts.map +1 -0
  70. package/dist/services/renderEntry/type.d.mts +14 -0
  71. package/dist/services/renderEntry/type.d.mts.map +1 -0
  72. package/dist/services/resolveTarget/index.cjs +2 -0
  73. package/dist/services/resolveTarget/index.cjs.map +1 -0
  74. package/dist/services/resolveTarget/index.d.cts +16 -0
  75. package/dist/services/resolveTarget/index.d.cts.map +1 -0
  76. package/dist/services/resolveTarget/index.d.mts +16 -0
  77. package/dist/services/resolveTarget/index.d.mts.map +1 -0
  78. package/dist/services/resolveTarget/index.mjs +2 -0
  79. package/dist/services/resolveTarget/index.mjs.map +1 -0
  80. package/dist/services/resolveTarget/type.d.cts +34 -0
  81. package/dist/services/resolveTarget/type.d.cts.map +1 -0
  82. package/dist/services/resolveTarget/type.d.mts +34 -0
  83. package/dist/services/resolveTarget/type.d.mts.map +1 -0
  84. package/dist/services/scan/index.cjs +2 -0
  85. package/dist/services/scan/index.cjs.map +1 -0
  86. package/dist/services/scan/index.d.cts +19 -0
  87. package/dist/services/scan/index.d.cts.map +1 -0
  88. package/dist/services/scan/index.d.mts +19 -0
  89. package/dist/services/scan/index.d.mts.map +1 -0
  90. package/dist/services/scan/index.mjs +2 -0
  91. package/dist/services/scan/index.mjs.map +1 -0
  92. package/dist/services/scan/type.d.cts +25 -0
  93. package/dist/services/scan/type.d.cts.map +1 -0
  94. package/dist/services/scan/type.d.mts +25 -0
  95. package/dist/services/scan/type.d.mts.map +1 -0
  96. package/dist/services/segments/index.cjs +2 -0
  97. package/dist/services/segments/index.cjs.map +1 -0
  98. package/dist/services/segments/index.d.cts +26 -0
  99. package/dist/services/segments/index.d.cts.map +1 -0
  100. package/dist/services/segments/index.d.mts +26 -0
  101. package/dist/services/segments/index.d.mts.map +1 -0
  102. package/dist/services/segments/index.mjs +2 -0
  103. package/dist/services/segments/index.mjs.map +1 -0
  104. package/dist/services/syncManifest/index.cjs +2 -0
  105. package/dist/services/syncManifest/index.cjs.map +1 -0
  106. package/dist/services/syncManifest/index.d.cts +21 -0
  107. package/dist/services/syncManifest/index.d.cts.map +1 -0
  108. package/dist/services/syncManifest/index.d.mts +21 -0
  109. package/dist/services/syncManifest/index.d.mts.map +1 -0
  110. package/dist/services/syncManifest/index.mjs +2 -0
  111. package/dist/services/syncManifest/index.mjs.map +1 -0
  112. package/dist/services/syncManifest/type.d.cts +15 -0
  113. package/dist/services/syncManifest/type.d.cts.map +1 -0
  114. package/dist/services/syncManifest/type.d.mts +15 -0
  115. package/dist/services/syncManifest/type.d.mts.map +1 -0
  116. package/dist/services/tsdownPreset/index.cjs +2 -0
  117. package/dist/services/tsdownPreset/index.cjs.map +1 -0
  118. package/dist/services/tsdownPreset/index.d.cts +63 -0
  119. package/dist/services/tsdownPreset/index.d.cts.map +1 -0
  120. package/dist/services/tsdownPreset/index.d.mts +63 -0
  121. package/dist/services/tsdownPreset/index.d.mts.map +1 -0
  122. package/dist/services/tsdownPreset/index.mjs +2 -0
  123. package/dist/services/tsdownPreset/index.mjs.map +1 -0
  124. package/dist/services/writeGenerated/index.cjs +2 -0
  125. package/dist/services/writeGenerated/index.cjs.map +1 -0
  126. package/dist/services/writeGenerated/index.d.cts +23 -0
  127. package/dist/services/writeGenerated/index.d.cts.map +1 -0
  128. package/dist/services/writeGenerated/index.d.mts +23 -0
  129. package/dist/services/writeGenerated/index.d.mts.map +1 -0
  130. package/dist/services/writeGenerated/index.mjs +2 -0
  131. package/dist/services/writeGenerated/index.mjs.map +1 -0
  132. package/dist/tsdown.cjs +1 -0
  133. package/dist/tsdown.d.cts +2 -0
  134. package/dist/tsdown.d.mts +2 -0
  135. package/dist/tsdown.mjs +1 -0
  136. package/dist/types/extensionGraph.d.cts +75 -0
  137. package/dist/types/extensionGraph.d.cts.map +1 -0
  138. package/dist/types/extensionGraph.d.mts +75 -0
  139. package/dist/types/extensionGraph.d.mts.map +1 -0
  140. package/package.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vuong Ngo
4
+ Copyright (c) 2026 pulseaiclub
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @agimon-ai/doompi-build
2
+
3
+ Folder-convention scanner and build presets for DoomPi extensions.
4
+
5
+ An extension declares what it contributes by where its files sit. This package reads that tree and hands the result to the generators and bundler presets, so a package keeps no parallel registry of its own contents.
6
+
7
+ See [Extension layout](../../../docs/extension-layout.md) for the convention and [Extension lifecycles](../../../docs/lifecycles.md) for what happens to a contribution once mounted.
8
+
9
+ ## Scanning
10
+
11
+ ```ts
12
+ import { scanExtensions } from '@agimon-ai/doompi-build';
13
+
14
+ const graph = scanExtensions({ packageDir: process.cwd() });
15
+ for (const entry of graph.entries) console.log(entry.scope, entry.side, entry.surface, entry.name);
16
+ for (const notice of graph.notices) console.warn(notice.path, notice.message);
17
+ ```
18
+
19
+ The scan is filesystem in, data out. It walks directories rather than globbing, which is what keeps parenthesised group folders safe: tsdown's globber reads a bare `(name)` as an extglob group, and a walk never sees a pattern at all.
20
+
21
+ Nothing throws. A folder the convention does not recognise becomes a notice and its subtree is skipped, so one bad directory never costs a package its other contributions.
22
+
23
+ ## What a path declares
24
+
25
+ ```text
26
+ src/extensions/<scope>/(side)/<surface>/<name>[.<target>][.<platform>].<ext>
27
+ ```
28
+
29
+ | Axis | Read from |
30
+ | -------- | ------------------------------------------------------------------ |
31
+ | scope | `workspaces/` and `sessions/` nesting below the root |
32
+ | side | the `(backend)` or `(frontend)` group folder |
33
+ | gate | a `mode/<id>/` or `domain/<id>/` container folder |
34
+ | surface | the folder directly holding the file, such as `tool/` |
35
+ | route | folders below a routed surface, with `[param]` and `[...catchAll]` |
36
+ | name | the first filename segment |
37
+ | target | filename segments between the name and the platform |
38
+ | platform | a trailing filename segment naming a platform for that side |
39
+
40
+ `_private` folders are never scanned. `*.test.*`, `*.spec.*` and `*.stories.*` are excluded everywhere.
41
+
42
+ ## Options
43
+
44
+ Every name in the convention is configurable, and the defaults are the documented ones.
45
+
46
+ ```ts
47
+ scanExtensions({
48
+ packageDir,
49
+ root: 'src/extensions',
50
+ sides: { backend: 'backend', frontend: 'frontend' },
51
+ platforms: { backend: ['cli', 'server'], frontend: ['cli', 'web', 'ios', 'android', 'desktop'] },
52
+ generatedEntries: ['pi', 'server', 'web'],
53
+ });
54
+ ```
55
+
56
+ ## Generating
57
+
58
+ `generateExtension` scans the authored tree, renders an entry for each host it contributes to, and writes build inputs beneath ignored `generated/`. A target with no contributions produces no entry, and removing a target deletes its obsolete generated entry.
59
+
60
+ ```ts
61
+ import { generateExtension } from '@agimon-ai/doompi-build';
62
+
63
+ const { targets, changed, notices } = generateExtension({ packageDir });
64
+ ```
65
+
66
+ Normal builds generate missing or stale entries, including in CI. Pass `check: true` only for an explicit write-free freshness check. Generated files are disposable build output and are not committed.
67
+
68
+ ## The tsdown preset
69
+
70
+ ```ts
71
+ // tsdown.config.ts, the whole file
72
+ import { doompiExtension } from '@agimon-ai/doompi-build/tsdown';
73
+ import { defineConfig } from 'tsdown';
74
+
75
+ export default defineConfig(doompiExtension());
76
+ ```
77
+
78
+ The preset generates entries while the config loads because tsdown needs its entry map before building. It builds Node host entries and public `src/exports` modules, then bundles routed frontend contributions separately to `dist/extensions/web.mjs`. The browser bundle keeps bare package imports external so the cockpit supplies shared React and store singletons. It also emits local `?url` assets and `?worker&url` worker chunks.
79
+
80
+ The build synchronizes `pi`, `doompiServer`, `doompiWeb`, and generated host exports in `package.json`. Keep package-specific public entries with the preset `entry` option, use `exportsDir` for a nonstandard public-export root, and set `pluginId` when the historical cockpit id differs from the package-derived default.
81
+
82
+ Packages with a frontend target typecheck it through a root `tsconfig.web.json`. Include `generated` in the Node project, exclude routed `(frontend)` files from it, and include those files plus `generated/web.ts` in the browser project.
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));exports.__toESM=s;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/browserFile/index.cjs");exports.isBrowserFile=e.isBrowserFile;
@@ -0,0 +1,2 @@
1
+ import { isBrowserFile } from "./services/browserFile/index.cjs";
2
+ export { isBrowserFile };
@@ -0,0 +1,2 @@
1
+ import { isBrowserFile } from "./services/browserFile/index.mjs";
2
+ export { isBrowserFile };
@@ -0,0 +1 @@
1
+ import{isBrowserFile as e}from"./services/browserFile/index.mjs";export{e as isBrowserFile};
@@ -0,0 +1,2 @@
1
+ const e=`tool-renderers`,t={tool:`tools`,"tool-restriction":`toolRestrictions`,command:`commands`,shortcut:`shortcuts`,hook:`events`,provider:`providers`,resource:`resources`},n={tool:`tools`,"tool-restriction":`toolRestrictions`,command:`commands`,hook:`hooks`,mode:`minorModes`,api:`api`,channel:`channels`,method:`methods`,resource:`resources`},r={tool:e,message:`messageRenderers`,overlay:``},i={tool:`toolRenderers`,command:`paletteCommands`,mode:`minorModes`,channel:`channels`,tab:`tabs`,dock:`dockFaces`,setting:`settingsSections`,slot:`slots`,fill:`fills`,action:`contextActions`,"activity-group":`activityGroups`,leader:`leaderBindings`,"selection-axis":`selectionAxes`,lifecycle:`start`,"file-links":`fileLinks`,"repository-settings-panel":`repositorySettingsPanel`,api:``,method:``,store:``},a={section:`settingsSections`,panel:`settingsPanels`},o={context:`contextActions`,message:`userMessageActions`};exports.ACTION_FIELDS=o,exports.CLI_FIELDS=t,exports.CLI_FRONTEND_FIELDS=r,exports.MERGED_INTO_TOOL=e,exports.SERVER_FIELDS=n,exports.SETTING_FIELDS=a,exports.WEB_FIELDS=i;
2
+ //# sourceMappingURL=contributions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contributions.cjs","names":[],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAa,EAAmB,iBAEnB,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEa,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAGa,EAAwD,CACnE,KAAM,EACN,QAAS,mBACT,QAAA,EACF,EAEa,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGa,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGa,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
@@ -0,0 +1,2 @@
1
+ const e=`tool-renderers`,t={tool:`tools`,"tool-restriction":`toolRestrictions`,command:`commands`,shortcut:`shortcuts`,hook:`events`,provider:`providers`,resource:`resources`},n={tool:`tools`,"tool-restriction":`toolRestrictions`,command:`commands`,hook:`hooks`,mode:`minorModes`,api:`api`,channel:`channels`,method:`methods`,resource:`resources`},r={tool:e,message:`messageRenderers`,overlay:``},i={tool:`toolRenderers`,command:`paletteCommands`,mode:`minorModes`,channel:`channels`,tab:`tabs`,dock:`dockFaces`,setting:`settingsSections`,slot:`slots`,fill:`fills`,action:`contextActions`,"activity-group":`activityGroups`,leader:`leaderBindings`,"selection-axis":`selectionAxes`,lifecycle:`start`,"file-links":`fileLinks`,"repository-settings-panel":`repositorySettingsPanel`,api:``,method:``,store:``},a={section:`settingsSections`,panel:`settingsPanels`},o={context:`contextActions`,message:`userMessageActions`};export{o as ACTION_FIELDS,t as CLI_FIELDS,r as CLI_FRONTEND_FIELDS,e as MERGED_INTO_TOOL,n as SERVER_FIELDS,a as SETTING_FIELDS,i as WEB_FIELDS};
2
+ //# sourceMappingURL=contributions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contributions.mjs","names":[],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAa,EAAmB,iBAEnB,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEa,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAGa,EAAwD,CACnE,KAAM,EACN,QAAS,mBACT,QAAA,EACF,EAEa,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGa,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGa,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
@@ -0,0 +1,2 @@
1
+ const e=[`mode`,`domain`],t={cli:`pi`,server:`server`,web:`web`},n=[`pi`,`server`,`web`,`client`],r=[`cli`,`server`],i=[`cli`,`web`,`ios`,`android`,`desktop`],a=[`cli`,`server`,`web`],o=[`tool`,`tool-restriction`,`command`,`shortcut`,`hook`,`api`,`channel`,`method`,`provider`,`resource`],s=[`tool`,`command`,`api`,`channel`,`method`,`message`,`overlay`,`tab`,`dock`,`setting`,`slot`,`fill`,`action`,`store`,`activity-group`,`leader`,`selection-axis`,`lifecycle`,`file-links`,`repository-settings-panel`],c=[`fill`,`action`],l=[`api`],u=[`ts`,`tsx`,`mts`,`cts`],d=[`test`,`spec`,`stories`];exports.API_ROUTES_MODULE=`src/types/apiRoutes.ts`,exports.BACKEND_GROUP=`backend`,exports.BACKEND_PLATFORMS=r,exports.BACKEND_SURFACES=o,exports.BUILD_TARGET_PLATFORMS=a,exports.DEFAULT_ROUTING_ROOT=`src/extensions`,exports.EXCLUDED_INFIXES=d,exports.FRONTEND_GROUP=`frontend`,exports.FRONTEND_PLATFORMS=i,exports.FRONTEND_SURFACES=s,exports.GATE_SEGMENTS=e,exports.GENERATED_CLIENT_NAME=`client`,exports.GENERATED_DIR=`generated`,exports.GENERATED_ENTRY_FILENAMES=t,exports.GENERATED_ENTRY_NAMES=n,exports.ROOT_FILE_NAME=`root`,exports.ROUTED_SURFACES=l,exports.ROUTE_FILE_NAME=`route`,exports.ROUTING_ROOT_ALIAS=`src/extension`,exports.SESSION_SEGMENT=`sessions`,exports.SOURCE_EXTENSIONS=u,exports.TARGETED_SURFACES=c,exports.WORKSPACE_SEGMENT=`workspaces`;
2
+ //# sourceMappingURL=layout.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.cjs","names":[],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAaa,EAAmC,CAAC,OAAQ,QAAQ,EAiCpD,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,KAAM,EA4BtE,EAA2C,CAAC,KAAM,SAAU,MAAO,QAAQ,EAc3E,EAAuC,CAAC,MAAO,QAAQ,EACvD,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,KAAK,EAQnE,EAAsC,CACjD,OACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASa,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGa,EAAuC,CAAC,OAAQ,QAAQ,EAGxD,EAAqC,CAAC,KAAK,EAG3C,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjE,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
@@ -0,0 +1,59 @@
1
+ //#region src/constants/layout.d.ts
2
+ /**
3
+ * The folder-convention vocabulary, in one place.
4
+ *
5
+ * Every name here is part of the authoring contract in
6
+ * docs/extension-layout.md. Adding a surface means adding it to both.
7
+ */
8
+ /** Where the scan starts, package-relative. */
9
+ export declare const DEFAULT_ROUTING_ROOT = "src/extensions";
10
+ /** Accepted spelling of the same root, for packages that prefer the singular. */
11
+ export declare const ROUTING_ROOT_ALIAS = "src/extension";
12
+ /** Gate folders. Each is followed by exactly one id segment. */
13
+ export declare const GATE_SEGMENTS: readonly string[];
14
+ /** The leaf filename of an HTTP route, as Next.js spells it. */
15
+ export declare const ROUTE_FILE_NAME = "route";
16
+ /**
17
+ * Where generated entries are written, package-relative.
18
+ *
19
+ * Not `src`. That directory is authored code, and a build that writes into it
20
+ * makes every package carry output its author did not write and must not edit.
21
+ * This one is gitignored per package, and the repository's formatter already
22
+ * skips a directory by this name.
23
+ */
24
+ export declare const GENERATED_DIR = "generated";
25
+ /**
26
+ * Platform suffixes, scoped to their side. A target may not reuse one of these words.
27
+ *
28
+ * Every public routed file names one of these, so which host reads it is read
29
+ * off the filename rather than inferred. A file that names none is a notice.
30
+ *
31
+ * `cli` appears on both sides, because the interactive host has both. Its
32
+ * backend files hold a tool's `execute` and its services; its frontend files
33
+ * hold the TUI that draws them. A terminal is a frontend that happens not to
34
+ * be a browser, which is why the side axis is logic against presentation
35
+ * rather than Node against browser.
36
+ */
37
+ export declare const BACKEND_PLATFORMS: readonly string[];
38
+ export declare const FRONTEND_PLATFORMS: readonly string[];
39
+ /**
40
+ * Surfaces that produce contributions on the backend side.
41
+ *
42
+ * `mode` is absent on purpose: it is a gate folder, so it is consumed before
43
+ * the surface check and its declaration file synthesises the surface instead.
44
+ */
45
+ export declare const BACKEND_SURFACES: readonly string[];
46
+ /**
47
+ * Surfaces that produce contributions on the frontend side.
48
+ *
49
+ * `message` is terminal-only today: the cockpit renders a timeline entry
50
+ * through a tool renderer or a fill, while the TUI has a separate registry
51
+ * keyed by custom message type.
52
+ */
53
+ export declare const FRONTEND_SURFACES: readonly string[];
54
+ /** Surfaces whose filename carries a relationship target. */
55
+ export declare const TARGETED_SURFACES: readonly string[];
56
+ /** Surfaces whose folders below the surface spell a route path. */
57
+ export declare const ROUTED_SURFACES: readonly string[];
58
+ //#endregion
59
+ //# sourceMappingURL=layout.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.cts","names":[],"sources":["../../src/constants/layout.ts"],"mappings":";;;;;;;;qBAQa;;qBAEA;;qBAWA;;qBAGA;;;;;;;;;qBAoBA;;;;;;;;;;;;;qBAoDA;qBACA;;;;;;;qBAWA;;;;;;;;qBAoBA;;qBAwBA;;qBAGA"}
@@ -0,0 +1,59 @@
1
+ //#region src/constants/layout.d.ts
2
+ /**
3
+ * The folder-convention vocabulary, in one place.
4
+ *
5
+ * Every name here is part of the authoring contract in
6
+ * docs/extension-layout.md. Adding a surface means adding it to both.
7
+ */
8
+ /** Where the scan starts, package-relative. */
9
+ export declare const DEFAULT_ROUTING_ROOT = "src/extensions";
10
+ /** Accepted spelling of the same root, for packages that prefer the singular. */
11
+ export declare const ROUTING_ROOT_ALIAS = "src/extension";
12
+ /** Gate folders. Each is followed by exactly one id segment. */
13
+ export declare const GATE_SEGMENTS: readonly string[];
14
+ /** The leaf filename of an HTTP route, as Next.js spells it. */
15
+ export declare const ROUTE_FILE_NAME = "route";
16
+ /**
17
+ * Where generated entries are written, package-relative.
18
+ *
19
+ * Not `src`. That directory is authored code, and a build that writes into it
20
+ * makes every package carry output its author did not write and must not edit.
21
+ * This one is gitignored per package, and the repository's formatter already
22
+ * skips a directory by this name.
23
+ */
24
+ export declare const GENERATED_DIR = "generated";
25
+ /**
26
+ * Platform suffixes, scoped to their side. A target may not reuse one of these words.
27
+ *
28
+ * Every public routed file names one of these, so which host reads it is read
29
+ * off the filename rather than inferred. A file that names none is a notice.
30
+ *
31
+ * `cli` appears on both sides, because the interactive host has both. Its
32
+ * backend files hold a tool's `execute` and its services; its frontend files
33
+ * hold the TUI that draws them. A terminal is a frontend that happens not to
34
+ * be a browser, which is why the side axis is logic against presentation
35
+ * rather than Node against browser.
36
+ */
37
+ export declare const BACKEND_PLATFORMS: readonly string[];
38
+ export declare const FRONTEND_PLATFORMS: readonly string[];
39
+ /**
40
+ * Surfaces that produce contributions on the backend side.
41
+ *
42
+ * `mode` is absent on purpose: it is a gate folder, so it is consumed before
43
+ * the surface check and its declaration file synthesises the surface instead.
44
+ */
45
+ export declare const BACKEND_SURFACES: readonly string[];
46
+ /**
47
+ * Surfaces that produce contributions on the frontend side.
48
+ *
49
+ * `message` is terminal-only today: the cockpit renders a timeline entry
50
+ * through a tool renderer or a fill, while the TUI has a separate registry
51
+ * keyed by custom message type.
52
+ */
53
+ export declare const FRONTEND_SURFACES: readonly string[];
54
+ /** Surfaces whose filename carries a relationship target. */
55
+ export declare const TARGETED_SURFACES: readonly string[];
56
+ /** Surfaces whose folders below the surface spell a route path. */
57
+ export declare const ROUTED_SURFACES: readonly string[];
58
+ //#endregion
59
+ //# sourceMappingURL=layout.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.mts","names":[],"sources":["../../src/constants/layout.ts"],"mappings":";;;;;;;;qBAQa;;qBAEA;;qBAWA;;qBAGA;;;;;;;;;qBAoBA;;;;;;;;;;;;;qBAoDA;qBACA;;;;;;;qBAWA;;;;;;;;qBAoBA;;qBAwBA;;qBAGA"}
@@ -0,0 +1,2 @@
1
+ const e=`src/extensions`,t=`src/extension`,n=`backend`,r=`frontend`,i=`workspaces`,a=`sessions`,o=[`mode`,`domain`],s=`route`,c=`root`,l=`generated`,u={cli:`pi`,server:`server`,web:`web`},d=`client`,f=`src/types/apiRoutes.ts`,p=[`pi`,`server`,`web`,`client`],m=[`cli`,`server`],h=[`cli`,`web`,`ios`,`android`,`desktop`],g=[`cli`,`server`,`web`],_=[`tool`,`tool-restriction`,`command`,`shortcut`,`hook`,`api`,`channel`,`method`,`provider`,`resource`],v=[`tool`,`command`,`api`,`channel`,`method`,`message`,`overlay`,`tab`,`dock`,`setting`,`slot`,`fill`,`action`,`store`,`activity-group`,`leader`,`selection-axis`,`lifecycle`,`file-links`,`repository-settings-panel`],y=[`fill`,`action`],b=[`api`],x=[`ts`,`tsx`,`mts`,`cts`],S=[`test`,`spec`,`stories`];export{f as API_ROUTES_MODULE,n as BACKEND_GROUP,m as BACKEND_PLATFORMS,_ as BACKEND_SURFACES,g as BUILD_TARGET_PLATFORMS,e as DEFAULT_ROUTING_ROOT,S as EXCLUDED_INFIXES,r as FRONTEND_GROUP,h as FRONTEND_PLATFORMS,v as FRONTEND_SURFACES,o as GATE_SEGMENTS,d as GENERATED_CLIENT_NAME,l as GENERATED_DIR,u as GENERATED_ENTRY_FILENAMES,p as GENERATED_ENTRY_NAMES,c as ROOT_FILE_NAME,b as ROUTED_SURFACES,s as ROUTE_FILE_NAME,t as ROUTING_ROOT_ALIAS,a as SESSION_SEGMENT,x as SOURCE_EXTENSIONS,y as TARGETED_SURFACES,i as WORKSPACE_SEGMENT};
2
+ //# sourceMappingURL=layout.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.mjs","names":[],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAAa,EAAuB,iBAEvB,EAAqB,gBAGrB,EAAgB,UAChB,EAAiB,WAGjB,EAAoB,aACpB,EAAkB,WAGlB,EAAmC,CAAC,OAAQ,QAAQ,EAGpD,EAAkB,QAUlB,EAAiB,OAUjB,EAAgB,YAUhB,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,KAAM,EAUtE,EAAwB,SASxB,EAAoB,yBASpB,EAA2C,CAAC,KAAM,SAAU,MAAO,QAAQ,EAc3E,EAAuC,CAAC,MAAO,QAAQ,EACvD,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,KAAK,EAQnE,EAAsC,CACjD,OACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASa,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGa,EAAuC,CAAC,OAAQ,QAAQ,EAGxD,EAAqC,CAAC,KAAK,EAG3C,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjE,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants/layout.cjs"),t=require("./services/filename/index.cjs"),n=require("./services/segments/index.cjs"),r=require("./services/scan/index.cjs"),i=require("./services/resolveTarget/index.cjs"),a=require("./services/renderEntry/index.cjs"),o=require("./services/writeGenerated/index.cjs"),s=require("./services/generate/index.cjs"),c=require("./services/syncManifest/index.cjs");exports.BACKEND_PLATFORMS=e.BACKEND_PLATFORMS,exports.BACKEND_SURFACES=e.BACKEND_SURFACES,exports.DEFAULT_ROUTING_ROOT=e.DEFAULT_ROUTING_ROOT,exports.FRONTEND_PLATFORMS=e.FRONTEND_PLATFORMS,exports.FRONTEND_SURFACES=e.FRONTEND_SURFACES,exports.GATE_SEGMENTS=e.GATE_SEGMENTS,exports.GENERATED_DIR=e.GENERATED_DIR,exports.ROUTED_SURFACES=e.ROUTED_SURFACES,exports.ROUTE_FILE_NAME=e.ROUTE_FILE_NAME,exports.ROUTING_ROOT_ALIAS=e.ROUTING_ROOT_ALIAS,exports.StaleGeneratedError=o.StaleGeneratedError,exports.TARGETED_SURFACES=e.TARGETED_SURFACES,exports.classifySegment=n.classifySegment,exports.defaultPluginId=s.defaultPluginId,exports.generateExtension=s.generateExtension,exports.parseFilename=t.parseFilename,exports.renderCliEntry=a.renderCliEntry,exports.renderServerEntry=a.renderServerEntry,exports.renderWebEntry=a.renderWebEntry,exports.resolveRoutingRoot=r.resolveRoutingRoot,exports.resolveTarget=i.resolveTarget,exports.scanExtensions=r.scanExtensions,exports.syncManifest=c.syncManifest,exports.writeGenerated=o.writeGenerated,exports.writeManifest=c.writeManifest;
@@ -0,0 +1,16 @@
1
+ import { ExtensionEntry, ExtensionGate, ExtensionGraph, ExtensionNotice, ExtensionScope, ExtensionSide, RouteParam, RouteSegment } from "./types/extensionGraph.cjs";
2
+ import { Segment, classifySegment } from "./services/segments/index.cjs";
3
+ import { ParsedFilename, parseFilename } from "./services/filename/index.cjs";
4
+ import { ScanOptions } from "./services/scan/type.cjs";
5
+ import { resolveRoutingRoot, scanExtensions } from "./services/scan/index.cjs";
6
+ import { BuildTarget, ResolvedContribution, TargetResolution } from "./services/resolveTarget/type.cjs";
7
+ import { resolveTarget } from "./services/resolveTarget/index.cjs";
8
+ import { BACKEND_PLATFORMS, BACKEND_SURFACES, DEFAULT_ROUTING_ROOT, FRONTEND_PLATFORMS, FRONTEND_SURFACES, GATE_SEGMENTS, GENERATED_DIR, ROUTED_SURFACES, ROUTE_FILE_NAME, ROUTING_ROOT_ALIAS, TARGETED_SURFACES } from "./constants/layout.cjs";
9
+ import { GenerateOptions, GenerateResult } from "./services/generate/type.cjs";
10
+ import { defaultPluginId, generateExtension } from "./services/generate/index.cjs";
11
+ import { RenderOptions } from "./services/renderEntry/type.cjs";
12
+ import { renderCliEntry, renderServerEntry, renderWebEntry } from "./services/renderEntry/index.cjs";
13
+ import { StaleGeneratedError, WriteResult, writeGenerated } from "./services/writeGenerated/index.cjs";
14
+ import { ManifestSync } from "./services/syncManifest/type.cjs";
15
+ import { syncManifest, writeManifest } from "./services/syncManifest/index.cjs";
16
+ export { BACKEND_PLATFORMS, BACKEND_SURFACES, type BuildTarget, DEFAULT_ROUTING_ROOT, type ExtensionEntry, type ExtensionGate, type ExtensionGraph, type ExtensionNotice, type ExtensionScope, type ExtensionSide, FRONTEND_PLATFORMS, FRONTEND_SURFACES, GATE_SEGMENTS, GENERATED_DIR, type GenerateOptions, type GenerateResult, type ManifestSync, type ParsedFilename, ROUTED_SURFACES, ROUTE_FILE_NAME, ROUTING_ROOT_ALIAS, type RenderOptions, type ResolvedContribution, type RouteParam, type RouteSegment, type ScanOptions, type Segment, StaleGeneratedError, TARGETED_SURFACES, type TargetResolution, type WriteResult, classifySegment, defaultPluginId, generateExtension, parseFilename, renderCliEntry, renderServerEntry, renderWebEntry, resolveRoutingRoot, resolveTarget, scanExtensions, syncManifest, writeGenerated, writeManifest };
@@ -0,0 +1,16 @@
1
+ import { ExtensionEntry, ExtensionGate, ExtensionGraph, ExtensionNotice, ExtensionScope, ExtensionSide, RouteParam, RouteSegment } from "./types/extensionGraph.mjs";
2
+ import { Segment, classifySegment } from "./services/segments/index.mjs";
3
+ import { ParsedFilename, parseFilename } from "./services/filename/index.mjs";
4
+ import { ScanOptions } from "./services/scan/type.mjs";
5
+ import { resolveRoutingRoot, scanExtensions } from "./services/scan/index.mjs";
6
+ import { BuildTarget, ResolvedContribution, TargetResolution } from "./services/resolveTarget/type.mjs";
7
+ import { resolveTarget } from "./services/resolveTarget/index.mjs";
8
+ import { BACKEND_PLATFORMS, BACKEND_SURFACES, DEFAULT_ROUTING_ROOT, FRONTEND_PLATFORMS, FRONTEND_SURFACES, GATE_SEGMENTS, GENERATED_DIR, ROUTED_SURFACES, ROUTE_FILE_NAME, ROUTING_ROOT_ALIAS, TARGETED_SURFACES } from "./constants/layout.mjs";
9
+ import { GenerateOptions, GenerateResult } from "./services/generate/type.mjs";
10
+ import { defaultPluginId, generateExtension } from "./services/generate/index.mjs";
11
+ import { RenderOptions } from "./services/renderEntry/type.mjs";
12
+ import { renderCliEntry, renderServerEntry, renderWebEntry } from "./services/renderEntry/index.mjs";
13
+ import { StaleGeneratedError, WriteResult, writeGenerated } from "./services/writeGenerated/index.mjs";
14
+ import { ManifestSync } from "./services/syncManifest/type.mjs";
15
+ import { syncManifest, writeManifest } from "./services/syncManifest/index.mjs";
16
+ export { BACKEND_PLATFORMS, BACKEND_SURFACES, type BuildTarget, DEFAULT_ROUTING_ROOT, type ExtensionEntry, type ExtensionGate, type ExtensionGraph, type ExtensionNotice, type ExtensionScope, type ExtensionSide, FRONTEND_PLATFORMS, FRONTEND_SURFACES, GATE_SEGMENTS, GENERATED_DIR, type GenerateOptions, type GenerateResult, type ManifestSync, type ParsedFilename, ROUTED_SURFACES, ROUTE_FILE_NAME, ROUTING_ROOT_ALIAS, type RenderOptions, type ResolvedContribution, type RouteParam, type RouteSegment, type ScanOptions, type Segment, StaleGeneratedError, TARGETED_SURFACES, type TargetResolution, type WriteResult, classifySegment, defaultPluginId, generateExtension, parseFilename, renderCliEntry, renderServerEntry, renderWebEntry, resolveRoutingRoot, resolveTarget, scanExtensions, syncManifest, writeGenerated, writeManifest };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{BACKEND_PLATFORMS as e,BACKEND_SURFACES as t,DEFAULT_ROUTING_ROOT as n,FRONTEND_PLATFORMS as r,FRONTEND_SURFACES as i,GATE_SEGMENTS as a,GENERATED_DIR as o,ROUTED_SURFACES as s,ROUTE_FILE_NAME as c,ROUTING_ROOT_ALIAS as l,TARGETED_SURFACES as u}from"./constants/layout.mjs";import{parseFilename as d}from"./services/filename/index.mjs";import{classifySegment as f}from"./services/segments/index.mjs";import{resolveRoutingRoot as p,scanExtensions as m}from"./services/scan/index.mjs";import{resolveTarget as h}from"./services/resolveTarget/index.mjs";import{renderCliEntry as g,renderServerEntry as _,renderWebEntry as v}from"./services/renderEntry/index.mjs";import{StaleGeneratedError as y,writeGenerated as b}from"./services/writeGenerated/index.mjs";import{defaultPluginId as x,generateExtension as S}from"./services/generate/index.mjs";import{syncManifest as C,writeManifest as w}from"./services/syncManifest/index.mjs";export{e as BACKEND_PLATFORMS,t as BACKEND_SURFACES,n as DEFAULT_ROUTING_ROOT,r as FRONTEND_PLATFORMS,i as FRONTEND_SURFACES,a as GATE_SEGMENTS,o as GENERATED_DIR,s as ROUTED_SURFACES,c as ROUTE_FILE_NAME,l as ROUTING_ROOT_ALIAS,y as StaleGeneratedError,u as TARGETED_SURFACES,f as classifySegment,x as defaultPluginId,S as generateExtension,d as parseFilename,g as renderCliEntry,_ as renderServerEntry,v as renderWebEntry,p as resolveRoutingRoot,h as resolveTarget,m as scanExtensions,C as syncManifest,b as writeGenerated,w as writeManifest};
@@ -0,0 +1,2 @@
1
+ const e=require("../../constants/contributions.cjs"),t=require("../../constants/layout.cjs"),n=require("../filename/index.cjs"),r=require("../segments/index.cjs"),i=Object.keys(e.CLI_FRONTEND_FIELDS).filter(t=>!(t in e.WEB_FIELDS));function a(e){for(let n of[t.DEFAULT_ROUTING_ROOT,t.ROUTING_ROOT_ALIAS])if(e.startsWith(`${n}/`))return e.slice(n.length+1).split(`/`)}function o(e){let o=a(e);if(o===void 0)return!1;let s=o[o.length-1];if(s===void 0)return!1;let c=o.slice(0,-1),l=0,u;for(;l<c.length&&u===void 0;){let e=r.classifySegment(c[l]);l+=1,e.kind===`group`&&(e.name===`backend`||e.name===`frontend`)&&(u=e.name)}if(u!==`frontend`)return!1;let d;for(;l<c.length&&d===void 0;){let e=r.classifySegment(c[l]);l+=1,e.kind===`plain`&&(t.GATE_SEGMENTS.includes(e.name)?l+=1:d=e.name)}return d!==void 0&&i.includes(d)?!1:n.parseFilename(s,t.FRONTEND_PLATFORMS)?.platform!==`cli`}exports.isBrowserFile=o;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["CLI_FRONTEND_FIELDS","WEB_FIELDS","DEFAULT_ROUTING_ROOT","ROUTING_ROOT_ALIAS","classifySegment","GATE_SEGMENTS","parseFilename","FRONTEND_PLATFORMS"],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONLY_SURFACES.includes(surface)) return false;\n\n return parseFilename(fileName, FRONTEND_PLATFORMS)?.platform !== TERMINAL_PLATFORM;\n}\n"],"mappings":"mKAsBM,EAA4C,OAAO,KAAKA,EAAAA,mBAAmB,CAAC,CAAC,OAChF,GAAY,EAAE,KAAWC,EAAAA,WAC5B,EAGA,SAAS,EAAe,EAAqD,CAC3E,IAAK,IAAM,IAAQ,CAACC,EAAAA,qBAAsBC,EAAAA,kBAAkB,EAC1D,GAAI,EAAa,WAAW,GAAG,EAAK,EAAE,EAAG,OAAO,EAAa,MAAM,EAAK,OAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAGjG,CA0BA,SAAgB,EAAc,EAA+B,CAC3D,IAAM,EAAW,EAAe,CAAY,EAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GAEnC,IAAM,EAAW,EAAS,EAAS,OAAS,GAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GACnC,IAAM,EAAU,EAAS,MAAM,EAAG,EAAE,EAChC,EAAQ,EAGR,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAS,IAAA,IAAW,CACnD,IAAM,EAAUC,EAAAA,gBAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAQ,OAAA,WAA0B,EAAQ,OAAA,cAAyB,EAAO,EAAQ,KACxF,CACA,GAAI,IAAA,WAAyB,MAAO,GAIpC,IAAI,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAY,IAAA,IAAW,CACtD,IAAM,EAAUA,EAAAA,gBAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjBC,EAAAA,cAAc,SAAS,EAAQ,IAAI,EAAG,GAAS,EAC9C,EAAU,EAAQ,KACzB,CAGA,OAFI,IAAY,IAAA,IAAa,EAAuB,SAAS,CAAO,EAAU,GAEvEC,EAAAA,cAAc,EAAUC,EAAAA,kBAAkB,CAAC,EAAE,WAAa,KACnE"}
@@ -0,0 +1,28 @@
1
+ //#region src/services/browserFile/index.d.ts
2
+ /**
3
+ * Whether a package-relative path holds code the cockpit bundles.
4
+ *
5
+ * Browser-bound is narrower than `(frontend)`. That side carries both
6
+ * presentations, and the terminal's half legitimately imports src/services and
7
+ * pi-tui, so treating the whole side as browser would reject every one of those
8
+ * imports. Two things separate the halves, in this order:
9
+ *
10
+ * - a surface the CLI frontend table names and the web table does not is
11
+ * terminal-only, whatever the filename says;
12
+ * - on a surface both hosts share, the platform in the filename decides, which
13
+ * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.
14
+ *
15
+ * Everything else under `(frontend)` is browser, including the private folders
16
+ * colocated beside a surface, and a private folder at the side root, which
17
+ * names no surface to read.
18
+ *
19
+ * That default is why a private terminal helper carries `.cli` even though the
20
+ * scan never routes it: on a shared surface such as `tool/`, the folder says
21
+ * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the
22
+ * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.
23
+ *
24
+ * Path in, answer out: nothing here reads the file or the filesystem.
25
+ */
26
+ export declare function isBrowserFile(relativePath: string): boolean;
27
+ //#endregion
28
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/services/browserFile/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wBA0DgB,cAAc"}
@@ -0,0 +1,28 @@
1
+ //#region src/services/browserFile/index.d.ts
2
+ /**
3
+ * Whether a package-relative path holds code the cockpit bundles.
4
+ *
5
+ * Browser-bound is narrower than `(frontend)`. That side carries both
6
+ * presentations, and the terminal's half legitimately imports src/services and
7
+ * pi-tui, so treating the whole side as browser would reject every one of those
8
+ * imports. Two things separate the halves, in this order:
9
+ *
10
+ * - a surface the CLI frontend table names and the web table does not is
11
+ * terminal-only, whatever the filename says;
12
+ * - on a surface both hosts share, the platform in the filename decides, which
13
+ * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.
14
+ *
15
+ * Everything else under `(frontend)` is browser, including the private folders
16
+ * colocated beside a surface, and a private folder at the side root, which
17
+ * names no surface to read.
18
+ *
19
+ * That default is why a private terminal helper carries `.cli` even though the
20
+ * scan never routes it: on a shared surface such as `tool/`, the folder says
21
+ * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the
22
+ * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.
23
+ *
24
+ * Path in, answer out: nothing here reads the file or the filesystem.
25
+ */
26
+ export declare function isBrowserFile(relativePath: string): boolean;
27
+ //#endregion
28
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/services/browserFile/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wBA0DgB,cAAc"}
@@ -0,0 +1,2 @@
1
+ import{CLI_FRONTEND_FIELDS as e,WEB_FIELDS as t}from"../../constants/contributions.mjs";import{DEFAULT_ROUTING_ROOT as n,FRONTEND_PLATFORMS as r,GATE_SEGMENTS as i,ROUTING_ROOT_ALIAS as a}from"../../constants/layout.mjs";import{parseFilename as o}from"../filename/index.mjs";import{classifySegment as s}from"../segments/index.mjs";const c=Object.keys(e).filter(e=>!(e in t));function l(e){for(let t of[n,a])if(e.startsWith(`${t}/`))return e.slice(t.length+1).split(`/`)}function u(e){let t=l(e);if(t===void 0)return!1;let n=t[t.length-1];if(n===void 0)return!1;let a=t.slice(0,-1),u=0,d;for(;u<a.length&&d===void 0;){let e=s(a[u]);u+=1,e.kind===`group`&&(e.name===`backend`||e.name===`frontend`)&&(d=e.name)}if(d!==`frontend`)return!1;let f;for(;u<a.length&&f===void 0;){let e=s(a[u]);u+=1,e.kind===`plain`&&(i.includes(e.name)?u+=1:f=e.name)}return f!==void 0&&c.includes(f)?!1:o(n,r)?.platform!==`cli`}export{u as isBrowserFile};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONLY_SURFACES.includes(surface)) return false;\n\n return parseFilename(fileName, FRONTEND_PLATFORMS)?.platform !== TERMINAL_PLATFORM;\n}\n"],"mappings":"2UAaA,MASM,EAA4C,OAAO,KAAK,CAAmB,CAAC,CAAC,OAChF,GAAY,EAAE,KAAW,EAC5B,EAGA,SAAS,EAAe,EAAqD,CAC3E,IAAK,IAAM,IAAQ,CAAC,EAAsB,CAAkB,EAC1D,GAAI,EAAa,WAAW,GAAG,EAAK,EAAE,EAAG,OAAO,EAAa,MAAM,EAAK,OAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAGjG,CA0BA,SAAgB,EAAc,EAA+B,CAC3D,IAAM,EAAW,EAAe,CAAY,EAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GAEnC,IAAM,EAAW,EAAS,EAAS,OAAS,GAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GACnC,IAAM,EAAU,EAAS,MAAM,EAAG,EAAE,EAChC,EAAQ,EAGR,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAS,IAAA,IAAW,CACnD,IAAM,EAAU,EAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAQ,OAAA,WAA0B,EAAQ,OAAA,cAAyB,EAAO,EAAQ,KACxF,CACA,GAAI,IAAA,WAAyB,MAAO,GAIpC,IAAI,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAY,IAAA,IAAW,CACtD,IAAM,EAAU,EAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAc,SAAS,EAAQ,IAAI,EAAG,GAAS,EAC9C,EAAU,EAAQ,KACzB,CAGA,OAFI,IAAY,IAAA,IAAa,EAAuB,SAAS,CAAO,EAAU,GAEvE,EAAc,EAAU,CAAkB,CAAC,EAAE,WAAa,KACnE"}
@@ -0,0 +1,2 @@
1
+ const e=require("../../constants/layout.cjs");function t(t,n){let r=t.lastIndexOf(`.`);if(r<=0)return;let i=t.slice(r+1);if(!e.SOURCE_EXTENSIONS.includes(i))return;let a=t.slice(0,r).split(`.`),[o,...s]=a;if(o===void 0||o===``||a.some(t=>e.EXCLUDED_INFIXES.includes(t)))return;let c=s[s.length-1],l=c!==void 0&&n.includes(c)?s.pop():void 0;return{name:o,target:s.length>0?s.join(`.`):void 0,platform:l,extension:i}}exports.parseFilename=t;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["SOURCE_EXTENSIONS","EXCLUDED_INFIXES"],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"8CA4BA,SAAgB,EAAc,EAAkB,EAA0D,CACxG,IAAM,EAAU,EAAS,YAAY,GAAG,EACxC,GAAI,GAAW,EAAG,OAElB,IAAM,EAAY,EAAS,MAAM,EAAU,CAAC,EAC5C,GAAI,CAACA,EAAAA,kBAAkB,SAAS,CAAS,EAAG,OAE5C,IAAM,EAAQ,EAAS,MAAM,EAAG,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAAC,EAAM,GAAG,GAAQ,EAExB,GADI,IAAS,IAAA,IAAa,IAAS,IAC/B,EAAM,KAAM,GAASC,EAAAA,iBAAiB,SAAS,CAAI,CAAC,EAAG,OAE3D,IAAM,EAAO,EAAK,EAAK,OAAS,GAC1B,EAAW,IAAS,IAAA,IAAa,EAAU,SAAS,CAAI,EAAI,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQ,EAAK,OAAS,EAAI,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}
@@ -0,0 +1,29 @@
1
+ //#region src/services/filename/index.d.ts
2
+ /** One filename split into the four things the grammar encodes. */
3
+ export interface ParsedFilename {
4
+ /** The contribution's identity. */
5
+ readonly name: string;
6
+ /** The relationship target, such as the slot a fill names. */
7
+ readonly target: string | undefined;
8
+ /** The platform this file serves, or undefined when the filename names none. */
9
+ readonly platform: string | undefined;
10
+ readonly extension: string;
11
+ }
12
+ /**
13
+ * Parses `{name}[.{target}][.{platform}].{ext}`.
14
+ *
15
+ * Right to left, because the platform set is closed and the target is not: a
16
+ * dotted slot name such as `task.detail` would otherwise be ambiguous. A file
17
+ * whose extension is not a source extension, or that carries an excluded
18
+ * infix, returns undefined rather than an entry the caller has to filter.
19
+ *
20
+ * The one word a target may not be is a platform name for its own side, since
21
+ * the last segment is read as a platform whenever it matches.
22
+ *
23
+ * A filename that names no platform still parses, with `platform: undefined`.
24
+ * Requiring one is the scan's job, since only the scan knows whether the file
25
+ * is public: a private `_lib` helper and an `api/` route sibling name none.
26
+ */
27
+ export declare function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined;
28
+ //#endregion
29
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/services/filename/index.ts"],"mappings":";;iBAGiB;;WAEN;;WAEA;;WAEA;WACA;;;;;;;;;;;;;;;;;wBAkBK,cAAc,kBAAkB,+BAA+B"}
@@ -0,0 +1,29 @@
1
+ //#region src/services/filename/index.d.ts
2
+ /** One filename split into the four things the grammar encodes. */
3
+ export interface ParsedFilename {
4
+ /** The contribution's identity. */
5
+ readonly name: string;
6
+ /** The relationship target, such as the slot a fill names. */
7
+ readonly target: string | undefined;
8
+ /** The platform this file serves, or undefined when the filename names none. */
9
+ readonly platform: string | undefined;
10
+ readonly extension: string;
11
+ }
12
+ /**
13
+ * Parses `{name}[.{target}][.{platform}].{ext}`.
14
+ *
15
+ * Right to left, because the platform set is closed and the target is not: a
16
+ * dotted slot name such as `task.detail` would otherwise be ambiguous. A file
17
+ * whose extension is not a source extension, or that carries an excluded
18
+ * infix, returns undefined rather than an entry the caller has to filter.
19
+ *
20
+ * The one word a target may not be is a platform name for its own side, since
21
+ * the last segment is read as a platform whenever it matches.
22
+ *
23
+ * A filename that names no platform still parses, with `platform: undefined`.
24
+ * Requiring one is the scan's job, since only the scan knows whether the file
25
+ * is public: a private `_lib` helper and an `api/` route sibling name none.
26
+ */
27
+ export declare function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined;
28
+ //#endregion
29
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/services/filename/index.ts"],"mappings":";;iBAGiB;;WAEN;;WAEA;;WAEA;WACA;;;;;;;;;;;;;;;;;wBAkBK,cAAc,kBAAkB,+BAA+B"}
@@ -0,0 +1,2 @@
1
+ import{EXCLUDED_INFIXES as e,SOURCE_EXTENSIONS as t}from"../../constants/layout.mjs";function n(n,r){let i=n.lastIndexOf(`.`);if(i<=0)return;let a=n.slice(i+1);if(!t.includes(a))return;let o=n.slice(0,i).split(`.`),[s,...c]=o;if(s===void 0||s===``||o.some(t=>e.includes(t)))return;let l=c[c.length-1],u=l!==void 0&&r.includes(l)?c.pop():void 0;return{name:s,target:c.length>0?c.join(`.`):void 0,platform:u,extension:a}}export{n as parseFilename};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"qFA4BA,SAAgB,EAAc,EAAkB,EAA0D,CACxG,IAAM,EAAU,EAAS,YAAY,GAAG,EACxC,GAAI,GAAW,EAAG,OAElB,IAAM,EAAY,EAAS,MAAM,EAAU,CAAC,EAC5C,GAAI,CAAC,EAAkB,SAAS,CAAS,EAAG,OAE5C,IAAM,EAAQ,EAAS,MAAM,EAAG,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAAC,EAAM,GAAG,GAAQ,EAExB,GADI,IAAS,IAAA,IAAa,IAAS,IAC/B,EAAM,KAAM,GAAS,EAAiB,SAAS,CAAI,CAAC,EAAG,OAE3D,IAAM,EAAO,EAAK,EAAK,OAAS,GAC1B,EAAW,IAAS,IAAA,IAAa,EAAU,SAAS,CAAI,EAAI,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQ,EAAK,OAAS,EAAI,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}