Run precommit checks (lint, format, tests) on the mycelium codebase. Use when the user says /precommit or wants to check code quality before committing.
Install
npx skillscat add mycelium-io/mycelium/precommit Install via the SkillsCat registry.
Precommit Checks
Run all quality checks on the mycelium codebase. Auto-fix issues where possible.
Steps
Lint + format — Fix lint and format issues automatically:
cd fastapi-backend && uv run ruff check --fix . && uv run ruff format . cd mycelium-cli && uv run ruff check --fix . && uv run ruff format .Type check (ty) — Both backend and CLI must come back clean. CI gates on this:
cd fastapi-backend && uv run ty check . cd mycelium-cli && uv run ty check .Generated client (
mycelium-cli/src/mycelium_backend_client/) is excluded via[tool.ty.src]since openapi-python-client templates produce diagnostics we can't fix without forking the generator. New diagnostics outside that path must be resolved before commit — don't paper over with# ty: ignoreunless the underlying issue is a typeshed/library bug (CORSMiddleware add_middleware is the canonical example).Stale client signal: if ty reports
unknown-argumentorunresolved-attributeon a type imported frommycelium_backend_client, the generated client is out of date — skip to step 6 and regenerate before re-running ty.Backend tests — Run pytest:
cd fastapi-backend && uv run pytest tests/ -x -qFrontend — Type-check, test, and build. All three:
tscandnext buildbetween them prove the app compiles, not that it behaves, and the component suite is where the interaction bugs actually get caught.cd mycelium-frontend && npx tsc --noEmit && npx vitest run && npx next buildnpm run lintistsc --noEmit— there's no separate ESLint pass. The suite should come back fully green; a failure that looks environmental (missing DOM API, a global the runtime shapes differently) belongs invitest.setup.tsas a guarded stub next to the others, not left failing for the next person to rediscover.CLI docs — If any CLI command files were changed (
mycelium-cli/src/mycelium/commands/):- Ensure new commands have
@doc_refdecorators - Run
/generate-cli-docsto regenerate the HTML CLI reference - If markdown source files changed (
mycelium-cli/src/mycelium/docs/**/*.md), also runcd mycelium-cli && uv run python ../docs/generate_docs.pyto regenerate the docs site (docs/index.html,walkthrough.html,engines.html,concepts.html,guides.html,reference.html, plusdocs/search-index.jsanddocs/llms-full.txt).--page <start|walkthrough|engines|concepts|guides|reference>limits what gets written; every page is still assembled, because the persistent nav and the search index span the whole site. The script reads<!-- keep -->-marked hand-coded sections from the existing HTML — don't delete those files between edits.
- Ensure new commands have
Generated OpenAPI clients — Two clients are vendored from live OpenAPI specs. CI gates on the mycelium one being current; the CFN one is regenerated by hand when we bump the image.
Mycelium backend → CLI client. If any backend schemas or routes changed (
fastapi-backend/app/schemas.py,fastapi-backend/app/routes/), regenerate. Ifopenapi.jsonis already current (i.e. you ransnapshot-openapi.shor the spec wasn't updated), no backend is needed:SPEC_FILE=openapi.json ./scripts/gen-mycelium-client.shIf the spec itself needs refreshing from a live backend first:
docker compose -f mycelium-cli/src/mycelium/docker/compose.yml up -d mycelium-backend ./scripts/gen-mycelium-client.shWrites to
mycelium-client/mycelium_backend_client/andmycelium-cli/src/mycelium_backend_client/. CI fails if the committed copy drifts from live/openapi.json.CFN client.
app/services/cfn_negotiation.pyuses the generated typedioc_cfn_svc_api_client(fromfastapi-backend/cfn_swagger.json). If the CFN image was bumped inmycelium-cli/src/mycelium/docker/compose.yml, refresh + regenerate:CFN_URL=http://localhost:9002 ./scripts/gen-cfn-client.sh(or point at the ioc-cfn-svc repo'sdocs/swagger.json), thencd fastapi-backend && uv run ty check .. Type errors at call sites mean the CFN contract changed. The typecheck IS the contract test. (cfn_knowledge.pystays on httpx by design: json.RawMessage payload + graph endpoints absent from swagger.)Docs consistency — If any user-facing behavior changed (commands renamed, new features, API changes), grep for stale references and fix them in:
docs/index.html(Get Started),walkthrough.html,engines.html,concepts.html,guides.html,reference.html— main docs site (6 pages, generated), plusdocs/search-index.jsdocs/mycelium-dataflow.html— scrolly presentation deckdocs/demo-script.md— live demo scriptREADME.md— quickstart and overviewmycelium-cli/src/mycelium/docs/— built-in CLI docs- The agent skill (
mycelium-cli/src/mycelium/skills/mycelium/SKILL.md) and cursor's workspace assets (mycelium-cli/src/mycelium/integrations/agents/cursor/assets/)
Doctor sanity check — If
mycelium-cli/src/mycelium/commands/doctor.pywas changed, runmycelium doctorto verify every check still passes against the current install:mycelium doctorAll checks should be green (
✓). If any come back as warnings (~) or errors (✗), act on them before committing — doctor is the fastest way to catch setup regressions (config drift, an unreachable backend, channel config issues).If you added new failure modes that doctor should catch, add a new check function to
doctor.pyfollowing the_check_*() -> CheckResultpattern and register it in_run_all_checks(). Doctor is the user's first debugging tool — new silent-failure classes should land here alongside their fix.Report — Summarize what was fixed and any remaining issues.