Adopts ideas/token-conservation.md, parked 2026-07-28, plus the disciplines the human added: read the compressed form first, discover by mechanism, shrink output at the source, never pay twice for the same bytes. docs/context-economy.md owns all of it and leads with a floor, because every cheap failure mode is also a token saving — skipping the owning doc, guessing a signature, reporting from a diff, thinning a test — and each has already cost this repo a defect. Frugality is for presentation and discovery, never for the artifact or the evidence. Mechanical, not remembered: - scripts/surface.sh generates docs/surface.md — every top-level declaration with its line, 261 lines standing for 3757 of source. The pre-commit hook regenerates and stages it, so it cannot be stale, and verify.sh compares independently for a clone that never set core.hooksPath. The hook refuses a commit with unstaged .go changes, since what it generated describes the working tree, not the commit. - verify.sh --quiet: 48 lines of gate output become 1. The hook uses it. - CLAUDE_LOC_MAX=150, the only budget billed per turn rather than per read. Both new gates were watched failing before being kept: a doctored surface.md, and CLAUDE_LOC_MAX temporarily set to 5. state.md's inventory loses its LOC column. It had already drifted on six files (content.go 381→450, render.go 447→454, web.go 206→217, check 216→223, watch 129→137, chrome 105→110) which is what a number written in two places does; the generated file owns sizes now, the table owns purpose. The subagent question is recorded there as the one open decision, with the case for and against written out in the idea file.
52 lines
1.7 KiB
Makefile
52 lines
1.7 KiB
Makefile
# Convenience only. `go build`, `go test` and ./scripts/verify.sh are the ground truth — nothing here
|
|
# is required to work on khosra, and the gate never invokes make.
|
|
|
|
SITE ?= $(KHOSRA_SITE)
|
|
ADDR ?= localhost:8080
|
|
BIN := ./khosra
|
|
|
|
.PHONY: help build run check new demo test verify fmt tidy clean
|
|
|
|
help: ## list targets
|
|
@grep -hE '^[a-z]+:.*##' $(MAKEFILE_LIST) | sed 's/:[^#]*## /|/' | column -t -s '|'
|
|
|
|
build: ## compile the binary
|
|
go build -o $(BIN) ./cmd/khosra
|
|
|
|
run: build ## serve a site root: make run SITE=/path/to/site
|
|
@test -n "$(SITE)" || { echo "set SITE=/path/to/site, or export KHOSRA_SITE"; exit 1; }
|
|
$(BIN) -site "$(SITE)" -addr "$(ADDR)"
|
|
|
|
check: build ## validate a site root's content: make check SITE=/path/to/site
|
|
@test -n "$(SITE)" || { echo "set SITE=/path/to/site, or export KHOSRA_SITE"; exit 1; }
|
|
$(BIN) check -site "$(SITE)"
|
|
|
|
new: build ## scaffold a bundle: make new KEY=posts/hello-world SITE=/path/to/site
|
|
@test -n "$(SITE)" || { echo "set SITE=/path/to/site, or export KHOSRA_SITE"; exit 1; }
|
|
@test -n "$(KEY)" || { echo "set KEY=posts/hello-world"; exit 1; }
|
|
$(BIN) new -site "$(SITE)" "$(KEY)"
|
|
|
|
demo: build ## serve the demo site in examples/, which exercises every feature
|
|
$(BIN) -site examples/demo-site -addr "$(ADDR)"
|
|
|
|
test: ## run tests with the race detector
|
|
go test -race ./...
|
|
|
|
verify: ## everything the harness enforces; must be green before a commit
|
|
./scripts/verify.sh
|
|
|
|
quiet: ## the same gates, printing only what needs acting on
|
|
./scripts/verify.sh --quiet
|
|
|
|
surface: ## regenerate docs/surface.md, the compressed map of the code
|
|
./scripts/surface.sh --write
|
|
|
|
fmt: ## format all Go source
|
|
gofmt -w .
|
|
|
|
tidy: ## tidy go.mod
|
|
go mod tidy
|
|
|
|
clean: ## remove build output
|
|
rm -f $(BIN)
|