biz is an agent-friendly business automation CLI in Go.
It starts with invoice automation (Notion-backed), with modular domain design to expand into broader business ops.
This repository is prepared for public open-source use:
- secret-safe defaults (
config.example.yaml) - local secret file ignored (
config.yaml) - typed error handling and stable JSON envelope
- module-level architecture guides in
docs/modules/
- Cobra-based CLI with machine-first
--jsonoutput - Composable module architecture (
internal/modules/*) - Notion-backed invoice source using
Invoices -> Worklogs/Costsrelations - Optional generic records module (
records list/get/schema/create/update/archive) for Notion pages/databases - HTML template rendering + PDF generation
- Idempotent invoice create behavior
- Create local config:
cp config.example.yaml config.yaml- Set Notion credentials in
config.yamlor env vars:
BIZ_NOTION_TOKENBIZ_NOTION_INVOICE_DB_ID
- Build and test:
go test ./...
go build -o ./bin/biz ./cmd/biz- Run:
./bin/biz doctor --json
./bin/biz invoice list --json
./bin/biz invoice preview <invoice_page_id> --json
./bin/biz invoice create <invoice_page_id> --jsonCommand availability depends on modules.enabled in your config.
Always available:
biz doctorbiz helpbiz completion
Loaded when modules.enabled includes invoice:
biz invoice list [status]- flags:
--status,--limit,--cursor
- flags:
biz invoice create <invoice_id>- flags:
--out,--source,--source-file,--upload-notion,--confirm
- flags:
biz invoice preview <invoice_id>- flags:
--format
- flags:
Loaded when modules.enabled includes records:
biz records list <collection-or-db-id>- flags:
--limit,--cursor
- flags:
biz records get <page-id>biz records schema <collection-or-db-id>biz records create <collection-or-db-id>- flags:
--dataor--data-file,--validate-schema,--dry-run
- flags:
biz records update <page-id>- flags:
--collection,--dataor--data-file,--validate-schema,--if-last-edited,--dry-run
- flags:
biz records archive <page-id>- flags:
--collection,--confirm,--if-last-edited,--dry-run
- flags:
Global flags on all commands:
--config--profile--actor--json--trace-id
Enable records module example:
modules:
enabled: [invoice, records]Notes:
--configis optional;bizauto-loads./config.yamlor$HOME/.config/biz/config.yaml.- Use
biz inv ...as a short alias forbiz invoice .... - Notion mutations are policy-disabled by default (
invoice.allow_notion_mutations: false). - Use
--actor agentfor agent-invoked runs; this activatesagent_policycontrols. - Commands are loaded from
modules.enabledin config (for examplemodules.enabled: [invoice, records]).
go test ./...
go vet ./...
docker build -t biz:local .See:
config.example.yamldocs/notion-worklogs-setup.md
Local-only:
config.yaml(ignored by git)
--upload-notionis guarded by policy and confirmation:- set
invoice.allow_notion_mutations: true - keep
invoice.require_mutation_confirm: true - run with
--confirmon create
- set
Example:
./bin/biz invoice create <invoice_page_id> --upload-notion --confirmagent_policy is enforced only when --actor agent is used.
Example:
./bin/biz --actor agent invoice list --limit 20 --jsonFor records mutations, use strict allowlists:
agent_policy:
enabled: true
allowed_commands: [invoice.list, invoice.preview, records.list, records.get, records.create, records.update, records.archive]
records_allowed_collections: [invoices]
records_allowed_properties: [Status, Notes]Optional collection aliases for records:
notion:
collections:
invoices: "<NOTION_INVOICE_DB_ID>"
clients: "<NOTION_CLIENTS_DB_ID>"Records mutation safety features:
--dry-runfor create/update/archive preview--if-last-edited <RFC3339>optimistic concurrency check for update/archive--data-fileto load mutation payloads from JSON files
Invoice idempotency hardening:
- optional
invoice.idempotency_signing_keyenables HMAC signing/verification of idempotency records - if enabled, tampered idempotency records fail validation during
invoice create
Enable signed, hash-chained JSONL audit logging:
audit:
enabled: true
path: audit/biz-audit.log
signing_key: "replace-with-strong-secret"
strict: trueEvery audited event records actor, command, args, exit code, result code, prev_hash, hash, and HMAC signature.
cmd/biz: application entrypointinternal/command: shared command framework and command spec builderinternal/modules: pluggable command modules (invoice,records, runtimetax)internal/invoice: invoice domain and workflowsinternal/invoice/notion: Notion adapterinternal/records: generic record CRUD domain and Notion adapterinternal/tax: tax policy logicinternal/platform: config/errors/output/logging utilitiesdocs/modules: module-level guides
- Notion setup and worklog import:
docs/notion-worklogs-setup.md
- Security:
docs/security/threat-model.md
- Module guides:
docs/modules/cli.mddocs/modules/invoice.mddocs/modules/notion.mddocs/modules/records.mddocs/modules/tax.mddocs/modules/platform.md
Read SECURITY.md before running in production.
See CONTRIBUTING.md.
MIT. See LICENSE.