framework-aidf 0.0.0-stage → 0.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/CHANGELOG.md +174 -0
- package/INSTALLATION.md +140 -0
- package/LICENSE +21 -0
- package/QODER.md +88 -0
- package/README.md +142 -2
- package/UTILISATION.md +188 -0
- package/assets/adapters/qoder/agents/aidf-orchestrator.md +30 -0
- package/assets/adapters/qoder/rules/00-core.md +28 -0
- package/assets/adapters/qoder/rules/10-security.md +33 -0
- package/assets/adapters/qoder/rules/20-context.md +39 -0
- package/assets/core/AGENTS.fragment.md +18 -0
- package/assets/core/AIDF.md +107 -0
- package/assets/docs/APPFLOW.md +66 -0
- package/assets/docs/BACKEND.md +71 -0
- package/assets/docs/CHANGELOG.md +25 -0
- package/assets/docs/CONVENTIONS.md +95 -0
- package/assets/docs/DECISIONS.md +60 -0
- package/assets/docs/PLAN.md +53 -0
- package/assets/docs/PRD.md +88 -0
- package/assets/docs/SECURITY.md +94 -0
- package/assets/docs/TRD.md +78 -0
- package/assets/docs/UI-UX.md +71 -0
- package/assets/docs/constitution.md +86 -0
- package/assets/hooks/audit.mjs +45 -0
- package/assets/hooks/session-context.mjs +53 -0
- package/assets/integrations/spec-kit/mapping.yaml +92 -0
- package/assets/knowledge/best-practices/testing.md +53 -0
- package/assets/knowledge/best-practices/web-dev-baseline.md +39 -0
- package/assets/knowledge/rules/api.md +45 -0
- package/assets/knowledge/rules/sql.md +44 -0
- package/assets/knowledge/rules/typescript.md +50 -0
- package/assets/knowledge/security-references/owasp-baseline.md +58 -0
- package/assets/registry/activation-map.yaml +83 -0
- package/assets/registry/dependencies.yaml +35 -0
- package/assets/registry/skills.yaml +541 -0
- package/assets/registry/sources.yaml +396 -0
- package/assets/schemas/architecture/v1.json +110 -0
- package/assets/schemas/constraints/v1.json +93 -0
- package/assets/schemas/decision/v1.json +106 -0
- package/assets/schemas/discovery/v1.json +91 -0
- package/assets/schemas/requirement/v1.json +136 -0
- package/assets/schemas/security/threat-model/v1.json +127 -0
- package/assets/schemas/test-plan/v1.json +108 -0
- package/assets/skills/aidf-architecture-review/SKILL.md +49 -0
- package/assets/skills/aidf-backend-implementation/SKILL.md +47 -0
- package/assets/skills/aidf-database-design/SKILL.md +48 -0
- package/assets/skills/aidf-devops-engineering/SKILL.md +41 -0
- package/assets/skills/aidf-documentation-maintenance/SKILL.md +41 -0
- package/assets/skills/aidf-frontend-implementation/SKILL.md +44 -0
- package/assets/skills/aidf-phase-transition/SKILL.md +48 -0
- package/assets/skills/aidf-product-analysis/SKILL.md +47 -0
- package/assets/skills/aidf-project-context/SKILL.md +57 -0
- package/assets/skills/aidf-requirements-engineering/SKILL.md +52 -0
- package/assets/skills/aidf-security-review/SKILL.md +57 -0
- package/assets/skills/aidf-testing-validation/SKILL.md +48 -0
- package/assets/skills/aidf-ui-ux-implementation/SKILL.md +43 -0
- package/assets/workflows/gates.yaml +232 -0
- package/assets/workflows/phases.yaml +161 -0
- package/bin/aidf.mjs +12 -0
- package/demo/run-demo.mjs +97 -0
- package/docs/aidf/ADR-001-artefacts-architectur.md +126 -0
- package/docs/aidf/ADR-002-requirements-registry.md +145 -0
- package/docs/aidf/ADR-003-traceability-chain.md +145 -0
- package/docs/aidf/ADR-004-markdown-generation.md +134 -0
- package/docs/aidf/ADR-005-validation-and-tests.md +170 -0
- package/docs/aidf/ADR-006-cli-commands.md +189 -0
- package/docs/aidf/ADR-007-compatibility-and-migration.md +119 -0
- package/docs/aidf/ADR-008-schema-versioning.md +115 -0
- package/docs/aidf/ADR-009-artefacts-scope.md +84 -0
- package/docs/aidf/ARCHITECTURE.md +137 -0
- package/docs/aidf/COMPATIBILITY.md +90 -0
- package/docs/aidf/DECISIONS.md +200 -0
- package/docs/aidf/FRAMEWORK.md +38 -0
- package/docs/aidf/IDE-QODER.md +61 -0
- package/docs/aidf/INSTALL.md +99 -0
- package/docs/aidf/INVENTORY.md +72 -0
- package/docs/aidf/L1-ARCHITECTURE-RAPPORT.md +353 -0
- package/docs/aidf/LIMITATIONS.md +69 -0
- package/docs/aidf/MATRICE-0.1.0-vers-0.2.0.md +155 -0
- package/docs/aidf/SECURITY.md +86 -0
- package/docs/aidf/SKILLS.md +78 -0
- package/docs/aidf/SPECKIT.md +67 -0
- package/docs/aidf/USAGE.md +113 -0
- package/docs/aidf/VALIDATION.md +55 -0
- package/package.json +37 -4
- package/src/cli.mjs +148 -0
- package/src/commands/artefacts.mjs +129 -0
- package/src/commands/config.mjs +130 -0
- package/src/commands/context.mjs +55 -0
- package/src/commands/decision.mjs +142 -0
- package/src/commands/design.mjs +141 -0
- package/src/commands/docs.mjs +133 -0
- package/src/commands/doctor.mjs +210 -0
- package/src/commands/evidence.mjs +178 -0
- package/src/commands/install.mjs +154 -0
- package/src/commands/release.mjs +214 -0
- package/src/commands/requirements.mjs +196 -0
- package/src/commands/resources.mjs +181 -0
- package/src/commands/scan.mjs +139 -0
- package/src/commands/security.mjs +97 -0
- package/src/commands/setup.mjs +68 -0
- package/src/commands/skills.mjs +204 -0
- package/src/commands/speckit.mjs +78 -0
- package/src/commands/tests.mjs +81 -0
- package/src/commands/traceability.mjs +116 -0
- package/src/commands/uninstall.mjs +238 -0
- package/src/commands/validate.mjs +84 -0
- package/src/commands/workflow.mjs +137 -0
- package/src/core/adapters/base.mjs +32 -0
- package/src/core/adapters/generic.mjs +70 -0
- package/src/core/adapters/index.mjs +24 -0
- package/src/core/adapters/opencode.mjs +115 -0
- package/src/core/adapters/qoder.mjs +228 -0
- package/src/core/artefacts/index.mjs +1 -0
- package/src/core/artefacts/validation.mjs +161 -0
- package/src/core/bootstrap.mjs +179 -0
- package/src/core/config.mjs +123 -0
- package/src/core/context.mjs +187 -0
- package/src/core/design-engineering/complexity-classifier.mjs +78 -0
- package/src/core/design-engineering/engine.mjs +197 -0
- package/src/core/design-engineering/fallback/mockups.mjs +221 -0
- package/src/core/design-engineering/fallback/wireframes.mjs +114 -0
- package/src/core/design-engineering/figma/validators.mjs +178 -0
- package/src/core/design-engineering/index.mjs +9 -0
- package/src/core/design-engineering/visual-parity/capture.mjs +172 -0
- package/src/core/detect.mjs +220 -0
- package/src/core/docsgen.mjs +175 -0
- package/src/core/evidence.mjs +210 -0
- package/src/core/installer.mjs +377 -0
- package/src/core/manifest.mjs +53 -0
- package/src/core/paths.mjs +94 -0
- package/src/core/requirements/index.mjs +13 -0
- package/src/core/requirements/registry.mjs +234 -0
- package/src/core/resource-inventory.mjs +434 -0
- package/src/core/resources.mjs +280 -0
- package/src/core/security/threat-model.mjs +235 -0
- package/src/core/skills.mjs +353 -0
- package/src/core/source-skills.mjs +213 -0
- package/src/core/speckit.mjs +195 -0
- package/src/core/technology-decision/analyzer-deterministic.mjs +240 -0
- package/src/core/technology-decision/engine.mjs +157 -0
- package/src/core/technology-decision/generator.mjs +204 -0
- package/src/core/technology-decision/index.mjs +17 -0
- package/src/core/technology-decision/options/index.mjs +10 -0
- package/src/core/testplan.mjs +176 -0
- package/src/core/traceability/chain.mjs +488 -0
- package/src/core/traceability/index.mjs +12 -0
- package/src/core/workflow.mjs +471 -0
- package/src/util/args.mjs +69 -0
- package/src/util/frontmatter.mjs +26 -0
- package/src/util/fsx.mjs +208 -0
- package/src/util/logger.mjs +74 -0
- package/src/util/text.mjs +66 -0
- package/src/util/yaml.mjs +379 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { existsSync } from '../util/fsx.mjs';
|
|
4
|
+
|
|
5
|
+
export const FRAMEWORK_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
6
|
+
export const AIDF_DIR = '.aidf';
|
|
7
|
+
export const AIDF_VERSION = '0.2.0';
|
|
8
|
+
|
|
9
|
+
export const DOCUMENTS = [
|
|
10
|
+
'PRD',
|
|
11
|
+
'TRD',
|
|
12
|
+
'APPFLOW',
|
|
13
|
+
'UI-UX',
|
|
14
|
+
'BACKEND',
|
|
15
|
+
'PLAN',
|
|
16
|
+
'SECURITY',
|
|
17
|
+
'CONVENTIONS',
|
|
18
|
+
'constitution',
|
|
19
|
+
'DECISIONS',
|
|
20
|
+
'CHANGELOG',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export const DOC_STATUSES = ['DRAFT', 'VALIDATED', 'BLOCKED', 'OUTDATED', 'NOT_APPLICABLE'];
|
|
24
|
+
|
|
25
|
+
export const PHASES = [
|
|
26
|
+
'intake',
|
|
27
|
+
'discovery',
|
|
28
|
+
'specification',
|
|
29
|
+
'planning',
|
|
30
|
+
'implementation',
|
|
31
|
+
'testing',
|
|
32
|
+
'security',
|
|
33
|
+
'release',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export function aidfPaths(root) {
|
|
37
|
+
const base = path.join(root, AIDF_DIR);
|
|
38
|
+
const artefactsDir = path.join(base, 'artefacts');
|
|
39
|
+
return {
|
|
40
|
+
root,
|
|
41
|
+
base,
|
|
42
|
+
config: path.join(base, 'config.json'),
|
|
43
|
+
manifest: path.join(base, 'manifest.json'),
|
|
44
|
+
docs: path.join(base, 'docs'),
|
|
45
|
+
registry: path.join(base, 'registry'),
|
|
46
|
+
workflows: path.join(base, 'workflows'),
|
|
47
|
+
evidence: path.join(base, 'evidence'),
|
|
48
|
+
state: path.join(base, 'state'),
|
|
49
|
+
logs: path.join(base, 'logs'),
|
|
50
|
+
cache: path.join(base, 'cache'),
|
|
51
|
+
skills: path.join(base, 'skills'),
|
|
52
|
+
projectSkills: path.join(base, 'skills', 'project-skills'),
|
|
53
|
+
knowledge: path.join(base, 'knowledge'),
|
|
54
|
+
backups: path.join(base, 'backups'),
|
|
55
|
+
hooks: path.join(base, 'hooks'),
|
|
56
|
+
bin: path.join(base, 'bin'),
|
|
57
|
+
adapters: path.join(base, 'adapters'),
|
|
58
|
+
context: path.join(base, 'state', 'context'),
|
|
59
|
+
reports: path.join(base, 'reports'),
|
|
60
|
+
// L1 artefacts
|
|
61
|
+
artefacts: {
|
|
62
|
+
dir: artefactsDir,
|
|
63
|
+
requirements: path.join(artefactsDir, 'requirements.json'),
|
|
64
|
+
discovery: path.join(artefactsDir, 'discovery.json'),
|
|
65
|
+
constraints: path.join(artefactsDir, 'constraints.json'),
|
|
66
|
+
architecture: path.join(artefactsDir, 'architecture.json'),
|
|
67
|
+
testPlan: path.join(artefactsDir, 'test-plan.json'),
|
|
68
|
+
decisions: path.join(artefactsDir, 'decisions'),
|
|
69
|
+
security: path.join(artefactsDir, 'security'),
|
|
70
|
+
'security/threat-model': path.join(artefactsDir, 'security', 'threat-model.json'),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function findProjectRoot(startDir) {
|
|
76
|
+
let current = path.resolve(startDir);
|
|
77
|
+
for (;;) {
|
|
78
|
+
if (existsSync(path.join(current, AIDF_DIR, 'manifest.json'))) return current;
|
|
79
|
+
const parent = path.dirname(current);
|
|
80
|
+
if (parent === current) return null;
|
|
81
|
+
current = parent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function resolveProjectRoot(options = {}) {
|
|
86
|
+
if (options.target) return path.resolve(options.target);
|
|
87
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
88
|
+
if (found) return found;
|
|
89
|
+
return path.resolve(options.cwd ?? process.cwd());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function isInitialized(root) {
|
|
93
|
+
return existsSync(path.join(root, AIDF_DIR, 'manifest.json'));
|
|
94
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
loadRequirementsRegistry,
|
|
3
|
+
saveRequirementsRegistry,
|
|
4
|
+
addRequirement,
|
|
5
|
+
updateRequirement,
|
|
6
|
+
deleteRequirement,
|
|
7
|
+
calculateCoverage,
|
|
8
|
+
filterRequirements,
|
|
9
|
+
generateRequirementId,
|
|
10
|
+
REQUIREMENT_STATUSES,
|
|
11
|
+
REQUIREMENT_TYPES,
|
|
12
|
+
REQUIREMENT_PRIORITIES
|
|
13
|
+
} from './registry.mjs';
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { aidfPaths, AIDF_VERSION } from '../paths.mjs';
|
|
2
|
+
import { readJson, writeJson, exists, sha256Text } from '../../util/fsx.mjs';
|
|
3
|
+
|
|
4
|
+
export const REQUIREMENT_STATUSES = ['DRAFT', 'VALIDATED', 'BLOCKED', 'OUTDATED'];
|
|
5
|
+
export const REQUIREMENT_TYPES = ['FUNCTIONAL', 'NON_FUNCTIONAL'];
|
|
6
|
+
export const REQUIREMENT_PRIORITIES = ['must', 'should', 'could'];
|
|
7
|
+
export const REQUIREMENT_PATTERN = /^REQ-(F|NF)-\d{3}$/;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generate a stable requirement ID.
|
|
11
|
+
*/
|
|
12
|
+
export function generateRequirementId(type, index) {
|
|
13
|
+
if (!REQUIREMENT_TYPES.includes(type)) {
|
|
14
|
+
throw new Error(`Invalid requirement type: ${type}`);
|
|
15
|
+
}
|
|
16
|
+
return `REQ-${type === 'FUNCTIONAL' ? 'F' : 'NF'}-${String(index).padStart(3, '0')}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Load the requirements registry.
|
|
21
|
+
*/
|
|
22
|
+
export async function loadRequirementsRegistry(root) {
|
|
23
|
+
const { readJson } = await import('../../util/fsx.mjs');
|
|
24
|
+
const file = aidfPaths(root).artefacts.requirements;
|
|
25
|
+
|
|
26
|
+
const data = await readJson(file, null);
|
|
27
|
+
if (!data) {
|
|
28
|
+
return {
|
|
29
|
+
schemaVersion: '1.0.0',
|
|
30
|
+
requirements: [],
|
|
31
|
+
updatedAt: null
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Save the requirements registry.
|
|
40
|
+
*/
|
|
41
|
+
export async function saveRequirementsRegistry(root, registry) {
|
|
42
|
+
const { writeJson } = await import('../../util/fsx.mjs');
|
|
43
|
+
const file = aidfPaths(root).artefacts.requirements;
|
|
44
|
+
registry.updatedAt = new Date().toISOString();
|
|
45
|
+
await writeJson(file, registry);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Add a requirement to the registry.
|
|
50
|
+
*/
|
|
51
|
+
export async function addRequirement(root, requirement, options = {}) {
|
|
52
|
+
const registry = await loadRequirementsRegistry(root);
|
|
53
|
+
|
|
54
|
+
// Validate requirement ID
|
|
55
|
+
if (requirement.id && !REQUIREMENT_PATTERN.test(requirement.id)) {
|
|
56
|
+
throw new Error(`Invalid requirement ID format: ${requirement.id}. Must match: REQ-(F|NF)-XXX`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Generate ID if not provided
|
|
60
|
+
if (!requirement.id) {
|
|
61
|
+
const nextIndex = registry.requirements.length + 1;
|
|
62
|
+
requirement.id = generateRequirementId(requirement.type, nextIndex);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Check for duplicates
|
|
66
|
+
if (registry.requirements.some(r => r.id === requirement.id)) {
|
|
67
|
+
throw new Error(`Requirement ID already exists: ${requirement.id}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Set required fields
|
|
71
|
+
const now = new Date().toISOString();
|
|
72
|
+
const artifact = {
|
|
73
|
+
id: requirement.id,
|
|
74
|
+
schemaVersion: '1.0.0',
|
|
75
|
+
createdAt: now,
|
|
76
|
+
updatedAt: now,
|
|
77
|
+
status: requirement.status || 'DRAFT',
|
|
78
|
+
type: requirement.type,
|
|
79
|
+
title: requirement.title,
|
|
80
|
+
description: requirement.description,
|
|
81
|
+
priority: requirement.priority || 'should',
|
|
82
|
+
acceptanceCriteria: requirement.acceptanceCriteria || [],
|
|
83
|
+
source: {
|
|
84
|
+
type: options.human ? 'human' : 'generated',
|
|
85
|
+
author: options.human ? (options.by || 'human') : 'aidf',
|
|
86
|
+
createdAt: now,
|
|
87
|
+
generator: 'requirements-registry@1.0.0'
|
|
88
|
+
},
|
|
89
|
+
links: requirement.links || {},
|
|
90
|
+
validation: {
|
|
91
|
+
schemaVersion: '1.0.0',
|
|
92
|
+
timestamp: now,
|
|
93
|
+
valid: true,
|
|
94
|
+
errors: [],
|
|
95
|
+
warnings: []
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
registry.requirements.push(artifact);
|
|
100
|
+
await saveRequirementsRegistry(root, registry);
|
|
101
|
+
|
|
102
|
+
return artifact;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Update a requirement in the registry.
|
|
107
|
+
*/
|
|
108
|
+
export async function updateRequirement(root, id, updates, options = {}) {
|
|
109
|
+
const registry = await loadRequirementsRegistry(root);
|
|
110
|
+
const index = registry.requirements.findIndex(r => r.id === id);
|
|
111
|
+
|
|
112
|
+
if (index === -1) {
|
|
113
|
+
throw new Error(`Requirement not found: ${id}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Update fields
|
|
117
|
+
const existing = registry.requirements[index];
|
|
118
|
+
const updated = {
|
|
119
|
+
...existing,
|
|
120
|
+
...updates,
|
|
121
|
+
updatedAt: new Date().toISOString()
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
registry.requirements[index] = updated;
|
|
125
|
+
await saveRequirementsRegistry(root, registry);
|
|
126
|
+
|
|
127
|
+
return updated;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Mark a requirement as BLOCKED (soft delete).
|
|
132
|
+
*/
|
|
133
|
+
export async function deleteRequirement(root, id, options = {}) {
|
|
134
|
+
const registry = await loadRequirementsRegistry(root);
|
|
135
|
+
const index = registry.requirements.findIndex(r => r.id === id);
|
|
136
|
+
|
|
137
|
+
if (index === -1) {
|
|
138
|
+
throw new Error(`Requirement not found: ${id}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Mark as BLOCKED instead of removing
|
|
142
|
+
registry.requirements[index].status = 'BLOCKED';
|
|
143
|
+
registry.requirements[index].updatedAt = new Date().toISOString();
|
|
144
|
+
|
|
145
|
+
await saveRequirementsRegistry(root, registry);
|
|
146
|
+
return registry.requirements[index];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Calculate coverage for requirements.
|
|
151
|
+
* Coverage is computed, never declared.
|
|
152
|
+
* Returns { coverage, details }
|
|
153
|
+
*/
|
|
154
|
+
export async function calculateCoverage(root, options = {}) {
|
|
155
|
+
const registry = await loadRequirementsRegistry(root);
|
|
156
|
+
const { loadEvidenceIndex } = await import('../evidence.mjs');
|
|
157
|
+
|
|
158
|
+
const evidenceIndex = await loadEvidenceIndex(root);
|
|
159
|
+
const details = [];
|
|
160
|
+
|
|
161
|
+
for (const req of registry.requirements) {
|
|
162
|
+
const covered = checkRequirementCoverage(req, evidenceIndex);
|
|
163
|
+
details.push({
|
|
164
|
+
id: req.id,
|
|
165
|
+
status: req.status,
|
|
166
|
+
type: req.type,
|
|
167
|
+
covered,
|
|
168
|
+
tests: req.acceptanceCriteria.length,
|
|
169
|
+
passed: covered ? req.acceptanceCriteria.length : 0
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const total = details.length;
|
|
174
|
+
const covered = details.filter(d => d.covered).length;
|
|
175
|
+
const untested = details.filter(d => d.tests === 0).length;
|
|
176
|
+
const testedButNotPassing = details.filter(d => d.tests > 0 && !d.covered).length;
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
coverage: {
|
|
180
|
+
total,
|
|
181
|
+
covered,
|
|
182
|
+
untested,
|
|
183
|
+
testedButNotPassing
|
|
184
|
+
},
|
|
185
|
+
details
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Check if a single requirement is covered.
|
|
191
|
+
* A requirement is covered when ALL acceptance criteria have passing evidence.
|
|
192
|
+
*/
|
|
193
|
+
function checkRequirementCoverage(req, evidenceIndex) {
|
|
194
|
+
if (!req.acceptanceCriteria || req.acceptanceCriteria.length === 0) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Check each acceptance criterion
|
|
199
|
+
for (const criterion of req.acceptanceCriteria) {
|
|
200
|
+
const hasPassingEvidence = evidenceIndex.entries.some(entry => {
|
|
201
|
+
// Evidence must reference this requirement or its tests
|
|
202
|
+
const referencesReq = entry.links?.requirement === req.id;
|
|
203
|
+
const referencesTest = entry.links?.test === criterion.id;
|
|
204
|
+
return entry.status === 'PASS' && (referencesReq || referencesTest);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (!hasPassingEvidence) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Find requirements by type, status, or priority.
|
|
217
|
+
*/
|
|
218
|
+
export function filterRequirements(registry, filters = {}) {
|
|
219
|
+
let result = registry.requirements;
|
|
220
|
+
|
|
221
|
+
if (filters.type) {
|
|
222
|
+
result = result.filter(r => r.type === filters.type);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (filters.status) {
|
|
226
|
+
result = result.filter(r => r.status === filters.status);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (filters.priority) {
|
|
230
|
+
result = result.filter(r => r.priority === filters.priority);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return result;
|
|
234
|
+
}
|