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.
Files changed (154) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/INSTALLATION.md +140 -0
  3. package/LICENSE +21 -0
  4. package/QODER.md +88 -0
  5. package/README.md +142 -2
  6. package/UTILISATION.md +188 -0
  7. package/assets/adapters/qoder/agents/aidf-orchestrator.md +30 -0
  8. package/assets/adapters/qoder/rules/00-core.md +28 -0
  9. package/assets/adapters/qoder/rules/10-security.md +33 -0
  10. package/assets/adapters/qoder/rules/20-context.md +39 -0
  11. package/assets/core/AGENTS.fragment.md +18 -0
  12. package/assets/core/AIDF.md +107 -0
  13. package/assets/docs/APPFLOW.md +66 -0
  14. package/assets/docs/BACKEND.md +71 -0
  15. package/assets/docs/CHANGELOG.md +25 -0
  16. package/assets/docs/CONVENTIONS.md +95 -0
  17. package/assets/docs/DECISIONS.md +60 -0
  18. package/assets/docs/PLAN.md +53 -0
  19. package/assets/docs/PRD.md +88 -0
  20. package/assets/docs/SECURITY.md +94 -0
  21. package/assets/docs/TRD.md +78 -0
  22. package/assets/docs/UI-UX.md +71 -0
  23. package/assets/docs/constitution.md +86 -0
  24. package/assets/hooks/audit.mjs +45 -0
  25. package/assets/hooks/session-context.mjs +53 -0
  26. package/assets/integrations/spec-kit/mapping.yaml +92 -0
  27. package/assets/knowledge/best-practices/testing.md +53 -0
  28. package/assets/knowledge/best-practices/web-dev-baseline.md +39 -0
  29. package/assets/knowledge/rules/api.md +45 -0
  30. package/assets/knowledge/rules/sql.md +44 -0
  31. package/assets/knowledge/rules/typescript.md +50 -0
  32. package/assets/knowledge/security-references/owasp-baseline.md +58 -0
  33. package/assets/registry/activation-map.yaml +83 -0
  34. package/assets/registry/dependencies.yaml +35 -0
  35. package/assets/registry/skills.yaml +541 -0
  36. package/assets/registry/sources.yaml +396 -0
  37. package/assets/schemas/architecture/v1.json +110 -0
  38. package/assets/schemas/constraints/v1.json +93 -0
  39. package/assets/schemas/decision/v1.json +106 -0
  40. package/assets/schemas/discovery/v1.json +91 -0
  41. package/assets/schemas/requirement/v1.json +136 -0
  42. package/assets/schemas/security/threat-model/v1.json +127 -0
  43. package/assets/schemas/test-plan/v1.json +108 -0
  44. package/assets/skills/aidf-architecture-review/SKILL.md +49 -0
  45. package/assets/skills/aidf-backend-implementation/SKILL.md +47 -0
  46. package/assets/skills/aidf-database-design/SKILL.md +48 -0
  47. package/assets/skills/aidf-devops-engineering/SKILL.md +41 -0
  48. package/assets/skills/aidf-documentation-maintenance/SKILL.md +41 -0
  49. package/assets/skills/aidf-frontend-implementation/SKILL.md +44 -0
  50. package/assets/skills/aidf-phase-transition/SKILL.md +48 -0
  51. package/assets/skills/aidf-product-analysis/SKILL.md +47 -0
  52. package/assets/skills/aidf-project-context/SKILL.md +57 -0
  53. package/assets/skills/aidf-requirements-engineering/SKILL.md +52 -0
  54. package/assets/skills/aidf-security-review/SKILL.md +57 -0
  55. package/assets/skills/aidf-testing-validation/SKILL.md +48 -0
  56. package/assets/skills/aidf-ui-ux-implementation/SKILL.md +43 -0
  57. package/assets/workflows/gates.yaml +232 -0
  58. package/assets/workflows/phases.yaml +161 -0
  59. package/bin/aidf.mjs +12 -0
  60. package/demo/run-demo.mjs +97 -0
  61. package/docs/aidf/ADR-001-artefacts-architectur.md +126 -0
  62. package/docs/aidf/ADR-002-requirements-registry.md +145 -0
  63. package/docs/aidf/ADR-003-traceability-chain.md +145 -0
  64. package/docs/aidf/ADR-004-markdown-generation.md +134 -0
  65. package/docs/aidf/ADR-005-validation-and-tests.md +170 -0
  66. package/docs/aidf/ADR-006-cli-commands.md +189 -0
  67. package/docs/aidf/ADR-007-compatibility-and-migration.md +119 -0
  68. package/docs/aidf/ADR-008-schema-versioning.md +115 -0
  69. package/docs/aidf/ADR-009-artefacts-scope.md +84 -0
  70. package/docs/aidf/ARCHITECTURE.md +137 -0
  71. package/docs/aidf/COMPATIBILITY.md +90 -0
  72. package/docs/aidf/DECISIONS.md +200 -0
  73. package/docs/aidf/FRAMEWORK.md +38 -0
  74. package/docs/aidf/IDE-QODER.md +61 -0
  75. package/docs/aidf/INSTALL.md +99 -0
  76. package/docs/aidf/INVENTORY.md +72 -0
  77. package/docs/aidf/L1-ARCHITECTURE-RAPPORT.md +353 -0
  78. package/docs/aidf/LIMITATIONS.md +69 -0
  79. package/docs/aidf/MATRICE-0.1.0-vers-0.2.0.md +155 -0
  80. package/docs/aidf/SECURITY.md +86 -0
  81. package/docs/aidf/SKILLS.md +78 -0
  82. package/docs/aidf/SPECKIT.md +67 -0
  83. package/docs/aidf/USAGE.md +113 -0
  84. package/docs/aidf/VALIDATION.md +55 -0
  85. package/package.json +37 -4
  86. package/src/cli.mjs +148 -0
  87. package/src/commands/artefacts.mjs +129 -0
  88. package/src/commands/config.mjs +130 -0
  89. package/src/commands/context.mjs +55 -0
  90. package/src/commands/decision.mjs +142 -0
  91. package/src/commands/design.mjs +141 -0
  92. package/src/commands/docs.mjs +133 -0
  93. package/src/commands/doctor.mjs +210 -0
  94. package/src/commands/evidence.mjs +178 -0
  95. package/src/commands/install.mjs +154 -0
  96. package/src/commands/release.mjs +214 -0
  97. package/src/commands/requirements.mjs +196 -0
  98. package/src/commands/resources.mjs +181 -0
  99. package/src/commands/scan.mjs +139 -0
  100. package/src/commands/security.mjs +97 -0
  101. package/src/commands/setup.mjs +68 -0
  102. package/src/commands/skills.mjs +204 -0
  103. package/src/commands/speckit.mjs +78 -0
  104. package/src/commands/tests.mjs +81 -0
  105. package/src/commands/traceability.mjs +116 -0
  106. package/src/commands/uninstall.mjs +238 -0
  107. package/src/commands/validate.mjs +84 -0
  108. package/src/commands/workflow.mjs +137 -0
  109. package/src/core/adapters/base.mjs +32 -0
  110. package/src/core/adapters/generic.mjs +70 -0
  111. package/src/core/adapters/index.mjs +24 -0
  112. package/src/core/adapters/opencode.mjs +115 -0
  113. package/src/core/adapters/qoder.mjs +228 -0
  114. package/src/core/artefacts/index.mjs +1 -0
  115. package/src/core/artefacts/validation.mjs +161 -0
  116. package/src/core/bootstrap.mjs +179 -0
  117. package/src/core/config.mjs +123 -0
  118. package/src/core/context.mjs +187 -0
  119. package/src/core/design-engineering/complexity-classifier.mjs +78 -0
  120. package/src/core/design-engineering/engine.mjs +197 -0
  121. package/src/core/design-engineering/fallback/mockups.mjs +221 -0
  122. package/src/core/design-engineering/fallback/wireframes.mjs +114 -0
  123. package/src/core/design-engineering/figma/validators.mjs +178 -0
  124. package/src/core/design-engineering/index.mjs +9 -0
  125. package/src/core/design-engineering/visual-parity/capture.mjs +172 -0
  126. package/src/core/detect.mjs +220 -0
  127. package/src/core/docsgen.mjs +175 -0
  128. package/src/core/evidence.mjs +210 -0
  129. package/src/core/installer.mjs +377 -0
  130. package/src/core/manifest.mjs +53 -0
  131. package/src/core/paths.mjs +94 -0
  132. package/src/core/requirements/index.mjs +13 -0
  133. package/src/core/requirements/registry.mjs +234 -0
  134. package/src/core/resource-inventory.mjs +434 -0
  135. package/src/core/resources.mjs +280 -0
  136. package/src/core/security/threat-model.mjs +235 -0
  137. package/src/core/skills.mjs +353 -0
  138. package/src/core/source-skills.mjs +213 -0
  139. package/src/core/speckit.mjs +195 -0
  140. package/src/core/technology-decision/analyzer-deterministic.mjs +240 -0
  141. package/src/core/technology-decision/engine.mjs +157 -0
  142. package/src/core/technology-decision/generator.mjs +204 -0
  143. package/src/core/technology-decision/index.mjs +17 -0
  144. package/src/core/technology-decision/options/index.mjs +10 -0
  145. package/src/core/testplan.mjs +176 -0
  146. package/src/core/traceability/chain.mjs +488 -0
  147. package/src/core/traceability/index.mjs +12 -0
  148. package/src/core/workflow.mjs +471 -0
  149. package/src/util/args.mjs +69 -0
  150. package/src/util/frontmatter.mjs +26 -0
  151. package/src/util/fsx.mjs +208 -0
  152. package/src/util/logger.mjs +74 -0
  153. package/src/util/text.mjs +66 -0
  154. package/src/util/yaml.mjs +379 -0
@@ -0,0 +1,106 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aidf.dev/schemas/decision/v1",
4
+ "$defs": {
5
+ "source": {
6
+ "type": "object",
7
+ "required": ["type", "author", "createdAt"],
8
+ "properties": {
9
+ "type": { "enum": ["human", "generated", "derived"] },
10
+ "author": { "type": "string" },
11
+ "createdAt": { "type": "string", "format": "date-time" },
12
+ "generator": { "type": ["string", "null"] }
13
+ }
14
+ },
15
+ "linkage": {
16
+ "type": "object",
17
+ "properties": {
18
+ "implements": { "type": "array", "items": { "type": "string" } },
19
+ "designedBy": { "type": "array", "items": { "type": "string" } }
20
+ }
21
+ },
22
+ "validation": {
23
+ "type": "object",
24
+ "required": ["schemaVersion", "timestamp", "valid"],
25
+ "properties": {
26
+ "schemaVersion": { "type": "string" },
27
+ "timestamp": { "type": "string", "format": "date-time" },
28
+ "valid": { "type": "boolean" },
29
+ "errors": { "type": "array", "items": { "type": "string" } },
30
+ "warnings": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "adr": {
34
+ "type": "object",
35
+ "required": ["id", "title", "status", "date", "context", "options", "decision", "consequences"],
36
+ "properties": {
37
+ "id": { "type": "string", "pattern": "^ADR-\\d{3}$" },
38
+ "title": { "type": "string" },
39
+ "status": {
40
+ "type": "string",
41
+ "enum": ["proposed", "accepted", "superseded", "rejected", "BLOCKED"]
42
+ },
43
+ "date": { "type": "string", "format": "date-time" },
44
+ "deciders": {
45
+ "type": "array",
46
+ "items": { "type": "object" }
47
+ },
48
+ "related": {
49
+ "type": "array",
50
+ "items": { "type": "string" }
51
+ },
52
+ "context": { "type": "string" },
53
+ "options": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "object",
57
+ "required": ["name", "pros", "cons"],
58
+ "properties": {
59
+ "name": { "type": "string" },
60
+ "pros": { "type": "string" },
61
+ "cons": { "type": "string" }
62
+ }
63
+ }
64
+ },
65
+ "decision": { "type": "string" },
66
+ "consequences": { "type": "string" },
67
+ "evidence": {
68
+ "type": "array",
69
+ "items": { "type": "string" }
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "type": "object",
75
+ "required": ["id", "schemaVersion", "createdAt", "updatedAt", "status", "source", "links", "validation"],
76
+ "properties": {
77
+ "id": {
78
+ "type": "string",
79
+ "pattern": "^DECISIONS-\\d{3}$",
80
+ "description": "Decision log identifier"
81
+ },
82
+ "schemaVersion": {
83
+ "const": "1.0.0",
84
+ "description": "Schema version"
85
+ },
86
+ "createdAt": {
87
+ "type": "string",
88
+ "format": "date-time"
89
+ },
90
+ "updatedAt": {
91
+ "type": "string",
92
+ "format": "date-time"
93
+ },
94
+ "status": {
95
+ "type": "string",
96
+ "enum": ["DRAFT", "VALIDATED", "BLOCKED", "OUTDATED"]
97
+ },
98
+ "decisions": {
99
+ "type": "array",
100
+ "items": { "$ref": "#/$defs/adr" }
101
+ },
102
+ "source": { "$ref": "#/$defs/source" },
103
+ "links": { "$ref": "#/$defs/linkage" },
104
+ "validation": { "$ref": "#/$defs/validation" }
105
+ }
106
+ }
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aidf.dev/schemas/discovery/v1",
4
+ "$defs": {
5
+ "source": {
6
+ "type": "object",
7
+ "required": ["type", "author", "createdAt"],
8
+ "properties": {
9
+ "type": { "enum": ["human", "generated", "derived"] },
10
+ "author": { "type": "string" },
11
+ "createdAt": { "type": "string", "format": "date-time" },
12
+ "generator": { "type": ["string", "null"] }
13
+ }
14
+ },
15
+ "linkage": {
16
+ "type": "object",
17
+ "properties": {
18
+ "references": { "type": "array", "items": { "type": "string" } }
19
+ }
20
+ },
21
+ "validation": {
22
+ "type": "object",
23
+ "required": ["schemaVersion", "timestamp", "valid"],
24
+ "properties": {
25
+ "schemaVersion": { "type": "string" },
26
+ "timestamp": { "type": "string", "format": "date-time" },
27
+ "valid": { "type": "boolean" },
28
+ "errors": { "type": "array", "items": { "type": "string" } },
29
+ "warnings": { "type": "array", "items": { "type": "string" } }
30
+ }
31
+ },
32
+ "fact": {
33
+ "type": "object",
34
+ "required": ["id", "category", "description", "evidence"],
35
+ "properties": {
36
+ "id": { "type": "string" },
37
+ "category": {
38
+ "type": "string",
39
+ "enum": ["stack", "structure", "constraints", "resources", "risks", "open_questions"]
40
+ },
41
+ "description": { "type": "string", "minLength": 5 },
42
+ "evidence": {
43
+ "type": "array",
44
+ "items": { "type": "string" },
45
+ "description": "File references, command outputs, or evidence IDs"
46
+ },
47
+ "confidence": {
48
+ "type": "string",
49
+ "enum": ["high", "medium", "low"],
50
+ "description": "Based on evidence quality"
51
+ },
52
+ "assumption": {
53
+ "type": "boolean",
54
+ "description": "Is this a declared assumption?"
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "type": "object",
60
+ "required": ["id", "schemaVersion", "createdAt", "updatedAt", "status", "source", "links", "validation"],
61
+ "properties": {
62
+ "id": {
63
+ "type": "string",
64
+ "pattern": "^DISC-\\d{3}$",
65
+ "description": "Discovery report identifier"
66
+ },
67
+ "schemaVersion": {
68
+ "const": "1.0.0",
69
+ "description": "Schema version"
70
+ },
71
+ "createdAt": {
72
+ "type": "string",
73
+ "format": "date-time"
74
+ },
75
+ "updatedAt": {
76
+ "type": "string",
77
+ "format": "date-time"
78
+ },
79
+ "status": {
80
+ "type": "string",
81
+ "enum": ["DRAFT", "VALIDATED", "BLOCKED", "OUTDATED"]
82
+ },
83
+ "facts": {
84
+ "type": "array",
85
+ "items": { "$ref": "#/$defs/fact" }
86
+ },
87
+ "source": { "$ref": "#/$defs/source" },
88
+ "links": { "$ref": "#/$defs/linkage" },
89
+ "validation": { "$ref": "#/$defs/validation" }
90
+ }
91
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aidf.dev/schemas/requirement/v1",
4
+ "$defs": {
5
+ "source": {
6
+ "type": "object",
7
+ "required": ["type", "author", "createdAt"],
8
+ "properties": {
9
+ "type": { "enum": ["human", "generated", "derived"] },
10
+ "author": { "type": "string" },
11
+ "createdAt": { "type": "string", "format": "date-time" },
12
+ "generator": { "type": ["string", "null"] }
13
+ }
14
+ },
15
+ "link": {
16
+ "type": "object",
17
+ "required": ["targetId", "targetType", "type"],
18
+ "properties": {
19
+ "targetId": { "type": "string" },
20
+ "targetType": {
21
+ "type": "string",
22
+ "enum": ["requirement", "decision", "design", "implementation", "test", "evidence"]
23
+ },
24
+ "type": {
25
+ "type": "string",
26
+ "enum": ["implements", "designed-by", "implemented-by", "verified-by", "evidenced-by"]
27
+ }
28
+ }
29
+ },
30
+ "linkage": {
31
+ "type": "object",
32
+ "properties": {
33
+ "implements": { "type": "array", "items": { "type": "string" } },
34
+ "designedBy": { "type": "array", "items": { "type": "string" } },
35
+ "implementedBy": { "type": "array", "items": { "type": "string" } },
36
+ "verifiedBy": { "type": "array", "items": { "type": "string" } }
37
+ }
38
+ },
39
+ "criterion": {
40
+ "type": "object",
41
+ "required": ["id", "description"],
42
+ "properties": {
43
+ "id": { "type": "string" },
44
+ "description": { "type": "string", "minLength": 1 },
45
+ "verification": {
46
+ "type": "object",
47
+ "required": ["type"],
48
+ "properties": {
49
+ "type": { "enum": ["test", "manual", "review"] },
50
+ "testPath": { "type": "string" },
51
+ "command": { "type": "string" }
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "validation": {
57
+ "type": "object",
58
+ "required": ["schemaVersion", "timestamp", "valid"],
59
+ "properties": {
60
+ "schemaVersion": { "type": "string" },
61
+ "timestamp": { "type": "string", "format": "date-time" },
62
+ "valid": { "type": "boolean" },
63
+ "errors": { "type": "array", "items": { "type": "string" } },
64
+ "warnings": { "type": "array", "items": { "type": "string" } }
65
+ }
66
+ }
67
+ },
68
+ "type": "object",
69
+ "required": [
70
+ "id",
71
+ "schemaVersion",
72
+ "createdAt",
73
+ "updatedAt",
74
+ "status",
75
+ "type",
76
+ "title",
77
+ "description",
78
+ "source",
79
+ "links",
80
+ "validation"
81
+ ],
82
+ "properties": {
83
+ "id": {
84
+ "type": "string",
85
+ "pattern": "^REQ-(F|NF)-\\d{3}$",
86
+ "description": "Stable identifier (REQ-F-XXX for functional, REQ-NF-XXX for non-functional)"
87
+ },
88
+ "schemaVersion": {
89
+ "const": "1.0.0",
90
+ "description": "Schema version (independent of AIDF version)"
91
+ },
92
+ "createdAt": {
93
+ "type": "string",
94
+ "format": "date-time",
95
+ "description": "Immutable creation timestamp"
96
+ },
97
+ "updatedAt": {
98
+ "type": "string",
99
+ "format": "date-time",
100
+ "description": "Mutable last update timestamp"
101
+ },
102
+ "status": {
103
+ "type": "string",
104
+ "enum": ["DRAFT", "VALIDATED", "BLOCKED", "OUTDATED"],
105
+ "description": "Requirement status"
106
+ },
107
+ "type": {
108
+ "type": "string",
109
+ "enum": ["FUNCTIONAL", "NON_FUNCTIONAL"],
110
+ "description": "Requirement type"
111
+ },
112
+ "title": {
113
+ "type": "string",
114
+ "minLength": 1,
115
+ "description": "Brief requirement title"
116
+ },
117
+ "description": {
118
+ "type": "string",
119
+ "minLength": 10,
120
+ "description": "Detailed requirement description"
121
+ },
122
+ "priority": {
123
+ "type": "string",
124
+ "enum": ["must", "should", "could"],
125
+ "description": "Priority level"
126
+ },
127
+ "acceptanceCriteria": {
128
+ "type": "array",
129
+ "items": { "$ref": "#/$defs/criterion" },
130
+ "description": "Acceptance criteria with verification methods"
131
+ },
132
+ "source": { "$ref": "#/$defs/source" },
133
+ "links": { "$ref": "#/$defs/linkage" },
134
+ "validation": { "$ref": "#/$defs/validation" }
135
+ }
136
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aidf.dev/schemas/security/threat-model/v1",
4
+ "$defs": {
5
+ "source": {
6
+ "type": "object",
7
+ "required": ["type", "author", "createdAt"],
8
+ "properties": {
9
+ "type": { "enum": ["human", "generated", "derived"] },
10
+ "author": { "type": "string" },
11
+ "createdAt": { "type": "string", "format": "date-time" },
12
+ "generator": { "type": ["string", "null"] }
13
+ }
14
+ },
15
+ "linkage": {
16
+ "type": "object",
17
+ "properties": {
18
+ "references": { "type": "array", "items": { "type": "string" } }
19
+ }
20
+ },
21
+ "validation": {
22
+ "type": "object",
23
+ "required": ["schemaVersion", "timestamp", "valid"],
24
+ "properties": {
25
+ "schemaVersion": { "type": "string" },
26
+ "timestamp": { "type": "string", "format": "date-time" },
27
+ "valid": { "type": "boolean" },
28
+ "errors": { "type": "array", "items": { "type": "string" } },
29
+ "warnings": { "type": "array", "items": { "type": "string" } }
30
+ }
31
+ },
32
+ "asset": {
33
+ "type": "object",
34
+ "required": ["id", "name", "classification", "owner", "storage"],
35
+ "properties": {
36
+ "id": { "type": "string" },
37
+ "name": { "type": "string" },
38
+ "classification": {
39
+ "type": "string",
40
+ "enum": ["public", "internal", "confidential", "restricted"]
41
+ },
42
+ "owner": { "type": "string" },
43
+ "storage": { "type": "string" },
44
+ "retention": { "type": "string" }
45
+ }
46
+ },
47
+ "threat": {
48
+ "type": "object",
49
+ "required": ["id", "name", "stride", "asset", "mitigation"],
50
+ "properties": {
51
+ "id": { "type": "string" },
52
+ "name": { "type": "string" },
53
+ "description": { "type": "string" },
54
+ "stride": {
55
+ "type": "string",
56
+ "enum": ["Spoofing", "Tampering", "Repudiation", "Information Disclosure", "Denial of Service", "Elevation of Privilege"]
57
+ },
58
+ "asset": { "type": "string" },
59
+ "likelihood": {
60
+ "type": "string",
61
+ "enum": ["low", "medium", "high"]
62
+ },
63
+ "impact": {
64
+ "type": "string",
65
+ "enum": ["low", "medium", "high"]
66
+ },
67
+ "mitigation": { "type": "string" },
68
+ "status": {
69
+ "type": "string",
70
+ "enum": ["open", "mitigated", "accepted", "rejected"]
71
+ }
72
+ }
73
+ },
74
+ "trustBoundary": {
75
+ "type": "object",
76
+ "required": ["id", "name", "components"],
77
+ "properties": {
78
+ "id": { "type": "string" },
79
+ "name": { "type": "string" },
80
+ "components": {
81
+ "type": "array",
82
+ "items": { "type": "string" }
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "type": "object",
88
+ "required": ["id", "schemaVersion", "createdAt", "updatedAt", "status", "source", "links", "validation"],
89
+ "properties": {
90
+ "id": {
91
+ "type": "string",
92
+ "pattern": "^TM-\\d{3}$",
93
+ "description": "Threat model identifier"
94
+ },
95
+ "schemaVersion": {
96
+ "const": "1.0.0",
97
+ "description": "Schema version"
98
+ },
99
+ "createdAt": {
100
+ "type": "string",
101
+ "format": "date-time"
102
+ },
103
+ "updatedAt": {
104
+ "type": "string",
105
+ "format": "date-time"
106
+ },
107
+ "status": {
108
+ "type": "string",
109
+ "enum": ["DRAFT", "VALIDATED", "BLOCKED", "OUTDATED"]
110
+ },
111
+ "assets": {
112
+ "type": "array",
113
+ "items": { "$ref": "#/$defs/asset" }
114
+ },
115
+ "threats": {
116
+ "type": "array",
117
+ "items": { "$ref": "#/$defs/threat" }
118
+ },
119
+ "trustBoundaries": {
120
+ "type": "array",
121
+ "items": { "$ref": "#/$defs/trustBoundary" }
122
+ },
123
+ "source": { "$ref": "#/$defs/source" },
124
+ "links": { "$ref": "#/$defs/linkage" },
125
+ "validation": { "$ref": "#/$defs/validation" }
126
+ }
127
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aidf.dev/schemas/test-plan/v1",
4
+ "$defs": {
5
+ "source": {
6
+ "type": "object",
7
+ "required": ["type", "author", "createdAt"],
8
+ "properties": {
9
+ "type": { "enum": ["human", "generated", "derived"] },
10
+ "author": { "type": "string" },
11
+ "createdAt": { "type": "string", "format": "date-time" },
12
+ "generator": { "type": ["string", "null"] }
13
+ }
14
+ },
15
+ "linkage": {
16
+ "type": "object",
17
+ "properties": {
18
+ "covers": { "type": "array", "items": { "type": "string" } }
19
+ }
20
+ },
21
+ "validation": {
22
+ "type": "object",
23
+ "required": ["schemaVersion", "timestamp", "valid"],
24
+ "properties": {
25
+ "schemaVersion": { "type": "string" },
26
+ "timestamp": { "type": "string", "format": "date-time" },
27
+ "valid": { "type": "boolean" },
28
+ "errors": { "type": "array", "items": { "type": "string" } },
29
+ "warnings": { "type": "array", "items": { "type": "string" } }
30
+ }
31
+ },
32
+ "testCase": {
33
+ "type": "object",
34
+ "required": ["id", "name", "type", "path", "command"],
35
+ "properties": {
36
+ "id": { "type": "string" },
37
+ "name": { "type": "string" },
38
+ "type": {
39
+ "type": "string",
40
+ "enum": ["unit", "integration", "api", "e2e", "security", "accessibility", "performance"]
41
+ },
42
+ "path": { "type": "string" },
43
+ "command": { "type": "string" },
44
+ "status": {
45
+ "type": "string",
46
+ "enum": ["planned", "written", "passing", "failing", "skipped"]
47
+ }
48
+ }
49
+ },
50
+ "testStrategy": {
51
+ "type": "object",
52
+ "required": ["approach", "coverageGoals", "tools"],
53
+ "properties": {
54
+ "approach": { "type": "string" },
55
+ "coverageGoals": {
56
+ "type": "object",
57
+ "properties": {
58
+ "line": { "type": "number" },
59
+ "branch": { "type": "number" },
60
+ "function": { "type": "number" },
61
+ "statement": { "type": "number" }
62
+ }
63
+ },
64
+ "tools": {
65
+ "type": "array",
66
+ "items": { "type": "object" }
67
+ },
68
+ "mockPolicy": {
69
+ "type": "string",
70
+ "description": "When mocks are allowed/prohibited"
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "type": "object",
76
+ "required": ["id", "schemaVersion", "createdAt", "updatedAt", "status", "source", "links", "validation"],
77
+ "properties": {
78
+ "id": {
79
+ "type": "string",
80
+ "pattern": "^TP-\\d{3}$",
81
+ "description": "Test plan identifier"
82
+ },
83
+ "schemaVersion": {
84
+ "const": "1.0.0",
85
+ "description": "Schema version"
86
+ },
87
+ "createdAt": {
88
+ "type": "string",
89
+ "format": "date-time"
90
+ },
91
+ "updatedAt": {
92
+ "type": "string",
93
+ "format": "date-time"
94
+ },
95
+ "status": {
96
+ "type": "string",
97
+ "enum": ["DRAFT", "VALIDATED", "BLOCKED", "OUTDATED"]
98
+ },
99
+ "strategy": { "$ref": "#/$defs/testStrategy" },
100
+ "testCases": {
101
+ "type": "array",
102
+ "items": { "$ref": "#/$defs/testCase" }
103
+ },
104
+ "source": { "$ref": "#/$defs/source" },
105
+ "links": { "$ref": "#/$defs/linkage" },
106
+ "validation": { "$ref": "#/$defs/validation" }
107
+ }
108
+ }
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: aidf-architecture-review
3
+ description: Review or document architecture against real code and constraints, including boundaries, data ownership, failure modes and trade-offs. Use before structural changes or when the TRD is stale.
4
+ metadata:
5
+ aidf:
6
+ id: architecture-review
7
+ version: 1.0.0
8
+ phases: [discovery, planning]
9
+ documents: [TRD, DECISIONS, CONVENTIONS]
10
+ ---
11
+
12
+ # AIDF Architecture Review
13
+
14
+ ## Procedure
15
+
16
+ 1. Read the real structure: top-level directories, entry points, module
17
+ boundaries, dependency graph, data stores, deployment config.
18
+ 2. Map components to responsibilities and data ownership. Every claim cites a
19
+ path.
20
+ 3. Identify:
21
+ - boundaries that leak;
22
+ - circular or hidden dependencies;
23
+ - shared mutable state;
24
+ - single points of failure;
25
+ - unbounded operations.
26
+ 4. Compare the observed architecture with `TRD.md`. If they differ, mark the TRD
27
+ `OUTDATED` and record the discrepancy.
28
+ 5. For a proposed change, list at least two options with trade-offs and write an
29
+ ADR in `DECISIONS.md` when a decision is required.
30
+ 6. Do not propose a rewrite when a bounded change solves the problem.
31
+
32
+ ## Review checklist
33
+
34
+ - [ ] Data ownership is explicit for each store.
35
+ - [ ] Failure modes are handled at the boundary.
36
+ - [ ] Timeouts, retries and idempotency are defined for remote calls.
37
+ - [ ] The change respects the existing product surface and cockpit.
38
+ - [ ] Migration and rollback are possible.
39
+
40
+ ## Output
41
+
42
+ - Findings with severity and file references.
43
+ - ADR(s) for decisions.
44
+ - A recommendation that distinguishes "must fix now" from "record and defer".
45
+
46
+ ## Escalation
47
+
48
+ A contradiction affecting architecture, data ownership or business behaviour is
49
+ `BLOCKED` until a human decides. Record it; do not pick silently.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: aidf-backend-implementation
3
+ description: Implement backend services and APIs with explicit contracts, validation, error handling and tests. Use for endpoints, business rules, jobs and integrations.
4
+ metadata:
5
+ aidf:
6
+ id: backend-implementation
7
+ version: 1.0.0
8
+ phases: [implementation]
9
+ documents: [BACKEND, SECURITY, CONVENTIONS]
10
+ ---
11
+
12
+ # AIDF Backend Implementation
13
+
14
+ ## Procedure
15
+
16
+ 1. Read the existing route/service/repository pattern and follow it.
17
+ 2. Confirm the contract in `BACKEND.md` or the contract file. If it is missing,
18
+ write it first.
19
+ 3. Validate input at the boundary with the project's schema library.
20
+ 4. Implement business logic in the owning service, not in the transport layer.
21
+ 5. Define the error mapping explicitly: domain error → status/code.
22
+ 6. Add tests: nominal, validation failure, authorization failure, dependency
23
+ failure.
24
+ 7. Check idempotency and retries for writes and external calls.
25
+ 8. Verify no secret or internal detail leaks in responses or logs.
26
+
27
+ ## Security checklist
28
+
29
+ - [ ] Authorization enforced server-side for the specific object.
30
+ - [ ] Input validated and bounded (size, type, range).
31
+ - [ ] Queries parameterised.
32
+ - [ ] Outbound calls allowlisted and timed out.
33
+ - [ ] Sensitive fields excluded from logs.
34
+ - [ ] Rate limit considered for sensitive endpoints.
35
+
36
+ ## Output
37
+
38
+ - Service/API diff.
39
+ - Contract update if behaviour changed.
40
+ - Test results as evidence.
41
+ - Migration/rollback note if data changed.
42
+
43
+ ## Blocking conditions
44
+
45
+ - Contract ambiguity that changes behaviour.
46
+ - Missing authorization model for the resource.
47
+ - Unbounded operation that can exhaust resources.