@geraldmaron/construct 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -19
- package/bin/construct +311 -81
- package/bin/construct-postinstall.mjs +30 -2
- package/examples/distribution/README.md +42 -0
- package/examples/distribution/manifest.json +53 -0
- package/examples/distribution/sources/adr.md +84 -0
- package/examples/distribution/sources/deck-one-pager.md +65 -0
- package/examples/distribution/sources/prd-platform.md +161 -0
- package/examples/distribution/sources/research-brief.md +80 -0
- package/examples/distribution/sources/rfc-platform.md +82 -0
- package/examples/distribution/sources/runbook.md +103 -0
- package/examples/distribution/sources/strategy.md +88 -0
- package/lib/adapters-sync.mjs +67 -0
- package/lib/artifact-gate-notice.mjs +38 -0
- package/lib/artifact-manifest.mjs +112 -0
- package/lib/artifact-release-gate.mjs +171 -0
- package/lib/artifact-reviewers.mjs +68 -0
- package/lib/artifact-type-from-path.mjs +79 -0
- package/lib/audit-skills.mjs +4 -0
- package/lib/audit-specialists.mjs +285 -0
- package/lib/audit-trail.mjs +1 -1
- package/lib/auto-docs.mjs +87 -18
- package/lib/beads/drift.mjs +27 -6
- package/lib/beads-client.mjs +49 -121
- package/lib/beads-optimistic.mjs +5 -12
- package/lib/brand-fonts.mjs +93 -0
- package/lib/brand-prose.mjs +214 -0
- package/lib/brand-tokens.mjs +92 -0
- package/lib/bridges/copilot-proxy.mjs +13 -26
- package/lib/capability-ledger.mjs +156 -0
- package/lib/certification/artifact-fixtures.mjs +132 -0
- package/lib/certification/artifact-gates.mjs +63 -0
- package/lib/certification/artifact-provenance.mjs +97 -0
- package/lib/certification/canonical-scenarios.mjs +78 -0
- package/lib/certification/cli.mjs +191 -0
- package/lib/certification/dashboard-api.mjs +71 -0
- package/lib/certification/demo-parity.mjs +116 -0
- package/lib/certification/document-io-fixtures.mjs +246 -0
- package/lib/certification/document-workflow.mjs +97 -0
- package/lib/certification/eval-bridge.mjs +77 -0
- package/lib/certification/model-routing.mjs +149 -0
- package/lib/certification/prompt-budget.mjs +119 -0
- package/lib/certification/rc-gate.mjs +206 -0
- package/lib/certification/real-llm-scenarios.mjs +303 -0
- package/lib/certification/role-cards.mjs +113 -0
- package/lib/certification/role-overlays.mjs +117 -0
- package/lib/certification/run.mjs +122 -0
- package/lib/certification/runner.mjs +323 -0
- package/lib/certification/scenarios.mjs +51 -0
- package/lib/certification/skill-inventory.mjs +289 -0
- package/lib/certification/skill-scenarios.mjs +147 -0
- package/lib/certification/specialist-contracts.mjs +85 -0
- package/lib/certification/specialist-scenarios.mjs +175 -0
- package/lib/certification/stale-impact.mjs +146 -0
- package/lib/certification/status.mjs +252 -0
- package/lib/certification/store.mjs +77 -0
- package/lib/chat/cli.mjs +333 -0
- package/lib/chat/command-suggest.mjs +161 -0
- package/lib/chat/commands.mjs +215 -0
- package/lib/chat/config.mjs +142 -0
- package/lib/chat/context-compactor.mjs +250 -0
- package/lib/chat/context-continuation.mjs +253 -0
- package/lib/chat/continuation-source.mjs +58 -0
- package/lib/chat/demo-guide.mjs +61 -0
- package/lib/chat/design-tokens.mjs +91 -0
- package/lib/chat/desktop-binary.mjs +79 -0
- package/lib/chat/desktop-build.mjs +130 -0
- package/lib/chat/desktop-launcher.mjs +133 -0
- package/lib/chat/evidence.mjs +145 -0
- package/lib/chat/export.mjs +74 -0
- package/lib/chat/harness/driver.mjs +91 -0
- package/lib/chat/list-picker.mjs +112 -0
- package/lib/chat/model-picker.mjs +356 -0
- package/lib/chat/openrouter-fallback.mjs +151 -0
- package/lib/chat/permission-prompt.mjs +33 -0
- package/lib/chat/picker-catalog.mjs +45 -0
- package/lib/chat/policy-telemetry.mjs +34 -0
- package/lib/chat/present.mjs +245 -0
- package/lib/chat/session-context.mjs +39 -0
- package/lib/chat/session-persist.mjs +73 -0
- package/lib/chat/session-restore.mjs +71 -0
- package/lib/chat/session-settings.mjs +53 -0
- package/lib/chat/system-prompt.mjs +52 -0
- package/lib/chat/transparency.mjs +93 -0
- package/lib/chat/tui/color-scheme.mjs +42 -0
- package/lib/chat/tui/markdown.mjs +123 -0
- package/lib/chat/tui/presentation.mjs +100 -0
- package/lib/chat/tui/render.mjs +500 -0
- package/lib/chat/tui/turn-block.mjs +284 -0
- package/lib/chat/tui/turn-present.mjs +18 -0
- package/lib/chat/tui/turn-state.mjs +88 -0
- package/lib/chat/tui/usage.mjs +122 -0
- package/lib/chat/web-commands.mjs +146 -0
- package/lib/chat/web-launcher.mjs +63 -0
- package/lib/chat/web-picker-keys.mjs +46 -0
- package/lib/chat/web-session.mjs +159 -0
- package/lib/cli-commands.mjs +129 -15
- package/lib/comment-lint.mjs +6 -4
- package/lib/config/schema.mjs +36 -5
- package/lib/contract-schemas/decision.json +50 -0
- package/lib/contract-schemas/implementation.json +51 -0
- package/lib/contract-schemas/review-report.json +32 -0
- package/lib/contract-schemas/test-report.json +43 -0
- package/lib/contracts/construct-handoff.mjs +60 -0
- package/lib/contracts/validate.mjs +32 -3
- package/lib/contracts/violation-log.mjs +58 -5
- package/lib/dashboard-demo.mjs +71 -0
- package/lib/dashboard-static.mjs +19 -5
- package/lib/decisions/registry.mjs +5 -3
- package/lib/deck-export-pptx.mjs +1152 -0
- package/lib/demo-recording.mjs +142 -0
- package/lib/demo-script.mjs +114 -0
- package/lib/demo-surface.mjs +249 -0
- package/lib/demo.mjs +598 -140
- package/lib/diagram-export.mjs +192 -0
- package/lib/diagram.mjs +13 -11
- package/lib/docs-verify.mjs +25 -7
- package/lib/doctor/index.mjs +3 -1
- package/lib/doctor/project-adapters.mjs +44 -0
- package/lib/doctor/watchers/cx-budget.mjs +98 -0
- package/lib/doctor/watchers/graph-staleness.mjs +52 -0
- package/lib/doctor/watchers/process-pressure.mjs +4 -3
- package/lib/document-export.mjs +360 -36
- package/lib/document-extract.mjs +44 -4
- package/lib/document-ingest.mjs +29 -20
- package/lib/embed/cli.mjs +2 -2
- package/lib/embed/daemon.mjs +18 -46
- package/lib/embed/worker.mjs +2 -2
- package/lib/embedded-contract/model-resolve.mjs +10 -9
- package/lib/env-config.mjs +26 -0
- package/lib/evals/dataset.mjs +137 -0
- package/lib/evals/gates.mjs +175 -0
- package/lib/graph/build-co-change.mjs +54 -0
- package/lib/graph/build-from-registry.mjs +136 -0
- package/lib/graph/build-import-graph.mjs +153 -0
- package/lib/graph/cli.mjs +110 -0
- package/lib/graph/impact-cli.mjs +89 -0
- package/lib/graph/impact.mjs +108 -0
- package/lib/graph/staleness.mjs +44 -0
- package/lib/graph/store.mjs +172 -0
- package/lib/health-check.mjs +90 -76
- package/lib/hooks/artifact-release-gate.mjs +43 -0
- package/lib/hooks/brand-prose-lint.mjs +38 -0
- package/lib/hooks/graph-impact-advisory.mjs +62 -0
- package/lib/hooks/session-optimize.mjs +84 -207
- package/lib/hooks/session-start.mjs +4 -5
- package/lib/host-disposition.mjs +7 -0
- package/lib/improvement/cli.mjs +189 -0
- package/lib/improvement/controller.mjs +137 -0
- package/lib/improvement/proposal.mjs +120 -0
- package/lib/improvement/specialist-loop.mjs +192 -0
- package/lib/improvement/store.mjs +89 -0
- package/lib/improvement/surface.mjs +219 -0
- package/lib/ingest-tooling.mjs +97 -0
- package/lib/init/doc-lanes.mjs +165 -0
- package/lib/init-docs.mjs +31 -178
- package/lib/init-unified.mjs +27 -97
- package/lib/init-update-guide.mjs +102 -0
- package/lib/init-update.mjs +32 -1
- package/lib/init.mjs +8 -0
- package/lib/install/desktop-binary-download.mjs +85 -0
- package/lib/install/legacy-global-cleanup.mjs +189 -0
- package/lib/intake/daemon.mjs +2 -0
- package/lib/intake/git-queue.mjs +9 -8
- package/lib/intake/queue.mjs +2 -1
- package/lib/intake/session-prelude.mjs +90 -1
- package/lib/libreoffice-export.mjs +97 -0
- package/lib/logging/rotate.mjs +9 -0
- package/lib/maintenance/docker-reclaim.mjs +206 -0
- package/lib/mcp/external-schema-cost.mjs +74 -0
- package/lib/mcp/server.mjs +84 -9
- package/lib/mcp/stdio-mcp-probe.mjs +188 -0
- package/lib/mcp/tool-budget.mjs +55 -4
- package/lib/mcp/tools/document.mjs +18 -4
- package/lib/mcp/tools/skills.mjs +32 -3
- package/lib/mcp/tools/workflow.mjs +13 -1
- package/lib/model-free-selector.mjs +18 -0
- package/lib/model-registry.mjs +13 -229
- package/lib/model-router.mjs +373 -92
- package/lib/models/behavior-matrix.mjs +289 -0
- package/lib/models/catalog.mjs +209 -0
- package/lib/models/execution-capability-profile.mjs +196 -0
- package/lib/models/execution-policy.mjs +307 -0
- package/lib/models/provider-poll.mjs +383 -0
- package/lib/npm-spawn-env.mjs +17 -0
- package/lib/ollama/installed-models.mjs +129 -0
- package/lib/oracle/actions.mjs +187 -0
- package/lib/oracle/artifact-gate.mjs +99 -0
- package/lib/oracle/cli.mjs +204 -0
- package/lib/oracle/daemon-entry.mjs +14 -0
- package/lib/oracle/dispatch.mjs +81 -0
- package/lib/oracle/execute.mjs +143 -0
- package/lib/oracle/gaps.mjs +76 -0
- package/lib/oracle/index.mjs +84 -0
- package/lib/oracle/issues.mjs +164 -0
- package/lib/oracle/org-graph.mjs +170 -0
- package/lib/oracle/policy.mjs +80 -0
- package/lib/oracle/read-model.mjs +398 -0
- package/lib/oracle/reconcile.mjs +191 -0
- package/lib/oracle/routing.mjs +89 -0
- package/lib/oracle/synthesize.mjs +384 -0
- package/lib/oracle/verdicts.mjs +51 -0
- package/lib/orchestration/worker.mjs +88 -27
- package/lib/orchestration-policy.mjs +50 -0
- package/lib/parity.mjs +96 -2
- package/lib/playwright-demo.mjs +252 -0
- package/lib/project-init-shared.mjs +4 -1
- package/lib/prompt-composer.js +7 -3
- package/lib/prompt-validation-contract.mjs +24 -0
- package/lib/provider-capabilities.js +57 -11
- package/lib/providers/contract/adapters/confluence/index.mjs +181 -0
- package/lib/providers/contract/adapters/git/index.mjs +115 -0
- package/lib/providers/contract/adapters/github/index.mjs +166 -0
- package/lib/providers/contract/adapters/jira/index.mjs +187 -0
- package/lib/providers/contract/adapters/slack/index.mjs +175 -0
- package/lib/providers/contract/contract-tests.mjs +57 -0
- package/lib/providers/contract/errors.mjs +48 -0
- package/lib/providers/contract/interface.mjs +50 -0
- package/lib/providers/contract/registry.mjs +102 -0
- package/lib/providers/copilot-auth.mjs +297 -0
- package/lib/providers/credential-bootstrap.mjs +178 -0
- package/lib/providers/credential-catalog.mjs +46 -0
- package/lib/providers/credential-sources.mjs +63 -0
- package/lib/providers/creds.mjs +5 -2
- package/lib/providers/op-run.mjs +59 -0
- package/lib/providers/secret-resolver.mjs +159 -0
- package/lib/publish-template.mjs +163 -0
- package/lib/publish-tooling.mjs +119 -0
- package/lib/publish.mjs +305 -0
- package/lib/registry/cli.mjs +82 -0
- package/lib/registry/consolidation.mjs +147 -0
- package/lib/registry/generate-docs.mjs +75 -0
- package/lib/registry/skill-verification.mjs +57 -0
- package/lib/registry/surface-map.mjs +76 -0
- package/lib/registry/validate.mjs +135 -0
- package/lib/resources/budget.mjs +82 -0
- package/lib/resources/process-budget.mjs +45 -0
- package/lib/rules-delivery.mjs +9 -2
- package/lib/rules-read.mjs +26 -0
- package/lib/runtime-env.mjs +23 -0
- package/lib/runtime-pressure.mjs +51 -7
- package/lib/schema-infer.mjs +13 -2
- package/lib/server/chat-loop.mjs +622 -0
- package/lib/server/demo-preview.mjs +63 -0
- package/lib/server/index.mjs +228 -7
- package/lib/service-manager.mjs +60 -8
- package/lib/setup.mjs +70 -7
- package/lib/specialists/prompt-schema.mjs +19 -10
- package/lib/specialists/roster.mjs +43 -0
- package/lib/specialists/scaffold.mjs +56 -0
- package/lib/storage/backend.mjs +6 -6
- package/lib/storage/hybrid-query.mjs +7 -4
- package/lib/storage/state-source.mjs +5 -5
- package/lib/storage/sync.mjs +2 -3
- package/lib/telemetry/rule-calls.mjs +52 -0
- package/lib/template-registry.mjs +2 -2
- package/lib/templates/visual-requirements.mjs +27 -51
- package/lib/test-corpus-inventory.mjs +313 -0
- package/lib/uninstall/uninstall.mjs +19 -7
- package/lib/update.mjs +12 -0
- package/lib/upgrade.mjs +14 -0
- package/lib/wireframe.mjs +20 -14
- package/lib/worker/run.mjs +17 -4
- package/lib/worker/trace.mjs +11 -3
- package/package.json +28 -14
- package/personas/construct.md +2 -2
- package/platforms/claude/settings.template.json +36 -0
- package/rules/common/patterns.md +1 -1
- package/rules/common/release-gates.md +4 -3
- package/scripts/sync-specialists.mjs +41 -28
- package/skills/devops/data-engineering.md +1 -1
- package/skills/docs/adr-workflow.md +1 -0
- package/skills/docs/backlog-proposal-workflow.md +1 -0
- package/skills/docs/codebase-research-workflow.md +40 -0
- package/skills/docs/customer-profile-workflow.md +1 -0
- package/skills/docs/document-ingest-workflow.md +1 -0
- package/skills/docs/evidence-ingest-workflow.md +1 -0
- package/skills/docs/init-docs.md +2 -2
- package/skills/docs/init-project.md +7 -2
- package/skills/docs/prd-workflow.md +24 -1
- package/skills/docs/prfaq-workflow.md +1 -0
- package/skills/docs/product-intelligence-workflow.md +1 -0
- package/skills/docs/product-signal-workflow.md +1 -0
- package/skills/docs/research-workflow.md +54 -37
- package/skills/docs/runbook-workflow.md +1 -0
- package/skills/docs/strategy-workflow.md +1 -0
- package/skills/docs/user-research-workflow.md +40 -0
- package/skills/operating/orchestration-reference.md +1 -1
- package/skills/roles/architect.md +5 -0
- package/skills/roles/operator.docs.md +4 -0
- package/skills/routing.md +4 -2
- package/specialists/artifact-manifest.json +480 -0
- package/specialists/artifact-manifest.schema.json +53 -0
- package/specialists/audit-enrichments.json +454 -0
- package/specialists/contracts.json +37 -25
- package/specialists/prompts/_shared/validation-contract.md +26 -0
- package/specialists/prompts/cx-accessibility.md +21 -2
- package/specialists/prompts/cx-ai-engineer.md +24 -1
- package/specialists/prompts/cx-architect.md +4 -1
- package/specialists/prompts/cx-business-strategist.md +23 -2
- package/specialists/prompts/cx-data-analyst.md +22 -1
- package/specialists/prompts/cx-data-engineer.md +23 -2
- package/specialists/prompts/cx-debugger.md +21 -2
- package/specialists/prompts/cx-designer.md +26 -3
- package/specialists/prompts/cx-devil-advocate.md +19 -2
- package/specialists/prompts/cx-docs-keeper.md +28 -1
- package/specialists/prompts/cx-engineer.md +22 -1
- package/specialists/prompts/cx-evaluator.md +18 -1
- package/specialists/prompts/cx-explorer.md +21 -2
- package/specialists/prompts/cx-legal-compliance.md +21 -2
- package/specialists/prompts/cx-operations.md +21 -2
- package/specialists/prompts/cx-oracle.md +94 -0
- package/specialists/prompts/cx-orchestrator.md +20 -1
- package/specialists/prompts/cx-platform-engineer.md +25 -2
- package/specialists/prompts/cx-product-manager.md +32 -1
- package/specialists/prompts/cx-qa.md +24 -2
- package/specialists/prompts/cx-rd-lead.md +23 -2
- package/specialists/prompts/cx-release-manager.md +23 -2
- package/specialists/prompts/cx-researcher.md +22 -2
- package/specialists/prompts/cx-reviewer.md +18 -1
- package/specialists/prompts/cx-security.md +22 -2
- package/specialists/prompts/cx-sre.md +30 -3
- package/specialists/prompts/cx-test-automation.md +7 -1
- package/specialists/prompts/cx-trace-reviewer.md +22 -3
- package/specialists/prompts/cx-ux-researcher.md +21 -2
- package/specialists/registry.json +52 -173
- package/specialists/tone-profiles.json +42 -0
- package/templates/demos/playwright/demo-recording.config.mjs +47 -0
- package/templates/demos/recordings/agentic-platforms-prd.json +19 -0
- package/templates/demos/scripts/agentic-platforms-prd.json +44 -0
- package/templates/demos/specs/_helpers/scroll-artifact.ts +89 -0
- package/templates/demos/tapes/agentic-platforms-prd.tape +49 -0
- package/templates/demos/tapes/resource-guard-rails.tape +49 -0
- package/templates/demos/vhs/construct-cockpit.json +24 -0
- package/templates/distribution/construct-brand.typ +446 -0
- package/templates/distribution/construct-decision.typ +38 -0
- package/templates/distribution/construct-deck.html +95 -0
- package/templates/distribution/construct-pdf.typ +38 -0
- package/templates/distribution/construct-prd.typ +38 -0
- package/templates/distribution/construct-research.typ +38 -0
- package/templates/distribution/construct-web.html +92 -0
- package/templates/distribution/fonts/Geist-Bold.ttf +0 -0
- package/templates/distribution/fonts/Geist-Medium.ttf +0 -0
- package/templates/distribution/fonts/Geist-Regular.ttf +0 -0
- package/templates/distribution/fonts/Geist-SemiBold.ttf +0 -0
- package/templates/distribution/fonts/GeistMono-Medium.ttf +0 -0
- package/templates/distribution/fonts/GeistMono-Regular.ttf +0 -0
- package/templates/distribution/fonts/GeistMono-SemiBold.ttf +0 -0
- package/templates/distribution/fonts/IBMPlexMono-Regular.otf +0 -0
- package/templates/distribution/fonts/JetBrainsMono-Medium.ttf +0 -0
- package/templates/distribution/fonts/JetBrainsMono-Regular.ttf +0 -0
- package/templates/distribution/fonts/JetBrainsMono-SemiBold.ttf +0 -0
- package/templates/distribution/fonts/PlusJakartaSans-Bold.ttf +0 -0
- package/templates/distribution/fonts/PlusJakartaSans-Medium.ttf +0 -0
- package/templates/distribution/fonts/PlusJakartaSans-Regular.ttf +0 -0
- package/templates/distribution/fonts/PlusJakartaSans-SemiBold.ttf +0 -0
- package/templates/distribution/fonts/README.md +36 -0
- package/templates/distribution/fonts/SpaceGrotesk-Variable.ttf +0 -0
- package/templates/distribution/fonts/handwritten/Caveat.ttf +0 -0
- package/templates/distribution/fonts/legacy/IBMPlexMono-Regular.otf +0 -0
- package/templates/distribution/fonts/legacy/Inter-Medium.otf +0 -0
- package/templates/distribution/fonts/legacy/Inter-Regular.otf +0 -0
- package/templates/distribution/fonts/legacy/Inter-SemiBold.otf +0 -0
- package/templates/distribution/fonts/legacy/InterDisplay-SemiBold.otf +0 -0
- package/templates/distribution/fonts/legacy/SourceSerif4-Regular.otf +0 -0
- package/templates/distribution/fonts/legacy/SourceSerif4-Semibold.otf +0 -0
- package/templates/distribution/icons/activity.svg +15 -0
- package/templates/distribution/icons/alert-triangle.svg +17 -0
- package/templates/distribution/icons/book-open.svg +16 -0
- package/templates/distribution/icons/bot.svg +20 -0
- package/templates/distribution/icons/brain.svg +22 -0
- package/templates/distribution/icons/circle-check.svg +16 -0
- package/templates/distribution/icons/clipboard-check.svg +17 -0
- package/templates/distribution/icons/cpu.svg +28 -0
- package/templates/distribution/icons/database.svg +17 -0
- package/templates/distribution/icons/eye.svg +16 -0
- package/templates/distribution/icons/file-text.svg +19 -0
- package/templates/distribution/icons/gauge.svg +16 -0
- package/templates/distribution/icons/git-branch.svg +17 -0
- package/templates/distribution/icons/key.svg +17 -0
- package/templates/distribution/icons/layers.svg +17 -0
- package/templates/distribution/icons/list-checks.svg +19 -0
- package/templates/distribution/icons/lock.svg +16 -0
- package/templates/distribution/icons/message-square.svg +15 -0
- package/templates/distribution/icons/network.svg +19 -0
- package/templates/distribution/icons/route.svg +17 -0
- package/templates/distribution/icons/scale.svg +19 -0
- package/templates/distribution/icons/search.svg +16 -0
- package/templates/distribution/icons/send.svg +16 -0
- package/templates/distribution/icons/server.svg +18 -0
- package/templates/distribution/icons/shield-check.svg +16 -0
- package/templates/distribution/icons/users.svg +18 -0
- package/templates/distribution/icons/webhook.svg +17 -0
- package/templates/distribution/icons/workflow.svg +17 -0
- package/templates/distribution/icons/wrench.svg +15 -0
- package/templates/distribution/run.mjs +18 -1
- package/templates/docs/adr.md +7 -0
- package/templates/docs/construct_guide.md +8 -8
- package/templates/docs/customer-profile.md +4 -0
- package/templates/docs/one-pager.md +4 -0
- package/templates/docs/postmortem.md +31 -0
- package/templates/docs/prd-platform.md +19 -0
- package/templates/docs/prd.md +15 -0
- package/templates/docs/prfaq.md +7 -0
- package/templates/docs/qa-strategy.md +103 -0
- package/templates/docs/research-brief.md +8 -0
- package/templates/docs/rfc-platform.md +12 -0
- package/templates/docs/test-plan.md +7 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/certification/cli.mjs — certification scenario inspection and execution.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { listScenarios } from './scenarios.mjs';
|
|
6
|
+
import { buildCertificationStatus, formatCertificationStatus } from './status.mjs';
|
|
7
|
+
import { loadCanonicalScenarios, validateCanonicalScenarios } from './canonical-scenarios.mjs';
|
|
8
|
+
import { listCertificationModels } from './model-routing.mjs';
|
|
9
|
+
import { LIVE_OPT_IN_ENV, previewCertificationRun, runCertificationScenario } from './runner.mjs';
|
|
10
|
+
import {
|
|
11
|
+
listCertificationRunIds,
|
|
12
|
+
readCertificationRun,
|
|
13
|
+
} from './store.mjs';
|
|
14
|
+
import { formatReleaseCandidateGate, runReleaseCandidateGate } from './rc-gate.mjs';
|
|
15
|
+
import { buildDemoParityReport, writeDemoParityReport } from './demo-parity.mjs';
|
|
16
|
+
|
|
17
|
+
function printUsage() {
|
|
18
|
+
process.stderr.write(
|
|
19
|
+
'Usage: construct certify <list|show|scenarios|models|demos|parity|status|gate|run> …\n' +
|
|
20
|
+
' status [--json] [capability-id] (omit id for full rollup; pass capability id for detail)\n' +
|
|
21
|
+
' gate [--json] (release candidate certification freshness; blocks stale or failing release capabilities)\n' +
|
|
22
|
+
' parity [--json] [--write] (cross-surface demo parity report; --write persists under tests/certification/demos/)\n' +
|
|
23
|
+
` run <scenario-id> [--dry-run] [--json] (live scenarios require ${LIVE_OPT_IN_ENV}=1)\n` +
|
|
24
|
+
' models [--json] (lists routable models; paid models require CONSTRUCT_CERTIFY_ALLOW_PAID=1)\n' +
|
|
25
|
+
' demos [--json] (canonical demo scenario catalog for Tauri/web/VHS parity)\n',
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function runCertificationCli(args = [], { projectDir = process.cwd(), repoRoot = projectDir, env = process.env } = {}) {
|
|
30
|
+
const sub = args[0] || 'list';
|
|
31
|
+
const rest = args.slice(1);
|
|
32
|
+
|
|
33
|
+
if (sub === 'list') {
|
|
34
|
+
const ids = listCertificationRunIds({ rootDir: projectDir });
|
|
35
|
+
if (rest.includes('--json')) {
|
|
36
|
+
process.stdout.write(`${JSON.stringify(ids, null, 2)}\n`);
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
if (!ids.length) {
|
|
40
|
+
process.stdout.write('No certification runs recorded under .cx/certification/runs/\n');
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
for (const id of ids) process.stdout.write(`${id}\n`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (sub === 'models') {
|
|
48
|
+
const models = listCertificationModels({ env }).map((entry) => ({
|
|
49
|
+
id: entry.id,
|
|
50
|
+
tier: entry.tier,
|
|
51
|
+
resolvedId: entry.resolvedId,
|
|
52
|
+
label: entry.label,
|
|
53
|
+
}));
|
|
54
|
+
if (rest.includes('--json')) {
|
|
55
|
+
process.stdout.write(`${JSON.stringify(models, null, 2)}\n`);
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
for (const model of models) {
|
|
59
|
+
process.stdout.write(`${model.tier.padEnd(16)} ${model.id}\n`);
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (sub === 'demos') {
|
|
65
|
+
const { catalog } = loadCanonicalScenarios({ rootDir: repoRoot });
|
|
66
|
+
const validation = validateCanonicalScenarios({ rootDir: repoRoot, catalog });
|
|
67
|
+
if (rest.includes('--json')) {
|
|
68
|
+
process.stdout.write(`${JSON.stringify({ ...catalog, validation }, null, 2)}\n`);
|
|
69
|
+
return validation.pass ? 0 : 1;
|
|
70
|
+
}
|
|
71
|
+
for (const demo of catalog.demos ?? []) {
|
|
72
|
+
process.stdout.write(`${demo.id} tape=${demo.tape ?? demo.tapePath}\n`);
|
|
73
|
+
}
|
|
74
|
+
if (!validation.pass) {
|
|
75
|
+
for (const err of validation.errors) process.stderr.write(`error: ${err}\n`);
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (sub === 'parity') {
|
|
82
|
+
const json = rest.includes('--json');
|
|
83
|
+
const report = rest.includes('--write')
|
|
84
|
+
? writeDemoParityReport({ rootDir: repoRoot }).report
|
|
85
|
+
: buildDemoParityReport({ rootDir: repoRoot });
|
|
86
|
+
if (json) {
|
|
87
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
88
|
+
return report.pass ? 0 : 1;
|
|
89
|
+
}
|
|
90
|
+
process.stdout.write(`Demo parity: ${report.pass ? 'PASS' : 'FAIL'} (${report.demoCount} demos)\n`);
|
|
91
|
+
if (report.mismatches.length) {
|
|
92
|
+
for (const mismatch of report.mismatches) {
|
|
93
|
+
process.stderr.write(` ${mismatch.demoId}/${mismatch.surface}: ${mismatch.detail}\n`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return report.pass ? 0 : 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (sub === 'scenarios') {
|
|
100
|
+
const scenarios = listScenarios({ repoRoot }).map((entry) => {
|
|
101
|
+
const preview = previewCertificationRun(entry.id, { repoRoot, env });
|
|
102
|
+
return {
|
|
103
|
+
id: entry.id,
|
|
104
|
+
capabilityId: entry.capabilityId,
|
|
105
|
+
mode: entry.mode ?? 'hermetic',
|
|
106
|
+
requiresEnv: entry.requiresEnv ?? null,
|
|
107
|
+
modelTier: preview.model.tier,
|
|
108
|
+
modelSummary: preview.modelSummary,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
if (rest.includes('--json')) {
|
|
112
|
+
process.stdout.write(`${JSON.stringify(scenarios, null, 2)}\n`);
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
for (const scenario of scenarios) {
|
|
116
|
+
const live = scenario.mode === 'live' ? ` live(${scenario.requiresEnv ?? LIVE_OPT_IN_ENV}=1)` : '';
|
|
117
|
+
process.stdout.write(`${scenario.id} ${scenario.capabilityId}${live} ${scenario.modelSummary}\n`);
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (sub === 'status') {
|
|
123
|
+
const json = rest.includes('--json');
|
|
124
|
+
const capabilityId = rest.find((arg) => !arg.startsWith('-')) ?? null;
|
|
125
|
+
const report = buildCertificationStatus({ rootDir: repoRoot, capabilityId });
|
|
126
|
+
if (json) {
|
|
127
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
formatCertificationStatus(report, { capabilityId });
|
|
131
|
+
process.stdout.write('\n');
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (sub === 'show') {
|
|
136
|
+
const target = rest.find((arg) => !arg.startsWith('-'));
|
|
137
|
+
if (!target) {
|
|
138
|
+
process.stderr.write('Usage: construct certify show <run-id|capability-id> [--json]\n');
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
141
|
+
const json = rest.includes('--json');
|
|
142
|
+
if (target.startsWith('cert-')) {
|
|
143
|
+
const { run } = readCertificationRun(target, { rootDir: projectDir });
|
|
144
|
+
process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
const report = buildCertificationStatus({ rootDir: repoRoot, capabilityId: target });
|
|
148
|
+
if (json) {
|
|
149
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
formatCertificationStatus(report, { capabilityId: target });
|
|
153
|
+
process.stdout.write('\n');
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (sub === 'gate') {
|
|
158
|
+
const json = rest.includes('--json');
|
|
159
|
+
const result = await runReleaseCandidateGate({ rootDir: repoRoot, projectDir, env });
|
|
160
|
+
if (json) {
|
|
161
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
162
|
+
return result.pass ? 0 : 1;
|
|
163
|
+
}
|
|
164
|
+
process.stdout.write(formatReleaseCandidateGate(result));
|
|
165
|
+
return result.pass ? 0 : 1;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (sub === 'run') {
|
|
169
|
+
const scenarioId = rest.find((arg) => !arg.startsWith('-'));
|
|
170
|
+
if (!scenarioId) {
|
|
171
|
+
process.stderr.write(`Usage: construct certify run <scenario-id> [--dry-run] [--json]\n`);
|
|
172
|
+
return 1;
|
|
173
|
+
}
|
|
174
|
+
const dryRun = rest.includes('--dry-run');
|
|
175
|
+
const preview = previewCertificationRun(scenarioId, { repoRoot, env });
|
|
176
|
+
if (!rest.includes('--json')) {
|
|
177
|
+
process.stdout.write(`${preview.modelSummary}\n`);
|
|
178
|
+
}
|
|
179
|
+
const result = await runCertificationScenario(scenarioId, { projectDir, repoRoot, env, dryRun });
|
|
180
|
+
if (rest.includes('--json')) process.stdout.write(`${JSON.stringify(result.run, null, 2)}\n`);
|
|
181
|
+
else {
|
|
182
|
+
process.stdout.write(`scenario: ${result.run.scenarioId}\n`);
|
|
183
|
+
process.stdout.write(`verdict: ${result.run.verdict.status} (${result.run.verdict.source})\n`);
|
|
184
|
+
if (!dryRun) process.stdout.write(`run-id: ${result.run.id}\n`);
|
|
185
|
+
}
|
|
186
|
+
return result.exitCode ?? 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
printUsage();
|
|
190
|
+
return 1;
|
|
191
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/certification/dashboard-api.mjs — dashboard-safe certification status payload.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors construct certify status for GET /api/certification/status without secrets.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
|
|
10
|
+
import { buildCertificationStatus } from './status.mjs';
|
|
11
|
+
import { loadCertificationStatus } from './stale-impact.mjs';
|
|
12
|
+
import { certificationRunDir, certificationRunsRoot, listCertificationRunIds, readCertificationRun } from './store.mjs';
|
|
13
|
+
|
|
14
|
+
function findConstructRoot(startPath = process.cwd()) {
|
|
15
|
+
let current = path.resolve(startPath);
|
|
16
|
+
while (true) {
|
|
17
|
+
if (fs.existsSync(path.join(current, 'package.json'))) return current;
|
|
18
|
+
const parent = path.dirname(current);
|
|
19
|
+
if (parent === current) return path.resolve(startPath);
|
|
20
|
+
current = parent;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function buildStaleRows({ rootDir }) {
|
|
25
|
+
const { status } = loadCertificationStatus({ rootDir });
|
|
26
|
+
if (!status?.capabilities) return [];
|
|
27
|
+
return Object.entries(status.capabilities)
|
|
28
|
+
.filter(([, entry]) => entry.status === 'stale')
|
|
29
|
+
.map(([capabilityId, entry]) => ({
|
|
30
|
+
capabilityId,
|
|
31
|
+
staleSince: entry.staleSince ?? null,
|
|
32
|
+
staleReason: entry.staleReason ?? null,
|
|
33
|
+
stalePaths: entry.stalePaths ?? [],
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function buildCertificationDashboard({ rootDir = process.cwd() } = {}) {
|
|
38
|
+
const root = findConstructRoot(rootDir);
|
|
39
|
+
const report = buildCertificationStatus({ rootDir: root });
|
|
40
|
+
const runs = [];
|
|
41
|
+
for (const runId of listCertificationRunIds({ rootDir: root }).slice(-20)) {
|
|
42
|
+
try {
|
|
43
|
+
const { run } = readCertificationRun(runId, { rootDir: root });
|
|
44
|
+
const dir = certificationRunDir(runId, root);
|
|
45
|
+
runs.push({
|
|
46
|
+
id: run.id,
|
|
47
|
+
scenarioId: run.scenarioId,
|
|
48
|
+
capabilityId: run.capabilityId,
|
|
49
|
+
status: run.verdict?.status ?? 'unknown',
|
|
50
|
+
createdAt: run.createdAt,
|
|
51
|
+
artifactPath: path.relative(root, path.join(dir, 'run.json')),
|
|
52
|
+
});
|
|
53
|
+
} catch { /* skip corrupt */ }
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
generatedAt: report.generatedAt,
|
|
57
|
+
capabilities: report.capabilities,
|
|
58
|
+
specialists: report.specialists,
|
|
59
|
+
skills: report.skills,
|
|
60
|
+
artifactTypes: report.artifactTypes,
|
|
61
|
+
documentCategories: report.documentCategories,
|
|
62
|
+
demos: report.demos,
|
|
63
|
+
stale: buildStaleRows({ rootDir: root }),
|
|
64
|
+
runs,
|
|
65
|
+
runsDir: path.relative(root, certificationRunsRoot(root)),
|
|
66
|
+
artifactLinks: {
|
|
67
|
+
runsRoot: '.cx/certification/runs',
|
|
68
|
+
recentRunIds: runs.map((r) => r.id),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/certification/demo-parity.mjs — cross-surface demo parity report generator.
|
|
3
|
+
*
|
|
4
|
+
* Compares Tauri, web cockpit, and VHS terminal harness markers for each canonical
|
|
5
|
+
* demo. Mismatches are recorded for follow-up beads; acceptable divergences cite
|
|
6
|
+
* platform constraints with evidence paths.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
import { loadCanonicalScenarios } from './canonical-scenarios.mjs';
|
|
13
|
+
|
|
14
|
+
const SURFACE_MARKERS = Object.freeze({
|
|
15
|
+
tauri: {
|
|
16
|
+
label: 'Tauri desktop',
|
|
17
|
+
probe: (root, demo) => {
|
|
18
|
+
const launcher = path.join(root, 'tests/functional/chat-desktop-launcher.functional.test.mjs');
|
|
19
|
+
if (!fs.existsSync(launcher)) return { ok: false, detail: 'missing desktop launcher test' };
|
|
20
|
+
const src = fs.readFileSync(launcher, 'utf8');
|
|
21
|
+
return { ok: /surface=desktop/.test(src), detail: launcher };
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
web: {
|
|
25
|
+
label: 'Web cockpit',
|
|
26
|
+
probe: (root, demo) => {
|
|
27
|
+
const routeStrip = path.join(root, 'apps/chat/web/components/route-strip.tsx');
|
|
28
|
+
const tokens = path.join(root, 'apps/chat/web/theme/tokens.css');
|
|
29
|
+
if (!fs.existsSync(routeStrip) || !fs.existsSync(tokens)) {
|
|
30
|
+
return { ok: false, detail: 'missing web cockpit markers' };
|
|
31
|
+
}
|
|
32
|
+
return { ok: true, detail: routeStrip };
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
terminal: {
|
|
36
|
+
label: 'VHS terminal',
|
|
37
|
+
probe: (root, demo) => {
|
|
38
|
+
const tape = demo.tape ?? demo.tapePath;
|
|
39
|
+
if (!tape) return { ok: false, detail: 'demo missing tape path' };
|
|
40
|
+
const abs = path.join(root, tape);
|
|
41
|
+
return { ok: fs.existsSync(abs), detail: abs };
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const ACCEPTABLE_DIVERGENCES = Object.freeze([
|
|
47
|
+
{
|
|
48
|
+
id: 'tauri-native-chrome',
|
|
49
|
+
surface: 'tauri',
|
|
50
|
+
reason: 'Desktop shell uses native window chrome; web uses browser viewport.',
|
|
51
|
+
evidence: 'apps/chat/desktop/',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'vhs-terminal-only',
|
|
55
|
+
surface: 'terminal',
|
|
56
|
+
reason: 'VHS tapes assert terminal UX; Tauri/web use GUI interaction models.',
|
|
57
|
+
evidence: 'templates/demos/tapes/',
|
|
58
|
+
},
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
function findConstructRoot(startPath = process.cwd()) {
|
|
62
|
+
let current = path.resolve(startPath);
|
|
63
|
+
while (true) {
|
|
64
|
+
if (fs.existsSync(path.join(current, 'package.json'))) return current;
|
|
65
|
+
const parent = path.dirname(current);
|
|
66
|
+
if (parent === current) return path.resolve(startPath);
|
|
67
|
+
current = parent;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function buildDemoParityReport({ rootDir } = {}) {
|
|
72
|
+
const root = findConstructRoot(rootDir);
|
|
73
|
+
const { catalog } = loadCanonicalScenarios({ rootDir: root });
|
|
74
|
+
const demos = [];
|
|
75
|
+
const mismatches = [];
|
|
76
|
+
|
|
77
|
+
for (const demo of catalog.demos ?? []) {
|
|
78
|
+
const surfaces = {};
|
|
79
|
+
for (const [surfaceId, marker] of Object.entries(SURFACE_MARKERS)) {
|
|
80
|
+
const result = marker.probe(root, demo);
|
|
81
|
+
surfaces[surfaceId] = {
|
|
82
|
+
label: marker.label,
|
|
83
|
+
ok: result.ok,
|
|
84
|
+
evidence: result.detail,
|
|
85
|
+
};
|
|
86
|
+
if (!result.ok) {
|
|
87
|
+
mismatches.push({
|
|
88
|
+
demoId: demo.id,
|
|
89
|
+
surface: surfaceId,
|
|
90
|
+
detail: result.detail,
|
|
91
|
+
followUpBead: `construct-xp5k.7.5:${demo.id}:${surfaceId}`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
demos.push({ id: demo.id, capabilityId: demo.capabilityId, surfaces });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
schema: 'construct/certification/demo-parity/1',
|
|
100
|
+
generatedAt: new Date().toISOString(),
|
|
101
|
+
demoCount: demos.length,
|
|
102
|
+
pass: mismatches.length === 0,
|
|
103
|
+
demos,
|
|
104
|
+
mismatches,
|
|
105
|
+
acceptableDivergences: ACCEPTABLE_DIVERGENCES,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function writeDemoParityReport({ rootDir } = {}) {
|
|
110
|
+
const root = findConstructRoot(rootDir);
|
|
111
|
+
const report = buildDemoParityReport({ rootDir: root });
|
|
112
|
+
const out = path.join(root, 'tests', 'certification', 'demos', 'parity-report.json');
|
|
113
|
+
fs.mkdirSync(path.dirname(out), { recursive: true });
|
|
114
|
+
fs.writeFileSync(out, `${JSON.stringify(report, null, 2)}\n`);
|
|
115
|
+
return { path: out, report };
|
|
116
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/certification/document-io-fixtures.mjs — intake fixture catalog for document I/O tests.
|
|
3
|
+
*
|
|
4
|
+
* Maps docs/reference/document-io.md supported intake categories to committed
|
|
5
|
+
* files under tests/fixtures/document-io/<category>/.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
|
|
11
|
+
function findConstructRoot(startPath = process.cwd()) {
|
|
12
|
+
let current = path.resolve(startPath);
|
|
13
|
+
while (true) {
|
|
14
|
+
if (fs.existsSync(path.join(current, 'package.json')) && fs.existsSync(path.join(current, 'tests'))) return current;
|
|
15
|
+
const parent = path.dirname(current);
|
|
16
|
+
if (parent === current) return path.resolve(startPath);
|
|
17
|
+
current = parent;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const DOCUMENT_IO_CATEGORIES = Object.freeze([
|
|
22
|
+
{
|
|
23
|
+
id: 'plain-text',
|
|
24
|
+
label: 'Plain text / code',
|
|
25
|
+
extensions: ['.md', '.txt', '.json', '.yaml', '.csv', '.html', '.xml'],
|
|
26
|
+
files: ['sample.md', 'sample.txt', 'sample.json', 'sample.yaml', 'sample.csv', 'sample.html', 'sample.xml'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'transcripts',
|
|
30
|
+
label: 'Transcripts',
|
|
31
|
+
extensions: ['.vtt', '.srt', '.lrc'],
|
|
32
|
+
files: ['sample.vtt', 'sample.srt', 'sample.lrc'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'calendar',
|
|
36
|
+
label: 'Calendar',
|
|
37
|
+
extensions: ['.ics'],
|
|
38
|
+
files: ['sample.ics'],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'email',
|
|
42
|
+
label: 'Email',
|
|
43
|
+
extensions: ['.eml', '.msg'],
|
|
44
|
+
files: ['sample.eml', 'sample.msg'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'pdf',
|
|
48
|
+
label: 'PDF',
|
|
49
|
+
extensions: ['.pdf'],
|
|
50
|
+
files: ['sample.pdf'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'word',
|
|
54
|
+
label: 'Word',
|
|
55
|
+
extensions: ['.docx', '.doc'],
|
|
56
|
+
files: ['sample.docx', 'sample.doc'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'excel',
|
|
60
|
+
label: 'Excel',
|
|
61
|
+
extensions: ['.xlsx', '.xls', '.ods'],
|
|
62
|
+
files: ['sample.xlsx', 'sample.xls', 'sample.ods'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'powerpoint',
|
|
66
|
+
label: 'PowerPoint',
|
|
67
|
+
extensions: ['.pptx', '.ppt'],
|
|
68
|
+
files: ['sample.pptx', 'sample.ppt'],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'rich-text',
|
|
72
|
+
label: 'Rich text',
|
|
73
|
+
extensions: ['.rtf'],
|
|
74
|
+
files: ['sample.rtf'],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'apple-iwork',
|
|
78
|
+
label: 'Apple iWork',
|
|
79
|
+
extensions: ['.pages', '.numbers', '.key'],
|
|
80
|
+
files: ['sample.pages', 'sample.numbers', 'sample.key'],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'audio-video',
|
|
84
|
+
label: 'Audio/video',
|
|
85
|
+
extensions: ['.mp3', '.wav', '.mp4', '.mov'],
|
|
86
|
+
files: ['sample.mp3', 'sample.wav', 'sample.mp4', 'sample.mov'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'unsupported',
|
|
90
|
+
label: 'Unsupported (negative)',
|
|
91
|
+
extensions: ['.xyz'],
|
|
92
|
+
files: ['sample.xyz'],
|
|
93
|
+
negative: true,
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
|
|
97
|
+
export function documentIoFixtureRoot(rootDir = process.cwd()) {
|
|
98
|
+
return path.join(findConstructRoot(rootDir), 'tests', 'fixtures', 'document-io');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function documentIoFixturePath(categoryId, fileName, { rootDir } = {}) {
|
|
102
|
+
return path.join(documentIoFixtureRoot(rootDir), categoryId, fileName);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function validateDocumentIoFixtures({ rootDir } = {}) {
|
|
106
|
+
const root = findConstructRoot(rootDir);
|
|
107
|
+
const errors = [];
|
|
108
|
+
for (const category of DOCUMENT_IO_CATEGORIES) {
|
|
109
|
+
for (const file of category.files) {
|
|
110
|
+
const abs = documentIoFixturePath(category.id, file, { rootDir: root });
|
|
111
|
+
if (!fs.existsSync(abs)) errors.push(`missing fixture: tests/fixtures/document-io/${category.id}/${file}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
categoryCount: DOCUMENT_IO_CATEGORIES.length,
|
|
116
|
+
errors,
|
|
117
|
+
pass: errors.length === 0,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function writeDocumentIoFixtures({ rootDir } = {}) {
|
|
122
|
+
const root = findConstructRoot(rootDir);
|
|
123
|
+
const base = documentIoFixtureRoot(root);
|
|
124
|
+
|
|
125
|
+
const samples = {
|
|
126
|
+
'plain-text/sample.md': '# Fixture\n\nDocument I/O plain-text sample.\n',
|
|
127
|
+
'plain-text/sample.txt': 'Document I/O plain-text fixture.\n',
|
|
128
|
+
'plain-text/sample.json': '{"fixture": "document-io", "category": "plain-text"}\n',
|
|
129
|
+
'plain-text/sample.yaml': 'fixture: document-io\ncategory: plain-text\n',
|
|
130
|
+
'plain-text/sample.csv': 'name,value\nfixture,1\n',
|
|
131
|
+
'plain-text/sample.html': '<!doctype html><html><body><p>Document I/O fixture</p></body></html>\n',
|
|
132
|
+
'plain-text/sample.xml': '<?xml version="1.0"?><fixture category="plain-text">document-io</fixture>\n',
|
|
133
|
+
'transcripts/sample.vtt': 'WEBVTT\n\n00:00:00.000 --> 00:00:02.000\nDocument I/O transcript fixture.\n',
|
|
134
|
+
'transcripts/sample.srt': '1\n00:00:00,000 --> 00:00:02,000\nDocument I/O transcript fixture.\n',
|
|
135
|
+
'transcripts/sample.lrc': '[00:00.00]Document I/O transcript fixture.\n',
|
|
136
|
+
'calendar/sample.ics': [
|
|
137
|
+
'BEGIN:VCALENDAR',
|
|
138
|
+
'VERSION:2.0',
|
|
139
|
+
'BEGIN:VEVENT',
|
|
140
|
+
'UID:fixture-document-io@construct',
|
|
141
|
+
'DTSTART:20260622T120000Z',
|
|
142
|
+
'SUMMARY:Document I/O calendar fixture',
|
|
143
|
+
'END:VEVENT',
|
|
144
|
+
'END:VCALENDAR',
|
|
145
|
+
'',
|
|
146
|
+
].join('\n'),
|
|
147
|
+
'email/sample.eml': [
|
|
148
|
+
'From: fixture@construct.test',
|
|
149
|
+
'To: intake@construct.test',
|
|
150
|
+
'Subject: Document I/O email fixture',
|
|
151
|
+
'Content-Type: text/plain; charset=utf-8',
|
|
152
|
+
'',
|
|
153
|
+
'Email body for document-io fixture.',
|
|
154
|
+
'',
|
|
155
|
+
].join('\n'),
|
|
156
|
+
'email/sample.msg': 'MSG fixture stub — binary Outlook format not generated in tests.\n',
|
|
157
|
+
'pdf/sample.pdf': '%PDF-1.1\n1 0 obj<<>>endobj\ntrailer<<>>\n%%EOF\n',
|
|
158
|
+
'word/sample.doc': 'DOC fixture stub for docling-only legacy format.\n',
|
|
159
|
+
'rich-text/sample.rtf': '{\\rtf1\\ansi Document I/O RTF fixture.}\n',
|
|
160
|
+
'apple-iwork/sample.pages': 'iWork pages fixture stub for docling path.\n',
|
|
161
|
+
'apple-iwork/sample.numbers': 'iWork numbers fixture stub for docling path.\n',
|
|
162
|
+
'apple-iwork/sample.key': 'iWork key fixture stub for docling path.\n',
|
|
163
|
+
'audio-video/sample.mp3': 'ID3fixture',
|
|
164
|
+
'audio-video/sample.wav': 'RIFF....WAVEfmt ',
|
|
165
|
+
'audio-video/sample.mp4': '....ftypmp42',
|
|
166
|
+
'audio-video/sample.mov': '....ftypqt ',
|
|
167
|
+
'unsupported/sample.xyz': 'unsupported extension negative fixture\n',
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const minimalZip = (content) => {
|
|
171
|
+
const crcTable = [];
|
|
172
|
+
for (let n = 0; n < 256; n += 1) {
|
|
173
|
+
let c = n;
|
|
174
|
+
for (let k = 0; k < 8; k += 1) c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1);
|
|
175
|
+
crcTable[n] = c;
|
|
176
|
+
}
|
|
177
|
+
const crc32 = (buf) => {
|
|
178
|
+
let c = 0xffffffff;
|
|
179
|
+
for (let i = 0; i < buf.length; i += 1) c = crcTable[(c ^ buf[i]) & 0xff] ^ (c >>> 8);
|
|
180
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
181
|
+
};
|
|
182
|
+
const name = Buffer.from('word/document.xml', 'utf8');
|
|
183
|
+
const data = Buffer.from(content, 'utf8');
|
|
184
|
+
const crc = crc32(data);
|
|
185
|
+
const local = Buffer.alloc(30 + name.length + data.length);
|
|
186
|
+
local.writeUInt32LE(0x04034b50, 0);
|
|
187
|
+
local.writeUInt16LE(10, 4);
|
|
188
|
+
local.writeUInt16LE(0, 6);
|
|
189
|
+
local.writeUInt16LE(0, 8);
|
|
190
|
+
local.writeUInt16LE(0, 10);
|
|
191
|
+
local.writeUInt16LE(0, 12);
|
|
192
|
+
local.writeUInt32LE(crc, 14);
|
|
193
|
+
local.writeUInt32LE(data.length, 18);
|
|
194
|
+
local.writeUInt32LE(data.length, 22);
|
|
195
|
+
local.writeUInt16LE(name.length, 26);
|
|
196
|
+
local.writeUInt16LE(0, 28);
|
|
197
|
+
name.copy(local, 30);
|
|
198
|
+
data.copy(local, 30 + name.length);
|
|
199
|
+
const central = Buffer.alloc(46 + name.length);
|
|
200
|
+
central.writeUInt32LE(0x02014b50, 0);
|
|
201
|
+
central.writeUInt16LE(20, 4);
|
|
202
|
+
central.writeUInt16LE(10, 6);
|
|
203
|
+
central.writeUInt16LE(0, 8);
|
|
204
|
+
central.writeUInt16LE(0, 10);
|
|
205
|
+
central.writeUInt16LE(0, 12);
|
|
206
|
+
central.writeUInt16LE(0, 14);
|
|
207
|
+
central.writeUInt32LE(crc, 16);
|
|
208
|
+
central.writeUInt32LE(data.length, 20);
|
|
209
|
+
central.writeUInt32LE(data.length, 24);
|
|
210
|
+
central.writeUInt16LE(name.length, 28);
|
|
211
|
+
central.writeUInt16LE(0, 30);
|
|
212
|
+
central.writeUInt16LE(0, 32);
|
|
213
|
+
central.writeUInt16LE(0, 34);
|
|
214
|
+
central.writeUInt16LE(0, 36);
|
|
215
|
+
central.writeUInt32LE(0, 38);
|
|
216
|
+
central.writeUInt32LE(0, 42);
|
|
217
|
+
name.copy(central, 46);
|
|
218
|
+
const end = Buffer.alloc(22);
|
|
219
|
+
end.writeUInt32LE(0x06054b50, 0);
|
|
220
|
+
end.writeUInt16LE(0, 4);
|
|
221
|
+
end.writeUInt16LE(0, 6);
|
|
222
|
+
end.writeUInt16LE(1, 8);
|
|
223
|
+
end.writeUInt16LE(1, 10);
|
|
224
|
+
end.writeUInt32LE(central.length, 12);
|
|
225
|
+
end.writeUInt32LE(local.length, 16);
|
|
226
|
+
end.writeUInt16LE(0, 20);
|
|
227
|
+
return Buffer.concat([local, central, end]);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const officeXml = '<?xml version="1.0"?><fixture>document-io</fixture>';
|
|
231
|
+
samples['word/sample.docx'] = minimalZip(officeXml);
|
|
232
|
+
samples['excel/sample.xlsx'] = minimalZip(officeXml);
|
|
233
|
+
samples['excel/sample.xls'] = 'XLS fixture stub for docling path.\n';
|
|
234
|
+
samples['excel/sample.ods'] = minimalZip(officeXml);
|
|
235
|
+
samples['powerpoint/sample.pptx'] = minimalZip(officeXml);
|
|
236
|
+
samples['powerpoint/sample.ppt'] = 'PPT fixture stub for docling path.\n';
|
|
237
|
+
|
|
238
|
+
const written = [];
|
|
239
|
+
for (const [rel, content] of Object.entries(samples)) {
|
|
240
|
+
const abs = path.join(base, rel);
|
|
241
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
242
|
+
fs.writeFileSync(abs, content);
|
|
243
|
+
written.push(`tests/fixtures/document-io/${rel}`);
|
|
244
|
+
}
|
|
245
|
+
return { written };
|
|
246
|
+
}
|