feat: add cost tracking make targets and documentation
Added comprehensive cost tracking system to Makefile: Make Targets: - cost-help: Show cost tracking commands and usage guidelines - cost-note-issue: Generate cost note for specific issue with token counts Features: - Token estimation guidelines for different development tasks - Integration with existing `markitect cost session track` command - Automatic issue title fetching for cost notes - Clear examples and usage documentation - Support for custom implementation summaries Documentation: - Complete help system with token estimation guidelines - Examples for small changes to complex system refactoring - Clear parameter requirements and error messages The cost tracking system currently captures Claude token usage only (input/output tokens, USD/EUR pricing). Daily rates and human time tracking are not yet implemented but could be added in future iterations. Usage Examples: make cost-help make cost-note-issue ISSUE=136 INPUT_TOKENS=45000 OUTPUT_TOKENS=28000 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
66
Makefile
66
Makefile
@@ -1,7 +1,7 @@
|
||||
# MarkiTect - Advanced Markdown Engine
|
||||
# Makefile for common development tasks
|
||||
|
||||
.PHONY: help setup install test build clean update status dev lint format check-deps venv-status update-digest add-diary-entry issue-list issue-show issue-list-open issue-create issue-close issue-close-enhanced issue-close-batch issue-get issue-csv issue-json issue-high test-from-issue tdd-start tdd-add-test tdd-finish tdd-status test-status test-new test-coverage test-arch test-foundation test-infrastructure test-integration test-domain test-service test-application test-presentation test-quick test-layers test-random test-random-seed test-random-repeat test-install-randomly test-clean test-tdd test-changed test-module test-cache-clean test-efficient cli-help release-status release-validate release-prepare release-build release-publish release-dry-run chaos-validate chaos-matrix chaos-inject chaos-report
|
||||
.PHONY: help setup install test build clean update status dev lint format check-deps venv-status update-digest add-diary-entry issue-list issue-show issue-list-open issue-create issue-close issue-close-enhanced issue-close-batch issue-get issue-csv issue-json issue-high test-from-issue tdd-start tdd-add-test tdd-finish tdd-status test-status test-new test-coverage test-arch test-foundation test-infrastructure test-integration test-domain test-service test-application test-presentation test-quick test-layers test-random test-random-seed test-random-repeat test-install-randomly test-clean test-tdd test-changed test-module test-cache-clean test-efficient cli-help release-status release-validate release-prepare release-build release-publish release-dry-run chaos-validate chaos-matrix chaos-inject chaos-report cost-help cost-note-issue
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@@ -40,6 +40,10 @@ help:
|
||||
@echo " chaos-inject LAYER=X TYPE=Y - Inject chaos into specific layer"
|
||||
@echo " chaos-report - Generate chaos engineering report"
|
||||
@echo ""
|
||||
@echo "Cost Tracking:"
|
||||
@echo " cost-help - Show cost tracking commands and usage"
|
||||
@echo " cost-note-issue ISSUE=X INPUT_TOKENS=N OUTPUT_TOKENS=M - Generate cost note for issue"
|
||||
@echo ""
|
||||
@echo "Architectural Testing:"
|
||||
@echo " test-arch - Run all tests in architectural order"
|
||||
@echo " test-foundation - Run foundation layer tests only"
|
||||
@@ -1255,3 +1259,63 @@ view-requirements-examples: $(VENV)/bin/activate
|
||||
|
||||
# Update .PHONY for requirements engineering targets
|
||||
.PHONY: validate-requirements check-interface-compatibility generate-dev-checklist validate-mocks pre-commit-validate setup-mock-validation view-requirements-examples
|
||||
|
||||
# ==============================================================================
|
||||
# Cost Tracking Commands
|
||||
# ==============================================================================
|
||||
|
||||
# Show cost tracking help and examples
|
||||
cost-help:
|
||||
@echo "MarkiTect Cost Tracking System"
|
||||
@echo "==============================="
|
||||
@echo ""
|
||||
@echo "The cost tracking system captures Claude token usage and generates"
|
||||
@echo "cost notes for issues. Currently tracks Claude API costs only."
|
||||
@echo ""
|
||||
@echo "🔧 Commands:"
|
||||
@echo " cost-help - Show this help"
|
||||
@echo " cost-note-issue ISSUE=X INPUT_TOKENS=N OUTPUT_TOKENS=M"
|
||||
@echo " - Generate cost note for issue"
|
||||
@echo ""
|
||||
@echo "💰 Manual Cost Note Generation:"
|
||||
@echo " markitect cost session track ISSUE_ID 'ISSUE_TITLE' \\"
|
||||
@echo " --input-tokens N --output-tokens M \\"
|
||||
@echo " --summary 'Implementation description'"
|
||||
@echo ""
|
||||
@echo "📊 Token Estimation Guidelines:"
|
||||
@echo " - Small changes (1-2 functions): 15k input, 8k output"
|
||||
@echo " - Medium features (multiple files): 30k input, 18k output"
|
||||
@echo " - Large features (TDD8 full cycle): 45k input, 28k output"
|
||||
@echo " - Complex systems (refactoring): 60k input, 35k output"
|
||||
@echo ""
|
||||
@echo "💡 Examples:"
|
||||
@echo " make cost-note-issue ISSUE=136 INPUT_TOKENS=45000 OUTPUT_TOKENS=28000"
|
||||
@echo " markitect cost session track 136 'Index generation' --input-tokens 45000 --output-tokens 28000"
|
||||
@echo ""
|
||||
@echo "📁 Output: Cost notes saved to cost_notes/ directory"
|
||||
@echo "💰 Currency: Costs calculated in USD and EUR"
|
||||
@echo "🤖 Model: Default claude-sonnet-4 pricing"
|
||||
|
||||
# Generate cost note for an issue (requires ISSUE, INPUT_TOKENS, OUTPUT_TOKENS)
|
||||
cost-note-issue: $(VENV)/bin/activate
|
||||
@if [ -z "$(ISSUE)" ]; then \
|
||||
echo "❌ Please specify issue number: make cost-note-issue ISSUE=136 INPUT_TOKENS=45000 OUTPUT_TOKENS=28000"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [ -z "$(INPUT_TOKENS)" ]; then \
|
||||
echo "❌ Please specify input tokens: make cost-note-issue ISSUE=$(ISSUE) INPUT_TOKENS=45000 OUTPUT_TOKENS=28000"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [ -z "$(OUTPUT_TOKENS)" ]; then \
|
||||
echo "❌ Please specify output tokens: make cost-note-issue ISSUE=$(ISSUE) INPUT_TOKENS=$(INPUT_TOKENS) OUTPUT_TOKENS=28000"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "💰 Generating cost note for Issue #$(ISSUE)..."
|
||||
@$(VENV_PYTHON) -c "import sys; sys.path.append('.'); from tddai.issue_fetcher import IssueFetcher; fetcher = IssueFetcher(); issue = fetcher.fetch_issue($(ISSUE)); print(f'📋 Issue: {issue[\"title\"]}')"
|
||||
@ISSUE_TITLE=$$($(VENV_PYTHON) -c "import sys; sys.path.append('.'); from tddai.issue_fetcher import IssueFetcher; fetcher = IssueFetcher(); issue = fetcher.fetch_issue($(ISSUE)); print(issue['title'])"); \
|
||||
markitect cost session track $(ISSUE) "$$ISSUE_TITLE" \
|
||||
--input-tokens $(INPUT_TOKENS) \
|
||||
--output-tokens $(OUTPUT_TOKENS) \
|
||||
--summary "$(if $(SUMMARY),$(SUMMARY),Implementation completed using TDD8 methodology)"
|
||||
@echo "✅ Cost note generated successfully!"
|
||||
@echo "📁 Check cost_notes/issue_$(ISSUE)_cost_$$(date +%Y-%m-%d).md"
|
||||
|
||||
Reference in New Issue
Block a user