@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
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assurance-basis.command.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assurance-basis.command.test.d.ts","sourceRoot":"","sources":["../../../../../src/commands/context/__tests__/assurance-basis.command.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,63 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { collectDeclaredBasisIdentities } from '../assurance-basis.command.js';
3
+ /**
4
+ * The structural walk that finds every basis acceptance in an application's compliance specification.
5
+ *
6
+ * It is a WALK rather than a list of known paths on purpose: the identity is authored on postures,
7
+ * definition authorities and implementation authorities, and a path list would be a second enumeration
8
+ * of a shape the schema already owns — the kind that silently omits the site added next. These cases
9
+ * pin the properties that makes the walk trustworthy, because a walk that quietly finds nothing reports
10
+ * a perfectly healthy application.
11
+ */
12
+ describe('collectDeclaredBasisIdentities', () => {
13
+ it('finds an identity at any depth, not only at a known path', () => {
14
+ expect(collectDeclaredBasisIdentities({
15
+ postures: [{ nested: { deeper: { basisRef: 'assurance-authority-basis:x', basisVersion: 1 } } }],
16
+ })).toEqual(['assurance-authority-basis:x@1']);
17
+ });
18
+ /*
19
+ * The reason the report is readable. Wonder Todos spreads ONE constant across eleven sites; without
20
+ * de-duplication this prints eleven identical lines and a reader stops reading it.
21
+ */
22
+ it('de-duplicates one identity spread across many sites, and sorts', () => {
23
+ const spread = { basisRef: 'assurance-authority-basis:x', basisVersion: 1 };
24
+ expect(collectDeclaredBasisIdentities({
25
+ a: spread, b: spread, c: { basisRef: 'assurance-authority-basis:a', basisVersion: 2 },
26
+ })).toEqual(['assurance-authority-basis:a@2', 'assurance-authority-basis:x@1']);
27
+ });
28
+ /*
29
+ * THE CASE THE CHECK EXISTS FOR. A partial re-acceptance legitimately leaves two generations in one
30
+ * specification — the schema carries the pin per site — and a check reading one site would pass an
31
+ * application whose other sites are stale.
32
+ */
33
+ it('reports BOTH generations when a specification holds two', () => {
34
+ expect(collectDeclaredBasisIdentities({
35
+ posture: { basisRef: 'assurance-authority-basis:x', basisVersion: 1 },
36
+ authority: { basisRef: 'assurance-authority-basis:x', basisVersion: 2 },
37
+ })).toEqual(['assurance-authority-basis:x@1', 'assurance-authority-basis:x@2']);
38
+ });
39
+ /*
40
+ * The pair must be RECOGNISED, not guessed at: a `basisRef` without a numeric `basisVersion` is not
41
+ * an acceptance, and treating it as one would print an identity like `…@undefined` that resolves
42
+ * against nothing and reads as a real failure.
43
+ */
44
+ it('ignores a half-shaped pair rather than inventing an identity', () => {
45
+ expect(collectDeclaredBasisIdentities({ basisRef: 'assurance-authority-basis:x' })).toEqual([]);
46
+ expect(collectDeclaredBasisIdentities({ basisVersion: 1 })).toEqual([]);
47
+ expect(collectDeclaredBasisIdentities({ basisRef: 'x', basisVersion: '1' })).toEqual([]);
48
+ });
49
+ it('answers nothing for an absent specification, without throwing', () => {
50
+ expect(collectDeclaredBasisIdentities(undefined)).toEqual([]);
51
+ expect(collectDeclaredBasisIdentities(null)).toEqual([]);
52
+ });
53
+ /*
54
+ * Defence rather than a known case — a specification is plain data today. Recorded because an
55
+ * infinite walk inside a CI check is a bad way to discover that assumption changed.
56
+ */
57
+ it('terminates on a cyclic graph', () => {
58
+ const cycle = { basisRef: 'assurance-authority-basis:x', basisVersion: 1 };
59
+ cycle.self = cycle;
60
+ expect(collectDeclaredBasisIdentities(cycle)).toEqual(['assurance-authority-basis:x@1']);
61
+ });
62
+ });
63
+ //# sourceMappingURL=assurance-basis.command.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assurance-basis.command.test.js","sourceRoot":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,CAAC,OAAO,CAAC,CAAC,+BAA+B,EAAE,+BAA+B,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH;;;;OAIG;IACH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,CAAC,8BAA8B,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChG,MAAM,CAAC,8BAA8B,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxE,MAAM,CAAC,8BAA8B,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9D,MAAM,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH;;;OAGG;IACH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,KAAK,GAA4B,EAAE,QAAQ,EAAE,6BAA6B,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;QACpG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,MAAM,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\n\nimport { collectDeclaredBasisIdentities } from '../assurance-basis.command';\n\n/**\n * The structural walk that finds every basis acceptance in an application's compliance specification.\n *\n * It is a WALK rather than a list of known paths on purpose: the identity is authored on postures,\n * definition authorities and implementation authorities, and a path list would be a second enumeration\n * of a shape the schema already owns — the kind that silently omits the site added next. These cases\n * pin the properties that makes the walk trustworthy, because a walk that quietly finds nothing reports\n * a perfectly healthy application.\n */\ndescribe('collectDeclaredBasisIdentities', () => {\n it('finds an identity at any depth, not only at a known path', () => {\n expect(collectDeclaredBasisIdentities({\n postures: [{ nested: { deeper: { basisRef: 'assurance-authority-basis:x', basisVersion: 1 } } }],\n })).toEqual(['assurance-authority-basis:x@1']);\n });\n\n /*\n * The reason the report is readable. Wonder Todos spreads ONE constant across eleven sites; without\n * de-duplication this prints eleven identical lines and a reader stops reading it.\n */\n it('de-duplicates one identity spread across many sites, and sorts', () => {\n const spread = { basisRef: 'assurance-authority-basis:x', basisVersion: 1 };\n expect(collectDeclaredBasisIdentities({\n a: spread, b: spread, c: { basisRef: 'assurance-authority-basis:a', basisVersion: 2 },\n })).toEqual(['assurance-authority-basis:a@2', 'assurance-authority-basis:x@1']);\n });\n\n /*\n * THE CASE THE CHECK EXISTS FOR. A partial re-acceptance legitimately leaves two generations in one\n * specification — the schema carries the pin per site — and a check reading one site would pass an\n * application whose other sites are stale.\n */\n it('reports BOTH generations when a specification holds two', () => {\n expect(collectDeclaredBasisIdentities({\n posture: { basisRef: 'assurance-authority-basis:x', basisVersion: 1 },\n authority: { basisRef: 'assurance-authority-basis:x', basisVersion: 2 },\n })).toEqual(['assurance-authority-basis:x@1', 'assurance-authority-basis:x@2']);\n });\n\n /*\n * The pair must be RECOGNISED, not guessed at: a `basisRef` without a numeric `basisVersion` is not\n * an acceptance, and treating it as one would print an identity like `…@undefined` that resolves\n * against nothing and reads as a real failure.\n */\n it('ignores a half-shaped pair rather than inventing an identity', () => {\n expect(collectDeclaredBasisIdentities({ basisRef: 'assurance-authority-basis:x' })).toEqual([]);\n expect(collectDeclaredBasisIdentities({ basisVersion: 1 })).toEqual([]);\n expect(collectDeclaredBasisIdentities({ basisRef: 'x', basisVersion: '1' })).toEqual([]);\n });\n\n it('answers nothing for an absent specification, without throwing', () => {\n expect(collectDeclaredBasisIdentities(undefined)).toEqual([]);\n expect(collectDeclaredBasisIdentities(null)).toEqual([]);\n });\n\n /*\n * Defence rather than a known case — a specification is plain data today. Recorded because an\n * infinite walk inside a CI check is a bad way to discover that assumption changed.\n */\n it('terminates on a cyclic graph', () => {\n const cycle: Record<string, unknown> = { basisRef: 'assurance-authority-basis:x', basisVersion: 1 };\n cycle.self = cycle;\n expect(collectDeclaredBasisIdentities(cycle)).toEqual(['assurance-authority-basis:x@1']);\n });\n});\n"]}
@@ -0,0 +1,61 @@
1
+ import { BaseCommand } from '../../kernel/base-command';
2
+ import type { CommandMeta, CommandContext, CommandResult } from '../../kernel/types';
3
+ /**
4
+ * Does the authority basis this application accepted its controls against still exist? (#452)
5
+ *
6
+ * ## The gap this closes
7
+ *
8
+ * `wildo fwk generate-docs` ships an assurance-authority basis into every generated application, and
9
+ * until now **nothing read it**. Its two loader accessors were called by the loader itself and by one
10
+ * generation test, so an application received a basis artefact no code consumed — and an application's
11
+ * own `basisRef` / `basisVersion` pins, which are the compatibility generation its controls were
12
+ * accepted against, were checked against nothing at all.
13
+ *
14
+ * That matters because of what the pin PROMISES. Per `.claude/rules/one-source-of-truth.md`, two equal
15
+ * generations promise the same interpretation contract; a change that alters what a control MEANS
16
+ * advances the generation so the application re-accepts deliberately. A pin naming a generation the
17
+ * installed framework no longer ships is therefore not a stale string — it is a control acceptance
18
+ * whose meaning nothing can resolve, on the one surface where "we accepted this" has to be auditable.
19
+ *
20
+ * ## EVERY identity, not the first one
21
+ *
22
+ * An application names a basis identity at many sites — each posture, each definition authority, each
23
+ * implementation authority. Wonder Todos spreads one constant across eleven of them, and nothing
24
+ * REQUIRES that: the schema carries `basisRef`/`basisVersion` per site, so a partial re-acceptance
25
+ * legitimately produces a specification holding two generations at once. Checking one site would pass
26
+ * an application whose other ten are stale, so this walks the whole value and reports each distinct
27
+ * identity it finds.
28
+ *
29
+ * ## Offline, for the same reason as `wildo context jurisdictions`
30
+ *
31
+ * The application's specification is loaded through the companion-exports entry with the shared jiti
32
+ * loader, and the shipped basis registry comes from the installed `@wildo-ai/framework-knowledge`
33
+ * package. Neither needs a companion, a stack or a network — which is the whole point: the reason to
34
+ * prefer a command over a page is that a command is reachable from CI, and a command that first
35
+ * requires a running dev companion is not.
36
+ *
37
+ * ## It REPORTS. `--check` is opt-in, and NOT DECLARED is not a failure
38
+ *
39
+ * Same disposition as its jurisdiction sibling, for the same reason. An application that declares no
40
+ * compliance specification has not answered the question rather than answered it badly, and failing
41
+ * there would gate every application on work it may not yet owe. `--check` fails only on a DECLARED
42
+ * identity the installed framework does not ship.
43
+ */
44
+ export default class ContextAssuranceBasisCommand extends BaseCommand {
45
+ readonly meta: CommandMeta;
46
+ run(ctx: CommandContext): Promise<CommandResult>;
47
+ }
48
+ /**
49
+ * Every distinct `basisRef@basisVersion` the value names, at any depth.
50
+ *
51
+ * A structural walk rather than a list of known paths, and that is deliberate. The identity is
52
+ * authored on postures, definition authorities and implementation authorities, and a path list would
53
+ * be a second enumeration of a shape the schema already owns — the kind that silently omits the site
54
+ * added next (`.claude/rules/invariant-call-site-enumeration.md`). The pair is distinctive enough to
55
+ * recognise structurally: an object carrying a string `basisRef` beside a numeric `basisVersion`.
56
+ *
57
+ * Sorted and de-duplicated, so the report reads the same on every run and an application that spreads
58
+ * one constant across eleven sites prints one line rather than eleven.
59
+ */
60
+ export declare function collectDeclaredBasisIdentities(value: unknown): readonly string[];
61
+ //# sourceMappingURL=assurance-basis.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assurance-basis.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/context/assurance-basis.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,WAAW;IACnE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAWxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAoEvD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAsBhF"}
@@ -0,0 +1,166 @@
1
+ import chalk from 'chalk';
2
+ import { join } from 'node:path';
3
+ import { loadPackageCompanionExport } from '@wildo-ai/platform-config-lib';
4
+ import { listFrameworkKnowledgeAssuranceAuthorityBases } from '@wildo-ai/framework-knowledge';
5
+ import { BaseCommand } from '../../kernel/base-command.js';
6
+ import { CommandCategory } from '../../kernel/types.js';
7
+ import { ErrorUtils } from '../../infrastructure/errors/error.utils.js';
8
+ import { requireSaasRoot } from '../../services/registry/registry-command.utils.js';
9
+ /**
10
+ * Does the authority basis this application accepted its controls against still exist? (#452)
11
+ *
12
+ * ## The gap this closes
13
+ *
14
+ * `wildo fwk generate-docs` ships an assurance-authority basis into every generated application, and
15
+ * until now **nothing read it**. Its two loader accessors were called by the loader itself and by one
16
+ * generation test, so an application received a basis artefact no code consumed — and an application's
17
+ * own `basisRef` / `basisVersion` pins, which are the compatibility generation its controls were
18
+ * accepted against, were checked against nothing at all.
19
+ *
20
+ * That matters because of what the pin PROMISES. Per `.claude/rules/one-source-of-truth.md`, two equal
21
+ * generations promise the same interpretation contract; a change that alters what a control MEANS
22
+ * advances the generation so the application re-accepts deliberately. A pin naming a generation the
23
+ * installed framework no longer ships is therefore not a stale string — it is a control acceptance
24
+ * whose meaning nothing can resolve, on the one surface where "we accepted this" has to be auditable.
25
+ *
26
+ * ## EVERY identity, not the first one
27
+ *
28
+ * An application names a basis identity at many sites — each posture, each definition authority, each
29
+ * implementation authority. Wonder Todos spreads one constant across eleven of them, and nothing
30
+ * REQUIRES that: the schema carries `basisRef`/`basisVersion` per site, so a partial re-acceptance
31
+ * legitimately produces a specification holding two generations at once. Checking one site would pass
32
+ * an application whose other ten are stale, so this walks the whole value and reports each distinct
33
+ * identity it finds.
34
+ *
35
+ * ## Offline, for the same reason as `wildo context jurisdictions`
36
+ *
37
+ * The application's specification is loaded through the companion-exports entry with the shared jiti
38
+ * loader, and the shipped basis registry comes from the installed `@wildo-ai/framework-knowledge`
39
+ * package. Neither needs a companion, a stack or a network — which is the whole point: the reason to
40
+ * prefer a command over a page is that a command is reachable from CI, and a command that first
41
+ * requires a running dev companion is not.
42
+ *
43
+ * ## It REPORTS. `--check` is opt-in, and NOT DECLARED is not a failure
44
+ *
45
+ * Same disposition as its jurisdiction sibling, for the same reason. An application that declares no
46
+ * compliance specification has not answered the question rather than answered it badly, and failing
47
+ * there would gate every application on work it may not yet owe. `--check` fails only on a DECLARED
48
+ * identity the installed framework does not ship.
49
+ */
50
+ export default class ContextAssuranceBasisCommand extends BaseCommand {
51
+ meta = {
52
+ name: 'context assurance-basis',
53
+ description: "Check that the assurance-authority basis generations this application's controls were accepted against are still shipped by the installed framework.",
54
+ category: CommandCategory.Context,
55
+ flags: {
56
+ check: {
57
+ type: 'boolean',
58
+ description: 'Exit non-zero when a declared basis generation is not shipped by the installed framework. Reporting is the default.',
59
+ default: false,
60
+ },
61
+ },
62
+ };
63
+ async run(ctx) {
64
+ let saasRoot;
65
+ try {
66
+ saasRoot = requireSaasRoot(ctx, 'context-assurance-basis');
67
+ }
68
+ catch (error) {
69
+ ctx.log.error(ErrorUtils.extractErrorMessage(error));
70
+ return { success: false };
71
+ }
72
+ const shipped = listFrameworkKnowledgeAssuranceAuthorityBases();
73
+ const shippedIdentities = new Set(shipped.map((entry) => `${entry.ref}@${entry.version}`));
74
+ const specificationsRoot = join(saasRoot, 'specifications');
75
+ let companionExports;
76
+ try {
77
+ companionExports = await loadPackageCompanionExport(specificationsRoot);
78
+ }
79
+ catch (error) {
80
+ /*
81
+ * A specifications package that cannot be loaded is NOT "declares nothing". Reporting it as an
82
+ * absence would turn a wiring failure into a clean verdict, which is exactly the reading
83
+ * `.claude/rules/negative-results-require-a-positive-probe.md` exists to refuse — and here the
84
+ * clean verdict would be "every acceptance resolves", the most reassuring thing this command
85
+ * can say.
86
+ */
87
+ ctx.log.error(`Could not load the specifications package at ${specificationsRoot}: ${ErrorUtils.extractErrorMessage(error)}`);
88
+ return { success: false };
89
+ }
90
+ ctx.log.info(chalk.cyan(`\n Assurance-authority basis acceptance — ${saasRoot}\n`));
91
+ ctx.log.info(`installed framework ships: ${shipped.length === 0 ? 'NOTHING' : [...shippedIdentities].sort().join(', ')}`);
92
+ ctx.log.info('');
93
+ const declared = collectDeclaredBasisIdentities(companionExports.complianceSpecification);
94
+ if (declared.length === 0) {
95
+ /*
96
+ * Not phrased as a gap to close. An application with no compliance specification has not
97
+ * accepted any controls, so there is no acceptance to resolve — and inventing an obligation
98
+ * here would gate applications that have not begun compliance work.
99
+ */
100
+ ctx.log.warn('Accepted basis: NOT DECLARED.');
101
+ ctx.log.info(' This application names no assurance-authority basis, so no control acceptance exists');
102
+ ctx.log.info(' to resolve. That is NOT "the acceptance is broken" — nobody has made one.');
103
+ return { success: true };
104
+ }
105
+ const unshipped = declared.filter((identity) => !shippedIdentities.has(identity));
106
+ for (const identity of declared) {
107
+ if (shippedIdentities.has(identity)) {
108
+ ctx.log.success(` ${identity} — shipped by the installed framework`);
109
+ continue;
110
+ }
111
+ ctx.log.warn(` ${identity} — NOT SHIPPED`);
112
+ ctx.log.info(' Controls were accepted against a compatibility generation the installed framework');
113
+ ctx.log.info(' does not describe, so what those controls MEAN cannot be resolved. Either install');
114
+ ctx.log.info(' the framework release that ships it, or re-accept against a shipped generation —');
115
+ ctx.log.info(' deliberately, because re-accepting is the human decision the pin exists to record.');
116
+ }
117
+ ctx.log.info('');
118
+ if (unshipped.length === 0) {
119
+ ctx.log.success(` All ${declared.length} declared basis generation(s) are shipped by the installed framework.`);
120
+ return { success: true };
121
+ }
122
+ ctx.log.warn(` ${unshipped.length} of ${declared.length} declared basis generation(s) are not shipped.`);
123
+ // `--check` is the only path that turns this report into a refusal — see the class note above.
124
+ return { success: ctx.flags.check !== true };
125
+ }
126
+ }
127
+ /**
128
+ * Every distinct `basisRef@basisVersion` the value names, at any depth.
129
+ *
130
+ * A structural walk rather than a list of known paths, and that is deliberate. The identity is
131
+ * authored on postures, definition authorities and implementation authorities, and a path list would
132
+ * be a second enumeration of a shape the schema already owns — the kind that silently omits the site
133
+ * added next (`.claude/rules/invariant-call-site-enumeration.md`). The pair is distinctive enough to
134
+ * recognise structurally: an object carrying a string `basisRef` beside a numeric `basisVersion`.
135
+ *
136
+ * Sorted and de-duplicated, so the report reads the same on every run and an application that spreads
137
+ * one constant across eleven sites prints one line rather than eleven.
138
+ */
139
+ export function collectDeclaredBasisIdentities(value) {
140
+ const found = new Set();
141
+ const seen = new Set();
142
+ const walk = (node) => {
143
+ if (node === null || typeof node !== 'object')
144
+ return;
145
+ // Guards against a cycle in an authored graph. A specification is plain data today, so this is
146
+ // defence rather than a known case — but an infinite walk inside a CI check is a bad way to
147
+ // discover that assumption changed.
148
+ if (seen.has(node))
149
+ return;
150
+ seen.add(node);
151
+ if (Array.isArray(node)) {
152
+ for (const item of node)
153
+ walk(item);
154
+ return;
155
+ }
156
+ const record = node;
157
+ if (typeof record.basisRef === 'string' && typeof record.basisVersion === 'number') {
158
+ found.add(`${record.basisRef}@${record.basisVersion}`);
159
+ }
160
+ for (const item of Object.values(record))
161
+ walk(item);
162
+ };
163
+ walk(value);
164
+ return [...found].sort();
165
+ }
166
+ //# sourceMappingURL=assurance-basis.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assurance-basis.command.js","sourceRoot":"","sources":["../../../../src/commands/context/assurance-basis.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IA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C,KAAc;IAC3D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,IAAa,EAAQ,EAAE;QACnC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO;QACtD,+FAA+F;QAC/F,4FAA4F;QAC5F,oCAAoC;QACpC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,KAAK,MAAM,IAAI,IAAI,IAAI;gBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QACD,MAAM,MAAM,GAAG,IAA+B,CAAC;QAC/C,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YACnF,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,CAAC;IACZ,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { join } from 'node:path';\n\nimport { loadPackageCompanionExport } from '@wildo-ai/platform-config-lib';\nimport { listFrameworkKnowledgeAssuranceAuthorityBases } from '@wildo-ai/framework-knowledge';\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { requireSaasRoot } from '~wildo-cli/services/registry/registry-command.utils';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\n\n/**\n * Does the authority basis this application accepted its controls against still exist? (#452)\n *\n * ## The gap this closes\n *\n * `wildo fwk generate-docs` ships an assurance-authority basis into every generated application, and\n * until now **nothing read it**. Its two loader accessors were called by the loader itself and by one\n * generation test, so an application received a basis artefact no code consumed — and an application's\n * own `basisRef` / `basisVersion` pins, which are the compatibility generation its controls were\n * accepted against, were checked against nothing at all.\n *\n * That matters because of what the pin PROMISES. Per `.claude/rules/one-source-of-truth.md`, two equal\n * generations promise the same interpretation contract; a change that alters what a control MEANS\n * advances the generation so the application re-accepts deliberately. A pin naming a generation the\n * installed framework no longer ships is therefore not a stale string — it is a control acceptance\n * whose meaning nothing can resolve, on the one surface where \"we accepted this\" has to be auditable.\n *\n * ## EVERY identity, not the first one\n *\n * An application names a basis identity at many sites — each posture, each definition authority, each\n * implementation authority. Wonder Todos spreads one constant across eleven of them, and nothing\n * REQUIRES that: the schema carries `basisRef`/`basisVersion` per site, so a partial re-acceptance\n * legitimately produces a specification holding two generations at once. Checking one site would pass\n * an application whose other ten are stale, so this walks the whole value and reports each distinct\n * identity it finds.\n *\n * ## Offline, for the same reason as `wildo context jurisdictions`\n *\n * The application's specification is loaded through the companion-exports entry with the shared jiti\n * loader, and the shipped basis registry comes from the installed `@wildo-ai/framework-knowledge`\n * package. Neither needs a companion, a stack or a network — which is the whole point: the reason to\n * prefer a command over a page is that a command is reachable from CI, and a command that first\n * requires a running dev companion is not.\n *\n * ## It REPORTS. `--check` is opt-in, and NOT DECLARED is not a failure\n *\n * Same disposition as its jurisdiction sibling, for the same reason. An application that declares no\n * compliance specification has not answered the question rather than answered it badly, and failing\n * there would gate every application on work it may not yet owe. `--check` fails only on a DECLARED\n * identity the installed framework does not ship.\n */\nexport default class ContextAssuranceBasisCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'context assurance-basis',\n description: \"Check that the assurance-authority basis generations this application's controls were accepted against are still shipped by the installed framework.\",\n category: CommandCategory.Context,\n flags: {\n check: {\n type: 'boolean',\n description: 'Exit non-zero when a declared basis generation is not shipped by the installed framework. Reporting is the default.',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n let saasRoot: string;\n try {\n saasRoot = requireSaasRoot(ctx, 'context-assurance-basis');\n } catch (error) {\n ctx.log.error(ErrorUtils.extractErrorMessage(error));\n return { success: false };\n }\n\n const shipped = listFrameworkKnowledgeAssuranceAuthorityBases();\n const shippedIdentities = new Set(shipped.map((entry) => `${entry.ref}@${entry.version}`));\n\n const specificationsRoot = join(saasRoot, 'specifications');\n let companionExports: Record<string, unknown>;\n try {\n companionExports = await loadPackageCompanionExport<Record<string, unknown>>(specificationsRoot);\n } catch (error) {\n /*\n * A specifications package that cannot be loaded is NOT \"declares nothing\". Reporting it as an\n * absence would turn a wiring failure into a clean verdict, which is exactly the reading\n * `.claude/rules/negative-results-require-a-positive-probe.md` exists to refuse — and here the\n * clean verdict would be \"every acceptance resolves\", the most reassuring thing this command\n * can say.\n */\n ctx.log.error(`Could not load the specifications package at ${specificationsRoot}: ${ErrorUtils.extractErrorMessage(error)}`);\n return { success: false };\n }\n\n ctx.log.info(chalk.cyan(`\\n Assurance-authority basis acceptance — ${saasRoot}\\n`));\n ctx.log.info(`installed framework ships: ${shipped.length === 0 ? 'NOTHING' : [...shippedIdentities].sort().join(', ')}`);\n ctx.log.info('');\n\n const declared = collectDeclaredBasisIdentities(companionExports.complianceSpecification);\n if (declared.length === 0) {\n /*\n * Not phrased as a gap to close. An application with no compliance specification has not\n * accepted any controls, so there is no acceptance to resolve — and inventing an obligation\n * here would gate applications that have not begun compliance work.\n */\n ctx.log.warn('Accepted basis: NOT DECLARED.');\n ctx.log.info(' This application names no assurance-authority basis, so no control acceptance exists');\n ctx.log.info(' to resolve. That is NOT \"the acceptance is broken\" — nobody has made one.');\n return { success: true };\n }\n\n const unshipped = declared.filter((identity) => !shippedIdentities.has(identity));\n for (const identity of declared) {\n if (shippedIdentities.has(identity)) {\n ctx.log.success(` ${identity} — shipped by the installed framework`);\n continue;\n }\n ctx.log.warn(` ${identity} — NOT SHIPPED`);\n ctx.log.info(' Controls were accepted against a compatibility generation the installed framework');\n ctx.log.info(' does not describe, so what those controls MEAN cannot be resolved. Either install');\n ctx.log.info(' the framework release that ships it, or re-accept against a shipped generation —');\n ctx.log.info(' deliberately, because re-accepting is the human decision the pin exists to record.');\n }\n\n ctx.log.info('');\n if (unshipped.length === 0) {\n ctx.log.success(` All ${declared.length} declared basis generation(s) are shipped by the installed framework.`);\n return { success: true };\n }\n\n ctx.log.warn(` ${unshipped.length} of ${declared.length} declared basis generation(s) are not shipped.`);\n // `--check` is the only path that turns this report into a refusal — see the class note above.\n return { success: ctx.flags.check !== true };\n }\n}\n\n/**\n * Every distinct `basisRef@basisVersion` the value names, at any depth.\n *\n * A structural walk rather than a list of known paths, and that is deliberate. The identity is\n * authored on postures, definition authorities and implementation authorities, and a path list would\n * be a second enumeration of a shape the schema already owns — the kind that silently omits the site\n * added next (`.claude/rules/invariant-call-site-enumeration.md`). The pair is distinctive enough to\n * recognise structurally: an object carrying a string `basisRef` beside a numeric `basisVersion`.\n *\n * Sorted and de-duplicated, so the report reads the same on every run and an application that spreads\n * one constant across eleven sites prints one line rather than eleven.\n */\nexport function collectDeclaredBasisIdentities(value: unknown): readonly string[] {\n const found = new Set<string>();\n const seen = new Set<object>();\n const walk = (node: unknown): void => {\n if (node === null || typeof node !== 'object') return;\n // Guards against a cycle in an authored graph. A specification is plain data today, so this is\n // defence rather than a known case — but an infinite walk inside a CI check is a bad way to\n // discover that assumption changed.\n if (seen.has(node)) return;\n seen.add(node);\n if (Array.isArray(node)) {\n for (const item of node) walk(item);\n return;\n }\n const record = node as Record<string, unknown>;\n if (typeof record.basisRef === 'string' && typeof record.basisVersion === 'number') {\n found.add(`${record.basisRef}@${record.basisVersion}`);\n }\n for (const item of Object.values(record)) walk(item);\n };\n walk(value);\n return [...found].sort();\n}\n"]}
@@ -4,9 +4,11 @@ import type { CommandMeta, CommandContext, CommandResult } from '../../kernel/ty
4
4
  * `wildo charts audit` — fail-fast drift guard for resource-owned charts.
5
5
  *
6
6
  * A chart authored in a frontend `chartViews[].chartDefinition` but NOT
7
- * registered in the owning backend module's `chartDefinitions` produces a silent
8
- * runtime `chart_not_found` 404 — the host renders but the data fetch fails. This
9
- * command surfaces that drift before it ships. Two channels:
7
+ * registered in the owning backend module's `chartDefinitions` produces a runtime
8
+ * `chart_not_found` 404 — the host renders but the data fetch fails, showing an
9
+ * error card with a retry action. That failure is LOUD but LATE: it is visible only
10
+ * to whoever opens the chart, so a chart on a rarely-visited surface ships broken.
11
+ * This command moves the discovery to authoring time. Two channels:
10
12
  * - FAIL: `unregisteredFrontendCharts` — a chartView with no backend registration
11
13
  * (always a runtime 404). Exits non-zero.
12
14
  * - WARN: `orphanBackendCharts` — a backend chart no frontend view references
@@ -1 +1 @@
1
- {"version":3,"file":"charts-audit.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/charts-audit.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAuB1F;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,WAAW;IAC5D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAaxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAuDvD"}
1
+ {"version":3,"file":"charts-audit.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/charts-audit.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4C1F;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,WAAW;IAC5D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAaxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAyEvD"}
@@ -5,14 +5,27 @@ import { ErrorUtils } from '../../infrastructure/errors/error.utils.js';
5
5
  import { ensureSaasAppScope } from '../../kernel/command-scope-utils.js';
6
6
  import { CompanionClient } from '../../services/companion/companion-client.service.js';
7
7
  import { loadAppLocalRuntimeServiceAddresses } from '../../services/application/app-local-runtime-addresses.service.js';
8
+ /**
9
+ * The one verdict that entitles this command to print "aligned".
10
+ *
11
+ * A string literal rather than an import: the CLI reads a SERIALIZED report off an HTTP response, so
12
+ * this is a wire value being pinned at the boundary that decodes it, not a vocabulary this package
13
+ * owns. Kept in step by `ChartRegistrationAlignmentVerdict.ALIGNED` in `@wildo-ai/saas-models`.
14
+ */
15
+ // semantic-literal-boundary: serialized companion-route verdict, decoded here
16
+ const VERDICT_ALIGNED = 'aligned';
17
+ // semantic-literal-boundary: serialized companion-route verdict, decoded here
18
+ const VERDICT_CANNOT_VOUCH = 'cannot-vouch';
8
19
  const CHARTS_AUDIT_TIMEOUT_MS = 60_000;
9
20
  /**
10
21
  * `wildo charts audit` — fail-fast drift guard for resource-owned charts.
11
22
  *
12
23
  * A chart authored in a frontend `chartViews[].chartDefinition` but NOT
13
- * registered in the owning backend module's `chartDefinitions` produces a silent
14
- * runtime `chart_not_found` 404 — the host renders but the data fetch fails. This
15
- * command surfaces that drift before it ships. Two channels:
24
+ * registered in the owning backend module's `chartDefinitions` produces a runtime
25
+ * `chart_not_found` 404 — the host renders but the data fetch fails, showing an
26
+ * error card with a retry action. That failure is LOUD but LATE: it is visible only
27
+ * to whoever opens the chart, so a chart on a rarely-visited surface ships broken.
28
+ * This command moves the discovery to authoring time. Two channels:
16
29
  * - FAIL: `unregisteredFrontendCharts` — a chartView with no backend registration
17
30
  * (always a runtime 404). Exits non-zero.
18
31
  * - WARN: `orphanBackendCharts` — a backend chart no frontend view references
@@ -22,7 +35,7 @@ export default class DevChartsAuditCommand extends BaseCommand {
22
35
  meta = {
23
36
  name: 'charts audit',
24
37
  description: 'Audit chart-registration alignment: every frontend chartView must have a backend '
25
- + 'registration, else its data fetch 404s (chart_not_found).',
38
+ + 'registration, else its data fetch 404s (chart_not_found) for whoever opens it.',
26
39
  category: CommandCategory.Dev,
27
40
  flags: {
28
41
  strict: {
@@ -58,9 +71,25 @@ export default class DevChartsAuditCommand extends BaseCommand {
58
71
  ctx.log.warn(` • '${ref}'`);
59
72
  }
60
73
  }
61
- const failed = unregisteredFrontendCharts.length > 0 || (strict && orphanBackendCharts.length > 0);
74
+ // A clean FAIL channel is evidence of alignment ONLY if the companion compared against the set
75
+ // the backend actually registers. Printing "aligned" off a comparison that used the module
76
+ // DECLARATIONS is the defect this command shipped with: an application override that dropped a
77
+ // declared chart produced a green line and a 404 for whoever opened the chart.
78
+ const cannotVouch = report.verdict === VERDICT_CANNOT_VOUCH
79
+ || (report.verdict === undefined && report.backendRefsProvenance === undefined);
80
+ const failed = unregisteredFrontendCharts.length > 0
81
+ || (strict && orphanBackendCharts.length > 0)
82
+ || (strict && cannotVouch);
83
+ if (cannotVouch) {
84
+ ctx.log.warn(` ${strict ? 'FAIL (--strict)' : 'WARN'} — cannot vouch for alignment: the companion compared against `
85
+ + `'${report.backendRefsProvenance ?? 'unknown'}', not the set the backend registers. An application `
86
+ + 'supplying `ApplicationInitializationOverrides.chartDefinitions` REPLACES the declared array, so a '
87
+ + 'dropped chart would read as aligned here and 404 at runtime.');
88
+ }
62
89
  if (!failed) {
63
- ctx.log.success(` Chart registration aligned — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan.`);
90
+ ctx.log.success(report.verdict === VERDICT_ALIGNED
91
+ ? ` Chart registration aligned — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan.`
92
+ : ` Chart registration audit completed WITHOUT a vouched verdict — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan. See the warning above.`);
64
93
  }
65
94
  ctx.log.info('');
66
95
  return { success: !failed };
@@ -1 +1 @@
1
- {"version":3,"file":"charts-audit.command.js","sourceRoot":"","sources":["../../../../src/commands/dev/charts-audit.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AACzF,OAAO,EAAE,mCAAmC,EAAE,MAAM,qEAAqE,CAAC;AAkB1H,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,WAAW;IACnD,IAAI,GAAgB;QAC3B,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,mFAAmF;cACjF,2DAA2D;QAC/D,QAAQ,EAAE,eAAe,CAAC,GAAG;QAC7B,KAAK,EAAE;YACL,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,4FAA4F;gBACzG,OAAO,EAAE,KAAK;aACf;SACF;KACF,CAAC;IAEF,KAAK,CAAC,GAAG,CAAC,GAAmB;QAC3B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC;Y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AC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC;gBAClD,GAAG,CAAC,GAAG,CAAC,IAAI,CACV,KAAK,KAAK,MAAM,mBAAmB,CAAC,MAAM,mFAAmF,CAC9H,CAAC;gBACF,KAAK,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;oBACtC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;YAED,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,GAAG,CAAC,GAAG,CAAC,OAAO,CACb,kCAAkC,0BAA0B,CAAC,MAAM,kBAAkB,mBAAmB,CAAC,MAAM,UAAU,CAC1H,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAEjB,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC3F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import chalk from 'chalk';\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { ensureSaasAppScope } from '~wildo-cli/kernel/command-scope-utils';\nimport { CompanionClient } from '~wildo-cli/services/companion/companion-client.service';\nimport { loadAppLocalRuntimeServiceAddresses } from '~wildo-cli/services/application/app-local-runtime-addresses.service';\n\n/**\n * Report shape returned by the companion `POST /api/companion/charts/audit`\n * route (the pure `ChartRegistrationAlignmentReport` from\n * `@wildo-ai/saas-models`, serialized). The CLI only formats + gates on it — the\n * companion does the cross-process composition (frontend chartView refs from the\n * frontend subprocess × backend-registered refs from the merged backend modules).\n */\ninterface ChartRegistrationAuditReport {\n unregisteredFrontendCharts: Array<{\n chartDefinitionRef: string;\n resourceType: string;\n chartViewRef: string;\n }>;\n orphanBackendCharts: string[];\n}\n\nconst CHARTS_AUDIT_TIMEOUT_MS = 60_000;\n\n/**\n * `wildo charts audit` — fail-fast drift guard for resource-owned charts.\n *\n * A chart authored in a frontend `chartViews[].chartDefinition` but NOT\n * registered in the owning backend module's `chartDefinitions` produces a silent\n * runtime `chart_not_found` 404 — the host renders but the data fetch fails. This\n * command surfaces that drift before it ships. Two channels:\n * - FAIL: `unregisteredFrontendCharts` — a chartView with no backend registration\n * (always a runtime 404). Exits non-zero.\n * - WARN: `orphanBackendCharts` — a backend chart no frontend view references\n * (valid for API/programmatic charts). `--strict` escalates it to a failure.\n */\nexport default class DevChartsAuditCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'charts audit',\n description:\n 'Audit chart-registration alignment: every frontend chartView must have a backend '\n + 'registration, else its data fetch 404s (chart_not_found).',\n category: CommandCategory.Dev,\n flags: {\n strict: {\n type: 'boolean',\n description: 'Escalate orphan-backend-chart warnings (backend charts with no frontend view) to failures.',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n if (!ensureSaasAppScope(ctx)) {\n return { success: false };\n }\n\n try {\n ctx.log.info(chalk.cyan('\\n Auditing chart registration via dev companion...\\n'));\n\n const saasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n const serviceAddresses = saasRoot ? await loadAppLocalRuntimeServiceAddresses(saasRoot) : undefined;\n const devCompanion = serviceAddresses?.devCompanion;\n\n const report = await CompanionClient.post<ChartRegistrationAuditReport>(\n '/api/companion/charts/audit',\n {},\n { appRoot: saasRoot, baseUrl: devCompanion?.url, port: devCompanion?.port, timeoutMs: CHARTS_AUDIT_TIMEOUT_MS },\n );\n\n const strict = ctx.flags.strict === true;\n const { unregisteredFrontendCharts, orphanBackendCharts } = report;\n\n if (unregisteredFrontendCharts.length > 0) {\n ctx.log.error(\n ` FAIL — ${unregisteredFrontendCharts.length} chart view(s) reference a chart NOT registered backend-side (each 404s at runtime):`,\n );\n for (const chart of unregisteredFrontendCharts) {\n ctx.log.error(` • ${chart.resourceType}.${chart.chartViewRef} → chartDefinition.ref '${chart.chartDefinitionRef}'`);\n }\n ctx.log.info(\" Fix: add the shared ChartDefinition to the owning backend module's `chartDefinitions`.\");\n }\n\n if (orphanBackendCharts.length > 0) {\n const label = strict ? 'FAIL (--strict)' : 'WARN';\n ctx.log.warn(\n ` ${label} — ${orphanBackendCharts.length} backend chart(s) with no frontend chartView (valid for API/programmatic charts):`,\n );\n for (const ref of orphanBackendCharts) {\n ctx.log.warn(` • '${ref}'`);\n }\n }\n\n const failed = unregisteredFrontendCharts.length > 0 || (strict && orphanBackendCharts.length > 0);\n if (!failed) {\n ctx.log.success(\n ` Chart registration aligned — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan.`,\n );\n }\n ctx.log.info('');\n\n return { success: !failed };\n } catch (error) {\n ctx.log.error(`Chart registration audit failed: ${ErrorUtils.extractErrorMessage(error)}`);\n return { success: false };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"charts-audit.command.js","sourceRoot":"","sources":["../../../../src/commands/dev/charts-audit.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EA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AAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,qBAAqB,KAAK,SAAS,CAAC,CAAC;YAClF,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,GAAG,CAAC;mBAC/C,CAAC,MAAM,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;mBAC1C,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC;YAC7B,IAAI,WAAW,EAAE,CAAC;gBAChB,GAAG,CAAC,GAAG,CAAC,IAAI,CACV,KAAK,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,gEAAgE;sBACtG,IAAI,MAAM,CAAC,qBAAqB,IAAI,SAAS,uDAAuD;sBACpG,oGAAoG;sBACpG,8DAA8D,CACjE,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,GAAG,CAAC,GAAG,CAAC,OAAO,CACb,MAAM,CAAC,OAAO,KAAK,eAAe;oBAChC,CAAC,CAAC,kCAAkC,0BAA0B,CAAC,MAAM,kBAAkB,mBAAmB,CAAC,MAAM,UAAU;oBAC3H,CAAC,CAAC,oEAAoE,0BAA0B,CAAC,MAAM,kBAAkB,mBAAmB,CAAC,MAAM,iCAAiC,CACvL,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAEjB,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC3F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import chalk from 'chalk';\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { ensureSaasAppScope } from '~wildo-cli/kernel/command-scope-utils';\nimport { CompanionClient } from '~wildo-cli/services/companion/companion-client.service';\nimport { loadAppLocalRuntimeServiceAddresses } from '~wildo-cli/services/application/app-local-runtime-addresses.service';\n\n/**\n * Report shape returned by the companion `POST /api/companion/charts/audit`\n * route (the pure `ChartRegistrationAlignmentReport` from\n * `@wildo-ai/saas-models`, serialized). The CLI only formats + gates on it — the\n * companion does the cross-process composition (frontend chartView refs from the\n * frontend subprocess × backend-registered refs from the merged backend modules).\n */\ninterface ChartRegistrationAuditReport {\n /**\n * WHICH backend set the companion compared against — the serialized\n * `ChartRegistrationBackendRefsProvenance`. Only `'effective-initialization-config'` is the set\n * the backend registers; `'module-declarations'` is what the modules DECLARE, which an\n * application's `ApplicationInitializationOverrides.chartDefinitions` REPLACES rather than merges.\n */\n backendRefsProvenance?: string;\n /** Serialized `ChartRegistrationAlignmentVerdict` — `'aligned' | 'misaligned' | 'cannot-vouch'`. */\n verdict?: string;\n unregisteredFrontendCharts: Array<{\n chartDefinitionRef: string;\n resourceType: string;\n chartViewRef: string;\n }>;\n orphanBackendCharts: string[];\n}\n\n/**\n * The one verdict that entitles this command to print \"aligned\".\n *\n * A string literal rather than an import: the CLI reads a SERIALIZED report off an HTTP response, so\n * this is a wire value being pinned at the boundary that decodes it, not a vocabulary this package\n * owns. Kept in step by `ChartRegistrationAlignmentVerdict.ALIGNED` in `@wildo-ai/saas-models`.\n */\n// semantic-literal-boundary: serialized companion-route verdict, decoded here\nconst VERDICT_ALIGNED = 'aligned';\n// semantic-literal-boundary: serialized companion-route verdict, decoded here\nconst VERDICT_CANNOT_VOUCH = 'cannot-vouch';\n\nconst CHARTS_AUDIT_TIMEOUT_MS = 60_000;\n\n/**\n * `wildo charts audit` — fail-fast drift guard for resource-owned charts.\n *\n * A chart authored in a frontend `chartViews[].chartDefinition` but NOT\n * registered in the owning backend module's `chartDefinitions` produces a runtime\n * `chart_not_found` 404 — the host renders but the data fetch fails, showing an\n * error card with a retry action. That failure is LOUD but LATE: it is visible only\n * to whoever opens the chart, so a chart on a rarely-visited surface ships broken.\n * This command moves the discovery to authoring time. Two channels:\n * - FAIL: `unregisteredFrontendCharts` — a chartView with no backend registration\n * (always a runtime 404). Exits non-zero.\n * - WARN: `orphanBackendCharts` — a backend chart no frontend view references\n * (valid for API/programmatic charts). `--strict` escalates it to a failure.\n */\nexport default class DevChartsAuditCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'charts audit',\n description:\n 'Audit chart-registration alignment: every frontend chartView must have a backend '\n + 'registration, else its data fetch 404s (chart_not_found) for whoever opens it.',\n category: CommandCategory.Dev,\n flags: {\n strict: {\n type: 'boolean',\n description: 'Escalate orphan-backend-chart warnings (backend charts with no frontend view) to failures.',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n if (!ensureSaasAppScope(ctx)) {\n return { success: false };\n }\n\n try {\n ctx.log.info(chalk.cyan('\\n Auditing chart registration via dev companion...\\n'));\n\n const saasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n const serviceAddresses = saasRoot ? await loadAppLocalRuntimeServiceAddresses(saasRoot) : undefined;\n const devCompanion = serviceAddresses?.devCompanion;\n\n const report = await CompanionClient.post<ChartRegistrationAuditReport>(\n '/api/companion/charts/audit',\n {},\n { appRoot: saasRoot, baseUrl: devCompanion?.url, port: devCompanion?.port, timeoutMs: CHARTS_AUDIT_TIMEOUT_MS },\n );\n\n const strict = ctx.flags.strict === true;\n const { unregisteredFrontendCharts, orphanBackendCharts } = report;\n\n if (unregisteredFrontendCharts.length > 0) {\n ctx.log.error(\n ` FAIL — ${unregisteredFrontendCharts.length} chart view(s) reference a chart NOT registered backend-side (each 404s at runtime):`,\n );\n for (const chart of unregisteredFrontendCharts) {\n ctx.log.error(` • ${chart.resourceType}.${chart.chartViewRef} → chartDefinition.ref '${chart.chartDefinitionRef}'`);\n }\n ctx.log.info(\" Fix: add the shared ChartDefinition to the owning backend module's `chartDefinitions`.\");\n }\n\n if (orphanBackendCharts.length > 0) {\n const label = strict ? 'FAIL (--strict)' : 'WARN';\n ctx.log.warn(\n ` ${label} — ${orphanBackendCharts.length} backend chart(s) with no frontend chartView (valid for API/programmatic charts):`,\n );\n for (const ref of orphanBackendCharts) {\n ctx.log.warn(` • '${ref}'`);\n }\n }\n\n // A clean FAIL channel is evidence of alignment ONLY if the companion compared against the set\n // the backend actually registers. Printing \"aligned\" off a comparison that used the module\n // DECLARATIONS is the defect this command shipped with: an application override that dropped a\n // declared chart produced a green line and a 404 for whoever opened the chart.\n const cannotVouch = report.verdict === VERDICT_CANNOT_VOUCH\n || (report.verdict === undefined && report.backendRefsProvenance === undefined);\n const failed = unregisteredFrontendCharts.length > 0\n || (strict && orphanBackendCharts.length > 0)\n || (strict && cannotVouch);\n if (cannotVouch) {\n ctx.log.warn(\n ` ${strict ? 'FAIL (--strict)' : 'WARN'} — cannot vouch for alignment: the companion compared against `\n + `'${report.backendRefsProvenance ?? 'unknown'}', not the set the backend registers. An application `\n + 'supplying `ApplicationInitializationOverrides.chartDefinitions` REPLACES the declared array, so a '\n + 'dropped chart would read as aligned here and 404 at runtime.',\n );\n }\n if (!failed) {\n ctx.log.success(\n report.verdict === VERDICT_ALIGNED\n ? ` Chart registration aligned — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan.`\n : ` Chart registration audit completed WITHOUT a vouched verdict — ${unregisteredFrontendCharts.length} unregistered, ${orphanBackendCharts.length} orphan. See the warning above.`,\n );\n }\n ctx.log.info('');\n\n return { success: !failed };\n } catch (error) {\n ctx.log.error(`Chart registration audit failed: ${ErrorUtils.extractErrorMessage(error)}`);\n return { success: false };\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-providers.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/fwk/generate-providers.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AA4F1G;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,WAAW;IAClE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAKxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAgNvD"}
1
+ {"version":3,"file":"generate-providers.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/fwk/generate-providers.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AA4F1G;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,WAAW;IAClE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAKxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAiOvD"}
@@ -192,6 +192,14 @@ export default class FwkGenerateProvidersCommand extends BaseCommand {
192
192
  const pend = provider.operations.filter((o) => o.resolution === TransposedOperationResolution.PENDING_ENDPOINT).length;
193
193
  const unreadable = (unreadableByVendor.get(provider.ref) ?? []).length;
194
194
  withheld.push({ ref: provider.ref, pending: pend, unreadable });
195
+ // A vendor somebody DECIDED to withhold is not news. This warning exists to surface an entry
196
+ // that produced nothing UNEXPECTEDLY — a vendor whose extraction broke, which somebody might
197
+ // fix — and a deliberate `scrape: false` is the opposite of that. Reporting both made the line
198
+ // fire 214 times a run, and a warning that fires 214 times is read by nobody, which cost the
199
+ // real findings their audience. The withheld entries stay in the inventory, where the question
200
+ // they answer is "what did we decide" rather than "what went wrong".
201
+ if (readDecisions(providersRoot, provider.ref)?.scrape === false)
202
+ continue;
195
203
  ctx.log.warn(`${provider.ref}: no executable operation (${pend} pending, ${unreadable} unreadable) — no subpath exported.`);
196
204
  }
197
205
  // ONE package with a subpath per vendor (Paul, 2026-09-06). The emitter replaces the whole
@@ -245,12 +253,20 @@ export default class FwkGenerateProvidersCommand extends BaseCommand {
245
253
  ref: provider.ref,
246
254
  classification: decisions?.classification ?? CatalogueEntryClassification.THIRD_PARTY_VENDOR,
247
255
  sources: [...new Set(provider.operations.map((operation) => operation.provenance.source))].sort(),
248
- exported: decisions?.scrape !== false && lost === undefined,
256
+ // Asked, never re-derived. `vendorIsExported` has three clauses — nothing executable,
257
+ // withheld by decision, and a ref the ENGINE already owns — and reconstructing it here
258
+ // missed the third, reporting 707 exports against 682 actually emitted. The emitter now
259
+ // reports the set it built the package from.
260
+ exported: emitResult.exportedOperationCounts.has(provider.ref),
249
261
  withheld: decisions?.scrape === false,
250
262
  // Judged, not merely decided: a `scrape: false` file is a decision about SHIPPING, and
251
263
  // reading it as an admissibility judgement would report the withheld entries as done.
252
264
  admissibilityJudged: (decisions?.admissibleConnections?.length ?? 0) > 0,
253
- operations: provider.operations.filter((o) => o.resolution === TransposedOperationResolution.RESOLVED).length,
265
+ // The count the emitter shipped, falling back to the planned count for an entry it did
266
+ // not export — a withheld vendor still has operations, and reporting zero would read as
267
+ // "nothing to ship" rather than "we chose not to".
268
+ operations: emitResult.exportedOperationCounts.get(provider.ref)
269
+ ?? provider.operations.filter((o) => o.resolution === TransposedOperationResolution.RESOLVED).length,
254
270
  pending: lost?.pending ?? provider.operations.filter((o) => o.resolution === TransposedOperationResolution.PENDING_ENDPOINT).length,
255
271
  unreadable: lost?.unreadable ?? (unreadableByVendor.get(provider.ref) ?? []).length,
256
272
  refusedAtEmit: Object.fromEntries(emitResult.refusedByVendor.get(provider.ref) ?? new Map()),