@owlmeans/viable-common 0.0.4
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.
- package/README.md +68 -0
- package/agent-meta/manifest.json +16 -0
- package/agent-meta/skills/viable-common/SKILL.md +179 -0
- package/build/agent/index.d.ts +4 -0
- package/build/agent/index.d.ts.map +1 -0
- package/build/agent/index.js +3 -0
- package/build/agent/index.js.map +1 -0
- package/build/agent/memory.d.ts +12 -0
- package/build/agent/memory.d.ts.map +1 -0
- package/build/agent/memory.js +11 -0
- package/build/agent/memory.js.map +1 -0
- package/build/agent/spectator/consts.d.ts +9 -0
- package/build/agent/spectator/consts.d.ts.map +1 -0
- package/build/agent/spectator/consts.js +10 -0
- package/build/agent/spectator/consts.js.map +1 -0
- package/build/agent/spectator/index.d.ts +3 -0
- package/build/agent/spectator/index.d.ts.map +1 -0
- package/build/agent/spectator/index.js +2 -0
- package/build/agent/spectator/index.js.map +1 -0
- package/build/agent/spectator/types.d.ts +13 -0
- package/build/agent/spectator/types.d.ts.map +1 -0
- package/build/agent/spectator/types.js +2 -0
- package/build/agent/spectator/types.js.map +1 -0
- package/build/agent/types.d.ts +10 -0
- package/build/agent/types.d.ts.map +1 -0
- package/build/agent/types.js +2 -0
- package/build/agent/types.js.map +1 -0
- package/build/areas/consts.d.ts +88 -0
- package/build/areas/consts.d.ts.map +1 -0
- package/build/areas/consts.js +106 -0
- package/build/areas/consts.js.map +1 -0
- package/build/areas/index.d.ts +3 -0
- package/build/areas/index.d.ts.map +1 -0
- package/build/areas/index.js +2 -0
- package/build/areas/index.js.map +1 -0
- package/build/areas/types.d.ts +28 -0
- package/build/areas/types.d.ts.map +1 -0
- package/build/areas/types.js +2 -0
- package/build/areas/types.js.map +1 -0
- package/build/ba/consts.d.ts +38 -0
- package/build/ba/consts.d.ts.map +1 -0
- package/build/ba/consts.js +41 -0
- package/build/ba/consts.js.map +1 -0
- package/build/ba/helpers.d.ts +41 -0
- package/build/ba/helpers.d.ts.map +1 -0
- package/build/ba/helpers.js +79 -0
- package/build/ba/helpers.js.map +1 -0
- package/build/ba/index.d.ts +5 -0
- package/build/ba/index.d.ts.map +1 -0
- package/build/ba/index.js +4 -0
- package/build/ba/index.js.map +1 -0
- package/build/ba/schemas.d.ts +13 -0
- package/build/ba/schemas.d.ts.map +1 -0
- package/build/ba/schemas.js +181 -0
- package/build/ba/schemas.js.map +1 -0
- package/build/ba/types.d.ts +113 -0
- package/build/ba/types.d.ts.map +1 -0
- package/build/ba/types.js +2 -0
- package/build/ba/types.js.map +1 -0
- package/build/blueprint/case.d.ts +73 -0
- package/build/blueprint/case.d.ts.map +1 -0
- package/build/blueprint/case.js +244 -0
- package/build/blueprint/case.js.map +1 -0
- package/build/blueprint/consts.d.ts +11 -0
- package/build/blueprint/consts.d.ts.map +1 -0
- package/build/blueprint/consts.js +11 -0
- package/build/blueprint/consts.js.map +1 -0
- package/build/blueprint/index.d.ts +6 -0
- package/build/blueprint/index.d.ts.map +1 -0
- package/build/blueprint/index.js +6 -0
- package/build/blueprint/index.js.map +1 -0
- package/build/blueprint/resolve.d.ts +51 -0
- package/build/blueprint/resolve.d.ts.map +1 -0
- package/build/blueprint/resolve.js +108 -0
- package/build/blueprint/resolve.js.map +1 -0
- package/build/blueprint/schemas.d.ts +41 -0
- package/build/blueprint/schemas.d.ts.map +1 -0
- package/build/blueprint/schemas.js +27 -0
- package/build/blueprint/schemas.js.map +1 -0
- package/build/blueprint/types.d.ts +186 -0
- package/build/blueprint/types.d.ts.map +1 -0
- package/build/blueprint/types.js +32 -0
- package/build/blueprint/types.js.map +1 -0
- package/build/branding.d.ts +19 -0
- package/build/branding.d.ts.map +1 -0
- package/build/branding.js +32 -0
- package/build/branding.js.map +1 -0
- package/build/connect/consts.d.ts +378 -0
- package/build/connect/consts.d.ts.map +1 -0
- package/build/connect/consts.js +425 -0
- package/build/connect/consts.js.map +1 -0
- package/build/connect/entrypoints.d.ts +41 -0
- package/build/connect/entrypoints.d.ts.map +1 -0
- package/build/connect/entrypoints.js +141 -0
- package/build/connect/entrypoints.js.map +1 -0
- package/build/connect/errors.d.ts +50 -0
- package/build/connect/errors.d.ts.map +1 -0
- package/build/connect/errors.js +77 -0
- package/build/connect/errors.js.map +1 -0
- package/build/connect/index.d.ts +8 -0
- package/build/connect/index.d.ts.map +1 -0
- package/build/connect/index.js +6 -0
- package/build/connect/index.js.map +1 -0
- package/build/connect/ops.d.ts +192 -0
- package/build/connect/ops.d.ts.map +1 -0
- package/build/connect/ops.js +2 -0
- package/build/connect/ops.js.map +1 -0
- package/build/connect/references.d.ts +194 -0
- package/build/connect/references.d.ts.map +1 -0
- package/build/connect/references.js +62 -0
- package/build/connect/references.js.map +1 -0
- package/build/connect/schemas.d.ts +59 -0
- package/build/connect/schemas.d.ts.map +1 -0
- package/build/connect/schemas.js +346 -0
- package/build/connect/schemas.js.map +1 -0
- package/build/connect/types.d.ts +428 -0
- package/build/connect/types.d.ts.map +1 -0
- package/build/connect/types.js +2 -0
- package/build/connect/types.js.map +1 -0
- package/build/consts.d.ts +9 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +31 -0
- package/build/consts.js.map +1 -0
- package/build/convert/consts.d.ts +539 -0
- package/build/convert/consts.d.ts.map +1 -0
- package/build/convert/consts.js +630 -0
- package/build/convert/consts.js.map +1 -0
- package/build/convert/helpers.d.ts +91 -0
- package/build/convert/helpers.d.ts.map +1 -0
- package/build/convert/helpers.js +301 -0
- package/build/convert/helpers.js.map +1 -0
- package/build/convert/index.d.ts +11 -0
- package/build/convert/index.d.ts.map +1 -0
- package/build/convert/index.js +4 -0
- package/build/convert/index.js.map +1 -0
- package/build/convert/schemas.d.ts +62 -0
- package/build/convert/schemas.d.ts.map +1 -0
- package/build/convert/schemas.js +626 -0
- package/build/convert/schemas.js.map +1 -0
- package/build/convert/types.d.ts +683 -0
- package/build/convert/types.d.ts.map +1 -0
- package/build/convert/types.js +2 -0
- package/build/convert/types.js.map +1 -0
- package/build/design/consts.d.ts +25 -0
- package/build/design/consts.d.ts.map +1 -0
- package/build/design/consts.js +26 -0
- package/build/design/consts.js.map +1 -0
- package/build/design/helpers.d.ts +60 -0
- package/build/design/helpers.d.ts.map +1 -0
- package/build/design/helpers.js +221 -0
- package/build/design/helpers.js.map +1 -0
- package/build/design/index.d.ts +6 -0
- package/build/design/index.d.ts.map +1 -0
- package/build/design/index.js +5 -0
- package/build/design/index.js.map +1 -0
- package/build/design/runtime.d.ts +126 -0
- package/build/design/runtime.d.ts.map +1 -0
- package/build/design/runtime.js +65 -0
- package/build/design/runtime.js.map +1 -0
- package/build/design/schemas.d.ts +21 -0
- package/build/design/schemas.d.ts.map +1 -0
- package/build/design/schemas.js +369 -0
- package/build/design/schemas.js.map +1 -0
- package/build/design/types.d.ts +199 -0
- package/build/design/types.d.ts.map +1 -0
- package/build/design/types.js +2 -0
- package/build/design/types.js.map +1 -0
- package/build/dev/consts.d.ts +32 -0
- package/build/dev/consts.d.ts.map +1 -0
- package/build/dev/consts.js +33 -0
- package/build/dev/consts.js.map +1 -0
- package/build/dev/index.d.ts +4 -0
- package/build/dev/index.d.ts.map +1 -0
- package/build/dev/index.js +3 -0
- package/build/dev/index.js.map +1 -0
- package/build/dev/schemas.d.ts +15 -0
- package/build/dev/schemas.d.ts.map +1 -0
- package/build/dev/schemas.js +116 -0
- package/build/dev/schemas.js.map +1 -0
- package/build/dev/types.d.ts +42 -0
- package/build/dev/types.d.ts.map +1 -0
- package/build/dev/types.js +2 -0
- package/build/dev/types.js.map +1 -0
- package/build/execution/consts.d.ts +36 -0
- package/build/execution/consts.d.ts.map +1 -0
- package/build/execution/consts.js +37 -0
- package/build/execution/consts.js.map +1 -0
- package/build/execution/index.d.ts +3 -0
- package/build/execution/index.d.ts.map +1 -0
- package/build/execution/index.js +2 -0
- package/build/execution/index.js.map +1 -0
- package/build/execution/types.d.ts +50 -0
- package/build/execution/types.d.ts.map +1 -0
- package/build/execution/types.js +2 -0
- package/build/execution/types.js.map +1 -0
- package/build/index.d.ts +22 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +21 -0
- package/build/index.js.map +1 -0
- package/build/integrity/consts.d.ts +226 -0
- package/build/integrity/consts.d.ts.map +1 -0
- package/build/integrity/consts.js +401 -0
- package/build/integrity/consts.js.map +1 -0
- package/build/integrity/index.d.ts +4 -0
- package/build/integrity/index.d.ts.map +1 -0
- package/build/integrity/index.js +3 -0
- package/build/integrity/index.js.map +1 -0
- package/build/integrity/types.d.ts +35 -0
- package/build/integrity/types.d.ts.map +1 -0
- package/build/integrity/types.js +2 -0
- package/build/integrity/types.js.map +1 -0
- package/build/integrity/verify.d.ts +23 -0
- package/build/integrity/verify.d.ts.map +1 -0
- package/build/integrity/verify.js +198 -0
- package/build/integrity/verify.js.map +1 -0
- package/build/metadata/consts.d.ts +101 -0
- package/build/metadata/consts.d.ts.map +1 -0
- package/build/metadata/consts.js +104 -0
- package/build/metadata/consts.js.map +1 -0
- package/build/metadata/index.d.ts +3 -0
- package/build/metadata/index.d.ts.map +1 -0
- package/build/metadata/index.js +3 -0
- package/build/metadata/index.js.map +1 -0
- package/build/metadata/types.d.ts +286 -0
- package/build/metadata/types.d.ts.map +1 -0
- package/build/metadata/types.js +39 -0
- package/build/metadata/types.js.map +1 -0
- package/build/moderation/consts.d.ts +58 -0
- package/build/moderation/consts.d.ts.map +1 -0
- package/build/moderation/consts.js +60 -0
- package/build/moderation/consts.js.map +1 -0
- package/build/moderation/index.d.ts +5 -0
- package/build/moderation/index.d.ts.map +1 -0
- package/build/moderation/index.js +4 -0
- package/build/moderation/index.js.map +1 -0
- package/build/moderation/schemas.d.ts +19 -0
- package/build/moderation/schemas.d.ts.map +1 -0
- package/build/moderation/schemas.js +26 -0
- package/build/moderation/schemas.js.map +1 -0
- package/build/moderation/types.d.ts +64 -0
- package/build/moderation/types.d.ts.map +1 -0
- package/build/moderation/types.js +2 -0
- package/build/moderation/types.js.map +1 -0
- package/build/moderation/utils.d.ts +21 -0
- package/build/moderation/utils.d.ts.map +1 -0
- package/build/moderation/utils.js +31 -0
- package/build/moderation/utils.js.map +1 -0
- package/build/preview/consts.d.ts +10 -0
- package/build/preview/consts.d.ts.map +1 -0
- package/build/preview/consts.js +11 -0
- package/build/preview/consts.js.map +1 -0
- package/build/preview/index.d.ts +3 -0
- package/build/preview/index.d.ts.map +1 -0
- package/build/preview/index.js +2 -0
- package/build/preview/index.js.map +1 -0
- package/build/preview/types.d.ts +60 -0
- package/build/preview/types.d.ts.map +1 -0
- package/build/preview/types.js +2 -0
- package/build/preview/types.js.map +1 -0
- package/build/scaffold/consts.d.ts +25 -0
- package/build/scaffold/consts.d.ts.map +1 -0
- package/build/scaffold/consts.js +26 -0
- package/build/scaffold/consts.js.map +1 -0
- package/build/scaffold/helpers.d.ts +35 -0
- package/build/scaffold/helpers.d.ts.map +1 -0
- package/build/scaffold/helpers.js +54 -0
- package/build/scaffold/helpers.js.map +1 -0
- package/build/scaffold/index.d.ts +5 -0
- package/build/scaffold/index.d.ts.map +1 -0
- package/build/scaffold/index.js +4 -0
- package/build/scaffold/index.js.map +1 -0
- package/build/scaffold/schemas.d.ts +5 -0
- package/build/scaffold/schemas.d.ts.map +1 -0
- package/build/scaffold/schemas.js +273 -0
- package/build/scaffold/schemas.js.map +1 -0
- package/build/scaffold/types.d.ts +144 -0
- package/build/scaffold/types.d.ts.map +1 -0
- package/build/scaffold/types.js +2 -0
- package/build/scaffold/types.js.map +1 -0
- package/build/skills/catalogue.d.ts +47 -0
- package/build/skills/catalogue.d.ts.map +1 -0
- package/build/skills/catalogue.js +1566 -0
- package/build/skills/catalogue.js.map +1 -0
- package/build/skills/consts.d.ts +104 -0
- package/build/skills/consts.d.ts.map +1 -0
- package/build/skills/consts.js +170 -0
- package/build/skills/consts.js.map +1 -0
- package/build/skills/index.d.ts +4 -0
- package/build/skills/index.d.ts.map +1 -0
- package/build/skills/index.js +4 -0
- package/build/skills/index.js.map +1 -0
- package/build/skills/roles.d.ts +52 -0
- package/build/skills/roles.d.ts.map +1 -0
- package/build/skills/roles.js +256 -0
- package/build/skills/roles.js.map +1 -0
- package/build/slot/consts.d.ts +305 -0
- package/build/slot/consts.d.ts.map +1 -0
- package/build/slot/consts.js +376 -0
- package/build/slot/consts.js.map +1 -0
- package/build/slot/helpers.d.ts +25 -0
- package/build/slot/helpers.d.ts.map +1 -0
- package/build/slot/helpers.js +27 -0
- package/build/slot/helpers.js.map +1 -0
- package/build/slot/index.d.ts +6 -0
- package/build/slot/index.d.ts.map +1 -0
- package/build/slot/index.js +5 -0
- package/build/slot/index.js.map +1 -0
- package/build/slot/layout.d.ts +72 -0
- package/build/slot/layout.d.ts.map +1 -0
- package/build/slot/layout.js +82 -0
- package/build/slot/layout.js.map +1 -0
- package/build/slot/schemas.d.ts +12 -0
- package/build/slot/schemas.d.ts.map +1 -0
- package/build/slot/schemas.js +43 -0
- package/build/slot/schemas.js.map +1 -0
- package/build/slot/types.d.ts +147 -0
- package/build/slot/types.d.ts.map +1 -0
- package/build/slot/types.js +2 -0
- package/build/slot/types.js.map +1 -0
- package/build/topology/card.d.ts +23 -0
- package/build/topology/card.d.ts.map +1 -0
- package/build/topology/card.js +95 -0
- package/build/topology/card.js.map +1 -0
- package/build/topology/consts.d.ts +32 -0
- package/build/topology/consts.d.ts.map +1 -0
- package/build/topology/consts.js +55 -0
- package/build/topology/consts.js.map +1 -0
- package/build/topology/helpers.d.ts +44 -0
- package/build/topology/helpers.d.ts.map +1 -0
- package/build/topology/helpers.js +112 -0
- package/build/topology/helpers.js.map +1 -0
- package/build/topology/index.d.ts +5 -0
- package/build/topology/index.d.ts.map +1 -0
- package/build/topology/index.js +4 -0
- package/build/topology/index.js.map +1 -0
- package/build/topology/types.d.ts +83 -0
- package/build/topology/types.d.ts.map +1 -0
- package/build/topology/types.js +2 -0
- package/build/topology/types.js.map +1 -0
- package/build/types.d.ts +88 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/ux/consts.d.ts +5 -0
- package/build/ux/consts.d.ts.map +1 -0
- package/build/ux/consts.js +6 -0
- package/build/ux/consts.js.map +1 -0
- package/build/ux/index.d.ts +4 -0
- package/build/ux/index.d.ts.map +1 -0
- package/build/ux/index.js +3 -0
- package/build/ux/index.js.map +1 -0
- package/build/ux/schemas.d.ts +8 -0
- package/build/ux/schemas.d.ts.map +1 -0
- package/build/ux/schemas.js +91 -0
- package/build/ux/schemas.js.map +1 -0
- package/build/ux/types.d.ts +21 -0
- package/build/ux/types.d.ts.map +1 -0
- package/build/ux/types.js +2 -0
- package/build/ux/types.js.map +1 -0
- package/package.json +71 -0
- package/src/agent/index.ts +4 -0
- package/src/agent/memory.ts +16 -0
- package/src/agent/spectator/consts.ts +10 -0
- package/src/agent/spectator/index.ts +3 -0
- package/src/agent/spectator/types.ts +14 -0
- package/src/agent/types.ts +10 -0
- package/src/areas/consts.ts +112 -0
- package/src/areas/index.ts +3 -0
- package/src/areas/types.ts +29 -0
- package/src/ba/consts.ts +40 -0
- package/src/ba/helpers.ts +93 -0
- package/src/ba/index.ts +5 -0
- package/src/ba/schemas.ts +196 -0
- package/src/ba/types.ts +125 -0
- package/src/blueprint/case.ts +272 -0
- package/src/blueprint/consts.ts +11 -0
- package/src/blueprint/index.ts +6 -0
- package/src/blueprint/resolve.ts +133 -0
- package/src/blueprint/schemas.ts +44 -0
- package/src/blueprint/types.ts +204 -0
- package/src/branding.ts +34 -0
- package/src/connect/consts.ts +441 -0
- package/src/connect/entrypoints.ts +291 -0
- package/src/connect/errors.ts +91 -0
- package/src/connect/index.ts +7 -0
- package/src/connect/ops.ts +208 -0
- package/src/connect/references.ts +89 -0
- package/src/connect/schemas.ts +384 -0
- package/src/connect/types.ts +456 -0
- package/src/consts.ts +34 -0
- package/src/convert/consts.ts +672 -0
- package/src/convert/helpers.ts +340 -0
- package/src/convert/index.ts +10 -0
- package/src/convert/schemas.ts +663 -0
- package/src/convert/types.ts +741 -0
- package/src/design/consts.ts +26 -0
- package/src/design/helpers.ts +255 -0
- package/src/design/index.ts +5 -0
- package/src/design/runtime.ts +142 -0
- package/src/design/schemas.ts +384 -0
- package/src/design/types.ts +191 -0
- package/src/dev/consts.ts +35 -0
- package/src/dev/index.ts +4 -0
- package/src/dev/schemas.ts +124 -0
- package/src/dev/types.ts +47 -0
- package/src/execution/consts.ts +37 -0
- package/src/execution/index.ts +3 -0
- package/src/execution/types.ts +55 -0
- package/src/index.ts +22 -0
- package/src/integrity/consts.ts +477 -0
- package/src/integrity/index.ts +3 -0
- package/src/integrity/types.ts +37 -0
- package/src/integrity/verify.ts +221 -0
- package/src/metadata/consts.ts +118 -0
- package/src/metadata/index.ts +3 -0
- package/src/metadata/types.ts +310 -0
- package/src/moderation/consts.ts +59 -0
- package/src/moderation/index.ts +4 -0
- package/src/moderation/schemas.ts +28 -0
- package/src/moderation/types.ts +68 -0
- package/src/moderation/utils.ts +35 -0
- package/src/preview/consts.ts +9 -0
- package/src/preview/index.ts +3 -0
- package/src/preview/types.ts +79 -0
- package/src/scaffold/consts.ts +26 -0
- package/src/scaffold/helpers.ts +84 -0
- package/src/scaffold/index.ts +4 -0
- package/src/scaffold/schemas.ts +283 -0
- package/src/scaffold/types.ts +118 -0
- package/src/skills/catalogue.ts +1617 -0
- package/src/skills/consts.ts +183 -0
- package/src/skills/index.ts +4 -0
- package/src/skills/roles.ts +299 -0
- package/src/slot/consts.ts +393 -0
- package/src/slot/helpers.ts +34 -0
- package/src/slot/index.ts +5 -0
- package/src/slot/layout.ts +141 -0
- package/src/slot/schemas.ts +46 -0
- package/src/slot/types.ts +164 -0
- package/src/topology/card.ts +106 -0
- package/src/topology/consts.ts +59 -0
- package/src/topology/helpers.ts +138 -0
- package/src/topology/index.ts +5 -0
- package/src/topology/types.ts +86 -0
- package/src/types.ts +104 -0
- package/src/ux/consts.ts +5 -0
- package/src/ux/index.ts +4 -0
- package/src/ux/schemas.ts +97 -0
- package/src/ux/types.ts +25 -0
- package/tests/connect-convert.spec.ts +161 -0
- package/tests/convert.spec.ts +318 -0
- package/tests/design.spec.ts +136 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape a target project must have before the platform will install, build or run it.
|
|
3
|
+
*
|
|
4
|
+
* A slot is a pod the platform owns, on a hostname the platform owns, holding a volume the
|
|
5
|
+
* user can write to — through the editor, through the agent, and through a GitHub pull that
|
|
6
|
+
* merges a tree nobody here has read. What the publisher then executes comes out of that
|
|
7
|
+
* volume: `bun run build` reads `scripts.build` from a `package.json` on the PVC, `bun install`
|
|
8
|
+
* runs whatever lifecycle hooks it declares, and `bun dist/index.js` runs whatever the build
|
|
9
|
+
* emitted. Replacing the generated app with something else is therefore not an exploit — it is
|
|
10
|
+
* the documented behaviour of the tools, and the manifest below is what makes it fail.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately structural, never heuristic: a list of paths, a handful of exact strings, and
|
|
13
|
+
* a few markers. Nothing here asks a model what code means. The point is not to judge a
|
|
14
|
+
* program — it is to refuse a tree that is not the one the platform generated.
|
|
15
|
+
*
|
|
16
|
+
* **Two trees are the one the platform generated.** A slot's volume holds the layout it was
|
|
17
|
+
* initialized with for the life of the project and nothing migrates it, so the manifest is
|
|
18
|
+
* per-layout and the tree picks which one it is verified against ({@link detectTargetLayout}).
|
|
19
|
+
* Asserting the current layout unconditionally is not a stricter check — it is a check aimed at
|
|
20
|
+
* the wrong tree, and every legacy slot answers it with one `missing` violation per path it was
|
|
21
|
+
* never supposed to have. That refuses the application the platform itself generated, in front
|
|
22
|
+
* of every spawn, which takes the target's backend down permanently while its preview keeps
|
|
23
|
+
* serving the last build.
|
|
24
|
+
*/
|
|
25
|
+
/** The five workspace packages of the current layout, in the order the build runs them. */
|
|
26
|
+
export declare enum TargetPackage {
|
|
27
|
+
Common = "common",
|
|
28
|
+
Backend = "backend",
|
|
29
|
+
Api = "api",
|
|
30
|
+
Web = "web",
|
|
31
|
+
Worker = "worker"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The three workspace packages of the legacy layout.
|
|
35
|
+
*
|
|
36
|
+
* Not a renaming of {@link TargetPackage}: v1's `backend` is the HTTP SERVER (v2 split that into
|
|
37
|
+
* the `backend` library plus the `api` runtime) and its `frontend` is v2's `web`. The two
|
|
38
|
+
* vocabularies overlap in spelling and disagree in meaning, which is exactly why they are
|
|
39
|
+
* separate enums and every rule is looked up per layout.
|
|
40
|
+
*/
|
|
41
|
+
export declare enum TargetLegacyPackage {
|
|
42
|
+
Common = "common",
|
|
43
|
+
Backend = "backend",
|
|
44
|
+
Frontend = "frontend"
|
|
45
|
+
}
|
|
46
|
+
/** Directory holding the workspace packages of the current layout, relative to the sandbox root. */
|
|
47
|
+
export declare const TARGET_PACKAGES_DIR = "sources";
|
|
48
|
+
/** The legacy layout's packages directory, kept so an already-published slot stays servable. */
|
|
49
|
+
export declare const TARGET_LEGACY_PACKAGES_DIR = "packages";
|
|
50
|
+
/** The packages that bundle themselves — the ones carrying a rollup pair. */
|
|
51
|
+
export declare const TARGET_BUNDLED_PACKAGES: readonly [TargetPackage.Api, TargetPackage.Web, TargetPackage.Worker];
|
|
52
|
+
/** Same, for the legacy layout: its `common` is the only `tsc -b` library. */
|
|
53
|
+
export declare const TARGET_LEGACY_BUNDLED_PACKAGES: readonly [TargetLegacyPackage.Backend, TargetLegacyPackage.Frontend];
|
|
54
|
+
export declare const TARGET_LEGACY_PACKAGES: TargetLegacyPackage[];
|
|
55
|
+
/**
|
|
56
|
+
* The layout a target was generated with.
|
|
57
|
+
*
|
|
58
|
+
* Slots created before the `create-app` adoption hold `packages/{common,backend,frontend}` and
|
|
59
|
+
* keep running: their volume is the user's, and a platform that refuses to serve what it itself
|
|
60
|
+
* generated is a platform that deletes projects. Detection is by probe file rather than by a
|
|
61
|
+
* recorded flag, because the tree on the PVC is the only thing that is certainly true about it —
|
|
62
|
+
* a re-initialization replaces the tree wholesale under a running pod.
|
|
63
|
+
*/
|
|
64
|
+
export declare enum TargetLayout {
|
|
65
|
+
V1 = "v1",
|
|
66
|
+
V2 = "v2"
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What the platform generates today. The one layout a NEW project is ever created with, and
|
|
70
|
+
* therefore the only one anything upstream of the sandbox — code generation, path builders,
|
|
71
|
+
* the metadata tree — knows how to write.
|
|
72
|
+
*/
|
|
73
|
+
export declare const TARGET_CURRENT_LAYOUT = TargetLayout.V2;
|
|
74
|
+
/**
|
|
75
|
+
* Everything one layout asserts about a tree.
|
|
76
|
+
*
|
|
77
|
+
* One record per layout rather than a set of parallel constants, because the rules are the same
|
|
78
|
+
* questions asked of a different package set: a rule that exists for one layout and is forgotten
|
|
79
|
+
* for the other is a hole that nothing fails on.
|
|
80
|
+
*/
|
|
81
|
+
export interface TargetLayoutManifest {
|
|
82
|
+
layout: TargetLayout;
|
|
83
|
+
/** Directory holding the workspace packages, relative to the sandbox root. */
|
|
84
|
+
dir: string;
|
|
85
|
+
/** Package directory names, in build order. */
|
|
86
|
+
packages: readonly string[];
|
|
87
|
+
/** The one file whose presence identifies this layout and appears in no other. */
|
|
88
|
+
probe: string;
|
|
89
|
+
/** Every file the verifier reads for this layout. */
|
|
90
|
+
files: readonly string[];
|
|
91
|
+
/** Files no user-facing write may touch in a tree of this layout. */
|
|
92
|
+
protectedFiles: readonly string[];
|
|
93
|
+
/** The exact `scripts.build` each package must declare. */
|
|
94
|
+
buildScripts: Readonly<Record<string, string>>;
|
|
95
|
+
/** Framework dependencies without which a package cannot be the generated app. */
|
|
96
|
+
requiredDeps: Readonly<Record<string, readonly string[]>>;
|
|
97
|
+
/** The workspace siblings each package must depend on. */
|
|
98
|
+
workspaceDeps: Readonly<Record<string, readonly string[]>>;
|
|
99
|
+
/** The glob spelling of the root manifest's workspace list. */
|
|
100
|
+
workspaceGlob: string;
|
|
101
|
+
/** The written-out spelling of the same list. */
|
|
102
|
+
workspaceEntries: readonly string[];
|
|
103
|
+
/** Markers proving an entry file is still the framework's entry, keyed by file. */
|
|
104
|
+
markers: Readonly<Record<string, readonly string[]>>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Every layout the platform is willing to run, keyed by its own name.
|
|
108
|
+
*
|
|
109
|
+
* Declared current-first, and the order is load-bearing: detection walks it and takes the first
|
|
110
|
+
* probe it finds, so a half-migrated tree carrying both is verified against the layout the
|
|
111
|
+
* platform generates today rather than against the frozen one.
|
|
112
|
+
*/
|
|
113
|
+
export declare const TARGET_LAYOUTS: Readonly<Record<TargetLayout, TargetLayoutManifest>>;
|
|
114
|
+
/** What one layout asserts. */
|
|
115
|
+
export declare const targetManifest: (layout: TargetLayout) => TargetLayoutManifest;
|
|
116
|
+
/**
|
|
117
|
+
* Whether a tree of this layout can still be GENERATED INTO.
|
|
118
|
+
*
|
|
119
|
+
* A legacy target is served, built and run exactly like any other — that is the whole point of
|
|
120
|
+
* verifying it against its own manifest. What no longer works on it is code generation: every
|
|
121
|
+
* path builder, every stamped import specifier and the whole `docs/` metadata tree name the
|
|
122
|
+
* current layout's packages, so a story implemented into a legacy tree writes files into
|
|
123
|
+
* directories its workspace does not contain. That fails silently — the build succeeds, the
|
|
124
|
+
* story completes and the application does not change — which is why the platform refuses
|
|
125
|
+
* instead, and names re-initialization as the one cure.
|
|
126
|
+
*
|
|
127
|
+
* `undefined` reads as current: a publisher that predates layout reporting omits it, and reading
|
|
128
|
+
* that silence as legacy would refuse development for every slot already in the cluster.
|
|
129
|
+
*/
|
|
130
|
+
export declare const isLegacyLayout: (layout: TargetLayout | string | undefined | null) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* The files whose presence tells the layouts apart.
|
|
133
|
+
*
|
|
134
|
+
* Each layout's probe is a path the other cannot have. They are members of their own layout's
|
|
135
|
+
* file list too, so a caller that reads {@link TARGET_INTEGRITY_FILES} always has both in hand —
|
|
136
|
+
* which is the whole reason detection works at all. It did not before: the probe for the legacy
|
|
137
|
+
* layout was declared but never read, so `detectTargetLayout` could only ever answer `V2`.
|
|
138
|
+
*/
|
|
139
|
+
export declare const TARGET_LAYOUT_PROBE_FILES: readonly string[];
|
|
140
|
+
/**
|
|
141
|
+
* Which layout a tree is in, from its files alone — IO-free, like everything else here.
|
|
142
|
+
*
|
|
143
|
+
* A tree that shows neither probe is reported as the current layout: it is not a target at all,
|
|
144
|
+
* and the integrity report is what has to say so, in the vocabulary of the layout the platform
|
|
145
|
+
* generates today.
|
|
146
|
+
*/
|
|
147
|
+
export declare const detectTargetLayout: (files: Record<string, string | null>) => TargetLayout;
|
|
148
|
+
/**
|
|
149
|
+
* Files a caller must read and hand to `verifyTargetShape`.
|
|
150
|
+
*
|
|
151
|
+
* The UNION over every layout, because a caller reads before it knows which layout it is holding
|
|
152
|
+
* and the probes are what settle that. The verifier reports only the files its selected layout
|
|
153
|
+
* actually requires, so the extra reads cost a `stat` each and never a violation.
|
|
154
|
+
*
|
|
155
|
+
* The verifier is pure and does no IO of its own — the publisher reads these from the PVC, and
|
|
156
|
+
* a test reads them from the template tree. A path that does not exist is passed as `null`,
|
|
157
|
+
* which the verifier reports rather than skipping: absence is a violation for everything here.
|
|
158
|
+
*/
|
|
159
|
+
export declare const TARGET_INTEGRITY_FILES: readonly string[];
|
|
160
|
+
/**
|
|
161
|
+
* Files no user-facing write may touch, through any path — the union over every layout.
|
|
162
|
+
*
|
|
163
|
+
* These are the ones that decide what gets EXECUTED — the build scripts, the package manifests
|
|
164
|
+
* that name them, the compiler configuration that resolves them, and the install configuration.
|
|
165
|
+
* The agent harness is here for the same reason: `.claude/settings.json` declares a
|
|
166
|
+
* `SessionStart` hook and `.agents/scripts/link-skills.sh` is the command it spawns, so a write
|
|
167
|
+
* to either runs code in the slot the next time an agent session opens, with no build and no
|
|
168
|
+
* request involved. The agent's own generator already refuses the wiring sources
|
|
169
|
+
* (`WIRING_SOURCES`), but that guard is LLM-scoped: it never saw a manual editor save and never
|
|
170
|
+
* saw a git merge.
|
|
171
|
+
*
|
|
172
|
+
* The union rather than the current layout's list, because this is a path-shaped refusal with
|
|
173
|
+
* nothing to gain from being narrow: a v2 path cannot exist in a v1 tree, so covering both costs
|
|
174
|
+
* nothing and covers the legacy slots that were left writable.
|
|
175
|
+
*/
|
|
176
|
+
export declare const TARGET_PROTECTED_FILES: readonly string[];
|
|
177
|
+
/**
|
|
178
|
+
* What a target's root package may be named — and therefore what every other name in the tree is.
|
|
179
|
+
*
|
|
180
|
+
* The root manifest's `name` IS the project slug: it is what the user chose, what the hostname
|
|
181
|
+
* carries, and what each workspace package prefixes itself with. Verification reads it once and
|
|
182
|
+
* checks the rest AGAINST it, so a renamed project stays verifiable instead of being refused for
|
|
183
|
+
* no longer being called `project`.
|
|
184
|
+
*
|
|
185
|
+
* The pattern is the npm-name subset a hostname label also accepts, because the two are the same
|
|
186
|
+
* string: lowercase alphanumerics and inner hyphens, 1–32 characters, never starting or ending
|
|
187
|
+
* with a hyphen.
|
|
188
|
+
*/
|
|
189
|
+
export declare const TARGET_SLUG_PATTERN: RegExp;
|
|
190
|
+
/** `<slug>-<package>` — the only way a workspace package is ever named, in either layout. */
|
|
191
|
+
export declare const targetPackageName: (slug: string, pkg: string) => string;
|
|
192
|
+
/**
|
|
193
|
+
* npm lifecycle hooks, forbidden in every one of the target's manifests.
|
|
194
|
+
*
|
|
195
|
+
* `bun install` runs these, and the target's install runs as part of ordinary provisioning and
|
|
196
|
+
* of every `Reinstall`. A `postinstall` added to a pulled `package.json` is the shortest path
|
|
197
|
+
* from "merged a branch" to "ran a command in the slot", and it does not need the build to
|
|
198
|
+
* succeed or the app to work.
|
|
199
|
+
*/
|
|
200
|
+
export declare const TARGET_FORBIDDEN_SCRIPTS: readonly ['preinstall', 'install', 'postinstall', 'preprepare', 'prepare', 'postprepare', 'prepublish', 'prepublishOnly', 'postpublish', 'prepack', 'postpack'];
|
|
201
|
+
/** Everything one package must declare, once the root manifest has named the slug. */
|
|
202
|
+
export declare const targetRequiredDeps: (slug: string, pkg: string, layout?: TargetLayout) => string[];
|
|
203
|
+
/**
|
|
204
|
+
* The current layout's own rules, kept as named constants because consumers outside the verifier
|
|
205
|
+
* ask about the tree the platform generates today — never about a frozen one.
|
|
206
|
+
*/
|
|
207
|
+
export declare const TARGET_BUILD_SCRIPTS: Readonly<Record<string, string>>;
|
|
208
|
+
export declare const TARGET_REQUIRED_DEPS: Readonly<Record<string, readonly string[]>>;
|
|
209
|
+
export declare const TARGET_WORKSPACE_DEPS: Readonly<Record<string, readonly string[]>>;
|
|
210
|
+
export declare const TARGET_ENTRY_MARKERS: Readonly<Record<string, readonly string[]>>;
|
|
211
|
+
export declare const TARGET_WORKSPACE_GLOB: string;
|
|
212
|
+
export declare const TARGET_WORKSPACE_ENTRIES: readonly string[];
|
|
213
|
+
/** Rule ids carried on a violation, so a consumer can branch without parsing prose. */
|
|
214
|
+
export declare enum IntegrityRule {
|
|
215
|
+
Missing = "missing",
|
|
216
|
+
Unreadable = "unreadable",
|
|
217
|
+
PackageName = "package-name",
|
|
218
|
+
ModuleType = "module-type",
|
|
219
|
+
Workspaces = "workspaces",
|
|
220
|
+
BuildScript = "build-script",
|
|
221
|
+
LifecycleScript = "lifecycle-script",
|
|
222
|
+
RequiredDependency = "required-dependency",
|
|
223
|
+
EntryMarker = "entry-marker",
|
|
224
|
+
InstallConfig = "install-config"
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/integrity/consts.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape a target project must have before the platform will install, build or run it.
|
|
3
|
+
*
|
|
4
|
+
* A slot is a pod the platform owns, on a hostname the platform owns, holding a volume the
|
|
5
|
+
* user can write to — through the editor, through the agent, and through a GitHub pull that
|
|
6
|
+
* merges a tree nobody here has read. What the publisher then executes comes out of that
|
|
7
|
+
* volume: `bun run build` reads `scripts.build` from a `package.json` on the PVC, `bun install`
|
|
8
|
+
* runs whatever lifecycle hooks it declares, and `bun dist/index.js` runs whatever the build
|
|
9
|
+
* emitted. Replacing the generated app with something else is therefore not an exploit — it is
|
|
10
|
+
* the documented behaviour of the tools, and the manifest below is what makes it fail.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately structural, never heuristic: a list of paths, a handful of exact strings, and
|
|
13
|
+
* a few markers. Nothing here asks a model what code means. The point is not to judge a
|
|
14
|
+
* program — it is to refuse a tree that is not the one the platform generated.
|
|
15
|
+
*
|
|
16
|
+
* **Two trees are the one the platform generated.** A slot's volume holds the layout it was
|
|
17
|
+
* initialized with for the life of the project and nothing migrates it, so the manifest is
|
|
18
|
+
* per-layout and the tree picks which one it is verified against ({@link detectTargetLayout}).
|
|
19
|
+
* Asserting the current layout unconditionally is not a stricter check — it is a check aimed at
|
|
20
|
+
* the wrong tree, and every legacy slot answers it with one `missing` violation per path it was
|
|
21
|
+
* never supposed to have. That refuses the application the platform itself generated, in front
|
|
22
|
+
* of every spawn, which takes the target's backend down permanently while its preview keeps
|
|
23
|
+
* serving the last build.
|
|
24
|
+
*/
|
|
25
|
+
/** The five workspace packages of the current layout, in the order the build runs them. */
|
|
26
|
+
export var TargetPackage;
|
|
27
|
+
(function (TargetPackage) {
|
|
28
|
+
TargetPackage["Common"] = "common";
|
|
29
|
+
TargetPackage["Backend"] = "backend";
|
|
30
|
+
TargetPackage["Api"] = "api";
|
|
31
|
+
TargetPackage["Web"] = "web";
|
|
32
|
+
TargetPackage["Worker"] = "worker";
|
|
33
|
+
})(TargetPackage || (TargetPackage = {}));
|
|
34
|
+
/**
|
|
35
|
+
* The three workspace packages of the legacy layout.
|
|
36
|
+
*
|
|
37
|
+
* Not a renaming of {@link TargetPackage}: v1's `backend` is the HTTP SERVER (v2 split that into
|
|
38
|
+
* the `backend` library plus the `api` runtime) and its `frontend` is v2's `web`. The two
|
|
39
|
+
* vocabularies overlap in spelling and disagree in meaning, which is exactly why they are
|
|
40
|
+
* separate enums and every rule is looked up per layout.
|
|
41
|
+
*/
|
|
42
|
+
export var TargetLegacyPackage;
|
|
43
|
+
(function (TargetLegacyPackage) {
|
|
44
|
+
TargetLegacyPackage["Common"] = "common";
|
|
45
|
+
TargetLegacyPackage["Backend"] = "backend";
|
|
46
|
+
TargetLegacyPackage["Frontend"] = "frontend";
|
|
47
|
+
})(TargetLegacyPackage || (TargetLegacyPackage = {}));
|
|
48
|
+
/** Directory holding the workspace packages of the current layout, relative to the sandbox root. */
|
|
49
|
+
export const TARGET_PACKAGES_DIR = 'sources';
|
|
50
|
+
/** The legacy layout's packages directory, kept so an already-published slot stays servable. */
|
|
51
|
+
export const TARGET_LEGACY_PACKAGES_DIR = 'packages';
|
|
52
|
+
/** The packages that bundle themselves — the ones carrying a rollup pair. */
|
|
53
|
+
export const TARGET_BUNDLED_PACKAGES = [
|
|
54
|
+
TargetPackage.Api, TargetPackage.Web, TargetPackage.Worker,
|
|
55
|
+
];
|
|
56
|
+
/** Same, for the legacy layout: its `common` is the only `tsc -b` library. */
|
|
57
|
+
export const TARGET_LEGACY_BUNDLED_PACKAGES = [
|
|
58
|
+
TargetLegacyPackage.Backend, TargetLegacyPackage.Frontend,
|
|
59
|
+
];
|
|
60
|
+
export const TARGET_LEGACY_PACKAGES = Object.values(TargetLegacyPackage);
|
|
61
|
+
/**
|
|
62
|
+
* The layout a target was generated with.
|
|
63
|
+
*
|
|
64
|
+
* Slots created before the `create-app` adoption hold `packages/{common,backend,frontend}` and
|
|
65
|
+
* keep running: their volume is the user's, and a platform that refuses to serve what it itself
|
|
66
|
+
* generated is a platform that deletes projects. Detection is by probe file rather than by a
|
|
67
|
+
* recorded flag, because the tree on the PVC is the only thing that is certainly true about it —
|
|
68
|
+
* a re-initialization replaces the tree wholesale under a running pod.
|
|
69
|
+
*/
|
|
70
|
+
export var TargetLayout;
|
|
71
|
+
(function (TargetLayout) {
|
|
72
|
+
TargetLayout["V1"] = "v1";
|
|
73
|
+
TargetLayout["V2"] = "v2";
|
|
74
|
+
})(TargetLayout || (TargetLayout = {}));
|
|
75
|
+
/**
|
|
76
|
+
* What the platform generates today. The one layout a NEW project is ever created with, and
|
|
77
|
+
* therefore the only one anything upstream of the sandbox — code generation, path builders,
|
|
78
|
+
* the metadata tree — knows how to write.
|
|
79
|
+
*/
|
|
80
|
+
export const TARGET_CURRENT_LAYOUT = TargetLayout.V2;
|
|
81
|
+
const fileIn = (dir, pkg, path) => `${dir}/${pkg}/${path}`;
|
|
82
|
+
/** The harness files, protected in every layout — see {@link TARGET_PROTECTED_FILES}. */
|
|
83
|
+
const HARNESS_PROTECTED = ['.claude/settings.json', '.agents/scripts/link-skills.sh'];
|
|
84
|
+
/** Root-level files protected in every layout. */
|
|
85
|
+
const ROOT_PROTECTED = ['package.json', 'bunfig.toml', 'bun.lock', 'index.js'];
|
|
86
|
+
const protectedOf = (dir, packages, bundled) => [
|
|
87
|
+
...ROOT_PROTECTED,
|
|
88
|
+
...HARNESS_PROTECTED,
|
|
89
|
+
...packages.flatMap(pkg => [fileIn(dir, pkg, 'package.json'), fileIn(dir, pkg, 'tsconfig.json')]),
|
|
90
|
+
...bundled.flatMap(pkg => [fileIn(dir, pkg, 'rollup.config.js'), fileIn(dir, pkg, 'rollup.build.mjs')]),
|
|
91
|
+
];
|
|
92
|
+
const v2 = (pkg, path) => fileIn(TARGET_PACKAGES_DIR, pkg, path);
|
|
93
|
+
const v1 = (pkg, path) => fileIn(TARGET_LEGACY_PACKAGES_DIR, pkg, path);
|
|
94
|
+
/**
|
|
95
|
+
* The current layout: five workspace packages under `sources/`.
|
|
96
|
+
*
|
|
97
|
+
* `common` and `backend` are libraries the other three import, so they emit declarations with
|
|
98
|
+
* `tsc -b` rather than a bundle; `api`, `web` and `worker` each bundle themselves.
|
|
99
|
+
*/
|
|
100
|
+
const V2_MANIFEST = {
|
|
101
|
+
layout: TargetLayout.V2,
|
|
102
|
+
dir: TARGET_PACKAGES_DIR,
|
|
103
|
+
packages: Object.values(TargetPackage),
|
|
104
|
+
// The same file the publisher's own filesystem detection probes for (`sources/api`), so the
|
|
105
|
+
// two answers about one volume cannot disagree.
|
|
106
|
+
probe: v2(TargetPackage.Api, 'package.json'),
|
|
107
|
+
files: [
|
|
108
|
+
'package.json',
|
|
109
|
+
'bunfig.toml',
|
|
110
|
+
v2(TargetPackage.Common, 'package.json'),
|
|
111
|
+
v2(TargetPackage.Common, 'tsconfig.json'),
|
|
112
|
+
v2(TargetPackage.Common, 'src/index.ts'),
|
|
113
|
+
v2(TargetPackage.Common, 'src/entrypoints.ts'),
|
|
114
|
+
v2(TargetPackage.Backend, 'package.json'),
|
|
115
|
+
v2(TargetPackage.Backend, 'tsconfig.json'),
|
|
116
|
+
v2(TargetPackage.Backend, 'src/index.ts'),
|
|
117
|
+
v2(TargetPackage.Backend, 'src/context.ts'),
|
|
118
|
+
v2(TargetPackage.Backend, 'src/config.ts'),
|
|
119
|
+
v2(TargetPackage.Api, 'package.json'),
|
|
120
|
+
v2(TargetPackage.Api, 'tsconfig.json'),
|
|
121
|
+
v2(TargetPackage.Api, 'rollup.config.js'),
|
|
122
|
+
v2(TargetPackage.Api, 'rollup.build.mjs'),
|
|
123
|
+
v2(TargetPackage.Api, 'src/index.ts'),
|
|
124
|
+
v2(TargetPackage.Api, 'src/owlmeans.ts'),
|
|
125
|
+
v2(TargetPackage.Api, 'src/config.ts'),
|
|
126
|
+
v2(TargetPackage.Api, 'src/entrypoints.ts'),
|
|
127
|
+
v2(TargetPackage.Web, 'package.json'),
|
|
128
|
+
v2(TargetPackage.Web, 'tsconfig.json'),
|
|
129
|
+
v2(TargetPackage.Web, 'rollup.config.js'),
|
|
130
|
+
v2(TargetPackage.Web, 'rollup.build.mjs'),
|
|
131
|
+
v2(TargetPackage.Web, 'src/index.tsx'),
|
|
132
|
+
v2(TargetPackage.Web, 'src/owlmeans.ts'),
|
|
133
|
+
v2(TargetPackage.Web, 'src/config.ts'),
|
|
134
|
+
v2(TargetPackage.Web, 'src/entrypoints.ts'),
|
|
135
|
+
v2(TargetPackage.Worker, 'package.json'),
|
|
136
|
+
v2(TargetPackage.Worker, 'tsconfig.json'),
|
|
137
|
+
v2(TargetPackage.Worker, 'rollup.config.js'),
|
|
138
|
+
v2(TargetPackage.Worker, 'rollup.build.mjs'),
|
|
139
|
+
v2(TargetPackage.Worker, 'src/index.ts'),
|
|
140
|
+
v2(TargetPackage.Worker, 'src/owlmeans.ts'),
|
|
141
|
+
v2(TargetPackage.Worker, 'src/config.ts'),
|
|
142
|
+
v2(TargetPackage.Worker, 'src/entrypoints.ts'),
|
|
143
|
+
],
|
|
144
|
+
protectedFiles: protectedOf(TARGET_PACKAGES_DIR, Object.values(TargetPackage), TARGET_BUNDLED_PACKAGES),
|
|
145
|
+
buildScripts: {
|
|
146
|
+
[TargetPackage.Common]: 'tsc -b',
|
|
147
|
+
[TargetPackage.Backend]: 'tsc -b',
|
|
148
|
+
[TargetPackage.Api]: 'bun ./rollup.build.mjs',
|
|
149
|
+
[TargetPackage.Web]: 'bun ./rollup.build.mjs',
|
|
150
|
+
[TargetPackage.Worker]: 'bun ./rollup.build.mjs',
|
|
151
|
+
},
|
|
152
|
+
requiredDeps: {
|
|
153
|
+
[TargetPackage.Common]: ['@owlmeans/context', '@owlmeans/entrypoint'],
|
|
154
|
+
[TargetPackage.Backend]: ['@owlmeans/context', '@owlmeans/postgres-resource'],
|
|
155
|
+
[TargetPackage.Api]: ['@owlmeans/server-app'],
|
|
156
|
+
[TargetPackage.Web]: ['@owlmeans/web-client'],
|
|
157
|
+
[TargetPackage.Worker]: ['@owlmeans/queue', '@owlmeans/redis-queue'],
|
|
158
|
+
},
|
|
159
|
+
// `api` and `worker` both reach the database through `backend`, which is the whole reason
|
|
160
|
+
// `backend` is a library: two runtimes, one context factory, one set of resources. A `worker`
|
|
161
|
+
// that stopped depending on `backend` is processing jobs against something else.
|
|
162
|
+
workspaceDeps: {
|
|
163
|
+
[TargetPackage.Common]: [],
|
|
164
|
+
[TargetPackage.Backend]: [TargetPackage.Common],
|
|
165
|
+
[TargetPackage.Api]: [TargetPackage.Common, TargetPackage.Backend],
|
|
166
|
+
[TargetPackage.Web]: [TargetPackage.Common],
|
|
167
|
+
[TargetPackage.Worker]: [TargetPackage.Backend],
|
|
168
|
+
},
|
|
169
|
+
workspaceGlob: `${TARGET_PACKAGES_DIR}/*`,
|
|
170
|
+
workspaceEntries: Object.values(TargetPackage).map(pkg => `${TARGET_PACKAGES_DIR}/${pkg}`),
|
|
171
|
+
markers: {
|
|
172
|
+
[v2(TargetPackage.Common, 'src/index.ts')]: ['./entrypoints.js'],
|
|
173
|
+
[v2(TargetPackage.Backend, 'src/index.ts')]: ['./context.js'],
|
|
174
|
+
[v2(TargetPackage.Backend, 'src/context.ts')]: ['@owlmeans/context', 'makeContext'],
|
|
175
|
+
[v2(TargetPackage.Api, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
|
|
176
|
+
[v2(TargetPackage.Api, 'src/owlmeans.ts')]: ['@owlmeans/server-app', 'makeContext'],
|
|
177
|
+
[v2(TargetPackage.Web, 'src/index.tsx')]: ['@owlmeans/web-client', 'renderApp', './owlmeans'],
|
|
178
|
+
[v2(TargetPackage.Web, 'src/owlmeans.ts')]: ['makeContext', 'owlCtx'],
|
|
179
|
+
// The worker binds nothing but its health port; what makes it a worker is that it listens.
|
|
180
|
+
[v2(TargetPackage.Worker, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
|
|
181
|
+
[v2(TargetPackage.Worker, 'src/owlmeans.ts')]: ['@owlmeans/queue', 'makeContext'],
|
|
182
|
+
// The build configuration itself: what it reads and what it emits. These are the paths the
|
|
183
|
+
// publisher spawns and serves, so a config that redirects either one is a different program.
|
|
184
|
+
// Matched loosely enough to survive the `path.resolve(srcDir, …)` the template writes them
|
|
185
|
+
// with, and strictly enough that an input or an output somewhere else fails.
|
|
186
|
+
[v2(TargetPackage.Api, 'rollup.config.js')]: ['input:', 'index.ts', 'dist', 'index.js'],
|
|
187
|
+
[v2(TargetPackage.Web, 'rollup.config.js')]: ['input:', 'index.tsx', 'dist', 'bundle.js'],
|
|
188
|
+
[v2(TargetPackage.Worker, 'rollup.config.js')]: ['input:', 'index.ts', 'dist', 'index.js'],
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The legacy layout: three workspace packages under `packages/`.
|
|
193
|
+
*
|
|
194
|
+
* Frozen — nothing generates one any more, and every rule here is stated against the trees that
|
|
195
|
+
* exist rather than against a template this repository still ships (it does not). `backend` is
|
|
196
|
+
* the HTTP server AND the data layer, which is why it carries both `@owlmeans/server-app` and
|
|
197
|
+
* `@owlmeans/postgres-resource`; `common` is the only library.
|
|
198
|
+
*/
|
|
199
|
+
const V1_MANIFEST = {
|
|
200
|
+
layout: TargetLayout.V1,
|
|
201
|
+
dir: TARGET_LEGACY_PACKAGES_DIR,
|
|
202
|
+
packages: TARGET_LEGACY_PACKAGES,
|
|
203
|
+
// `packages/backend` again — the publisher's own marker for this layout.
|
|
204
|
+
probe: v1(TargetLegacyPackage.Backend, 'package.json'),
|
|
205
|
+
files: [
|
|
206
|
+
'package.json',
|
|
207
|
+
'bunfig.toml',
|
|
208
|
+
v1(TargetLegacyPackage.Common, 'package.json'),
|
|
209
|
+
v1(TargetLegacyPackage.Common, 'tsconfig.json'),
|
|
210
|
+
v1(TargetLegacyPackage.Common, 'src/index.ts'),
|
|
211
|
+
v1(TargetLegacyPackage.Common, 'src/entrypoints.ts'),
|
|
212
|
+
v1(TargetLegacyPackage.Backend, 'package.json'),
|
|
213
|
+
v1(TargetLegacyPackage.Backend, 'tsconfig.json'),
|
|
214
|
+
v1(TargetLegacyPackage.Backend, 'rollup.config.js'),
|
|
215
|
+
v1(TargetLegacyPackage.Backend, 'rollup.build.mjs'),
|
|
216
|
+
v1(TargetLegacyPackage.Backend, 'src/index.ts'),
|
|
217
|
+
v1(TargetLegacyPackage.Backend, 'src/owlmeans.ts'),
|
|
218
|
+
v1(TargetLegacyPackage.Backend, 'src/config.ts'),
|
|
219
|
+
v1(TargetLegacyPackage.Backend, 'src/entrypoints.ts'),
|
|
220
|
+
v1(TargetLegacyPackage.Frontend, 'package.json'),
|
|
221
|
+
v1(TargetLegacyPackage.Frontend, 'tsconfig.json'),
|
|
222
|
+
v1(TargetLegacyPackage.Frontend, 'rollup.config.js'),
|
|
223
|
+
v1(TargetLegacyPackage.Frontend, 'rollup.build.mjs'),
|
|
224
|
+
v1(TargetLegacyPackage.Frontend, 'src/index.tsx'),
|
|
225
|
+
v1(TargetLegacyPackage.Frontend, 'src/owlmeans.ts'),
|
|
226
|
+
v1(TargetLegacyPackage.Frontend, 'src/config.ts'),
|
|
227
|
+
v1(TargetLegacyPackage.Frontend, 'src/entrypoints.ts'),
|
|
228
|
+
],
|
|
229
|
+
protectedFiles: protectedOf(TARGET_LEGACY_PACKAGES_DIR, TARGET_LEGACY_PACKAGES, TARGET_LEGACY_BUNDLED_PACKAGES),
|
|
230
|
+
buildScripts: {
|
|
231
|
+
[TargetLegacyPackage.Common]: 'tsc -b',
|
|
232
|
+
[TargetLegacyPackage.Backend]: 'bun ./rollup.build.mjs',
|
|
233
|
+
[TargetLegacyPackage.Frontend]: 'bun ./rollup.build.mjs',
|
|
234
|
+
},
|
|
235
|
+
requiredDeps: {
|
|
236
|
+
[TargetLegacyPackage.Common]: ['@owlmeans/context', '@owlmeans/entrypoint'],
|
|
237
|
+
[TargetLegacyPackage.Backend]: ['@owlmeans/server-app', '@owlmeans/postgres-resource'],
|
|
238
|
+
[TargetLegacyPackage.Frontend]: ['@owlmeans/web-client'],
|
|
239
|
+
},
|
|
240
|
+
workspaceDeps: {
|
|
241
|
+
[TargetLegacyPackage.Common]: [],
|
|
242
|
+
[TargetLegacyPackage.Backend]: [TargetLegacyPackage.Common],
|
|
243
|
+
[TargetLegacyPackage.Frontend]: [TargetLegacyPackage.Common],
|
|
244
|
+
},
|
|
245
|
+
workspaceGlob: `${TARGET_LEGACY_PACKAGES_DIR}/*`,
|
|
246
|
+
workspaceEntries: TARGET_LEGACY_PACKAGES.map(pkg => `${TARGET_LEGACY_PACKAGES_DIR}/${pkg}`),
|
|
247
|
+
markers: {
|
|
248
|
+
[v1(TargetLegacyPackage.Common, 'src/index.ts')]: ['./entrypoints.js'],
|
|
249
|
+
[v1(TargetLegacyPackage.Backend, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
|
|
250
|
+
[v1(TargetLegacyPackage.Backend, 'src/owlmeans.ts')]: ['@owlmeans/server-app', 'makeContext'],
|
|
251
|
+
[v1(TargetLegacyPackage.Frontend, 'src/index.tsx')]: ['@owlmeans/web-client', 'renderApp', './owlmeans'],
|
|
252
|
+
[v1(TargetLegacyPackage.Frontend, 'src/owlmeans.ts')]: ['makeContext', 'owlCtx'],
|
|
253
|
+
[v1(TargetLegacyPackage.Backend, 'rollup.config.js')]: ['input:', 'index.ts', 'dist', 'index.js'],
|
|
254
|
+
[v1(TargetLegacyPackage.Frontend, 'rollup.config.js')]: ['input:', 'index.tsx', 'dist', 'bundle.js'],
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Every layout the platform is willing to run, keyed by its own name.
|
|
259
|
+
*
|
|
260
|
+
* Declared current-first, and the order is load-bearing: detection walks it and takes the first
|
|
261
|
+
* probe it finds, so a half-migrated tree carrying both is verified against the layout the
|
|
262
|
+
* platform generates today rather than against the frozen one.
|
|
263
|
+
*/
|
|
264
|
+
export const TARGET_LAYOUTS = {
|
|
265
|
+
[TargetLayout.V2]: V2_MANIFEST,
|
|
266
|
+
[TargetLayout.V1]: V1_MANIFEST,
|
|
267
|
+
};
|
|
268
|
+
/** What one layout asserts. */
|
|
269
|
+
export const targetManifest = (layout) => TARGET_LAYOUTS[layout];
|
|
270
|
+
/**
|
|
271
|
+
* Whether a tree of this layout can still be GENERATED INTO.
|
|
272
|
+
*
|
|
273
|
+
* A legacy target is served, built and run exactly like any other — that is the whole point of
|
|
274
|
+
* verifying it against its own manifest. What no longer works on it is code generation: every
|
|
275
|
+
* path builder, every stamped import specifier and the whole `docs/` metadata tree name the
|
|
276
|
+
* current layout's packages, so a story implemented into a legacy tree writes files into
|
|
277
|
+
* directories its workspace does not contain. That fails silently — the build succeeds, the
|
|
278
|
+
* story completes and the application does not change — which is why the platform refuses
|
|
279
|
+
* instead, and names re-initialization as the one cure.
|
|
280
|
+
*
|
|
281
|
+
* `undefined` reads as current: a publisher that predates layout reporting omits it, and reading
|
|
282
|
+
* that silence as legacy would refuse development for every slot already in the cluster.
|
|
283
|
+
*/
|
|
284
|
+
export const isLegacyLayout = (layout) => layout != null && layout !== TARGET_CURRENT_LAYOUT;
|
|
285
|
+
/**
|
|
286
|
+
* The files whose presence tells the layouts apart.
|
|
287
|
+
*
|
|
288
|
+
* Each layout's probe is a path the other cannot have. They are members of their own layout's
|
|
289
|
+
* file list too, so a caller that reads {@link TARGET_INTEGRITY_FILES} always has both in hand —
|
|
290
|
+
* which is the whole reason detection works at all. It did not before: the probe for the legacy
|
|
291
|
+
* layout was declared but never read, so `detectTargetLayout` could only ever answer `V2`.
|
|
292
|
+
*/
|
|
293
|
+
export const TARGET_LAYOUT_PROBE_FILES = Object.values(TARGET_LAYOUTS).map(manifest => manifest.probe);
|
|
294
|
+
/**
|
|
295
|
+
* Which layout a tree is in, from its files alone — IO-free, like everything else here.
|
|
296
|
+
*
|
|
297
|
+
* A tree that shows neither probe is reported as the current layout: it is not a target at all,
|
|
298
|
+
* and the integrity report is what has to say so, in the vocabulary of the layout the platform
|
|
299
|
+
* generates today.
|
|
300
|
+
*/
|
|
301
|
+
export const detectTargetLayout = (files) => {
|
|
302
|
+
for (const manifest of Object.values(TARGET_LAYOUTS)) {
|
|
303
|
+
if (files[manifest.probe] != null) {
|
|
304
|
+
return manifest.layout;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return TARGET_CURRENT_LAYOUT;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Files a caller must read and hand to `verifyTargetShape`.
|
|
311
|
+
*
|
|
312
|
+
* The UNION over every layout, because a caller reads before it knows which layout it is holding
|
|
313
|
+
* and the probes are what settle that. The verifier reports only the files its selected layout
|
|
314
|
+
* actually requires, so the extra reads cost a `stat` each and never a violation.
|
|
315
|
+
*
|
|
316
|
+
* The verifier is pure and does no IO of its own — the publisher reads these from the PVC, and
|
|
317
|
+
* a test reads them from the template tree. A path that does not exist is passed as `null`,
|
|
318
|
+
* which the verifier reports rather than skipping: absence is a violation for everything here.
|
|
319
|
+
*/
|
|
320
|
+
export const TARGET_INTEGRITY_FILES = [
|
|
321
|
+
...new Set(Object.values(TARGET_LAYOUTS).flatMap(manifest => manifest.files)),
|
|
322
|
+
];
|
|
323
|
+
/**
|
|
324
|
+
* Files no user-facing write may touch, through any path — the union over every layout.
|
|
325
|
+
*
|
|
326
|
+
* These are the ones that decide what gets EXECUTED — the build scripts, the package manifests
|
|
327
|
+
* that name them, the compiler configuration that resolves them, and the install configuration.
|
|
328
|
+
* The agent harness is here for the same reason: `.claude/settings.json` declares a
|
|
329
|
+
* `SessionStart` hook and `.agents/scripts/link-skills.sh` is the command it spawns, so a write
|
|
330
|
+
* to either runs code in the slot the next time an agent session opens, with no build and no
|
|
331
|
+
* request involved. The agent's own generator already refuses the wiring sources
|
|
332
|
+
* (`WIRING_SOURCES`), but that guard is LLM-scoped: it never saw a manual editor save and never
|
|
333
|
+
* saw a git merge.
|
|
334
|
+
*
|
|
335
|
+
* The union rather than the current layout's list, because this is a path-shaped refusal with
|
|
336
|
+
* nothing to gain from being narrow: a v2 path cannot exist in a v1 tree, so covering both costs
|
|
337
|
+
* nothing and covers the legacy slots that were left writable.
|
|
338
|
+
*/
|
|
339
|
+
export const TARGET_PROTECTED_FILES = [
|
|
340
|
+
...new Set(Object.values(TARGET_LAYOUTS).flatMap(manifest => manifest.protectedFiles)),
|
|
341
|
+
];
|
|
342
|
+
/**
|
|
343
|
+
* What a target's root package may be named — and therefore what every other name in the tree is.
|
|
344
|
+
*
|
|
345
|
+
* The root manifest's `name` IS the project slug: it is what the user chose, what the hostname
|
|
346
|
+
* carries, and what each workspace package prefixes itself with. Verification reads it once and
|
|
347
|
+
* checks the rest AGAINST it, so a renamed project stays verifiable instead of being refused for
|
|
348
|
+
* no longer being called `project`.
|
|
349
|
+
*
|
|
350
|
+
* The pattern is the npm-name subset a hostname label also accepts, because the two are the same
|
|
351
|
+
* string: lowercase alphanumerics and inner hyphens, 1–32 characters, never starting or ending
|
|
352
|
+
* with a hyphen.
|
|
353
|
+
*/
|
|
354
|
+
export const TARGET_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$/;
|
|
355
|
+
/** `<slug>-<package>` — the only way a workspace package is ever named, in either layout. */
|
|
356
|
+
export const targetPackageName = (slug, pkg) => `${slug}-${pkg}`;
|
|
357
|
+
/**
|
|
358
|
+
* npm lifecycle hooks, forbidden in every one of the target's manifests.
|
|
359
|
+
*
|
|
360
|
+
* `bun install` runs these, and the target's install runs as part of ordinary provisioning and
|
|
361
|
+
* of every `Reinstall`. A `postinstall` added to a pulled `package.json` is the shortest path
|
|
362
|
+
* from "merged a branch" to "ran a command in the slot", and it does not need the build to
|
|
363
|
+
* succeed or the app to work.
|
|
364
|
+
*/
|
|
365
|
+
export const TARGET_FORBIDDEN_SCRIPTS = [
|
|
366
|
+
'preinstall', 'install', 'postinstall', 'preprepare', 'prepare', 'postprepare',
|
|
367
|
+
'prepublish', 'prepublishOnly', 'postpublish', 'prepack', 'postpack',
|
|
368
|
+
];
|
|
369
|
+
/** Everything one package must declare, once the root manifest has named the slug. */
|
|
370
|
+
export const targetRequiredDeps = (slug, pkg, layout = TARGET_CURRENT_LAYOUT) => {
|
|
371
|
+
const manifest = targetManifest(layout);
|
|
372
|
+
return [
|
|
373
|
+
...(manifest.requiredDeps[pkg] ?? []),
|
|
374
|
+
...(manifest.workspaceDeps[pkg] ?? []).map(dep => targetPackageName(slug, dep)),
|
|
375
|
+
];
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* The current layout's own rules, kept as named constants because consumers outside the verifier
|
|
379
|
+
* ask about the tree the platform generates today — never about a frozen one.
|
|
380
|
+
*/
|
|
381
|
+
export const TARGET_BUILD_SCRIPTS = V2_MANIFEST.buildScripts;
|
|
382
|
+
export const TARGET_REQUIRED_DEPS = V2_MANIFEST.requiredDeps;
|
|
383
|
+
export const TARGET_WORKSPACE_DEPS = V2_MANIFEST.workspaceDeps;
|
|
384
|
+
export const TARGET_ENTRY_MARKERS = V2_MANIFEST.markers;
|
|
385
|
+
export const TARGET_WORKSPACE_GLOB = V2_MANIFEST.workspaceGlob;
|
|
386
|
+
export const TARGET_WORKSPACE_ENTRIES = V2_MANIFEST.workspaceEntries;
|
|
387
|
+
/** Rule ids carried on a violation, so a consumer can branch without parsing prose. */
|
|
388
|
+
export var IntegrityRule;
|
|
389
|
+
(function (IntegrityRule) {
|
|
390
|
+
IntegrityRule["Missing"] = "missing";
|
|
391
|
+
IntegrityRule["Unreadable"] = "unreadable";
|
|
392
|
+
IntegrityRule["PackageName"] = "package-name";
|
|
393
|
+
IntegrityRule["ModuleType"] = "module-type";
|
|
394
|
+
IntegrityRule["Workspaces"] = "workspaces";
|
|
395
|
+
IntegrityRule["BuildScript"] = "build-script";
|
|
396
|
+
IntegrityRule["LifecycleScript"] = "lifecycle-script";
|
|
397
|
+
IntegrityRule["RequiredDependency"] = "required-dependency";
|
|
398
|
+
IntegrityRule["EntryMarker"] = "entry-marker";
|
|
399
|
+
IntegrityRule["InstallConfig"] = "install-config";
|
|
400
|
+
})(IntegrityRule || (IntegrityRule = {}));
|
|
401
|
+
//# sourceMappingURL=consts.js.map
|