oh-my-customcodex 0.1.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/LICENSE +21 -0
- package/README.md +327 -0
- package/dist/cli/index.js +32054 -0
- package/dist/index.js +5469 -0
- package/package.json +89 -0
- package/templates/.claude/agents/arch-documenter.md +38 -0
- package/templates/.claude/agents/arch-speckit-agent.md +66 -0
- package/templates/.claude/agents/be-django-expert.md +47 -0
- package/templates/.claude/agents/be-express-expert.md +31 -0
- package/templates/.claude/agents/be-fastapi-expert.md +45 -0
- package/templates/.claude/agents/be-go-backend-expert.md +45 -0
- package/templates/.claude/agents/be-nestjs-expert.md +29 -0
- package/templates/.claude/agents/be-springboot-expert.md +42 -0
- package/templates/.claude/agents/db-alembic-expert.md +73 -0
- package/templates/.claude/agents/db-postgres-expert.md +38 -0
- package/templates/.claude/agents/db-redis-expert.md +38 -0
- package/templates/.claude/agents/db-supabase-expert.md +37 -0
- package/templates/.claude/agents/de-airflow-expert.md +48 -0
- package/templates/.claude/agents/de-dbt-expert.md +36 -0
- package/templates/.claude/agents/de-kafka-expert.md +83 -0
- package/templates/.claude/agents/de-pipeline-expert.md +34 -0
- package/templates/.claude/agents/de-snowflake-expert.md +38 -0
- package/templates/.claude/agents/de-spark-expert.md +38 -0
- package/templates/.claude/agents/fe-design-expert.md +120 -0
- package/templates/.claude/agents/fe-flutter-agent.md +48 -0
- package/templates/.claude/agents/fe-svelte-agent.md +33 -0
- package/templates/.claude/agents/fe-vercel-agent.md +40 -0
- package/templates/.claude/agents/fe-vuejs-agent.md +34 -0
- package/templates/.claude/agents/infra-aws-expert.md +49 -0
- package/templates/.claude/agents/infra-docker-expert.md +49 -0
- package/templates/.claude/agents/lang-golang-expert.md +46 -0
- package/templates/.claude/agents/lang-java21-expert.md +42 -0
- package/templates/.claude/agents/lang-kotlin-expert.md +45 -0
- package/templates/.claude/agents/lang-python-expert.md +45 -0
- package/templates/.claude/agents/lang-rust-expert.md +45 -0
- package/templates/.claude/agents/lang-typescript-expert.md +45 -0
- package/templates/.claude/agents/mgr-claude-code-bible.md +62 -0
- package/templates/.claude/agents/mgr-creator.md +57 -0
- package/templates/.claude/agents/mgr-gitnerd.md +50 -0
- package/templates/.claude/agents/mgr-sauron.md +163 -0
- package/templates/.claude/agents/mgr-supplier.md +39 -0
- package/templates/.claude/agents/mgr-updater.md +40 -0
- package/templates/.claude/agents/qa-engineer.md +36 -0
- package/templates/.claude/agents/qa-planner.md +78 -0
- package/templates/.claude/agents/qa-writer.md +32 -0
- package/templates/.claude/agents/sec-codeql-expert.md +56 -0
- package/templates/.claude/agents/slack-cli-expert.md +98 -0
- package/templates/.claude/agents/souls/lang-golang-expert.soul.md +21 -0
- package/templates/.claude/agents/sys-memory-keeper.md +123 -0
- package/templates/.claude/agents/sys-naggy.md +76 -0
- package/templates/.claude/agents/tool-bun-expert.md +26 -0
- package/templates/.claude/agents/tool-npm-expert.md +31 -0
- package/templates/.claude/agents/tool-optimizer.md +37 -0
- package/templates/.claude/agents/wiki-curator.md +72 -0
- package/templates/.claude/config/required-plugins.json +30 -0
- package/templates/.claude/contexts/dev.md +20 -0
- package/templates/.claude/contexts/ecomode.md +110 -0
- package/templates/.claude/contexts/index.yaml +41 -0
- package/templates/.claude/contexts/research.md +28 -0
- package/templates/.claude/contexts/review.md +23 -0
- package/templates/.claude/hooks/hooks.json +533 -0
- package/templates/.claude/hooks/scripts/adaptive-harness-scan.sh +45 -0
- package/templates/.claude/hooks/scripts/agent-start-recorder.sh +40 -0
- package/templates/.claude/hooks/scripts/agent-teams-advisor.sh +76 -0
- package/templates/.claude/hooks/scripts/audit-log.sh +64 -0
- package/templates/.claude/hooks/scripts/auto-continue-guard.sh +33 -0
- package/templates/.claude/hooks/scripts/content-hash-validator.sh +75 -0
- package/templates/.claude/hooks/scripts/context-budget-advisor.sh +107 -0
- package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
- package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
- package/templates/.claude/hooks/scripts/eval-core-batch-save.sh +46 -0
- package/templates/.claude/hooks/scripts/feedback-collector.sh +92 -0
- package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
- package/templates/.claude/hooks/scripts/git-delegation-guard.sh +57 -0
- package/templates/.claude/hooks/scripts/model-escalation-advisor.sh +106 -0
- package/templates/.claude/hooks/scripts/omcodex-auto-update.sh +4 -0
- package/templates/.claude/hooks/scripts/omcustom-auto-update.sh +177 -0
- package/templates/.claude/hooks/scripts/rtk-intercept.sh +77 -0
- package/templates/.claude/hooks/scripts/rule-deletion-guard.sh +60 -0
- package/templates/.claude/hooks/scripts/schema-validator.sh +106 -0
- package/templates/.claude/hooks/scripts/secret-filter.sh +100 -0
- package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
- package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
- package/templates/.claude/hooks/scripts/session-env-check.sh +254 -0
- package/templates/.claude/hooks/scripts/skill-extractor-analyzer.sh +49 -0
- package/templates/.claude/hooks/scripts/stage-blocker.sh +16 -0
- package/templates/.claude/hooks/scripts/stale-todo-scanner.sh +91 -0
- package/templates/.claude/hooks/scripts/stall-detection-advisor.sh +112 -0
- package/templates/.claude/hooks/scripts/stop-console-audit.sh +46 -0
- package/templates/.claude/hooks/scripts/stuck-detector.sh +199 -0
- package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +119 -0
- package/templates/.claude/hooks/scripts/task-state-precompact.sh +58 -0
- package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
- package/templates/.claude/hooks/skill-count-reminder.sh +34 -0
- package/templates/.claude/install-hooks.sh +100 -0
- package/templates/.claude/ontology/agents.yaml +546 -0
- package/templates/.claude/ontology/graphs/agent-skill.json +102 -0
- package/templates/.claude/ontology/graphs/full-graph.json +629 -0
- package/templates/.claude/ontology/graphs/routing.json +112 -0
- package/templates/.claude/ontology/graphs/skill-rule.json +78 -0
- package/templates/.claude/ontology/rules.yaml +251 -0
- package/templates/.claude/ontology/schema.yaml +144 -0
- package/templates/.claude/ontology/skills.yaml +575 -0
- package/templates/.claude/rules/MAY-optimization.md +42 -0
- package/templates/.claude/rules/MUST-agent-design.md +340 -0
- package/templates/.claude/rules/MUST-agent-identification.md +77 -0
- package/templates/.claude/rules/MUST-agent-teams.md +293 -0
- package/templates/.claude/rules/MUST-completion-verification.md +112 -0
- package/templates/.claude/rules/MUST-continuous-improvement.md +69 -0
- package/templates/.claude/rules/MUST-enforcement-policy.md +50 -0
- package/templates/.claude/rules/MUST-intent-transparency.md +74 -0
- package/templates/.claude/rules/MUST-language-policy.md +28 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +399 -0
- package/templates/.claude/rules/MUST-parallel-execution.md +184 -0
- package/templates/.claude/rules/MUST-permissions.md +32 -0
- package/templates/.claude/rules/MUST-safety.md +23 -0
- package/templates/.claude/rules/MUST-sync-verification.md +145 -0
- package/templates/.claude/rules/MUST-tool-identification.md +97 -0
- package/templates/.claude/rules/SHOULD-ecomode.md +123 -0
- package/templates/.claude/rules/SHOULD-error-handling.md +33 -0
- package/templates/.claude/rules/SHOULD-hud-statusline.md +51 -0
- package/templates/.claude/rules/SHOULD-interaction.md +77 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +371 -0
- package/templates/.claude/rules/SHOULD-ontology-rag-routing.md +49 -0
- package/templates/.claude/rules/SHOULD-wiki-sync.md +73 -0
- package/templates/.claude/rules/index.yaml +141 -0
- package/templates/.claude/schemas/tool-inputs.json +62 -0
- package/templates/.claude/skills/action-validator/SKILL.md +89 -0
- package/templates/.claude/skills/adaptive-harness/SKILL.md +335 -0
- package/templates/.claude/skills/adversarial-review/SKILL.md +80 -0
- package/templates/.claude/skills/agora/SKILL.md +194 -0
- package/templates/.claude/skills/airflow-best-practices/SKILL.md +94 -0
- package/templates/.claude/skills/alembic-best-practices/SKILL.md +295 -0
- package/templates/.claude/skills/ambiguity-gate/SKILL.md +94 -0
- package/templates/.claude/skills/analysis/SKILL.md +223 -0
- package/templates/.claude/skills/audit-agents/SKILL.md +118 -0
- package/templates/.claude/skills/aws-best-practices/SKILL.md +281 -0
- package/templates/.claude/skills/claude-code-bible/SKILL.md +93 -0
- package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
- package/templates/.claude/skills/claude-native/SKILL.md +215 -0
- package/templates/.claude/skills/codex-exec/SKILL.md +206 -0
- package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +430 -0
- package/templates/.claude/skills/create-agent/SKILL.md +94 -0
- package/templates/.claude/skills/cve-triage/SKILL.md +91 -0
- package/templates/.claude/skills/dag-orchestration/SKILL.md +201 -0
- package/templates/.claude/skills/dbt-best-practices/SKILL.md +55 -0
- package/templates/.claude/skills/de-lead-routing/SKILL.md +230 -0
- package/templates/.claude/skills/deep-plan/SKILL.md +344 -0
- package/templates/.claude/skills/deep-verify/SKILL.md +111 -0
- package/templates/.claude/skills/dev-lead-routing/SKILL.md +161 -0
- package/templates/.claude/skills/dev-refactor/SKILL.md +234 -0
- package/templates/.claude/skills/dev-review/SKILL.md +172 -0
- package/templates/.claude/skills/django-best-practices/SKILL.md +334 -0
- package/templates/.claude/skills/docker-best-practices/SKILL.md +276 -0
- package/templates/.claude/skills/evaluator-optimizer/SKILL.md +421 -0
- package/templates/.claude/skills/fastapi-best-practices/SKILL.md +271 -0
- package/templates/.claude/skills/fix-refs/SKILL.md +109 -0
- package/templates/.claude/skills/flutter-best-practices/SKILL.md +325 -0
- package/templates/.claude/skills/gemini-exec/SKILL.md +215 -0
- package/templates/.claude/skills/gemini-exec/scripts/gemini-wrapper.cjs +485 -0
- package/templates/.claude/skills/go-backend-best-practices/SKILL.md +135 -0
- package/templates/.claude/skills/go-best-practices/SKILL.md +204 -0
- package/templates/.claude/skills/hada-scout/SKILL.md +92 -0
- package/templates/.claude/skills/harness-eval/SKILL.md +95 -0
- package/templates/.claude/skills/harness-synthesizer/SKILL.md +145 -0
- package/templates/.claude/skills/help/SKILL.md +127 -0
- package/templates/.claude/skills/idea/SKILL.md +88 -0
- package/templates/.claude/skills/impeccable-design/SKILL.md +173 -0
- package/templates/.claude/skills/intent-detection/SKILL.md +293 -0
- package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +438 -0
- package/templates/.claude/skills/java21-best-practices/SKILL.md +190 -0
- package/templates/.claude/skills/jinja2-prompts/SKILL.md +86 -0
- package/templates/.claude/skills/kafka-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/kotlin-best-practices/SKILL.md +257 -0
- package/templates/.claude/skills/lists/SKILL.md +80 -0
- package/templates/.claude/skills/memory-management/SKILL.md +196 -0
- package/templates/.claude/skills/memory-recall/SKILL.md +172 -0
- package/templates/.claude/skills/memory-save/SKILL.md +128 -0
- package/templates/.claude/skills/model-escalation/SKILL.md +62 -0
- package/templates/.claude/skills/monitoring-setup/SKILL.md +215 -0
- package/templates/.claude/skills/multi-model-verification/SKILL.md +130 -0
- package/templates/.claude/skills/npm-audit/SKILL.md +74 -0
- package/templates/.claude/skills/npm-publish/SKILL.md +65 -0
- package/templates/.claude/skills/npm-version/SKILL.md +104 -0
- package/templates/.claude/skills/omcodex-auto-improve/SKILL.md +136 -0
- package/templates/.claude/skills/omcodex-feedback/SKILL.md +205 -0
- package/templates/.claude/skills/omcodex-improve-report/SKILL.md +65 -0
- package/templates/.claude/skills/omcodex-loop/SKILL.md +45 -0
- package/templates/.claude/skills/omcodex-release-notes/SKILL.md +117 -0
- package/templates/.claude/skills/omcodex-takeover/SKILL.md +115 -0
- package/templates/.claude/skills/omcodex-web/SKILL.md +95 -0
- package/templates/.claude/skills/optimize-analyze/SKILL.md +57 -0
- package/templates/.claude/skills/optimize-bundle/SKILL.md +69 -0
- package/templates/.claude/skills/optimize-report/SKILL.md +76 -0
- package/templates/.claude/skills/peer-messaging/SKILL.md +59 -0
- package/templates/.claude/skills/pipeline/SKILL.md +103 -0
- package/templates/.claude/skills/pipeline-architecture-patterns/SKILL.md +84 -0
- package/templates/.claude/skills/pipeline-guards/SKILL.md +173 -0
- package/templates/.claude/skills/post-release-followup/SKILL.md +134 -0
- package/templates/.claude/skills/postgres-best-practices/SKILL.md +67 -0
- package/templates/.claude/skills/pr-auto-improve/SKILL.md +129 -0
- package/templates/.claude/skills/professor-triage/SKILL.md +321 -0
- package/templates/.claude/skills/python-best-practices/SKILL.md +223 -0
- package/templates/.claude/skills/qa-lead-routing/SKILL.md +104 -0
- package/templates/.claude/skills/react-best-practices/SKILL.md +102 -0
- package/templates/.claude/skills/reasoning-sandwich/SKILL.md +64 -0
- package/templates/.claude/skills/redis-best-practices/SKILL.md +84 -0
- package/templates/.claude/skills/release-plan/SKILL.md +207 -0
- package/templates/.claude/skills/research/SKILL.md +493 -0
- package/templates/.claude/skills/result-aggregation/SKILL.md +165 -0
- package/templates/.claude/skills/rtk-exec/SKILL.md +199 -0
- package/templates/.claude/skills/rtk-exec/scripts/rtk-wrapper.cjs +377 -0
- package/templates/.claude/skills/rust-best-practices/SKILL.md +268 -0
- package/templates/.claude/skills/sauron-watch/SKILL.md +239 -0
- package/templates/.claude/skills/scout/SKILL.md +250 -0
- package/templates/.claude/skills/sdd/SKILL.md +24 -0
- package/templates/.claude/skills/sdd-dev/SKILL.md +257 -0
- package/templates/.claude/skills/sdd-development/SKILL.md +24 -0
- package/templates/.claude/skills/secretary-routing/SKILL.md +132 -0
- package/templates/.claude/skills/skill-extractor/SKILL.md +155 -0
- package/templates/.claude/skills/skills-sh-search/SKILL.md +210 -0
- package/templates/.claude/skills/snowflake-best-practices/SKILL.md +66 -0
- package/templates/.claude/skills/spark-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/springboot-best-practices/SKILL.md +74 -0
- package/templates/.claude/skills/springboot-best-practices/examples/config-properties-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-example.java +28 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-test-example.java +33 -0
- package/templates/.claude/skills/springboot-best-practices/examples/entity-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/exception-handler-example.java +30 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-example.java +17 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-test-example.java +23 -0
- package/templates/.claude/skills/springboot-best-practices/examples/security-config-example.java +27 -0
- package/templates/.claude/skills/springboot-best-practices/examples/service-example.java +33 -0
- package/templates/.claude/skills/status/SKILL.md +155 -0
- package/templates/.claude/skills/structured-dev-cycle/SKILL.md +200 -0
- package/templates/.claude/skills/stuck-recovery/SKILL.md +80 -0
- package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +100 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +288 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +278 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting.md +240 -0
- package/templates/.claude/skills/systematic-debugging/defense-in-depth.md +252 -0
- package/templates/.claude/skills/systematic-debugging/find-polluter.sh +147 -0
- package/templates/.claude/skills/systematic-debugging/root-cause-tracing.md +87 -0
- package/templates/.claude/skills/task-decomposition/SKILL.md +197 -0
- package/templates/.claude/skills/typescript-best-practices/SKILL.md +322 -0
- package/templates/.claude/skills/update-docs/SKILL.md +142 -0
- package/templates/.claude/skills/update-external/SKILL.md +169 -0
- package/templates/.claude/skills/vercel-deploy/SKILL.md +75 -0
- package/templates/.claude/skills/web-design-guidelines/SKILL.md +119 -0
- package/templates/.claude/skills/wiki/SKILL.md +426 -0
- package/templates/.claude/skills/wiki-rag/SKILL.md +154 -0
- package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +165 -0
- package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +66 -0
- package/templates/.claude/statusline.sh +380 -0
- package/templates/.claude/uninstall-hooks.sh +52 -0
- package/templates/.github/workflows/wiki-sync.yml +132 -0
- package/templates/AGENTS.md.en +255 -0
- package/templates/AGENTS.md.ko +255 -0
- package/templates/CLAUDE.md +263 -0
- package/templates/CLAUDE.md.en +256 -0
- package/templates/CLAUDE.md.ko +256 -0
- package/templates/deprecated-files.json +10 -0
- package/templates/guides/agents-md-quality/README.md +110 -0
- package/templates/guides/airflow/README.md +47 -0
- package/templates/guides/alembic/README.md +438 -0
- package/templates/guides/aws/common-patterns.md +169 -0
- package/templates/guides/aws/index.yaml +26 -0
- package/templates/guides/aws/well-architected.md +143 -0
- package/templates/guides/cc-token-saver/README.md +97 -0
- package/templates/guides/claude-code/01-overview.md +42 -0
- package/templates/guides/claude-code/03-tools.md +107 -0
- package/templates/guides/claude-code/04-agent-skills.md +90 -0
- package/templates/guides/claude-code/05-agent-sdk.md +129 -0
- package/templates/guides/claude-code/06-mcp.md +165 -0
- package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
- package/templates/guides/claude-code/08-testing.md +56 -0
- package/templates/guides/claude-code/09-guardrails.md +78 -0
- package/templates/guides/claude-code/10-monitoring.md +87 -0
- package/templates/guides/claude-code/11-sub-agents.md +159 -0
- package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
- package/templates/guides/claude-code/13-cli-flags.md +151 -0
- package/templates/guides/claude-code/index.yaml +61 -0
- package/templates/guides/dbt/README.md +32 -0
- package/templates/guides/django-best-practices/README.md +476 -0
- package/templates/guides/docker/compose-best-practices.md +284 -0
- package/templates/guides/docker/dockerfile-best-practices.md +262 -0
- package/templates/guides/docker/index.yaml +26 -0
- package/templates/guides/drizzle-orm/README.md +69 -0
- package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
- package/templates/guides/fastapi/best-practices.md +232 -0
- package/templates/guides/fastapi/index.yaml +21 -0
- package/templates/guides/flutter/architecture.md +141 -0
- package/templates/guides/flutter/fundamentals.md +119 -0
- package/templates/guides/flutter/index.yaml +44 -0
- package/templates/guides/flutter/performance.md +119 -0
- package/templates/guides/flutter/security.md +120 -0
- package/templates/guides/flutter/state-management.md +144 -0
- package/templates/guides/flutter/testing.md +155 -0
- package/templates/guides/git-worktree-workflow/README.md +138 -0
- package/templates/guides/go-backend/index.yaml +26 -0
- package/templates/guides/go-backend/project-layout.md +243 -0
- package/templates/guides/go-backend/uber-style.md +212 -0
- package/templates/guides/golang/concurrency.md +282 -0
- package/templates/guides/golang/effective-go.md +309 -0
- package/templates/guides/golang/error-handling.md +250 -0
- package/templates/guides/golang/index.yaml +27 -0
- package/templates/guides/hook-data-flow/README.md +135 -0
- package/templates/guides/iceberg/README.md +49 -0
- package/templates/guides/impeccable-design/color-and-contrast.md +278 -0
- package/templates/guides/impeccable-design/index.yaml +12 -0
- package/templates/guides/impeccable-design/motion-design.md +390 -0
- package/templates/guides/impeccable-design/typography.md +386 -0
- package/templates/guides/impeccable-design/ux-writing.md +400 -0
- package/templates/guides/index.yaml +265 -0
- package/templates/guides/java21/index.yaml +29 -0
- package/templates/guides/java21/java-style-guide.md +248 -0
- package/templates/guides/java21/modern-java21.md +303 -0
- package/templates/guides/kafka/README.md +32 -0
- package/templates/guides/kotlin/coding-conventions.md +247 -0
- package/templates/guides/kotlin/idioms.md +234 -0
- package/templates/guides/kotlin/index.yaml +26 -0
- package/templates/guides/multi-model-routing/README.md +101 -0
- package/templates/guides/multi-provider-exec/README.md +83 -0
- package/templates/guides/postgres/README.md +58 -0
- package/templates/guides/python/index.yaml +26 -0
- package/templates/guides/python/pep8-style-guide.md +202 -0
- package/templates/guides/python/zen-of-python.md +79 -0
- package/templates/guides/redis/README.md +50 -0
- package/templates/guides/rust/error-handling.md +262 -0
- package/templates/guides/rust/index.yaml +26 -0
- package/templates/guides/rust/ownership.md +180 -0
- package/templates/guides/skill-bundle-design/README.md +106 -0
- package/templates/guides/slack-cli/README.md +145 -0
- package/templates/guides/snowflake/README.md +32 -0
- package/templates/guides/spark/README.md +32 -0
- package/templates/guides/springboot/best-practices.md +361 -0
- package/templates/guides/springboot/index.yaml +22 -0
- package/templates/guides/supabase-postgres/README.md +32 -0
- package/templates/guides/supabase-postgres/index.yaml +19 -0
- package/templates/guides/typescript/advanced-types.md +225 -0
- package/templates/guides/typescript/index.yaml +26 -0
- package/templates/guides/typescript/type-system.md +219 -0
- package/templates/guides/web-design/accessibility.md +66 -0
- package/templates/guides/web-design/index.yaml +20 -0
- package/templates/guides/web-design/performance.md +102 -0
- package/templates/guides/web-scraping/README.md +926 -0
- package/templates/guides/web-scraping/index.yaml +19 -0
- package/templates/guides/worktree-lifecycle/README.md +104 -0
- package/templates/index.yaml +18 -0
- package/templates/manifest.json +49 -0
- package/templates/workflows/auto-dev.yaml +46 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rtk-exec
|
|
3
|
+
description: Execute CLI commands through RTK proxy for token-optimized output
|
|
4
|
+
scope: core
|
|
5
|
+
argument-hint: "<command> [args...] [--gain] [--version] [--init]"
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# RTK Exec Skill
|
|
10
|
+
|
|
11
|
+
Execute CLI commands through the RTK (Rust Token Killer) proxy to reduce LLM token consumption by 60-90%. RTK is a CLI command proxy — it wraps existing shell commands and compresses their output using smart filtering, grouping, truncation, and deduplication.
|
|
12
|
+
|
|
13
|
+
> **Important**: RTK is NOT an AI prompt tool. It is a CLI output compressor. You pass it a regular shell command and it returns compressed output.
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<command> [args...] Required. CLI command to proxy through RTK (e.g., "ls .", "git status", "cargo test")
|
|
19
|
+
--gain Show token savings statistics (rtk gain)
|
|
20
|
+
--version Show RTK version (rtk --version)
|
|
21
|
+
--init Initialize RTK for current project (rtk init -g)
|
|
22
|
+
--timeout <ms> Execution timeout (default: 120000, max: 600000)
|
|
23
|
+
--working-dir <dir> Working directory for command execution
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
1. Pre-checks
|
|
30
|
+
- Verify `rtk` binary is installed (which rtk)
|
|
31
|
+
- No authentication required
|
|
32
|
+
2. Build command
|
|
33
|
+
- Special: rtk gain | rtk --version | rtk init -g
|
|
34
|
+
- Proxy: rtk <command> [args...]
|
|
35
|
+
3. Execute
|
|
36
|
+
- Run via Bash tool with timeout (default 2min, max 10min)
|
|
37
|
+
- Or use helper script: node .codex/skills/rtk-exec/scripts/rtk-wrapper.cjs
|
|
38
|
+
4. Parse output
|
|
39
|
+
- RTK always returns plain text compressed output (no JSON modes)
|
|
40
|
+
- Capture stdout and stderr
|
|
41
|
+
5. Report results
|
|
42
|
+
- Format output with execution metadata and token savings info
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Supported Commands
|
|
46
|
+
|
|
47
|
+
RTK supports 100+ CLI commands across categories:
|
|
48
|
+
|
|
49
|
+
| Category | Commands |
|
|
50
|
+
|----------|----------|
|
|
51
|
+
| File ops | `ls`, `find`, `grep`, `cat`, `tree`, `du`, `diff` |
|
|
52
|
+
| Git | `git status`, `git log`, `git diff`, `git push`, `git pull`, `git branch` |
|
|
53
|
+
| Test runners | `cargo test`, `pytest`, `vitest`, `jest`, `go test`, `bun test` |
|
|
54
|
+
| Linters | `eslint`, `tsc`, `ruff`, `clippy`, `golangci-lint`, `rubocop` |
|
|
55
|
+
| Package managers | `pnpm install`, `pip install`, `cargo build`, `npm install` |
|
|
56
|
+
| Containers | `docker build`, `docker ps`, `kubectl get`, `kubectl logs` |
|
|
57
|
+
| Build tools | `make`, `cmake`, `gradle`, `mvn` |
|
|
58
|
+
| System | `ps`, `top`, `df`, `netstat`, `env` |
|
|
59
|
+
|
|
60
|
+
## Output Format
|
|
61
|
+
|
|
62
|
+
### Success
|
|
63
|
+
```
|
|
64
|
+
[RTK Exec] Completed
|
|
65
|
+
|
|
66
|
+
Command: rtk git status
|
|
67
|
+
Duration: 0.3s
|
|
68
|
+
Working Dir: /path/to/project
|
|
69
|
+
|
|
70
|
+
--- Output ---
|
|
71
|
+
{rtk compressed output}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Success (--gain)
|
|
75
|
+
```
|
|
76
|
+
[RTK Exec] Token Savings
|
|
77
|
+
|
|
78
|
+
--- Gain Report ---
|
|
79
|
+
{rtk gain statistics showing tokens saved per command}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Failure
|
|
83
|
+
```
|
|
84
|
+
[RTK Exec] Failed
|
|
85
|
+
|
|
86
|
+
Command: rtk cargo test
|
|
87
|
+
Error: {error_message}
|
|
88
|
+
Exit Code: {code}
|
|
89
|
+
Stderr: {stderr}
|
|
90
|
+
Suggested Fix: {suggestion}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Helper Script
|
|
94
|
+
|
|
95
|
+
For complex executions or programmatic use:
|
|
96
|
+
```bash
|
|
97
|
+
node .codex/skills/rtk-exec/scripts/rtk-wrapper.cjs --command "cargo test" [options]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The wrapper provides:
|
|
101
|
+
- Binary availability check
|
|
102
|
+
- Safe command construction
|
|
103
|
+
- Timeout handling with graceful SIGTERM → SIGKILL escalation
|
|
104
|
+
- Structured JSON output for programmatic consumption
|
|
105
|
+
|
|
106
|
+
## Examples
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# List files with compression
|
|
110
|
+
/rtk-exec "ls -la src/"
|
|
111
|
+
|
|
112
|
+
# Git status (often 70%+ token reduction)
|
|
113
|
+
/rtk-exec "git status"
|
|
114
|
+
|
|
115
|
+
# Run Rust tests
|
|
116
|
+
/rtk-exec "cargo test"
|
|
117
|
+
|
|
118
|
+
# Run Python tests
|
|
119
|
+
/rtk-exec "pytest tests/ -v"
|
|
120
|
+
|
|
121
|
+
# TypeScript type check
|
|
122
|
+
/rtk-exec "tsc --noEmit"
|
|
123
|
+
|
|
124
|
+
# Show token savings stats
|
|
125
|
+
/rtk-exec --gain
|
|
126
|
+
|
|
127
|
+
# Initialize RTK for project
|
|
128
|
+
/rtk-exec --init
|
|
129
|
+
|
|
130
|
+
# With timeout override
|
|
131
|
+
/rtk-exec "cargo build --release" --timeout 300000
|
|
132
|
+
|
|
133
|
+
# Specify working directory
|
|
134
|
+
/rtk-exec "git log --oneline -20" --working-dir /path/to/repo
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Integration
|
|
138
|
+
|
|
139
|
+
Works with the orchestrator pattern:
|
|
140
|
+
- Main conversation delegates CLI execution via this skill
|
|
141
|
+
- Results are returned to the main conversation for further processing
|
|
142
|
+
- Particularly effective for test runs, lint checks, and git operations where output is verbose
|
|
143
|
+
- Can be chained: rtk-exec for output collection → Claude expert for analysis
|
|
144
|
+
|
|
145
|
+
## Availability Check
|
|
146
|
+
|
|
147
|
+
rtk-exec requires the RTK binary to be installed. The skill is only usable when:
|
|
148
|
+
|
|
149
|
+
1. `rtk` binary is found in PATH (`which rtk` succeeds)
|
|
150
|
+
2. No authentication or API keys required
|
|
151
|
+
|
|
152
|
+
If the binary check fails, this skill cannot be used. Fall back to direct Bash tool execution.
|
|
153
|
+
|
|
154
|
+
> **Note**: This skill is invoked via `/rtk-exec` command or delegated by the orchestrator. It is most useful for any task that produces verbose CLI output that would otherwise consume large amounts of context tokens.
|
|
155
|
+
|
|
156
|
+
## Agent Teams Integration
|
|
157
|
+
|
|
158
|
+
When used within Agent Teams:
|
|
159
|
+
|
|
160
|
+
1. **As delegated task**: orchestrator explicitly delegates CLI execution for token-efficient output
|
|
161
|
+
2. **Hybrid workflow**: Claude team member plans → rtk-exec runs commands → Claude analyzes compressed output
|
|
162
|
+
3. **Batch execution**: Multiple rtk-exec invocations in parallel for different commands
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Orchestrator delegates CLI task
|
|
166
|
+
→ /rtk-exec invoked with command
|
|
167
|
+
→ Compressed output returned to orchestrator
|
|
168
|
+
→ Analyst processes compressed result
|
|
169
|
+
→ Iterate if needed
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Token Savings
|
|
173
|
+
|
|
174
|
+
RTK uses four compression strategies:
|
|
175
|
+
|
|
176
|
+
| Strategy | Description | Typical Savings |
|
|
177
|
+
|----------|-------------|-----------------|
|
|
178
|
+
| Smart Filtering | Removes redundant/noise lines based on command type | 30-50% |
|
|
179
|
+
| Grouping | Collapses repeated patterns into summary counts | 20-40% |
|
|
180
|
+
| Truncation | Clips excessively long lines with ellipsis | 10-20% |
|
|
181
|
+
| Deduplication | Removes identical repeated output blocks | 15-30% |
|
|
182
|
+
|
|
183
|
+
Combined effect: **60-90% token reduction** on typical CLI output (git log, test results, lint reports).
|
|
184
|
+
|
|
185
|
+
## Installation
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# macOS via Homebrew
|
|
189
|
+
brew install rtk
|
|
190
|
+
|
|
191
|
+
# Universal install script
|
|
192
|
+
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
193
|
+
|
|
194
|
+
# From source via Cargo
|
|
195
|
+
cargo install --git https://github.com/rtk-ai/rtk
|
|
196
|
+
|
|
197
|
+
# Verify installation
|
|
198
|
+
rtk --version
|
|
199
|
+
```
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* rtk-wrapper.cjs
|
|
5
|
+
*
|
|
6
|
+
* Node.js wrapper for RTK (Rust Token Killer) CLI proxy.
|
|
7
|
+
* Executes shell commands through RTK for token-optimized compressed output.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node rtk-wrapper.cjs --command "git status" [options]
|
|
11
|
+
* node rtk-wrapper.cjs --gain
|
|
12
|
+
* node rtk-wrapper.cjs --version
|
|
13
|
+
* node rtk-wrapper.cjs --init
|
|
14
|
+
*
|
|
15
|
+
* Options:
|
|
16
|
+
* --command <cmd> Required (unless --gain/--version/--init): CLI command to proxy through RTK
|
|
17
|
+
* --timeout <ms> Execution timeout in milliseconds (default: 120000, max: 600000)
|
|
18
|
+
* --working-dir <dir> Set working directory for execution
|
|
19
|
+
* --gain Show token savings statistics (rtk gain)
|
|
20
|
+
* --version Show RTK version (rtk --version)
|
|
21
|
+
* --init Initialize RTK for current project (rtk init -g)
|
|
22
|
+
*
|
|
23
|
+
* Output (JSON to stdout):
|
|
24
|
+
* Success: { "success": true, "output": "...", "duration_ms": 1234, "command": "..." }
|
|
25
|
+
* Failure: { "success": false, "error": "...", "stderr": "...", "exit_code": 1 }
|
|
26
|
+
*
|
|
27
|
+
* Exit codes:
|
|
28
|
+
* 0 = success
|
|
29
|
+
* 1 = execution error
|
|
30
|
+
* 2 = validation error (missing binary or invalid arguments)
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const { spawn, execFileSync } = require('child_process');
|
|
34
|
+
const fs = require('fs');
|
|
35
|
+
const path = require('path');
|
|
36
|
+
const os = require('os');
|
|
37
|
+
|
|
38
|
+
// Configuration
|
|
39
|
+
const DEFAULT_TIMEOUT_MS = 120000; // 2 minutes
|
|
40
|
+
const MAX_TIMEOUT_MS = 600000; // 10 minutes
|
|
41
|
+
const KILL_GRACE_PERIOD_MS = 5000; // 5 seconds for graceful shutdown
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Parse command line arguments
|
|
45
|
+
* @returns {Object} Parsed arguments
|
|
46
|
+
*/
|
|
47
|
+
function parseArgs() {
|
|
48
|
+
const args = {
|
|
49
|
+
command: null,
|
|
50
|
+
timeout: DEFAULT_TIMEOUT_MS,
|
|
51
|
+
workingDir: null,
|
|
52
|
+
gain: false,
|
|
53
|
+
version: false,
|
|
54
|
+
init: false,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
for (let i = 2; i < process.argv.length; i++) {
|
|
58
|
+
const arg = process.argv[i];
|
|
59
|
+
|
|
60
|
+
switch (arg) {
|
|
61
|
+
case '--command':
|
|
62
|
+
if (i + 1 < process.argv.length) {
|
|
63
|
+
args.command = process.argv[++i];
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
case '--timeout':
|
|
67
|
+
if (i + 1 < process.argv.length) {
|
|
68
|
+
const timeoutValue = parseInt(process.argv[++i], 10);
|
|
69
|
+
if (!isNaN(timeoutValue)) {
|
|
70
|
+
args.timeout = Math.min(timeoutValue, MAX_TIMEOUT_MS);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
case '--working-dir':
|
|
75
|
+
if (i + 1 < process.argv.length) {
|
|
76
|
+
args.workingDir = process.argv[++i];
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case '--gain':
|
|
80
|
+
args.gain = true;
|
|
81
|
+
break;
|
|
82
|
+
case '--version':
|
|
83
|
+
args.version = true;
|
|
84
|
+
break;
|
|
85
|
+
case '--init':
|
|
86
|
+
args.init = true;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return args;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Validate environment for RTK execution
|
|
96
|
+
* No auth required — only checks binary availability
|
|
97
|
+
* @returns {Object} Validation result { valid: boolean, errors: string[], rtkPath: string|null }
|
|
98
|
+
*/
|
|
99
|
+
function validateEnvironment() {
|
|
100
|
+
const errors = [];
|
|
101
|
+
let rtkPath = null;
|
|
102
|
+
|
|
103
|
+
// Check for rtk binary
|
|
104
|
+
try {
|
|
105
|
+
const result = execFileSync('which', ['rtk'], { stdio: 'pipe' });
|
|
106
|
+
rtkPath = result.toString().trim();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
// Try common installation paths
|
|
109
|
+
const commonPaths = [
|
|
110
|
+
'/usr/local/bin/rtk',
|
|
111
|
+
path.join(os.homedir(), '.local', 'bin', 'rtk'),
|
|
112
|
+
path.join(os.homedir(), 'bin', 'rtk'),
|
|
113
|
+
path.join(os.homedir(), '.cargo', 'bin', 'rtk'),
|
|
114
|
+
'/opt/homebrew/bin/rtk',
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
const foundPath = commonPaths.find(p => fs.existsSync(p));
|
|
118
|
+
if (foundPath) {
|
|
119
|
+
rtkPath = foundPath;
|
|
120
|
+
} else {
|
|
121
|
+
errors.push(
|
|
122
|
+
'rtk binary not found in PATH or common locations. ' +
|
|
123
|
+
'Install with: brew install rtk, ' +
|
|
124
|
+
'curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh, ' +
|
|
125
|
+
'or cargo install --git https://github.com/rtk-ai/rtk'
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
valid: errors.length === 0,
|
|
132
|
+
errors,
|
|
133
|
+
rtkPath,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Build RTK command array
|
|
139
|
+
* @param {Object} options - Parsed arguments
|
|
140
|
+
* @returns {Object} Command structure { binary: string, args: string[], label: string }
|
|
141
|
+
*/
|
|
142
|
+
function buildCommand(options) {
|
|
143
|
+
// Special commands
|
|
144
|
+
if (options.gain) {
|
|
145
|
+
return { binary: 'rtk', args: ['gain'], label: 'rtk gain' };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (options.version) {
|
|
149
|
+
return { binary: 'rtk', args: ['--version'], label: 'rtk --version' };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (options.init) {
|
|
153
|
+
return { binary: 'rtk', args: ['init', '-g'], label: 'rtk init -g' };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Proxy command: rtk <command_parts...>
|
|
157
|
+
// Split the command string into parts for safe argv construction
|
|
158
|
+
const commandParts = splitCommand(options.command);
|
|
159
|
+
return {
|
|
160
|
+
binary: 'rtk',
|
|
161
|
+
args: commandParts,
|
|
162
|
+
label: `rtk ${options.command}`,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Split a command string into argv parts, respecting quoted strings
|
|
168
|
+
* Simple shell-like splitting (no full POSIX parsing)
|
|
169
|
+
* @param {string} cmd - Command string
|
|
170
|
+
* @returns {string[]} Argv parts
|
|
171
|
+
*/
|
|
172
|
+
function splitCommand(cmd) {
|
|
173
|
+
const parts = [];
|
|
174
|
+
let current = '';
|
|
175
|
+
let inSingleQuote = false;
|
|
176
|
+
let inDoubleQuote = false;
|
|
177
|
+
|
|
178
|
+
for (let i = 0; i < cmd.length; i++) {
|
|
179
|
+
const ch = cmd[i];
|
|
180
|
+
|
|
181
|
+
if (ch === "'" && !inDoubleQuote) {
|
|
182
|
+
inSingleQuote = !inSingleQuote;
|
|
183
|
+
} else if (ch === '"' && !inSingleQuote) {
|
|
184
|
+
inDoubleQuote = !inDoubleQuote;
|
|
185
|
+
} else if (ch === ' ' && !inSingleQuote && !inDoubleQuote) {
|
|
186
|
+
if (current.length > 0) {
|
|
187
|
+
parts.push(current);
|
|
188
|
+
current = '';
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
current += ch;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (current.length > 0) {
|
|
196
|
+
parts.push(current);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return parts;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Execute RTK command
|
|
204
|
+
* @param {string} binary - Binary to execute (rtk)
|
|
205
|
+
* @param {string[]} args - Command arguments
|
|
206
|
+
* @param {number} timeout - Timeout in milliseconds
|
|
207
|
+
* @param {string|null} workingDir - Working directory
|
|
208
|
+
* @returns {Promise<Object>} Execution result
|
|
209
|
+
*/
|
|
210
|
+
function executeRtk(binary, args, timeout, workingDir = null) {
|
|
211
|
+
return new Promise((resolve) => {
|
|
212
|
+
const startTime = Date.now();
|
|
213
|
+
let stdout = '';
|
|
214
|
+
let stderr = '';
|
|
215
|
+
let timedOut = false;
|
|
216
|
+
|
|
217
|
+
const spawnOptions = {
|
|
218
|
+
cwd: workingDir || process.cwd(),
|
|
219
|
+
env: process.env,
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const child = spawn(binary, args, spawnOptions);
|
|
223
|
+
|
|
224
|
+
// Collect output
|
|
225
|
+
child.stdout.on('data', (data) => {
|
|
226
|
+
stdout += data.toString();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
child.stderr.on('data', (data) => {
|
|
230
|
+
stderr += data.toString();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Set timeout
|
|
234
|
+
const timeoutHandle = setTimeout(() => {
|
|
235
|
+
timedOut = true;
|
|
236
|
+
console.error('[rtk-wrapper] Timeout reached, terminating process...');
|
|
237
|
+
|
|
238
|
+
// Graceful termination attempt
|
|
239
|
+
child.kill('SIGTERM');
|
|
240
|
+
|
|
241
|
+
// Force kill after grace period
|
|
242
|
+
setTimeout(() => {
|
|
243
|
+
if (!child.killed) {
|
|
244
|
+
console.error('[rtk-wrapper] Force killing process...');
|
|
245
|
+
child.kill('SIGKILL');
|
|
246
|
+
}
|
|
247
|
+
}, KILL_GRACE_PERIOD_MS);
|
|
248
|
+
}, timeout);
|
|
249
|
+
|
|
250
|
+
// Handle process exit
|
|
251
|
+
child.on('close', (exitCode) => {
|
|
252
|
+
clearTimeout(timeoutHandle);
|
|
253
|
+
const durationMs = Date.now() - startTime;
|
|
254
|
+
|
|
255
|
+
resolve({
|
|
256
|
+
exitCode: exitCode !== null ? exitCode : 1,
|
|
257
|
+
stdout,
|
|
258
|
+
stderr,
|
|
259
|
+
timedOut,
|
|
260
|
+
durationMs,
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Handle spawn errors
|
|
265
|
+
child.on('error', (error) => {
|
|
266
|
+
clearTimeout(timeoutHandle);
|
|
267
|
+
const durationMs = Date.now() - startTime;
|
|
268
|
+
|
|
269
|
+
resolve({
|
|
270
|
+
exitCode: 1,
|
|
271
|
+
stdout,
|
|
272
|
+
stderr: stderr + '\nSpawn error: ' + error.message,
|
|
273
|
+
timedOut: false,
|
|
274
|
+
durationMs,
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Main execution function
|
|
282
|
+
*/
|
|
283
|
+
async function main() {
|
|
284
|
+
const args = parseArgs();
|
|
285
|
+
|
|
286
|
+
// Determine which mode we're running in
|
|
287
|
+
const isSpecialCommand = args.gain || args.version || args.init;
|
|
288
|
+
|
|
289
|
+
// Validate required arguments
|
|
290
|
+
if (!isSpecialCommand && !args.command) {
|
|
291
|
+
const result = {
|
|
292
|
+
success: false,
|
|
293
|
+
error: 'Missing required argument: --command (or use --gain, --version, --init)',
|
|
294
|
+
exit_code: 2,
|
|
295
|
+
};
|
|
296
|
+
console.log(JSON.stringify(result, null, 2));
|
|
297
|
+
process.exit(2);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Validate environment (binary check only, no auth)
|
|
301
|
+
const validation = validateEnvironment();
|
|
302
|
+
if (!validation.valid) {
|
|
303
|
+
const result = {
|
|
304
|
+
success: false,
|
|
305
|
+
error: 'RTK binary not found',
|
|
306
|
+
validation_errors: validation.errors,
|
|
307
|
+
exit_code: 2,
|
|
308
|
+
};
|
|
309
|
+
console.log(JSON.stringify(result, null, 2));
|
|
310
|
+
process.exit(2);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
console.error(`[rtk-wrapper] RTK binary: ${validation.rtkPath}`);
|
|
314
|
+
console.error(`[rtk-wrapper] Executing with timeout: ${args.timeout}ms`);
|
|
315
|
+
if (args.workingDir) {
|
|
316
|
+
console.error(`[rtk-wrapper] Working directory: ${args.workingDir}`);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Build command
|
|
320
|
+
const command = buildCommand(args);
|
|
321
|
+
console.error(`[rtk-wrapper] Command: ${command.binary} ${command.args.join(' ')}`);
|
|
322
|
+
|
|
323
|
+
// Execute
|
|
324
|
+
const execResult = await executeRtk(
|
|
325
|
+
command.binary,
|
|
326
|
+
command.args,
|
|
327
|
+
args.timeout,
|
|
328
|
+
args.workingDir
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
// Determine success
|
|
332
|
+
const success = execResult.exitCode === 0 && !execResult.timedOut;
|
|
333
|
+
|
|
334
|
+
// Build result object
|
|
335
|
+
const result = {
|
|
336
|
+
success,
|
|
337
|
+
duration_ms: execResult.durationMs,
|
|
338
|
+
exit_code: execResult.exitCode,
|
|
339
|
+
command: command.label,
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
if (success) {
|
|
343
|
+
result.output = execResult.stdout.trim();
|
|
344
|
+
if (execResult.stderr.trim()) {
|
|
345
|
+
result.stderr = execResult.stderr.trim();
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
if (execResult.timedOut) {
|
|
349
|
+
result.error = `Execution timed out after ${args.timeout}ms`;
|
|
350
|
+
} else {
|
|
351
|
+
result.error = 'Execution failed';
|
|
352
|
+
}
|
|
353
|
+
if (execResult.stderr.trim()) {
|
|
354
|
+
result.stderr = execResult.stderr.trim();
|
|
355
|
+
}
|
|
356
|
+
if (execResult.stdout.trim()) {
|
|
357
|
+
result.partial_output = execResult.stdout.trim();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Output JSON result to stdout
|
|
362
|
+
console.log(JSON.stringify(result, null, 2));
|
|
363
|
+
|
|
364
|
+
process.exit(result.exit_code);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Run
|
|
368
|
+
main().catch(error => {
|
|
369
|
+
const result = {
|
|
370
|
+
success: false,
|
|
371
|
+
error: 'Unexpected error: ' + error.message,
|
|
372
|
+
stack: error.stack,
|
|
373
|
+
exit_code: 1,
|
|
374
|
+
};
|
|
375
|
+
console.log(JSON.stringify(result, null, 2));
|
|
376
|
+
process.exit(1);
|
|
377
|
+
});
|