@agimon-ai/doompi-build 0.0.1-alpha.4 → 0.0.1-alpha.6

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 (51) hide show
  1. package/dist/constants/contributions.cjs +1 -1
  2. package/dist/constants/contributions.cjs.map +1 -1
  3. package/dist/constants/contributions.mjs +1 -1
  4. package/dist/constants/contributions.mjs.map +1 -1
  5. package/dist/constants/layout.cjs +1 -1
  6. package/dist/constants/layout.cjs.map +1 -1
  7. package/dist/constants/layout.d.cts.map +1 -1
  8. package/dist/constants/layout.d.mts.map +1 -1
  9. package/dist/constants/layout.mjs +1 -1
  10. package/dist/constants/layout.mjs.map +1 -1
  11. package/dist/services/generate/index.cjs +1 -1
  12. package/dist/services/generate/index.cjs.map +1 -1
  13. package/dist/services/generate/index.mjs +1 -1
  14. package/dist/services/generate/index.mjs.map +1 -1
  15. package/dist/services/generate/type.d.cts +2 -0
  16. package/dist/services/generate/type.d.cts.map +1 -1
  17. package/dist/services/generate/type.d.mts +2 -0
  18. package/dist/services/generate/type.d.mts.map +1 -1
  19. package/dist/services/renderEntry/index.cjs +2 -2
  20. package/dist/services/renderEntry/index.cjs.map +1 -1
  21. package/dist/services/renderEntry/index.d.cts.map +1 -1
  22. package/dist/services/renderEntry/index.d.mts.map +1 -1
  23. package/dist/services/renderEntry/index.mjs +2 -2
  24. package/dist/services/renderEntry/index.mjs.map +1 -1
  25. package/dist/services/resolveTarget/index.cjs +1 -1
  26. package/dist/services/resolveTarget/index.cjs.map +1 -1
  27. package/dist/services/resolveTarget/index.d.cts.map +1 -1
  28. package/dist/services/resolveTarget/index.d.mts.map +1 -1
  29. package/dist/services/resolveTarget/index.mjs +1 -1
  30. package/dist/services/resolveTarget/index.mjs.map +1 -1
  31. package/dist/services/resolveTarget/type.d.cts +2 -2
  32. package/dist/services/resolveTarget/type.d.mts +2 -2
  33. package/dist/services/scan/index.cjs +1 -1
  34. package/dist/services/scan/index.cjs.map +1 -1
  35. package/dist/services/scan/index.mjs +1 -1
  36. package/dist/services/scan/index.mjs.map +1 -1
  37. package/dist/services/syncManifest/index.cjs +1 -1
  38. package/dist/services/syncManifest/index.cjs.map +1 -1
  39. package/dist/services/syncManifest/index.d.cts.map +1 -1
  40. package/dist/services/syncManifest/index.d.mts.map +1 -1
  41. package/dist/services/syncManifest/index.mjs +1 -1
  42. package/dist/services/syncManifest/index.mjs.map +1 -1
  43. package/dist/services/tsdownPreset/index.cjs +1 -1
  44. package/dist/services/tsdownPreset/index.cjs.map +1 -1
  45. package/dist/services/tsdownPreset/index.d.cts +3 -1
  46. package/dist/services/tsdownPreset/index.d.cts.map +1 -1
  47. package/dist/services/tsdownPreset/index.d.mts +3 -1
  48. package/dist/services/tsdownPreset/index.d.mts.map +1 -1
  49. package/dist/services/tsdownPreset/index.mjs +1 -1
  50. package/dist/services/tsdownPreset/index.mjs.map +1 -1
  51. package/package.json +1 -1
@@ -1,2 +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;
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:`tools`,skill:`skills`},i={tool:e,message:`messageRenderers`,overlay:``},a={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:``},o={section:`settingsSections`,panel:`settingsPanels`},s={context:`contextActions`,message:`userMessageActions`};exports.ACTION_FIELDS=s,exports.CLI_FIELDS=t,exports.CLI_FRONTEND_FIELDS=i,exports.MCP_FIELDS=r,exports.MERGED_INTO_TOOL=e,exports.SERVER_FIELDS=n,exports.SETTING_FIELDS=o,exports.WEB_FIELDS=a;
2
2
  //# sourceMappingURL=contributions.cjs.map
@@ -1 +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"}
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\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\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,EAEa,EAA+C,CAC1D,KAAM,QACN,MAAO,QACT,EAEa,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"}
@@ -1,2 +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};
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:`tools`,skill:`skills`},i={tool:e,message:`messageRenderers`,overlay:``},a={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:``},o={section:`settingsSections`,panel:`settingsPanels`},s={context:`contextActions`,message:`userMessageActions`};export{s as ACTION_FIELDS,t as CLI_FIELDS,i as CLI_FRONTEND_FIELDS,r as MCP_FIELDS,e as MERGED_INTO_TOOL,n as SERVER_FIELDS,o as SETTING_FIELDS,a as WEB_FIELDS};
2
2
  //# sourceMappingURL=contributions.mjs.map
@@ -1 +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"}
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\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\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,EAEa,EAA+C,CAC1D,KAAM,QACN,MAAO,QACT,EAEa,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"}
@@ -1,2 +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`;
1
+ const e=[`mode`,`domain`],t={cli:`pi`,server:`server`,web:`web`,mcp:`mcp`},n=[`pi`,`server`,`web`,`mcp`,`client`],r=[`cli`,`server`,`mcp`],i=[`cli`,`web`,`ios`,`android`,`desktop`],a=[`cli`,`server`,`web`,`mcp`],o=[`tool`,`skill`,`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
2
  //# sourceMappingURL=layout.cjs.map
@@ -1 +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"}
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', mcp: 'mcp' } 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', 'mcp', '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', 'mcp'];\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', 'mcp'];\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 'skill',\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,MAAO,IAAK,KAAM,EA4BlF,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclF,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9D,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1E,EAAsC,CACjD,OACA,QACA,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"}
@@ -1 +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"}
1
+ {"version":3,"file":"layout.d.cts","names":[],"sources":["../../src/constants/layout.ts"],"mappings":";;;;;;;;qBAQa;;qBAEA;;qBAWA;;qBAGA;;;;;;;;;qBAoBA;;;;;;;;;;;;;qBAoDA;qBACA;;;;;;;qBAWA;;;;;;;;qBAqBA;;qBAwBA;;qBAGA"}
@@ -1 +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"}
1
+ {"version":3,"file":"layout.d.mts","names":[],"sources":["../../src/constants/layout.ts"],"mappings":";;;;;;;;qBAQa;;qBAEA;;qBAWA;;qBAGA;;;;;;;;;qBAoBA;;;;;;;;;;;;;qBAoDA;qBACA;;;;;;;qBAWA;;;;;;;;qBAqBA;;qBAwBA;;qBAGA"}
@@ -1,2 +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};
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`,mcp:`mcp`},d=`client`,f=`src/types/apiRoutes.ts`,p=[`pi`,`server`,`web`,`mcp`,`client`],m=[`cli`,`server`,`mcp`],h=[`cli`,`web`,`ios`,`android`,`desktop`],g=[`cli`,`server`,`web`,`mcp`],_=[`tool`,`skill`,`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
2
  //# sourceMappingURL=layout.mjs.map
@@ -1 +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"}
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', mcp: 'mcp' } 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', 'mcp', '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', 'mcp'];\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', 'mcp'];\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 'skill',\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,MAAO,IAAK,KAAM,EAUlF,EAAwB,SASxB,EAAoB,yBASpB,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclF,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9D,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1E,EAAsC,CACjD,OACA,QACA,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"}
@@ -1,2 +1,2 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../constants/layout.cjs"),n=require("../scan/index.cjs"),r=require("../resolveTarget/index.cjs"),i=require("../renderClient/index.cjs"),a=require("../renderEntry/index.cjs"),o=require("../writeGenerated/index.cjs");let s=require("node:fs");s=e.__toESM(s,1);let c=require("node:path");c=e.__toESM(c,1);function l(e){return e.replace(/^@[^/]+\//u,``).replace(/^doompi-/u,``)}function u(e){let t=JSON.parse(s.default.readFileSync(c.default.join(e,`package.json`),`utf8`));if(typeof t.name!=`string`)throw Error(`${e}/package.json has no name`);return t.name}const d={cli:a.renderCliEntry,server:a.renderServerEntry,web:a.renderWebEntry},f=t.GENERATED_ENTRY_FILENAMES,p={cli:`ts`,server:`ts`,web:`ts`};function m(e){let a=e.packageName??u(e.packageDir),m=e.pluginId??l(a),h=n.scanExtensions(e),g=[...h.notices],_=new Map,v=[];for(let e of h.entries)e.platform===void 0||t.BUILD_TARGET_PLATFORMS.includes(e.platform)||g.push({path:e.file,message:`'${e.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server or web`});for(let e of[`cli`,`server`,`web`]){let n=r.resolveTarget(h,e);if(g.push(...n.notices),n.contributions.length===0&&n.escapeHatches.length===0&&n.roots.length===0)continue;v.push(e);let i=d[e],o=i(n,{packageName:a,pluginId:m,root:h.root,entryDir:t.GENERATED_DIR});_.set(`${t.GENERATED_DIR}/${f[e]}.${p[e]}`,o)}let y=s.default.existsSync(c.default.join(e.packageDir,t.API_ROUTES_MODULE)),b=v.includes(`web`),x=y&&b?i.renderApiClient(h,{packageName:a,pluginId:m,root:h.root,entryDir:t.GENERATED_DIR}):void 0;x!==void 0&&_.set(`${t.GENERATED_DIR}/${t.GENERATED_CLIENT_NAME}.ts`,x),y&&b&&x===void 0&&g.push({path:t.API_ROUTES_MODULE,message:`declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted`});let S=t.GENERATED_ENTRY_NAMES.map(e=>`${t.GENERATED_DIR}/${e}.ts`),{changed:C}=o.writeGenerated(e.packageDir,_,e.check,S);return{graph:h,packageName:a,pluginId:m,files:_,changed:C,notices:g,targets:v}}exports.defaultPluginId=l,exports.generateExtension=m;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../constants/layout.cjs"),n=require("../scan/index.cjs"),r=require("../resolveTarget/index.cjs"),i=require("../renderClient/index.cjs"),a=require("../renderEntry/index.cjs"),o=require("../writeGenerated/index.cjs");let s=require("node:fs");s=e.__toESM(s,1);let c=require("node:path");c=e.__toESM(c,1);function l(e){return e.replace(/^@[^/]+\//u,``).replace(/^doompi-/u,``)}function u(e){let t=JSON.parse(s.default.readFileSync(c.default.join(e,`package.json`),`utf8`));if(typeof t.name!=`string`)throw Error(`${e}/package.json has no name`);return t.name}const d={cli:a.renderCliEntry,server:a.renderServerEntry,web:a.renderWebEntry,mcp:a.renderMcpEntry},f=t.GENERATED_ENTRY_FILENAMES,p={cli:`ts`,server:`ts`,web:`ts`,mcp:`ts`};function m(e){let a=e.packageName??u(e.packageDir),m=e.pluginId??l(a),h=n.scanExtensions(e),g=[...h.notices],_=new Map,v=[];for(let e of h.entries)e.platform===void 0||t.BUILD_TARGET_PLATFORMS.includes(e.platform)||g.push({path:e.file,message:`'${e.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`});let y=e.target===void 0?[`cli`,`server`,`web`]:[e.target];for(let e of y){let n=r.resolveTarget(h,e);if(g.push(...n.notices),n.contributions.length===0&&n.escapeHatches.length===0&&n.roots.length===0)continue;v.push(e);let i=d[e],o=i(n,{packageName:a,pluginId:m,root:h.root,entryDir:t.GENERATED_DIR});_.set(`${t.GENERATED_DIR}/${f[e]}.${p[e]}`,o)}let b=e.target===void 0&&s.default.existsSync(c.default.join(e.packageDir,`src/types/apiRoutes.ts`)),x=v.includes(`web`),S=b&&x?i.renderApiClient(h,{packageName:a,pluginId:m,root:h.root,entryDir:t.GENERATED_DIR}):void 0;S!==void 0&&_.set(`${t.GENERATED_DIR}/${t.GENERATED_CLIENT_NAME}.ts`,S),b&&x&&S===void 0&&g.push({path:t.API_ROUTES_MODULE,message:`declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted`});let C=e.target===void 0?t.GENERATED_ENTRY_NAMES.filter(t=>t!==`mcp`||!s.default.existsSync(c.default.join(e.packageDir,`tsdown.mcp.config.ts`))).map(e=>`${t.GENERATED_DIR}/${e}.ts`):[`${t.GENERATED_DIR}/${f[e.target]}.${p[e.target]}`],{changed:w}=o.writeGenerated(e.packageDir,_,e.check,C);return{graph:h,packageName:a,pluginId:m,files:_,changed:w,notices:g,targets:v}}exports.defaultPluginId=l,exports.generateExtension=m;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["fs","path","renderCliEntry","renderServerEntry","renderWebEntry","GENERATED_ENTRY_FILENAMES","scanExtensions","BUILD_TARGET_PLATFORMS","resolveTarget","GENERATED_DIR","API_ROUTES_MODULE","renderApiClient","GENERATED_CLIENT_NAME","GENERATED_ENTRY_NAMES","writeGenerated"],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\n\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server or web`,\n });\n }\n\n for (const target of ['cli', 'server', 'web'] as const) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n if (resolution.contributions.length === 0 && resolution.escapeHatches.length === 0 && resolution.roots.length === 0)\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed = GENERATED_ENTRY_NAMES.map((name) => `${GENERATED_DIR}/${name}.ts`);\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"mXAqBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAMA,EAAAA,QAAG,aAAaC,EAAAA,QAAK,KAAK,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAO,EAAS,MAAS,SAAU,MAAU,MAAM,GAAG,EAAW,0BAA0B,EAC/F,OAAO,EAAS,IAClB,CAEA,MAAM,EAAkE,CACtE,IAAKC,EAAAA,eACL,OAAQC,EAAAA,kBACR,IAAKC,EAAAA,cACP,EAGM,EAAwDC,EAAAA,0BAExD,EAAyD,CAAE,IAAK,KAAM,OAAQ,KAAM,IAAK,IAAK,EAUpG,SAAgB,EAAkB,EAA0C,CAC1E,IAAM,EAAc,EAAQ,aAAe,EAAgB,EAAQ,UAAU,EACvE,EAAW,EAAQ,UAAY,EAAgB,CAAW,EAE1D,EAAwBC,EAAAA,eAAe,CAAO,EAC9C,EAA6B,CAAC,GAAG,EAAM,OAAO,EAC9C,EAAQ,IAAI,IACZ,EAAyB,CAAC,EAMhC,IAAK,IAAM,KAAS,EAAM,QACpB,EAAM,WAAa,IAAA,IAAaC,EAAAA,uBAAuB,SAAS,EAAM,QAAQ,GAClF,EAAQ,KAAK,CACX,KAAM,EAAM,KACZ,QAAS,IAAI,EAAM,SAAS,sGAC9B,CAAC,EAGH,IAAK,IAAM,IAAU,CAAC,MAAO,SAAU,KAAK,EAAY,CACtD,IAAM,EAAaC,EAAAA,cAAc,EAAO,CAAM,EAE9C,GADA,EAAQ,KAAK,GAAG,EAAW,OAAO,EAC9B,EAAW,cAAc,SAAW,GAAK,EAAW,cAAc,SAAW,GAAK,EAAW,MAAM,SAAW,EAChH,SAEF,EAAQ,KAAK,CAAM,EACnB,IAAM,EAAS,EAAU,GACnB,EAAS,EAAO,EAAY,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAUC,EAAAA,aAAc,CAAC,EACtG,EAAM,IAAI,GAAGA,EAAAA,cAAc,GAAG,EAAe,GAAQ,GAAG,EAAgB,KAAW,CAAM,CAC3F,CAUA,IAAM,EAAgBT,EAAAA,QAAG,WAAWC,EAAAA,QAAK,KAAK,EAAQ,WAAYS,EAAAA,iBAAiB,CAAC,EAC9E,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACbC,EAAAA,gBAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAUF,EAAAA,aAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAGA,EAAAA,cAAc,GAAGG,EAAAA,sBAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAMF,EAAAA,kBACN,QAAS,2FACX,CAAC,EAGH,IAAM,EAAUG,EAAAA,sBAAsB,IAAK,GAAS,GAAGJ,EAAAA,cAAc,GAAG,EAAK,IAAI,EAC3E,CAAE,WAAYK,EAAAA,eAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
1
+ {"version":3,"file":"index.cjs","names":["fs","path","renderCliEntry","renderServerEntry","renderWebEntry","renderMcpEntry","GENERATED_ENTRY_FILENAMES","scanExtensions","BUILD_TARGET_PLATFORMS","resolveTarget","GENERATED_DIR","renderApiClient","GENERATED_CLIENT_NAME","API_ROUTES_MODULE","GENERATED_ENTRY_NAMES","writeGenerated"],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n if (resolution.contributions.length === 0 && resolution.escapeHatches.length === 0 && resolution.roots.length === 0)\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [`${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"mXAqBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAMA,EAAAA,QAAG,aAAaC,EAAAA,QAAK,KAAK,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAO,EAAS,MAAS,SAAU,MAAU,MAAM,GAAG,EAAW,0BAA0B,EAC/F,OAAO,EAAS,IAClB,CAEA,MAAM,EAAkE,CACtE,IAAKC,EAAAA,eACL,OAAQC,EAAAA,kBACR,IAAKC,EAAAA,eACL,IAAKC,EAAAA,cACP,EAGM,EAAwDC,EAAAA,0BACxD,EAAyD,CAAE,IAAK,KAAM,OAAQ,KAAM,IAAK,KAAM,IAAK,IAAK,EAU/G,SAAgB,EAAkB,EAA0C,CAC1E,IAAM,EAAc,EAAQ,aAAe,EAAgB,EAAQ,UAAU,EACvE,EAAW,EAAQ,UAAY,EAAgB,CAAW,EAE1D,EAAwBC,EAAAA,eAAe,CAAO,EAC9C,EAA6B,CAAC,GAAG,EAAM,OAAO,EAC9C,EAAQ,IAAI,IACZ,EAAyB,CAAC,EAMhC,IAAK,IAAM,KAAS,EAAM,QACpB,EAAM,WAAa,IAAA,IAAaC,EAAAA,uBAAuB,SAAS,EAAM,QAAQ,GAClF,EAAQ,KAAK,CACX,KAAM,EAAM,KACZ,QAAS,IAAI,EAAM,SAAS,2GAC9B,CAAC,EAGH,IAAM,EAAmB,EAAQ,SAAW,IAAA,GAAa,CAAC,MAAO,SAAU,KAAK,EAAc,CAAC,EAAQ,MAAM,EAC7G,IAAK,IAAM,KAAU,EAAkB,CACrC,IAAM,EAAaC,EAAAA,cAAc,EAAO,CAAM,EAE9C,GADA,EAAQ,KAAK,GAAG,EAAW,OAAO,EAC9B,EAAW,cAAc,SAAW,GAAK,EAAW,cAAc,SAAW,GAAK,EAAW,MAAM,SAAW,EAChH,SAEF,EAAQ,KAAK,CAAM,EACnB,IAAM,EAAS,EAAU,GACnB,EAAS,EAAO,EAAY,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAUC,EAAAA,aAAc,CAAC,EACtG,EAAM,IAAI,GAAGA,EAAAA,cAAc,GAAG,EAAe,GAAQ,GAAG,EAAgB,KAAW,CAAM,CAC3F,CAUA,IAAM,EAAgB,EAAQ,SAAW,IAAA,IAAaV,EAAAA,QAAG,WAAWC,EAAAA,QAAK,KAAK,EAAQ,WAAA,wBAA6B,CAAC,EAC9G,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACbU,EAAAA,gBAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAUD,EAAAA,aAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAGA,EAAAA,cAAc,GAAGE,EAAAA,sBAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAMC,EAAAA,kBACN,QAAS,2FACX,CAAC,EAGH,IAAM,EACJ,EAAQ,SAAW,IAAA,GACfC,EAAAA,sBAAsB,OACnB,GAAS,IAAS,OAAS,CAACd,EAAAA,QAAG,WAAWC,EAAAA,QAAK,KAAK,EAAQ,WAAY,sBAAsB,CAAC,CAClG,CAAC,CAAC,IAAK,GAAS,GAAGS,EAAAA,cAAc,GAAG,EAAK,IAAI,EAC7C,CAAC,GAAGA,EAAAA,cAAc,GAAG,EAAe,EAAQ,QAAQ,GAAG,EAAgB,EAAQ,SAAS,EACxF,CAAE,WAAYK,EAAAA,eAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
@@ -1,2 +1,2 @@
1
- import{API_ROUTES_MODULE as e,BUILD_TARGET_PLATFORMS as t,GENERATED_CLIENT_NAME as n,GENERATED_DIR as r,GENERATED_ENTRY_FILENAMES as i,GENERATED_ENTRY_NAMES as a}from"../../constants/layout.mjs";import{scanExtensions as o}from"../scan/index.mjs";import{resolveTarget as s}from"../resolveTarget/index.mjs";import{renderApiClient as c}from"../renderClient/index.mjs";import{renderCliEntry as l,renderServerEntry as u,renderWebEntry as d}from"../renderEntry/index.mjs";import{writeGenerated as f}from"../writeGenerated/index.mjs";import p from"node:fs";import m from"node:path";function h(e){return e.replace(/^@[^/]+\//u,``).replace(/^doompi-/u,``)}function g(e){let t=JSON.parse(p.readFileSync(m.join(e,`package.json`),`utf8`));if(typeof t.name!=`string`)throw Error(`${e}/package.json has no name`);return t.name}const _={cli:l,server:u,web:d},v=i,y={cli:`ts`,server:`ts`,web:`ts`};function b(i){let l=i.packageName??g(i.packageDir),u=i.pluginId??h(l),d=o(i),b=[...d.notices],x=new Map,S=[];for(let e of d.entries)e.platform===void 0||t.includes(e.platform)||b.push({path:e.file,message:`'${e.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server or web`});for(let e of[`cli`,`server`,`web`]){let t=s(d,e);if(b.push(...t.notices),t.contributions.length===0&&t.escapeHatches.length===0&&t.roots.length===0)continue;S.push(e);let n=_[e],i=n(t,{packageName:l,pluginId:u,root:d.root,entryDir:r});x.set(`${r}/${v[e]}.${y[e]}`,i)}let C=p.existsSync(m.join(i.packageDir,e)),w=S.includes(`web`),T=C&&w?c(d,{packageName:l,pluginId:u,root:d.root,entryDir:r}):void 0;T!==void 0&&x.set(`${r}/${n}.ts`,T),C&&w&&T===void 0&&b.push({path:e,message:`declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted`});let E=a.map(e=>`${r}/${e}.ts`),{changed:D}=f(i.packageDir,x,i.check,E);return{graph:d,packageName:l,pluginId:u,files:x,changed:D,notices:b,targets:S}}export{h as defaultPluginId,b as generateExtension};
1
+ import{API_ROUTES_MODULE as e,BUILD_TARGET_PLATFORMS as t,GENERATED_CLIENT_NAME as n,GENERATED_DIR as r,GENERATED_ENTRY_FILENAMES as i,GENERATED_ENTRY_NAMES as a}from"../../constants/layout.mjs";import{scanExtensions as o}from"../scan/index.mjs";import{resolveTarget as s}from"../resolveTarget/index.mjs";import{renderApiClient as c}from"../renderClient/index.mjs";import{renderCliEntry as l,renderMcpEntry as u,renderServerEntry as d,renderWebEntry as f}from"../renderEntry/index.mjs";import{writeGenerated as p}from"../writeGenerated/index.mjs";import m from"node:fs";import h from"node:path";function g(e){return e.replace(/^@[^/]+\//u,``).replace(/^doompi-/u,``)}function _(e){let t=JSON.parse(m.readFileSync(h.join(e,`package.json`),`utf8`));if(typeof t.name!=`string`)throw Error(`${e}/package.json has no name`);return t.name}const v={cli:l,server:d,web:f,mcp:u},y=i,b={cli:`ts`,server:`ts`,web:`ts`,mcp:`ts`};function x(i){let l=i.packageName??_(i.packageDir),u=i.pluginId??g(l),d=o(i),f=[...d.notices],x=new Map,S=[];for(let e of d.entries)e.platform===void 0||t.includes(e.platform)||f.push({path:e.file,message:`'${e.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`});let C=i.target===void 0?[`cli`,`server`,`web`]:[i.target];for(let e of C){let t=s(d,e);if(f.push(...t.notices),t.contributions.length===0&&t.escapeHatches.length===0&&t.roots.length===0)continue;S.push(e);let n=v[e],i=n(t,{packageName:l,pluginId:u,root:d.root,entryDir:r});x.set(`${r}/${y[e]}.${b[e]}`,i)}let w=i.target===void 0&&m.existsSync(h.join(i.packageDir,`src/types/apiRoutes.ts`)),T=S.includes(`web`),E=w&&T?c(d,{packageName:l,pluginId:u,root:d.root,entryDir:r}):void 0;E!==void 0&&x.set(`${r}/${n}.ts`,E),w&&T&&E===void 0&&f.push({path:e,message:`declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted`});let D=i.target===void 0?a.filter(e=>e!==`mcp`||!m.existsSync(h.join(i.packageDir,`tsdown.mcp.config.ts`))).map(e=>`${r}/${e}.ts`):[`${r}/${y[i.target]}.${b[i.target]}`],{changed:O}=p(i.packageDir,x,i.check,D);return{graph:d,packageName:l,pluginId:u,files:x,changed:O,notices:f,targets:S}}export{g as defaultPluginId,x as generateExtension};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\n\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server or web`,\n });\n }\n\n for (const target of ['cli', 'server', 'web'] as const) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n if (resolution.contributions.length === 0 && resolution.escapeHatches.length === 0 && resolution.roots.length === 0)\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed = GENERATED_ENTRY_NAMES.map((name) => `${GENERATED_DIR}/${name}.ts`);\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"+jBAqBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAM,EAAG,aAAa,EAAK,KAAK,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAO,EAAS,MAAS,SAAU,MAAU,MAAM,GAAG,EAAW,0BAA0B,EAC/F,OAAO,EAAS,IAClB,CAEA,MAAM,EAAkE,CACtE,IAAK,EACL,OAAQ,EACR,IAAK,CACP,EAGM,EAAwD,EAExD,EAAyD,CAAE,IAAK,KAAM,OAAQ,KAAM,IAAK,IAAK,EAUpG,SAAgB,EAAkB,EAA0C,CAC1E,IAAM,EAAc,EAAQ,aAAe,EAAgB,EAAQ,UAAU,EACvE,EAAW,EAAQ,UAAY,EAAgB,CAAW,EAE1D,EAAwB,EAAe,CAAO,EAC9C,EAA6B,CAAC,GAAG,EAAM,OAAO,EAC9C,EAAQ,IAAI,IACZ,EAAyB,CAAC,EAMhC,IAAK,IAAM,KAAS,EAAM,QACpB,EAAM,WAAa,IAAA,IAAa,EAAuB,SAAS,EAAM,QAAQ,GAClF,EAAQ,KAAK,CACX,KAAM,EAAM,KACZ,QAAS,IAAI,EAAM,SAAS,sGAC9B,CAAC,EAGH,IAAK,IAAM,IAAU,CAAC,MAAO,SAAU,KAAK,EAAY,CACtD,IAAM,EAAa,EAAc,EAAO,CAAM,EAE9C,GADA,EAAQ,KAAK,GAAG,EAAW,OAAO,EAC9B,EAAW,cAAc,SAAW,GAAK,EAAW,cAAc,SAAW,GAAK,EAAW,MAAM,SAAW,EAChH,SAEF,EAAQ,KAAK,CAAM,EACnB,IAAM,EAAS,EAAU,GACnB,EAAS,EAAO,EAAY,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAU,CAAc,CAAC,EACtG,EAAM,IAAI,GAAG,EAAc,GAAG,EAAe,GAAQ,GAAG,EAAgB,KAAW,CAAM,CAC3F,CAUA,IAAM,EAAgB,EAAG,WAAW,EAAK,KAAK,EAAQ,WAAY,CAAiB,CAAC,EAC9E,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACb,EAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAU,CAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAG,EAAc,GAAG,EAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAM,EACN,QAAS,2FACX,CAAC,EAGH,IAAM,EAAU,EAAsB,IAAK,GAAS,GAAG,EAAc,GAAG,EAAK,IAAI,EAC3E,CAAE,WAAY,EAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n if (resolution.contributions.length === 0 && resolution.escapeHatches.length === 0 && resolution.roots.length === 0)\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [`${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"mlBAqBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAM,EAAG,aAAa,EAAK,KAAK,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAO,EAAS,MAAS,SAAU,MAAU,MAAM,GAAG,EAAW,0BAA0B,EAC/F,OAAO,EAAS,IAClB,CAEA,MAAM,EAAkE,CACtE,IAAK,EACL,OAAQ,EACR,IAAK,EACL,IAAK,CACP,EAGM,EAAwD,EACxD,EAAyD,CAAE,IAAK,KAAM,OAAQ,KAAM,IAAK,KAAM,IAAK,IAAK,EAU/G,SAAgB,EAAkB,EAA0C,CAC1E,IAAM,EAAc,EAAQ,aAAe,EAAgB,EAAQ,UAAU,EACvE,EAAW,EAAQ,UAAY,EAAgB,CAAW,EAE1D,EAAwB,EAAe,CAAO,EAC9C,EAA6B,CAAC,GAAG,EAAM,OAAO,EAC9C,EAAQ,IAAI,IACZ,EAAyB,CAAC,EAMhC,IAAK,IAAM,KAAS,EAAM,QACpB,EAAM,WAAa,IAAA,IAAa,EAAuB,SAAS,EAAM,QAAQ,GAClF,EAAQ,KAAK,CACX,KAAM,EAAM,KACZ,QAAS,IAAI,EAAM,SAAS,2GAC9B,CAAC,EAGH,IAAM,EAAmB,EAAQ,SAAW,IAAA,GAAa,CAAC,MAAO,SAAU,KAAK,EAAc,CAAC,EAAQ,MAAM,EAC7G,IAAK,IAAM,KAAU,EAAkB,CACrC,IAAM,EAAa,EAAc,EAAO,CAAM,EAE9C,GADA,EAAQ,KAAK,GAAG,EAAW,OAAO,EAC9B,EAAW,cAAc,SAAW,GAAK,EAAW,cAAc,SAAW,GAAK,EAAW,MAAM,SAAW,EAChH,SAEF,EAAQ,KAAK,CAAM,EACnB,IAAM,EAAS,EAAU,GACnB,EAAS,EAAO,EAAY,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAU,CAAc,CAAC,EACtG,EAAM,IAAI,GAAG,EAAc,GAAG,EAAe,GAAQ,GAAG,EAAgB,KAAW,CAAM,CAC3F,CAUA,IAAM,EAAgB,EAAQ,SAAW,IAAA,IAAa,EAAG,WAAW,EAAK,KAAK,EAAQ,WAAA,wBAA6B,CAAC,EAC9G,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACb,EAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAU,CAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAG,EAAc,GAAG,EAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAM,EACN,QAAS,2FACX,CAAC,EAGH,IAAM,EACJ,EAAQ,SAAW,IAAA,GACf,EAAsB,OACnB,GAAS,IAAS,OAAS,CAAC,EAAG,WAAW,EAAK,KAAK,EAAQ,WAAY,sBAAsB,CAAC,CAClG,CAAC,CAAC,IAAK,GAAS,GAAG,EAAc,GAAG,EAAK,IAAI,EAC7C,CAAC,GAAG,EAAc,GAAG,EAAe,EAAQ,QAAQ,GAAG,EAAgB,EAAQ,SAAS,EACxF,CAAE,WAAY,EAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
@@ -3,6 +3,8 @@ import { ScanOptions } from "../scan/type.cjs";
3
3
  import { BuildTarget } from "../resolveTarget/type.cjs";
4
4
  //#region src/services/generate/type.d.ts
5
5
  export interface GenerateOptions extends ScanOptions {
6
+ /** Generate only one isolated host target. Omitted preserves the normal build. */
7
+ readonly target?: BuildTarget;
6
8
  /** Defaults to the name in the package's own package.json. */
7
9
  readonly packageName?: string;
8
10
  /** Defaults to the package name without its scope and `doompi-` prefix. */
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.cts","names":[],"sources":["../../../src/services/generate/type.ts"],"mappings":";;;;iBAIiB,wBAAwB;;WAE9B;;WAEA;;WAEA;;iBAGM;WACN,OAAO;WACP;WACA;;WAEA,OAAO;;WAEP;WACA,kBAAkB;;WAElB,kBAAkB"}
1
+ {"version":3,"file":"type.d.cts","names":[],"sources":["../../../src/services/generate/type.ts"],"mappings":";;;;iBAIiB,wBAAwB;;WAE9B,SAAS;;WAET;;WAEA;;WAEA;;iBAGM;WACN,OAAO;WACP;WACA;;WAEA,OAAO;;WAEP;WACA,kBAAkB;;WAElB,kBAAkB"}
@@ -3,6 +3,8 @@ import { ScanOptions } from "../scan/type.mjs";
3
3
  import { BuildTarget } from "../resolveTarget/type.mjs";
4
4
  //#region src/services/generate/type.d.ts
5
5
  export interface GenerateOptions extends ScanOptions {
6
+ /** Generate only one isolated host target. Omitted preserves the normal build. */
7
+ readonly target?: BuildTarget;
6
8
  /** Defaults to the name in the package's own package.json. */
7
9
  readonly packageName?: string;
8
10
  /** Defaults to the package name without its scope and `doompi-` prefix. */
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.mts","names":[],"sources":["../../../src/services/generate/type.ts"],"mappings":";;;;iBAIiB,wBAAwB;;WAE9B;;WAEA;;WAEA;;iBAGM;WACN,OAAO;WACP;WACA;;WAEA,OAAO;;WAEP;WACA,kBAAkB;;WAElB,kBAAkB"}
1
+ {"version":3,"file":"type.d.mts","names":[],"sources":["../../../src/services/generate/type.ts"],"mappings":";;;;iBAIiB,wBAAwB;;WAE9B,SAAS;;WAET;;WAEA;;WAEA;;iBAGM;WACN,OAAO;WACP;WACA;;WAEA,OAAO;;WAEP;WACA,kBAAkB;;WAElB,kBAAkB"}
@@ -1,7 +1,7 @@
1
- const e=require("../identity/index.cjs");let t=require("node:path");const n=`// Generated by @agimon-ai/doompi-build. Do not edit by hand.`,r=[`events`],i=[`fileLinks`,`repositorySettingsPanel`,`start`],a={cli:[`channels`],server:[`channels`],web:[]},o=[`services`],s=[`global`,`workspace`,`session`],c={cli:`PiPluginContributions`,server:`DoomServerSessionPlugin`,web:`WebPluginContributions`};function l(){return[`type Factory<T, C> = (context: C) => T;`,`const at = <T, C>(value: T | Factory<T, C>, context: C): T =>`,` typeof value === 'function' ? (value as Factory<T, C>)(context) : value;`].join(`
1
+ const e=require("../identity/index.cjs");let t=require("node:path");const n=`// Generated by @agimon-ai/doompi-build. Do not edit by hand.`,r=[`events`],i=[`fileLinks`,`repositorySettingsPanel`,`start`],a={cli:[`channels`],server:[`channels`],web:[],mcp:[]},o=[`services`],s=[`global`,`workspace`,`session`],c={cli:`PiPluginContributions`,server:`DoomServerSessionPlugin`,web:`WebPluginContributions`,mcp:`DoomMcpSessionPlugin`};function l(){return[`type Factory<T, C> = (context: C) => T;`,`const at = <T, C>(value: T | Factory<T, C>, context: C): T =>`,` typeof value === 'function' ? (value as Factory<T, C>)(context) : value;`].join(`
2
2
  `)}function u(){return[`type ManyFactory<T, C> = (context: C) => T | readonly T[];`,`const many = <T, C>(value: T | readonly T[] | ManyFactory<T, C>, context: C): readonly T[] => {`,` const resolved = typeof value === 'function' ? (value as ManyFactory<T, C>)(context) : value;`,` return Array.isArray(resolved) ? resolved : [resolved as T];`,`};`].join(`
3
3
  `)}function d(){return[`/* v8 ignore next -- generated normalization branch */`,`const defined = <T>(values: readonly (T | undefined)[]): T[] =>`,` values.filter((value): value is T => value !== undefined);`].join(`
4
4
  `)}function f(){return[`/* v8 ignore next -- generated normalization branch */`,`const keyed = <T>(key: string, value: T | undefined): Record<string, T> =>`,` value === undefined ? {} : { [key]: value };`].join(`
5
5
  `)}function p(t,n){return n===void 0?{id:e.toKebab(t)}:{slot:n,id:e.toKebab(t)}}const m={tool:t=>({name:e.toSnake(t)}),command:t=>({name:e.toKebab(t)}),channel:t=>({frameType:e.toSnake(t)}),hook:t=>({event:e.toSnake(t)}),mode:t=>({name:e.toKebab(t)})},h={tool:t=>({tools:[e.toSnake(t)]}),channel:t=>({channel:e.toSnake(t)}),slot:(t,n)=>({slot:`${n.pluginId}.${e.toKebab(t)}`}),command:t=>({id:e.toKebab(t)}),tab:t=>({id:e.toKebab(t)}),dock:t=>({id:e.toKebab(t)}),setting:t=>({id:e.toKebab(t)}),action:t=>({id:e.toKebab(t)}),mode:t=>({name:e.toKebab(t)}),"activity-group":t=>({name:e.toKebab(t)}),"selection-axis":t=>({name:e.toKebab(t)}),leader:(t,n)=>({id:`${n.pluginId}.${e.toKebab(t)}`})};function g(e,t,n){let{entry:r}=e,i=r.surface;if(i!==void 0)return t===`web`?i===`fill`?p(r.name,r.target):h[i]?.(r.name,n):m[i]?.(r.name)}function _(e,t){let n=e.join(`-`).split(/[^A-Za-z0-9]+/u).filter(e=>e.length>0).map((e,t)=>t===0?e:e[0]?.toUpperCase()+e.slice(1)).join(``),r=/^[A-Za-z_]/u.test(n)?n:`x${n}`,i=r,a=2;for(;t.has(i);)i=`${r}${a++}`;return t.add(i),i}function v(e,t){return _([e.entry.surface??`extra`,e.entry.name],t)}function y(e,n){let r=e.replace(/\.[^.]+$/u,``),i=t.posix.relative(n,r);return i.startsWith(`.`)?i:`./${i}`}function b(e,t){let n=new Set;return[...e.contributions].sort((e,t)=>e.entry.file.localeCompare(t.entry.file)).map(r=>{let i=v(r,n),a=r.renderers;return{identifier:i,contribution:r,identity:g(r,e.target,t),renderers:a===void 0?void 0:{identifier:_([`render`,a.name],n),file:a.file}}})}const x={global:0,workspace:1,session:2};function S(e){return e.map(e=>{let t=e.scope[0]?.toUpperCase()+e.scope.slice(1);return{identifier:`root${t}`,declaration:`scope${t}`,context:`context${t}`,entry:e}})}function C(e,t,n){let r=[],i=t;for(let[t,a]of e.entries())r.push(`const ${a.declaration} = await ${a.identifier}(${i});`),(t<e.length-1||n.some(e=>e.includes(a.context)))&&r.push(`const ${a.context} = { ...${i}, root: ${a.declaration}.value };`),i=a.context;return r}function w(e,t,n){let r=n;for(let n of e)x[n.entry.scope]<=x[t]&&(r=n.context);return r}function T(e){return[...e].sort((e,t)=>e.file.localeCompare(t.file)).map((e,t)=>({identifier:`extra${t===0?``:t+1}`,entry:e}))}function E(t,n,r){if(o.includes(t.contribution.field))return`${t.identifier}(${n})`;let i=r===`web`?t.identifier:`at(${t.identifier}, ${n})`;if(r===`cli`&&t.contribution.entry.surface===`command`&&t.contribution.entry.platform===`cli`)return i;let s=t.renderers===void 0?i:`withPiRenderers(${i}, at(${t.renderers.identifier}, ${n}))`,c=a[r].includes(t.contribution.field);if(t.contribution.entry.cardinality===`collection`)return s;if(t.identity===void 0)return c?t.identifier:s;let l=e.renderIdentity(t.identity);return c?`() => via({ ${l} }, ${t.identifier}())`:`via({ ${l} }, ${s})`}function D(e,t,n,r){return e!==`tools`||t!==`cli`?`${e}: ${n},`:`...piToolContributions('${r.packageName}', ${n}),`}function O(e){return`import { ${[`defineServerPlugin`,...e.some(e=>e.includes(`get `))?[`type DoomServerSessionPlugin`]:[]].join(`, `)} } from '@agimon-ai/doompi-core/server-facet';`}function k(e,t){let n=[`definePiExtension`];e.some(e=>e.includes(`piToolContributions(`))&&n.push(`piToolContributions`),e.some(e=>e.includes(`withPiRenderers(`))&&n.push(`withPiRenderers`);let r=[...e.some(e=>e.includes(`at(`))||t?[`type PiPluginContext`]:[],...e.some(e=>e.includes(c.cli))?[`type ${c.cli}`]:[]];return`import { ${[...n,...r].join(`, `)} } from '@agimon-ai/doompi-core/pi-extension';`}function A(e,t,n){if(e===`services`||t.startsWith(`...`))return t;let[r,...i]=t.split(`: `);return`get ${r}(): ${`${c[n]}['${r}']`} { return ${i.join(`: `).replace(/,$/u,``)}; },`}function j(t,n,a,o,s){let c=new Map;for(let e of t){let t=c.get(e.contribution.field);t===void 0?c.set(e.contribution.field,[e]):t.push(e)}let l=[];for(let t of[...c.keys()].sort()){let u=c.get(t);if(r.includes(t)){l.push(`${n}${t}: {`);for(let t of u){let r=e.toSnake(t.contribution.entry.name),i=`at(${t.identifier}, ${a(t)})`,s=o===`cli`?`${i} as NonNullable<PiPluginContributions['events']>['${r}']`:i;l.push(t.contribution.entry.cardinality===`optional`?`${n} ...keyed('${r}', ${s}),`:`${n} ${r}: ${s},`)}l.push(`${n}},`);continue}if(o===`cli`&&u.length===1&&u[0]?.contribution.entry.cardinality===`collection`){let e=u[0],r=E(e,a(e),o);l.push(`${n}${A(t,D(t,o,r,s),o)}`);continue}if(i.includes(t)){let e=u[0];if(e){let r=E(e,a(e),o);l.push(`${n}${A(t,`${t}: ${r},`,o)}`)}continue}let d=`[${u.map(e=>e.contribution.entry.cardinality===`many`?`...many(${e.identifier}, ${a(e)})`:E(e,a(e),o)).join(`, `)}]`,f=u.some(e=>e.contribution.entry.cardinality===`optional`)?`defined(${d})`:d;l.push(`${n}${A(t,D(t,o,f,s),o)}`)}return l}function M(e,t,n,r,i){if(t.length===0)return[...e];let a=[...e],o=a.findIndex(e=>e.startsWith(`${r}services: [`)),s=o<0?``:a.splice(o,1)[0]?.match(/services: \[(.*)\],$/u)?.[1]??``,c=[...t.map(e=>`...(${e.declaration}.services ?? [])`),s].filter(Boolean).join(`, `);if(a.push(`${r}services: [${c}],`),n===`server`&&i===`session`){let e=a.findIndex(e=>e.startsWith(`${r}get activities()`)),n=e<0?``:a.splice(e,1)[0]?.match(/return \[(.*)\]; \},$/u)?.[1]??``,i=[...t.map(e=>`...(${e.declaration}.activities ?? [])`),n].filter(Boolean).join(`, `);a.push(`${r}get activities(): DoomServerSessionPlugin['activities'] { return [${i}]; },`)}return a}function N(e,t,n,r){return[...n.map(e=>`import ${e.identifier} from '${y(e.entry.file,r)}';`),...e.flatMap(e=>[`import ${e.identifier} from '${y(e.contribution.entry.file,r)}';`,...e.renderers===void 0?[]:[`import ${e.renderers.identifier} from '${y(e.renderers.file,r)}';`]]),...t.map(e=>`import ${e.identifier} from '${y(e.entry.file,r)}';`)]}function P(e){return e.filter((e,t,n)=>e!==``||n[t-1]!==``).join(`
6
- `)}function F(e){return e.length===0?[]:[`type OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;`,`type InferredOptions = Exclude<${e.map(e=>`OptionsOf<typeof ${e}>`).join(` | `)}, undefined>;`,`type Intersect<Union> =`,` (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;`,`type ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;`,``]}function I(e){let t=[];return e.some(e=>e.includes(`at(`))&&t.push(l()),e.some(e=>e.includes(`many(`))&&t.push(u()),e.some(e=>e.includes(`defined(`))&&t.push(d()),e.some(e=>e.includes(`keyed(`))&&t.push(f()),e.some(e=>e.includes(`via(`))&&t.push(`const via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;`),t.length>0?[...t,``]:[]}function L(e){return e.some(e=>e.includes(`, context)`)||e.includes(`(context)`))?`(context)`:`()`}function R(e,t,n,r){let i=[...t===void 0?[]:[`${r} ${t}`],...n],a=[...e,...n].some(e=>e.includes(`await `))?`async `:``;return e.length===0?[`${a}${L(n)} => ({`,...i,`${r}}),`]:[`${a}${L([...e,...n])} => {`,...e.map(e=>`${r} ${e}`),`${r} return {`,...i.map(e=>` ${e}`),`${r} };`,`${r}},`]}function z(e){if(e.length!==0)return`...composeRootHooks(${e.map(e=>e.declaration).join(`, `)}),`}function B(e,t){let r=b(e,t),i=T(e.escapeHatches),a=S(e.roots),o=a[a.length-1]?.context??`context`,s=[...M(j(r,` `,e=>w(a,e.contribution.entry.scope,`context`),`cli`,t),a,`cli`,` `,`session`),...i.map(e=>` ...await at(${e.identifier}, ${o}),`)],c=C(a,`context`,s),l=R(c,z(a),s,``),u=[...a.map(e=>e.identifier),...r.map(e=>e.identifier),...i.map(e=>e.identifier)],d=u.length>0;return P([n,k([...c,...s],d),...a.length>0?[`import { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';`]:[],``,...N(r,i,a,t.entryDir),``,...F(u),...I(s),`export const extension = definePiExtension${d?`<ExtensionOptions>`:``}('${t.packageName}', ${l[0]}`,...l.slice(1,-1),`${l[l.length-1]?.replace(/,$/u,``)});`,``,`export default extension;`,``])}function V(e,t){let r=b(e,t),i=T(e.escapeHatches),a=S(e.roots),o=[],c=!1;for(let[e,n]of s.entries()){let l=r.filter(t=>s.indexOf(t.contribution.entry.scope)<=e),u=i.filter(t=>s.indexOf(t.entry.scope)<=e),d=a.filter(t=>s.indexOf(t.entry.scope)<=e),f=d[d.length-1]?.context??`context`,p=[...M(j(l,` `,e=>w(d,e.contribution.entry.scope,`context`),`server`,t),d,`server`,` `,n),...u.map(e=>` ...await at(${e.identifier}, ${f}),`)];if(p.length===0&&d.length===0)continue;d.length>0&&(c=!0);let m=R(C(d,`context`,p),z(d),p,` `);o.push(` ${n}: ${m[0]}`,...m.slice(1))}return P([n,O(o),...c?[`import { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';`]:[],``,...N(r,i,a,t.entryDir),``,...I(o),`export const facet = defineServerPlugin({`,` name: '${t.packageName}',`,...o,`});`,``,`export default facet;`,``])}function H(e,t){let r=b(e,t),i=T(e.escapeHatches),a=[];for(let e of s){let n=r.filter(t=>t.contribution.entry.scope===e),o=i.filter(t=>t.entry.scope===e),s=[...j(n,` `,()=>`undefined`,`web`,t),...o.map(e=>` ...${e.identifier},`)];s.length!==0&&a.push(` ${e}: {`,...s,` },`)}return P([n,a.some(e=>e.includes(`get `))?`import { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/doompi-core/web';`:`import { defineWebPlugin } from '@agimon-ai/doompi-core/web';`,``,...N(r,i,[],t.entryDir),``,...I(a),`export const webPlugin = defineWebPlugin({`,` id: '${t.pluginId}',`,...a,`});`,``])}exports.renderCliEntry=B,exports.renderServerEntry=V,exports.renderWebEntry=H;
6
+ `)}function F(e){return e.length===0?[]:[`type OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;`,`type InferredOptions = Exclude<${e.map(e=>`OptionsOf<typeof ${e}>`).join(` | `)}, undefined>;`,`type Intersect<Union> =`,` (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;`,`type ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;`,``]}function I(e){let t=[];return e.some(e=>e.includes(`at(`))&&t.push(l()),e.some(e=>e.includes(`many(`))&&t.push(u()),e.some(e=>e.includes(`defined(`))&&t.push(d()),e.some(e=>e.includes(`keyed(`))&&t.push(f()),e.some(e=>e.includes(`via(`))&&t.push(`const via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;`),t.length>0?[...t,``]:[]}function L(e){return e.some(e=>e.includes(`, context)`)||e.includes(`(context)`))?`(context)`:`()`}function R(e,t,n,r){let i=[...t===void 0?[]:[`${r} ${t}`],...n],a=[...e,...n].some(e=>e.includes(`await `))?`async `:``;return e.length===0?[`${a}${L(n)} => ({`,...i,`${r}}),`]:[`${a}${L([...e,...n])} => {`,...e.map(e=>`${r} ${e}`),`${r} return {`,...i.map(e=>` ${e}`),`${r} };`,`${r}},`]}function z(e){if(e.length!==0)return`...composeRootHooks(${e.map(e=>e.declaration).join(`, `)}),`}function B(e,t){let r=b(e,t),i=T(e.escapeHatches),a=S(e.roots),o=a[a.length-1]?.context??`context`,s=[...M(j(r,` `,e=>w(a,e.contribution.entry.scope,`context`),`cli`,t),a,`cli`,` `,`session`),...i.map(e=>` ...await at(${e.identifier}, ${o}),`)],c=C(a,`context`,s),l=R(c,z(a),s,``),u=[...a.map(e=>e.identifier),...r.map(e=>e.identifier),...i.map(e=>e.identifier)],d=u.length>0;return P([n,k([...c,...s],d),...a.length>0?[`import { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';`]:[],``,...N(r,i,a,t.entryDir),``,...F(u),...I(s),`export const extension = definePiExtension${d?`<ExtensionOptions>`:``}('${t.packageName}', ${l[0]}`,...l.slice(1,-1),`${l[l.length-1]?.replace(/,$/u,``)});`,``,`export default extension;`,``])}function V(e,t){let r=b(e,t),i=T(e.escapeHatches),a=S(e.roots),o=[],c=!1;for(let[e,n]of s.entries()){let l=r.filter(t=>s.indexOf(t.contribution.entry.scope)<=e),u=i.filter(t=>s.indexOf(t.entry.scope)<=e),d=a.filter(t=>s.indexOf(t.entry.scope)<=e),f=d[d.length-1]?.context??`context`,p=[...M(j(l,` `,e=>w(d,e.contribution.entry.scope,`context`),`server`,t),d,`server`,` `,n),...u.map(e=>` ...await at(${e.identifier}, ${f}),`)];if(p.length===0&&d.length===0)continue;d.length>0&&(c=!0);let m=R(C(d,`context`,p),z(d),p,` `);o.push(` ${n}: ${m[0]}`,...m.slice(1))}return P([n,O(o),...c?[`import { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';`]:[],``,...N(r,i,a,t.entryDir),``,...I(o),`export const facet = defineServerPlugin({`,` name: '${t.packageName}',`,...o,`});`,``,`export default facet;`,``])}function H(e,t){let r=b(e,t),i=j(r,` `,()=>`context`,`mcp`,t);return P([n,`import { defineMcpPlugin, type DoomMcpSessionPlugin } from '@agimon-ai/doompi-core/mcp-facet';`,``,...N(r,[],[],t.entryDir),``,...I(i),`export const mcp = defineMcpPlugin({`,` name: '${t.packageName}',`,` session: (context) => ({`,...i,` }) satisfies DoomMcpSessionPlugin,`,`});`,``,`export default mcp;`,``])}function U(e,t){let r=b(e,t),i=T(e.escapeHatches),a=[];for(let e of s){let n=r.filter(t=>t.contribution.entry.scope===e),o=i.filter(t=>t.entry.scope===e),s=[...j(n,` `,()=>`undefined`,`web`,t),...o.map(e=>` ...${e.identifier},`)];s.length!==0&&a.push(` ${e}: {`,...s,` },`)}return P([n,a.some(e=>e.includes(`get `))?`import { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/doompi-core/web';`:`import { defineWebPlugin } from '@agimon-ai/doompi-core/web';`,``,...N(r,i,[],t.entryDir),``,...I(a),`export const webPlugin = defineWebPlugin({`,` id: '${t.pluginId}',`,...a,`});`,``])}exports.renderCliEntry=B,exports.renderMcpEntry=H,exports.renderServerEntry=V,exports.renderWebEntry=U;
7
7
  //# sourceMappingURL=index.cjs.map