lastlight 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +265 -118
- package/agent-context/rules.md +62 -9
- package/agent-context/security.md +69 -0
- package/config/default.yaml +89 -0
- package/deploy/.env.production.example +20 -2
- package/deploy/entrypoint.sh +16 -17
- package/deploy/native/README.md +160 -0
- package/deploy/native/install.sh +110 -0
- package/deploy/native/lastlight.env.example +95 -0
- package/deploy/native/lastlight.service +50 -0
- package/deploy/sandbox-entrypoint.sh +59 -42
- package/dist/admin/auth.d.ts +1 -1
- package/dist/admin/auth.js +3 -1
- package/dist/admin/auth.js.map +1 -1
- package/dist/admin/chat-session-reader.d.ts +11 -14
- package/dist/admin/chat-session-reader.js +27 -51
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/docker.d.ts +37 -0
- package/dist/admin/docker.js +86 -1
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/index.js +38 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/log-search.test.d.ts +1 -0
- package/dist/admin/log-search.test.js +78 -0
- package/dist/admin/log-search.test.js.map +1 -0
- package/dist/admin/routes.d.ts +52 -3
- package/dist/admin/routes.js +780 -63
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/routes.test.js +680 -14
- package/dist/admin/routes.test.js.map +1 -1
- package/dist/admin/server-logs.test.d.ts +1 -0
- package/dist/admin/server-logs.test.js +58 -0
- package/dist/admin/server-logs.test.js.map +1 -0
- package/dist/admin/sessions.d.ts +26 -39
- package/dist/admin/sessions.js +86 -310
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/sessions.test.d.ts +1 -0
- package/dist/admin/sessions.test.js +78 -0
- package/dist/admin/sessions.test.js.map +1 -0
- package/dist/admin/version.d.ts +15 -0
- package/dist/admin/version.js +73 -0
- package/dist/admin/version.js.map +1 -0
- package/dist/admin/version.test.d.ts +1 -0
- package/dist/admin/version.test.js +71 -0
- package/dist/admin/version.test.js.map +1 -0
- package/dist/cli-config.d.ts +55 -0
- package/dist/cli-config.js +119 -0
- package/dist/cli-config.js.map +1 -0
- package/dist/cli-config.test.d.ts +1 -0
- package/dist/cli-config.test.js +92 -0
- package/dist/cli-config.test.js.map +1 -0
- package/dist/cli-format.d.ts +19 -0
- package/dist/cli-format.js +107 -0
- package/dist/cli-format.js.map +1 -0
- package/dist/cli-server.d.ts +73 -0
- package/dist/cli-server.js +347 -0
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-server.test.d.ts +1 -0
- package/dist/cli-server.test.js +38 -0
- package/dist/cli-server.test.js.map +1 -0
- package/dist/cli-timeline.d.ts +35 -0
- package/dist/cli-timeline.js +373 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/cli-timeline.test.d.ts +1 -0
- package/dist/cli-timeline.test.js +104 -0
- package/dist/cli-timeline.test.js.map +1 -0
- package/dist/cli.d.ts +0 -19
- package/dist/cli.js +910 -194
- package/dist/cli.js.map +1 -1
- package/dist/config-overlay.test.d.ts +1 -0
- package/dist/config-overlay.test.js +112 -0
- package/dist/config-overlay.test.js.map +1 -0
- package/dist/config-resolve.d.ts +28 -0
- package/dist/config-resolve.js +47 -0
- package/dist/config-resolve.js.map +1 -0
- package/dist/config-resolve.test.d.ts +1 -0
- package/dist/config-resolve.test.js +68 -0
- package/dist/config-resolve.test.js.map +1 -0
- package/dist/config.d.ts +62 -49
- package/dist/config.js +452 -76
- package/dist/config.js.map +1 -1
- package/dist/config.test.js +201 -32
- package/dist/config.test.js.map +1 -1
- package/dist/connectors/github-webhook.js +83 -5
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/github-webhook.test.d.ts +1 -0
- package/dist/connectors/github-webhook.test.js +156 -0
- package/dist/connectors/github-webhook.test.js.map +1 -0
- package/dist/connectors/messaging/session-manager.d.ts +18 -0
- package/dist/connectors/messaging/session-manager.js +83 -2
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/messaging/session-manager.test.d.ts +1 -0
- package/dist/connectors/messaging/session-manager.test.js +144 -0
- package/dist/connectors/messaging/session-manager.test.js.map +1 -0
- package/dist/connectors/slack/connector.d.ts +9 -0
- package/dist/connectors/slack/connector.js +15 -0
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.js +81 -0
- package/dist/connectors/slack/mrkdwn.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.test.js +49 -0
- package/dist/connectors/slack/mrkdwn.test.js.map +1 -1
- package/dist/connectors/types.d.ts +1 -1
- package/dist/cron/fanout.d.ts +33 -0
- package/dist/cron/fanout.js +55 -0
- package/dist/cron/fanout.js.map +1 -0
- package/dist/cron/fanout.test.d.ts +1 -0
- package/dist/cron/fanout.test.js +73 -0
- package/dist/cron/fanout.test.js.map +1 -0
- package/dist/cron/jobs.d.ts +5 -0
- package/dist/cron/jobs.js +10 -3
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/scheduler.d.ts +12 -0
- package/dist/cron/scheduler.js +27 -1
- package/dist/cron/scheduler.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +158 -0
- package/dist/engine/agent-executor.js +1140 -0
- package/dist/engine/agent-executor.js.map +1 -0
- package/dist/engine/agent-executor.test.d.ts +1 -0
- package/dist/engine/agent-executor.test.js +395 -0
- package/dist/engine/agent-executor.test.js.map +1 -0
- package/dist/engine/chat-runner.d.ts +123 -0
- package/dist/engine/chat-runner.js +379 -0
- package/dist/engine/chat-runner.js.map +1 -0
- package/dist/engine/chat-runner.test.d.ts +1 -0
- package/dist/engine/chat-runner.test.js +104 -0
- package/dist/engine/chat-runner.test.js.map +1 -0
- package/dist/engine/chat-skills.d.ts +45 -0
- package/dist/engine/chat-skills.js +184 -0
- package/dist/engine/chat-skills.js.map +1 -0
- package/dist/engine/chat-skills.test.d.ts +1 -0
- package/dist/engine/chat-skills.test.js +20 -0
- package/dist/engine/chat-skills.test.js.map +1 -0
- package/dist/engine/chat.d.ts +20 -23
- package/dist/engine/chat.js +251 -155
- package/dist/engine/chat.js.map +1 -1
- package/dist/engine/chat.test.d.ts +1 -0
- package/dist/engine/chat.test.js +42 -0
- package/dist/engine/chat.test.js.map +1 -0
- package/dist/engine/classifier.d.ts +35 -2
- package/dist/engine/classifier.js +170 -31
- package/dist/engine/classifier.js.map +1 -1
- package/dist/engine/classifier.test.d.ts +1 -0
- package/dist/engine/classifier.test.js +115 -0
- package/dist/engine/classifier.test.js.map +1 -0
- package/dist/engine/dispatcher.d.ts +60 -0
- package/dist/engine/dispatcher.js +601 -0
- package/dist/engine/dispatcher.js.map +1 -0
- package/dist/engine/dispatcher.test.d.ts +1 -0
- package/dist/engine/dispatcher.test.js +511 -0
- package/dist/engine/dispatcher.test.js.map +1 -0
- package/dist/engine/event-shim.d.ts +117 -0
- package/dist/engine/event-shim.js +435 -0
- package/dist/engine/event-shim.js.map +1 -0
- package/dist/engine/event-shim.test.d.ts +1 -0
- package/dist/engine/event-shim.test.js +194 -0
- package/dist/engine/event-shim.test.js.map +1 -0
- package/dist/engine/git-auth.d.ts +13 -17
- package/dist/engine/git-auth.js +99 -42
- package/dist/engine/git-auth.js.map +1 -1
- package/dist/engine/git-auth.test.d.ts +1 -0
- package/dist/engine/git-auth.test.js +117 -0
- package/dist/engine/git-auth.test.js.map +1 -0
- package/dist/engine/github-app-client.d.ts +7 -0
- package/dist/engine/github-app-client.js +16 -0
- package/dist/engine/github-app-client.js.map +1 -0
- package/dist/engine/github-app-client.test.d.ts +1 -0
- package/dist/engine/github-app-client.test.js +44 -0
- package/dist/engine/github-app-client.test.js.map +1 -0
- package/dist/engine/github-tools.d.ts +12 -0
- package/dist/engine/github-tools.js +261 -0
- package/dist/engine/github-tools.js.map +1 -0
- package/dist/engine/github.d.ts +1027 -43
- package/dist/engine/github.js +153 -14
- package/dist/engine/github.js.map +1 -1
- package/dist/engine/llm.d.ts +47 -0
- package/dist/engine/llm.js +221 -0
- package/dist/engine/llm.js.map +1 -0
- package/dist/engine/llm.test.d.ts +1 -0
- package/dist/engine/llm.test.js +189 -0
- package/dist/engine/llm.test.js.map +1 -0
- package/dist/engine/profiles.d.ts +249 -0
- package/dist/engine/profiles.js +42 -0
- package/dist/engine/profiles.js.map +1 -0
- package/dist/engine/router.d.ts +12 -6
- package/dist/engine/router.js +339 -81
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/router.test.js +428 -78
- package/dist/engine/router.test.js.map +1 -1
- package/dist/engine/screen.d.ts +41 -0
- package/dist/engine/screen.js +93 -0
- package/dist/engine/screen.js.map +1 -0
- package/dist/engine/screen.test.d.ts +1 -0
- package/dist/engine/screen.test.js +82 -0
- package/dist/engine/screen.test.js.map +1 -0
- package/dist/index.js +423 -437
- package/dist/index.js.map +1 -1
- package/dist/managed-repos.d.ts +7 -9
- package/dist/managed-repos.js +12 -15
- package/dist/managed-repos.js.map +1 -1
- package/dist/managed-repos.test.js +24 -19
- package/dist/managed-repos.test.js.map +1 -1
- package/dist/notify/index.d.ts +15 -0
- package/dist/notify/index.js +6 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/model.d.ts +57 -0
- package/dist/notify/model.js +89 -0
- package/dist/notify/model.js.map +1 -0
- package/dist/notify/model.test.d.ts +1 -0
- package/dist/notify/model.test.js +109 -0
- package/dist/notify/model.test.js.map +1 -0
- package/dist/notify/notifier.d.ts +17 -0
- package/dist/notify/notifier.js +87 -0
- package/dist/notify/notifier.js.map +1 -0
- package/dist/notify/notifier.test.d.ts +1 -0
- package/dist/notify/notifier.test.js +100 -0
- package/dist/notify/notifier.test.js.map +1 -0
- package/dist/notify/render.d.ts +21 -0
- package/dist/notify/render.js +59 -0
- package/dist/notify/render.js.map +1 -0
- package/dist/notify/render.test.d.ts +1 -0
- package/dist/notify/render.test.js +65 -0
- package/dist/notify/render.test.js.map +1 -0
- package/dist/notify/transports/github.d.ts +26 -0
- package/dist/notify/transports/github.js +26 -0
- package/dist/notify/transports/github.js.map +1 -0
- package/dist/notify/transports/slack.d.ts +26 -0
- package/dist/notify/transports/slack.js +28 -0
- package/dist/notify/transports/slack.js.map +1 -0
- package/dist/notify/transports.test.d.ts +1 -0
- package/dist/notify/transports.test.js +71 -0
- package/dist/notify/transports.test.js.map +1 -0
- package/dist/notify/types.d.ts +95 -0
- package/dist/notify/types.js +16 -0
- package/dist/notify/types.js.map +1 -0
- package/dist/sandbox/docker-compose.test.d.ts +1 -0
- package/dist/sandbox/docker-compose.test.js +128 -0
- package/dist/sandbox/docker-compose.test.js.map +1 -0
- package/dist/sandbox/docker.d.ts +97 -9
- package/dist/sandbox/docker.js +192 -41
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/docker.test.d.ts +1 -0
- package/dist/sandbox/docker.test.js +137 -0
- package/dist/sandbox/docker.test.js.map +1 -0
- package/dist/sandbox/egress-allowlist.d.ts +69 -0
- package/dist/sandbox/egress-allowlist.js +164 -0
- package/dist/sandbox/egress-allowlist.js.map +1 -0
- package/dist/sandbox/egress-allowlist.test.d.ts +1 -0
- package/dist/sandbox/egress-allowlist.test.js +65 -0
- package/dist/sandbox/egress-allowlist.test.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.d.ts +127 -0
- package/dist/sandbox/egress-firewall-config.js +434 -0
- package/dist/sandbox/egress-firewall-config.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.test.d.ts +1 -0
- package/dist/sandbox/egress-firewall-config.test.js +244 -0
- package/dist/sandbox/egress-firewall-config.test.js.map +1 -0
- package/dist/sandbox/images.d.ts +23 -0
- package/dist/sandbox/images.js +55 -0
- package/dist/sandbox/images.js.map +1 -0
- package/dist/sandbox/index.d.ts +82 -3
- package/dist/sandbox/index.js +223 -93
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/index.test.d.ts +1 -0
- package/dist/sandbox/index.test.js +157 -0
- package/dist/sandbox/index.test.js.map +1 -0
- package/dist/session-log.d.ts +63 -0
- package/dist/session-log.js +290 -0
- package/dist/session-log.js.map +1 -0
- package/dist/session-log.test.d.ts +1 -0
- package/dist/session-log.test.js +85 -0
- package/dist/session-log.test.js.map +1 -0
- package/dist/setup.d.ts +31 -12
- package/dist/setup.js +516 -174
- package/dist/setup.js.map +1 -1
- package/dist/setup.test.js +138 -6
- package/dist/setup.test.js.map +1 -1
- package/dist/state/approval-store.d.ts +86 -0
- package/dist/state/approval-store.js +140 -0
- package/dist/state/approval-store.js.map +1 -0
- package/dist/state/build-assets.d.ts +50 -0
- package/dist/state/build-assets.js +154 -0
- package/dist/state/build-assets.js.map +1 -0
- package/dist/state/build-assets.test.d.ts +1 -0
- package/dist/state/build-assets.test.js +106 -0
- package/dist/state/build-assets.test.js.map +1 -0
- package/dist/state/db.d.ts +65 -333
- package/dist/state/db.js +112 -835
- package/dist/state/db.js.map +1 -1
- package/dist/state/db.test.js +127 -91
- package/dist/state/db.test.js.map +1 -1
- package/dist/state/execution-store.d.ts +257 -0
- package/dist/state/execution-store.js +527 -0
- package/dist/state/execution-store.js.map +1 -0
- package/dist/state/migrate.d.ts +15 -0
- package/dist/state/migrate.js +175 -0
- package/dist/state/migrate.js.map +1 -0
- package/dist/state/workflow-run-store.d.ts +195 -0
- package/dist/state/workflow-run-store.js +363 -0
- package/dist/state/workflow-run-store.js.map +1 -0
- package/dist/state/workflow-run-store.test.d.ts +1 -0
- package/dist/state/workflow-run-store.test.js +264 -0
- package/dist/state/workflow-run-store.test.js.map +1 -0
- package/dist/telemetry/index.d.ts +38 -0
- package/dist/telemetry/index.js +253 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.test.d.ts +1 -0
- package/dist/telemetry/index.test.js +73 -0
- package/dist/telemetry/index.test.js.map +1 -0
- package/dist/telemetry/pi-events.d.ts +12 -0
- package/dist/telemetry/pi-events.js +134 -0
- package/dist/telemetry/pi-events.js.map +1 -0
- package/dist/telemetry/pi-events.test.d.ts +1 -0
- package/dist/telemetry/pi-events.test.js +69 -0
- package/dist/telemetry/pi-events.test.js.map +1 -0
- package/dist/workflows/dag.d.ts +13 -1
- package/dist/workflows/dag.js +7 -3
- package/dist/workflows/dag.js.map +1 -1
- package/dist/workflows/dag.test.js +22 -0
- package/dist/workflows/dag.test.js.map +1 -1
- package/dist/workflows/golden-build.test.d.ts +1 -0
- package/dist/workflows/golden-build.test.js +45 -0
- package/dist/workflows/golden-build.test.js.map +1 -0
- package/dist/workflows/loader-overlay.test.d.ts +1 -0
- package/dist/workflows/loader-overlay.test.js +101 -0
- package/dist/workflows/loader-overlay.test.js.map +1 -0
- package/dist/workflows/loader.d.ts +36 -11
- package/dist/workflows/loader.js +311 -87
- package/dist/workflows/loader.js.map +1 -1
- package/dist/workflows/loader.test.js +114 -10
- package/dist/workflows/loader.test.js.map +1 -1
- package/dist/workflows/loop-eval.js +2 -0
- package/dist/workflows/loop-eval.js.map +1 -1
- package/dist/workflows/loop-eval.test.js +14 -0
- package/dist/workflows/loop-eval.test.js.map +1 -1
- package/dist/workflows/phase-executor.d.ts +145 -0
- package/dist/workflows/phase-executor.js +691 -0
- package/dist/workflows/phase-executor.js.map +1 -0
- package/dist/workflows/phase-executor.test.d.ts +1 -0
- package/dist/workflows/phase-executor.test.js +434 -0
- package/dist/workflows/phase-executor.test.js.map +1 -0
- package/dist/workflows/phase-ref.d.ts +44 -0
- package/dist/workflows/phase-ref.js +78 -0
- package/dist/workflows/phase-ref.js.map +1 -0
- package/dist/workflows/phase-ref.test.d.ts +1 -0
- package/dist/workflows/phase-ref.test.js +24 -0
- package/dist/workflows/phase-ref.test.js.map +1 -0
- package/dist/workflows/resume.d.ts +5 -11
- package/dist/workflows/resume.js +88 -7
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.d.ts +34 -27
- package/dist/workflows/runner.js +252 -930
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/runner.test.js +346 -35
- package/dist/workflows/runner.test.js.map +1 -1
- package/dist/workflows/schema.d.ts +52 -10
- package/dist/workflows/schema.js +147 -7
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/simple.d.ts +67 -3
- package/dist/workflows/simple.js +248 -87
- package/dist/workflows/simple.js.map +1 -1
- package/dist/workflows/simple.test.d.ts +1 -0
- package/dist/workflows/simple.test.js +107 -0
- package/dist/workflows/simple.test.js.map +1 -0
- package/dist/workflows/templates.d.ts +29 -0
- package/dist/workflows/templates.js +42 -4
- package/dist/workflows/templates.js.map +1 -1
- package/dist/workflows/templates.test.js +103 -0
- package/dist/workflows/templates.test.js.map +1 -1
- package/dist/workflows/triggers.d.ts +21 -0
- package/dist/workflows/triggers.js +44 -0
- package/dist/workflows/triggers.js.map +1 -0
- package/dist/workflows/verdict.d.ts +19 -0
- package/dist/workflows/verdict.js +30 -0
- package/dist/workflows/verdict.js.map +1 -0
- package/dist/workflows/verdict.test.d.ts +1 -0
- package/dist/workflows/verdict.test.js +44 -0
- package/dist/workflows/verdict.test.js.map +1 -0
- package/dist/worktree/manager.d.ts +1 -1
- package/dist/worktree/manager.js +14 -14
- package/dist/worktree/manager.js.map +1 -1
- package/dist/worktree/manager.test.d.ts +1 -0
- package/dist/worktree/manager.test.js +87 -0
- package/dist/worktree/manager.test.js.map +1 -0
- package/docker-compose.yml +206 -5
- package/package.json +19 -7
- package/sandbox.Dockerfile +97 -18
- package/skills/README.md +40 -0
- package/skills/browser-qa/SKILL.md +193 -0
- package/skills/browser-qa/scripts/agent-browser.mjs +380 -0
- package/skills/building/SKILL.md +95 -0
- package/skills/chat/SKILL.md +30 -11
- package/skills/code-review/SKILL.md +59 -0
- package/skills/debug-production/SKILL.md +108 -0
- package/skills/demo/SKILL.md +194 -0
- package/skills/demo/scripts/compose-demo.sh +205 -0
- package/skills/issue-answer/SKILL.md +90 -0
- package/skills/issue-comment/SKILL.md +38 -24
- package/skills/issue-triage/SKILL.md +103 -37
- package/skills/issue-triage/references/AGENT-BRIEF.md +61 -0
- package/skills/pr-comment/SKILL.md +64 -0
- package/skills/pr-review/SKILL.md +65 -49
- package/skills/qa-test/SKILL.md +97 -0
- package/skills/repo-health/SKILL.md +48 -45
- package/skills/security-feedback/SKILL.md +173 -0
- package/skills/security-feedback/references/templates.md +77 -0
- package/skills/security-review/SKILL.md +213 -0
- package/skills/security-review/references/issue-format.md +302 -0
- package/skills/verify/SKILL.md +118 -0
- package/workflows/answer.yaml +37 -0
- package/workflows/build.yaml +32 -22
- package/workflows/cron-security.yaml +6 -0
- package/workflows/demo.yaml +55 -0
- package/workflows/explore.yaml +9 -0
- package/workflows/pr-comment.yaml +16 -0
- package/workflows/pr-fix.yaml +3 -0
- package/workflows/pr-review.yaml +4 -1
- package/workflows/prompts/answer.md +67 -0
- package/workflows/prompts/architect.md +24 -7
- package/workflows/prompts/demo.md +100 -0
- package/workflows/prompts/executor.md +29 -20
- package/workflows/prompts/explore-ask.md +51 -22
- package/workflows/prompts/explore-publish.md +2 -2
- package/workflows/prompts/explore-read.md +24 -10
- package/workflows/prompts/explore-synthesize.md +15 -8
- package/workflows/prompts/fix.md +9 -10
- package/workflows/prompts/guardrails.md +26 -8
- package/workflows/prompts/pr-fix.md +6 -7
- package/workflows/prompts/pr.md +11 -10
- package/workflows/prompts/qa-browser.md +95 -0
- package/workflows/prompts/qa-synth.md +44 -0
- package/workflows/prompts/qa-test.md +60 -0
- package/workflows/prompts/re-reviewer.md +8 -9
- package/workflows/prompts/reviewer.md +10 -9
- package/workflows/prompts/verify-browser.md +93 -0
- package/workflows/prompts/verify-synth.md +44 -0
- package/workflows/prompts/verify.md +63 -0
- package/workflows/qa-test.yaml +87 -0
- package/workflows/security-feedback.yaml +25 -0
- package/workflows/security-review.yaml +29 -0
- package/workflows/verify.yaml +85 -0
- package/deploy/mcp-config.tmpl.json +0 -14
- package/dist/cron/rate-limits.d.ts +0 -26
- package/dist/cron/rate-limits.js +0 -193
- package/dist/cron/rate-limits.js.map +0 -1
- package/dist/engine/executor.d.ts +0 -75
- package/dist/engine/executor.js +0 -292
- package/dist/engine/executor.js.map +0 -1
- package/mcp-github-app/package.json +0 -18
- package/mcp-github-app/src/auth.js +0 -66
- package/mcp-github-app/src/github.js +0 -371
- package/mcp-github-app/src/index.js +0 -534
- package/skills/devops/webhook-subscriptions/SKILL.md +0 -180
- package/skills/github/DESCRIPTION.md +0 -3
- package/skills/github/codebase-inspection/SKILL.md +0 -115
- package/skills/github/github-auth/SKILL.md +0 -54
- package/skills/github/github-auth/scripts/gh-env.sh +0 -66
- package/skills/github/github-code-review/SKILL.md +0 -480
- package/skills/github/github-code-review/references/review-output-template.md +0 -74
- package/skills/github/github-issues/SKILL.md +0 -369
- package/skills/github/github-issues/templates/bug-report.md +0 -35
- package/skills/github/github-issues/templates/feature-request.md +0 -31
- package/skills/github/github-pr-workflow/SKILL.md +0 -395
- package/skills/github/github-pr-workflow/references/ci-troubleshooting.md +0 -183
- package/skills/github/github-pr-workflow/references/conventional-commits.md +0 -71
- package/skills/github/github-pr-workflow/templates/pr-body-bugfix.md +0 -35
- package/skills/github/github-pr-workflow/templates/pr-body-feature.md +0 -33
- package/skills/github/github-repo-management/SKILL.md +0 -515
- package/skills/github/github-repo-management/references/github-api-cheatsheet.md +0 -161
- package/skills/github-orchestrator/SKILL.md +0 -103
- package/skills/mcp/DESCRIPTION.md +0 -3
- package/skills/mcp/mcporter/SKILL.md +0 -122
- package/skills/mcp/native-mcp/SKILL.md +0 -356
- package/skills/software-development/architect/SKILL.md +0 -154
- package/skills/software-development/assure-guardrails/SKILL.md +0 -239
- package/skills/software-development/plan/SKILL.md +0 -64
- package/skills/software-development/requesting-code-review/SKILL.md +0 -291
- package/skills/software-development/subagent-driven-development/SKILL.md +0 -433
- package/skills/software-development/systematic-debugging/SKILL.md +0 -366
- package/skills/software-development/test-driven-development/SKILL.md +0 -342
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: systematic-debugging
|
|
3
|
-
description: Use when encountering any bug, test failure, or unexpected behavior. 4-phase root cause investigation — NO fixes without understanding the problem first.
|
|
4
|
-
version: 1.1.0
|
|
5
|
-
author: Hermes Agent (adapted from obra/superpowers)
|
|
6
|
-
license: MIT
|
|
7
|
-
metadata:
|
|
8
|
-
hermes:
|
|
9
|
-
tags: [debugging, troubleshooting, problem-solving, root-cause, investigation]
|
|
10
|
-
related_skills: [test-driven-development, plan, subagent-driven-development]
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Systematic Debugging
|
|
14
|
-
|
|
15
|
-
## Overview
|
|
16
|
-
|
|
17
|
-
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
|
|
18
|
-
|
|
19
|
-
**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
|
|
20
|
-
|
|
21
|
-
**Violating the letter of this process is violating the spirit of debugging.**
|
|
22
|
-
|
|
23
|
-
## The Iron Law
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If you haven't completed Phase 1, you cannot propose fixes.
|
|
30
|
-
|
|
31
|
-
## When to Use
|
|
32
|
-
|
|
33
|
-
Use for ANY technical issue:
|
|
34
|
-
- Test failures
|
|
35
|
-
- Bugs in production
|
|
36
|
-
- Unexpected behavior
|
|
37
|
-
- Performance problems
|
|
38
|
-
- Build failures
|
|
39
|
-
- Integration issues
|
|
40
|
-
|
|
41
|
-
**Use this ESPECIALLY when:**
|
|
42
|
-
- Under time pressure (emergencies make guessing tempting)
|
|
43
|
-
- "Just one quick fix" seems obvious
|
|
44
|
-
- You've already tried multiple fixes
|
|
45
|
-
- Previous fix didn't work
|
|
46
|
-
- You don't fully understand the issue
|
|
47
|
-
|
|
48
|
-
**Don't skip when:**
|
|
49
|
-
- Issue seems simple (simple bugs have root causes too)
|
|
50
|
-
- You're in a hurry (rushing guarantees rework)
|
|
51
|
-
- Someone wants it fixed NOW (systematic is faster than thrashing)
|
|
52
|
-
|
|
53
|
-
## The Four Phases
|
|
54
|
-
|
|
55
|
-
You MUST complete each phase before proceeding to the next.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Phase 1: Root Cause Investigation
|
|
60
|
-
|
|
61
|
-
**BEFORE attempting ANY fix:**
|
|
62
|
-
|
|
63
|
-
### 1. Read Error Messages Carefully
|
|
64
|
-
|
|
65
|
-
- Don't skip past errors or warnings
|
|
66
|
-
- They often contain the exact solution
|
|
67
|
-
- Read stack traces completely
|
|
68
|
-
- Note line numbers, file paths, error codes
|
|
69
|
-
|
|
70
|
-
**Action:** Use `read_file` on the relevant source files. Use `search_files` to find the error string in the codebase.
|
|
71
|
-
|
|
72
|
-
### 2. Reproduce Consistently
|
|
73
|
-
|
|
74
|
-
- Can you trigger it reliably?
|
|
75
|
-
- What are the exact steps?
|
|
76
|
-
- Does it happen every time?
|
|
77
|
-
- If not reproducible → gather more data, don't guess
|
|
78
|
-
|
|
79
|
-
**Action:** Use the `terminal` tool to run the failing test or trigger the bug:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Run specific failing test
|
|
83
|
-
pytest tests/test_module.py::test_name -v
|
|
84
|
-
|
|
85
|
-
# Run with verbose output
|
|
86
|
-
pytest tests/test_module.py -v --tb=long
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 3. Check Recent Changes
|
|
90
|
-
|
|
91
|
-
- What changed that could cause this?
|
|
92
|
-
- Git diff, recent commits
|
|
93
|
-
- New dependencies, config changes
|
|
94
|
-
|
|
95
|
-
**Action:**
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
# Recent commits
|
|
99
|
-
git log --oneline -10
|
|
100
|
-
|
|
101
|
-
# Uncommitted changes
|
|
102
|
-
git diff
|
|
103
|
-
|
|
104
|
-
# Changes in specific file
|
|
105
|
-
git log -p --follow src/problematic_file.py | head -100
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 4. Gather Evidence in Multi-Component Systems
|
|
109
|
-
|
|
110
|
-
**WHEN system has multiple components (API → service → database, CI → build → deploy):**
|
|
111
|
-
|
|
112
|
-
**BEFORE proposing fixes, add diagnostic instrumentation:**
|
|
113
|
-
|
|
114
|
-
For EACH component boundary:
|
|
115
|
-
- Log what data enters the component
|
|
116
|
-
- Log what data exits the component
|
|
117
|
-
- Verify environment/config propagation
|
|
118
|
-
- Check state at each layer
|
|
119
|
-
|
|
120
|
-
Run once to gather evidence showing WHERE it breaks.
|
|
121
|
-
THEN analyze evidence to identify the failing component.
|
|
122
|
-
THEN investigate that specific component.
|
|
123
|
-
|
|
124
|
-
### 5. Trace Data Flow
|
|
125
|
-
|
|
126
|
-
**WHEN error is deep in the call stack:**
|
|
127
|
-
|
|
128
|
-
- Where does the bad value originate?
|
|
129
|
-
- What called this function with the bad value?
|
|
130
|
-
- Keep tracing upstream until you find the source
|
|
131
|
-
- Fix at the source, not at the symptom
|
|
132
|
-
|
|
133
|
-
**Action:** Use `search_files` to trace references:
|
|
134
|
-
|
|
135
|
-
```python
|
|
136
|
-
# Find where the function is called
|
|
137
|
-
search_files("function_name(", path="src/", file_glob="*.py")
|
|
138
|
-
|
|
139
|
-
# Find where the variable is set
|
|
140
|
-
search_files("variable_name\\s*=", path="src/", file_glob="*.py")
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Phase 1 Completion Checklist
|
|
144
|
-
|
|
145
|
-
- [ ] Error messages fully read and understood
|
|
146
|
-
- [ ] Issue reproduced consistently
|
|
147
|
-
- [ ] Recent changes identified and reviewed
|
|
148
|
-
- [ ] Evidence gathered (logs, state, data flow)
|
|
149
|
-
- [ ] Problem isolated to specific component/code
|
|
150
|
-
- [ ] Root cause hypothesis formed
|
|
151
|
-
|
|
152
|
-
**STOP:** Do not proceed to Phase 2 until you understand WHY it's happening.
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
## Phase 2: Pattern Analysis
|
|
157
|
-
|
|
158
|
-
**Find the pattern before fixing:**
|
|
159
|
-
|
|
160
|
-
### 1. Find Working Examples
|
|
161
|
-
|
|
162
|
-
- Locate similar working code in the same codebase
|
|
163
|
-
- What works that's similar to what's broken?
|
|
164
|
-
|
|
165
|
-
**Action:** Use `search_files` to find comparable patterns:
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
search_files("similar_pattern", path="src/", file_glob="*.py")
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 2. Compare Against References
|
|
172
|
-
|
|
173
|
-
- If implementing a pattern, read the reference implementation COMPLETELY
|
|
174
|
-
- Don't skim — read every line
|
|
175
|
-
- Understand the pattern fully before applying
|
|
176
|
-
|
|
177
|
-
### 3. Identify Differences
|
|
178
|
-
|
|
179
|
-
- What's different between working and broken?
|
|
180
|
-
- List every difference, however small
|
|
181
|
-
- Don't assume "that can't matter"
|
|
182
|
-
|
|
183
|
-
### 4. Understand Dependencies
|
|
184
|
-
|
|
185
|
-
- What other components does this need?
|
|
186
|
-
- What settings, config, environment?
|
|
187
|
-
- What assumptions does it make?
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Phase 3: Hypothesis and Testing
|
|
192
|
-
|
|
193
|
-
**Scientific method:**
|
|
194
|
-
|
|
195
|
-
### 1. Form a Single Hypothesis
|
|
196
|
-
|
|
197
|
-
- State clearly: "I think X is the root cause because Y"
|
|
198
|
-
- Write it down
|
|
199
|
-
- Be specific, not vague
|
|
200
|
-
|
|
201
|
-
### 2. Test Minimally
|
|
202
|
-
|
|
203
|
-
- Make the SMALLEST possible change to test the hypothesis
|
|
204
|
-
- One variable at a time
|
|
205
|
-
- Don't fix multiple things at once
|
|
206
|
-
|
|
207
|
-
### 3. Verify Before Continuing
|
|
208
|
-
|
|
209
|
-
- Did it work? → Phase 4
|
|
210
|
-
- Didn't work? → Form NEW hypothesis
|
|
211
|
-
- DON'T add more fixes on top
|
|
212
|
-
|
|
213
|
-
### 4. When You Don't Know
|
|
214
|
-
|
|
215
|
-
- Say "I don't understand X"
|
|
216
|
-
- Don't pretend to know
|
|
217
|
-
- Ask the user for help
|
|
218
|
-
- Research more
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Phase 4: Implementation
|
|
223
|
-
|
|
224
|
-
**Fix the root cause, not the symptom:**
|
|
225
|
-
|
|
226
|
-
### 1. Create Failing Test Case
|
|
227
|
-
|
|
228
|
-
- Simplest possible reproduction
|
|
229
|
-
- Automated test if possible
|
|
230
|
-
- MUST have before fixing
|
|
231
|
-
- Use the `test-driven-development` skill
|
|
232
|
-
|
|
233
|
-
### 2. Implement Single Fix
|
|
234
|
-
|
|
235
|
-
- Address the root cause identified
|
|
236
|
-
- ONE change at a time
|
|
237
|
-
- No "while I'm here" improvements
|
|
238
|
-
- No bundled refactoring
|
|
239
|
-
|
|
240
|
-
### 3. Verify Fix
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# Run the specific regression test
|
|
244
|
-
pytest tests/test_module.py::test_regression -v
|
|
245
|
-
|
|
246
|
-
# Run full suite — no regressions
|
|
247
|
-
pytest tests/ -q
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### 4. If Fix Doesn't Work — The Rule of Three
|
|
251
|
-
|
|
252
|
-
- **STOP.**
|
|
253
|
-
- Count: How many fixes have you tried?
|
|
254
|
-
- If < 3: Return to Phase 1, re-analyze with new information
|
|
255
|
-
- **If ≥ 3: STOP and question the architecture (step 5 below)**
|
|
256
|
-
- DON'T attempt Fix #4 without architectural discussion
|
|
257
|
-
|
|
258
|
-
### 5. If 3+ Fixes Failed: Question Architecture
|
|
259
|
-
|
|
260
|
-
**Pattern indicating an architectural problem:**
|
|
261
|
-
- Each fix reveals new shared state/coupling in a different place
|
|
262
|
-
- Fixes require "massive refactoring" to implement
|
|
263
|
-
- Each fix creates new symptoms elsewhere
|
|
264
|
-
|
|
265
|
-
**STOP and question fundamentals:**
|
|
266
|
-
- Is this pattern fundamentally sound?
|
|
267
|
-
- Are we "sticking with it through sheer inertia"?
|
|
268
|
-
- Should we refactor the architecture vs. continue fixing symptoms?
|
|
269
|
-
|
|
270
|
-
**Discuss with the user before attempting more fixes.**
|
|
271
|
-
|
|
272
|
-
This is NOT a failed hypothesis — this is a wrong architecture.
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## Red Flags — STOP and Follow Process
|
|
277
|
-
|
|
278
|
-
If you catch yourself thinking:
|
|
279
|
-
- "Quick fix for now, investigate later"
|
|
280
|
-
- "Just try changing X and see if it works"
|
|
281
|
-
- "Add multiple changes, run tests"
|
|
282
|
-
- "Skip the test, I'll manually verify"
|
|
283
|
-
- "It's probably X, let me fix that"
|
|
284
|
-
- "I don't fully understand but this might work"
|
|
285
|
-
- "Pattern says X but I'll adapt it differently"
|
|
286
|
-
- "Here are the main problems: [lists fixes without investigation]"
|
|
287
|
-
- Proposing solutions before tracing data flow
|
|
288
|
-
- **"One more fix attempt" (when already tried 2+)**
|
|
289
|
-
- **Each fix reveals a new problem in a different place**
|
|
290
|
-
|
|
291
|
-
**ALL of these mean: STOP. Return to Phase 1.**
|
|
292
|
-
|
|
293
|
-
**If 3+ fixes failed:** Question the architecture (Phase 4 step 5).
|
|
294
|
-
|
|
295
|
-
## Common Rationalizations
|
|
296
|
-
|
|
297
|
-
| Excuse | Reality |
|
|
298
|
-
|--------|---------|
|
|
299
|
-
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
|
|
300
|
-
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
|
|
301
|
-
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
302
|
-
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
|
|
303
|
-
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
304
|
-
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
305
|
-
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
306
|
-
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern, don't fix again. |
|
|
307
|
-
|
|
308
|
-
## Quick Reference
|
|
309
|
-
|
|
310
|
-
| Phase | Key Activities | Success Criteria |
|
|
311
|
-
|-------|---------------|------------------|
|
|
312
|
-
| **1. Root Cause** | Read errors, reproduce, check changes, gather evidence, trace data flow | Understand WHAT and WHY |
|
|
313
|
-
| **2. Pattern** | Find working examples, compare, identify differences | Know what's different |
|
|
314
|
-
| **3. Hypothesis** | Form theory, test minimally, one variable at a time | Confirmed or new hypothesis |
|
|
315
|
-
| **4. Implementation** | Create regression test, fix root cause, verify | Bug resolved, all tests pass |
|
|
316
|
-
|
|
317
|
-
## Hermes Agent Integration
|
|
318
|
-
|
|
319
|
-
### Investigation Tools
|
|
320
|
-
|
|
321
|
-
Use these Hermes tools during Phase 1:
|
|
322
|
-
|
|
323
|
-
- **`search_files`** — Find error strings, trace function calls, locate patterns
|
|
324
|
-
- **`read_file`** — Read source code with line numbers for precise analysis
|
|
325
|
-
- **`terminal`** — Run tests, check git history, reproduce bugs
|
|
326
|
-
- **`web_search`/`web_extract`** — Research error messages, library docs
|
|
327
|
-
|
|
328
|
-
### With delegate_task
|
|
329
|
-
|
|
330
|
-
For complex multi-component debugging, dispatch investigation subagents:
|
|
331
|
-
|
|
332
|
-
```python
|
|
333
|
-
delegate_task(
|
|
334
|
-
goal="Investigate why [specific test/behavior] fails",
|
|
335
|
-
context="""
|
|
336
|
-
Follow systematic-debugging skill:
|
|
337
|
-
1. Read the error message carefully
|
|
338
|
-
2. Reproduce the issue
|
|
339
|
-
3. Trace the data flow to find root cause
|
|
340
|
-
4. Report findings — do NOT fix yet
|
|
341
|
-
|
|
342
|
-
Error: [paste full error]
|
|
343
|
-
File: [path to failing code]
|
|
344
|
-
Test command: [exact command]
|
|
345
|
-
""",
|
|
346
|
-
toolsets=['terminal', 'file']
|
|
347
|
-
)
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### With test-driven-development
|
|
351
|
-
|
|
352
|
-
When fixing bugs:
|
|
353
|
-
1. Write a test that reproduces the bug (RED)
|
|
354
|
-
2. Debug systematically to find root cause
|
|
355
|
-
3. Fix the root cause (GREEN)
|
|
356
|
-
4. The test proves the fix and prevents regression
|
|
357
|
-
|
|
358
|
-
## Real-World Impact
|
|
359
|
-
|
|
360
|
-
From debugging sessions:
|
|
361
|
-
- Systematic approach: 15-30 minutes to fix
|
|
362
|
-
- Random fixes approach: 2-3 hours of thrashing
|
|
363
|
-
- First-time fix rate: 95% vs 40%
|
|
364
|
-
- New bugs introduced: Near zero vs common
|
|
365
|
-
|
|
366
|
-
**No shortcuts. No guessing. Systematic always wins.**
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: test-driven-development
|
|
3
|
-
description: Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.
|
|
4
|
-
version: 1.1.0
|
|
5
|
-
author: Hermes Agent (adapted from obra/superpowers)
|
|
6
|
-
license: MIT
|
|
7
|
-
metadata:
|
|
8
|
-
hermes:
|
|
9
|
-
tags: [testing, tdd, development, quality, red-green-refactor]
|
|
10
|
-
related_skills: [systematic-debugging, plan, subagent-driven-development]
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Test-Driven Development (TDD)
|
|
14
|
-
|
|
15
|
-
## Overview
|
|
16
|
-
|
|
17
|
-
Write the test first. Watch it fail. Write minimal code to pass.
|
|
18
|
-
|
|
19
|
-
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
|
|
20
|
-
|
|
21
|
-
**Violating the letter of the rules is violating the spirit of the rules.**
|
|
22
|
-
|
|
23
|
-
## When to Use
|
|
24
|
-
|
|
25
|
-
**Always:**
|
|
26
|
-
- New features
|
|
27
|
-
- Bug fixes
|
|
28
|
-
- Refactoring
|
|
29
|
-
- Behavior changes
|
|
30
|
-
|
|
31
|
-
**Exceptions (ask the user first):**
|
|
32
|
-
- Throwaway prototypes
|
|
33
|
-
- Generated code
|
|
34
|
-
- Configuration files
|
|
35
|
-
|
|
36
|
-
Thinking "skip TDD just this once"? Stop. That's rationalization.
|
|
37
|
-
|
|
38
|
-
## The Iron Law
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Write code before the test? Delete it. Start over.
|
|
45
|
-
|
|
46
|
-
**No exceptions:**
|
|
47
|
-
- Don't keep it as "reference"
|
|
48
|
-
- Don't "adapt" it while writing tests
|
|
49
|
-
- Don't look at it
|
|
50
|
-
- Delete means delete
|
|
51
|
-
|
|
52
|
-
Implement fresh from tests. Period.
|
|
53
|
-
|
|
54
|
-
## Red-Green-Refactor Cycle
|
|
55
|
-
|
|
56
|
-
### RED — Write Failing Test
|
|
57
|
-
|
|
58
|
-
Write one minimal test showing what should happen.
|
|
59
|
-
|
|
60
|
-
**Good test:**
|
|
61
|
-
```python
|
|
62
|
-
def test_retries_failed_operations_3_times():
|
|
63
|
-
attempts = 0
|
|
64
|
-
def operation():
|
|
65
|
-
nonlocal attempts
|
|
66
|
-
attempts += 1
|
|
67
|
-
if attempts < 3:
|
|
68
|
-
raise Exception('fail')
|
|
69
|
-
return 'success'
|
|
70
|
-
|
|
71
|
-
result = retry_operation(operation)
|
|
72
|
-
|
|
73
|
-
assert result == 'success'
|
|
74
|
-
assert attempts == 3
|
|
75
|
-
```
|
|
76
|
-
Clear name, tests real behavior, one thing.
|
|
77
|
-
|
|
78
|
-
**Bad test:**
|
|
79
|
-
```python
|
|
80
|
-
def test_retry_works():
|
|
81
|
-
mock = MagicMock()
|
|
82
|
-
mock.side_effect = [Exception(), Exception(), 'success']
|
|
83
|
-
result = retry_operation(mock)
|
|
84
|
-
assert result == 'success' # What about retry count? Timing?
|
|
85
|
-
```
|
|
86
|
-
Vague name, tests mock not real code.
|
|
87
|
-
|
|
88
|
-
**Requirements:**
|
|
89
|
-
- One behavior per test
|
|
90
|
-
- Clear descriptive name ("and" in name? Split it)
|
|
91
|
-
- Real code, not mocks (unless truly unavoidable)
|
|
92
|
-
- Name describes behavior, not implementation
|
|
93
|
-
|
|
94
|
-
### Verify RED — Watch It Fail
|
|
95
|
-
|
|
96
|
-
**MANDATORY. Never skip.**
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
# Use terminal tool to run the specific test
|
|
100
|
-
pytest tests/test_feature.py::test_specific_behavior -v
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Confirm:
|
|
104
|
-
- Test fails (not errors from typos)
|
|
105
|
-
- Failure message is expected
|
|
106
|
-
- Fails because the feature is missing
|
|
107
|
-
|
|
108
|
-
**Test passes immediately?** You're testing existing behavior. Fix the test.
|
|
109
|
-
|
|
110
|
-
**Test errors?** Fix the error, re-run until it fails correctly.
|
|
111
|
-
|
|
112
|
-
### GREEN — Minimal Code
|
|
113
|
-
|
|
114
|
-
Write the simplest code to pass the test. Nothing more.
|
|
115
|
-
|
|
116
|
-
**Good:**
|
|
117
|
-
```python
|
|
118
|
-
def add(a, b):
|
|
119
|
-
return a + b # Nothing extra
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Bad:**
|
|
123
|
-
```python
|
|
124
|
-
def add(a, b):
|
|
125
|
-
result = a + b
|
|
126
|
-
logging.info(f"Adding {a} + {b} = {result}") # Extra!
|
|
127
|
-
return result
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Don't add features, refactor other code, or "improve" beyond the test.
|
|
131
|
-
|
|
132
|
-
**Cheating is OK in GREEN:**
|
|
133
|
-
- Hardcode return values
|
|
134
|
-
- Copy-paste
|
|
135
|
-
- Duplicate code
|
|
136
|
-
- Skip edge cases
|
|
137
|
-
|
|
138
|
-
We'll fix it in REFACTOR.
|
|
139
|
-
|
|
140
|
-
### Verify GREEN — Watch It Pass
|
|
141
|
-
|
|
142
|
-
**MANDATORY.**
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Run the specific test
|
|
146
|
-
pytest tests/test_feature.py::test_specific_behavior -v
|
|
147
|
-
|
|
148
|
-
# Then run ALL tests to check for regressions
|
|
149
|
-
pytest tests/ -q
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Confirm:
|
|
153
|
-
- Test passes
|
|
154
|
-
- Other tests still pass
|
|
155
|
-
- Output pristine (no errors, warnings)
|
|
156
|
-
|
|
157
|
-
**Test fails?** Fix the code, not the test.
|
|
158
|
-
|
|
159
|
-
**Other tests fail?** Fix regressions now.
|
|
160
|
-
|
|
161
|
-
### REFACTOR — Clean Up
|
|
162
|
-
|
|
163
|
-
After green only:
|
|
164
|
-
- Remove duplication
|
|
165
|
-
- Improve names
|
|
166
|
-
- Extract helpers
|
|
167
|
-
- Simplify expressions
|
|
168
|
-
|
|
169
|
-
Keep tests green throughout. Don't add behavior.
|
|
170
|
-
|
|
171
|
-
**If tests fail during refactor:** Undo immediately. Take smaller steps.
|
|
172
|
-
|
|
173
|
-
### Repeat
|
|
174
|
-
|
|
175
|
-
Next failing test for next behavior. One cycle at a time.
|
|
176
|
-
|
|
177
|
-
## Why Order Matters
|
|
178
|
-
|
|
179
|
-
**"I'll write tests after to verify it works"**
|
|
180
|
-
|
|
181
|
-
Tests written after code pass immediately. Passing immediately proves nothing:
|
|
182
|
-
- Might test the wrong thing
|
|
183
|
-
- Might test implementation, not behavior
|
|
184
|
-
- Might miss edge cases you forgot
|
|
185
|
-
- You never saw it catch the bug
|
|
186
|
-
|
|
187
|
-
Test-first forces you to see the test fail, proving it actually tests something.
|
|
188
|
-
|
|
189
|
-
**"I already manually tested all the edge cases"**
|
|
190
|
-
|
|
191
|
-
Manual testing is ad-hoc. You think you tested everything but:
|
|
192
|
-
- No record of what you tested
|
|
193
|
-
- Can't re-run when code changes
|
|
194
|
-
- Easy to forget cases under pressure
|
|
195
|
-
- "It worked when I tried it" ≠ comprehensive
|
|
196
|
-
|
|
197
|
-
Automated tests are systematic. They run the same way every time.
|
|
198
|
-
|
|
199
|
-
**"Deleting X hours of work is wasteful"**
|
|
200
|
-
|
|
201
|
-
Sunk cost fallacy. The time is already gone. Your choice now:
|
|
202
|
-
- Delete and rewrite with TDD (high confidence)
|
|
203
|
-
- Keep it and add tests after (low confidence, likely bugs)
|
|
204
|
-
|
|
205
|
-
The "waste" is keeping code you can't trust.
|
|
206
|
-
|
|
207
|
-
**"TDD is dogmatic, being pragmatic means adapting"**
|
|
208
|
-
|
|
209
|
-
TDD IS pragmatic:
|
|
210
|
-
- Finds bugs before commit (faster than debugging after)
|
|
211
|
-
- Prevents regressions (tests catch breaks immediately)
|
|
212
|
-
- Documents behavior (tests show how to use code)
|
|
213
|
-
- Enables refactoring (change freely, tests catch breaks)
|
|
214
|
-
|
|
215
|
-
"Pragmatic" shortcuts = debugging in production = slower.
|
|
216
|
-
|
|
217
|
-
**"Tests after achieve the same goals — it's spirit not ritual"**
|
|
218
|
-
|
|
219
|
-
No. Tests-after answer "What does this do?" Tests-first answer "What should this do?"
|
|
220
|
-
|
|
221
|
-
Tests-after are biased by your implementation. You test what you built, not what's required. Tests-first force edge case discovery before implementing.
|
|
222
|
-
|
|
223
|
-
## Common Rationalizations
|
|
224
|
-
|
|
225
|
-
| Excuse | Reality |
|
|
226
|
-
|--------|---------|
|
|
227
|
-
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
228
|
-
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
229
|
-
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
230
|
-
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
|
|
231
|
-
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
|
|
232
|
-
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
233
|
-
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
234
|
-
| "Test hard = design unclear" | Listen to the test. Hard to test = hard to use. |
|
|
235
|
-
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
236
|
-
| "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
|
|
237
|
-
| "Existing code has no tests" | You're improving it. Add tests for the code you touch. |
|
|
238
|
-
|
|
239
|
-
## Red Flags — STOP and Start Over
|
|
240
|
-
|
|
241
|
-
If you catch yourself doing any of these, delete the code and restart with TDD:
|
|
242
|
-
|
|
243
|
-
- Code before test
|
|
244
|
-
- Test after implementation
|
|
245
|
-
- Test passes immediately on first run
|
|
246
|
-
- Can't explain why test failed
|
|
247
|
-
- Tests added "later"
|
|
248
|
-
- Rationalizing "just this once"
|
|
249
|
-
- "I already manually tested it"
|
|
250
|
-
- "Tests after achieve the same purpose"
|
|
251
|
-
- "Keep as reference" or "adapt existing code"
|
|
252
|
-
- "Already spent X hours, deleting is wasteful"
|
|
253
|
-
- "TDD is dogmatic, I'm being pragmatic"
|
|
254
|
-
- "This is different because..."
|
|
255
|
-
|
|
256
|
-
**All of these mean: Delete code. Start over with TDD.**
|
|
257
|
-
|
|
258
|
-
## Verification Checklist
|
|
259
|
-
|
|
260
|
-
Before marking work complete:
|
|
261
|
-
|
|
262
|
-
- [ ] Every new function/method has a test
|
|
263
|
-
- [ ] Watched each test fail before implementing
|
|
264
|
-
- [ ] Each test failed for expected reason (feature missing, not typo)
|
|
265
|
-
- [ ] Wrote minimal code to pass each test
|
|
266
|
-
- [ ] All tests pass
|
|
267
|
-
- [ ] Output pristine (no errors, warnings)
|
|
268
|
-
- [ ] Tests use real code (mocks only if unavoidable)
|
|
269
|
-
- [ ] Edge cases and errors covered
|
|
270
|
-
|
|
271
|
-
Can't check all boxes? You skipped TDD. Start over.
|
|
272
|
-
|
|
273
|
-
## When Stuck
|
|
274
|
-
|
|
275
|
-
| Problem | Solution |
|
|
276
|
-
|---------|----------|
|
|
277
|
-
| Don't know how to test | Write the wished-for API. Write the assertion first. Ask the user. |
|
|
278
|
-
| Test too complicated | Design too complicated. Simplify the interface. |
|
|
279
|
-
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
280
|
-
| Test setup huge | Extract helpers. Still complex? Simplify the design. |
|
|
281
|
-
|
|
282
|
-
## Hermes Agent Integration
|
|
283
|
-
|
|
284
|
-
### Running Tests
|
|
285
|
-
|
|
286
|
-
Use the `terminal` tool to run tests at each step:
|
|
287
|
-
|
|
288
|
-
```python
|
|
289
|
-
# RED — verify failure
|
|
290
|
-
terminal("pytest tests/test_feature.py::test_name -v")
|
|
291
|
-
|
|
292
|
-
# GREEN — verify pass
|
|
293
|
-
terminal("pytest tests/test_feature.py::test_name -v")
|
|
294
|
-
|
|
295
|
-
# Full suite — verify no regressions
|
|
296
|
-
terminal("pytest tests/ -q")
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### With delegate_task
|
|
300
|
-
|
|
301
|
-
When dispatching subagents for implementation, enforce TDD in the goal:
|
|
302
|
-
|
|
303
|
-
```python
|
|
304
|
-
delegate_task(
|
|
305
|
-
goal="Implement [feature] using strict TDD",
|
|
306
|
-
context="""
|
|
307
|
-
Follow test-driven-development skill:
|
|
308
|
-
1. Write failing test FIRST
|
|
309
|
-
2. Run test to verify it fails
|
|
310
|
-
3. Write minimal code to pass
|
|
311
|
-
4. Run test to verify it passes
|
|
312
|
-
5. Refactor if needed
|
|
313
|
-
6. Commit
|
|
314
|
-
|
|
315
|
-
Project test command: pytest tests/ -q
|
|
316
|
-
Project structure: [describe relevant files]
|
|
317
|
-
""",
|
|
318
|
-
toolsets=['terminal', 'file']
|
|
319
|
-
)
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### With systematic-debugging
|
|
323
|
-
|
|
324
|
-
Bug found? Write failing test reproducing it. Follow TDD cycle. The test proves the fix and prevents regression.
|
|
325
|
-
|
|
326
|
-
Never fix bugs without a test.
|
|
327
|
-
|
|
328
|
-
## Testing Anti-Patterns
|
|
329
|
-
|
|
330
|
-
- **Testing mock behavior instead of real behavior** — mocks should verify interactions, not replace the system under test
|
|
331
|
-
- **Testing implementation details** — test behavior/results, not internal method calls
|
|
332
|
-
- **Happy path only** — always test edge cases, errors, and boundaries
|
|
333
|
-
- **Brittle tests** — tests should verify behavior, not structure; refactoring shouldn't break them
|
|
334
|
-
|
|
335
|
-
## Final Rule
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
Production code → test exists and failed first
|
|
339
|
-
Otherwise → not TDD
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
No exceptions without the user's explicit permission.
|