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,53 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Qoder SessionStart hook: inject a short AIDF reminder and the current phase.
4
+ * Never blocks. Never prints secrets. Fails open.
5
+ */
6
+ import fs from 'node:fs';
7
+ import path from 'node:path';
8
+
9
+ function readStdin() {
10
+ try {
11
+ return fs.readFileSync(0, 'utf8');
12
+ } catch {
13
+ return '';
14
+ }
15
+ }
16
+
17
+ function safeJson(file, fallback) {
18
+ try {
19
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
20
+ } catch {
21
+ return fallback;
22
+ }
23
+ }
24
+
25
+ try {
26
+ const input = JSON.parse(readStdin() || '{}');
27
+ const cwd = input.cwd || process.cwd();
28
+ const aidf = path.join(cwd, '.aidf');
29
+ const config = safeJson(path.join(aidf, 'config.json'), null);
30
+ const state = safeJson(path.join(aidf, 'state', 'workflow.json'), null);
31
+ if (!config) process.exit(0);
32
+ const phase = state?.currentPhase ?? config.workflow?.currentPhase ?? 'intake';
33
+ const docs = Object.entries(config.documents ?? {})
34
+ .filter(([, v]) => ['BLOCKED', 'OUTDATED'].includes(v?.status))
35
+ .map(([k, v]) => `${k}=${v.status}`);
36
+ const lines = [
37
+ 'AIDF is installed in this project.',
38
+ 'Read .aidf/AIDF.md and .aidf/docs/constitution.md before acting.',
39
+ `Current phase: ${phase}. Check gates with: node .aidf/bin/aidf.mjs workflow status`,
40
+ 'Select context with: node .aidf/bin/aidf.mjs context --task "<request>"',
41
+ ];
42
+ if (docs.length > 0) lines.push(`Contradiction-sensitive documents not clean: ${docs.join(', ')}`);
43
+ lines.push('No PASS without evidence. Never read or print secrets.');
44
+ process.stdout.write(JSON.stringify({
45
+ hookSpecificOutput: {
46
+ hookEventName: 'SessionStart',
47
+ additionalContext: lines.join('\n'),
48
+ },
49
+ }));
50
+ process.exit(0);
51
+ } catch {
52
+ process.exit(0);
53
+ }
@@ -0,0 +1,92 @@
1
+ schemaVersion: 1
2
+ description: |
3
+ Mapping between AIDF durable documents and GitHub Spec Kit artefacts.
4
+ AIDF owns product-wide truth; Spec Kit owns feature-level change artefacts.
5
+ Nothing is duplicated: each fact has one canonical owner.
6
+
7
+ specKit:
8
+ supportedSince: 1.0.0
9
+ verifiedAgainst:
10
+ cli: 1.2.3
11
+ source: 1.2.6.dev0
12
+ integration:
13
+ key: qodercli
14
+ installCommand: specify init --here --integration qodercli --ignore-agent-tools --non-interactive
15
+ layout:
16
+ skills: .qoder/skills
17
+ commands: .qoder/commands (legacy)
18
+ requiresCli: true
19
+
20
+ mapping:
21
+ - aidf: constitution
22
+ aidfPath: .aidf/docs/constitution.md
23
+ specKit: constitution
24
+ specKitPath: .specify/memory/constitution.md
25
+ owner: AIDF
26
+ sync: copy-with-hash
27
+ notes: |
28
+ AIDF constitution is the source of truth. Spec Kit receives a generated
29
+ copy with a header and a source hash. If Spec Kit already has a
30
+ constitution, AIDF does not overwrite it; it reports a conflict.
31
+
32
+ - aidf: PRD
33
+ aidfPath: .aidf/docs/PRD.md
34
+ specKit: spec / requirements
35
+ specKitPath: specs/<feature>/spec.md
36
+ owner: shared
37
+ sync: reference
38
+ notes: |
39
+ PRD holds product-wide requirements. Feature specs hold the delta for a
40
+ feature and reference PRD requirement IDs.
41
+
42
+ - aidf: TRD
43
+ aidfPath: .aidf/docs/TRD.md
44
+ specKit: plan
45
+ specKitPath: specs/<feature>/plan.md
46
+ owner: shared
47
+ sync: reference
48
+ notes: |
49
+ TRD holds durable technical constraints and architecture. The feature plan
50
+ holds implementation choices for that feature.
51
+
52
+ - aidf: APPFLOW
53
+ aidfPath: .aidf/docs/APPFLOW.md
54
+ specKit: spec scenarios
55
+ specKitPath: specs/<feature>/spec.md
56
+ owner: shared
57
+ sync: reference
58
+
59
+ - aidf: UI-UX
60
+ aidfPath: .aidf/docs/UI-UX.md
61
+ specKit: design artefacts
62
+ specKitPath: specs/<feature>/design/
63
+ owner: shared
64
+ sync: reference
65
+
66
+ - aidf: BACKEND
67
+ aidfPath: .aidf/docs/BACKEND.md
68
+ specKit: contracts / plan
69
+ specKitPath: specs/<feature>/contracts/
70
+ owner: shared
71
+ sync: reference
72
+
73
+ - aidf: PLAN
74
+ aidfPath: .aidf/docs/PLAN.md
75
+ specKit: plan + tasks
76
+ specKitPath: specs/<feature>/tasks.md
77
+ owner: shared
78
+ sync: reference
79
+
80
+ - aidf: SECURITY
81
+ aidfPath: .aidf/docs/SECURITY.md
82
+ specKit: invariants, requirements, checklists
83
+ specKitPath: specs/<feature>/checklists/security.md
84
+ owner: AIDF
85
+ sync: reference
86
+
87
+ - aidf: CONVENTIONS
88
+ aidfPath: .aidf/docs/CONVENTIONS.md
89
+ specKit: constitution / agent instructions
90
+ specKitPath: .specify/memory/constitution.md
91
+ owner: AIDF
92
+ sync: reference
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: Testing and validation practices
3
+ source: AIDF original summary
4
+ references:
5
+ - https://martinfowler.com/bliki/TestPyramid.html
6
+ license: MIT
7
+ status: AVAILABLE
8
+ retrieved: 2026-10-30
9
+ ---
10
+
11
+ # Testing and Validation Practices
12
+
13
+ ## What counts as proof
14
+
15
+ A test is proof only when:
16
+
17
+ 1. the command was actually executed;
18
+ 2. the exit code and output were recorded;
19
+ 3. the test exercises the changed behaviour;
20
+ 4. the environment is identified (local, CI, container).
21
+
22
+ A mock is not an integration. A skipped test is not a pass. A screenshot of a
23
+ previous run is not evidence for the current diff.
24
+
25
+ ## Test levels
26
+
27
+ | Level | Purpose | Speed | Allowed dependencies |
28
+ |---|---|---|---|
29
+ | Unit | Logic and edge cases | fast | none / in-memory |
30
+ | Integration | Real boundaries (DB, HTTP) | slower | disposable real services |
31
+ | Contract | Producer/consumer agreement | medium | schema or recorded contract |
32
+ | E2E | User-visible journey | slow | full stack |
33
+
34
+ Use the lowest level that can prove the behaviour. Add a higher-level test only
35
+ for risks the lower level cannot cover.
36
+
37
+ ## Design
38
+
39
+ - Cover nominal, boundary, invalid input and failure paths.
40
+ - One behaviour per test; the test name states the expected behaviour.
41
+ - Avoid testing implementation details that are free to change.
42
+ - Control time, randomness and network. Flaky tests are defects.
43
+ - A regression fix includes a test that fails before the fix.
44
+
45
+ ## Evidence capture
46
+
47
+ ```bash
48
+ aidf validate --phase testing --kind exit --allow-exec
49
+ aidf evidence capture --type test-run --note "unit + integration"
50
+ ```
51
+
52
+ The recorded evidence includes the command, exit code, duration, output hashes
53
+ and the list of changed files. Do not edit evidence files by hand.
@@ -0,0 +1,39 @@
1
+ # Web Development Curriculum Baseline (MODULES index)
2
+
3
+ Purpose: seed rules derived from the owner's complete web-developer curriculum
4
+ (`resources/MODULES/`, ~400 course documents indexed; code trees and secrets
5
+ excluded). Index-only: this file lists domains and the module folders that
6
+ carry authority; it does not copy course content.
7
+
8
+ Domains and authoritative sources (relative to the project root, folder
9
+ `resources/MODULES/`):
10
+
11
+ | Domain | MODULES folder (now resources/MODULES) | Rule for AIDF projects |
12
+ |---|---|---|
13
+ | Algorithmics | `algo/` | Design before code; pseudocode/uml for non-trivial logic |
14
+ | HTML/CSS/Sass/Bootstrap | `html_css/` | Semantic HTML, responsive layouts, SASS conventions |
15
+ | JavaScript/AJAX/API | `JAVASCRIPT/` | ES conventions, DOM, fetch/API usage, algos in JS |
16
+ | PHP / POO / MVC | `PHP/` | MVC separation, POO design, form/session handling |
17
+ | SQL | `SQL/` | Pareto 80/20 querying, schema correctness, injections awareness |
18
+ | Data modelling (Merise, MCD/MLD) | `CONCEPTION/` | Entity/association modelling before coding |
19
+ | UX/UI, mockups, SEO, graphisme | `CONCEPTION/` | Mockups precede implementation; SEO taken into account |
20
+ | Cahier des charges | `CAHIER DES CHARGES/` | Requirements + personas precede development (PRD source material) |
21
+ | CNIL / RGPD | `CNIL_RGPD/` | Privacy-by-design; data minimisation; consent; retention (owner is CNIL-certified) |
22
+ | Project management | `GESTION DE PROJET/` | Phases, planning, deliverables orientation |
23
+ | Git | `GIT/` | Commit discipline, branching, PR hygiene |
24
+ | Docker | `DOCKER/` | Container parity for dev/staging (course + labs) |
25
+ | Linux | `LINUX/` | Users/permissions, shell basics for deploying |
26
+ | Networks & hardware | `infra_reseaux_hard_soft/` | TCP/IP, hosting constraints |
27
+ | Hosting | `hebergement/` | Deployment targets and constraints |
28
+ | English | `ANGLAIS/` | Docs/comments readability in English |
29
+ | AI usage | `IA/` | AI-assisted work under governance (AIDF) |
30
+ | Career positioning | `POSITIONNEMENT/`, `PRO/` | Portfolio and professional context |
31
+
32
+ Exclusions honoured by the AIDF resource registry (`sources.yaml`:
33
+ `jeremy-web-modules`): `STAGE/**` (real company project), node_modules, vendor,
34
+ `.env*`, `*.pem`, `*.crt`, `*.key`, `db/**`. Secrets observed in lab projects
35
+ are never read or copied; `aidf scan` reports filenames only.
36
+
37
+ Usage: when a task matches a domain above, the corresponding MODULES documents
38
+ are the owner's reference material. AIDF documents (PRD/SECURITY/CONVENTIONS…)
39
+ must stay consistent with these rules.
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: API design rules
3
+ source: AIDF original summary
4
+ references:
5
+ - https://www.rfc-editor.org/rfc/rfc9110
6
+ license: MIT
7
+ status: AVAILABLE
8
+ retrieved: 2026-10-30
9
+ ---
10
+
11
+ # API Design Rules
12
+
13
+ ## Contracts
14
+
15
+ - Define the contract before implementation (OpenAPI, schema, or typed
16
+ interface) and keep it in the repository.
17
+ - Validate input at the boundary. Reject unknown fields when the contract is
18
+ closed.
19
+ - Use consistent error envelopes with a stable machine-readable code, a human
20
+ message, and optional details.
21
+ - Never leak stack traces, SQL, internal hostnames or secrets in errors.
22
+
23
+ ## HTTP semantics
24
+
25
+ - Use the method that matches the semantics; do not tunnel everything through
26
+ POST.
27
+ - Status codes: 2xx success, 4xx caller error, 5xx server error. Do not return
28
+ 200 with an error payload.
29
+ - `PUT` and `DELETE` should be idempotent where the resource model allows it.
30
+ - Pagination: cursor-based for large or changing collections; document limits.
31
+
32
+ ## Security
33
+
34
+ - Authenticate and authorise on the server for every request. UI checks are not
35
+ authorisation.
36
+ - Apply rate limits to unauthenticated and sensitive endpoints.
37
+ - Do not accept secrets in URLs.
38
+ - CORS is explicit; no wildcard with credentials.
39
+
40
+ ## Versioning and change
41
+
42
+ - Additive changes first. Breaking changes need a version or a deprecation
43
+ window.
44
+ - Deprecations have an owner, a date and a migration note.
45
+ - Contract tests run in CI.
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: SQL and data rules
3
+ source: AIDF original summary
4
+ references:
5
+ - https://www.postgresql.org/docs/
6
+ license: MIT
7
+ status: AVAILABLE
8
+ retrieved: 2026-10-30
9
+ ---
10
+
11
+ # SQL and Data Rules
12
+
13
+ ## Schema
14
+
15
+ - Every table has a primary key.
16
+ - Foreign keys are enforced by the database, not only by application code.
17
+ - Nullability is a deliberate decision; document it when it affects behaviour.
18
+ - Use database-level constraints for invariants that must always hold.
19
+ - Names are stable and descriptive; avoid abbreviations that require a glossary.
20
+
21
+ ## Migrations
22
+
23
+ - Migrations are forward-only and versioned; rollback is a separate, tested
24
+ procedure when the database cannot reverse safely.
25
+ - A migration that rewrites a large table needs a plan for locks and duration.
26
+ - Destructive changes (drop column/table, data rewrite) require a backup and a
27
+ human approval recorded in `.aidf/evidence/`.
28
+ - Never edit an already-applied migration in a shared environment.
29
+
30
+ ## Queries
31
+
32
+ - Parameterise every value; never concatenate user input into SQL.
33
+ - Add indexes for real query patterns, not speculatively. Record the query.
34
+ - Avoid `SELECT *` in production code; select the columns the code uses.
35
+ - Pagination must be stable (order by a unique key).
36
+ - Watch N+1 patterns at ORM boundaries; verify with query logs.
37
+
38
+ ## Access
39
+
40
+ - The application user is not the schema owner and has only the privileges it
41
+ needs.
42
+ - Reporting/analytics access is read-only and separate.
43
+ - Secrets for database access come from the environment or a secret manager,
44
+ never from committed files.
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: TypeScript and JavaScript rules
3
+ source: AIDF original summary
4
+ references:
5
+ - https://www.typescriptlang.org/docs/handbook/
6
+ license: MIT
7
+ status: AVAILABLE
8
+ retrieved: 2026-10-30
9
+ ---
10
+
11
+ # TypeScript / JavaScript Rules
12
+
13
+ These rules are AIDF's own concise guidance. The official handbook remains the
14
+ authority for language semantics.
15
+
16
+ ## Types
17
+
18
+ - `strict` must be enabled in `tsconfig.json` for new TypeScript code. If it is
19
+ not, record why in `DECISIONS.md` before changing it.
20
+ - Do not use `any` to silence an error. Use `unknown` plus a narrowing guard, or
21
+ a precise type. If `any` is unavoidable at a boundary, isolate it and explain.
22
+ - Prefer discriminated unions for state that has exclusive variants.
23
+ - Model invalid states out of existence where practical.
24
+ - Do not cast through `as unknown as T` to bypass a real mismatch.
25
+
26
+ ## Modules and boundaries
27
+
28
+ - Respect the existing module system (`type: module` or CommonJS). Do not mix.
29
+ - A module owns its data and exposes a narrow interface. Do not reach into
30
+ another module's internals.
31
+ - Avoid circular dependencies; if one appears, the boundary is probably wrong.
32
+
33
+ ## Errors
34
+
35
+ - Throw `Error` subclasses with actionable messages, not strings.
36
+ - Do not swallow errors with empty `catch`.
37
+ - Distinguish expected domain failures from unexpected defects.
38
+ - Never include secrets or full request bodies in error messages.
39
+
40
+ ## Async
41
+
42
+ - Do not leave floating promises; await or explicitly handle them.
43
+ - Use `AbortSignal` for cancellable work.
44
+ - Avoid unbounded concurrency; use a pool or a queue.
45
+
46
+ ## Tests
47
+
48
+ - Test observable behaviour, not private implementation details.
49
+ - One reason to fail per test where possible.
50
+ - Deterministic: control time, randomness and network.
@@ -0,0 +1,58 @@
1
+ ---
2
+ title: Security baseline references
3
+ source: AIDF original summary
4
+ references:
5
+ - https://owasp.org/www-project-application-security-verification-standard/
6
+ - https://cheatsheetseries.owasp.org/
7
+ license: MIT
8
+ status: AVAILABLE
9
+ retrieved: 2026-10-30
10
+ ---
11
+
12
+ # Security Baseline References
13
+
14
+ This is a review aid, not a certification and not a claim that the application
15
+ is free of vulnerabilities. Verify each item against the real deployment.
16
+
17
+ ## Authentication and session
18
+
19
+ - [ ] Passwords are hashed with a memory-hard algorithm (Argon2id, scrypt, bcrypt).
20
+ - [ ] Session tokens are random, stored securely and rotated on privilege change.
21
+ - [ ] Logout invalidates the session server-side.
22
+ - [ ] Multi-factor authentication is available for sensitive roles.
23
+
24
+ ## Authorization
25
+
26
+ - [ ] Every server endpoint enforces authorization.
27
+ - [ ] Object-level authorization prevents IDOR (the caller owns the object).
28
+ - [ ] Deny by default; permissions are explicit.
29
+ - [ ] Admin actions are separately protected and audited.
30
+
31
+ ## Input and output
32
+
33
+ - [ ] All input is validated against a schema at the boundary.
34
+ - [ ] SQL uses parameters; no string concatenation.
35
+ - [ ] Output is encoded for its context (HTML, attribute, URL, JS).
36
+ - [ ] File uploads are type-checked, size-limited and stored outside the web root.
37
+ - [ ] Redirects and outbound fetches are allowlisted (SSRF).
38
+
39
+ ## Secrets and configuration
40
+
41
+ - [ ] No secret in the repository, logs, error pages or client bundle.
42
+ - [ ] Secrets come from environment or a secret manager.
43
+ - [ ] Debug mode is off in production.
44
+ - [ ] Dependencies are locked and audited.
45
+
46
+ ## Data protection
47
+
48
+ - [ ] Transport encryption is enforced.
49
+ - [ ] Sensitive data at rest is encrypted.
50
+ - [ ] Backups are encrypted and restore-tested.
51
+ - [ ] Personal data has a retention and deletion path.
52
+
53
+ ## Operations
54
+
55
+ - [ ] Security-relevant events are logged without sensitive payloads.
56
+ - [ ] Alerts exist for authentication anomalies and privilege changes.
57
+ - [ ] Incident contact and escalation are documented.
58
+ - [ ] Residual risks are recorded and accepted by a human.
@@ -0,0 +1,83 @@
1
+ schemaVersion: 1
2
+ description: |
3
+ Maps tasks and phases to the minimum set of documents and skills. The context
4
+ assembler loads only what is selected here, plus the always-on documents.
5
+ Keywords are matched case-insensitively against the task text.
6
+
7
+ always:
8
+ documents:
9
+ - constitution
10
+ - CONVENTIONS
11
+ skills:
12
+ - project-context
13
+
14
+ byPhase:
15
+ intake:
16
+ documents: [PRD]
17
+ skills: [project-context, phase-transition]
18
+ discovery:
19
+ documents: [TRD, DECISIONS]
20
+ skills: [project-context, architecture-review]
21
+ specification:
22
+ documents: [PRD, APPFLOW, UI-UX]
23
+ skills: [product-analysis, requirements-engineering, ui-ux-implementation]
24
+ planning:
25
+ documents: [TRD, PLAN, BACKEND]
26
+ skills: [architecture-review, database-design, requirements-engineering]
27
+ implementation:
28
+ documents: [CONVENTIONS, BACKEND, UI-UX]
29
+ skills: [frontend-implementation, backend-implementation, database-design, devops-engineering]
30
+ testing:
31
+ documents: [PLAN, CONVENTIONS]
32
+ skills: [testing-validation]
33
+ security:
34
+ documents: [SECURITY, BACKEND, DECISIONS]
35
+ skills: [security-review, testing-validation]
36
+ release:
37
+ documents: [CHANGELOG, PLAN, DECISIONS]
38
+ skills: [documentation-maintenance, phase-transition, devops-engineering]
39
+
40
+ byKeyword:
41
+ - keywords: [api, endpoint, rest, graphql, webhook, contract]
42
+ documents: [BACKEND, SECURITY]
43
+ skills: [backend-implementation, requirements-engineering]
44
+ - keywords: [database, schema, migration, sql, index, query]
45
+ documents: [BACKEND, SECURITY]
46
+ skills: [database-design]
47
+ - keywords: [ui, ux, screen, page, component, design, accessibility, responsive]
48
+ documents: [UI-UX, APPFLOW]
49
+ skills: [ui-ux-implementation, frontend-implementation]
50
+ - keywords: [auth, login, permission, role, token, session, secret, security, vulnerability, privacy]
51
+ documents: [SECURITY, BACKEND]
52
+ skills: [security-review]
53
+ - keywords: [test, coverage, regression, flaky, e2e, unit]
54
+ documents: [CONVENTIONS]
55
+ skills: [testing-validation]
56
+ - keywords: [ci, cd, pipeline, deploy, docker, kubernetes, release, rollback]
57
+ documents: [TRD, SECURITY, PLAN]
58
+ skills: [devops-engineering]
59
+ - keywords: [architecture, refactor, module, boundary, dependency, adr]
60
+ documents: [TRD, DECISIONS]
61
+ skills: [architecture-review]
62
+ - keywords: [bug, error, crash, regression, broken, fix]
63
+ documents: [APPFLOW, BACKEND]
64
+ skills: [testing-validation, architecture-review]
65
+ - keywords: [docs, documentation, changelog, readme, adr]
66
+ documents: [CHANGELOG, DECISIONS]
67
+ skills: [documentation-maintenance]
68
+ - keywords: [performance, latency, memory, cache, load, scale]
69
+ documents: [TRD, BACKEND]
70
+ skills: [architecture-review, backend-implementation]
71
+ - keywords: [rgpd, cnil, gdpr, consent, retention, données, data, privacy policy]
72
+ documents: [SECURITY]
73
+ skills: [security-review]
74
+ - keywords: [php, javascript, html, css, sass, bootstrap, cookie, session, seo, merise, mcd, mld]
75
+ documents: [CONVENTIONS, BACKEND]
76
+ skills: [frontend-implementation, backend-implementation]
77
+
78
+ # Documents that must never be silently ignored when they are BLOCKED/OUTDATED.
79
+ contradictionSensitive:
80
+ - SECURITY
81
+ - TRD
82
+ - BACKEND
83
+ - PRD
@@ -0,0 +1,35 @@
1
+ schemaVersion: 1
2
+ description: |
3
+ Skill dependency graph. A skill is AVAILABLE only when its dependencies are
4
+ themselves VALIDATED or AVAILABLE, or explicitly marked NOT_APPLICABLE with a
5
+ reason. Cycles are rejected by `aidf skills validate`.
6
+
7
+ skills:
8
+ project-context:
9
+ requires: []
10
+ product-analysis:
11
+ requires: [project-context]
12
+ requirements-engineering:
13
+ requires: [product-analysis]
14
+ architecture-review:
15
+ requires: [project-context]
16
+ database-design:
17
+ requires: [architecture-review]
18
+ ui-ux-implementation:
19
+ requires: [requirements-engineering]
20
+ frontend-implementation:
21
+ requires: [ui-ux-implementation]
22
+ backend-implementation:
23
+ requires: [architecture-review]
24
+ testing-validation:
25
+ requires: [requirements-engineering]
26
+ security-review:
27
+ requires: [testing-validation]
28
+ devops-engineering:
29
+ requires: [architecture-review]
30
+ documentation-maintenance:
31
+ requires: [project-context]
32
+ phase-transition:
33
+ requires: [project-context, testing-validation]
34
+
35
+ external: {}