@wildo-ai/wildo-cli 1.1.3 → 1.1.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.
Files changed (141) hide show
  1. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts +2 -0
  2. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts.map +1 -0
  3. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js +63 -0
  4. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js.map +1 -0
  5. package/dist/src/commands/context/assurance-basis.command.d.ts +61 -0
  6. package/dist/src/commands/context/assurance-basis.command.d.ts.map +1 -0
  7. package/dist/src/commands/context/assurance-basis.command.js +166 -0
  8. package/dist/src/commands/context/assurance-basis.command.js.map +1 -0
  9. package/dist/src/commands/dev/charts-audit.command.d.ts +5 -3
  10. package/dist/src/commands/dev/charts-audit.command.d.ts.map +1 -1
  11. package/dist/src/commands/dev/charts-audit.command.js +35 -6
  12. package/dist/src/commands/dev/charts-audit.command.js.map +1 -1
  13. package/dist/src/commands/fwk/generate-providers.command.d.ts.map +1 -1
  14. package/dist/src/commands/fwk/generate-providers.command.js +18 -2
  15. package/dist/src/commands/fwk/generate-providers.command.js.map +1 -1
  16. package/dist/src/commands/generate/email-preview.command.d.ts +8 -0
  17. package/dist/src/commands/generate/email-preview.command.d.ts.map +1 -1
  18. package/dist/src/commands/generate/email-preview.command.js +57 -0
  19. package/dist/src/commands/generate/email-preview.command.js.map +1 -1
  20. package/dist/src/commands/init.command.d.ts.map +1 -1
  21. package/dist/src/commands/init.command.js +32 -0
  22. package/dist/src/commands/init.command.js.map +1 -1
  23. package/dist/src/commands/lock/check.command.d.ts.map +1 -1
  24. package/dist/src/commands/lock/check.command.js +3 -2
  25. package/dist/src/commands/lock/check.command.js.map +1 -1
  26. package/dist/src/commands/registry/login.command.d.ts.map +1 -1
  27. package/dist/src/commands/registry/login.command.js +2 -0
  28. package/dist/src/commands/registry/login.command.js.map +1 -1
  29. package/dist/src/commands/registry/publish.command.d.ts.map +1 -1
  30. package/dist/src/commands/registry/publish.command.js +2 -0
  31. package/dist/src/commands/registry/publish.command.js.map +1 -1
  32. package/dist/src/commands/registry/registry-transport.constants.d.ts +33 -0
  33. package/dist/src/commands/registry/registry-transport.constants.d.ts.map +1 -0
  34. package/dist/src/commands/registry/registry-transport.constants.js +33 -0
  35. package/dist/src/commands/registry/registry-transport.constants.js.map +1 -0
  36. package/dist/src/commands/registry/whoami.command.d.ts.map +1 -1
  37. package/dist/src/commands/registry/whoami.command.js +2 -0
  38. package/dist/src/commands/registry/whoami.command.js.map +1 -1
  39. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts +2 -0
  40. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts.map +1 -0
  41. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js +146 -0
  42. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js.map +1 -0
  43. package/dist/src/modules/domain/credentials/approver-user.module.d.ts +85 -0
  44. package/dist/src/modules/domain/credentials/approver-user.module.d.ts.map +1 -0
  45. package/dist/src/modules/domain/credentials/approver-user.module.js +92 -0
  46. package/dist/src/modules/domain/credentials/approver-user.module.js.map +1 -0
  47. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts +2 -0
  48. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts.map +1 -0
  49. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js +111 -0
  50. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js.map +1 -0
  51. package/dist/src/services/application/__tests__/provider-package-links.service.test.js +68 -0
  52. package/dist/src/services/application/__tests__/provider-package-links.service.test.js.map +1 -1
  53. package/dist/src/services/application/app-bootstrap.service.d.ts +9 -0
  54. package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
  55. package/dist/src/services/application/app-bootstrap.service.js +30 -1
  56. package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
  57. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts +6 -0
  58. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts.map +1 -1
  59. package/dist/src/services/application/application-runtime-bootstrap.service.js +41 -0
  60. package/dist/src/services/application/application-runtime-bootstrap.service.js.map +1 -1
  61. package/dist/src/services/application/provider-package-links.service.d.ts +30 -0
  62. package/dist/src/services/application/provider-package-links.service.d.ts.map +1 -1
  63. package/dist/src/services/application/provider-package-links.service.js +35 -3
  64. package/dist/src/services/application/provider-package-links.service.js.map +1 -1
  65. package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
  66. package/dist/src/services/application/provider-runtime-sync.service.js +4 -3
  67. package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
  68. package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
  69. package/dist/src/services/application/saas-skeleton.service.js +22 -2
  70. package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
  71. package/dist/src/services/companion/workbench-cli.service.js +10 -1
  72. package/dist/src/services/companion/workbench-cli.service.js.map +1 -1
  73. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts +2 -0
  74. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts.map +1 -0
  75. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js +94 -0
  76. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js.map +1 -0
  77. package/dist/src/services/credentials/ci-secrets-adapter.service.d.ts.map +1 -1
  78. package/dist/src/services/credentials/ci-secrets-adapter.service.js +16 -0
  79. package/dist/src/services/credentials/ci-secrets-adapter.service.js.map +1 -1
  80. package/dist/src/services/credentials/composed-provider-catalogue.d.ts +34 -0
  81. package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
  82. package/dist/src/services/credentials/composed-provider-catalogue.js +35 -0
  83. package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
  84. package/dist/src/services/credentials/credentials.schemas.d.ts +27 -0
  85. package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
  86. package/dist/src/services/credentials/credentials.schemas.js +50 -0
  87. package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
  88. package/dist/src/services/credentials/framework-managed-secrets.d.ts +1 -1
  89. package/dist/src/services/credentials/framework-managed-secrets.d.ts.map +1 -1
  90. package/dist/src/services/credentials/framework-managed-secrets.js +49 -8
  91. package/dist/src/services/credentials/framework-managed-secrets.js.map +1 -1
  92. package/dist/src/services/deployment/infra-writer.service.d.ts.map +1 -1
  93. package/dist/src/services/deployment/infra-writer.service.js +23 -4
  94. package/dist/src/services/deployment/infra-writer.service.js.map +1 -1
  95. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js +45 -2
  96. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js.map +1 -1
  97. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts +23 -0
  98. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts.map +1 -1
  99. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js +49 -6
  100. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js.map +1 -1
  101. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  102. package/dist/src/services/environment/env-vars-builder.service.js +19 -0
  103. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  104. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js +8 -0
  105. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js.map +1 -1
  106. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js +17 -0
  107. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js.map +1 -1
  108. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js +51 -0
  109. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js.map +1 -1
  110. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts +41 -1
  111. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts.map +1 -1
  112. package/dist/src/services/framework/framework-knowledge-audit.service.js +90 -0
  113. package/dist/src/services/framework/framework-knowledge-audit.service.js.map +1 -1
  114. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts +2 -0
  115. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts.map +1 -0
  116. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js +100 -0
  117. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js.map +1 -0
  118. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js +55 -2
  119. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js.map +1 -1
  120. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts +9 -0
  121. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts.map +1 -1
  122. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js +139 -19
  123. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js.map +1 -1
  124. package/dist/src/services/frontend/cloudflare-cdn.service.d.ts.map +1 -1
  125. package/dist/src/services/frontend/cloudflare-cdn.service.js +33 -2
  126. package/dist/src/services/frontend/cloudflare-cdn.service.js.map +1 -1
  127. package/dist/tsconfig.build.tsbuildinfo +1 -1
  128. package/dist/tsconfig.tsbuildinfo +1 -1
  129. package/package.json +17 -17
  130. package/scripts/app-dependency-alignment/propagated-engine-overrides.json +13 -0
  131. package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +64 -16
  132. package/templates/saas/engine-peer-closure.json +12 -0
  133. package/templates/saas/scenarios/add-provider/scenario.json +11 -11
  134. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/docusaurus.config.ts.hbs +34 -0
  135. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/pages/auth/exchange.tsx +24 -1
  136. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/theme/Root.tsx +22 -2
  137. package/templates/saas/skeleton/backend-api/package.json.hbs +1 -1
  138. package/templates/saas/skeleton/backend-api/src/companion-exports.ts +13 -2
  139. package/wildo-framework.info.json +1 -1
  140. package/templates/saas/scenarios/add-backend-provider/scenario.json +0 -17
  141. package/templates/saas/skeleton/backend-api/src/provider-contributions.ts +0 -44
@@ -39,6 +39,14 @@ describe('engine provider specifications reconcile with the live backend modules
39
39
  expect([...spec.providerCapabilities].sort()).toEqual([...module.providerCapabilities].sort());
40
40
  const boundSlots = [...new Set(engineSlotsBoundByCapabilities(module.providerCapabilities).map((entry) => entry.slot))].sort();
41
41
  expect([...spec.engineCapabilities].sort()).toEqual(boundSlots);
42
+ /*
43
+ * WHO runs it and WHERE it processes, restated. This is the fact that makes an operator's
44
+ * declared processing region CHECKABLE: the compliance lane reads specifications, not backend
45
+ * modules, so before the spec carried it `appAssertedProcessingRegions` had no data to compare
46
+ * and therefore no caller. A spec that drifts here would let the register vouch for a region
47
+ * the vendor never offered.
48
+ */
49
+ expect(spec.complianceProfile, `${spec.ref} compliance profile`).toEqual(module.complianceProfile);
42
50
  expect(spec.secretsContract).toEqual(Object.entries(module.secretsContract)
43
51
  .map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))
44
52
  .sort((left, right) => left.slug.localeCompare(right.slug)));
@@ -1 +1 @@
1
- {"version":3,"file":"engine-provider-specifications.reconciliation.test.js","sourceRoot":"","sources":["../../../../../src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,YAAY,EAAE,8BAA8B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CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;aAC1H,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAC9D,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { EngineBackendProviderRegistry } from '@wildo-ai/external-connectors-private/backend';\nimport { engineProviderSpecifications, providerSpecificationKeyFor } from '@wildo-ai/saas-specifications';\nimport { ProviderTier, engineSlotsBoundByCapabilities } from '@wildo-ai/saas-models';\n\n/**\n * A provider specification RE-STATES facts its backend module owns (protocols, capabilities,\n * engine slots, secrets, tier, package). Two hand-maintained copies of one population drift —\n * `invariant-call-site-enumeration.md` #21 — so this test is the link: every fact the spec\n * states is read back from the live module. It lives here because the CLI is the one package\n * that depends on both the specifications and the private connector package.\n *\n * Coverage is one-directional on purpose: every MAIN engine module must have a specification\n * (the acceptance of #328), while an EXTENSION/CATALOGUE engine module gets its entry when it\n * is extracted into its own package (#339).\n */\ndescribe('engine provider specifications reconcile with the live backend modules (#328)', () => {\n const modules = Array.from(EngineBackendProviderRegistry.modules.values());\n\n it('discovers the population it reconciles (guards the guard)', () => {\n expect(modules.length).toBeGreaterThanOrEqual(20);\n expect(Object.keys(engineProviderSpecifications).length).toBeGreaterThanOrEqual(13);\n });\n\n it('describes every MAIN backend module', () => {\n const missing = modules\n .filter((module) => module.metadata.tier === ProviderTier.MAIN)\n .map((module) => module.metadata.ref)\n .filter((ref) => !engineProviderSpecifications[providerSpecificationKeyFor(ref)]);\n expect(missing, 'MAIN engine providers with no specification').toEqual([]);\n });\n\n it.each(Object.values(engineProviderSpecifications).map((spec) => [spec.ref, spec] as const))(\n 'the %s specification states what its module declares',\n (ref, spec) => {\n const module = EngineBackendProviderRegistry.modules.get(ref as never);\n expect(module, `no backend module for ${ref}`).toBeDefined();\n if (!module) return;\n expect(spec.packageName).toBe(module.metadata.packageName);\n expect(spec.tier).toBe(module.metadata.tier);\n expect(spec.vendor).toBe(module.metadata.vendor);\n expect(spec.origin).toEqual(module.metadata.origin);\n expect([...spec.protocols].sort()).toEqual(module.protocols.map((binding) => binding.protocol).sort());\n expect([...spec.providerCapabilities].sort()).toEqual([...module.providerCapabilities].sort());\n const boundSlots = [...new Set(engineSlotsBoundByCapabilities(module.providerCapabilities).map((entry) => entry.slot))].sort();\n expect([...spec.engineCapabilities].sort()).toEqual(boundSlots);\n expect(spec.secretsContract).toEqual(\n Object.entries(module.secretsContract)\n .map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n );\n },\n );\n});\n"]}
1
+ {"version":3,"file":"engine-provider-specifications.reconciliation.test.js","sourceRoot":"","sources":["../../../../../src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,YAAY,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;;;;;;GAUG;AACH,QAAQ,CA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CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEnG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;aAC1H,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAC9D,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { EngineBackendProviderRegistry } from '@wildo-ai/external-connectors-private/backend';\nimport { engineProviderSpecifications, providerSpecificationKeyFor } from '@wildo-ai/saas-specifications';\nimport { ProviderTier, engineSlotsBoundByCapabilities } from '@wildo-ai/saas-models';\n\n/**\n * A provider specification RE-STATES facts its backend module owns (protocols, capabilities,\n * engine slots, secrets, tier, package). Two hand-maintained copies of one population drift —\n * `invariant-call-site-enumeration.md` #21 — so this test is the link: every fact the spec\n * states is read back from the live module. It lives here because the CLI is the one package\n * that depends on both the specifications and the private connector package.\n *\n * Coverage is one-directional on purpose: every MAIN engine module must have a specification\n * (the acceptance of #328), while an EXTENSION/CATALOGUE engine module gets its entry when it\n * is extracted into its own package (#339).\n */\ndescribe('engine provider specifications reconcile with the live backend modules (#328)', () => {\n const modules = Array.from(EngineBackendProviderRegistry.modules.values());\n\n it('discovers the population it reconciles (guards the guard)', () => {\n expect(modules.length).toBeGreaterThanOrEqual(20);\n expect(Object.keys(engineProviderSpecifications).length).toBeGreaterThanOrEqual(13);\n });\n\n it('describes every MAIN backend module', () => {\n const missing = modules\n .filter((module) => module.metadata.tier === ProviderTier.MAIN)\n .map((module) => module.metadata.ref)\n .filter((ref) => !engineProviderSpecifications[providerSpecificationKeyFor(ref)]);\n expect(missing, 'MAIN engine providers with no specification').toEqual([]);\n });\n\n it.each(Object.values(engineProviderSpecifications).map((spec) => [spec.ref, spec] as const))(\n 'the %s specification states what its module declares',\n (ref, spec) => {\n const module = EngineBackendProviderRegistry.modules.get(ref as never);\n expect(module, `no backend module for ${ref}`).toBeDefined();\n if (!module) return;\n expect(spec.packageName).toBe(module.metadata.packageName);\n expect(spec.tier).toBe(module.metadata.tier);\n expect(spec.vendor).toBe(module.metadata.vendor);\n expect(spec.origin).toEqual(module.metadata.origin);\n expect([...spec.protocols].sort()).toEqual(module.protocols.map((binding) => binding.protocol).sort());\n expect([...spec.providerCapabilities].sort()).toEqual([...module.providerCapabilities].sort());\n const boundSlots = [...new Set(engineSlotsBoundByCapabilities(module.providerCapabilities).map((entry) => entry.slot))].sort();\n expect([...spec.engineCapabilities].sort()).toEqual(boundSlots);\n /*\n * WHO runs it and WHERE it processes, restated. This is the fact that makes an operator's\n * declared processing region CHECKABLE: the compliance lane reads specifications, not backend\n * modules, so before the spec carried it `appAssertedProcessingRegions` had no data to compare\n * and therefore no caller. A spec that drifts here would let the register vouch for a region\n * the vendor never offered.\n */\n expect(spec.complianceProfile, `${spec.ref} compliance profile`).toEqual(module.complianceProfile);\n\n expect(spec.secretsContract).toEqual(\n Object.entries(module.secretsContract)\n .map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n );\n },\n );\n});\n"]}
@@ -193,6 +193,23 @@ describe('wildo fwk audit — live contract', () => {
193
193
  expect(authoredPlaybookCount).toBeGreaterThan(0);
194
194
  expect(report.stats.playbookCount).toBe(authoredPlaybookCount);
195
195
  });
196
+ it('LIFTS choreography children, so rule 30 reporting zero is a clean catalog and not a blind rule', () => {
197
+ /**
198
+ * The guard on rule 30's own silence.
199
+ *
200
+ * Rule 30 refuses a composite admitting a child playbook that does not exist. Its answer on this
201
+ * tree is zero, and zero is exactly what a parser that lifted no `method.choreography.admits`
202
+ * would also report — a green line with a plausible number, which is the failure mode
203
+ * `invariant-call-site-enumeration.md` #19 records ("a count is evidence about your search, never
204
+ * about the world"). This assertion is the independent measurement that separates them.
205
+ *
206
+ * A FLOOR, not an equality: the catalog's composite count is a product decision that moves, and a
207
+ * literal beside a thing it counts is the maintenance defect the playbook-count comment above
208
+ * this one was rewritten to remove. What must never happen is the count reaching zero while
209
+ * composites are authored.
210
+ */
211
+ expect(report.stats.choreographyChildRefCount).toBeGreaterThan(0);
212
+ });
196
213
  });
197
214
  function countByRule(findings) {
198
215
  const counts = {};
@@ -1 +1 @@
1
- {"version":3,"file":"framework-knowledge-audit.live.contract.test.js","sourceRoot":"","sources":["../../../../../src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAE/B,MAAM,iEAAiE,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AAEpC,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,4BAA4B;AAC5B,MAAM,gBAAgB,GAAmE;IACvF,CAAC,2BAA2B,CAAC,+BAA+B,C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AAQ,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAClH,IAAI,CACL,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;QACxC,IACE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;YAClD,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAC/C,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,MAAM;QACR,CAAC;QACD,MAAM,GAAG,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,wGAAwG,IAAI,EAAE,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { dirname, resolve } from 'node:path';\nimport { existsSync, readdirSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport {\n FrameworkKnowledgeAuditRule,\n FrameworkKnowledgeAuditService,\n type FrameworkKnowledgeAuditFinding,\n} from '~wildo-cli/services/framework/framework-knowledge-audit.service';\n\n/**\n * Live contract test for `wildo fwk audit`.\n *\n * Unlike `framework-knowledge-audit.service.test.ts`, which exercises every\n * rule against synthetic fixtures, this test runs the real audit against\n * the live repository tree. It is the regression gate for any PR that\n * touches `platform/factory/framework-knowledge/**`, `engine/**`, or\n * `examples/wonder-todos/**`.\n *\n * Contract:\n *\n * - **Failures (rules 1–5 + 12) must always be zero.** If a PR introduces\n * an integrity break (unknown reference id, registered id without\n * anchor, anchor without registry entry, missing/empty SKILL\n * frontmatter, description over the 1024-char hard limit, or a\n * `@wildo_source:part:start` without a matching `:part:end`), this\n * test fails and the PR is blocked.\n * - **Warnings (rules 6–11) are bounded by a baseline.** The baseline\n * reflects the current floor of accepted hygiene debt. Any new warning\n * pushes the count over the baseline and fails this test, forcing the\n * author to either fix the warning or explicitly raise the baseline\n * (which surfaces as a code-review signal). Lowering the baseline is\n * silent and welcome — it ratchets the floor downwards.\n *\n * The baseline is intentionally per-rule rather than a single number, so\n * a fix on one rule cannot mask a regression on another.\n *\n * The matching CI workflow is `.github/workflows/framework-knowledge-audit.yml`.\n */\n\nconst REPO_ROOT = resolveRepoRoot();\n\n// Deliberately partial: a newly introduced rule receives a zero default below\n// until its owner explicitly documents a non-zero hygiene baseline. That keeps\n// a new rule from silently escaping the live contract merely because this map\n// predates the enum member.\nconst WARNING_BASELINE: Readonly<Partial<Record<FrameworkKnowledgeAuditRule, number>>> = {\n [FrameworkKnowledgeAuditRule.ReferencePlaceholderToUnknownId]: 0,\n [FrameworkKnowledgeAuditRule.ReferencePlaceholderWithoutAnchor]: 0,\n [FrameworkKnowledgeAuditRule.AnchorWithoutRegistryEntry]: 0,\n [FrameworkKnowledgeAuditRule.SkillFrontmatterIncomplete]: 0,\n [FrameworkKnowledgeAuditRule.SkillDescriptionExceedsHardLimit]: 0,\n [FrameworkKnowledgeAuditRule.RegistryEntryWithoutAnchor]: 0,\n [FrameworkKnowledgeAuditRule.ReferenceFileNotCitedInSkill]: 0,\n [FrameworkKnowledgeAuditRule.IndexCatalogMismatch]: 0,\n [FrameworkKnowledgeAuditRule.SkillDescriptionMissingTriggerPhrasing]: 3,\n // Baseline raised from 5 → 16 (2026-04-13) post-recovery. Two\n // categories of accepted hygiene debt — both deliberately surfaced\n // here so any further regression still trips the gate:\n //\n // • 11 in `website_section_*/SKILL.md` Phase-1 drops (contact / cta\n // / faq×2 / feature_benefit_summary / feature_detail / footer_cta\n // / hero / pricing×2 / social_proof). Tier A (wonder-todos) does\n // NOT apply — wonder-todos is a todos app, not a website. Tier B\n // (engine JSDoc) does NOT apply either — per `saas-website-slice\n // .md` D6/D15 the framework intentionally ships NO concrete\n // business sections, so there is no engine-side host for these\n // JSX fragments. Tier C with an inline example IS the correct\n // tier; the per-block `// TIER C WAIVER:` comment refactor is\n // tracked in `.cursor/plans/saas-website-slice.md` (Phase-3 skill\n // polish pass).\n //\n // • 5 in non-website skills (`backend-addon-wiring`,\n // `backend-custom-operation`, `config-design-system`,\n // `i18n-label-generation`, `i18n-translation-rerun`). These COULD\n // migrate to Tier A (wonder-todos anchor) or Tier B (engine\n // JSDoc) and SHOULD — they are recovery-batch debt, not a\n // structural Tier-C exception. Tracked as a deferred follow-up;\n // when each is migrated, lower this baseline accordingly.\n [FrameworkKnowledgeAuditRule.TierCExampleWithoutWaiver]: 16,\n [FrameworkKnowledgeAuditRule.VerificationSectionMissingGrepInvariants]: 1,\n // FAIL-channel rules; listed here only so the per-rule baseline loop\n // covers every enum member. The FAIL gate above already asserts zero\n // findings for these rules.\n [FrameworkKnowledgeAuditRule.AnchorWithoutEndMarker]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookSkillRefToUnknownSkill]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookOutputSchemaRefInvalid]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookRefVersionDuplicate]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookForbiddenTopicImplicitPlaceholder]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookFolderContractViolation]: 0,\n [FrameworkKnowledgeAuditRule.SkillsIndexForbiddenTopicImplicitPlaceholder]: 0,\n // Rule 21 — must stay 0. It fires when one anchor id extracts identical\n // content from several files, which means a duplicated / generated copy of a\n // source tree has leaked back into the scan universe. Measured on this tree:\n // 25 ids fired before `**/.wildo-saas/tmp/**` was denied, 0 after. Do not\n // raise this baseline — the correct fix is always to exclude the duplicate\n // tree in FRAMEWORK_KNOWLEDGE_SCAN_IGNORE_GLOBS.\n [FrameworkKnowledgeAuditRule.AnchorIdDuplicateSourceContent]: 0,\n // Rule 23 — two TRUE findings, awaiting a product decision, and shrink-only:\n //\n // • CLEARED 2026-08-28 — `top_down.business-model` now produces the family, so\n // `bottom_up.foundation`'s billing derivation has something to read.\n // • `refinement.compliance-document-candidate` gates on `artifact_valid:\n // compliance-document-fact-projection`, a family with no producer, no landing target and no\n // schema anywhere. That playbook, and with it the whole `refinement` phase, has been\n // permanently ineligible since it was authored.\n //\n // Both have now cleared (business-model 2026-08-28 via `top_down.business-model`; the compliance\n // projection the same day via `refinement.document-facts`). Never RAISE this: a new dangling\n // declaration is exactly the defect this rule exists to catch at PR time instead of by hand.\n // 0 as of 2026-08-28. The last finding was `refinement.compliance-document-candidate` gating on\n // `compliance-document-fact-projection`, a host-computed projection that no playbook produces and\n // that `artifact_valid` (which reads LANDED families) could never satisfy. It now gates on\n // `document-facts`, which `refinement.document-facts` produces.\n //\n // The rule is ready for the FAIL channel — promoting it is a separate change, since it turns every\n // future dangling declaration into a merge block rather than a warning.\n [FrameworkKnowledgeAuditRule.PlaybookInputFamilyWithNoProducer]: 0,\n\n // Rule 24 — a READINESS-gated family must also be declared as an input.\n //\n // 0 from the day it landed (2026-08-29), and recorded EXPLICITLY rather than left to the default\n // so the next reader can tell \"measured and clean\" from \"never measured\". All 16 playbooks with\n // preconditions satisfy it: every family gated at `artifact_exists`/`artifact_valid` strength is\n // also declared in `inputs[]`.\n //\n // Why it exists at zero: derived-staleness reads a playbook's OWN `inputs[]`, so an omission makes\n // the family drop silently out of the comparison — and a family not reported as moved reads as one\n // that is current, the dangerous direction. This is the guard that keeps the graph the staleness\n // annotation rests on true, and it must never be RAISED.\n [FrameworkKnowledgeAuditRule.PlaybookReadinessGatedFamilyNotDeclaredAsInput]: 0,\n\n /*\n * Rule 27 is RETIRED (2026-09-04) with the mechanism it policed.\n *\n * It caught a `PHASE_IS` gate naming a phase `deriveJourneyPhase` could never return, which made\n * the playbook permanently unselectable by the loop (#116). Both the predicate and the derivation\n * are gone — an application is not in a phase — so the finding it reported can no longer be\n * authored, and the rule is deleted rather than left at a baseline of 0.\n *\n * Its note carried a caution worth keeping in general: never widen a vocabulary to make a finding\n * fall. That shortcut clears the report while leaving what the report was about.\n *\n * NOTE ON THE BASELINES ABOVE: they were all measured while the parser could not resolve\n * enum-backed fields, so rules 23/24/26 saw only the JSON-style playbooks and were blind to those\n * authored in TypeScript. That was fixed and every baseline above re-measured with full\n * visibility — all still 0, verified by planting a dangling-family precondition in a TS-style\n * playbook and watching rules 23 and 24 both fire.\n */\n};\n\ndescribe('wildo fwk audit — live contract', () => {\n const report = FrameworkKnowledgeAuditService.audit(REPO_ROOT);\n\n it('reports zero FAIL-channel findings (rules 1–5 + 12–18)', () => {\n expect(\n report.failures,\n formatFindingsForFailureMessage(\n 'New integrity break in framework-knowledge — fix before merge:',\n report.failures,\n ),\n ).toHaveLength(0);\n });\n\n it('does not exceed the per-rule warning baseline', () => {\n const observed = countByRule(report.warnings);\n const breaches: string[] = [];\n for (const rule of Object.values(FrameworkKnowledgeAuditRule)) {\n const baseline = WARNING_BASELINE[rule] ?? 0;\n const actual = observed[rule] ?? 0;\n if (actual > baseline) {\n const offendingFindings = report.warnings.filter((finding) => finding.rule === rule);\n breaches.push(\n `Rule \"${rule}\": ${actual} finding(s) > baseline ${baseline}.\\n` +\n offendingFindings.map((finding) => ` - ${finding.location} — ${finding.message}`).join('\\n'),\n );\n }\n }\n expect(\n breaches,\n breaches.length > 0\n ? [\n 'New framework-knowledge hygiene warning(s) exceeded the recorded baseline.',\n 'Either fix the issue or — if the regression is intentional — raise the baseline',\n 'in framework-knowledge-audit.live.contract.test.ts so reviewers see the trade-off explicitly.',\n '',\n ...breaches,\n ].join('\\n')\n : 'baseline respected',\n ).toEqual([]);\n });\n\n it('exposes a healthy registry (anchor parity + non-empty skill catalog)', () => {\n expect(report.stats.registeredAnchorCount).toBeGreaterThan(0);\n expect(report.stats.discoveredAnchorCount).toBe(report.stats.registeredAnchorCount);\n expect(report.stats.skillCount).toBeGreaterThanOrEqual(30);\n expect(report.stats.referenceFileCount).toBeGreaterThan(0);\n /**\n * DERIVED from the authored catalog, not a hand-kept literal.\n *\n * This assertion exists to catch playbook DISCOVERY breaking — a count of 0 while the repo ships\n * a catalog. It was written as `>= 16`, and a literal has to be re-edited every time the catalog\n * changes: when `bottom_up.assemble-verify` was retired the floor stayed at 16 and the test\n * failed on a CORRECT tree, on this branch and upstream alike. A number that must be maintained\n * by hand beside the thing it counts is the defect, not the number.\n *\n * Upstream fixed the same red independently by bumping the floor to 15 (merge `ab4d15af`,\n * \"catalog 16 -> 15\"). That is correct today and wrong at the next add or retirement, which\n * is the argument for deriving it instead — the two fixes met in a merge conflict here.\n *\n * Reading the directory makes it self-maintaining AND stronger — exact equality rather than a\n * floor, so a playbook that fails to be discovered is caught even while others still are. The\n * `toBeGreaterThan(0)` above it guards the guard: if the directory read ever returns nothing,\n * the comparison would otherwise pass vacuously and report a healthy registry.\n */\n const authoredPlaybookCount = readdirSync(\n resolve(resolveRepoRoot(), 'platform/factory/framework-knowledge/src/playbooks'),\n { withFileTypes: true },\n ).filter((entry) => entry.isDirectory()).length;\n expect(authoredPlaybookCount).toBeGreaterThan(0);\n expect(report.stats.playbookCount).toBe(authoredPlaybookCount);\n });\n});\n\nfunction countByRule(findings: readonly FrameworkKnowledgeAuditFinding[]): Record<string, number> {\n const counts: Record<string, number> = {};\n for (const finding of findings) {\n counts[finding.rule] = (counts[finding.rule] ?? 0) + 1;\n }\n return counts;\n}\n\nfunction formatFindingsForFailureMessage(\n prefix: string,\n findings: readonly FrameworkKnowledgeAuditFinding[],\n): string {\n if (findings.length === 0) {\n return prefix;\n }\n return [prefix, ...findings.map((finding) => ` - [${finding.rule}] ${finding.location} — ${finding.message}`)].join(\n '\\n',\n );\n}\n\n/**\n * Walks up from the test file location until it finds the wildo-ai repo\n * root (identified by `pnpm-workspace.yaml` + `.wildo-framework/`). This\n * keeps the live audit independent of whatever working directory vitest\n * is launched from.\n */\nfunction resolveRepoRoot(): string {\n const here = dirname(fileURLToPath(import.meta.url));\n let cursor = here;\n for (let depth = 0; depth < 10; depth++) {\n if (\n existsSync(resolve(cursor, 'pnpm-workspace.yaml')) &&\n existsSync(resolve(cursor, '.wildo-framework'))\n ) {\n return cursor;\n }\n const parent = dirname(cursor);\n if (parent === cursor) {\n break;\n }\n cursor = parent;\n }\n throw new Error(\n `Could not locate wildo-ai repo root (expected pnpm-workspace.yaml + .wildo-framework/) starting from ${here}`,\n );\n}\n"]}
1
+ {"version":3,"file":"framework-knowledge-audit.live.contract.test.js","sourceRoot":"","sources":["../../../../../src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAE/B,MAAM,iEAAiE,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AAEpC,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,4BAA4B;AAC5B,MAAM,gBAAgB,GAAmE;IACvF,CAAC,2BAA2B,CAAC,+BAA+B,CAAC,EAAE,CAAC;IAChE,CAAC,2BAA2B,CAAC,iCAAiC,CAAC,EAAE,CAAC;IAClE,CAAC,2BAA2B,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC3D,CAAC,2BAA2B,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC3D,CAAC,2BAA2B,CAAC,gCAAgC,CAAC,EAAE,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AC,CAAC,CAAC,IAAI,CAClH,IAAI,CACL,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;QACxC,IACE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;YAClD,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAC/C,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,MAAM;QACR,CAAC;QACD,MAAM,GAAG,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,wGAAwG,IAAI,EAAE,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { dirname, resolve } from 'node:path';\nimport { existsSync, readdirSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport {\n FrameworkKnowledgeAuditRule,\n FrameworkKnowledgeAuditService,\n type FrameworkKnowledgeAuditFinding,\n} from '~wildo-cli/services/framework/framework-knowledge-audit.service';\n\n/**\n * Live contract test for `wildo fwk audit`.\n *\n * Unlike `framework-knowledge-audit.service.test.ts`, which exercises every\n * rule against synthetic fixtures, this test runs the real audit against\n * the live repository tree. It is the regression gate for any PR that\n * touches `platform/factory/framework-knowledge/**`, `engine/**`, or\n * `examples/wonder-todos/**`.\n *\n * Contract:\n *\n * - **Failures (rules 1–5 + 12) must always be zero.** If a PR introduces\n * an integrity break (unknown reference id, registered id without\n * anchor, anchor without registry entry, missing/empty SKILL\n * frontmatter, description over the 1024-char hard limit, or a\n * `@wildo_source:part:start` without a matching `:part:end`), this\n * test fails and the PR is blocked.\n * - **Warnings (rules 6–11) are bounded by a baseline.** The baseline\n * reflects the current floor of accepted hygiene debt. Any new warning\n * pushes the count over the baseline and fails this test, forcing the\n * author to either fix the warning or explicitly raise the baseline\n * (which surfaces as a code-review signal). Lowering the baseline is\n * silent and welcome — it ratchets the floor downwards.\n *\n * The baseline is intentionally per-rule rather than a single number, so\n * a fix on one rule cannot mask a regression on another.\n *\n * The matching CI workflow is `.github/workflows/framework-knowledge-audit.yml`.\n */\n\nconst REPO_ROOT = resolveRepoRoot();\n\n// Deliberately partial: a newly introduced rule receives a zero default below\n// until its owner explicitly documents a non-zero hygiene baseline. That keeps\n// a new rule from silently escaping the live contract merely because this map\n// predates the enum member.\nconst WARNING_BASELINE: Readonly<Partial<Record<FrameworkKnowledgeAuditRule, number>>> = {\n [FrameworkKnowledgeAuditRule.ReferencePlaceholderToUnknownId]: 0,\n [FrameworkKnowledgeAuditRule.ReferencePlaceholderWithoutAnchor]: 0,\n [FrameworkKnowledgeAuditRule.AnchorWithoutRegistryEntry]: 0,\n [FrameworkKnowledgeAuditRule.SkillFrontmatterIncomplete]: 0,\n [FrameworkKnowledgeAuditRule.SkillDescriptionExceedsHardLimit]: 0,\n [FrameworkKnowledgeAuditRule.RegistryEntryWithoutAnchor]: 0,\n [FrameworkKnowledgeAuditRule.ReferenceFileNotCitedInSkill]: 0,\n [FrameworkKnowledgeAuditRule.IndexCatalogMismatch]: 0,\n [FrameworkKnowledgeAuditRule.SkillDescriptionMissingTriggerPhrasing]: 3,\n // Baseline raised from 5 → 16 (2026-04-13) post-recovery. Two\n // categories of accepted hygiene debt — both deliberately surfaced\n // here so any further regression still trips the gate:\n //\n // • 11 in `website_section_*/SKILL.md` Phase-1 drops (contact / cta\n // / faq×2 / feature_benefit_summary / feature_detail / footer_cta\n // / hero / pricing×2 / social_proof). Tier A (wonder-todos) does\n // NOT apply — wonder-todos is a todos app, not a website. Tier B\n // (engine JSDoc) does NOT apply either — per `saas-website-slice\n // .md` D6/D15 the framework intentionally ships NO concrete\n // business sections, so there is no engine-side host for these\n // JSX fragments. Tier C with an inline example IS the correct\n // tier; the per-block `// TIER C WAIVER:` comment refactor is\n // tracked in `.cursor/plans/saas-website-slice.md` (Phase-3 skill\n // polish pass).\n //\n // • 5 in non-website skills (`backend-addon-wiring`,\n // `backend-custom-operation`, `config-design-system`,\n // `i18n-label-generation`, `i18n-translation-rerun`). These COULD\n // migrate to Tier A (wonder-todos anchor) or Tier B (engine\n // JSDoc) and SHOULD — they are recovery-batch debt, not a\n // structural Tier-C exception. Tracked as a deferred follow-up;\n // when each is migrated, lower this baseline accordingly.\n [FrameworkKnowledgeAuditRule.TierCExampleWithoutWaiver]: 16,\n [FrameworkKnowledgeAuditRule.VerificationSectionMissingGrepInvariants]: 1,\n // FAIL-channel rules; listed here only so the per-rule baseline loop\n // covers every enum member. The FAIL gate above already asserts zero\n // findings for these rules.\n [FrameworkKnowledgeAuditRule.AnchorWithoutEndMarker]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookSkillRefToUnknownSkill]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookOutputSchemaRefInvalid]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookRefVersionDuplicate]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookForbiddenTopicImplicitPlaceholder]: 0,\n [FrameworkKnowledgeAuditRule.PlaybookFolderContractViolation]: 0,\n [FrameworkKnowledgeAuditRule.SkillsIndexForbiddenTopicImplicitPlaceholder]: 0,\n // Rule 21 — must stay 0. It fires when one anchor id extracts identical\n // content from several files, which means a duplicated / generated copy of a\n // source tree has leaked back into the scan universe. Measured on this tree:\n // 25 ids fired before `**/.wildo-saas/tmp/**` was denied, 0 after. Do not\n // raise this baseline — the correct fix is always to exclude the duplicate\n // tree in FRAMEWORK_KNOWLEDGE_SCAN_IGNORE_GLOBS.\n [FrameworkKnowledgeAuditRule.AnchorIdDuplicateSourceContent]: 0,\n // Rule 23 — two TRUE findings, awaiting a product decision, and shrink-only:\n //\n // • CLEARED 2026-08-28 — `top_down.business-model` now produces the family, so\n // `bottom_up.foundation`'s billing derivation has something to read.\n // • `refinement.compliance-document-candidate` gates on `artifact_valid:\n // compliance-document-fact-projection`, a family with no producer, no landing target and no\n // schema anywhere. That playbook, and with it the whole `refinement` phase, has been\n // permanently ineligible since it was authored.\n //\n // Both have now cleared (business-model 2026-08-28 via `top_down.business-model`; the compliance\n // projection the same day via `refinement.document-facts`). Never RAISE this: a new dangling\n // declaration is exactly the defect this rule exists to catch at PR time instead of by hand.\n // 0 as of 2026-08-28. The last finding was `refinement.compliance-document-candidate` gating on\n // `compliance-document-fact-projection`, a host-computed projection that no playbook produces and\n // that `artifact_valid` (which reads LANDED families) could never satisfy. It now gates on\n // `document-facts`, which `refinement.document-facts` produces.\n //\n // The rule is ready for the FAIL channel — promoting it is a separate change, since it turns every\n // future dangling declaration into a merge block rather than a warning.\n [FrameworkKnowledgeAuditRule.PlaybookInputFamilyWithNoProducer]: 0,\n\n // Rule 24 — a READINESS-gated family must also be declared as an input.\n //\n // 0 from the day it landed (2026-08-29), and recorded EXPLICITLY rather than left to the default\n // so the next reader can tell \"measured and clean\" from \"never measured\". All 16 playbooks with\n // preconditions satisfy it: every family gated at `artifact_exists`/`artifact_valid` strength is\n // also declared in `inputs[]`.\n //\n // Why it exists at zero: derived-staleness reads a playbook's OWN `inputs[]`, so an omission makes\n // the family drop silently out of the comparison — and a family not reported as moved reads as one\n // that is current, the dangerous direction. This is the guard that keeps the graph the staleness\n // annotation rests on true, and it must never be RAISED.\n [FrameworkKnowledgeAuditRule.PlaybookReadinessGatedFamilyNotDeclaredAsInput]: 0,\n\n /*\n * Rule 27 is RETIRED (2026-09-04) with the mechanism it policed.\n *\n * It caught a `PHASE_IS` gate naming a phase `deriveJourneyPhase` could never return, which made\n * the playbook permanently unselectable by the loop (#116). Both the predicate and the derivation\n * are gone — an application is not in a phase — so the finding it reported can no longer be\n * authored, and the rule is deleted rather than left at a baseline of 0.\n *\n * Its note carried a caution worth keeping in general: never widen a vocabulary to make a finding\n * fall. That shortcut clears the report while leaving what the report was about.\n *\n * NOTE ON THE BASELINES ABOVE: they were all measured while the parser could not resolve\n * enum-backed fields, so rules 23/24/26 saw only the JSON-style playbooks and were blind to those\n * authored in TypeScript. That was fixed and every baseline above re-measured with full\n * visibility — all still 0, verified by planting a dangling-family precondition in a TS-style\n * playbook and watching rules 23 and 24 both fire.\n */\n};\n\ndescribe('wildo fwk audit — live contract', () => {\n const report = FrameworkKnowledgeAuditService.audit(REPO_ROOT);\n\n it('reports zero FAIL-channel findings (rules 1–5 + 12–18)', () => {\n expect(\n report.failures,\n formatFindingsForFailureMessage(\n 'New integrity break in framework-knowledge — fix before merge:',\n report.failures,\n ),\n ).toHaveLength(0);\n });\n\n it('does not exceed the per-rule warning baseline', () => {\n const observed = countByRule(report.warnings);\n const breaches: string[] = [];\n for (const rule of Object.values(FrameworkKnowledgeAuditRule)) {\n const baseline = WARNING_BASELINE[rule] ?? 0;\n const actual = observed[rule] ?? 0;\n if (actual > baseline) {\n const offendingFindings = report.warnings.filter((finding) => finding.rule === rule);\n breaches.push(\n `Rule \"${rule}\": ${actual} finding(s) > baseline ${baseline}.\\n` +\n offendingFindings.map((finding) => ` - ${finding.location} — ${finding.message}`).join('\\n'),\n );\n }\n }\n expect(\n breaches,\n breaches.length > 0\n ? [\n 'New framework-knowledge hygiene warning(s) exceeded the recorded baseline.',\n 'Either fix the issue or — if the regression is intentional — raise the baseline',\n 'in framework-knowledge-audit.live.contract.test.ts so reviewers see the trade-off explicitly.',\n '',\n ...breaches,\n ].join('\\n')\n : 'baseline respected',\n ).toEqual([]);\n });\n\n it('exposes a healthy registry (anchor parity + non-empty skill catalog)', () => {\n expect(report.stats.registeredAnchorCount).toBeGreaterThan(0);\n expect(report.stats.discoveredAnchorCount).toBe(report.stats.registeredAnchorCount);\n expect(report.stats.skillCount).toBeGreaterThanOrEqual(30);\n expect(report.stats.referenceFileCount).toBeGreaterThan(0);\n /**\n * DERIVED from the authored catalog, not a hand-kept literal.\n *\n * This assertion exists to catch playbook DISCOVERY breaking — a count of 0 while the repo ships\n * a catalog. It was written as `>= 16`, and a literal has to be re-edited every time the catalog\n * changes: when `bottom_up.assemble-verify` was retired the floor stayed at 16 and the test\n * failed on a CORRECT tree, on this branch and upstream alike. A number that must be maintained\n * by hand beside the thing it counts is the defect, not the number.\n *\n * Upstream fixed the same red independently by bumping the floor to 15 (merge `ab4d15af`,\n * \"catalog 16 -> 15\"). That is correct today and wrong at the next add or retirement, which\n * is the argument for deriving it instead — the two fixes met in a merge conflict here.\n *\n * Reading the directory makes it self-maintaining AND stronger — exact equality rather than a\n * floor, so a playbook that fails to be discovered is caught even while others still are. The\n * `toBeGreaterThan(0)` above it guards the guard: if the directory read ever returns nothing,\n * the comparison would otherwise pass vacuously and report a healthy registry.\n */\n const authoredPlaybookCount = readdirSync(\n resolve(resolveRepoRoot(), 'platform/factory/framework-knowledge/src/playbooks'),\n { withFileTypes: true },\n ).filter((entry) => entry.isDirectory()).length;\n expect(authoredPlaybookCount).toBeGreaterThan(0);\n expect(report.stats.playbookCount).toBe(authoredPlaybookCount);\n });\n\n it('LIFTS choreography children, so rule 30 reporting zero is a clean catalog and not a blind rule', () => {\n /**\n * The guard on rule 30's own silence.\n *\n * Rule 30 refuses a composite admitting a child playbook that does not exist. Its answer on this\n * tree is zero, and zero is exactly what a parser that lifted no `method.choreography.admits`\n * would also report — a green line with a plausible number, which is the failure mode\n * `invariant-call-site-enumeration.md` #19 records (\"a count is evidence about your search, never\n * about the world\"). This assertion is the independent measurement that separates them.\n *\n * A FLOOR, not an equality: the catalog's composite count is a product decision that moves, and a\n * literal beside a thing it counts is the maintenance defect the playbook-count comment above\n * this one was rewritten to remove. What must never happen is the count reaching zero while\n * composites are authored.\n */\n expect(report.stats.choreographyChildRefCount).toBeGreaterThan(0);\n });\n});\n\nfunction countByRule(findings: readonly FrameworkKnowledgeAuditFinding[]): Record<string, number> {\n const counts: Record<string, number> = {};\n for (const finding of findings) {\n counts[finding.rule] = (counts[finding.rule] ?? 0) + 1;\n }\n return counts;\n}\n\nfunction formatFindingsForFailureMessage(\n prefix: string,\n findings: readonly FrameworkKnowledgeAuditFinding[],\n): string {\n if (findings.length === 0) {\n return prefix;\n }\n return [prefix, ...findings.map((finding) => ` - [${finding.rule}] ${finding.location} — ${finding.message}`)].join(\n '\\n',\n );\n}\n\n/**\n * Walks up from the test file location until it finds the wildo-ai repo\n * root (identified by `pnpm-workspace.yaml` + `.wildo-framework/`). This\n * keeps the live audit independent of whatever working directory vitest\n * is launched from.\n */\nfunction resolveRepoRoot(): string {\n const here = dirname(fileURLToPath(import.meta.url));\n let cursor = here;\n for (let depth = 0; depth < 10; depth++) {\n if (\n existsSync(resolve(cursor, 'pnpm-workspace.yaml')) &&\n existsSync(resolve(cursor, '.wildo-framework'))\n ) {\n return cursor;\n }\n const parent = dirname(cursor);\n if (parent === cursor) {\n break;\n }\n cursor = parent;\n }\n throw new Error(\n `Could not locate wildo-ai repo root (expected pnpm-workspace.yaml + .wildo-framework/) starting from ${here}`,\n );\n}\n"]}
@@ -159,6 +159,7 @@ function writePlaybook(frameworkRoot, playbook) {
159
159
  method: {
160
160
  skillRefs: playbook.skillRefs ?? [],
161
161
  ...(playbook.contextSources !== undefined ? { contextSources: playbook.contextSources } : {}),
162
+ ...(playbook.admits !== undefined ? { choreography: { admits: playbook.admits } } : {}),
162
163
  ...(playbook.inlineGuidance !== undefined ? { guidance: playbook.inlineGuidance } : {}),
163
164
  },
164
165
  executor: 'human',
@@ -745,6 +746,56 @@ describe('FrameworkKnowledgeAuditService', () => {
745
746
  expect(findings[0].message).toContain('no-such-skill');
746
747
  expect(findings[0].location).toContain('meta-workflows.smoke');
747
748
  });
749
+ it('FAIL rule 30 — flags a composite admitting a child playbook that does not exist', () => {
750
+ const frameworkRoot = mkdtempSync(join(tmpdir(), 'wildo-fwk-audit-rule30-'));
751
+ tempDirs.push(frameworkRoot);
752
+ setupFrameworkScaffold(frameworkRoot);
753
+ writeRegistry(frameworkRoot, { ids: [] });
754
+ writeIndexCatalog(frameworkRoot, { citedSkillIds: [] });
755
+ writePlaybook(frameworkRoot, { folderName: 'meta-workflows.child-a' });
756
+ writePlaybook(frameworkRoot, {
757
+ folderName: 'meta-workflows.composite',
758
+ admits: ['meta-workflows.child-a', 'meta-workflows.no-such-child'],
759
+ });
760
+ const report = FrameworkKnowledgeAuditService.audit(frameworkRoot);
761
+ const findings = findFindings(report.failures, FrameworkKnowledgeAuditRule.PlaybookChoreographyAdmitsUnknownPlaybook);
762
+ expect(findings).toHaveLength(1);
763
+ expect(findings[0].message).toContain('meta-workflows.no-such-child');
764
+ // The RESOLVABLE sibling must not be reported. Without this the rule could be "flag every child"
765
+ // and the first assertion would still pass on a two-child fixture.
766
+ expect(findings[0].message).not.toContain('child-a');
767
+ expect(findings[0].location).toContain('meta-workflows.composite');
768
+ });
769
+ it('PASS rule 30 — a composite whose every admitted child exists is silent', () => {
770
+ // The control. A rule that fired on a correct catalog would be worse than none, and this is the
771
+ // shape the live catalogue is in — both real composites resolve every child today.
772
+ const frameworkRoot = mkdtempSync(join(tmpdir(), 'wildo-fwk-audit-rule30-clean-'));
773
+ tempDirs.push(frameworkRoot);
774
+ setupFrameworkScaffold(frameworkRoot);
775
+ writeRegistry(frameworkRoot, { ids: [] });
776
+ writeIndexCatalog(frameworkRoot, { citedSkillIds: [] });
777
+ writePlaybook(frameworkRoot, { folderName: 'meta-workflows.child-a' });
778
+ writePlaybook(frameworkRoot, { folderName: 'meta-workflows.child-b' });
779
+ writePlaybook(frameworkRoot, {
780
+ folderName: 'meta-workflows.composite',
781
+ admits: ['meta-workflows.child-a', 'meta-workflows.child-b'],
782
+ });
783
+ const report = FrameworkKnowledgeAuditService.audit(frameworkRoot);
784
+ expect(findFindings(report.failures, FrameworkKnowledgeAuditRule.PlaybookChoreographyAdmitsUnknownPlaybook)).toEqual([]);
785
+ });
786
+ it('PASS rule 30 — an ordinary playbook declaring no choreography is not a composite over nothing', () => {
787
+ // `choreography` is optional on the schema, so its absence is the ordinary case. A reader that
788
+ // treated a missing field as a parse failure, or an empty `admits` as a violation, would fire on
789
+ // every non-composite in the catalog — 21 of its 23 playbooks.
790
+ const frameworkRoot = mkdtempSync(join(tmpdir(), 'wildo-fwk-audit-rule30-absent-'));
791
+ tempDirs.push(frameworkRoot);
792
+ setupFrameworkScaffold(frameworkRoot);
793
+ writeRegistry(frameworkRoot, { ids: [] });
794
+ writeIndexCatalog(frameworkRoot, { citedSkillIds: [] });
795
+ writePlaybook(frameworkRoot, { folderName: 'meta-workflows.plain' });
796
+ const report = FrameworkKnowledgeAuditService.audit(frameworkRoot);
797
+ expect(findFindings(report.failures, FrameworkKnowledgeAuditRule.PlaybookChoreographyAdmitsUnknownPlaybook)).toEqual([]);
798
+ });
748
799
  it('FAIL rule 23 — flags an INPUT family no playbook in the catalog produces', () => {
749
800
  const frameworkRoot = mkdtempSync(join(tmpdir(), 'wildo-fwk-audit-rule23-input-'));
750
801
  tempDirs.push(frameworkRoot);