You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .specsmith/requirements.json
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3111,5 +3111,36 @@
3111
3111
"test_ids": [
3112
3112
"TEST-353"
3113
3113
]
3114
+
},
3115
+
{
3116
+
"id": "REQ-354",
3117
+
"title": "CodityAdapter Scaffolds AI Code Review CI Workflow",
3118
+
"description": "specsmith MUST provide a CodityAdapter registered as 'codity' in the integrations registry. CodityAdapter.generate() MUST detect the VCS host from scaffold.yml content ('gitlab' keyword → gitlab, 'azure' keyword → azure, else github) and from directory heuristics (.gitlab-ci.yml → gitlab, azure-pipelines.yml → azure). For github it MUST write .github/workflows/codity-review.yml; for gitlab it MUST write .gitlab-ci-codity.yml; for azure it MUST write .azure-pipelines/codity-review.yml. All variants MUST install the Codity CLI via the official install script, run 'codity review --staged', and require CODITY_ACCESS_TOKEN. GitLab and Azure variants MUST additionally call 'codity config set-pat --provider <vcs>'. generate() MUST also write docs/codity-setup.md (one-time setup checklist) and append a TODO checklist to LEDGER.md if it exists. The adapter MUST be discoverable via specsmith integrate codity.",
3119
+
"source": "ARCHITECTURE.md §39",
3120
+
"status": "implemented",
3121
+
"test_ids": [
3122
+
"TEST-354",
3123
+
"TEST-355"
3124
+
]
3125
+
},
3126
+
{
3127
+
"id": "REQ-355",
3128
+
"title": "AGENTS.md Template Includes Codity.ai Pre-commit Rule",
3129
+
"description": "The AGENTS.md Jinja2 template (agents.md.j2) MUST include a 'Codity.ai Code Review' section that instructs agents: if 'codity doctor' exits 0 (Codity is configured), run 'codity review --staged' before any commit touching production code; HIGH-severity findings are blocking; MEDIUM-severity findings require inline acknowledgement in the commit message; setup is via 'specsmith integrate codity --project-dir .'.",
3130
+
"source": "ARCHITECTURE.md §39",
3131
+
"status": "implemented",
3132
+
"test_ids": [
3133
+
"TEST-357"
3134
+
]
3135
+
},
3136
+
{
3137
+
"id": "REQ-356",
3138
+
"title": "codity-ai-review Governance Skill in Skills Catalog",
3139
+
"description": "specsmith MUST include a 'codity-ai-review' SkillEntry in the governance domain skills catalog. The skill MUST document: Codity CLI install command (curl install script), codity login (magic-link browser auth), codity init (per-repo initialisation), daily commands (review --staged, scan --staged, test-gen --staged, doctor), the AGENTS.md blocking rule (HIGH severity = commit blocked, MEDIUM = acknowledgement required), CI integration via specsmith integrate codity, GitHub App setup, GitLab PAT setup (codity config set-pat --provider gitlab), and Azure DevOps PAT setup. The skill MUST be tagged with codity, ai-review, code-review, security, test-gen, ci, github, gitlab, azure, staged, pre-commit and discoverable via specsmith skill list.",
Copy file name to clipboardExpand all lines: .specsmith/testcases.json
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3452,5 +3452,49 @@
3452
3452
"input": "list_tools_for_type for each new type; check _TYPE_LABELS",
3453
3453
"expected_behavior": "Each type has correct build tool; all five types in _TYPE_LABELS",
3454
3454
"confidence": 0.95
3455
+
},
3456
+
{
3457
+
"id": "TEST-354",
3458
+
"title": "CodityAdapter Generates GitHub Workflow by Default",
3459
+
"description": "CodityAdapter().generate(config, tmp_path) on a directory with no VCS signals MUST create .github/workflows/codity-review.yml containing 'codity review --staged', 'curl -fsSL https://cli.codity.ai/install.sh | sh', 'CODITY_ACCESS_TOKEN', and 'actions/checkout@v4'. It MUST also create docs/codity-setup.md. When LEDGER.md exists, a TODO checklist entry MUST be appended containing 'codity login' and 'codity doctor'. CodityAdapter().name MUST equal 'codity'.",
3460
+
"requirement_id": "REQ-354",
3461
+
"type": "unit",
3462
+
"verification_method": "pytest",
3463
+
"input": "CodityAdapter().generate(mock_config, tmp_path); tmp_path has no scaffold.yml or VCS hint files",
3464
+
"expected_behavior": ".github/workflows/codity-review.yml created; docs/codity-setup.md created; LEDGER.md appended; name == 'codity'",
3465
+
"confidence": 0.95
3466
+
},
3467
+
{
3468
+
"id": "TEST-355",
3469
+
"title": "CodityAdapter Detects GitLab and Azure VCS from Scaffold or Directory",
3470
+
"description": "When scaffold.yml contains 'gitlab' (case-insensitive), _detect_vcs() MUST return 'gitlab' and generate() MUST write .gitlab-ci-codity.yml (not a GitHub workflow). When scaffold.yml contains 'azure', _detect_vcs() MUST return 'azure' and generate() MUST write .azure-pipelines/codity-review.yml. When .gitlab-ci.yml exists in the project root (no scaffold.yml), _detect_vcs() MUST return 'gitlab'. When azure-pipelines.yml exists, _detect_vcs() MUST return 'azure'. The GitLab workflow MUST contain 'codity config set-pat --provider gitlab'. The Azure workflow MUST contain 'codity config set-pat --provider azure'.",
3471
+
"requirement_id": "REQ-354",
3472
+
"type": "unit",
3473
+
"verification_method": "pytest",
3474
+
"input": "Scaffold.yml with gitlab/azure keyword; .gitlab-ci.yml present; azure-pipelines.yml present",
"title": "codity-ai-review Skill Is in Governance Skills Catalog",
3481
+
"description": "specsmith.skills.governance.SKILLS MUST contain a SkillEntry with slug='codity-ai-review'. Its body MUST contain 'codity review --staged', 'codity login', 'codity init', 'codity scan --staged', 'codity test-gen --staged', 'codity doctor', 'specsmith integrate codity', 'HIGH severity', 'set-pat --provider gitlab', and 'set-pat --provider azure'. Its tags MUST include 'codity', 'ai-review', and 'pre-commit'. Its domain MUST be SkillDomain.GOVERNANCE.",
"description": "The rendered agents.md.j2 template MUST contain a 'Codity.ai Code Review' section. The section MUST instruct agents to run 'codity review --staged' if codity doctor exits 0; MUST state that HIGH-severity findings block the commit; MUST mention MEDIUM-severity acknowledgement; MUST reference 'specsmith integrate codity'. The section MUST appear after the Session Governance Protocol section and before the project metadata footer.",
3493
+
"requirement_id": "REQ-355",
3494
+
"type": "unit",
3495
+
"verification_method": "pytest",
3496
+
"input": "Read src/specsmith/templates/agents.md.j2 directly; render via Jinja2 with minimal context",
3497
+
"expected_behavior": "Template contains Codity section with review --staged, HIGH severity, MEDIUM, integrate codity",
**AGENTS.md rule (REQ-355):** Projects with Codity configured SHOULD run `codity review --staged` before any commit touching production code. HIGH-severity findings are blocking; MEDIUM findings require inline acknowledgement.
880
+
881
+
See the `codity-ai-review` governance skill (`specsmith skill install codity-ai-review`) for the full CLI workflow reference.
882
+
883
+
---
884
+
866
885
## The specsmith Bootstrap
867
886
868
887
specsmith governs itself — the specsmith repo is a specsmith-managed project. Run `specsmith audit`
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -883,3 +883,24 @@ Hard-resets the working tree to `origin/<branch>` via `git fetch` + `git reset -
883
883
Same as `--discard` plus `git clean -fd` to remove all untracked files. Equivalent to a full workspace reset to remote state.
884
884
885
885
**Architecture invariant (I14):**`--force` and `--discard` flags MUST be used only when explicitly requested. They bypass safety guards intentionally designed to prevent accidental data loss. Agents MUST NOT invoke these flags without explicit user confirmation.
886
+
887
+
## 39. Codity.ai Integration — AI Code Review Adapter
`CodityAdapter` (REQ-354) scaffolds Codity.ai AI-code-review CI workflows into target projects via `specsmith integrate codity`. It detects the VCS host from `scaffold.yml` content and directory heuristics (`.gitlab-ci.yml`, `azure-pipelines.yml`) and generates the appropriate CI file:
All variants: install Codity CLI via `curl -fsSL https://cli.codity.ai/install.sh | sh`, run `codity review --staged`, require `CODITY_ACCESS_TOKEN` secret. GitLab/Azure additionally call `codity config set-pat --provider <vcs>` with a PAT.
899
+
900
+
`generate()` also writes `docs/codity-setup.md` (one-time setup checklist) and appends a TODO checklist to `LEDGER.md`.
901
+
902
+
The **`codity-ai-review`** governance skill (REQ-356) documents the full Codity.ai CLI workflow for agents: install, `codity login` (magic-link auth), `codity init`, daily commands (`review --staged`, `scan --staged`, `test-gen --staged`, `doctor`), VCS-specific PAT setup, and the AGENTS.md rule.
903
+
904
+
The **AGENTS.md template** (REQ-355) includes a conditional Codity section: projects with Codity configured SHOULD run `codity review --staged` before commits touching production code; HIGH-severity findings block the commit; MEDIUM findings require inline acknowledgement.
905
+
906
+
**Architecture invariant (I15):** The VCS-detection heuristic MUST default to `"github"` when no signals are present (scaffold.yml absent, no `.gitlab-ci.yml`, no `azure-pipelines.yml`). New VCS hosts require a new detection heuristic AND a corresponding workflow writer method.
Copy file name to clipboardExpand all lines: docs/REQUIREMENTS.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2490,3 +2490,27 @@
2490
2490
-**Source:** ARCHITECTURE.md §Implemented Specsmith System
2491
2491
-**Test_Ids:**['TEST-353']
2492
2492
2493
+
## REQ-354. CodityAdapter Scaffolds AI Code Review CI Workflow
2494
+
-**ID:** REQ-354
2495
+
-**Title:** CodityAdapter Scaffolds AI Code Review CI Workflow
2496
+
-**Description:** specsmith MUST provide a CodityAdapter registered as 'codity' in the integrations registry. CodityAdapter.generate() MUST detect the VCS host from scaffold.yml content ('gitlab' keyword → gitlab, 'azure' keyword → azure, else github) and from directory heuristics (.gitlab-ci.yml → gitlab, azure-pipelines.yml → azure). For github it MUST write .github/workflows/codity-review.yml; for gitlab it MUST write .gitlab-ci-codity.yml; for azure it MUST write .azure-pipelines/codity-review.yml. All variants MUST install the Codity CLI via the official install script, run 'codity review --staged', and require CODITY_ACCESS_TOKEN. GitLab and Azure variants MUST additionally call 'codity config set-pat --provider <vcs>'. generate() MUST also write docs/codity-setup.md (one-time setup checklist) and append a TODO checklist to LEDGER.md if it exists. The adapter MUST be discoverable via specsmith integrate codity.
2497
+
-**Status:** implemented
2498
+
-**Source:** ARCHITECTURE.md §39
2499
+
-**Test_Ids:**['TEST-354', 'TEST-355']
2500
+
2501
+
## REQ-355. AGENTS.md Template Includes Codity.ai Pre-commit Rule
2502
+
-**ID:** REQ-355
2503
+
-**Title:** AGENTS.md Template Includes Codity.ai Pre-commit Rule
2504
+
-**Description:** The AGENTS.md Jinja2 template (agents.md.j2) MUST include a 'Codity.ai Code Review' section that instructs agents: if 'codity doctor' exits 0 (Codity is configured), run 'codity review --staged' before any commit touching production code; HIGH-severity findings are blocking; MEDIUM-severity findings require inline acknowledgement in the commit message; setup is via 'specsmith integrate codity --project-dir .'.
2505
+
-**Status:** implemented
2506
+
-**Source:** ARCHITECTURE.md §39
2507
+
-**Test_Ids:**['TEST-357']
2508
+
2509
+
## REQ-356. codity-ai-review Governance Skill in Skills Catalog
2510
+
-**ID:** REQ-356
2511
+
-**Title:** codity-ai-review Governance Skill in Skills Catalog
2512
+
-**Description:** specsmith MUST include a 'codity-ai-review' SkillEntry in the governance domain skills catalog. The skill MUST document: Codity CLI install command (curl install script), codity login (magic-link browser auth), codity init (per-repo initialisation), daily commands (review --staged, scan --staged, test-gen --staged, doctor), the AGENTS.md blocking rule (HIGH severity = commit blocked, MEDIUM = acknowledgement required), CI integration via specsmith integrate codity, GitHub App setup, GitLab PAT setup (codity config set-pat --provider gitlab), and Azure DevOps PAT setup. The skill MUST be tagged with codity, ai-review, code-review, security, test-gen, ci, github, gitlab, azure, staged, pre-commit and discoverable via specsmith skill list.
Copy file name to clipboardExpand all lines: docs/TESTS.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2935,3 +2935,47 @@
2935
2935
-**Expected Behavior:** Each type has correct build tool; all five types in _TYPE_LABELS
2936
2936
-**Confidence:** 0.95
2937
2937
2938
+
## TEST-354. CodityAdapter Generates GitHub Workflow by Default
2939
+
-**ID:** TEST-354
2940
+
-**Title:** CodityAdapter Generates GitHub Workflow by Default
2941
+
-**Description:** CodityAdapter().generate(config, tmp_path) on a directory with no VCS signals MUST create .github/workflows/codity-review.yml containing 'codity review --staged', 'curl -fsSL https://cli.codity.ai/install.sh | sh', 'CODITY_ACCESS_TOKEN', and 'actions/checkout@v4'. It MUST also create docs/codity-setup.md. When LEDGER.md exists, a TODO checklist entry MUST be appended containing 'codity login' and 'codity doctor'. CodityAdapter().name MUST equal 'codity'.
2942
+
-**Requirement ID:** REQ-354
2943
+
-**Type:** unit
2944
+
-**Verification Method:** pytest
2945
+
-**Input:** CodityAdapter().generate(mock_config, tmp_path); tmp_path has no scaffold.yml or VCS hint files
## TEST-355. CodityAdapter Detects GitLab and Azure VCS from Scaffold or Directory
2950
+
-**ID:** TEST-355
2951
+
-**Title:** CodityAdapter Detects GitLab and Azure VCS from Scaffold or Directory
2952
+
-**Description:** When scaffold.yml contains 'gitlab' (case-insensitive), _detect_vcs() MUST return 'gitlab' and generate() MUST write .gitlab-ci-codity.yml (not a GitHub workflow). When scaffold.yml contains 'azure', _detect_vcs() MUST return 'azure' and generate() MUST write .azure-pipelines/codity-review.yml. When .gitlab-ci.yml exists in the project root (no scaffold.yml), _detect_vcs() MUST return 'gitlab'. When azure-pipelines.yml exists, _detect_vcs() MUST return 'azure'. The GitLab workflow MUST contain 'codity config set-pat --provider gitlab'. The Azure workflow MUST contain 'codity config set-pat --provider azure'.
2953
+
-**Requirement ID:** REQ-354
2954
+
-**Type:** unit
2955
+
-**Verification Method:** pytest
2956
+
-**Input:** Scaffold.yml with gitlab/azure keyword; .gitlab-ci.yml present; azure-pipelines.yml present
## TEST-356. codity-ai-review Skill Is in Governance Skills Catalog
2961
+
-**ID:** TEST-356
2962
+
-**Title:** codity-ai-review Skill Is in Governance Skills Catalog
2963
+
-**Description:** specsmith.skills.governance.SKILLS MUST contain a SkillEntry with slug='codity-ai-review'. Its body MUST contain 'codity review --staged', 'codity login', 'codity init', 'codity scan --staged', 'codity test-gen --staged', 'codity doctor', 'specsmith integrate codity', 'HIGH severity', 'set-pat --provider gitlab', and 'set-pat --provider azure'. Its tags MUST include 'codity', 'ai-review', and 'pre-commit'. Its domain MUST be SkillDomain.GOVERNANCE.
2964
+
-**Requirement ID:** REQ-356
2965
+
-**Type:** unit
2966
+
-**Verification Method:** pytest
2967
+
-**Input:** from specsmith.skills.governance import SKILLS; find slug='codity-ai-review'
2968
+
-**Expected Behavior:** SkillEntry found; body and tags correct; domain GOVERNANCE
-**Description:** The rendered agents.md.j2 template MUST contain a 'Codity.ai Code Review' section. The section MUST instruct agents to run 'codity review --staged' if codity doctor exits 0; MUST state that HIGH-severity findings block the commit; MUST mention MEDIUM-severity acknowledgement; MUST reference 'specsmith integrate codity'. The section MUST appear after the Session Governance Protocol section and before the project metadata footer.
2975
+
-**Requirement ID:** REQ-355
2976
+
-**Type:** unit
2977
+
-**Verification Method:** pytest
2978
+
-**Input:** Read src/specsmith/templates/agents.md.j2 directly; render via Jinja2 with minimal context
2979
+
-**Expected Behavior:** Template contains Codity section with review --staged, HIGH severity, MEDIUM, integrate codity
0 commit comments