Skip to content

Commit eb22145

Browse files
tbitcsoz-agent
andcommitted
docs: comprehensive update for all session changes
Upgrader: init credit tracking on upgrade (joins init + import) CHANGELOG: full unreleased section covering credits (#50/#51), architect (#49), self-update, multi-language, dynamic versioning, templates (#39/#40/#43), import quality (#46/#47/#48), all bug fixes README: updated command table (40+ commands), added architect/self-update/credits REQUIREMENTS.md: 20 new requirements across 5 sections: - REQ-CRD-001..009 (credit tracking) - REQ-ARC-001..004 (architecture generation) - REQ-SLF-001..003 (self-update) - REQ-TPL-005..008 (templates) TEST_SPEC.md: added TEST-SBX-013/014 (import with existing docs) RTD commands.md: added architect, self-update, credits command docs Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent ab96375 commit eb22145

6 files changed

Lines changed: 126 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- **Dynamic versioning**: `__version__` now reads from `importlib.metadata` at runtime instead of hardcoded strings. Docs use `{{ version }}` placeholders resolved by MkDocs hook. Tests are version-agnostic.
12-
- **Multi-language detection**: importer now detects and reports all significant languages (primary + secondary). Architecture, AGENTS.md, and CLI display show the full language mix.
13-
- **`specsmith self-update`** command: auto-detects channel (stable/dev), supports `--channel` override and `--version` pinning.
14-
- **Dev-release workflow for managed projects** (#35): `specsmith init` with gitflow + GitHub + Python now generates `.github/workflows/dev-release.yml`.
15-
- **No-hardcoded-versions rule** (H10): governance template and WARP rule enforce `pyproject.toml` as single version source of truth.
16-
- **Separate PyPI badges**: README shows both stable (blue) and dev (orange) version badges.
11+
- **AI credit tracking** (#50): `specsmith credits` subcommand group — record, summary, report, analyze, budget. Tracks tokens/cost per session, model, provider, and task. JSON storage at `.specsmith/credits.json`.
12+
- **Credit spend analysis** (#51): `specsmith credits analyze` detects model inefficiency, token waste, governance bloat, cost trends. Generates optimization recommendations with estimated savings.
13+
- **Credit budget/watermarks**: `specsmith credits budget --cap 50 --watermarks 5,10,25,50`. Monthly caps, alert thresholds, watermark notifications. Filed #52 for hard-cap enforcement.
14+
- **Auto-init credit tracking**: `init`, `import`, and `upgrade` all create `.specsmith/credit-budget.json` with unlimited default budget. `.specsmith/` gitignored.
15+
- **`specsmith architect`** (#49): interactive architecture generation — scans project, interviews user about components/data flow/deployment, generates rich `docs/architecture.md`.
16+
- **`specsmith self-update`**: auto-detects channel (stable/dev), supports `--channel` override and `--version` pinning.
17+
- **Multi-language detection**: importer detects and reports all significant languages (primary + secondary).
18+
- **Dynamic versioning**: `__version__` reads from `importlib.metadata`. Docs use `{{ version }}` hook. Tests are version-agnostic.
19+
- **Dev-release workflow for managed projects** (#35): gitflow + GitHub + Python generates `.github/workflows/dev-release.yml`.
20+
- **Type-specific templates**: .gitattributes (#39) for 15 language types, .gitignore (#40) expanded for all 30 types, .editorconfig (#43) with per-language indent settings.
21+
- **Yocto/bitbake/devicetree/markdown**: `.bbclass`, `.inc`, `.dts`, `.dtsi` in language detection; `kas.yml` build system; enhanced CI metadata.
22+
- **No-hardcoded-versions rule** (H10): governance template and WARP rule.
23+
- **Agent credit instructions**: Warp and Claude adapters include credit recording commands.
24+
- **Session-end credit summary**: `session-end` shows total spend and budget alerts.
1725

1826
### Fixed
19-
- **Import with large AGENTS.md** (#46): extraction now uses broader keyword matching, unmatched sections go to rules.md, oversized AGENTS.md is backed up and replaced with a hub.
27+
- **Import with large AGENTS.md** (#46): broader keyword extraction, diff marker stripping, paragraph dedup, existing doc detection.
28+
- **UnboundLocalError on import** with existing docs: scoping fix for REQUIREMENTS/TEST_SPEC/architecture skip logic.
29+
- **Audit false positive**: architecture docs found in subdirectories (e.g., `docs/architecture/DESIGN.md`).
30+
- **`audit --fix`** now generates missing recommended files (architecture.md from scan, REQUIREMENTS.md, TEST_SPEC.md stubs).
31+
- **Topic-aware section classification** (#47): body content keywords route sections to correct governance files.
32+
- **Type-specific audit thresholds** (#48): FPGA/embedded get higher limits (rules=1000, verification=600).
2033

2134
### Changed
22-
- RTD default version set to `stable`, default branch set to `develop` (`latest` now builds from develop).
35+
- RTD default version set to `stable`, default branch set to `develop`.
2336
- Docs version references use dynamic `{{ version }}` instead of hardcoded strings.
2437
- `init.py.j2` template for managed projects uses `importlib.metadata` pattern.
38+
- Governance file size thresholds raised globally (rules=800, verification=400).
39+
- Yocto toolset: added `testimage`, `yocto-check-layer` compliance.
2540

2641
## [0.1.3] - 2026-04-01
2742

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,23 @@ specsmith doctor --project-dir ./my-project # Tool check
5656

5757
Each type gets: tool-aware CI (correct lint/test/security/build tools), domain-specific directory structure, governance rules in AGENTS.md, and pre-populated requirements and test stubs.
5858

59-
## 30+ CLI Commands
59+
## 40+ CLI Commands
6060

6161
| Command | Purpose |
6262
|---------|---------|
6363
| `init` | Scaffold a new governed project |
6464
| `import` | Adopt an existing project (merge mode) |
6565
| `audit` | Drift detection and health checks (`--fix` to auto-repair) |
66+
| `architect` | Interactive architecture generation |
6667
| `validate` | Governance file consistency checks |
6768
| `compress` | Archive old ledger entries |
6869
| `upgrade` | Update governance to new spec version |
6970
| `status` | CI/PR/alert status from VCS platform |
7071
| `diff` | Compare governance against templates |
7172
| `export` | Compliance report with REQ↔TEST coverage |
7273
| `doctor` | Check if verification tools are installed |
74+
| `self-update` | Update specsmith (channel-aware) |
75+
| `credits` | AI credit tracking, analysis, and budgets |
7376

7477
## 7 Agent Integrations
7578

docs/REQUIREMENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,38 @@
150150
- **REQ-WFL-009**: specsmith commit --auto-push option to commit and push in one step
151151
- **REQ-WFL-010**: specsmith session-end provides checklist (unpushed commits, open TODOs, dirty files)
152152

153+
## Credit Tracking
154+
155+
- **REQ-CRD-001**: `specsmith credits record` stores token usage entry with model, provider, tokens, task, and estimated cost
156+
- **REQ-CRD-002**: `specsmith credits summary` shows aggregate spend by model, provider, and task
157+
- **REQ-CRD-003**: `specsmith credits report` generates markdown credit report
158+
- **REQ-CRD-004**: `specsmith credits analyze` detects model inefficiency, token waste, and cost trends
159+
- **REQ-CRD-005**: `specsmith credits budget` configures monthly cap, alert threshold, and watermark levels
160+
- **REQ-CRD-006**: Credit tracking auto-initialized on init, import, and upgrade with unlimited default
161+
- **REQ-CRD-007**: `.specsmith/` directory gitignored by default in generated projects
162+
- **REQ-CRD-008**: Session-end checklist includes credit summary and budget alerts
163+
- **REQ-CRD-009**: Agent adapters (Warp, Claude) include credit recording instructions
164+
165+
## Architecture Generation
166+
167+
- **REQ-ARC-001**: `specsmith architect` scans project for modules, languages, dependencies, git history
168+
- **REQ-ARC-002**: `specsmith architect` runs interactive interview for components, data flow, deployment
169+
- **REQ-ARC-003**: `specsmith architect --non-interactive` auto-generates without prompts
170+
- **REQ-ARC-004**: `audit --fix` generates architecture.md from project scan when missing
171+
172+
## Self-Update
173+
174+
- **REQ-SLF-001**: `specsmith self-update` auto-detects channel (stable/dev) from installed version
175+
- **REQ-SLF-002**: `specsmith self-update --channel dev` forces dev channel
176+
- **REQ-SLF-003**: `specsmith self-update --version X.Y.Z` pins to specific version
177+
178+
## Templates
179+
180+
- **REQ-TPL-005**: .gitattributes template includes type-specific patterns for all 30 project types
181+
- **REQ-TPL-006**: .gitignore template includes type-specific patterns for all 30 project types
182+
- **REQ-TPL-007**: .editorconfig template includes type-specific indent/EOL settings
183+
- **REQ-TPL-008**: Yocto/bitbake language detection includes .bbclass, .inc, .dts, .dtsi
184+
153185
## Cross-Platform
154186

155187
- **REQ-XPL-001**: All CLI commands work on Windows, Linux, and macOS

docs/TEST_SPEC.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@
173173
- **TEST-SBX-007**: Auditor tool verification on scaffolded project
174174
Covers: REQ-AUD-007, REQ-AUD-008
175175

176+
### Sandbox — Import with Existing Docs
177+
178+
- **TEST-SBX-013**: Import preserves existing REQUIREMENTS.md, TEST_SPEC.md, architecture docs
179+
Covers: REQ-IMP-008
180+
- **TEST-SBX-014**: Import with --force overwrites existing docs
181+
Covers: REQ-IMP-008
182+
176183
### Sandbox — Non-Python Types
177184

178185
- **TEST-SBX-008**: Patent application scaffold with domain directories, requirements, tests, tools

docs/site/commands.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CLI Commands
22

3-
specsmith has 11 commands. Every command that operates on a project accepts `--project-dir PATH` (default: current directory).
3+
specsmith has 40+ commands. Every command that operates on a project accepts `--project-dir PATH` (default: current directory).
44

55
## `specsmith init`
66

@@ -157,6 +157,57 @@ Reads scaffold.yml, looks up the ToolSet for the project type, and checks if eac
157157

158158
See [Doctor](doctor.md) for details.
159159

160+
## `specsmith architect`
161+
162+
Generate or enrich architecture documentation by scanning the project and interviewing you.
163+
164+
```bash
165+
specsmith architect --project-dir ./my-project
166+
specsmith architect --project-dir ./my-project --non-interactive
167+
```
168+
169+
**What it does:** Scans for modules, languages, dependencies, git history, and existing architecture docs. In interactive mode, prompts for component names, purposes, interfaces, data flow, and deployment notes. Generates a rich `docs/architecture.md`.
170+
171+
**Options:**
172+
173+
- `--non-interactive` — Skip prompts, auto-generate from scan data only.
174+
175+
## `specsmith self-update`
176+
177+
Update specsmith itself.
178+
179+
```bash
180+
specsmith self-update # Auto-detect channel
181+
specsmith self-update --channel dev # Force dev channel
182+
specsmith self-update --version 0.1.3 # Pin specific version
183+
```
184+
185+
Auto-detects whether you're on stable or dev and upgrades accordingly.
186+
187+
## `specsmith credits`
188+
189+
AI credit/token spend tracking and analysis.
190+
191+
```bash
192+
specsmith credits summary # Spend overview
193+
specsmith credits summary --month 2026-04 # Monthly view
194+
specsmith credits record --model claude-sonnet \ # Record usage
195+
--provider anthropic --tokens-in 5000 --tokens-out 2000 --task "import"
196+
specsmith credits report --output credits-report.md # Markdown report
197+
specsmith credits analyze # Optimization insights
198+
specsmith credits budget --cap 50 --alert-pct 80 # Set budget
199+
```
200+
201+
**Subcommands:**
202+
203+
- `summary` — Aggregate spend by model, provider, task. Shows budget alerts.
204+
- `record` — Log a credit usage entry (model, provider, tokens, task, cost).
205+
- `report` — Generate markdown credit report.
206+
- `analyze` — Detect model inefficiency, token waste, cost trends. Recommendations.
207+
- `budget` — View/set monthly cap, alert threshold, watermark levels.
208+
209+
Credit data stored locally at `.specsmith/credits.json` (gitignored).
210+
160211
## `specsmith --version`
161212

162213
```bash

src/specsmith/upgrader.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ def run_upgrade(
110110
yaml.dump(raw, f, default_flow_style=False, sort_keys=False)
111111
result.updated_files.append("scaffold.yml")
112112

113+
# Initialize credit tracking if not present
114+
specsmith_dir = root / ".specsmith"
115+
if not specsmith_dir.exists():
116+
from specsmith.credits import CreditBudget, save_budget
117+
118+
save_budget(root, CreditBudget())
119+
result.updated_files.append(".specsmith/credit-budget.json")
120+
113121
result.message = (
114122
f"Upgraded from {old_version} to {new_version}. "
115123
f"{len(result.updated_files)} files updated, {len(result.skipped_files)} skipped."

0 commit comments

Comments
 (0)