Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
362 commits
Select commit Hold shift + click to select a range
4d1f950
Merge branch 'main' into dev
djm81 Feb 13, 2026
47ea3f4
fix(backlog-core): remove unused module io contract global
djm81 Feb 13, 2026
2509412
Fixed conflict
djm81 Feb 14, 2026
d8d17a5
fix: rename LICENSE.md to LICENSE for GitHub license detection (#233)
djm81 Feb 14, 2026
100c94f
fix: restore standard Apache 2.0 license text for GitHub detection (#…
djm81 Feb 14, 2026
002cf19
Merge branch 'main' into dev
djm81 Feb 14, 2026
ee0b766
Add openspec changes for architecture level enhancement
djm81 Feb 15, 2026
540c96a
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 15, 2026
ea430ab
Merge branch 'main' into dev
djm81 Feb 15, 2026
6dc73ca
Merge branch 'main' into dev
djm81 Feb 16, 2026
d621e91
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 16, 2026
1b06427
feat(ci): attach test and repro log artifacts to PR orchestrator runs…
djm81 Feb 16, 2026
0bc52a5
feat: enhanced module manifest security and integrity (arch-06) (#263)
djm81 Feb 16, 2026
3f09ee7
feat: Schema Extension System for Modular ProjectBundle Extensions (a…
djm81 Feb 16, 2026
e959e61
Merge branch 'main' into dev
djm81 Feb 16, 2026
ba08744
Fix codeql findings
djm81 Feb 16, 2026
a3a3b6a
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 16, 2026
87a499f
Merge branch 'main' into dev
djm81 Feb 17, 2026
faf3b2e
feat(workflow): standardize worktree-first development flow (#268)
djm81 Feb 17, 2026
5c72c9f
Fix review finding
djm81 Feb 17, 2026
c51e96e
Merge branch 'main' into dev
djm81 Feb 17, 2026
deb176a
feat: implement policy-engine-01 unified policy framework (#270)
djm81 Feb 18, 2026
22a19a9
fix: harden policy module imports and snapshot path resolution
djm81 Feb 18, 2026
2724dbd
Merge branch 'main' into dev
djm81 Feb 18, 2026
1970266
Update backlog core change to cover workspace level modules
djm81 Feb 18, 2026
806f765
feat(init): align init module discovery with registry (backlog-core-0…
djm81 Feb 18, 2026
87dafba
feat: add thorough codebase validation (validation-01, #163) (#272)
djm81 Feb 18, 2026
1aac44f
feat: add patch apply (local + --write with confirmation) [#177] (#273)
djm81 Feb 18, 2026
d835ffb
feat: add bundle-mapper module (bundle-mapper-01, #121) (#274)
djm81 Feb 18, 2026
85576de
Archive finished changes
djm81 Feb 18, 2026
94a8ed1
fix: implement verification-01 wave1 delta closure (#277)
djm81 Feb 18, 2026
0f4a77c
Archive delta validation change and update specs
djm81 Feb 18, 2026
e2c93d1
Update patch version
djm81 Feb 18, 2026
c1c41f5
Potential fix for pull request finding 'Empty except'
djm81 Feb 19, 2026
27063ba
apply review fixes
djm81 Feb 19, 2026
6350aa8
Merge branch 'main' into dev
djm81 Feb 19, 2026
767d5b8
Add cli validation changes
djm81 Feb 19, 2026
3f4e1a3
Merge branch 'main' into dev
djm81 Feb 19, 2026
4f4b2ff
feat: launch central module marketplace lifecycle (#287)
djm81 Feb 21, 2026
78ddf06
Merge branch 'main' into dev
djm81 Feb 21, 2026
6772f0a
fix: resolve bundle-mapper review defects with TDD evidence (#290)
djm81 Feb 22, 2026
4529df1
feat:Add architecture review docs and findings to mitigate
djm81 Feb 22, 2026
cc50388
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 22, 2026
53a0fce
feat(backlog): add backlog add for interactive issue creation (#289)
djm81 Feb 22, 2026
c651c42
chore(openspec): archive completed changes and align architecture doc…
djm81 Feb 22, 2026
d7e8199
docs(change): Archive architecture discrepancy remediation change
djm81 Feb 22, 2026
aa4a9fb
fix(codeql): preserve module contract marker and document fallback ex…
djm81 Feb 22, 2026
176cd09
Merge branch 'main' into dev
djm81 Feb 22, 2026
30e2bbe
fix(backlog): restore installed-runtime discovery parity and add back…
djm81 Feb 23, 2026
9f479e4
fix(version): sync manifests to 0.36.1 and archive backlog-core-04 (#…
djm81 Feb 23, 2026
37a4a30
Merge branch 'main' into dev
djm81 Feb 23, 2026
991d568
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 23, 2026
15194b8
fix: harden module lifecycle bootstrap and signing workflows (#299)
djm81 Feb 24, 2026
a819852
test: simplify monkeypatch callables in module_security tests
djm81 Feb 24, 2026
67cd7e9
Merge branch 'main' into dev
djm81 Feb 24, 2026
078012f
Fix duplicate with statement
djm81 Feb 24, 2026
fa0604a
Merge branch 'main' into dev
djm81 Feb 24, 2026
c3f5bb6
chore(release): bump to v0.37.1 and harden signature gates
djm81 Feb 24, 2026
c0692e9
test: fix init command regression assertions
djm81 Feb 24, 2026
7787ba7
Merge branch 'main' into dev
djm81 Feb 24, 2026
db8d153
fix: release v0.37.2 with runtime crypto deps
djm81 Feb 24, 2026
cce4cf7
fix: address signature-backend warning and module version drift
djm81 Feb 24, 2026
297fb6c
fix: use hatch build in PyPI publish workflow script (#304)
djm81 Feb 24, 2026
e63669c
Merge branch 'main' into dev
djm81 Feb 24, 2026
dad2381
fix: resolve startup module freshness home path dynamically (#306)
djm81 Feb 24, 2026
0e1ac55
Merge branch 'main' into dev
djm81 Feb 24, 2026
764e5c9
Merge branch 'main' into dev
djm81 Feb 24, 2026
fa8708c
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 24, 2026
5d90ced
fix: harden module signing workflow and reduce startup log noise
djm81 Feb 24, 2026
276830e
test: align module migration compatibility with decoupled module vers…
djm81 Feb 24, 2026
effd96f
fix: fail fast on invalid base ref in changed-only module signing
djm81 Feb 24, 2026
798fc1a
fix: stabilize module precedence and backlog github mapping flow
djm81 Feb 25, 2026
f72d6e8
merge: resolve main into dev and retain module/backlog updates
djm81 Feb 25, 2026
c6a05f5
fix(module-registry): persist disables and correct bundled availability
djm81 Feb 25, 2026
c9db837
Re-sign module registry and fix / ignore local temp artifacts
djm81 Feb 25, 2026
db4da83
bump module registry version to 0.1.3
djm81 Feb 25, 2026
48ae89b
fix(registry): restore protocol reporting logs in debug mode
djm81 Feb 25, 2026
c87c2d0
Merge branch 'main' into dev
djm81 Feb 25, 2026
619f2a3
fix(backlog): harden refine writeback, prompts, and any-filter semant…
djm81 Feb 25, 2026
818dd32
fix(hooks,ado): correct format gate and enforce iteration on direct
djm81 Feb 25, 2026
954ff76
Apply review findings and fix tests
djm81 Feb 26, 2026
9825acd
Merge branch 'main' into dev
djm81 Feb 26, 2026
27b4078
Pin virtualenv < 21 to avoid incaopatibility failure
djm81 Feb 26, 2026
f9e9d74
Merge branch 'main' into dev
djm81 Feb 26, 2026
567a303
fix: finalize backlog-core-06 ado comment API versioning (#314)
djm81 Feb 26, 2026
a95e89f
feat: Advanced marketplace features (marketplace-02) - dependency res…
djm81 Feb 27, 2026
4a0620a
Merge branch 'main' into dev
djm81 Feb 27, 2026
c5635c9
fix: complete marketplace publish registry PR flow and bump (#320)
djm81 Feb 27, 2026
4ec9bdc
Merge branch 'main' into dev
djm81 Feb 27, 2026
f48631d
fix: update init ide hint and repair publish workflow
djm81 Feb 27, 2026
37d8475
Merge branch 'main' into dev
djm81 Feb 27, 2026
8be301e
feat(backlog): normalize daily summarize Markdown output (#323)
djm81 Feb 27, 2026
a6dcab0
Update version
djm81 Feb 27, 2026
0b99c6c
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Feb 27, 2026
073ae36
Merge branch 'main' into dev
djm81 Feb 27, 2026
2f13173
Add github skills
djm81 Feb 27, 2026
1e743b5
Add new marketplace changes
djm81 Feb 27, 2026
da80932
feat(cli): category groups and flat shims using real module Typer (#331)
djm81 Feb 28, 2026
c480e19
Update docs regarding module migration change
djm81 Feb 28, 2026
039da8b
feat: module-migration-02 bundle extraction (#332)
djm81 Mar 2, 2026
f4ae6b0
Implement blockers to prepare for module-migration-03 change. (#336)
djm81 Mar 2, 2026
efadc08
feat: module-migration-03 core slimming closeout and registry fixes (…
djm81 Mar 3, 2026
aeeaab0
Finalize module-migration-02 change
djm81 Mar 3, 2026
e1a90be
docs(backlog-auth): update auth docs and OpenSpec task status (#342)
djm81 Mar 3, 2026
d7d7c68
chore(openspec): archive completed changes and sync main specs
djm81 Mar 3, 2026
27ef25a
docs(openspec): prefix module migration proposal titles with IDs
djm81 Mar 3, 2026
594b0fa
Add bug change for ado required fields setting and update change order
djm81 Mar 4, 2026
10c1d6c
Update change order
djm81 Mar 4, 2026
f86b516
feat(core): finalize migration-03 auth removal and 3-core slim packag…
djm81 Mar 4, 2026
8b0e0d8
Archive module-migration-03 change
djm81 Mar 4, 2026
b1e9245
feat: remove flat command shims (category-only CLI) (#344)
djm81 Mar 4, 2026
5f9b537
Archived module-migration-04 and updated specs
djm81 Mar 4, 2026
ebb6e61
docs(openspec): finalize module-migration-05 tracking after modules P…
djm81 Mar 4, 2026
29df29c
Archive module-migration-05 change and update specs
djm81 Mar 4, 2026
1811f68
test(migration-06): move legacy sync tests out of core (#346)
djm81 Mar 5, 2026
61352f7
Archived module-migration-06 change and updated specs
djm81 Mar 5, 2026
9483fea
test: module-migration-07 core test ownership cleanup (#347)
djm81 Mar 5, 2026
c48fadb
Archived backlog-core-07 change and updated specs
djm81 Mar 5, 2026
2dd42f8
Update some docs and archive latest finished changes and specs
djm81 Mar 5, 2026
1e11e0a
Add docs update change
djm81 Mar 5, 2026
1578c6c
feat: add agile-01-feature-hierarchy change and update CHANGE_ORDER.m…
djm81 Mar 5, 2026
32c6fc1
docs: align core docs and sync pending changes (#377)
djm81 Mar 5, 2026
6b518b6
fix: stabilize release test suite after module migration
djm81 Mar 6, 2026
39409c5
Update module
djm81 Mar 6, 2026
675277f
Merge origin/main into dev for v0.40.0 release
djm81 Mar 6, 2026
acb3f88
Fix module install
djm81 Mar 6, 2026
04e96c5
Fix module install
djm81 Mar 6, 2026
4616064
Fix failed tests
djm81 Mar 6, 2026
53ed3a0
Merge branch 'main' into dev
djm81 Mar 6, 2026
e1a239e
Fix marketplace client regression
djm81 Mar 6, 2026
23ef66c
Merge branch 'main' into dev
djm81 Mar 6, 2026
d578657
Fix install regression for specfact-cli (#380)
djm81 Mar 6, 2026
5c8b661
Merge branch 'main' into dev
djm81 Mar 6, 2026
3de7b1c
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Mar 6, 2026
40e9695
Add changes to improve runtime validation and backlog module remainin…
djm81 Mar 6, 2026
978cc82
refactor: remove backlog ownership from core cli (#384)
djm81 Mar 6, 2026
00658a3
Add new command alignment change
djm81 Mar 6, 2026
f8e5af1
Merge branch 'dev' of https://github.com/nold-ai/specfact-cli into dev
djm81 Mar 6, 2026
08f028a
Merge branch 'main' into dev
djm81 Mar 6, 2026
332949e
fix: finalize cli runtime validation regressions (#387)
djm81 Mar 9, 2026
2a4a0ab
docs: archive cli-val-07 change
djm81 Mar 9, 2026
d031281
Archive changes and update specs
djm81 Mar 9, 2026
d21e157
Merge branch 'main' into dev
djm81 Mar 9, 2026
216f03f
Add code-review change proposals
djm81 Mar 10, 2026
e979938
test: align command surface regression coverage
djm81 Mar 10, 2026
9612cff
docs: add OpenSpec change for backlog-core commands migration (#390)
djm81 Mar 10, 2026
bd5badd
fix: use POST instead of PATCH for ADO work item creation (#391)
djm81 Mar 11, 2026
0448022
docs: archive backlog-02-migrate-core-commands change
djm81 Mar 11, 2026
e91e672
feat: document code-review module scaffold (#410)
djm81 Mar 11, 2026
aa494ff
Add change for project codebase ownership
djm81 Mar 11, 2026
b62292c
Merge branch 'main' into dev
djm81 Mar 11, 2026
67aaf31
Realign code import ownership surface (#412)
djm81 Mar 12, 2026
1f4d236
Update code review changes
djm81 Mar 16, 2026
516b4c7
docs: update reward ledger OpenSpec tracking (#413)
djm81 Mar 16, 2026
8579fe5
Track house-rules skill OpenSpec changes (#414)
djm81 Mar 16, 2026
ff8d041
docs: Update change-proposal for code-review-07 (#415)
djm81 Mar 16, 2026
b524f3a
Finalize code-review-07 status
djm81 Mar 16, 2026
097d8ef
Finalize code-review-08 status
djm81 Mar 16, 2026
37efea0
feat: apply code-review-09 pre-commit integration
djm81 Mar 17, 2026
fa503da
fix: fall back when cached hatch test env is broken
djm81 Mar 17, 2026
6e828e7
fix: avoid hatch env for coverage xml export
djm81 Mar 17, 2026
0aa178f
fix: install type-check and lint tools directly in CI
djm81 Mar 17, 2026
9f6a749
fix: install pytest fallback deps in test job
djm81 Mar 17, 2026
c451134
fix: install pytest-cov for test fallback path
djm81 Mar 17, 2026
f328223
Merge branch 'main' into dev
djm81 Mar 17, 2026
9146118
Merge branch 'main' into dev
djm81 Mar 17, 2026
0aa017d
Finalize code-review-09 status
djm81 Mar 17, 2026
f067288
[Change] Align core docs with modules site ownership (#419)
djm81 Mar 17, 2026
e456d46
fix: harden docs parity URL assertions
djm81 Mar 17, 2026
41052e6
Archive finished changes and update specs
djm81 Mar 17, 2026
05e81bb
Merge branch 'main' into dev
djm81 Mar 17, 2026
0648162
docs: fix command syntax parity after lean-core/modules split (v0.42.…
djm81 Mar 17, 2026
a6978a2
Archive finished changes and update specs
djm81 Mar 17, 2026
0273f1a
Update evidence
djm81 Mar 17, 2026
8ec2c11
Potential fix for pull request finding 'Unused global variable'
djm81 Mar 17, 2026
7d63dd8
Merge branch 'main' into dev
djm81 Mar 18, 2026
a77e5fd
docs: align core docs ownership and parity (#424)
djm81 Mar 20, 2026
664d4e4
docs: fix quickstart install guidance
djm81 Mar 20, 2026
09688de
docs: remove generated project plan docs
djm81 Mar 20, 2026
f7cca1e
Merge branch 'main' into dev
djm81 Mar 20, 2026
f4e91be
Add code-review change
djm81 Mar 20, 2026
37dfecb
fix: preserve native backlog import payloads (#429)
djm81 Mar 20, 2026
b54aaa6
fix: add docs review workflow and repair docs links (#428)
djm81 Mar 20, 2026
ae7f05c
fix: keep imported change ids stable across title changes (#431)
djm81 Mar 20, 2026
7449714
Merge branch 'main' into dev
djm81 Mar 20, 2026
65726fb
fix: remove conflicting pages file copies
djm81 Mar 20, 2026
fbb3b83
Merge branch 'main' into dev
djm81 Mar 20, 2026
c6c47fc
Add docs sync changs
djm81 Mar 20, 2026
eaa87ac
docs: update openspec clean-code planning
djm81 Mar 22, 2026
f602dba
Update change status
djm81 Mar 22, 2026
58314e5
fix: code-review-zero-findings dogfood remediation (v0.42.3) (#435)
djm81 Mar 23, 2026
fb3c5fd
Merge branch 'main' into dev
djm81 Mar 23, 2026
2809390
Add docs refactoring changes
djm81 Mar 23, 2026
215df59
Add bug change tracking for encoding and resources
djm81 Mar 24, 2026
2a60f15
docs: restructure core site IA to 6-section progressive nav (#442)
djm81 Mar 24, 2026
81bca26
fix: harden cross-platform runtime and IDE resource discovery (#443)
djm81 Mar 24, 2026
852f446
fix: resolve review type-safety findings
djm81 Mar 24, 2026
2bbde33
Merge branch 'main' into dev
djm81 Mar 24, 2026
8272233
Improve clarity and scope of ide prompt change
djm81 Mar 25, 2026
2f0675c
feat(init): IDE prompt source catalog, --prompts, namespaced exports …
djm81 Mar 25, 2026
278142e
fix tests
djm81 Mar 25, 2026
38a9d21
release: bump version to 0.42.5 and update CHANGELOG
djm81 Mar 25, 2026
f552107
Fix review findings
djm81 Mar 25, 2026
dab2ffe
feat(init): selective IDE prompt export cleanup and VS Code recommend…
djm81 Mar 25, 2026
fbb2307
Fix review findings
djm81 Mar 25, 2026
71e760b
Merge branch 'main' into dev
djm81 Mar 25, 2026
41dc0db
Add missing import
djm81 Mar 25, 2026
2b26098
Bump patch version and changelog
djm81 Mar 25, 2026
90da7da
Fix failed tests
djm81 Mar 25, 2026
1eca7a9
Fix review findings
djm81 Mar 25, 2026
07c19b4
Merge branch 'main' into dev
djm81 Mar 26, 2026
db4ddc3
docs: core vs modules URL contract and OpenSpec alignment (#448)
djm81 Mar 26, 2026
96f35d7
feat(docs-12): docs command validation and cross-site link checks (#449)
djm81 Mar 26, 2026
f11cb9e
fix(scripts): CliRunner without mix_stderr for Click 8.3+ compatibili…
djm81 Mar 26, 2026
7ccb122
fix: review gates (semgrep print, radon CC, icontract, questionary ty…
djm81 Mar 26, 2026
d516657
Merge branch 'main' into dev
djm81 Mar 26, 2026
86bdc7c
Add speckit adapter alignment change and update affected change specs
djm81 Mar 27, 2026
f92c820
feat(adapters): spec-kit v0.4.x adapter alignment (#454)
djm81 Mar 27, 2026
dd1e359
chore: bump version to 0.43.0 for spec-kit v0.4.x alignment (#455)
djm81 Mar 27, 2026
eec640e
fix(packaging): remove workflow prompts from core wheel (packaging-02…
djm81 Mar 27, 2026
f7fefdd
Potential fix for pull request finding 'Empty except'
djm81 Mar 28, 2026
280d158
Merge branch 'main' into dev
djm81 Mar 28, 2026
0cc2c3c
Fix changelog version
djm81 Mar 28, 2026
c1c2e47
docs: unify core docs portal UX (#459)
djm81 Mar 28, 2026
ce49cd5
Harden docs home URL test assertion
djm81 Mar 28, 2026
cb08cbb
Merge branch 'main' into dev
djm81 Mar 29, 2026
715d472
feat: doc frontmatter validation, v0.43.2 review JSON gate, and pre-c…
djm81 Mar 29, 2026
edc89a7
docs: archive doc-frontmatter-schema openspec change
djm81 Mar 29, 2026
85572f2
Apply suggestions from code review
djm81 Mar 29, 2026
117d568
fix: restore protocol stubs for type checking
djm81 Mar 29, 2026
582a53c
Add frontamtter check
djm81 Mar 29, 2026
4c4ef24
fix: harden protocol stubs for code quality
djm81 Mar 29, 2026
52ee695
Add PR test hardening change
djm81 Mar 29, 2026
644474a
fix: remediate review findings and harden review gates
djm81 Mar 30, 2026
3eff782
fix: rebuild review report model for pydantic
djm81 Mar 30, 2026
e44f15a
Merge branch 'main' into dev
djm81 Mar 30, 2026
93ff11e
Add story and onboarding change
djm81 Mar 30, 2026
506679e
Update change tracking
djm81 Mar 30, 2026
f84aa39
Improve scope for ci/cd requirements
djm81 Mar 30, 2026
11391c9
docs: sharpen first-contact story and onboarding (#467)
djm81 Mar 30, 2026
0fc5f1f
fix: harden review blockers and bump patch version
djm81 Mar 30, 2026
ab42fd0
test: harden modules docs url assertions
djm81 Mar 30, 2026
93b6dee
Merge branch 'main' into dev
djm81 Mar 30, 2026
c5efee3
fix: harden trustworthy green checks (#469)
djm81 Mar 30, 2026
30c70f3
fix: address CodeRabbit review findings for ci-02 (#471)
djm81 Mar 30, 2026
7709718
fix: propagate docker actionlint exit code instead of masking failure…
djm81 Mar 30, 2026
1ffdace
fix: assert hook id stability and cd to repo root for local actionlin…
djm81 Mar 30, 2026
4dcf207
Merge branch 'main' into dev
djm81 Mar 30, 2026
9dbe9d4
feat: clean-code-01-principle-gates β€” 7-principle charter gates, v0.4…
djm81 Mar 31, 2026
9855d35
feat: archive completed openspec changes and update main specs
djm81 Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 102 additions & 141 deletions .cursor/rules/clean-code-principles.mdc
Original file line number Diff line number Diff line change
@@ -1,148 +1,109 @@
---
description: Enforce clean-code principles and enforcements across the repository.
description: Enforce the 7-principle clean-code charter across the repository.
globs:
alwaysApply: true
---
# Rule: Clean Code Principles and Enforcements

Description:
This rule enforces concrete clean-code practices across the repository. It complements existing high-level rules (TDD, linting, formatting, coverage) by adding behavioral and API-consistency checks, with deterministic commands and examples.

Why:

- Reduce cognitive load and debugging time by standardizing error handling, return types, logging, and small, single-purpose functions.
- Make automated checks (pre-commit/CI) able to catch non-style problems (bare-excepts, prints, mixed return semantics, state-machine/config mismatches).

Scope:
Applies to all python files under src/ and tests/ and any state-machine generation artifacts.

Enforcement checklist (machine-checkable where possible):

1. No bare except or broad except Exception without re-raising or logging full context
- Rationale: Broad excepts hide real failures.
- Check: run pylint with a custom plugin or flake8 rule to detect "except:" or "except Exception:" that either:
- swallow the exception without re-raising, or
- do not call logger.exception(...) (stack trace).
- Command (CI): flake8 --select E722,B001 (or custom check)
- Example (bad):
try:
...
except Exception:
pass
- Example (good):
except SpecificError as e:
logger.error("...: %s", e)
raise

2. No direct print() calls in library modules
- Rationale: Use LoggerSetup for structured logs and session IDs.
- Check: grep for "print(" in src/ and tests/ (fail in src/)
- Command (CI): git grep -n -- '^\s*print\(' -- src/ && fail
- Fix: Replace print with LoggerSetup.get_logger(...) or setup_logger(...)

3. Enforce consistent return types (avoid implicit None/False mixing)
- Rationale: Functions exposed as API should have typed, predictable returns.
- Rules:
- Publishing/IO methods must return bool (True/False), not None. If underlying library returned int, normalize.
- connect() should return bool only.
- Check: static analysis rule or unit test that asserts function annotations and runtime contract on a selection of public functions (RedisClient.publish/connect, MessagingStandardization.*)
- Example (good):
def publish(...) -> bool: ...
return True/False

4. Prefer specific exceptions & re-raise after logging
- Rationale: Keep failure semantics explicit for callers and tests.
- Rule: Do not swallow exceptions. If a function handles and cannot continue, raise a domain-specific exception or re-raise.

5. Limit line / function complexity
- Rationale: Keep functions short and single-responsibility.
- Rules:
- Maximum function length: 120 lines (configurable)
- Maximum cyclomatic complexity: 12
- Check: use radon cc --total-average and flake8-ext or pylint thresholds
- Command (CI): radon cc -nc -s src/ && fail if any > 12

6. Use centralized logging, never ad-hoc formatting
- Rationale: Keep consistent format and redaction.
- Rules:
- Use LoggerSetup.get_logger or setup_logger to obtain logger.
- No module-level printing of messages; message flow logs should go via agent_flow logger.
- Check: grep for 'logging.getLogger(' and verify consistent usage, grep for 'print(' (see rule 2).

7. Avoid filesystem operations with overly permissive modes
- Rationale: 0o777 should not be used by default.
- Rule: mkdir/os.makedirs must not be invoked with mode=0o777. Use 0o755 or use environment-controlled mode.
- Check: grep for '0o777' and require explicit justification in code comments; CI should flag occurrences.

8. State machine / YAML consistency check
- Rationale: Generated state machines must match canonical YAML config.
- Rule: Add a unit/regression test that:
- reloads src/common/*.py generated state machine enums and compares state names and transitions to autodev_config.yaml and productplan_config.yaml
- fails the build if mismatch or case differences are present
- Check: add tests/unit/test_state_machine_config_sync.py
- Command (CI): hatch test tests/unit/test_state_machine_config_sync.py

9. No side-effects at import time
- Rationale: Module imports should be safe and predictable for tests and tools.
- Rule: Avoid heavy I/O or network calls on import. get_runtime_logs_dir may create directories β€” allowed only if idempotent and documented; avoid network calls or spawn threads.
- Check: grep for network or redis connection calls at module-level (e.g., RedisSDK(...)).

10. Async / signal safety
- Rationale: Signal handlers must not call non-signal-safe operations.
- Rule: Signal handlers may only set a flag or call a thread-safe routine; do not call asyncio.create_task directly from a POSIX signal handler.
- Check: grep for "signal.signal(" and assert handler functions only set flags or use loop.call_soon_threadsafe.
- Suggested fix: replace create_task calls in handler with loop.call_soon_threadsafe(lambda: asyncio.create_task(...))

11. Secure secret redaction guaranteed
- Rationale: Sensitive keys must be masked in logs.
- Rule: LoggerSetup.redact_secrets must be covered by unit tests for nested dicts and strings.
- Check: add tests/unit/test_logger_redaction.py

12. Messaging coercion & strict validation
- Rationale: Legacy message coercion is useful but must be exercised and tested.
- Rule: Any place that uses coercion (MessagingStandardization.process_standardized_message) must have tests that validate coercion success/failure and metrics increments.
- Check: add unit tests that assert contextschema_coercion_success/failed metrics behave as expected.

13. Enforce pre-commit & CI gating
- Add pre-commit config that runs: black, isort, mypy, flake8 (with B/C plugins), radon, tests for state machine sync.
- CI job must fail on:
- lint failures
- radon/cyclomatic complexity
- state-machine config mismatch test
- flake8 error codes for prints and bare excepts

14. Documentation/commit habits
- Rule: Any code change that modifies public API, state machine YAMLs, or generated state machine outputs MUST:
- include/modify a unit test covering new behavior
- update docs/ and CHANGELOG.md
- include 'BREAKING' section in PR if public API changed
- Check: CI script that rejects PRs lacking test files changed when src/ is modified (heuristic).

Implementation guidance (how to add tests / checks quickly)

- Add a lightweight pytest module for state-machine YAML<->enum sync (example included in docs).
- Add flake8 plugin rules or configure pylint to error on 'print' and bare excepts; enable in CI config.
- Add radon complexity check step to pipeline; fail if thresholds exceeded.
- Add a small assertion test for RedisClient.publish return normalization.

Mapping to existing rules (what to augment)

- docs/rules/python-github-rules.md: Add explicit "no-bare-except" and "no-print" items and function complexity thresholds.
- docs/rules/spec-fact-cli-rules.md: Add "state-machine YAML / generated code sync check" and "normalize public API return types".
- docs/rules/testing-and-build-guide.md: Add specific test files to run (state-machine sync test, logger redaction tests) and mention radon/complexity checks.
- .cursor/rules/testing-and-build-guide.mdc and .cursor/rules/python-github-rules.mdc: include exact CLI commands and required test files (see enforcement checklist).

Developer notes (priorities)

1. Add the state-machine sync unit test (high value, low effort).
2. Add flake8/pylint rule to detect print/bare-except (medium effort).
3. Normalize RedisClient.publish/connect return values & add tests (low-to-medium effort).
4. Add radon step to CI and fix top offenders iteratively (ongoing).
5. Replace print() in AutoDevStateMachine.log with LoggerSetup.get_logger (small change, run tests).
# Rule: Clean-Code Principles and Review Gate

---
## Charter source of truth

The canonical 7-principle clean-code charter lives in:
- **Policy-pack**: `specfact/clean-code-principles` (shipped by `specfact-cli-modules`)
- **Skill file**: `skills/specfact-code-review/SKILL.md` in `nold-ai/specfact-cli-modules`

This file is an **alias surface** for the specfact-cli repository. It maps each
principle to its review category and records the Phase A gate thresholds so that
contributors, reviewers, and AI coding agents operate from the same reference
without duplicating the full charter text.

## The 7 clean-code principles

| # | Principle | Review category |
|---|-----------|-----------------|
| 1 | **Meaningful Naming** β€” identifiers reveal intent; avoid abbreviations | `naming` |
| 2 | **KISS** β€” keep functions and modules small and single-purpose | `kiss` |
| 3 | **YAGNI** β€” do not add functionality until it is needed | `yagni` |
| 4 | **DRY** β€” single source of truth; eliminate copy-paste duplication | `dry` |
| 5 | **SOLID** β€” single responsibility, open/closed, Liskov, interface segregation, dependency inversion | `solid` |
| 6 | **Small, focused functions** β€” each function does exactly one thing (subsumed by KISS metrics) | `kiss` |
| 7 | **Self-documenting code** β€” prefer expressive code over inline comments; comments explain *why* not *what* | `naming` |

## Active gate: Phase A KISS metrics

The following thresholds are **enforced** through the `specfact code review run`
gate and the pre-commit hook (`scripts/pre_commit_code_review.py`):

| Metric | Warning | Error |
|--------|---------|-------|
| Lines of code per function (LOC) | > 80 (warning) | > 120 (error) |
| Nesting depth | configurable (phase A) | configurable (phase A) |
| Parameter count | configurable (phase A) | configurable (phase A) |

Nesting-depth and parameter-count checks are **active** in Phase A.

### Phase B (deferred)

Phase B thresholds (`> 40` warning / `> 80` error for LOC) are planned for a
future cleanup change once the initial Phase A remediation is complete.
**Phase B is not yet a hard gate.** Do not silently promote Phase B thresholds
when configuring or extending the review gate.

## Review categories consumed by this repo

When `specfact code review run` executes against this codebase the following
clean-code categories from the expanded review module are included:

- `naming` β€” semgrep naming and exception-pattern rules
- `kiss` β€” radon LOC/nesting/parameter findings under Phase A thresholds
- `yagni` β€” AST-based unused-abstraction detection
- `dry` β€” AST clone-detection and duplication findings
- `solid` β€” AST dependency-role and single-responsibility checks

Zero regressions in these categories are required before a PR is merge-ready.

## Per-principle enforcement notes

### Naming (`naming`)

- Identifiers in `src/` must use `snake_case` (modules/functions), `PascalCase` (classes), `UPPER_SNAKE_CASE` (constants).
- Avoid single-letter names outside short loop variables.
- Exception patterns must not use broad `except Exception` without re-raising or logging.

### KISS (`kiss`)

- Maximum function length: **120 lines** (Phase A error threshold).
- Maximum cyclomatic complexity: **12** (radon `cc` threshold; `>= 16` is error band).
- Phase A LOC warning at > 80, error at > 120.

### YAGNI (`yagni`)

- Do not add configuration options, flags, or extension points until a concrete use-case drives them.
- Remove dead code paths rather than commenting them out.

### DRY (`dry`)

- Do not copy-paste logic; extract to a shared function or module.
- Single source of truth for schemas (Pydantic `BaseModel`), constants (`UPPER_SNAKE_CASE`), and templates (`resources/templates/`).

### SOLID (`solid`)

- Each module/class has a single clearly named responsibility.
- Extend via dependency injection (adapters pattern) rather than modifying existing classes.
- Use `@icontract` (`@require`/`@ensure`) and `@beartype` on all public APIs.

## Additional behavioral rules (complement SOLID/KISS)

- No `print()` calls in `src/` β€” use `from specfact_cli.common import get_bridge_logger`.
*(Note: T20 is currently ignored in pyproject.toml and not enforced by the review gate; this is aspirational.)*
- No broad `except Exception` without re-raising or logging.
*(Note: W0718 is disabled in .pylintrc; broad-exception checks are aspirational.)*
- No side-effects at import time (no network calls, no file I/O on module load).
- Signal handlers must only set a flag or use `loop.call_soon_threadsafe`.
- Filesystem modes must not use `0o777`; use `0o755` or environment-controlled mode.
- Secret redaction via `LoggerSetup.redact_secrets` must be covered by unit tests.

Changelog / Expected follow-up
## Pre-commit and CI enforcement

- After adding these rules, update CI to run the new checks and add sample unit tests that fail on violations.
- Run hatch test and the new linters locally; fix top offenders in an iterative PR with small, focused commits.
The `specfact-code-review-gate` pre-commit hook and the `hatch run specfact code
review run --json --out .specfact/code-review.json` command both enforce these
principles. Run the review before submitting a PR and resolve every finding.
23 changes: 23 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# GitHub Copilot Instructions β€” specfact-cli

## Clean-Code Charter

This repository enforces the **7-principle clean-code charter** defined in:
- `skills/specfact-code-review/SKILL.md` (`nold-ai/specfact-cli-modules`)
- Policy-pack: `specfact/clean-code-principles`

Review categories checked on every PR: **naming Β· kiss Β· yagni Β· dry Β· solid**

Phase A KISS thresholds: LOC > 80 warning / > 120 error per function.
Nesting-depth and parameter-count checks are active. Phase B (>40/80) is deferred.

Run `hatch run specfact code review run --json --out .specfact/code-review.json` before submitting.

## Key conventions

- Python 3.11+, Typer CLI, Pydantic models, `@icontract` + `@beartype` on all public APIs
- No `print()` in `src/` β€” use `get_bridge_logger()`
- Branch protection: work on `feature/*`, `bugfix/*`, `hotfix/*` branches; PRs to `dev`
- Pre-commit checklist: `hatch run format` β†’ `type-check` β†’ `lint` β†’ `yaml-lint` β†’ `contract-test` β†’ `smart-test`

See `AGENTS.md` and `.cursor/rules/` for the full contributor guide.
20 changes: 20 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ hatch run specfact code review run --json --out .specfact/code-review.json

- OpenSpec change **`tasks.md`** should include explicit tasks for generating/updating this file and clearing findings (see `openspec/config.yaml` β†’ `rules.tasks` β†’ β€œSpecFact code review JSON”). Agent runs should treat those tasks and this section as the same bar.

### Clean-Code Review Gate

specfact-cli enforces the 7-principle clean-code charter through the `specfact code review run` gate. The canonical charter lives in `skills/specfact-code-review/SKILL.md` (in `nold-ai/specfact-cli-modules`). This repo consumes the expanded clean-code categories from that review module:

| Category | Principle covered |
|----------|-------------------|
| `naming` | Meaningful naming, exception-pattern rules |
| `kiss` | Keep It Simple: LOC, nesting-depth, parameter-count (Phase A: >80 warning / >120 error) |
| `yagni` | You Aren't Gonna Need It: unused-abstraction detection |
| `dry` | Don't Repeat Yourself: clone-detection and duplication checks |
| `solid` | SOLID principles: dependency-role and single-responsibility checks |

Zero regressions in any of these categories are required before merge. Run the review gate with:

```bash
hatch run specfact code review run --json --out .specfact/code-review.json
```

**Phase A thresholds are active.** Phase B thresholds (>40 / >80 LOC) are deferred to a later cleanup change and are not yet enforced.

### Module Signature Gate (Required for Change Finalization)

Before PR creation, every change MUST pass bundled module signature verification:
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ All notable changes to this project will be documented in this file.

---

## [0.44.0] - 2026-03-31

### Added

- **Clean-code principle gates** (`clean-code-01-principle-gates`):
- `.cursor/rules/clean-code-principles.mdc` restructured as a canonical alias for the
7-principle clean-code charter (`naming`, `kiss`, `yagni`, `dry`, `solid`) defined in
`nold-ai/specfact-cli-modules` (`skills/specfact-code-review/SKILL.md`).
- Phase A KISS metric thresholds documented: LOC > 80 warning / > 120 error per function;
nesting-depth and parameter-count checks active. Phase B (> 40 / > 80) explicitly deferred.
- `AGENTS.md` and `CLAUDE.md` extended with a **Clean-Code Review Gate** section listing
the 5 expanded review categories and the Phase A thresholds that gate every PR.
- `.github/copilot-instructions.md` created as a lightweight alias surface that references
the canonical charter without duplicating it inline.
- Unit tests: `tests/unit/specfact_cli/test_clean_code_principle_gates.py` covering all
three spec scenarios (charter references, compliance gate, LOC/nesting check).

---

## [0.43.3] - 2026-03-30

### Fixed
Expand Down
20 changes: 20 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,26 @@ Run all steps in order before committing. Every step must pass with no errors.
5. `hatch run contract-test` # contract-first validation
6. `hatch run smart-test` # targeted test run (use `smart-test-full` for larger modifications)

### Clean-Code Review Gate

specfact-cli enforces the 7-principle clean-code charter through the `specfact code review run` gate. The canonical charter lives in `skills/specfact-code-review/SKILL.md` (in `nold-ai/specfact-cli-modules`). This repo consumes the expanded clean-code categories from that review module:

| Category | Principle covered |
|----------|-------------------|
| `naming` | Meaningful naming, exception-pattern rules |
| `kiss` | Keep It Simple: LOC, nesting-depth, parameter-count (Phase A: >80 warning / >120 error) |
| `yagni` | You Aren't Gonna Need It: unused-abstraction detection |
| `dry` | Don't Repeat Yourself: clone-detection and duplication checks |
| `solid` | SOLID principles: dependency-role and single-responsibility checks |

Zero regressions in any of these categories are required before merge. Run the review gate with:

```bash
hatch run specfact code review run --json --out .specfact/code-review.json
```

**Phase A thresholds are active.** Phase B thresholds (>40 / >80 LOC) are deferred to a later cleanup change and are not yet enforced.

### OpenSpec Workflow

Before modifying application code, **always** verify that an active OpenSpec change in `openspec/changes/` **explicitly covers the requested modification**. This is the spec-driven workflow defined in `openspec/config.yaml`. Skip only when the user explicitly says `"skip openspec"` or `"implement without openspec change"`.
Expand Down
6 changes: 6 additions & 0 deletions openspec/CHANGE_ORDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ Only changes that are **archived**, shown as **βœ“ Complete** by `openspec list`

Entries in the tables below are pending unless explicitly marked as implemented (archived).

## Clean-code enforcement

| Module | Order | Change folder | GitHub # | Blocked by |
|--------|-------|---------------|----------|------------|
| clean-code | 01 | clean-code-01-principle-gates | [#434](https://github.com/nold-ai/specfact-cli/issues/434) | code-review-zero-findings βœ…; clean-code-02-expanded-review-module (modules repo) βœ… |

## Dogfooding

| Module | Order | Change folder | GitHub # | Blocked by |
Expand Down
Loading
Loading