@mnstry/atelier 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +383 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +262 -0
- package/SECURITY.md +93 -0
- package/TRADEMARKS.md +88 -0
- package/announcements/2026-08-06-announcements-channel.v1.json +12 -0
- package/announcements/keys/mnstry-announcements.public.v1.json +9 -0
- package/bin/atelier.mjs +2 -0
- package/bin/mnstry-atelier.mjs +3 -0
- package/contracts/analysis-adapter.v1.schema.json +248 -0
- package/contracts/atelier-action-intent.v1.schema.json +143 -0
- package/contracts/atelier-analysis-adapter.v1.schema.json +360 -0
- package/contracts/atelier-attestation.v1.schema.json +239 -0
- package/contracts/atelier-boundary-policy.v1.schema.json +339 -0
- package/contracts/atelier-claim.v1.schema.json +97 -0
- package/contracts/atelier-export.v1.schema.json +1015 -0
- package/contracts/atelier-extension-pack.v1.schema.json +290 -0
- package/contracts/atelier-kit-manifest.v1.schema.json +273 -0
- package/contracts/atelier-lock.v1.schema.json +364 -0
- package/contracts/atelier-migration.v1.schema.json +162 -0
- package/contracts/atelier-project-config.v1.schema.json +352 -0
- package/contracts/atelier-readiness-protocol.v1.schema.json +517 -0
- package/contracts/atelier-readiness-run.v1.schema.json +229 -0
- package/contracts/atelier-readiness.v1.schema.json +457 -0
- package/contracts/compat-baseline.json +10 -0
- package/contracts/git-promote-event.v1.schema.json +145 -0
- package/contracts/knowledge-source-sidecar.v1.schema.json +157 -0
- package/contracts/mnstry-atelier-semantic-profile.v1.json +254 -0
- package/docs/announcements.md +101 -0
- package/docs/atelier-runtime.md +34 -0
- package/docs/attestation.md +201 -0
- package/docs/continuity.md +55 -0
- package/docs/contract-stability.md +111 -0
- package/docs/distributions.md +220 -0
- package/docs/install.md +140 -0
- package/docs/knowledge-graph.md +140 -0
- package/docs/ontology.md +206 -0
- package/docs/release-engineering.md +151 -0
- package/docs/repo-boundary-guard.md +199 -0
- package/docs/tenant-readiness.md +64 -0
- package/docs/upgrade.md +124 -0
- package/fixtures/analysis/invalid/native-graph.v1.json +4 -0
- package/fixtures/analysis/invalid/promoted-claim.v1.json +17 -0
- package/fixtures/analysis/invalid/runtime-import.v1.json +20 -0
- package/fixtures/analysis/valid/output.claims.v1.json +17 -0
- package/fixtures/analysis-adapter/invalid/manifest-hidden-provider.v1.json +24 -0
- package/fixtures/analysis-adapter/invalid/output-frontmatter-mutation.v1.json +21 -0
- package/fixtures/analysis-adapter/invalid/output-native-graph.v1.json +14 -0
- package/fixtures/analysis-adapter/manifest.disabled.v1.json +22 -0
- package/fixtures/analysis-adapter/manifest.enabled-local.v1.json +23 -0
- package/fixtures/analysis-adapter/output.claims.v1.json +21 -0
- package/fixtures/atelier-action-intent/invalid/runtime-mutation-authority.v1.json +16 -0
- package/fixtures/atelier-action-intent/invalid/unknown-top-level-field.v1.json +17 -0
- package/fixtures/atelier-action-intent/invalid/writes-beyond-clipboard.v1.json +16 -0
- package/fixtures/atelier-action-intent/valid/copy-agent-prompt.v1.json +16 -0
- package/fixtures/atelier-action-intent/valid/copy-repo-path.v1.json +22 -0
- package/fixtures/atelier-analysis-adapter/invalid/hidden-model-provider.v1.json +24 -0
- package/fixtures/atelier-analysis-adapter/invalid/inert-with-execute-command.v1.json +24 -0
- package/fixtures/atelier-analysis-adapter/invalid/proposals-with-runtime-import.v1.json +30 -0
- package/fixtures/atelier-analysis-adapter/valid/manifest-inert.v1.json +24 -0
- package/fixtures/atelier-analysis-adapter/valid/proposals-claim-only.v1.json +27 -0
- package/fixtures/atelier-attestation/invalid/bad-digest.v1.json +23 -0
- package/fixtures/atelier-attestation/invalid/conformance-scope.v1.json +23 -0
- package/fixtures/atelier-attestation/invalid/missing-signature.v1.json +22 -0
- package/fixtures/atelier-attestation/invalid/unknown-root-field.v1.json +24 -0
- package/fixtures/atelier-attestation/keys/roundtrip-issuer.public.v1.json +9 -0
- package/fixtures/atelier-attestation/valid/rejected-with-reasons.v1.json +49 -0
- package/fixtures/atelier-attestation/valid/signed-admitted.v1.json +35 -0
- package/fixtures/atelier-attestation/valid/signed-roundtrip.v1.json +29 -0
- package/fixtures/atelier-attestation/valid/unsigned-advisory.v1.json +23 -0
- package/fixtures/atelier-claim/invalid/unknown-provider.v1.json +15 -0
- package/fixtures/atelier-claim/invalid/unknown-top-level-field.v1.json +16 -0
- package/fixtures/atelier-claim/invalid/wrong-schema-const.v1.json +15 -0
- package/fixtures/atelier-claim/valid/adapter-style-proposed-relation.v1.json +19 -0
- package/fixtures/atelier-claim/valid/codex-proposed-relation.v1.json +16 -0
- package/fixtures/atelier-claim/valid/manual-proposed-relation.v1.json +16 -0
- package/fixtures/atelier-claim/valid/readiness-proposed-relation.v1.json +18 -0
- package/fixtures/atelier-export/invalid/dirty-unforced-empty-taint.v1.json +19 -0
- package/fixtures/atelier-export/invalid/object-local-audience-visibility.v1.json +11 -0
- package/fixtures/atelier-export/invalid/open-object-class-owner.v1.json +23 -0
- package/fixtures/atelier-export/invalid/pricing-legacy-amount.v1.json +23 -0
- package/fixtures/atelier-export/invalid/public-disguised-internal-source-ref.v1.json +11 -0
- package/fixtures/atelier-export/invalid/public-nested-private-source-ref.v1.json +17 -0
- package/fixtures/atelier-export/invalid/public-resolved-private-source-ref.v1.json +13 -0
- package/fixtures/atelier-export/invalid/public-resolved-sensitive-source-ref.v1.json +13 -0
- package/fixtures/atelier-export/invalid/public-source-ref-missing-provenance.v1.json +20 -0
- package/fixtures/atelier-export/invalid/public-source-team-kg.json +12 -0
- package/fixtures/atelier-export/invalid/source-node-legacy-visibility.v1.json +21 -0
- package/fixtures/atelier-export/invalid/source-node-unknown-field.v1.json +18 -0
- package/fixtures/atelier-export/invalid/unresolved-public-source-ref.v1.json +11 -0
- package/fixtures/atelier-export/sample-studio-offer.v1.json +397 -0
- package/fixtures/atelier-extension-pack/invalid/bundled-slug-collision.v1.json +22 -0
- package/fixtures/atelier-extension-pack/invalid/escapes-root.v1.json +22 -0
- package/fixtures/atelier-extension-pack/invalid/posture-tampered.v1.json +22 -0
- package/fixtures/atelier-extension-pack/invalid/protocols/autonomous-authority.v1.json +118 -0
- package/fixtures/atelier-extension-pack/invalid/protocols/offer-map.v1.json +109 -0
- package/fixtures/atelier-extension-pack/invalid/redefines-runtime-term.v1.json +19 -0
- package/fixtures/atelier-extension-pack/invalid/wrong-namespace.v1.json +19 -0
- package/fixtures/atelier-extension-pack/valid/protocols/contract-gate.v1.json +109 -0
- package/fixtures/atelier-extension-pack/valid/sample-pack.v1.json +48 -0
- package/fixtures/atelier-kit-manifest/invalid/runtime-copy-without-canonical-role.v1.json +53 -0
- package/fixtures/atelier-kit-manifest/invalid/telemetry-send-path.v1.json +21 -0
- package/fixtures/atelier-kit-manifest/valid/mnstry-atelier.valid.v1.json +76 -0
- package/fixtures/atelier-lock/invalid/absolute-contract-path.v1.json +40 -0
- package/fixtures/atelier-lock/invalid/runtime-mutation-enabled.v1.json +41 -0
- package/fixtures/atelier-lock/invalid/unknown-top-level-field.v1.json +42 -0
- package/fixtures/atelier-lock/valid/extension-pack.v1.json +55 -0
- package/fixtures/atelier-lock/valid/minimal.v1.json +44 -0
- package/fixtures/atelier-migration/invalid/live-apply-mode.v1.json +21 -0
- package/fixtures/atelier-migration/invalid/missing-review-evidence.v1.json +20 -0
- package/fixtures/atelier-migration/invalid/runtime-mutation-enabled.v1.json +21 -0
- package/fixtures/atelier-migration/valid/minimal.v1.json +32 -0
- package/fixtures/atelier-project-config/invalid/absolute-repo-path.v1.json +11 -0
- package/fixtures/atelier-project-config/invalid/ext-not-object.v1.json +12 -0
- package/fixtures/atelier-project-config/invalid/external-kind-read-boundary.v1.json +12 -0
- package/fixtures/atelier-project-config/invalid/missing-repos-and-alignment.v1.json +7 -0
- package/fixtures/atelier-project-config/invalid/unknown-top-level-field.v1.json +14 -0
- package/fixtures/atelier-project-config/valid/alignment-scaffold.v1.json +15 -0
- package/fixtures/atelier-project-config/valid/ext-extension-packs.v1.json +36 -0
- package/fixtures/atelier-project-config/valid/repo-workspace.v1.json +23 -0
- package/fixtures/atelier-project-config/validator-only/ext-member-not-object.v1.json +14 -0
- package/fixtures/atelier-readiness/invalid/dry-run-only-false.v1.json +87 -0
- package/fixtures/atelier-readiness/invalid/support-bundle-send-path.v1.json +87 -0
- package/fixtures/atelier-readiness/invalid/unknown-top-level-field.v1.json +88 -0
- package/fixtures/atelier-readiness/valid/ready-workspace.v1.json +84 -0
- package/fixtures/boundary-policy/invalid/content-rule-exception-blanket-path.v1.json +67 -0
- package/fixtures/boundary-policy/invalid/invalid-actor-private-repo-mapping.v1.json +20 -0
- package/fixtures/boundary-policy/invalid/legacy-warning-missing-warning.v1.json +20 -0
- package/fixtures/boundary-policy/invalid/missing-repo-coverage.v1.json +19 -0
- package/fixtures/boundary-policy/invalid/unknown-key.v1.json +12 -0
- package/fixtures/boundary-policy/valid/content-rule-exception.v1.json +67 -0
- package/fixtures/boundary-policy/valid/legacy-warning.v1.json +33 -0
- package/fixtures/boundary-policy/valid/strict-private-shared.v1.json +40 -0
- package/fixtures/git-promote/invalid/provision-named-revocable.v1.json +29 -0
- package/fixtures/git-promote/private-to-team.v1.json +29 -0
- package/fixtures/knowledge-source-sidecar/invalid/legacy-visibility-field.v1.json +17 -0
- package/fixtures/knowledge-source-sidecar/invalid/missing-audience.v1.json +15 -0
- package/fixtures/knowledge-source-sidecar/invalid/unknown-relation-kind.v1.json +18 -0
- package/fixtures/knowledge-source-sidecar/valid/html-source.v1.json +18 -0
- package/fixtures/knowledge-source-sidecar/valid/pdf-evidence.v1.json +18 -0
- package/fixtures/projects/neutral-project/atelier.project.json +15 -0
- package/fixtures/projects/neutral-project/ops/config/repo-access.v1.json +12 -0
- package/fixtures/projects/neutral-project/project-knowledge.graph.json +69 -0
- package/fixtures/projects/sample-workspace/atelier.project.json +23 -0
- package/fixtures/projects/sample-workspace/boundary-policy.v1.json +59 -0
- package/fixtures/projects/sample-workspace/content/README.md +16 -0
- package/fixtures/projects/sample-workspace/content/source.html +5 -0
- package/fixtures/projects/sample-workspace/content/source.html.kg.json +15 -0
- package/fixtures/projects/sample-workspace/repo-access.v1.json +9 -0
- package/fixtures/projects/source-formats-workspace/atelier.project.json +23 -0
- package/fixtures/projects/source-formats-workspace/content/README.md +17 -0
- package/fixtures/projects/source-formats-workspace/content/data.json +7 -0
- package/fixtures/projects/source-formats-workspace/content/data.json.kg.json +15 -0
- package/fixtures/projects/source-formats-workspace/content/logo.png.kg.json +15 -0
- package/fixtures/projects/source-formats-workspace/content/metrics.csv +3 -0
- package/fixtures/projects/source-formats-workspace/content/metrics.csv.kg.json +15 -0
- package/fixtures/projects/source-formats-workspace/content/pipeline.yaml +4 -0
- package/fixtures/projects/source-formats-workspace/content/pipeline.yaml.kg.json +15 -0
- package/fixtures/projects/source-formats-workspace/repo-access.v1.json +9 -0
- package/fixtures/readiness-protocols/extension-pack/invalid/protocol-missing-path.v1.json +20 -0
- package/fixtures/readiness-protocols/extension-pack/valid/with-protocol.v1.json +24 -0
- package/fixtures/readiness-protocols/protocol/invalid/missing-check-target.v1.json +103 -0
- package/fixtures/readiness-protocols/protocol/invalid/runtime-mutation-enabled.v1.json +107 -0
- package/fixtures/readiness-protocols/protocol/valid/minimal.v1.json +100 -0
- package/fixtures/readiness-protocols/run/invalid/missing-evidence.v1.json +37 -0
- package/fixtures/readiness-protocols/run/invalid/pass-with-blocker.v1.json +22 -0
- package/fixtures/readiness-protocols/run/invalid/runtime-mutation-enabled.v1.json +22 -0
- package/fixtures/readiness-protocols/run/valid/pass.v1.json +44 -0
- package/fixtures/support/invalid/leaky-support.v1.json +13 -0
- package/fixtures/support/valid/minimal-safe.v1.json +20 -0
- package/package.json +98 -0
- package/skills/claude/atelier-open/SKILL.md +68 -0
- package/skills/claude/mnstry-readiness/SKILL.md +41 -0
- package/skills/codex/atelier-open/SKILL.md +68 -0
- package/skills/codex/mnstry-readiness/SKILL.md +41 -0
- package/src/analysis/adapter.mjs +20 -0
- package/src/analysis/analysis-claim-contract.mjs +335 -0
- package/src/attestation/jcs.mjs +64 -0
- package/src/attestation/sign.mjs +305 -0
- package/src/boundary/content-rules.mjs +262 -0
- package/src/boundary/policy.mjs +806 -0
- package/src/check-atelier-export-contract.mjs +116 -0
- package/src/cli/run.mjs +283 -0
- package/src/collaboration/proposals.mjs +262 -0
- package/src/commands/analysis.mjs +8 -0
- package/src/commands/announcements.mjs +308 -0
- package/src/commands/attestation.mjs +198 -0
- package/src/commands/boundary.mjs +25 -0
- package/src/commands/config.mjs +4 -0
- package/src/commands/context.mjs +3 -0
- package/src/commands/distribution.mjs +224 -0
- package/src/commands/egress.mjs +11 -0
- package/src/commands/extension-pack.mjs +209 -0
- package/src/commands/feedback.mjs +3 -0
- package/src/commands/graph.mjs +3 -0
- package/src/commands/init.mjs +130 -0
- package/src/commands/lock.mjs +3 -0
- package/src/commands/project.mjs +3 -0
- package/src/commands/promote.mjs +4 -0
- package/src/commands/readiness.mjs +3 -0
- package/src/commands/server.mjs +6 -0
- package/src/commands/setup.mjs +250 -0
- package/src/commands/support.mjs +3 -0
- package/src/commands/upgrade.mjs +3 -0
- package/src/contracts/corpus.mjs +171 -0
- package/src/egress/check.mjs +45 -0
- package/src/egress/forbidden-egress.mjs +323 -0
- package/src/export/atelier-export-contract.mjs +722 -0
- package/src/extension-packs/loader.mjs +491 -0
- package/src/graph/graph.mjs +370 -0
- package/src/graph/knowledge-graph.mjs +887 -0
- package/src/harness/context-client.mjs +144 -0
- package/src/harness/context.mjs +27 -0
- package/src/index.mjs +88 -0
- package/src/project/config.mjs +557 -0
- package/src/project/file-class.mjs +113 -0
- package/src/project/git-ignore.mjs +31 -0
- package/src/project/path-match.mjs +30 -0
- package/src/project/repo-identity.mjs +176 -0
- package/src/projection/alignment-projection.mjs +169 -0
- package/src/projection/policy.mjs +90 -0
- package/src/projection/project.mjs +152 -0
- package/src/readiness/readiness.mjs +312 -0
- package/src/readiness-protocols/bundled-pack.mjs +766 -0
- package/src/readiness-protocols/runtime.mjs +419 -0
- package/src/server/local-sidecar.mjs +640 -0
- package/src/server/security.mjs +229 -0
- package/src/server/server.mjs +42 -0
- package/src/support/feedback-report.mjs +414 -0
- package/src/support/support-bundle.mjs +226 -0
- package/src/ui/html-primitives.mjs +104 -0
- package/src/upgrade/upgrade.mjs +701 -0
- package/src/validate-atelier-export-dry-run.mjs +75 -0
- package/templates/atelier.project.example.json +23 -0
- package/templates/distribution-workspace/.claude/launch.json +12 -0
- package/templates/distribution-workspace/README.md +86 -0
- package/templates/distribution-workspace/atelier.project.json +36 -0
- package/templates/distribution-workspace/boundary-policy.v1.json +61 -0
- package/templates/distribution-workspace/gitignore +29 -0
- package/templates/distribution-workspace/governance/repo-boundary-ledger.md +5 -0
- package/templates/distribution-workspace/project/README.md +19 -0
- package/templates/distribution-workspace/repo-access.v1.json +9 -0
- package/templates/launch.json +12 -0
- package/templates/private-domain-workspace/.claude/launch.json +12 -0
- package/templates/private-domain-workspace/README.md +50 -0
- package/templates/private-domain-workspace/atelier.project.json +28 -0
- package/templates/private-domain-workspace/boundary-policy.v1.json +54 -0
- package/templates/private-domain-workspace/domain/README.md +19 -0
- package/templates/private-domain-workspace/gitignore +29 -0
- package/templates/private-domain-workspace/governance/repo-boundary-ledger.md +4 -0
- package/templates/private-domain-workspace/repo-access.v1.json +9 -0
- package/templates/shared-project-workspace/.claude/launch.json +12 -0
- package/templates/shared-project-workspace/README.md +51 -0
- package/templates/shared-project-workspace/atelier.project.json +28 -0
- package/templates/shared-project-workspace/boundary-policy.v1.json +61 -0
- package/templates/shared-project-workspace/gitignore +29 -0
- package/templates/shared-project-workspace/governance/repo-boundary-ledger.md +5 -0
- package/templates/shared-project-workspace/project/README.md +19 -0
- package/templates/shared-project-workspace/repo-access.v1.json +9 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { bundledReadinessProtocols } from '../readiness-protocols/bundled-pack.mjs'
|
|
4
|
+
import { createProtocolRegistry, loadExtensionPacks } from '../extension-packs/loader.mjs'
|
|
5
|
+
import {
|
|
6
|
+
buildReadinessExportDryRun,
|
|
7
|
+
buildTenantPacket,
|
|
8
|
+
runProtocol,
|
|
9
|
+
summarizeReadinessJourney,
|
|
10
|
+
writeTenantPacket,
|
|
11
|
+
} from '../readiness-protocols/runtime.mjs'
|
|
12
|
+
import { PROJECT_CONFIG_ENV, commandProject, parseArgs, projectConfigArg, readJson, writeJson } from '../project/config.mjs'
|
|
13
|
+
|
|
14
|
+
export const ATELIER_READINESS_SCHEMA = 'mnstry.atelier-readiness@v1'
|
|
15
|
+
|
|
16
|
+
export function summarizeGraph(graph, { path: graphPath = null, expectedSchema = 'mnstry.knowledge-graph@v1' } = {}) {
|
|
17
|
+
const diagnostics = Array.isArray(graph?.diagnostics) ? graph.diagnostics : []
|
|
18
|
+
return {
|
|
19
|
+
ok: graph?.schema === expectedSchema,
|
|
20
|
+
path: graphPath,
|
|
21
|
+
schema: graph?.schema ?? null,
|
|
22
|
+
nodes: graph?.nodeCount ?? graph?.counts?.nodes ?? graph?.nodes?.length ?? 0,
|
|
23
|
+
edges: graph?.edgeCount ?? graph?.counts?.edges ?? graph?.edges?.length ?? 0,
|
|
24
|
+
diagnostics: diagnostics.length || graph?.counts?.diagnostics || 0,
|
|
25
|
+
privateRepoRecommended: diagnostics.filter((item) => item.type === 'private-repo-recommended').length,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function summarizeProjection(projection, { path: projectionPath = null, expectedSchema = 'mnstry.alignment-projection@v1' } = {}) {
|
|
30
|
+
return {
|
|
31
|
+
ok: projection?.schema === expectedSchema,
|
|
32
|
+
path: projectionPath,
|
|
33
|
+
schema: projection?.schema ?? null,
|
|
34
|
+
generatedAt: projection?.generatedAt ?? null,
|
|
35
|
+
graphNodes: projection?.summary?.graphNodes ?? 0,
|
|
36
|
+
graphEdges: projection?.summary?.graphEdges ?? 0,
|
|
37
|
+
alignmentNodes: projection?.summary?.alignmentNodes ?? 0,
|
|
38
|
+
alignmentEdges: projection?.summary?.alignmentEdges ?? 0,
|
|
39
|
+
gaps: projection?.summary?.gaps ?? 0,
|
|
40
|
+
diagnostics: projection?.summary?.diagnostics ?? 0,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function buildPackageReadiness({
|
|
45
|
+
generatedAt = new Date().toISOString(),
|
|
46
|
+
workspace = {},
|
|
47
|
+
graph,
|
|
48
|
+
graphPath = null,
|
|
49
|
+
projection,
|
|
50
|
+
projectionPath = null,
|
|
51
|
+
contracts = [],
|
|
52
|
+
kitManifest = null,
|
|
53
|
+
runtimeDryRun = { ok: false },
|
|
54
|
+
supportBundle = {
|
|
55
|
+
states: ['none', 'support_bundle'],
|
|
56
|
+
sendPath: false,
|
|
57
|
+
background: false,
|
|
58
|
+
telemetry: 'none',
|
|
59
|
+
hashableDryRun: true,
|
|
60
|
+
},
|
|
61
|
+
analysis = {
|
|
62
|
+
ok: true,
|
|
63
|
+
enabled: false,
|
|
64
|
+
defaultEnabled: false,
|
|
65
|
+
manifestPath: null,
|
|
66
|
+
manifestPresent: false,
|
|
67
|
+
authority: 'optional-local-claim-only',
|
|
68
|
+
},
|
|
69
|
+
checks = [],
|
|
70
|
+
acceptedBoundary = 'extractable-kit',
|
|
71
|
+
} = {}) {
|
|
72
|
+
const graphSummary = summarizeGraph(graph, { path: graphPath })
|
|
73
|
+
const projectionSummary = summarizeProjection(projection, { path: projectionPath })
|
|
74
|
+
const normalizedContracts = contracts.map((contract) => ({
|
|
75
|
+
path: contract.path,
|
|
76
|
+
present: Boolean(contract.present),
|
|
77
|
+
}))
|
|
78
|
+
const normalizedKitManifest = {
|
|
79
|
+
ok: kitManifest?.ok === true,
|
|
80
|
+
path: kitManifest?.path ?? null,
|
|
81
|
+
schema: kitManifest?.schema ?? null,
|
|
82
|
+
kernel: kitManifest?.kernel ?? null,
|
|
83
|
+
sourceDialect: kitManifest?.sourceDialect ?? null,
|
|
84
|
+
exportContract: kitManifest?.exportContract ?? null,
|
|
85
|
+
extensionPacks: Array.isArray(kitManifest?.extensionPacks) ? kitManifest.extensionPacks.length : kitManifest?.extensionPacks ?? 0,
|
|
86
|
+
telemetry: kitManifest?.telemetry ?? null,
|
|
87
|
+
}
|
|
88
|
+
const blockers = []
|
|
89
|
+
const warnings = []
|
|
90
|
+
|
|
91
|
+
if (!graphSummary.ok) blockers.push('knowledge-graph-missing-or-invalid')
|
|
92
|
+
if (!projectionSummary.ok) blockers.push('alignment-projection-missing-or-invalid')
|
|
93
|
+
if (!runtimeDryRun?.ok) blockers.push('runtime-dry-run-missing')
|
|
94
|
+
if (!normalizedKitManifest.ok) blockers.push('kit-manifest-missing-or-invalid')
|
|
95
|
+
for (const contract of normalizedContracts) {
|
|
96
|
+
if (!contract.present) blockers.push(`missing-contract:${contract.path}`)
|
|
97
|
+
}
|
|
98
|
+
for (const check of checks) {
|
|
99
|
+
if (!check.ok) blockers.push(`live-check-failed:${check.label}`)
|
|
100
|
+
}
|
|
101
|
+
if (graphSummary.privateRepoRecommended > 0) warnings.push('private-or-sensitive-nodes-in-team-readable-repos')
|
|
102
|
+
if (!analysis?.enabled) warnings.push('analysis-adapter-disabled-by-default')
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
schema: ATELIER_READINESS_SCHEMA,
|
|
106
|
+
generatedAt,
|
|
107
|
+
workspace: {
|
|
108
|
+
root: workspace.root ?? null,
|
|
109
|
+
repoOpsHead: workspace.repoOpsHead ?? null,
|
|
110
|
+
},
|
|
111
|
+
acceptedBoundary,
|
|
112
|
+
ready: blockers.length === 0,
|
|
113
|
+
blockers,
|
|
114
|
+
warnings,
|
|
115
|
+
graph: graphSummary,
|
|
116
|
+
alignment: projectionSummary,
|
|
117
|
+
contracts: normalizedContracts,
|
|
118
|
+
kitManifest: normalizedKitManifest,
|
|
119
|
+
runtimeDryRun,
|
|
120
|
+
supportBundle,
|
|
121
|
+
analysis,
|
|
122
|
+
checks,
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function buildProjectReadiness({ project, graph = null } = {}) {
|
|
127
|
+
const loadedGraph = graph || (fs.existsSync(project.graphPath) ? readJson(project.graphPath) : null)
|
|
128
|
+
const projectionEntry = path.join(project.outputRoot, 'index.html')
|
|
129
|
+
const manifest = path.join(project.outputRoot, 'atelier.manifest.json')
|
|
130
|
+
const blockers = []
|
|
131
|
+
const warnings = []
|
|
132
|
+
if (!loadedGraph || loadedGraph.schema !== 'mnstry.atelier-knowledge-graph@v1') blockers.push('knowledge-graph-missing-or-invalid')
|
|
133
|
+
if (!fs.existsSync(projectionEntry)) blockers.push('project-projection-missing')
|
|
134
|
+
if (!fs.existsSync(manifest)) blockers.push('project-manifest-missing')
|
|
135
|
+
if (Array.isArray(loadedGraph?.errors) && loadedGraph.errors.length) blockers.push('knowledge-graph-errors-present')
|
|
136
|
+
if (Array.isArray(loadedGraph?.diagnostics) && loadedGraph.diagnostics.length) warnings.push('graph-diagnostics-present')
|
|
137
|
+
return {
|
|
138
|
+
schema: ATELIER_READINESS_SCHEMA,
|
|
139
|
+
generatedAt: 'deterministic',
|
|
140
|
+
project: project.config.name || path.basename(project.workspaceRoot),
|
|
141
|
+
ready: blockers.length === 0,
|
|
142
|
+
blockers,
|
|
143
|
+
warnings,
|
|
144
|
+
graph: {
|
|
145
|
+
path: project.graphPath,
|
|
146
|
+
nodes: loadedGraph?.counts?.nodes ?? loadedGraph?.nodes?.length ?? 0,
|
|
147
|
+
edges: loadedGraph?.counts?.edges ?? loadedGraph?.edges?.length ?? 0,
|
|
148
|
+
diagnostics: loadedGraph?.counts?.diagnostics ?? loadedGraph?.diagnostics?.length ?? 0,
|
|
149
|
+
},
|
|
150
|
+
projection: {
|
|
151
|
+
outputRoot: project.outputRoot,
|
|
152
|
+
entry: projectionEntry,
|
|
153
|
+
},
|
|
154
|
+
support: {
|
|
155
|
+
telemetry: 'none',
|
|
156
|
+
sendPath: false,
|
|
157
|
+
background: false,
|
|
158
|
+
},
|
|
159
|
+
analysis: {
|
|
160
|
+
enabled: false,
|
|
161
|
+
authority: 'claim-only',
|
|
162
|
+
},
|
|
163
|
+
tenantReadiness: summarizeReadinessJourney(project),
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function buildReadiness(options = {}) {
|
|
168
|
+
if (options.project) return buildProjectReadiness(options)
|
|
169
|
+
return buildPackageReadiness(options)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function stableReadinessForCheck(value) {
|
|
173
|
+
return {
|
|
174
|
+
...value,
|
|
175
|
+
generatedAt: null,
|
|
176
|
+
workspace: {
|
|
177
|
+
...value.workspace,
|
|
178
|
+
repoOpsHead: null,
|
|
179
|
+
},
|
|
180
|
+
runtimeDryRun: value.runtimeDryRun
|
|
181
|
+
? {
|
|
182
|
+
...value.runtimeDryRun,
|
|
183
|
+
root: null,
|
|
184
|
+
rootSource: null,
|
|
185
|
+
}
|
|
186
|
+
: value.runtimeDryRun,
|
|
187
|
+
checks: Array.isArray(value.checks)
|
|
188
|
+
? value.checks.map((check) => check?.label === 'runtime dry-run consumer passes'
|
|
189
|
+
? { ...check, cwd: null }
|
|
190
|
+
: check)
|
|
191
|
+
: value.checks,
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Loads declared extension packs (fail closed: any pack error throws before a
|
|
196
|
+
// protocol becomes resolvable) and composes the explicit registry. Projects
|
|
197
|
+
// with no declared packs get a bundled-only registry.
|
|
198
|
+
function projectRegistry(project) {
|
|
199
|
+
const { packs } = loadExtensionPacks(project)
|
|
200
|
+
return createProtocolRegistry({ packs })
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function runReadinessCommand(argv = process.argv.slice(2)) {
|
|
204
|
+
const parsed = parseArgs(argv)
|
|
205
|
+
const subcommand = parsed._[0]
|
|
206
|
+
if (subcommand === 'protocols') {
|
|
207
|
+
const detail = parsed.json === true || parsed.format === 'json'
|
|
208
|
+
// Bundled-only by default; an explicit --project PATH / --project-config=PATH
|
|
209
|
+
// argument OR the MNSTRY_ATELIER_PROJECT_CONFIG env var loads that
|
|
210
|
+
// project's extension packs and lists their protocols with a source
|
|
211
|
+
// marker. A bare invocation with neither never auto-detects the cwd.
|
|
212
|
+
const envConfig = process.env[PROJECT_CONFIG_ENV]
|
|
213
|
+
const projectAware = projectConfigArg(argv) !== null
|
|
214
|
+
|| (typeof envConfig === 'string' && envConfig.trim() !== '')
|
|
215
|
+
const entries = bundledReadinessProtocols.map((protocol) => ({ protocol, source: null }))
|
|
216
|
+
if (projectAware) {
|
|
217
|
+
const project = commandProject({ argv })
|
|
218
|
+
const registry = projectRegistry(project)
|
|
219
|
+
for (const pack of registry.packs) {
|
|
220
|
+
for (const record of pack.protocols ?? []) {
|
|
221
|
+
entries.push({ protocol: record.protocol, source: pack.id })
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (detail) {
|
|
226
|
+
console.log(`${JSON.stringify({
|
|
227
|
+
schema: 'mnstry.readiness-protocol-list@v1',
|
|
228
|
+
protocols: entries.map(({ protocol, source }) => (source ? { ...protocol, source } : protocol)),
|
|
229
|
+
}, null, 2)}\n`)
|
|
230
|
+
} else {
|
|
231
|
+
console.log('MNSTRY readiness protocols')
|
|
232
|
+
for (const { protocol, source } of entries) {
|
|
233
|
+
console.log(`- ${protocol.id}: ${protocol.title}${source ? ` (source: ${source})` : ''}`)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (subcommand === 'journey') {
|
|
240
|
+
const project = commandProject({ argv })
|
|
241
|
+
const journey = summarizeReadinessJourney(project, { registry: projectRegistry(project) })
|
|
242
|
+
console.log(`${JSON.stringify(journey, null, 2)}\n`)
|
|
243
|
+
return
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (subcommand === 'run') {
|
|
247
|
+
const project = commandProject({ argv })
|
|
248
|
+
const protocolId = parsed._[1]
|
|
249
|
+
if (!protocolId) throw new Error('readiness run requires a protocol id')
|
|
250
|
+
const answers = parsed.answers ? readJson(path.resolve(process.cwd(), parsed.answers)) : {}
|
|
251
|
+
const result = runProtocol(project, protocolId, {
|
|
252
|
+
answers,
|
|
253
|
+
write: parsed.write !== false,
|
|
254
|
+
createProposal: parsed.proposal !== false && parsed['no-proposal'] !== true,
|
|
255
|
+
registry: projectRegistry(project),
|
|
256
|
+
})
|
|
257
|
+
console.log(`${JSON.stringify({
|
|
258
|
+
ok: result.run.blockers.length === 0,
|
|
259
|
+
protocolId: result.run.protocolId,
|
|
260
|
+
runId: result.run.runId,
|
|
261
|
+
status: result.run.status,
|
|
262
|
+
score: result.run.score,
|
|
263
|
+
blockers: result.run.blockers,
|
|
264
|
+
warnings: result.run.warnings,
|
|
265
|
+
claims: result.run.claims.map((claim) => claim.claimId),
|
|
266
|
+
runPath: result.file,
|
|
267
|
+
proposal: result.proposal?.record?.proposal?.id ?? null,
|
|
268
|
+
}, null, 2)}\n`)
|
|
269
|
+
if (result.run.blockers.length) process.exitCode = 1
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (subcommand === 'packet') {
|
|
274
|
+
const project = commandProject({ argv })
|
|
275
|
+
const packet = buildTenantPacket(project, { registry: projectRegistry(project) })
|
|
276
|
+
const file = writeTenantPacket(project, packet)
|
|
277
|
+
console.log(`${JSON.stringify({
|
|
278
|
+
ok: true,
|
|
279
|
+
path: file,
|
|
280
|
+
packet,
|
|
281
|
+
}, null, 2)}\n`)
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (subcommand === 'export') {
|
|
286
|
+
if (!argv.includes('--dry-run')) throw new Error('readiness export only supports --dry-run')
|
|
287
|
+
const project = commandProject({ argv })
|
|
288
|
+
const report = buildReadinessExportDryRun(project, { registry: projectRegistry(project) })
|
|
289
|
+
console.log(`${JSON.stringify(report, null, 2)}\n`)
|
|
290
|
+
if (!report.accepted) process.exitCode = 1
|
|
291
|
+
return
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const check = argv.includes('--check')
|
|
295
|
+
const project = commandProject({ argv })
|
|
296
|
+
const readiness = buildReadiness({ project })
|
|
297
|
+
const next = `${JSON.stringify(readiness, null, 2)}\n`
|
|
298
|
+
if (check) {
|
|
299
|
+
const current = fs.existsSync(project.readinessPath) ? fs.readFileSync(project.readinessPath, 'utf8') : null
|
|
300
|
+
if (current !== next) {
|
|
301
|
+
console.error(`readiness is stale: ${project.readinessPath}`)
|
|
302
|
+
process.exit(1)
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
writeJson(project.readinessPath, readiness)
|
|
306
|
+
}
|
|
307
|
+
if (!readiness.ready) {
|
|
308
|
+
console.error(readiness.blockers.join('\n'))
|
|
309
|
+
process.exit(1)
|
|
310
|
+
}
|
|
311
|
+
console.log(`readiness: ready · ${readiness.blockers.length} blockers · ${readiness.warnings.length} warnings`)
|
|
312
|
+
}
|