oh-my-opencode 4.5.1 → 4.6.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/.agents/skills/opencode-qa/SKILL.md +194 -0
- package/.agents/skills/opencode-qa/references/cli-commands.md +188 -0
- package/.agents/skills/opencode-qa/references/db-investigation.md +197 -0
- package/.agents/skills/opencode-qa/references/events-hooks.md +110 -0
- package/.agents/skills/opencode-qa/references/sdk.md +96 -0
- package/.agents/skills/opencode-qa/references/server-api.md +200 -0
- package/.agents/skills/opencode-qa/references/testing-harness.md +218 -0
- package/.agents/skills/opencode-qa/references/tui-tmux.md +52 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-id.sh +53 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-name.sh +57 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-text.sh +158 -0
- package/.agents/skills/opencode-qa/scripts/export-roundtrip.sh +57 -0
- package/.agents/skills/opencode-qa/scripts/lib/common.sh +216 -0
- package/.agents/skills/opencode-qa/scripts/server-smoke.sh +64 -0
- package/.agents/skills/opencode-qa/scripts/sse-hook-probe.sh +106 -0
- package/.agents/skills/opencode-qa/scripts/tui-smoke.sh +89 -0
- package/README.ja.md +43 -18
- package/README.ko.md +43 -18
- package/README.md +92 -24
- package/README.ru.md +43 -18
- package/README.zh-cn.md +55 -24
- package/bin/oh-my-opencode.js +49 -3
- package/bin/oh-my-opencode.test.ts +202 -0
- package/bin/platform.d.ts +7 -1
- package/bin/platform.js +23 -4
- package/bin/platform.test.ts +97 -10
- package/dist/cli/cleanup-command.d.ts +4 -0
- package/dist/cli/cleanup.d.ts +11 -0
- package/dist/cli/cli-program.d.ts +19 -0
- package/dist/cli/index.js +30085 -26385
- package/dist/cli/install-codex/codex-cache-bundled-mcps.d.ts +5 -0
- package/dist/cli/install-codex/codex-cache-command-shim.d.ts +1 -0
- package/dist/cli/install-codex/codex-cache-legacy-bins.d.ts +3 -0
- package/dist/cli/install-codex/codex-cache-local-dependencies.d.ts +1 -0
- package/dist/cli/install-codex/codex-cache-paths.d.ts +2 -0
- package/dist/cli/install-codex/codex-cache.d.ts +32 -0
- package/dist/cli/install-codex/codex-cleanup-config.d.ts +6 -0
- package/dist/cli/install-codex/codex-cleanup.d.ts +21 -0
- package/dist/cli/install-codex/codex-config-mcp.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-reasoning.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-toml.d.ts +12 -0
- package/dist/cli/install-codex/codex-hook-trust.d.ts +6 -0
- package/dist/cli/install-codex/codex-installation-detection.d.ts +36 -0
- package/dist/cli/install-codex/codex-marketplace-snapshot.d.ts +15 -0
- package/dist/cli/install-codex/codex-marketplace.d.ts +9 -0
- package/dist/cli/install-codex/codex-multi-agent-v2-config.d.ts +1 -0
- package/dist/cli/install-codex/codex-package-layout.d.ts +1 -0
- package/dist/cli/install-codex/codex-process.d.ts +2 -0
- package/dist/cli/install-codex/codex-project-local-cleanup-best-effort.d.ts +7 -0
- package/dist/cli/install-codex/codex-project-local-cleanup.d.ts +35 -0
- package/dist/cli/install-codex/git-bash.d.ts +35 -0
- package/dist/cli/install-codex/index.d.ts +11 -0
- package/dist/cli/install-codex/install-codex.d.ts +17 -0
- package/dist/cli/install-codex/link-cached-plugin-agents.d.ts +12 -0
- package/dist/cli/install-codex/toml-section-editor.d.ts +11 -0
- package/dist/cli/install-codex/types.d.ts +76 -0
- package/dist/cli/run/event-state.d.ts +1 -0
- package/dist/cli/run/poll-for-completion.d.ts +1 -0
- package/dist/cli/run/prompt-start.d.ts +7 -0
- package/dist/cli/star-request.d.ts +11 -0
- package/dist/cli/tui-install-prompts.d.ts +3 -2
- package/dist/cli/types.d.ts +8 -0
- package/dist/config/schema/agent-names.d.ts +4 -1
- package/dist/config/schema/commands.d.ts +1 -2
- package/dist/config/schema/hooks.d.ts +0 -1
- package/dist/config/schema/oh-my-opencode-config.d.ts +5 -3
- package/dist/create-hooks.d.ts +0 -1
- package/dist/create-managers.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-message-activity.d.ts +23 -0
- package/dist/features/background-agent/parent-wake-notifier.d.ts +0 -1
- package/dist/features/boulder-state/storage.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +2 -2
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/features/builtin-skills/skill-file-loader.d.ts +4 -0
- package/dist/features/builtin-skills/skills/debugging.d.ts +2 -0
- package/dist/features/builtin-skills/skills/index.d.ts +5 -1
- package/dist/features/builtin-skills/skills/init-deep.d.ts +2 -0
- package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +2 -0
- package/dist/features/builtin-skills/skills/security-research.d.ts +2 -0
- package/dist/features/builtin-skills/skills/security-review.d.ts +2 -0
- package/dist/features/opencode-runtime-skills/index.d.ts +2 -0
- package/dist/features/opencode-runtime-skills/runtime-skill-config.d.ts +17 -0
- package/dist/features/opencode-runtime-skills/skill-markdown.d.ts +7 -0
- package/dist/features/opencode-runtime-skills/source-server.d.ts +8 -0
- package/dist/hooks/claude-code-hooks/hook-text.d.ts +2 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/session-recovery/storage/latest-assistant-message.d.ts +5 -0
- package/dist/hooks/session-recovery/storage/thinking-prepend.d.ts +3 -0
- package/dist/hooks/thinking-block-validator/hook.d.ts +0 -18
- package/dist/hooks/todo-continuation-enforcer/pending-question-detection.d.ts +4 -0
- package/dist/index.js +1949 -1913
- package/dist/oh-my-opencode.schema.json +4 -2
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +1 -2
- package/dist/plugin/messages-transform.d.ts +8 -1
- package/dist/plugin/user-abort-interrupted-recovery-guard.d.ts +6 -0
- package/dist/plugin-handlers/config-handler.d.ts +2 -1
- package/dist/shared/external-plugin-detector.d.ts +8 -0
- package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +1 -0
- package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +1 -0
- package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +8 -0
- package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +14 -0
- package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +7 -0
- package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +1 -0
- package/dist/shared/prompt-async-gate/timing.d.ts +1 -0
- package/dist/shared/prompt-async-gate/types.d.ts +2 -0
- package/dist/shared/prompt-async-gate.d.ts +1 -1
- package/dist/shared/prompt-timeout-context.d.ts +2 -0
- package/dist/testing/create-plugin-module.d.ts +5 -1
- package/dist/tools/delegate-task/sync-prompt-sender.d.ts +2 -2
- package/package.json +38 -18
- package/packages/ast-grep-mcp/dist/cli.js +245 -40
- package/packages/git-bash-mcp/dist/cli.js +367 -0
- package/packages/lsp-tools-mcp/dist/cli.js +1 -1
- package/packages/omo-codex/marketplace.json +17 -0
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +35 -0
- package/packages/omo-codex/plugin/.mcp.json +25 -0
- package/packages/omo-codex/plugin/README.md +13 -0
- package/packages/omo-codex/plugin/components/comment-checker/.gitattributes +13 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/CODEOWNERS +12 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/ISSUE_TEMPLATE/bug.yml +40 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/ISSUE_TEMPLATE/feature.yml +27 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/branch-ruleset.json +45 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/dependabot.yml +16 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/pull_request_template.md +19 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/workflows/ci.yml +47 -0
- package/packages/omo-codex/plugin/components/comment-checker/.github/workflows/publish.yml +51 -0
- package/packages/omo-codex/plugin/components/comment-checker/AGENTS.md +35 -0
- package/packages/omo-codex/plugin/components/comment-checker/CHANGELOG.md +33 -0
- package/packages/omo-codex/plugin/components/comment-checker/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/comment-checker/NOTICE +6 -0
- package/packages/omo-codex/plugin/components/comment-checker/README.md +87 -0
- package/packages/omo-codex/plugin/components/comment-checker/biome.json +48 -0
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/comment-checker/package.json +57 -0
- package/packages/omo-codex/plugin/components/comment-checker/skills/comment-checker/SKILL.md +16 -0
- package/packages/omo-codex/plugin/components/comment-checker/src/cli.ts +12 -0
- package/packages/omo-codex/plugin/components/comment-checker/src/codex-hook.ts +205 -0
- package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +361 -0
- package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +195 -0
- package/packages/omo-codex/plugin/components/comment-checker/test/codex-hook-newline.test.ts +52 -0
- package/packages/omo-codex/plugin/components/comment-checker/test/codex-hook.test.ts +368 -0
- package/packages/omo-codex/plugin/components/comment-checker/test/fixtures/post-tool-use.json +15 -0
- package/packages/omo-codex/plugin/components/comment-checker/test/package-smoke.test.ts +93 -0
- package/packages/omo-codex/plugin/components/comment-checker/test/runner.test.ts +66 -0
- package/packages/omo-codex/plugin/components/comment-checker/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/comment-checker/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/comment-checker/vitest.config.ts +9 -0
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +29 -0
- package/packages/omo-codex/plugin/components/git-bash/package.json +23 -0
- package/packages/omo-codex/plugin/components/git-bash/src/cli.ts +33 -0
- package/packages/omo-codex/plugin/components/git-bash/src/codex-hook.ts +180 -0
- package/packages/omo-codex/plugin/components/git-bash/src/index.ts +10 -0
- package/packages/omo-codex/plugin/components/git-bash/test/codex-hook.test.ts +195 -0
- package/packages/omo-codex/plugin/components/git-bash/tsconfig.build.json +13 -0
- package/packages/omo-codex/plugin/components/git-bash/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/lsp/.gitattributes +13 -0
- package/packages/omo-codex/plugin/components/lsp/.github/CODEOWNERS +1 -0
- package/packages/omo-codex/plugin/components/lsp/.github/ISSUE_TEMPLATE/bug.yml +26 -0
- package/packages/omo-codex/plugin/components/lsp/.github/ISSUE_TEMPLATE/feature.yml +19 -0
- package/packages/omo-codex/plugin/components/lsp/.github/branch-ruleset.json +45 -0
- package/packages/omo-codex/plugin/components/lsp/.github/dependabot.yml +11 -0
- package/packages/omo-codex/plugin/components/lsp/.github/pull_request_template.md +11 -0
- package/packages/omo-codex/plugin/components/lsp/.github/workflows/ci.yml +56 -0
- package/packages/omo-codex/plugin/components/lsp/.github/workflows/publish.yml +60 -0
- package/packages/omo-codex/plugin/components/lsp/.mcp.json +9 -0
- package/packages/omo-codex/plugin/components/lsp/AGENTS.md +25 -0
- package/packages/omo-codex/plugin/components/lsp/CHANGELOG.md +25 -0
- package/packages/omo-codex/plugin/components/lsp/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/lsp/NOTICE +3 -0
- package/packages/omo-codex/plugin/components/lsp/README.md +148 -0
- package/packages/omo-codex/plugin/components/lsp/biome.json +48 -0
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/lsp/package.json +64 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.mjs +46 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.test.mjs +104 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/clean-dist.mjs +5 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/test.mjs +8 -0
- package/packages/omo-codex/plugin/components/lsp/skills/lsp/SKILL.md +35 -0
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +44 -0
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +33 -0
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +277 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-cli.test.ts +28 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-errors.test.ts +55 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook.test.ts +358 -0
- package/packages/omo-codex/plugin/components/lsp/test/fixtures/broken.py +1 -0
- package/packages/omo-codex/plugin/components/lsp/test/fixtures/post-tool-use.json +15 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +155 -0
- package/packages/omo-codex/plugin/components/lsp/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/lsp/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/lsp/vitest.config.ts +9 -0
- package/packages/omo-codex/plugin/components/rules/.codex-plugin/plugin.json +3 -0
- package/packages/omo-codex/plugin/components/rules/.gitattributes +13 -0
- package/packages/omo-codex/plugin/components/rules/.github/CODEOWNERS +12 -0
- package/packages/omo-codex/plugin/components/rules/.github/ISSUE_TEMPLATE/bug.yml +49 -0
- package/packages/omo-codex/plugin/components/rules/.github/ISSUE_TEMPLATE/feature.yml +27 -0
- package/packages/omo-codex/plugin/components/rules/.github/branch-ruleset.json +45 -0
- package/packages/omo-codex/plugin/components/rules/.github/dependabot.yml +16 -0
- package/packages/omo-codex/plugin/components/rules/.github/pull_request_template.md +20 -0
- package/packages/omo-codex/plugin/components/rules/.github/workflows/ci.yml +47 -0
- package/packages/omo-codex/plugin/components/rules/.github/workflows/publish.yml +51 -0
- package/packages/omo-codex/plugin/components/rules/AGENTS.md +34 -0
- package/packages/omo-codex/plugin/components/rules/CHANGELOG.md +19 -0
- package/packages/omo-codex/plugin/components/rules/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/rules/NOTICE +15 -0
- package/packages/omo-codex/plugin/components/rules/README.md +124 -0
- package/packages/omo-codex/plugin/components/rules/biome.json +48 -0
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +209 -0
- package/packages/omo-codex/plugin/components/rules/bundled-rules/windows-git-bash.md +10 -0
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +54 -0
- package/packages/omo-codex/plugin/components/rules/package.json +62 -0
- package/packages/omo-codex/plugin/components/rules/scripts/bench-codex-rules.mjs +268 -0
- package/packages/omo-codex/plugin/components/rules/skills/rules/SKILL.md +34 -0
- package/packages/omo-codex/plugin/components/rules/src/cli.ts +143 -0
- package/packages/omo-codex/plugin/components/rules/src/codex-hook-options.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/src/codex-hook.ts +238 -0
- package/packages/omo-codex/plugin/components/rules/src/config.ts +107 -0
- package/packages/omo-codex/plugin/components/rules/src/context-pressure.ts +26 -0
- package/packages/omo-codex/plugin/components/rules/src/debug-log.ts +65 -0
- package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +98 -0
- package/packages/omo-codex/plugin/components/rules/src/hook-output.ts +19 -0
- package/packages/omo-codex/plugin/components/rules/src/path-utils.ts +29 -0
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +234 -0
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +104 -0
- package/packages/omo-codex/plugin/components/rules/src/post-compact-claim.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/src/post-compact-state.ts +45 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/cache.ts +64 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +115 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +535 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/errors.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-cache.ts +73 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-paths.ts +47 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-sources.ts +50 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/finder.ts +207 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +123 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/matcher.ts +142 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/ordering.ts +33 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/parser.ts +326 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/plugin-root.ts +55 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/project-root.ts +30 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/scanner.ts +162 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/truncator.ts +67 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +141 -0
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +24 -0
- package/packages/omo-codex/plugin/components/rules/src/session-state-lock.ts +47 -0
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +56 -0
- package/packages/omo-codex/plugin/components/rules/src/tool-paths.ts +192 -0
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +44 -0
- package/packages/omo-codex/plugin/components/rules/src/transcript-search.ts +108 -0
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +107 -0
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +268 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-context-pressure.test.ts +243 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-performance.test.ts +99 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +132 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +156 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +299 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-lock.test.ts +46 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-process.test.ts +83 -0
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +667 -0
- package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +192 -0
- package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +102 -0
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +168 -0
- package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +42 -0
- package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +206 -0
- package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +153 -0
- package/packages/omo-codex/plugin/components/rules/test/persistent-cache.test.ts +63 -0
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +172 -0
- package/packages/omo-codex/plugin/components/rules/test/post-compact-test-fixture.ts +196 -0
- package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +63 -0
- package/packages/omo-codex/plugin/components/rules/test/tool-paths.test.ts +198 -0
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +97 -0
- package/packages/omo-codex/plugin/components/rules/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/rules/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/rules/vitest.config.ts +8 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/.gitattributes +13 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/AGENTS.md +43 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/CHANGELOG.md +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/NOTICE +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/README.md +55 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/biome.json +48 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +52 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +28 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +53 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +167 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/cli.ts +52 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +66 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/directive.ts +6 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/index.ts +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/src/types.ts +23 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +63 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +124 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +182 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/boulder-completed.json +19 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/boulder-mixed-platforms.json +27 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/boulder-single-codex-work.json +19 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plan-all-done.md +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plan-with-nested-checkboxes.md +11 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plan-with-unchecked.md +6 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/vitest.config.ts +10 -0
- package/packages/omo-codex/plugin/components/telemetry/AGENTS.md +37 -0
- package/packages/omo-codex/plugin/components/telemetry/README.md +102 -0
- package/packages/omo-codex/plugin/components/telemetry/biome.json +48 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +16 -0
- package/packages/omo-codex/plugin/components/telemetry/package.json +56 -0
- package/packages/omo-codex/plugin/components/telemetry/src/atomic-write.ts +22 -0
- package/packages/omo-codex/plugin/components/telemetry/src/cli.ts +69 -0
- package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +49 -0
- package/packages/omo-codex/plugin/components/telemetry/src/data-path.ts +45 -0
- package/packages/omo-codex/plugin/components/telemetry/src/env-flags.ts +43 -0
- package/packages/omo-codex/plugin/components/telemetry/src/posthog-activity-state.ts +81 -0
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +165 -0
- package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +35 -0
- package/packages/omo-codex/plugin/components/telemetry/test/codex-hook.test.ts +270 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/telemetry/vitest.config.ts +8 -0
- package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +41 -0
- package/packages/omo-codex/plugin/components/ultrawork/CHANGELOG.md +25 -0
- package/packages/omo-codex/plugin/components/ultrawork/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/ultrawork/NOTICE +5 -0
- package/packages/omo-codex/plugin/components/ultrawork/README.md +60 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +18 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +82 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +222 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +65 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +69 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +164 -0
- package/packages/omo-codex/plugin/components/ultrawork/biome.json +48 -0
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +290 -0
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +16 -0
- package/packages/omo-codex/plugin/components/ultrawork/package.json +54 -0
- package/packages/omo-codex/plugin/components/ultrawork/src/cli.ts +50 -0
- package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +84 -0
- package/packages/omo-codex/plugin/components/ultrawork/src/directive.ts +3 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +275 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +103 -0
- package/packages/omo-codex/plugin/components/ultrawork/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/ultrawork/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/ulw-loop/.gitattributes +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +7 -0
- package/packages/omo-codex/plugin/components/ulw-loop/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/ulw-loop/NOTICE +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +74 -0
- package/packages/omo-codex/plugin/components/ulw-loop/biome.json +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +29 -0
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +55 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/.gitkeep +0 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +44 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/agents/openai.yaml +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +230 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/.gitkeep +0 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +155 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-arg-parser.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +156 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +63 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-steering.ts +94 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +40 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +129 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-snapshot.ts +139 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +177 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/evidence.ts +122 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/goal-status.ts +88 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +73 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +113 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-io.ts +124 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +102 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/review-blockers.ts +81 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/steering.ts +270 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/types.ts +277 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +213 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +375 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-helpers.test.ts +250 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering.test.ts +407 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +169 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-snapshot.test.ts +156 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +275 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/evidence-criteria-gate.test.ts +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/evidence.test.ts +263 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/.gitkeep +0 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/codex-goal-snapshot.json +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-brief.md +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-plan.json +108 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +18 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/steering-proposal.json +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/user-prompt-submit.json +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/goal-status.test.ts +327 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +261 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +62 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/plan-crud.test.ts +256 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/plan-io.test.ts +239 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +203 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/review-blockers.test.ts +180 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/steering.test.ts +353 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/types.test.ts +79 -0
- package/packages/omo-codex/plugin/components/ulw-loop/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/ulw-loop/vitest.config.ts +10 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +160 -0
- package/packages/omo-codex/plugin/package-lock.json +1769 -0
- package/packages/omo-codex/plugin/package.json +28 -0
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +65 -0
- package/packages/omo-codex/plugin/scripts/build-components.mjs +24 -0
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +46 -0
- package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +87 -0
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +75 -0
- package/packages/omo-codex/plugin/skills/comment-checker/SKILL.md +16 -0
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +116 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/00-setup.md +108 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/02-investigate.md +130 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/04-oracle-triple.md +136 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/05-escalate.md +69 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/06-fix.md +116 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/08-qa.md +94 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/partial-runtime-evidence.md +229 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/go.md +252 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/node.md +260 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/python.md +248 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/rust.md +234 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/ghidra.md +212 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/playwright-cli.md +194 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/pwndbg.md +263 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/pwntools.md +265 -0
- package/packages/omo-codex/plugin/skills/frontend-ui-ux/SKILL.md +77 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +325 -0
- package/packages/omo-codex/plugin/skills/lsp/SKILL.md +35 -0
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +463 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +90 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/backend-stack.md +641 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/bootstrap.md +328 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/bubbletea-v2.md +360 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/cobra-stack.md +468 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/concurrency.md +362 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/data-modeling.md +329 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/error-handling.md +359 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/golangci-strict.md +236 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/grpc-connect.md +375 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/libraries.md +337 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/one-liners.md +202 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/sqlc-pgx.md +471 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/testing.md +467 -0
- package/packages/omo-codex/plugin/skills/programming/references/go/type-patterns.md +298 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +314 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/async-anyio.md +442 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/data-modeling.md +233 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/data-processing.md +133 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +218 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/fastapi-stack.md +316 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/httpx2-optimization.md +360 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/libraries.md +307 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/one-liners.md +268 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/orjson-stack.md +378 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/pydantic-ai.md +285 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/pyproject-strict.md +232 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/textual-tui.md +201 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/type-patterns.md +176 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +317 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/async-tokio.md +299 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/axum-stack.md +467 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/cargo-strict.md +317 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/clap-stack.md +409 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/concurrency.md +375 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/libraries.md +439 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/one-liners.md +291 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/proptest-insta.md +429 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/type-state.md +354 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/unsafe-discipline.md +250 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/zero-cost-safety.md +527 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust-ub/README.md +289 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust-ub/ub-taxonomy.md +269 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +195 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/backend-hono.md +672 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/bootstrap.md +199 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/data-modeling.md +202 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +169 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/tsconfig-strict.md +152 -0
- package/packages/omo-codex/plugin/skills/programming/references/typescript/type-patterns.md +196 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/check-no-excuse-rules.sh +173 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/new-project.py +138 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/.editorconfig +13 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/.golangci.yml +95 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/README.md.tmpl +12 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/Taskfile.yml +40 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/ci.yml +37 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/config.go +24 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/gitignore +15 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/main.go.tmpl +22 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/go/templates/run.go +15 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/python/check-no-excuse-rules.py +687 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/python/new-project.py +172 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/python/new-script.py +116 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/rust/check-no-excuse-rules.py +296 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/rust/new-project.py +175 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/typescript/check-no-excuse-rules.ts +282 -0
- package/packages/omo-codex/plugin/skills/programming/scripts/typescript/new-project.ts +177 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +779 -0
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +333 -0
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +574 -0
- package/packages/omo-codex/plugin/skills/rules/SKILL.md +34 -0
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +149 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/.gitkeep +0 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +44 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/agents/openai.yaml +6 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +230 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +399 -0
- package/packages/omo-codex/plugin/test/aggregate.test.mjs +345 -0
- package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +66 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +195 -0
- package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +34 -0
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +21 -0
- package/packages/omo-codex/plugin/test/node-install-surface.test.mjs +48 -0
- package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +76 -0
- package/packages/omo-codex/plugin/test/sync-hook-status-messages.test.mjs +66 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +229 -0
- package/packages/omo-codex/scripts/install/agents.mjs +84 -0
- package/packages/omo-codex/scripts/install/cache.mjs +247 -0
- package/packages/omo-codex/scripts/install/cli-args.mjs +112 -0
- package/packages/omo-codex/scripts/install/command-shim.mjs +1 -0
- package/packages/omo-codex/scripts/install/config.mjs +264 -0
- package/packages/omo-codex/scripts/install/delegated-command.mjs +25 -0
- package/packages/omo-codex/scripts/install/git-bash.mjs +99 -0
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +174 -0
- package/packages/omo-codex/scripts/install/hook-trust.mjs +84 -0
- package/packages/omo-codex/scripts/install/legacy-bins.mjs +57 -0
- package/packages/omo-codex/scripts/install/marketplace.mjs +104 -0
- package/packages/omo-codex/scripts/install/mcp-runtime-cache.mjs +81 -0
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +38 -0
- package/packages/omo-codex/scripts/install/permissions.d.mts +1 -0
- package/packages/omo-codex/scripts/install/permissions.mjs +26 -0
- package/packages/omo-codex/scripts/install/process.mjs +19 -0
- package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +229 -0
- package/packages/omo-codex/scripts/install/reasoning-config.mjs +14 -0
- package/packages/omo-codex/scripts/install/snapshot.mjs +54 -0
- package/packages/omo-codex/scripts/install/source-package-build.mjs +20 -0
- package/packages/omo-codex/scripts/install/toml-editor.mjs +64 -0
- package/packages/omo-codex/scripts/install/utils.mjs +15 -0
- package/packages/omo-codex/scripts/install-agent-links.test.mjs +104 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +123 -0
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +30 -0
- package/packages/omo-codex/scripts/install-cli-args.test.mjs +146 -0
- package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +48 -0
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +62 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +324 -0
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +129 -0
- package/packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs +145 -0
- package/packages/omo-codex/scripts/install-local.mjs +275 -0
- package/packages/omo-codex/scripts/install-local.test.mjs +394 -0
- package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +233 -0
- package/packages/omo-codex/scripts/install-packaged-local.test.mjs +67 -0
- package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +277 -0
- package/packages/omo-codex/scripts/install-test-fixtures.mjs +58 -0
- package/packages/omo-codex/scripts/sync-telemetry-component.mjs +115 -0
- package/packages/omo-codex/scripts/sync-telemetry-component.test.mjs +94 -0
- package/packages/shared-skills/index.mjs +5 -0
- package/packages/shared-skills/package.json +14 -0
- package/packages/shared-skills/skills/debugging/SKILL.md +116 -0
- package/packages/shared-skills/skills/debugging/references/methodology/00-setup.md +108 -0
- package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +130 -0
- package/packages/shared-skills/skills/debugging/references/methodology/04-oracle-triple.md +136 -0
- package/packages/shared-skills/skills/debugging/references/methodology/05-escalate.md +69 -0
- package/packages/shared-skills/skills/debugging/references/methodology/06-fix.md +116 -0
- package/packages/shared-skills/skills/debugging/references/methodology/08-qa.md +94 -0
- package/packages/shared-skills/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/packages/shared-skills/skills/debugging/references/methodology/partial-runtime-evidence.md +229 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/go.md +252 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/node.md +260 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/python.md +248 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/rust.md +234 -0
- package/packages/shared-skills/skills/debugging/references/tools/ghidra.md +212 -0
- package/packages/shared-skills/skills/debugging/references/tools/playwright-cli.md +194 -0
- package/packages/shared-skills/skills/debugging/references/tools/pwndbg.md +263 -0
- package/packages/shared-skills/skills/debugging/references/tools/pwntools.md +265 -0
- package/packages/shared-skills/skills/frontend-ui-ux/SKILL.md +77 -0
- package/packages/shared-skills/skills/init-deep/SKILL.md +309 -0
- package/packages/shared-skills/skills/programming/SKILL.md +463 -0
- package/packages/shared-skills/skills/programming/references/go/README.md +90 -0
- package/packages/shared-skills/skills/programming/references/go/backend-stack.md +641 -0
- package/packages/shared-skills/skills/programming/references/go/bootstrap.md +328 -0
- package/packages/shared-skills/skills/programming/references/go/bubbletea-v2.md +360 -0
- package/packages/shared-skills/skills/programming/references/go/cobra-stack.md +468 -0
- package/packages/shared-skills/skills/programming/references/go/concurrency.md +362 -0
- package/packages/shared-skills/skills/programming/references/go/data-modeling.md +329 -0
- package/packages/shared-skills/skills/programming/references/go/error-handling.md +359 -0
- package/packages/shared-skills/skills/programming/references/go/golangci-strict.md +236 -0
- package/packages/shared-skills/skills/programming/references/go/grpc-connect.md +375 -0
- package/packages/shared-skills/skills/programming/references/go/libraries.md +337 -0
- package/packages/shared-skills/skills/programming/references/go/one-liners.md +202 -0
- package/packages/shared-skills/skills/programming/references/go/sqlc-pgx.md +471 -0
- package/packages/shared-skills/skills/programming/references/go/testing.md +467 -0
- package/packages/shared-skills/skills/programming/references/go/type-patterns.md +298 -0
- package/packages/shared-skills/skills/programming/references/python/README.md +314 -0
- package/packages/shared-skills/skills/programming/references/python/async-anyio.md +442 -0
- package/packages/shared-skills/skills/programming/references/python/data-modeling.md +233 -0
- package/packages/shared-skills/skills/programming/references/python/data-processing.md +133 -0
- package/packages/shared-skills/skills/programming/references/python/error-handling.md +218 -0
- package/packages/shared-skills/skills/programming/references/python/fastapi-stack.md +316 -0
- package/packages/shared-skills/skills/programming/references/python/httpx2-optimization.md +360 -0
- package/packages/shared-skills/skills/programming/references/python/libraries.md +307 -0
- package/packages/shared-skills/skills/programming/references/python/one-liners.md +268 -0
- package/packages/shared-skills/skills/programming/references/python/orjson-stack.md +378 -0
- package/packages/shared-skills/skills/programming/references/python/pydantic-ai.md +285 -0
- package/packages/shared-skills/skills/programming/references/python/pyproject-strict.md +232 -0
- package/packages/shared-skills/skills/programming/references/python/textual-tui.md +201 -0
- package/packages/shared-skills/skills/programming/references/python/type-patterns.md +176 -0
- package/packages/shared-skills/skills/programming/references/rust/README.md +317 -0
- package/packages/shared-skills/skills/programming/references/rust/async-tokio.md +299 -0
- package/packages/shared-skills/skills/programming/references/rust/axum-stack.md +467 -0
- package/packages/shared-skills/skills/programming/references/rust/cargo-strict.md +317 -0
- package/packages/shared-skills/skills/programming/references/rust/clap-stack.md +409 -0
- package/packages/shared-skills/skills/programming/references/rust/concurrency.md +375 -0
- package/packages/shared-skills/skills/programming/references/rust/libraries.md +439 -0
- package/packages/shared-skills/skills/programming/references/rust/one-liners.md +291 -0
- package/packages/shared-skills/skills/programming/references/rust/proptest-insta.md +429 -0
- package/packages/shared-skills/skills/programming/references/rust/type-state.md +354 -0
- package/packages/shared-skills/skills/programming/references/rust/unsafe-discipline.md +250 -0
- package/packages/shared-skills/skills/programming/references/rust/zero-cost-safety.md +527 -0
- package/packages/shared-skills/skills/programming/references/rust-ub/README.md +289 -0
- package/packages/shared-skills/skills/programming/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/packages/shared-skills/skills/programming/references/rust-ub/ub-taxonomy.md +269 -0
- package/packages/shared-skills/skills/programming/references/typescript/README.md +195 -0
- package/packages/shared-skills/skills/programming/references/typescript/backend-hono.md +672 -0
- package/packages/shared-skills/skills/programming/references/typescript/bootstrap.md +199 -0
- package/packages/shared-skills/skills/programming/references/typescript/data-modeling.md +202 -0
- package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +169 -0
- package/packages/shared-skills/skills/programming/references/typescript/tsconfig-strict.md +152 -0
- package/packages/shared-skills/skills/programming/references/typescript/type-patterns.md +196 -0
- package/packages/shared-skills/skills/programming/scripts/go/check-no-excuse-rules.sh +173 -0
- package/packages/shared-skills/skills/programming/scripts/go/new-project.py +138 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/.editorconfig +13 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/.golangci.yml +95 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/README.md.tmpl +12 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/Taskfile.yml +40 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/ci.yml +37 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/config.go +24 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/gitignore +15 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/main.go.tmpl +22 -0
- package/packages/shared-skills/skills/programming/scripts/go/templates/run.go +15 -0
- package/packages/shared-skills/skills/programming/scripts/python/check-no-excuse-rules.py +687 -0
- package/packages/shared-skills/skills/programming/scripts/python/new-project.py +172 -0
- package/packages/shared-skills/skills/programming/scripts/python/new-script.py +116 -0
- package/packages/shared-skills/skills/programming/scripts/rust/check-no-excuse-rules.py +296 -0
- package/packages/shared-skills/skills/programming/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/packages/shared-skills/skills/programming/scripts/rust/new-project.py +175 -0
- package/packages/shared-skills/skills/programming/scripts/typescript/check-no-excuse-rules.ts +282 -0
- package/packages/shared-skills/skills/programming/scripts/typescript/new-project.ts +177 -0
- package/packages/shared-skills/skills/refactor/SKILL.md +763 -0
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +317 -0
- package/packages/shared-skills/skills/review-work/SKILL.md +574 -0
- package/packages/shared-skills/skills/start-work/SKILL.md +149 -0
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +383 -0
- package/postinstall.mjs +6 -2
- package/dist/features/builtin-commands/templates/init-deep.d.ts +0 -1
- package/dist/features/builtin-skills/skills/ai-slop-remover.d.ts +0 -2
- package/dist/hooks/context-window-monitor.d.ts +0 -19
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# One-Liners and Disposable Scripts
|
|
2
|
+
|
|
3
|
+
Production hygiene with throwaway ergonomics. Rust scripts get the same strict lints, the same miri rule when `unsafe` is touched, the same type discipline. The difference is dependency declaration lives inline.
|
|
4
|
+
|
|
5
|
+
## `rust-script` — the recommended path
|
|
6
|
+
|
|
7
|
+
Install once:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cargo install rust-script
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Write a script:
|
|
14
|
+
|
|
15
|
+
```rust
|
|
16
|
+
#!/usr/bin/env rust-script
|
|
17
|
+
//! Fetch a URL and print its body length.
|
|
18
|
+
//!
|
|
19
|
+
//! Usage:
|
|
20
|
+
//! ./fetch.rs <url>
|
|
21
|
+
//!
|
|
22
|
+
//! ```cargo
|
|
23
|
+
//! [dependencies]
|
|
24
|
+
//! anyhow = "1"
|
|
25
|
+
//! reqwest = { version = "0.12", features = ["blocking"] }
|
|
26
|
+
//! ```
|
|
27
|
+
|
|
28
|
+
use std::env;
|
|
29
|
+
|
|
30
|
+
fn main() -> anyhow::Result<()> {
|
|
31
|
+
let url = env::args().nth(1).context("usage: fetch.rs <url>")?;
|
|
32
|
+
let body = reqwest::blocking::get(&url)?.error_for_status()?.text()?;
|
|
33
|
+
println!("{} bytes", body.len());
|
|
34
|
+
Ok(())
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Make executable: `chmod +x fetch.rs`. Run: `./fetch.rs https://example.com`.
|
|
39
|
+
|
|
40
|
+
The `//! \`\`\`cargo` block is parsed as inline `Cargo.toml`. Everything else is normal Rust.
|
|
41
|
+
|
|
42
|
+
## With async
|
|
43
|
+
|
|
44
|
+
```rust
|
|
45
|
+
#!/usr/bin/env rust-script
|
|
46
|
+
//! ```cargo
|
|
47
|
+
//! [dependencies]
|
|
48
|
+
//! anyhow = "1"
|
|
49
|
+
//! tokio = { version = "1", features = ["full"] }
|
|
50
|
+
//! reqwest = "0.12"
|
|
51
|
+
//! ```
|
|
52
|
+
|
|
53
|
+
#[tokio::main]
|
|
54
|
+
async fn main() -> anyhow::Result<()> {
|
|
55
|
+
let urls = [
|
|
56
|
+
"https://example.com",
|
|
57
|
+
"https://example.org",
|
|
58
|
+
];
|
|
59
|
+
let client = reqwest::Client::new();
|
|
60
|
+
let bodies = futures::future::join_all(urls.iter().map(|u| {
|
|
61
|
+
let c = client.clone();
|
|
62
|
+
async move { c.get(*u).send().await?.text().await }
|
|
63
|
+
})).await;
|
|
64
|
+
for (url, body) in urls.iter().zip(bodies) {
|
|
65
|
+
match body {
|
|
66
|
+
Ok(b) => println!("{url}: {} bytes", b.len()),
|
|
67
|
+
Err(e) => eprintln!("{url}: error {e}"),
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
Ok(())
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## With CLI parsing
|
|
75
|
+
|
|
76
|
+
```rust
|
|
77
|
+
#!/usr/bin/env rust-script
|
|
78
|
+
//! ```cargo
|
|
79
|
+
//! [dependencies]
|
|
80
|
+
//! anyhow = "1"
|
|
81
|
+
//! clap = { version = "4", features = ["derive"] }
|
|
82
|
+
//! ```
|
|
83
|
+
|
|
84
|
+
use clap::Parser;
|
|
85
|
+
|
|
86
|
+
#[derive(Parser, Debug)]
|
|
87
|
+
#[command(version, about = "rename files by pattern")]
|
|
88
|
+
struct Cli {
|
|
89
|
+
/// Glob to match
|
|
90
|
+
pattern: String,
|
|
91
|
+
/// Replacement template (use {n} for sequence)
|
|
92
|
+
template: String,
|
|
93
|
+
/// Show what would happen without doing it
|
|
94
|
+
#[arg(long)]
|
|
95
|
+
dry_run: bool,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
fn main() -> anyhow::Result<()> {
|
|
99
|
+
let cli = Cli::parse();
|
|
100
|
+
let entries: Vec<_> = glob::glob(&cli.pattern)?.collect::<Result<_, _>>()?;
|
|
101
|
+
for (n, entry) in entries.iter().enumerate() {
|
|
102
|
+
let target = cli.template.replace("{n}", &n.to_string());
|
|
103
|
+
if cli.dry_run {
|
|
104
|
+
println!("{} -> {target}", entry.display());
|
|
105
|
+
} else {
|
|
106
|
+
std::fs::rename(entry, &target)?;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
Ok(())
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Caching
|
|
114
|
+
|
|
115
|
+
`rust-script` caches the compiled binary in `~/.cache/rust-script/`. First run is slow (full compile), subsequent runs are instant.
|
|
116
|
+
|
|
117
|
+
To clear: `rust-script --clear-cache`.
|
|
118
|
+
|
|
119
|
+
Pin a script's compile target into the script directory for portability:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
rust-script --build-only --base-path . ./script.rs
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This drops a `target/` next to the script with the prebuilt binary.
|
|
126
|
+
|
|
127
|
+
## `cargo-script` (RFC 3424, stable since Rust 1.85)
|
|
128
|
+
|
|
129
|
+
The official replacement that landed in cargo proper. Same idea, slightly different syntax:
|
|
130
|
+
|
|
131
|
+
```rust
|
|
132
|
+
#!/usr/bin/env -S cargo +nightly -Zscript
|
|
133
|
+
---
|
|
134
|
+
package:
|
|
135
|
+
name = "fetch"
|
|
136
|
+
edition = "2024"
|
|
137
|
+
|
|
138
|
+
dependencies:
|
|
139
|
+
anyhow = "1"
|
|
140
|
+
reqwest = { version = "0.12", features = ["blocking"] }
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
fn main() -> anyhow::Result<()> {
|
|
144
|
+
let url = std::env::args().nth(1).context("url required")?;
|
|
145
|
+
println!("{}", reqwest::blocking::get(&url)?.text()?.len());
|
|
146
|
+
Ok(())
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Status as of 2026-05: stabilization in progress. Use `rust-script` for production now, migrate when `cargo script` is stable everywhere your tools live.
|
|
151
|
+
|
|
152
|
+
## Strict mode for scripts
|
|
153
|
+
|
|
154
|
+
Add a lints block in the inline `Cargo.toml`:
|
|
155
|
+
|
|
156
|
+
```rust
|
|
157
|
+
//! ```cargo
|
|
158
|
+
//! [dependencies]
|
|
159
|
+
//! anyhow = "1"
|
|
160
|
+
//!
|
|
161
|
+
//! [lints.rust]
|
|
162
|
+
//! unsafe_code = "forbid"
|
|
163
|
+
//!
|
|
164
|
+
//! [lints.clippy]
|
|
165
|
+
//! all = "deny"
|
|
166
|
+
//! pedantic = "warn"
|
|
167
|
+
//! unwrap_used = "deny"
|
|
168
|
+
//! expect_used = "deny"
|
|
169
|
+
//! panic = "deny"
|
|
170
|
+
//! ```
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Now the script gets the same strictness as the main project. If you need a one-line `unwrap()` for prototype velocity, switch the lint to `warn` for that one script - never blanket `allow`.
|
|
174
|
+
|
|
175
|
+
Run with lints visible:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
RUSTFLAGS="-D warnings" rust-script ./script.rs
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## When NOT to use a script
|
|
182
|
+
|
|
183
|
+
- It is going to live longer than a week → make it a real crate with `cargo new --bin`.
|
|
184
|
+
- It needs custom build scripts (`build.rs`) → real crate.
|
|
185
|
+
- It needs binary distribution to other machines → real crate with `cargo dist`.
|
|
186
|
+
- It needs to be tested → real crate (scripts can technically run `#[test]`s under `cargo test`, but the workflow is awkward).
|
|
187
|
+
|
|
188
|
+
A reasonable migration path: start as a script, when complexity grows past ~200 lines or you reach for a second `.rs` file, run `rust-script --emit ./script.rs` to dump a regular Cargo project skeleton and continue from there.
|
|
189
|
+
|
|
190
|
+
## Inline tests in a script
|
|
191
|
+
|
|
192
|
+
```rust
|
|
193
|
+
#!/usr/bin/env rust-script
|
|
194
|
+
//! ```cargo
|
|
195
|
+
//! [dependencies]
|
|
196
|
+
//! ```
|
|
197
|
+
|
|
198
|
+
fn double(x: i32) -> i32 { x * 2 }
|
|
199
|
+
|
|
200
|
+
fn main() {
|
|
201
|
+
println!("{}", double(21));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#[cfg(test)]
|
|
205
|
+
mod tests {
|
|
206
|
+
use super::*;
|
|
207
|
+
|
|
208
|
+
#[test]
|
|
209
|
+
fn doubles_ints() {
|
|
210
|
+
assert_eq!(double(5), 10);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Run tests: `rust-script --test ./script.rs`.
|
|
216
|
+
|
|
217
|
+
## A useful "Rust as awk" pattern
|
|
218
|
+
|
|
219
|
+
For ad-hoc data processing on stdin:
|
|
220
|
+
|
|
221
|
+
```rust
|
|
222
|
+
#!/usr/bin/env rust-script
|
|
223
|
+
//! ```cargo
|
|
224
|
+
//! [dependencies]
|
|
225
|
+
//! serde_json = "1"
|
|
226
|
+
//! ```
|
|
227
|
+
|
|
228
|
+
use std::io::{self, BufRead, Write};
|
|
229
|
+
|
|
230
|
+
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
231
|
+
let stdin = io::stdin();
|
|
232
|
+
let stdout = io::stdout();
|
|
233
|
+
let mut out = stdout.lock();
|
|
234
|
+
for line in stdin.lock().lines() {
|
|
235
|
+
let line = line?;
|
|
236
|
+
let value: serde_json::Value = serde_json::from_str(&line)?;
|
|
237
|
+
if let Some(s) = value.get("level").and_then(|v| v.as_str()) {
|
|
238
|
+
if s == "error" {
|
|
239
|
+
writeln!(out, "{line}")?;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
Ok(())
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
`cat logs.jsonl | ./filter-errors.rs` — filter JSON logs by `level == "error"`. Faster than `jq` for big files, type-safe.
|
|
248
|
+
|
|
249
|
+
For numerics:
|
|
250
|
+
|
|
251
|
+
```rust
|
|
252
|
+
#!/usr/bin/env rust-script
|
|
253
|
+
//! sum a column of numbers from stdin
|
|
254
|
+
use std::io::{self, BufRead};
|
|
255
|
+
fn main() {
|
|
256
|
+
let total: f64 = io::stdin().lock().lines()
|
|
257
|
+
.filter_map(|l| l.ok())
|
|
258
|
+
.filter_map(|l| l.trim().parse::<f64>().ok())
|
|
259
|
+
.sum();
|
|
260
|
+
println!("{total}");
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## The `rust-script` shebang trick on macOS
|
|
265
|
+
|
|
266
|
+
macOS does not support multi-arg shebangs without `env -S`. Use:
|
|
267
|
+
|
|
268
|
+
```rust
|
|
269
|
+
#!/usr/bin/env -S rust-script --
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The `--` lets clap-style argument parsers see the user's args, not the rust-script arguments.
|
|
273
|
+
|
|
274
|
+
## Editor support
|
|
275
|
+
|
|
276
|
+
VS Code / Helix / Vim with `rust-analyzer`: open the script file as if it were `src/main.rs` of an inferred crate. Most editors auto-detect the inline manifest. If not, hand-create a `Cargo.toml` next to the script with matching deps for the duration of editing, then delete it.
|
|
277
|
+
|
|
278
|
+
## When `rust-script` is too heavy
|
|
279
|
+
|
|
280
|
+
For absolutely throwaway "one expression on stdin" use cases, a Rust REPL like `evcxr_jupyter` (Jupyter kernel) or `irust` (terminal REPL) is more appropriate:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
cargo install irust
|
|
284
|
+
irust
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
But these are interactive playgrounds, not scriptable. For shell pipelines, stay with `rust-script`.
|
|
288
|
+
|
|
289
|
+
## The Promise
|
|
290
|
+
|
|
291
|
+
Same strict lints. Same `clippy::pedantic` enforcement. Same `unsafe`-requires-SAFETY rule. The agent does not get a free pass on a 30-line script. The whole point of strict scripts is that **production hygiene is cheap when the toolchain enforces it**.
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
# Property Tests (proptest) + Snapshot Tests (insta)
|
|
2
|
+
|
|
3
|
+
Two test types every Rust project should have alongside unit tests. Proptest hunts for inputs your unit tests forgot to try. Insta locks down output shapes you do not want to silently change.
|
|
4
|
+
|
|
5
|
+
## When to reach for each
|
|
6
|
+
|
|
7
|
+
| Want to test… | Use |
|
|
8
|
+
|---|---|
|
|
9
|
+
| One specific behavior with a known input | `#[test]` + `assert_eq!` |
|
|
10
|
+
| All inputs of a certain shape work | `proptest!` |
|
|
11
|
+
| Output structure stays stable across refactors | `insta::assert_*_snapshot!` |
|
|
12
|
+
| Parser/serializer round-trips | `proptest!` (the round-trip property) |
|
|
13
|
+
| CLI help text, JSON response shape, debug output | `insta::assert_snapshot!` |
|
|
14
|
+
| Concurrency under all interleavings | `loom` (see `concurrency.md`) |
|
|
15
|
+
|
|
16
|
+
Use all three. They cover different bug classes.
|
|
17
|
+
|
|
18
|
+
## Proptest — setup
|
|
19
|
+
|
|
20
|
+
`Cargo.toml`:
|
|
21
|
+
|
|
22
|
+
```toml
|
|
23
|
+
[dev-dependencies]
|
|
24
|
+
proptest = "1"
|
|
25
|
+
proptest-derive = "0.5" # for #[derive(Arbitrary)]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`proptest.toml` at project root (optional, sane defaults):
|
|
29
|
+
|
|
30
|
+
```toml
|
|
31
|
+
cases = 256 # number of random inputs per property
|
|
32
|
+
max_local_rejects = 65536
|
|
33
|
+
max_global_rejects = 1024
|
|
34
|
+
max_shrink_iters = 1024
|
|
35
|
+
max_shrink_time = 60_000 # ms
|
|
36
|
+
failure_persistence = { source_file = "proptest-regressions/", file_name = "regressions.txt" }
|
|
37
|
+
verbose = 0
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`failure_persistence` is the killer feature: every failure is written to a regression file. On the next run, those exact inputs are replayed first, so once a bug is found it never escapes again.
|
|
41
|
+
|
|
42
|
+
## Basic property test
|
|
43
|
+
|
|
44
|
+
```rust
|
|
45
|
+
use proptest::prelude::*;
|
|
46
|
+
|
|
47
|
+
fn parse(s: &str) -> Result<Color, ParseError> { /* ... */ }
|
|
48
|
+
fn render(c: &Color) -> String { /* ... */ }
|
|
49
|
+
|
|
50
|
+
proptest! {
|
|
51
|
+
#[test]
|
|
52
|
+
fn parse_render_roundtrips(red in 0u8..=255, green in 0u8..=255, blue in 0u8..=255) {
|
|
53
|
+
let color = Color { red, green, blue };
|
|
54
|
+
let rendered = render(&color);
|
|
55
|
+
let parsed = parse(&rendered).expect("our render should always parse");
|
|
56
|
+
prop_assert_eq!(parsed, color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`proptest!` macro takes `(arg in strategy, ...)` pairs. Each strategy produces values; proptest runs the body with random samples, then shrinks failing cases to minimal forms.
|
|
62
|
+
|
|
63
|
+
## Strategies — the value-generation language
|
|
64
|
+
|
|
65
|
+
| Strategy | Produces |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `any::<T>()` | Any value of `T` (if `T: Arbitrary`) |
|
|
68
|
+
| `0u32..100` | Integer ranges |
|
|
69
|
+
| `prop::sample::select(slice)` | Pick from a list |
|
|
70
|
+
| `prop::collection::vec(elem, range)` | Vec of length in range |
|
|
71
|
+
| `prop::collection::hash_map(k, v, n..m)` | HashMap |
|
|
72
|
+
| `prop::option::of(strategy)` | Option |
|
|
73
|
+
| `prop::result::maybe_ok(ok, err)` | Result |
|
|
74
|
+
| `(s1, s2).prop_map(\|(a, b)\| ...)` | Combine, transform |
|
|
75
|
+
| `s.prop_filter("reason", \|v\| pred)` | Reject values |
|
|
76
|
+
| `s.prop_flat_map(\|v\| dependent)` | Sequential dependency |
|
|
77
|
+
| `prop_oneof![strategy1, strategy2]` | Union of strategies |
|
|
78
|
+
| `r"[a-z]{3,10}"` | Regex-generated string |
|
|
79
|
+
| `"\\PC*"` | Any printable non-control string |
|
|
80
|
+
|
|
81
|
+
Example combining several:
|
|
82
|
+
|
|
83
|
+
```rust
|
|
84
|
+
fn config_strategy() -> impl Strategy<Value = Config> {
|
|
85
|
+
(
|
|
86
|
+
prop::sample::select(vec!["dev", "staging", "prod"]),
|
|
87
|
+
0u16..=65535,
|
|
88
|
+
prop::collection::hash_map(
|
|
89
|
+
r"[a-z_]{1,20}",
|
|
90
|
+
any::<String>(),
|
|
91
|
+
0..5,
|
|
92
|
+
),
|
|
93
|
+
).prop_map(|(env, port, vars)| Config {
|
|
94
|
+
env: env.into(),
|
|
95
|
+
port,
|
|
96
|
+
env_vars: vars,
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
proptest! {
|
|
101
|
+
#[test]
|
|
102
|
+
fn config_validates(cfg in config_strategy()) {
|
|
103
|
+
let result = validate(&cfg);
|
|
104
|
+
if cfg.port == 0 {
|
|
105
|
+
prop_assert!(result.is_err());
|
|
106
|
+
} else {
|
|
107
|
+
prop_assert!(result.is_ok());
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Properties to write for every parser
|
|
114
|
+
|
|
115
|
+
1. **Round-trip:** `parse(render(x)) == x` for all valid `x`.
|
|
116
|
+
2. **No-panic:** `parse(arbitrary_string)` never panics, always returns `Result`.
|
|
117
|
+
3. **Idempotent:** `parse(parse(x).unwrap().render()) == parse(x).unwrap()`.
|
|
118
|
+
4. **Whitespace insensitivity:** `parse(x) == parse(strip_whitespace(x))` (if applicable).
|
|
119
|
+
|
|
120
|
+
For every serializer:
|
|
121
|
+
|
|
122
|
+
1. **Length bound:** `render(x).len() <= bound(x)`.
|
|
123
|
+
2. **Charset:** `render(x).chars().all(|c| ALLOWED.contains(&c))`.
|
|
124
|
+
|
|
125
|
+
For every collection operation:
|
|
126
|
+
|
|
127
|
+
1. **Identity:** `op_identity(x) == x` (sort an already-sorted, dedupe a unique).
|
|
128
|
+
2. **Idempotence:** `op(op(x)) == op(x)`.
|
|
129
|
+
3. **Commutativity:** `op(a, b) == op(b, a)` (set union, etc).
|
|
130
|
+
4. **Length:** `op(a, b).len() == known_relation(a.len(), b.len())`.
|
|
131
|
+
|
|
132
|
+
For every numeric op:
|
|
133
|
+
|
|
134
|
+
1. **Monotonicity:** `a <= b => f(a) <= f(b)`.
|
|
135
|
+
2. **Identity element:** `f(x, identity) == x`.
|
|
136
|
+
|
|
137
|
+
Write these mechanically. The agent should reach for proptest the moment any of these properties is checkable.
|
|
138
|
+
|
|
139
|
+
## Derive `Arbitrary`
|
|
140
|
+
|
|
141
|
+
```rust
|
|
142
|
+
use proptest_derive::Arbitrary;
|
|
143
|
+
|
|
144
|
+
#[derive(Debug, Clone, PartialEq, Arbitrary)]
|
|
145
|
+
struct Vec3 {
|
|
146
|
+
#[proptest(strategy = "-100.0..=100.0")]
|
|
147
|
+
x: f32,
|
|
148
|
+
#[proptest(strategy = "-100.0..=100.0")]
|
|
149
|
+
y: f32,
|
|
150
|
+
#[proptest(strategy = "-100.0..=100.0")]
|
|
151
|
+
z: f32,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
proptest! {
|
|
155
|
+
#[test]
|
|
156
|
+
fn dot_product_is_commutative(a: Vec3, b: Vec3) {
|
|
157
|
+
prop_assert!((dot(&a, &b) - dot(&b, &a)).abs() < 1e-5);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`#[derive(Arbitrary)]` auto-implements the strategy. Per-field `#[proptest(strategy = "...")]` overrides.
|
|
163
|
+
|
|
164
|
+
## Stateful / state machine tests
|
|
165
|
+
|
|
166
|
+
For data structures with operations (queues, maps, trees), use `proptest-state-machine`:
|
|
167
|
+
|
|
168
|
+
```rust
|
|
169
|
+
use proptest_state_machine::{ReferenceStateMachine, StateMachineTest};
|
|
170
|
+
|
|
171
|
+
struct MyQueueRef { state: VecDeque<i32> }
|
|
172
|
+
struct MyQueueSut { sut: MyQueue<i32> }
|
|
173
|
+
|
|
174
|
+
#[derive(Debug, Clone)]
|
|
175
|
+
enum Op { Push(i32), Pop }
|
|
176
|
+
|
|
177
|
+
impl ReferenceStateMachine for MyQueueRef {
|
|
178
|
+
type State = VecDeque<i32>;
|
|
179
|
+
type Transition = Op;
|
|
180
|
+
|
|
181
|
+
fn init_state() -> BoxedStrategy<Self::State> {
|
|
182
|
+
Just(VecDeque::new()).boxed()
|
|
183
|
+
}
|
|
184
|
+
fn transitions(_: &Self::State) -> BoxedStrategy<Self::Transition> {
|
|
185
|
+
prop_oneof![
|
|
186
|
+
any::<i32>().prop_map(Op::Push),
|
|
187
|
+
Just(Op::Pop),
|
|
188
|
+
].boxed()
|
|
189
|
+
}
|
|
190
|
+
fn apply(mut state: Self::State, transition: &Self::Transition) -> Self::State {
|
|
191
|
+
match transition {
|
|
192
|
+
Op::Push(x) => state.push_back(*x),
|
|
193
|
+
Op::Pop => { state.pop_front(); }
|
|
194
|
+
}
|
|
195
|
+
state
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
impl StateMachineTest for MyQueueSut {
|
|
200
|
+
type SystemUnderTest = MyQueue<i32>;
|
|
201
|
+
type Reference = MyQueueRef;
|
|
202
|
+
|
|
203
|
+
fn init_test(_: &<Self::Reference as ReferenceStateMachine>::State) -> Self::SystemUnderTest {
|
|
204
|
+
MyQueue::new()
|
|
205
|
+
}
|
|
206
|
+
fn apply(mut sut: Self::SystemUnderTest, _: &VecDeque<i32>, transition: Op) -> Self::SystemUnderTest {
|
|
207
|
+
match transition {
|
|
208
|
+
Op::Push(x) => sut.push(x),
|
|
209
|
+
Op::Pop => { sut.pop(); }
|
|
210
|
+
}
|
|
211
|
+
sut
|
|
212
|
+
}
|
|
213
|
+
fn check_invariants(sut: &Self::SystemUnderTest, state: &VecDeque<i32>) {
|
|
214
|
+
assert_eq!(sut.len(), state.len());
|
|
215
|
+
// also check head/tail/iteration order...
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
proptest_state_machine::prop_state_machine! {
|
|
220
|
+
#[test]
|
|
221
|
+
fn queue_matches_vecdeque(sequential 1..50 => MyQueueSut);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
You define a reference implementation (`VecDeque` here), proptest fuzzes operations against both, asserts invariants every step. This is the technique for finding bugs in lock-free or complex containers.
|
|
226
|
+
|
|
227
|
+
## Shrinking
|
|
228
|
+
|
|
229
|
+
When a property fails, proptest reduces the input to a minimal counter-example. For built-in strategies this is automatic. For custom strategies built with `prop_map`, shrinking goes through the underlying strategy. Avoid breaking shrinking with `prop_filter` (rejection sampling) over wide spaces; prefer `prop_flat_map` or directly-shaped strategies.
|
|
230
|
+
|
|
231
|
+
## Regression corpus
|
|
232
|
+
|
|
233
|
+
When a property test fails, proptest writes the failing input to `proptest-regressions/<test_name>.txt`. Commit this directory. Future runs replay these failing inputs first, so the bug stays fixed forever.
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
proptest-regressions/
|
|
237
|
+
└── parse_color.txt # commit this
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Insta — setup
|
|
241
|
+
|
|
242
|
+
`Cargo.toml`:
|
|
243
|
+
|
|
244
|
+
```toml
|
|
245
|
+
[dev-dependencies]
|
|
246
|
+
insta = { version = "1", features = ["yaml", "json", "redactions", "filters"] }
|
|
247
|
+
|
|
248
|
+
[dependencies.serde_yaml]
|
|
249
|
+
version = "0.9"
|
|
250
|
+
optional = true
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Install the CLI:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
cargo install cargo-insta
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Insta — basic snapshots
|
|
260
|
+
|
|
261
|
+
```rust
|
|
262
|
+
#[test]
|
|
263
|
+
fn renders_default_help() {
|
|
264
|
+
let output = render_help();
|
|
265
|
+
insta::assert_snapshot!(output);
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
First run: creates `src/snapshots/mycrate__renders_default_help.snap.new`. Run `cargo insta review`, press `a` to accept, the `.new` extension is dropped. Subsequent runs diff against the committed snapshot; mismatches fail the test.
|
|
270
|
+
|
|
271
|
+
## Insta — typed snapshots
|
|
272
|
+
|
|
273
|
+
```rust
|
|
274
|
+
#[derive(Debug, serde::Serialize)]
|
|
275
|
+
struct Result {
|
|
276
|
+
status: String,
|
|
277
|
+
user: User,
|
|
278
|
+
duration_ms: u64,
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#[test]
|
|
282
|
+
fn json_response() {
|
|
283
|
+
let value = compute();
|
|
284
|
+
insta::assert_json_snapshot!(value);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
#[test]
|
|
288
|
+
fn yaml_response() {
|
|
289
|
+
insta::assert_yaml_snapshot!(value);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
#[test]
|
|
293
|
+
fn debug_repr() {
|
|
294
|
+
insta::assert_debug_snapshot!(value);
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Choose:
|
|
299
|
+
- `assert_snapshot!` for `String`/`Display` output (CLI help, error messages, generated code).
|
|
300
|
+
- `assert_debug_snapshot!` for `{:?}` (Rust-internal data).
|
|
301
|
+
- `assert_json_snapshot!` for structured data crossing process boundaries.
|
|
302
|
+
- `assert_yaml_snapshot!` when YAML is easier to read in diffs.
|
|
303
|
+
|
|
304
|
+
## Insta — redactions and filters
|
|
305
|
+
|
|
306
|
+
For values that change every run (timestamps, UUIDs, paths):
|
|
307
|
+
|
|
308
|
+
```rust
|
|
309
|
+
#[test]
|
|
310
|
+
fn with_redactions() {
|
|
311
|
+
let value = ApiResponse {
|
|
312
|
+
id: uuid::Uuid::now_v7(),
|
|
313
|
+
created_at: jiff::Timestamp::now(),
|
|
314
|
+
body: "hello".into(),
|
|
315
|
+
};
|
|
316
|
+
insta::assert_json_snapshot!(value, {
|
|
317
|
+
".id" => "[uuid]",
|
|
318
|
+
".created_at" => "[timestamp]",
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
For regex filters applied to all snapshots in a test:
|
|
324
|
+
|
|
325
|
+
```rust
|
|
326
|
+
#[test]
|
|
327
|
+
fn with_filters() {
|
|
328
|
+
let mut settings = insta::Settings::clone_current();
|
|
329
|
+
settings.add_filter(r"/tmp/[a-z0-9-]+", "[TMP]");
|
|
330
|
+
settings.add_filter(r"\d+\.\d+ms", "[TIMING]");
|
|
331
|
+
settings.bind(|| {
|
|
332
|
+
let output = run_command();
|
|
333
|
+
insta::assert_snapshot!(output);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
`Settings::bind` scopes filters to the closure.
|
|
339
|
+
|
|
340
|
+
## Insta workflow
|
|
341
|
+
|
|
342
|
+
1. Write the test, run it. First run creates `.snap.new`.
|
|
343
|
+
2. `cargo insta review` → interactive UI. Show diff, accept/reject.
|
|
344
|
+
3. Accepted snapshots commit to the repo.
|
|
345
|
+
4. Refactor code. Tests run; mismatches show as diffs.
|
|
346
|
+
5. If the new output is correct, `cargo insta accept` (or selective `review`). If wrong, fix the code.
|
|
347
|
+
|
|
348
|
+
Pair with CI to fail builds when uncommitted `.snap.new` files exist:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
cargo nextest run
|
|
352
|
+
if find . -name "*.snap.new" | grep -q .; then
|
|
353
|
+
echo "Pending snapshots, run 'cargo insta review'"
|
|
354
|
+
exit 1
|
|
355
|
+
fi
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Inline snapshots
|
|
359
|
+
|
|
360
|
+
```rust
|
|
361
|
+
#[test]
|
|
362
|
+
fn small_output() {
|
|
363
|
+
let value = compute();
|
|
364
|
+
insta::assert_snapshot!(value, @"hello world");
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
The trailing `@"..."` string is the expected snapshot, stored in source. Useful when the value is short enough that pulling out a separate file is overkill. `cargo insta accept` updates them in-place.
|
|
369
|
+
|
|
370
|
+
## Inline JSON snapshots
|
|
371
|
+
|
|
372
|
+
```rust
|
|
373
|
+
#[test]
|
|
374
|
+
fn json_inline() {
|
|
375
|
+
insta::assert_json_snapshot!(value, @r###"
|
|
376
|
+
{
|
|
377
|
+
"status": "ok",
|
|
378
|
+
"count": 3
|
|
379
|
+
}
|
|
380
|
+
"###);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Anti-patterns
|
|
385
|
+
|
|
386
|
+
1. **Snapshots of unstable output.** If `HashMap` iteration order changes per run, snapshots will fail. Switch to `BTreeMap` or sort before snapshotting.
|
|
387
|
+
2. **Massive snapshots.** A 10KB JSON dump where you really care about 3 fields. Either narrow to the fields, or accept that any refactor will require re-reviewing 10KB.
|
|
388
|
+
3. **Snapshots that bake in implementation details.** "function called 3 times" is not a snapshot - it's a behavior assertion. Use a real assertion.
|
|
389
|
+
4. **Skipping `cargo insta review`.** Accepting blind via `cargo insta accept --all` defeats the purpose. Always review.
|
|
390
|
+
|
|
391
|
+
## Combining proptest + insta
|
|
392
|
+
|
|
393
|
+
```rust
|
|
394
|
+
proptest! {
|
|
395
|
+
#[test]
|
|
396
|
+
fn random_inputs_render_consistently(input: ValidInput) {
|
|
397
|
+
let mut settings = insta::Settings::clone_current();
|
|
398
|
+
settings.set_snapshot_suffix(format!("{}", input.hash()));
|
|
399
|
+
settings.bind(|| {
|
|
400
|
+
insta::assert_snapshot!(render(&input));
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
But honestly, this is rarely a fit. Proptest tests properties, insta tests output shape. Don't snapshot random inputs - that defeats both tools.
|
|
407
|
+
|
|
408
|
+
## CI matrix recommendation
|
|
409
|
+
|
|
410
|
+
```yaml
|
|
411
|
+
- name: Tests
|
|
412
|
+
run: cargo nextest run --all-features
|
|
413
|
+
|
|
414
|
+
- name: Property regressions (replay)
|
|
415
|
+
run: |
|
|
416
|
+
# The regression files in proptest-regressions/ replay first.
|
|
417
|
+
# Failures here mean a previously-fixed bug came back.
|
|
418
|
+
cargo nextest run --all-features --test-threads 1
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
When a proptest finds a new failure, the regression file appears as a git diff - check it in.
|
|
422
|
+
|
|
423
|
+
## What proptest cannot do
|
|
424
|
+
|
|
425
|
+
- Find bugs that require multi-process / multi-network coordination → integration tests + fault injection.
|
|
426
|
+
- Find concurrency bugs → use `loom` (see `concurrency.md`).
|
|
427
|
+
- Find performance regressions → use `criterion`.
|
|
428
|
+
|
|
429
|
+
But for any function with a domain (inputs to outputs), proptest can find more bugs than your unit tests. **Write the property first, derive the unit test second.**
|