github / github/spec-kit

[Extension]: Add spec-kit-cost

Đang mở
#3,566 3 bình luận 0 reaction 2 người được giao Được @rnoap nhận Xem trên GitHub
enhancement extension-submission validation-failed
Ngôn ngữ chính
Python
Star
137k
Fork
12.3k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
159

Mô tả

### Extension ID

cost

### Extension Name

spec-kit-cost

### Version

1.4.0

### Description

Tracks LLM token cost per spec-kit workflow step, showing a running per-step cost and total spec implementation cost, with cache-aware pricing and measured usage on supported hosts.

### Author

Raúl Noa Pedroso

### Repository URL

https://github.com/rnoap/spec-kit-cost

### Download URL

https://github.com/rnoap/spec-kit-cost/archive/refs/tags/v1.4.0.zip

### License

MIT

### Homepage (optional)

https://github.com/rnoap/spec-kit-cost

### Documentation URL (optional)

https://github.com/rnoap/spec-kit-cost/blob/main/README.md

### Changelog URL (optional)

https://github.com/rnoap/spec-kit-cost/blob/main/CHANGELOG.md

### Required Spec Kit Version

>=0.4.0

### Required Tools (optional)

```markdown
None — pure POSIX bash (awk/grep/sed/cut/date), no external runtime dependencies.
```

### Number of Commands

3

### Number of Hooks (optional)

7

### Tags

cost, tokens, budget, observability, ledger, token-usage

### Key Features

- Per-step inline cost summary after each of 7 spec-kit lifecycle events (specify, clarify, plan, tasks, analyze, checklist, implement)
- Cumulative cost report shown automatically after `implement`, or on demand via speckit.cost.report
- Append-only USD ledger (JSON Lines) — entries are never modified, only appended
- Zero-config — works out of the box with sensible defaults and a built-in model-price catalog (Claude, OpenAI, Google Gemini)
- Measured token usage — on hosts exposing a session-store query tool (currently VS Code Copilot), records real token/cache counts instead of chars÷4 estimates
- Cache-aware pricing — prices cache-read/cache-write tokens at their own rates instead of the full input rate (verified case: 6.8x cost overstatement avoided)
- Pluggable providers — self-report (default), manual, log-file (planned)

### Testing Checklist

- [x] Extension installs successfully via download URL
- [x] All commands execute without errors
- [x] Documentation is complete and accurate
- [x] No security vulnerabilities identified
- [x] Tested on at least one real project

### Submission Requirements

- [x] Valid `extension.yml` manifest included
- [x] README.md with installation and usage instructions
- [x] LICENSE file included
- [x] GitHub release created with version tag
- [x] All command files exist and are properly formatted
- [x] Extension ID follows naming conventions (lowercase-with-hyphens)

### Testing Details

**Tested on:**
- Windows 11 with Git Bash (bats-core via npm) — spec-kit CLI 0.12.18.dev0
- Dogfooded within this repository across specs 001-004 (real per-step cost tracking)

**Test project:** this repository itself (rnoap/spec-kit-cost), specs/001-004

**Test scenarios:**
1. Installed extension from GitHub release archive URL (v1.4.0) into a fresh spec-kit project — succeeded, no errors
2. Ran full bats suite (record.bats, report.bats, reset.bats) covering record/report/reset commands, cache-aware pricing, measured vs. estimated sourcing, and byte-identity regression against legacy behavior
3. Verified hooks fire correctly across all 7 lifecycle events during real spec-kit workflow runs
4. Verified ledger append-only behavior and cumulative report output

### Example Usage

```markdown
# Install extension
specify extension add cost --from https://github.com/rnoap/spec-kit-cost/archive/refs/tags/v1.4.0.zip

# Use a command
/speckit.cost.report
```

### Proposed Catalog Entry

```json
{
"spec-kit-cost": {
"name": "spec-kit-cost",
"id": "cost",
"description": "Tracks LLM token cost per spec-kit workflow step, showing a running per-step cost and total spec implementation cost, with cache-aware pricing and measured usage on supported hosts.",
"author": "Raúl Noa Pedroso",
"version": "1.4.0",
"download_url": "https://github.com/rnoap/spec-kit-cost/archive/refs/tags/v1.4.0.zip",
"sha256": "7c3cc3e4f215339eb185ebc7d73addfd948dfbfb2b2d7a671612c0a05e32d538",
"repository": "https://github.com/rnoap/spec-kit-cost",
"homepage": "https://github.com/rnoap/spec-kit-cost",
"documentation": "https://github.com/rnoap/spec-kit-cost/blob/main/README.md",
"changelog": "https://github.com/rnoap/spec-kit-cost/blob/main/CHANGELOG.md",
"license": "MIT",
"requires": {
"speckit_version": ">=0.4.0",
"tools": []
},
"provides": {
"commands": 3,
"hooks": 7
},
"tags": ["cost", "tokens", "budget", "observability", "ledger", "token-usage"],
"verified": false
}
}
```

### Additional Context

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.