@thebackstoryis/engineering-with-ai 0.2.9
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/Docs/README.md +50 -0
- package/Docs/adoption/consultancy-and-multi-project-rollout.md +135 -0
- package/Docs/adoption/non-technical-team-guide.md +126 -0
- package/Docs/archaeology-technology-and-hosting-discovery.md +212 -0
- package/Docs/blast-radius-and-impact-routing-guide.md +325 -0
- package/Docs/blueprints/internal-blueprint-catalogue.md +146 -0
- package/Docs/blueprints/maintaining-organisation-blueprints.md +154 -0
- package/Docs/blueprints/validation-and-troubleshooting.md +168 -0
- package/Docs/cli-reference.md +113 -0
- package/Docs/completed-phase-evidence-amendments.md +74 -0
- package/Docs/consultancy-network-rollout-control-plane-guide.md +202 -0
- package/Docs/context-aware-delivery-companion-guide.md +198 -0
- package/Docs/context-aware-delivery-companion-user-guide.md +184 -0
- package/Docs/context-management-and-token-efficiency.md +113 -0
- package/Docs/design-systems/design-system-implementation-guide.md +85 -0
- package/Docs/design-systems/design-system-pack-authoring-guide.md +95 -0
- package/Docs/design-systems/design-system-review-guide.md +51 -0
- package/Docs/design-systems/design-system-user-guide.md +96 -0
- package/Docs/design-systems/product-owner-guide.md +49 -0
- package/Docs/designing-organisation-blueprint-packs.md +384 -0
- package/Docs/developer-delivery-guide.md +224 -0
- package/Docs/error-reporting-guide.md +110 -0
- package/Docs/error-reporting-provider-guide.md +49 -0
- package/Docs/examples/error-report-adapter.md +70 -0
- package/Docs/examples/meeting-review.md +76 -0
- package/Docs/examples/minimal-design-system.md +67 -0
- package/Docs/examples/prototype-review-inputs.md +175 -0
- package/Docs/examples/reproducible-archaeology-depth-example.md +144 -0
- package/Docs/examples/test-scenario-input.md +68 -0
- package/Docs/examples/worked-examples.md +147 -0
- package/Docs/existing-project-onboarding-guide.md +214 -0
- package/Docs/explanation/core-concepts.md +26 -0
- package/Docs/explanation/delivery-workflow.md +48 -0
- package/Docs/governance/governance-team-guide.md +139 -0
- package/Docs/governed-starter-project-materialisation-guide.md +284 -0
- package/Docs/guide-catalogue.md +117 -0
- package/Docs/guided-discovery-facilitator-guide.md +172 -0
- package/Docs/guided-intent-workspace-guide.md +109 -0
- package/Docs/guided-phase-evidence-drafting-guide.md +119 -0
- package/Docs/human-approval-and-assurance-guide.md +146 -0
- package/Docs/knowledge-proposals-implementer-guide.md +106 -0
- package/Docs/knowledge-proposals-user-guide.md +247 -0
- package/Docs/maintainers/context-benchmarks.md +29 -0
- package/Docs/maintainers/contributing.md +58 -0
- package/Docs/maintainers/evidence-depth-acceptance.md +72 -0
- package/Docs/maintainers/verification-walkthroughs.md +104 -0
- package/Docs/meeting-evidence-implementer-guide.md +132 -0
- package/Docs/meeting-evidence-user-guide.md +200 -0
- package/Docs/operations/dashboard-and-delivery-state.md +153 -0
- package/Docs/operations/dashboard-configuration.md +87 -0
- package/Docs/operations/installation-updating-and-entitlements.md +135 -0
- package/Docs/operations/premium-personas-setup.md +76 -0
- package/Docs/operations/troubleshooting-and-recovery.md +205 -0
- package/Docs/organisation-rollout-guide.md +142 -0
- package/Docs/persona-entitlement-provider-guide.md +199 -0
- package/Docs/persona-guided-prototype-iteration.md +129 -0
- package/Docs/personas/organisation-specific-personas.md +103 -0
- package/Docs/personas/persona-authoring-cookbook.md +176 -0
- package/Docs/personas/persona-engagement-ui.md +133 -0
- package/Docs/personas/persona-governance.md +118 -0
- package/Docs/platform-export-analysis-guide.md +336 -0
- package/Docs/policies/governance-owner-guide.md +36 -0
- package/Docs/policies/implementation-guide.md +42 -0
- package/Docs/policies/organisation-policy-design-gates.md +58 -0
- package/Docs/policies/policy-pack-authoring-guide.md +108 -0
- package/Docs/policies/product-owner-guide.md +43 -0
- package/Docs/policies/technical-owner-guide.md +37 -0
- package/Docs/product-owner-guide.md +327 -0
- package/Docs/project-portfolio-orchestration-guide.md +199 -0
- package/Docs/quality/manual-qa-and-acceptance.md +162 -0
- package/Docs/quality/persona-driven-test-scenarios.md +172 -0
- package/Docs/quality/reproducible-archaeology-depth-review-checklist.md +89 -0
- package/Docs/reference/capabilities-and-project-layout.md +678 -0
- package/Docs/reference/cli-and-configuration.md +398 -0
- package/Docs/reference/contributions-api.md +23 -0
- package/Docs/reference/security-adapter-authoring.md +81 -0
- package/Docs/reference/starter-adapter-authoring.md +74 -0
- package/Docs/repository-source-map-guide.md +381 -0
- package/Docs/reproducible-archaeology-and-discovery-depth.md +292 -0
- package/Docs/screen-prototype-creation-guide.md +324 -0
- package/Docs/security-validation-guide.md +353 -0
- package/Docs/solution-readiness-review-guide.md +123 -0
- package/Docs/standards/project-standards-authoring.md +157 -0
- package/Docs/team-hub-guide.md +162 -0
- package/Docs/team-hub-resource-registry-guide.md +167 -0
- package/Docs/tutorials/first-delivery.md +83 -0
- package/Docs/tutorials/first-session.md +62 -0
- package/Docs/using-lifecycle-hooks.md +381 -0
- package/Docs/working-with-personas.md +274 -0
- package/LICENSE +165 -0
- package/README.md +96 -0
- package/agents-src/claude/ewai-security-reviewer.md +15 -0
- package/bin/ewai +5 -0
- package/config/archaeology-record-families.yaml +59 -0
- package/config/delivery-artifacts.yaml +121 -0
- package/config/delivery-stages.yaml +77 -0
- package/config/design-system.schema.json +46 -0
- package/config/error-reporting.schema.json +79 -0
- package/config/evidence-depth.schema.json +53 -0
- package/config/intent.schema.json +90 -0
- package/config/knowledge-proposals-proposal.schema.json +34 -0
- package/config/lifecycle-event.schema.json +68 -0
- package/config/lifecycle-handler.schema.json +45 -0
- package/config/lifecycle-hook-ack.schema.json +19 -0
- package/config/meeting-evidence-candidate.schema.json +102 -0
- package/config/organisation-policy.schema.json +137 -0
- package/config/pack.schema.json +250 -0
- package/config/persona-pack.schema.json +21 -0
- package/config/persona.schema.json +17 -0
- package/config/policy-evaluation.schema.json +77 -0
- package/config/policy-facts.schema.json +140 -0
- package/config/portfolio.schema.json +68 -0
- package/config/project.schema.json +313 -0
- package/config/prototype-iteration.schema.json +128 -0
- package/config/rollout.schema.json +87 -0
- package/config/security-adapter.schema.json +31 -0
- package/config/security-scan-request.schema.json +64 -0
- package/config/security-scan-response.schema.json +52 -0
- package/config/security-validation-policy.schema.json +74 -0
- package/config/starter-source-acknowledgement.schema.json +13 -0
- package/config/starter-source-adapter.schema.json +38 -0
- package/config/starter-source-request.schema.json +61 -0
- package/package.json +77 -0
- package/packs/core/pack.yaml +7 -0
- package/packs/design-systems/default/experience-promise.md +9 -0
- package/packs/design-systems/default/intentional-review.md +10 -0
- package/packs/design-systems/default/interaction-and-entry.md +9 -0
- package/packs/design-systems/default/meaningful-content-and-states.md +9 -0
- package/packs/design-systems/default/pack.yaml +44 -0
- package/packs/design-systems/default/principles.md +10 -0
- package/packs/personas/core/pack.yaml +7 -0
- package/packs/personas/core/personas/archaeologist.md +37 -0
- package/packs/personas/core/personas/end-user.md +17 -0
- package/packs/personas/core/personas/maintainer.md +17 -0
- package/packs/personas/core/personas/operator.md +17 -0
- package/packs/personas/core/personas/specs-knowledge-curator.md +35 -0
- package/packs/technologies/laravel/pack.yaml +30 -0
- package/packs/technologies/laravel-nuxt/pack.yaml +30 -0
- package/packs/technologies/nuxt/pack.yaml +30 -0
- package/packs/technologies/power-platform/pack.yaml +31 -0
- package/packs/technologies/salesforce/pack.yaml +25 -0
- package/public/app.js +4896 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/backstory-icon.png +0 -0
- package/public/dashboard-navigation.js +98 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +789 -0
- package/public/styles.css +2693 -0
- package/public/team-hub/app.js +202 -0
- package/public/team-hub/index.html +79 -0
- package/public/team-hub/styles.css +90 -0
- package/scripts/publication-check.mjs +140 -0
- package/scripts/setup.mjs +21 -0
- package/skills-src/ewai-archaeology/SKILL.md +334 -0
- package/skills-src/ewai-archaeology/agents/openai.yaml +4 -0
- package/skills-src/ewai-archaeology/references/archaeology-contract.md +201 -0
- package/skills-src/ewai-archaeology/references/lifecycle-reconstruction.md +177 -0
- package/skills-src/ewai-archaeology/references/maximum-detail-reconstruction.md +97 -0
- package/skills-src/ewai-archaeology/references/model-routing.md +26 -0
- package/skills-src/ewai-architecture/SKILL.md +108 -0
- package/skills-src/ewai-architecture/agents/openai.yaml +4 -0
- package/skills-src/ewai-architecture/references/architecture-contract.md +176 -0
- package/skills-src/ewai-context/SKILL.md +68 -0
- package/skills-src/ewai-context/agents/openai.yaml +4 -0
- package/skills-src/ewai-context-import/SKILL.md +118 -0
- package/skills-src/ewai-context-import/agents/openai.yaml +4 -0
- package/skills-src/ewai-context-import/references/context-import-contract.md +106 -0
- package/skills-src/ewai-dashboard-configuration/SKILL.md +20 -0
- package/skills-src/ewai-deliver/SKILL.md +122 -0
- package/skills-src/ewai-deliver/references/delivery-evidence.md +92 -0
- package/skills-src/ewai-deliver/references/phase-routing.md +31 -0
- package/skills-src/ewai-design-system-apply/SKILL.md +27 -0
- package/skills-src/ewai-design-system-apply/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-apply/references/application-contract.md +36 -0
- package/skills-src/ewai-design-system-author/SKILL.md +28 -0
- package/skills-src/ewai-design-system-author/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-author/references/authoring-contract.md +38 -0
- package/skills-src/ewai-design-system-review/SKILL.md +26 -0
- package/skills-src/ewai-design-system-review/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-review/references/review-contract.md +40 -0
- package/skills-src/ewai-error-reporting/SKILL.md +46 -0
- package/skills-src/ewai-error-reporting/agents/openai.yaml +4 -0
- package/skills-src/ewai-error-reporting/references/provider-contract.md +74 -0
- package/skills-src/ewai-evidence-depth/SKILL.md +72 -0
- package/skills-src/ewai-evidence-depth/agents/openai.yaml +4 -0
- package/skills-src/ewai-evidence-depth/references/evidence-depth-contract.md +127 -0
- package/skills-src/ewai-intent/SKILL.md +68 -0
- package/skills-src/ewai-intent/agents/openai.yaml +4 -0
- package/skills-src/ewai-intent/references/intent-contract.md +42 -0
- package/skills-src/ewai-knowledge-proposals/SKILL.md +105 -0
- package/skills-src/ewai-knowledge-proposals/agents/openai.yaml +4 -0
- package/skills-src/ewai-knowledge-proposals/references/proposal-contract.md +59 -0
- package/skills-src/ewai-meeting-evidence/SKILL.md +106 -0
- package/skills-src/ewai-meeting-evidence/agents/openai.yaml +4 -0
- package/skills-src/ewai-meeting-evidence/references/candidate-contract.md +64 -0
- package/skills-src/ewai-organisation-policy/SKILL.md +62 -0
- package/skills-src/ewai-organisation-policy/agents/openai.yaml +4 -0
- package/skills-src/ewai-organisation-policy/references/policy-contract.md +94 -0
- package/skills-src/ewai-palace-housekeeping/SKILL.md +55 -0
- package/skills-src/ewai-palace-housekeeping/agents/openai.yaml +4 -0
- package/skills-src/ewai-persona-entitlement/SKILL.md +60 -0
- package/skills-src/ewai-persona-entitlement/agents/openai.yaml +4 -0
- package/skills-src/ewai-phase-evidence/SKILL.md +79 -0
- package/skills-src/ewai-phase-evidence/agents/openai.yaml +4 -0
- package/skills-src/ewai-pipeline/SKILL.md +130 -0
- package/skills-src/ewai-pipeline/agents/openai.yaml +4 -0
- package/skills-src/ewai-pipeline/references/cli.md +86 -0
- package/skills-src/ewai-pipeline/references/specs-contract.md +16 -0
- package/skills-src/ewai-portfolio/SKILL.md +70 -0
- package/skills-src/ewai-portfolio/agents/openai.yaml +4 -0
- package/skills-src/ewai-portfolio/references/portfolio-contract.md +67 -0
- package/skills-src/ewai-project-discovery/SKILL.md +95 -0
- package/skills-src/ewai-project-discovery/agents/openai.yaml +4 -0
- package/skills-src/ewai-project-discovery/references/discovery-contract.md +34 -0
- package/skills-src/ewai-prototype-iteration/SKILL.md +30 -0
- package/skills-src/ewai-prototype-iteration/agents/openai.yaml +4 -0
- package/skills-src/ewai-prototype-iteration/references/review-contract.md +49 -0
- package/skills-src/ewai-retro/SKILL.md +48 -0
- package/skills-src/ewai-retro/agents/openai.yaml +4 -0
- package/skills-src/ewai-retro/references/asset-routing.md +14 -0
- package/skills-src/ewai-rollout/SKILL.md +74 -0
- package/skills-src/ewai-rollout/agents/openai.yaml +4 -0
- package/skills-src/ewai-rollout/references/rollout-contract.md +74 -0
- package/skills-src/ewai-shape-intents/SKILL.md +84 -0
- package/skills-src/ewai-shape-intents/agents/openai.yaml +4 -0
- package/skills-src/ewai-shape-intents/references/intent-mapping-contract.md +109 -0
- package/skills-src/ewai-solution-readiness/SKILL.md +55 -0
- package/skills-src/ewai-solution-readiness/agents/openai.yaml +4 -0
- package/skills-src/ewai-standards-check/SKILL.md +93 -0
- package/skills-src/ewai-standards-check/agents/openai.yaml +4 -0
- package/skills-src/ewai-standards-check/references/report-contract.md +116 -0
- package/skills-src/ewai-test-scenarios/SKILL.md +94 -0
- package/skills-src/ewai-test-scenarios/agents/openai.yaml +4 -0
- package/skills-src/ewai-test-scenarios/references/scenario-contract.md +88 -0
- package/src/afk-worker.mjs +16 -0
- package/src/archaeology.mjs +1333 -0
- package/src/checkin.mjs +261 -0
- package/src/cli.mjs +2427 -0
- package/src/companion-guidance.mjs +257 -0
- package/src/companion-opening.mjs +62 -0
- package/src/companion.mjs +256 -0
- package/src/context.mjs +210 -0
- package/src/dashboard-preferences.mjs +80 -0
- package/src/delivery-artifacts.mjs +204 -0
- package/src/delivery-documents.mjs +248 -0
- package/src/delivery-gates.mjs +317 -0
- package/src/delivery.mjs +1433 -0
- package/src/design-system-application.mjs +291 -0
- package/src/design-system-authoring.mjs +101 -0
- package/src/design-systems.mjs +466 -0
- package/src/discovery.mjs +1314 -0
- package/src/error-reporting.mjs +323 -0
- package/src/evidence-depth.mjs +543 -0
- package/src/execution-state.mjs +243 -0
- package/src/install.mjs +166 -0
- package/src/intent-dependencies.mjs +117 -0
- package/src/intent-maps.mjs +402 -0
- package/src/intents.mjs +747 -0
- package/src/knowledge-proposals.mjs +717 -0
- package/src/launcher.mjs +51 -0
- package/src/meeting-evidence.mjs +703 -0
- package/src/network-rollout.mjs +386 -0
- package/src/organisation-blueprints.mjs +438 -0
- package/src/organisation-policies.mjs +448 -0
- package/src/packs.mjs +44 -0
- package/src/paths.mjs +62 -0
- package/src/persona-entitlements.mjs +438 -0
- package/src/persona-licence-config.mjs +98 -0
- package/src/persona-website-provider.mjs +134 -0
- package/src/persona-zip.mjs +87 -0
- package/src/personas.mjs +159 -0
- package/src/platform-metadata-analysis.mjs +314 -0
- package/src/policy-design-gates.mjs +623 -0
- package/src/policy-gate-integration.mjs +318 -0
- package/src/portfolio.mjs +509 -0
- package/src/power-platform-source-map.mjs +190 -0
- package/src/project.mjs +449 -0
- package/src/prototype-iterations.mjs +730 -0
- package/src/repository-source-map.mjs +603 -0
- package/src/runtime/afk-conductor.mjs +973 -0
- package/src/runtime/context-assembly.mjs +457 -0
- package/src/runtime/context-benchmarks.mjs +115 -0
- package/src/runtime/dashboard-actions.mjs +109 -0
- package/src/runtime/dashboard-handoffs.mjs +149 -0
- package/src/runtime/dashboard-server.mjs +1272 -0
- package/src/runtime/dashboard.mjs +197 -0
- package/src/runtime/database.mjs +789 -0
- package/src/runtime/error-reporting.mjs +581 -0
- package/src/runtime/evidence-depth-workspace.mjs +412 -0
- package/src/runtime/execution-leases.mjs +299 -0
- package/src/runtime/guided-discovery.mjs +350 -0
- package/src/runtime/guided-intents.mjs +517 -0
- package/src/runtime/impact-analysis.mjs +535 -0
- package/src/runtime/intents.mjs +222 -0
- package/src/runtime/knowledge.mjs +86 -0
- package/src/runtime/lifecycle-hooks.mjs +1239 -0
- package/src/runtime/mcp-config.mjs +110 -0
- package/src/runtime/mcp-server.mjs +1885 -0
- package/src/runtime/palace.mjs +362 -0
- package/src/runtime/paths.mjs +58 -0
- package/src/runtime/persona-engagement.mjs +255 -0
- package/src/runtime/phase-contributions.mjs +594 -0
- package/src/runtime/policy-workspace.mjs +170 -0
- package/src/runtime/prototype-iterations.mjs +235 -0
- package/src/runtime/provider-adapters.mjs +163 -0
- package/src/runtime/repository-index.mjs +838 -0
- package/src/runtime/runs.mjs +185 -0
- package/src/runtime/security-validation.mjs +1230 -0
- package/src/runtime/starter-materialisation.mjs +1155 -0
- package/src/runtime/team-hub-client.mjs +479 -0
- package/src/runtime/team-hub-database.mjs +288 -0
- package/src/runtime/team-hub-server.mjs +191 -0
- package/src/runtime/team-hub.mjs +110 -0
- package/src/runtime/tree-sitter-index.mjs +390 -0
- package/src/runtime/version.mjs +1 -0
- package/src/runtime/work.mjs +633 -0
- package/src/salesforce-source-map.mjs +212 -0
- package/src/security-validation-config.mjs +224 -0
- package/src/solution-readiness.mjs +620 -0
- package/src/starter-materialisation-contract.mjs +407 -0
- package/src/task-graph.mjs +544 -0
- package/src/team-hub-resources.mjs +239 -0
- package/src/team-hub.mjs +242 -0
- package/src/test-scenarios.mjs +622 -0
- package/src/validation-config.mjs +289 -0
- package/templates/SPECS/1.Scope/personas/registry.yaml +12 -0
- package/templates/SPECS/5.Strategy/patterns/context-packet.md +119 -0
- package/templates/SPECS/6.Build/_tracker-template.md +16 -0
- package/templates/SPECS/pipeline.yaml +62 -0
- package/templates/discovery-answers.yaml +86 -0
- package/templates/intent-body.md +21 -0
- package/tests/fixtures/context-benchmarks.json +9 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import {
|
|
4
|
+
EVIDENCE_DEPTH_DIMENSIONS,
|
|
5
|
+
compareEvidenceDepthRuns,
|
|
6
|
+
prepareEvidenceDepth,
|
|
7
|
+
readEvidenceDepthRun,
|
|
8
|
+
readEvidenceDepthStatus,
|
|
9
|
+
recordEvidenceDepthRun,
|
|
10
|
+
validateEvidenceDepthPreparation,
|
|
11
|
+
} from '../evidence-depth.mjs';
|
|
12
|
+
import { atomicJson } from '../delivery-documents.mjs';
|
|
13
|
+
import { projectPaths } from '../paths.mjs';
|
|
14
|
+
import { repositoryIndexFreshness, repositoryIndexStatus, repositorySourceMapCoverage } from './repository-index.mjs';
|
|
15
|
+
import { runtimePaths } from './paths.mjs';
|
|
16
|
+
import { selectEvidenceDepthPersonas } from './persona-engagement.mjs';
|
|
17
|
+
|
|
18
|
+
const WORKSPACE_SCHEMA = 'ewai.evidence-depth-workspace/v1';
|
|
19
|
+
const MAX_PREPARATION_PERSONAS = 8;
|
|
20
|
+
const ownerAuthorities = new Set(['declared', 'confirmed']);
|
|
21
|
+
const contradictionStates = new Set(['none', 'declared-versus-observed', 'observed-versus-observed', 'declared-versus-declared', 'unresolved']);
|
|
22
|
+
const questionText = Object.freeze({
|
|
23
|
+
'missing-owner-boundary': 'Which systems or identities are intended to cross this boundary?',
|
|
24
|
+
'missing-data-classification': 'Which data classifications and handling limits apply here?',
|
|
25
|
+
'missing-product-outcome': 'Which owner-confirmed user outcome should this behaviour support?',
|
|
26
|
+
'missing-delivery-expectation': 'Which delivery and validation expectations must remain mandatory?',
|
|
27
|
+
'missing-governance-owner': 'Who owns the applicable governance decision and review?',
|
|
28
|
+
'missing-recovery-owner': 'Who owns recovery, and what outcome must restoration achieve?',
|
|
29
|
+
'source-map-analysis-failures': 'How should the retained Source Map analysis failures be resolved or bounded?',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function fail(message) {
|
|
33
|
+
const error = new Error(`Evidence depth workspace: ${message}`);
|
|
34
|
+
error.statusCode = 409;
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function object(value, label) {
|
|
39
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) fail(`${label} must be an object`);
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function knownFields(value, allowed, label) {
|
|
44
|
+
for (const key of Object.keys(value)) if (!allowed.includes(key)) fail(`${label} has unknown field ${key}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function safeText(value, label, maximum = 200, optional = false) {
|
|
48
|
+
const cleaned = String(value ?? '').trim();
|
|
49
|
+
if (!cleaned && !optional) fail(`${label} is required`);
|
|
50
|
+
if (cleaned.length > maximum || cleaned.includes('..') || cleaned.startsWith('/')) fail(`${label} must be a bounded safe value`);
|
|
51
|
+
return cleaned;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function hash(value) {
|
|
55
|
+
return `sha256:${createHash('sha256').update(JSON.stringify(value)).digest('hex')}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function statusSummary(status) {
|
|
59
|
+
const run = status?.run ?? {};
|
|
60
|
+
const parsed = (() => {
|
|
61
|
+
try { return typeof run.summary === 'string' ? JSON.parse(run.summary) : run.summary ?? {}; } catch { return {}; }
|
|
62
|
+
})();
|
|
63
|
+
const repositories = Number(status?.repositories ?? parsed.repositories ?? (() => {
|
|
64
|
+
try { return Object.keys(JSON.parse(run.repos_json ?? '{}')).length; } catch { return 0; }
|
|
65
|
+
})());
|
|
66
|
+
return {
|
|
67
|
+
runId: Number(status?.runId ?? run.id ?? 0),
|
|
68
|
+
repositories: Number.isFinite(repositories) ? repositories : 0,
|
|
69
|
+
files: Number(status?.files ?? status?.counts?.files ?? parsed.files ?? 0),
|
|
70
|
+
parsed: Number(status?.parsed ?? status?.counts?.parsed ?? parsed.parsed ?? 0),
|
|
71
|
+
symbols: Number(status?.symbols ?? parsed.symbols ?? 0),
|
|
72
|
+
profileDigest: String(status?.profileDigest ?? run.profile_digest ?? 'unspecified'),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function coverageSummary(coverage) {
|
|
77
|
+
const outcomes = coverage?.outcomes ?? {};
|
|
78
|
+
return {
|
|
79
|
+
runId: Number(coverage?.runId ?? 0),
|
|
80
|
+
outcomes: {
|
|
81
|
+
analysed: Number(outcomes.analysed ?? 0),
|
|
82
|
+
inventory_only: Number(outcomes.inventory_only ?? 0),
|
|
83
|
+
skipped_sensitive: Number(outcomes.skipped_sensitive ?? 0),
|
|
84
|
+
skipped_oversized: Number(outcomes.skipped_oversized ?? 0),
|
|
85
|
+
analysis_failed: Number(outcomes.analysis_failed ?? 0),
|
|
86
|
+
},
|
|
87
|
+
warningCount: Array.isArray(coverage?.warnings) ? coverage.warnings.length : 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function readSourceMap(projectRoot, provided) {
|
|
92
|
+
if (provided) {
|
|
93
|
+
const source = object(provided, 'Source Map fixture');
|
|
94
|
+
return { freshness: source.freshness, status: source.status, coverage: source.coverage };
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
freshness: repositoryIndexFreshness(projectRoot),
|
|
98
|
+
status: repositoryIndexStatus(projectRoot),
|
|
99
|
+
coverage: repositorySourceMapCoverage(projectRoot),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function normalizeOwnerEvidence(value = []) {
|
|
104
|
+
if (!Array.isArray(value) || value.length > 50) fail('ownerEvidence must contain at most 50 entries');
|
|
105
|
+
const entries = value.map((item, index) => {
|
|
106
|
+
const entry = object(item, `owner evidence ${index + 1}`);
|
|
107
|
+
knownFields(entry, ['id', 'dimension', 'authority', 'evidenceDigest', 'answerCode', 'reasonCode', 'contradiction'], `owner evidence ${index + 1}`);
|
|
108
|
+
const dimension = safeText(entry.dimension, `owner evidence ${index + 1} dimension`);
|
|
109
|
+
if (!EVIDENCE_DEPTH_DIMENSIONS.includes(dimension)) fail(`owner evidence ${index + 1} dimension is unsupported`);
|
|
110
|
+
const authority = safeText(entry.authority, `owner evidence ${index + 1} authority`);
|
|
111
|
+
if (!ownerAuthorities.has(authority)) fail(`owner evidence ${index + 1} authority must be declared or confirmed`);
|
|
112
|
+
const contradiction = safeText(entry.contradiction ?? 'none', `owner evidence ${index + 1} contradiction`);
|
|
113
|
+
if (!contradictionStates.has(contradiction)) fail(`owner evidence ${index + 1} contradiction is unsupported`);
|
|
114
|
+
return {
|
|
115
|
+
id: safeText(entry.id, `owner evidence ${index + 1} id`),
|
|
116
|
+
dimension,
|
|
117
|
+
authority,
|
|
118
|
+
evidenceDigest: safeText(entry.evidenceDigest, `owner evidence ${index + 1} digest`),
|
|
119
|
+
answerCode: safeText(entry.answerCode, `owner evidence ${index + 1} answer code`),
|
|
120
|
+
reasonCode: safeText(entry.reasonCode, `owner evidence ${index + 1} reason code`),
|
|
121
|
+
contradiction,
|
|
122
|
+
};
|
|
123
|
+
}).sort((left, right) => left.id.localeCompare(right.id));
|
|
124
|
+
if (new Set(entries.map(({ id }) => id)).size !== entries.length) fail('ownerEvidence contains duplicate IDs');
|
|
125
|
+
return entries;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function projectFingerprint(projectRoot) {
|
|
129
|
+
const { configPath } = projectPaths(projectRoot);
|
|
130
|
+
return hash({ pipeline: existsSync(configPath) ? createHash('sha256').update(readFileSync(configPath)).digest('hex') : 'missing' });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function recommendation(dimension, summary, coverage, ownerForDimension) {
|
|
134
|
+
const large = summary.files >= 250 || summary.repositories > 1 || summary.symbols >= 1_000;
|
|
135
|
+
const uncertain = coverage.outcomes.analysis_failed > 0 || coverage.outcomes.inventory_only > 0;
|
|
136
|
+
const depth = {
|
|
137
|
+
architecture: large ? 'deep' : 'standard',
|
|
138
|
+
data: coverage.outcomes.skipped_sensitive > 0 || large ? 'deep' : 'standard',
|
|
139
|
+
security: coverage.outcomes.skipped_sensitive > 0 || uncertain ? 'deep' : 'standard',
|
|
140
|
+
product: ownerForDimension.length ? 'standard' : 'deep',
|
|
141
|
+
delivery: uncertain || large ? 'deep' : 'standard',
|
|
142
|
+
governance: large ? 'deep' : 'standard',
|
|
143
|
+
operations: summary.repositories > 1 || !ownerForDimension.length ? 'deep' : 'standard',
|
|
144
|
+
}[dimension];
|
|
145
|
+
return depth;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function gapFor(dimension, condition, evidenceRefs, overrides = {}) {
|
|
149
|
+
return {
|
|
150
|
+
dimension,
|
|
151
|
+
condition,
|
|
152
|
+
currentStateCode: overrides.currentStateCode ?? 'repository-evidence-present',
|
|
153
|
+
intendedStateCode: overrides.intendedStateCode ?? 'owner-evidence-required',
|
|
154
|
+
evidenceRefs,
|
|
155
|
+
contradiction: overrides.contradiction ?? 'none',
|
|
156
|
+
owner: overrides.owner ?? 'project-owner',
|
|
157
|
+
disposition: 'open',
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function filterEngagement(engagement, selectedIds) {
|
|
162
|
+
return {
|
|
163
|
+
...engagement,
|
|
164
|
+
activePersonas: engagement.activePersonas.filter(({ id }) => selectedIds.has(id)),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function boundedPersonaEnsemble(currentEngagement, personasByDimension, currentDimension) {
|
|
169
|
+
const selected = [];
|
|
170
|
+
const selectedIds = new Set();
|
|
171
|
+
const add = (persona, dimension) => {
|
|
172
|
+
if (!persona || selectedIds.has(persona.id) || selected.length >= MAX_PREPARATION_PERSONAS) return;
|
|
173
|
+
selectedIds.add(persona.id);
|
|
174
|
+
selected.push({ persona, dimension });
|
|
175
|
+
};
|
|
176
|
+
const dimensions = [currentDimension, ...EVIDENCE_DEPTH_DIMENSIONS.filter((dimension) => dimension !== currentDimension)];
|
|
177
|
+
|
|
178
|
+
add(currentEngagement.activePersonas[0], currentDimension);
|
|
179
|
+
for (const dimension of dimensions) {
|
|
180
|
+
const active = personasByDimension[dimension]?.activePersonas ?? [];
|
|
181
|
+
add(active.find(({ id }) => !selectedIds.has(id)) ?? active[0], dimension);
|
|
182
|
+
}
|
|
183
|
+
for (const persona of currentEngagement.activePersonas) add(persona, currentDimension);
|
|
184
|
+
for (const dimension of dimensions) {
|
|
185
|
+
for (const persona of personasByDimension[dimension]?.activePersonas ?? []) add(persona, dimension);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
personas: selected.map(({ persona, dimension }) => ({ id: persona.id, tier: persona.tier, reasonCode: `${dimension}-evidence-lens` })),
|
|
190
|
+
currentEngagement: filterEngagement(currentEngagement, selectedIds),
|
|
191
|
+
personasByDimension: Object.fromEntries(EVIDENCE_DEPTH_DIMENSIONS.map((dimension) => [
|
|
192
|
+
dimension,
|
|
193
|
+
filterEngagement(personasByDimension[dimension], selectedIds),
|
|
194
|
+
])),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function buildInput(projectRoot, source, ownerEvidence, personas, input = {}) {
|
|
199
|
+
const summary = statusSummary(source.status);
|
|
200
|
+
const coverage = coverageSummary(source.coverage);
|
|
201
|
+
const mapEvidence = EVIDENCE_DEPTH_DIMENSIONS.map((dimension) => ({
|
|
202
|
+
id: `source-map:${dimension}`,
|
|
203
|
+
authority: 'observed',
|
|
204
|
+
kind: 'repository-fact',
|
|
205
|
+
digest: hash({ runId: summary.runId, dimension, counts: coverage.outcomes, profileDigest: summary.profileDigest }),
|
|
206
|
+
}));
|
|
207
|
+
const ownerEntries = ownerEvidence.map((entry) => ({
|
|
208
|
+
id: entry.id,
|
|
209
|
+
authority: entry.authority,
|
|
210
|
+
kind: 'owner-declaration',
|
|
211
|
+
digest: entry.evidenceDigest,
|
|
212
|
+
}));
|
|
213
|
+
const evidence = [...mapEvidence, ...ownerEntries];
|
|
214
|
+
const gaps = [];
|
|
215
|
+
const dimensions = EVIDENCE_DEPTH_DIMENSIONS.map((dimension) => {
|
|
216
|
+
const ownerForDimension = ownerEvidence.filter((entry) => entry.dimension === dimension);
|
|
217
|
+
const evidenceRefs = [`source-map:${dimension}`, ...ownerForDimension.map(({ id }) => id)];
|
|
218
|
+
const failed = dimension === 'architecture' || dimension === 'delivery' ? coverage.outcomes.analysis_failed : 0;
|
|
219
|
+
const missingOwner = ['data', 'security', 'product', 'delivery', 'governance', 'operations'].includes(dimension) && ownerForDimension.length === 0;
|
|
220
|
+
if (dimension === 'architecture' && coverage.outcomes.analysis_failed > 0) {
|
|
221
|
+
gaps.push(gapFor(dimension, 'source-map-analysis-failures', evidenceRefs, { currentStateCode: 'bounded-analysis-failures-retained', intendedStateCode: 'failures-reviewed-or-bounded', owner: 'technical-owner' }));
|
|
222
|
+
}
|
|
223
|
+
if (missingOwner) {
|
|
224
|
+
const condition = {
|
|
225
|
+
data: 'missing-data-classification', security: 'missing-owner-boundary', product: 'missing-product-outcome',
|
|
226
|
+
delivery: 'missing-delivery-expectation', governance: 'missing-governance-owner', operations: 'missing-recovery-owner',
|
|
227
|
+
}[dimension];
|
|
228
|
+
gaps.push(gapFor(dimension, condition, evidenceRefs));
|
|
229
|
+
}
|
|
230
|
+
for (const owner of ownerForDimension.filter(({ contradiction }) => contradiction !== 'none')) {
|
|
231
|
+
gaps.push(gapFor(dimension, `contradictory-${owner.answerCode}`, evidenceRefs, { contradiction: owner.contradiction, currentStateCode: 'repository-and-owner-evidence-conflict', intendedStateCode: 'named-reconciliation-required' }));
|
|
232
|
+
}
|
|
233
|
+
const required = Math.max(1, 1 + ownerForDimension.length + (failed ? 1 : 0));
|
|
234
|
+
const supported = Math.max(1, required - (missingOwner ? 1 : 0) - (failed ? 1 : 0));
|
|
235
|
+
return {
|
|
236
|
+
id: dimension,
|
|
237
|
+
recommendedDepth: recommendation(dimension, summary, coverage, ownerForDimension),
|
|
238
|
+
drivers: [
|
|
239
|
+
summary.files >= 250 ? 'large-repository-surface' : 'bounded-repository-surface',
|
|
240
|
+
summary.repositories > 1 ? 'multiple-repositories' : 'single-repository',
|
|
241
|
+
coverage.outcomes.analysis_failed > 0 ? 'retained-analysis-failures' : 'analysis-complete-for-supported-files',
|
|
242
|
+
ownerForDimension.length ? 'owner-evidence-present' : 'owner-evidence-missing',
|
|
243
|
+
],
|
|
244
|
+
evidenceRefs,
|
|
245
|
+
coverage: {
|
|
246
|
+
status: ownerForDimension.some(({ contradiction }) => contradiction !== 'none') ? 'contradictory' : missingOwner ? 'owner-evidence-required' : failed ? 'partial' : 'supported',
|
|
247
|
+
required,
|
|
248
|
+
supported,
|
|
249
|
+
excluded: coverage.outcomes.inventory_only + coverage.outcomes.skipped_sensitive + coverage.outcomes.skipped_oversized,
|
|
250
|
+
failed,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
const allConditions = gaps.map(({ condition }) => condition);
|
|
255
|
+
const currentDimension = EVIDENCE_DEPTH_DIMENSIONS.find((dimension) => gaps.some((gap) => gap.dimension === dimension)) ?? 'architecture';
|
|
256
|
+
const currentEngagement = selectEvidenceDepthPersonas({ dimension: currentDimension, gapConditions: allConditions, context: { focus: input.focus ?? '' } }, personas);
|
|
257
|
+
const candidatePersonasByDimension = {};
|
|
258
|
+
for (const dimension of EVIDENCE_DEPTH_DIMENSIONS) {
|
|
259
|
+
candidatePersonasByDimension[dimension] = selectEvidenceDepthPersonas({ dimension, gapConditions: gaps.filter((gap) => gap.dimension === dimension).map(({ condition }) => condition), context: { focus: input.focus ?? '' } }, personas);
|
|
260
|
+
}
|
|
261
|
+
const bounded = boundedPersonaEnsemble(currentEngagement, candidatePersonasByDimension, currentDimension);
|
|
262
|
+
return {
|
|
263
|
+
input: {
|
|
264
|
+
schema: 'ewai.evidence-depth-input/v1',
|
|
265
|
+
projectFingerprint: projectFingerprint(projectRoot),
|
|
266
|
+
sourceMap: {
|
|
267
|
+
runId: summary.runId,
|
|
268
|
+
digest: hash({ runId: summary.runId, counts: coverage.outcomes, files: summary.files, symbols: summary.symbols }),
|
|
269
|
+
profileDigest: summary.profileDigest.startsWith('sha256:') ? summary.profileDigest : hash(summary.profileDigest),
|
|
270
|
+
freshness: 'fresh',
|
|
271
|
+
},
|
|
272
|
+
contractVersions: ['ewai.archaeology/v1', 'ewai.discovery/v1', 'ewai.evidence-depth/v1'],
|
|
273
|
+
packVersions: [],
|
|
274
|
+
provider: { id: 'host-model', modelFamily: 'provider-neutral', capabilityRevision: 'structured-v1' },
|
|
275
|
+
exclusions: [
|
|
276
|
+
...(coverage.outcomes.inventory_only ? ['inventory-only-files'] : []),
|
|
277
|
+
...(coverage.outcomes.skipped_sensitive ? ['sensitive-files'] : []),
|
|
278
|
+
...(coverage.outcomes.skipped_oversized ? ['oversized-files'] : []),
|
|
279
|
+
],
|
|
280
|
+
predecessorId: '',
|
|
281
|
+
personas: bounded.personas,
|
|
282
|
+
evidence,
|
|
283
|
+
dimensions,
|
|
284
|
+
gaps,
|
|
285
|
+
grouping: { strategy: 'user-outcome', assignments: [] },
|
|
286
|
+
},
|
|
287
|
+
currentDimension,
|
|
288
|
+
personaEngagement: bounded.currentEngagement,
|
|
289
|
+
personasByDimension: bounded.personasByDimension,
|
|
290
|
+
coverage,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function questions(preparation, personasByDimension) {
|
|
295
|
+
return preparation.gaps.filter(({ disposition }) => disposition === 'open').map((gap) => ({
|
|
296
|
+
id: `Q-${gap.id.slice(4)}`,
|
|
297
|
+
gapId: gap.id,
|
|
298
|
+
dimension: gap.dimension,
|
|
299
|
+
prompt: questionText[gap.condition] ?? 'What owner evidence would resolve or appropriately bound this gap?',
|
|
300
|
+
reasonCode: gap.condition,
|
|
301
|
+
evidenceRefs: gap.evidenceRefs,
|
|
302
|
+
activePersonas: personasByDimension[gap.dimension]?.activePersonas ?? [],
|
|
303
|
+
resolutionRoute: gap.condition === 'source-map-analysis-failures' ? 'technical-review-or-explicit-bounded-disposition' : 'named-owner-declaration-or-honest-unknown',
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function safeRuns(projectRoot) {
|
|
308
|
+
try { return readEvidenceDepthStatus(projectRoot).runs; } catch { return []; }
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function staleWorkspace(projectRoot, freshness) {
|
|
312
|
+
return {
|
|
313
|
+
schema: WORKSPACE_SCHEMA,
|
|
314
|
+
status: freshness?.reason === 'no-completed-index-run' ? 'source-map-missing' : 'source-map-stale',
|
|
315
|
+
freshness,
|
|
316
|
+
runs: safeRuns(projectRoot),
|
|
317
|
+
preparation: null,
|
|
318
|
+
questions: [],
|
|
319
|
+
activePersonas: [],
|
|
320
|
+
recovery: { command: 'node bin/ewai index refresh --project .', label: 'Refresh Source Map' },
|
|
321
|
+
authority: { repository: 'Source Map', owner: 'Guided Discovery', personas: 'advisory', depthDecision: 'named owner' },
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function prepareEvidenceDepthWorkspace(projectRoot, input = {}, options = {}) {
|
|
326
|
+
const request = object(input, 'prepare request');
|
|
327
|
+
knownFields(request, ['focus'], 'prepare request');
|
|
328
|
+
const source = readSourceMap(projectRoot, options.sourceMap);
|
|
329
|
+
if (source.freshness?.status !== 'fresh' || source.freshness?.stale === true) {
|
|
330
|
+
fail('refresh the Source Map before preparing a governed evidence-depth run');
|
|
331
|
+
}
|
|
332
|
+
const owners = normalizeOwnerEvidence(options.ownerEvidence ?? []);
|
|
333
|
+
const composed = buildInput(projectRoot, source, owners, options.personas ?? [], request);
|
|
334
|
+
const preparation = prepareEvidenceDepth(composed.input, { now: options.now });
|
|
335
|
+
atomicJson(runtimePaths(projectRoot).evidenceDepthPreparationPath, preparation);
|
|
336
|
+
const plannedQuestions = questions(preparation, composed.personasByDimension);
|
|
337
|
+
return {
|
|
338
|
+
schema: WORKSPACE_SCHEMA,
|
|
339
|
+
status: plannedQuestions.length ? 'ready-to-investigate' : 'ready-to-group-gaps',
|
|
340
|
+
freshness: source.freshness,
|
|
341
|
+
coverage: composed.coverage,
|
|
342
|
+
preparation,
|
|
343
|
+
questions: plannedQuestions,
|
|
344
|
+
currentDimension: composed.currentDimension,
|
|
345
|
+
activePersonas: composed.personaEngagement.activePersonas,
|
|
346
|
+
personasByDimension: composed.personasByDimension,
|
|
347
|
+
runs: safeRuns(projectRoot),
|
|
348
|
+
premium: composed.personaEngagement.premium,
|
|
349
|
+
authority: { repository: 'Source Map', owner: 'Guided Discovery', personas: 'advisory', depthDecision: 'named owner' },
|
|
350
|
+
recovery: null,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function readEvidenceDepthWorkspace(projectRoot, options = {}) {
|
|
355
|
+
const source = readSourceMap(projectRoot, options.sourceMap);
|
|
356
|
+
if (source.freshness?.status !== 'fresh' || source.freshness?.stale === true) return staleWorkspace(projectRoot, source.freshness);
|
|
357
|
+
const path = runtimePaths(projectRoot).evidenceDepthPreparationPath;
|
|
358
|
+
if (!existsSync(path)) {
|
|
359
|
+
return {
|
|
360
|
+
schema: WORKSPACE_SCHEMA,
|
|
361
|
+
status: 'not-prepared',
|
|
362
|
+
freshness: source.freshness,
|
|
363
|
+
coverage: coverageSummary(source.coverage),
|
|
364
|
+
preparation: null,
|
|
365
|
+
questions: [],
|
|
366
|
+
activePersonas: [],
|
|
367
|
+
personasByDimension: {},
|
|
368
|
+
runs: safeRuns(projectRoot),
|
|
369
|
+
premium: { installed: (options.personas ?? []).some(({ tier }) => tier === 'premium'), reason: 'Prepare depth to engage relevant personas.' },
|
|
370
|
+
authority: { repository: 'Source Map', owner: 'Guided Discovery', personas: 'advisory', depthDecision: 'named owner' },
|
|
371
|
+
recovery: { command: 'node bin/ewai archaeology depth-prepare --project .', label: 'Prepare evidence depth' },
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const preparation = validateEvidenceDepthPreparation(JSON.parse(readFileSync(path, 'utf8')));
|
|
375
|
+
const selectedIds = new Set(preparation.activePersonas.map(({ id }) => id));
|
|
376
|
+
const personasByDimension = Object.fromEntries(EVIDENCE_DEPTH_DIMENSIONS.map((dimension) => [dimension, filterEngagement(
|
|
377
|
+
selectEvidenceDepthPersonas({ dimension, gapConditions: preparation.gaps.filter((gap) => gap.dimension === dimension).map(({ condition }) => condition) }, options.personas ?? []),
|
|
378
|
+
selectedIds,
|
|
379
|
+
)]));
|
|
380
|
+
const plannedQuestions = questions(preparation, personasByDimension);
|
|
381
|
+
const currentDimension = EVIDENCE_DEPTH_DIMENSIONS.find((dimension) => plannedQuestions.some((question) => question.dimension === dimension)) ?? 'architecture';
|
|
382
|
+
return {
|
|
383
|
+
schema: WORKSPACE_SCHEMA,
|
|
384
|
+
status: plannedQuestions.length ? 'ready-to-investigate' : 'ready-to-group-gaps',
|
|
385
|
+
freshness: source.freshness,
|
|
386
|
+
coverage: coverageSummary(source.coverage),
|
|
387
|
+
preparation,
|
|
388
|
+
questions: plannedQuestions,
|
|
389
|
+
currentDimension,
|
|
390
|
+
activePersonas: personasByDimension[currentDimension].activePersonas,
|
|
391
|
+
personasByDimension,
|
|
392
|
+
runs: safeRuns(projectRoot),
|
|
393
|
+
premium: personasByDimension[currentDimension].premium,
|
|
394
|
+
authority: { repository: 'Source Map', owner: 'Guided Discovery', personas: 'advisory', depthDecision: 'named owner' },
|
|
395
|
+
recovery: null,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export function recordEvidenceDepthWorkspaceRun(projectRoot, input, options = {}) {
|
|
400
|
+
const path = runtimePaths(projectRoot).evidenceDepthPreparationPath;
|
|
401
|
+
if (!existsSync(path)) fail('prepare evidence depth before recording a reviewed run');
|
|
402
|
+
const preparation = validateEvidenceDepthPreparation(JSON.parse(readFileSync(path, 'utf8')));
|
|
403
|
+
return recordEvidenceDepthRun(projectRoot, preparation, input, options);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export function compareEvidenceDepthWorkspaceRuns(projectRoot, input) {
|
|
407
|
+
const request = object(input, 'comparison request');
|
|
408
|
+
knownFields(request, ['leftRunId', 'rightRunId'], 'comparison request');
|
|
409
|
+
const left = readEvidenceDepthRun(projectRoot, safeText(request.leftRunId, 'left run ID'));
|
|
410
|
+
const right = readEvidenceDepthRun(projectRoot, safeText(request.rightRunId, 'right run ID'));
|
|
411
|
+
return compareEvidenceDepthRuns(left, right);
|
|
412
|
+
}
|