Repository avatar
AI Tools
v0.2.4
active

octo

io.github.quadnix/octo

Teaches an AI agent Octo, signs it in to Octo, and runs the project's own Octo CLI for it.

Documentation

Octo

Infrastructure as code written as intent: you describe an app and what it needs, modules turn that into Terraform, and your own Terragrunt applies it. Users start at octo.quadnix.com.

Octo is in 0.x. Version 1.x will mark it ready for production.

This README is a set of procedures for working on the repository. docs/ARCHITECTURE.md explains what exists, and docs/CODING-STANDARDS.md how to add to it.

Requires Node 20 or newer, Terraform or OpenTofu 1.6 or newer, and Terragrunt 1.0 or newer. The integration suites also need Docker, and the e2e suites AWS credentials.


A — Set up this machine

Once.

corepack enable
pnpm install
pnpm run prepare

prepare installs the pre-commit hook, which runs the format check, lint, the build with its type check, the circular-dependency check, the secrets spec and the docs code-block check.

B — Build, lint and test

pnpm run build
pnpm run lint
pnpm test

octo-aws-cdk, octo-event-listeners, octo-build and octo-templates import octo from its dist, and octo-templates imports octo-aws-cdk the same way. Rebuild what you changed before testing what depends on it, or the suite runs against the old code and still passes.

pnpm run build also type-checks every package, tests included, through each package's check:types.

octo-mcp's build reads apps/octo-docs/build/mcp-source.json, which the docs site's build writes, and the site's build reads the other packages' dist. On a fresh clone, build in that order:

pnpm exec nx run-many -t build --exclude=@quadnix/octo-mcp
# then build the site: apps/octo-docs/README.md B
pnpm run build

Rebuild the site after changing a page or JSDoc, for octo-mcp to ship the change; a local build reads whatever site build is on disk.

pnpm run format writes what pnpm run format:check checks. Lint does not check formatting.

pnpm run lint:fix sorts imports, members and keys. A flag passed through pnpm run is written without --: pnpm forwards the separator, and the script then drops the flag.

C — Run integration tests

Integration specs run real Terraform; octo-templates' start LocalStack in Docker.

pnpm run test:integration

D — Run an e2e suite

Every e2e suite reaches a live AWS account. octo-aws-cdk's plan and apply nothing; octo-templates' create real resources and tear them down.

  1. Copy the .env.defaults beside the suite to .env and fill in real values. .env is ignored.

  2. Build the packages the suite imports:

    npx nx run-many -t build --projects=octo,octo-event-listeners,octo-aws-cdk
    
  3. Run one spec, by path, from its package:

    cd packages/octo-templates
    NODE_OPTIONS=--experimental-vm-modules npx jest --runTestsByPath src/<template>/main.e2e-spec.ts
    

Never pnpm run test:e2e — it runs every suite live at once. A template suite is one sequence: its first test applies the stack, the last tears it down, so run the whole file. Never combine -u with -t: jest then deletes the snapshots of every test it skipped. Never commit while a suite runs: the pre-commit hook deletes every dist.

E — Run the octo-mcp journeys and knowledge eval

Both run claude -p on your own Claude sign-in, so every run costs usage; packages/octo-mcp/README.md says what they measure.

  1. Build in the order B gives: every package but octo-mcp, the docs site (apps/octo-docs/README.md B), then what the agent runs:

    npx nx run-many -t build --projects=octo,octo-event-listeners,octo-aws-cdk,octo-build,octo-mcp
    
  2. From packages/octo-mcp:

    pnpm run journeys --runs 1 --only table-key-change
    pnpm run knowledge-eval --only design-kv-table,recover-run-died
    pnpm run search-eval
    
  • search-eval is free; run it after any change to the builders or the index.
  • A knowledge-eval run stops at $1.00 and a journeys run at $0.50; --stopAtDollars changes the cap.
  • A paid run asks only the questions and journeys a change touches, with --only, unless a full run is asked for, and only with a question you need answered before building further.
  • --runs 1 is a smoke check. Judge a journey regression only on --runs 3, of the journeys it flagged, and keep a baseline only from such a run: add --baseline, and commit baseline.json with the changes it measures. Keep baselines on Haiku, the default model.
  • Docker must run: a run that asks a project question, or runs a journey in the knowledge-eval project, first records that project on a LocalStack of its own, on port 4577.
  • Transcripts land in test/journeys/results/ and test/knowledge-eval/results/, which are ignored. Read one before running again.

F — Release

  1. Merge to main with PR titles per .github/jobs/validate-pr-title.job.sh. The commit type sets the bump: chore releases nothing.
  2. Run pnpm run check:changelog, which names the next version, and write its entry in apps/octo-docs/docs/reference/changelog.mdx from every change a user sees since the last release tag. An entry written before the release is rewritten whole: the check passes on any entry with the version's heading.
  3. Only when the release is told to check prices, otherwise skip: check every @cost figure in octo-aws-cdk's modules against AWS's us-east-1 price files (pricing.us-east-1.amazonaws.com/offers/v1.0/aws/<service>/current/us-east-1/index.json), or the service's pricing page where the file is over 50 MB, and correct each figure that drifted.
  4. Run the Manual Release workflow on main. It stops on a failed site build, an octo-mcp build that finds no mcp-source.json, or a version without a changelog entry; docs/ARCHITECTURE.md says what it publishes.

Environment variables

Everything outside the code that governs how this repository behaves. A suite's .env is read through env-smart, falling back to the .env.defaults beside it.

VariableSet byWhat it does
AWS_ACCOUNT_IDa suite's .envThe account every e2e suite plans or applies into.
AWS_REGION_IDpackages/octo-aws-cdk/test/.envThe region the module e2es plan into. Template suites hardcode us-east-1.
OCTO_DEFINITION_FILE_PATHthe user, or a create-app project's scriptsThe octo.yaml every lifecycle command boots from. OctoCliUtility sets it for the template suites. A relative path is resolved once against the working directory, so run-action callbacks find it.
OCTO_JOURNAL_COMMAND_IDJournalEventListenerThe running command's id, set for every process it starts, so a run-action that Terraform starts mid-apply names that apply as parentCommandId in its journal.
TF_VAR_OCTO_PROJECT_ROOTTerraformUtility, unless already setThe working directory, so terraform.localPath() paths resolve inside Terragrunt's cache copy of a folder.
TG_LOG_CUSTOM_FORMATTerraformUtility, alwaysTerragrunt's log line layout, its default without the time, since the journal records when each line arrived.
TG_LOG_FORMATTerraformUtility, always unsetUnset for every Terragrunt process, so it cannot override TG_LOG_CUSTOM_FORMAT.
TG_PROVIDER_CACHETerraformUtility, unless already set1, so Terragrunt shares one provider cache across folders.
TG_TF_PATHTerraformUtility, from --terraformBinaryWhich Terraform or OpenTofu binary Terragrunt runs.
NODE_OPTIONSevery package's test scripts--experimental-vm-modules, which Jest needs to run ESM. Set it yourself when running jest directly.
OCTO_GH_TOKENa repository secretCheckout and push in Manual Release, and the tags and GitHub releases nx release creates.
NPM
@quadnix/octo-mcp
Install Command
npm install @quadnix/octo-mcp