create-hq 5.0.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/dist/deps.d.ts +4 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +65 -0
- package/dist/deps.js.map +1 -0
- package/dist/git.d.ts +3 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +19 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +8 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +130 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/ui.d.ts +7 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +36 -0
- package/dist/ui.js.map +1 -0
- package/package.json +41 -0
- package/template/.claude/CLAUDE.md +202 -0
- package/template/.claude/commands/checkpoint.md +127 -0
- package/template/.claude/commands/cleanup.md +307 -0
- package/template/.claude/commands/execute-task.md +440 -0
- package/template/.claude/commands/exit-plan.md +41 -0
- package/template/.claude/commands/handoff.md +97 -0
- package/template/.claude/commands/learn.md +218 -0
- package/template/.claude/commands/metrics.md +118 -0
- package/template/.claude/commands/newworker.md +162 -0
- package/template/.claude/commands/nexttask.md +67 -0
- package/template/.claude/commands/prd.md +238 -0
- package/template/.claude/commands/reanchor.md +51 -0
- package/template/.claude/commands/remember.md +126 -0
- package/template/.claude/commands/run-project.md +348 -0
- package/template/.claude/commands/run.md +110 -0
- package/template/.claude/commands/search-reindex.md +62 -0
- package/template/.claude/commands/search.md +100 -0
- package/template/.claude/commands/setup.md +381 -0
- package/template/.claude/scripts/pure-ralph-loop.ps1 +312 -0
- package/template/.claude/scripts/pure-ralph-loop.sh +859 -0
- package/template/CHANGELOG.md +220 -0
- package/template/LICENSE +21 -0
- package/template/MIGRATION.md +259 -0
- package/template/README.md +368 -0
- package/template/data/journal/.gitkeep +0 -0
- package/template/docs/images/ascii-banner-options.md +122 -0
- package/template/docs/images/hq-banner.svg +105 -0
- package/template/knowledge/Ralph/01-overview.md +71 -0
- package/template/knowledge/Ralph/02-core-concepts.md +114 -0
- package/template/knowledge/Ralph/03-how-ralph-works.md +184 -0
- package/template/knowledge/Ralph/04-back-pressure.md +222 -0
- package/template/knowledge/Ralph/05-specifications.md +210 -0
- package/template/knowledge/Ralph/06-agents-md.md +222 -0
- package/template/knowledge/Ralph/07-implementation.md +316 -0
- package/template/knowledge/Ralph/08-economics.md +182 -0
- package/template/knowledge/Ralph/09-resources.md +145 -0
- package/template/knowledge/Ralph/10-claude-code-workflow.md +212 -0
- package/template/knowledge/Ralph/11-team-training-guide.md +383 -0
- package/template/knowledge/Ralph/README.md +40 -0
- package/template/knowledge/ai-security-framework/CONTRIBUTING.md +139 -0
- package/template/knowledge/ai-security-framework/GLOSSARY.md +176 -0
- package/template/knowledge/ai-security-framework/LICENSE +21 -0
- package/template/knowledge/ai-security-framework/QUICK-START.md +172 -0
- package/template/knowledge/ai-security-framework/README.md +232 -0
- package/template/knowledge/ai-security-framework/checklists/browser-security.md +301 -0
- package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +322 -0
- package/template/knowledge/ai-security-framework/checklists/incident-response.md +288 -0
- package/template/knowledge/ai-security-framework/checklists/pre-flight.md +249 -0
- package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +159 -0
- package/template/knowledge/ai-security-framework/configs/audit-logging.md +372 -0
- package/template/knowledge/ai-security-framework/configs/kill-switches.md +354 -0
- package/template/knowledge/ai-security-framework/docs/01-core-principles.md +256 -0
- package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +326 -0
- package/template/knowledge/ai-security-framework/docs/03-security-posture.md +250 -0
- package/template/knowledge/ai-security-framework/templates/agents-security.md +233 -0
- package/template/knowledge/design-styles/README.md +42 -0
- package/template/knowledge/design-styles/american-industrial.md +136 -0
- package/template/knowledge/design-styles/ethereal-abstract.md +133 -0
- package/template/knowledge/design-styles/liminal-portal.md +111 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/README.md +31 -0
- package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
- package/template/knowledge/dev-team/README.md +35 -0
- package/template/knowledge/dev-team/patterns/README.md +34 -0
- package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +178 -0
- package/template/knowledge/dev-team/troubleshooting/README.md +31 -0
- package/template/knowledge/dev-team/workflows/README.md +49 -0
- package/template/knowledge/hq/checkpoint-schema.json +51 -0
- package/template/knowledge/hq/index-md-spec.md +74 -0
- package/template/knowledge/hq/thread-schema.md +153 -0
- package/template/knowledge/hq-core/checkpoint-schema.json +51 -0
- package/template/knowledge/hq-core/index-md-spec.md +74 -0
- package/template/knowledge/hq-core/thread-schema.md +153 -0
- package/template/knowledge/loom/README.md +51 -0
- package/template/knowledge/loom/architecture.md +125 -0
- package/template/knowledge/loom/code-style.md +169 -0
- package/template/knowledge/loom/llm-proxy.md +132 -0
- package/template/knowledge/loom/state-machine.md +131 -0
- package/template/knowledge/loom/thread-system.md +117 -0
- package/template/knowledge/loom/tools.md +94 -0
- package/template/knowledge/loom/weaver.md +96 -0
- package/template/knowledge/loom/web-frontend.md +131 -0
- package/template/knowledge/projects/README.md +72 -0
- package/template/knowledge/projects/templates/README.template.md +28 -0
- package/template/knowledge/workers/README.md +195 -0
- package/template/knowledge/workers/ralph-loop-pattern.md +157 -0
- package/template/knowledge/workers/skill-schema.md +182 -0
- package/template/knowledge/workers/state-machine.md +102 -0
- package/template/knowledge/workers/templates/base-worker.yaml +73 -0
- package/template/knowledge/workers/templates/code-worker.yaml +85 -0
- package/template/knowledge/workers/templates/skill.yaml +49 -0
- package/template/knowledge/workers/templates/social-worker.yaml +70 -0
- package/template/modules/examples/full-manifest.yaml +92 -0
- package/template/modules/examples/minimal.yaml +14 -0
- package/template/modules/modules.yaml +59 -0
- package/template/projects/.gitkeep +0 -0
- package/template/projects/incorporate-workers-into-pure-ralph/prd.json +88 -0
- package/template/projects/pure-ralph-branch-isolation/README.md +114 -0
- package/template/projects/pure-ralph-branch-isolation/prd.json +123 -0
- package/template/projects/purist-ralph-loop/README.md +148 -0
- package/template/projects/purist-ralph-loop/prd.json +135 -0
- package/template/projects/ralph-test/prd.json +50 -0
- package/template/prompts/pure-ralph-base.md +551 -0
- package/template/settings/.gitkeep +0 -0
- package/template/settings/pure-ralph.json +42 -0
- package/template/social-content/drafts/INDEX.md +21 -0
- package/template/social-content/drafts/linkedin/.gitkeep +1 -0
- package/template/social-content/drafts/x/.gitkeep +1 -0
- package/template/social-content/images/.gitkeep +1 -0
- package/template/starter-projects/code-worker/README.md +97 -0
- package/template/starter-projects/code-worker/prd.json +45 -0
- package/template/starter-projects/personal-assistant/README.md +42 -0
- package/template/starter-projects/personal-assistant/prd.json +43 -0
- package/template/starter-projects/social-media/README.md +60 -0
- package/template/starter-projects/social-media/prd.json +43 -0
- package/template/workers/content-brand/README.md +59 -0
- package/template/workers/content-brand/skills/messaging-alignment.md +91 -0
- package/template/workers/content-brand/skills/tone-check.md +76 -0
- package/template/workers/content-brand/skills/voice-analysis.md +68 -0
- package/template/workers/content-brand/worker.yaml +81 -0
- package/template/workers/content-legal/README.md +80 -0
- package/template/workers/content-legal/skills/claim-substantiation.md +150 -0
- package/template/workers/content-legal/skills/compliance-scan.md +123 -0
- package/template/workers/content-legal/skills/disclaimer-check.md +146 -0
- package/template/workers/content-legal/worker.yaml +118 -0
- package/template/workers/content-product/README.md +77 -0
- package/template/workers/content-product/skills/claim-verification.md +96 -0
- package/template/workers/content-product/skills/feature-accuracy.md +117 -0
- package/template/workers/content-product/skills/stats-check.md +128 -0
- package/template/workers/content-product/worker.yaml +97 -0
- package/template/workers/content-sales/README.md +70 -0
- package/template/workers/content-sales/skills/conversion-analysis.md +96 -0
- package/template/workers/content-sales/skills/cta-audit.md +107 -0
- package/template/workers/content-sales/skills/value-prop-check.md +114 -0
- package/template/workers/content-sales/worker.yaml +93 -0
- package/template/workers/content-shared/cli.ts +242 -0
- package/template/workers/content-shared/index.ts +234 -0
- package/template/workers/content-shared/lib/accuracy-analyzer.ts +661 -0
- package/template/workers/content-shared/lib/analyze.ts +370 -0
- package/template/workers/content-shared/lib/brand-analyzer.ts +526 -0
- package/template/workers/content-shared/lib/cms-integration.ts +446 -0
- package/template/workers/content-shared/lib/compliance-analyzer.ts +655 -0
- package/template/workers/content-shared/lib/conversion-analyzer.ts +555 -0
- package/template/workers/content-shared/lib/github-integration.ts +582 -0
- package/template/workers/content-shared/lib/output.ts +373 -0
- package/template/workers/content-shared/lib/parser.ts +771 -0
- package/template/workers/content-shared/lib/priority.ts +439 -0
- package/template/workers/content-shared/lib/recommendations.ts +512 -0
- package/template/workers/content-shared/lib/reporter.ts +749 -0
- package/template/workers/content-shared/lib/restructure.ts +664 -0
- package/template/workers/content-shared/lib/scorer.ts +140 -0
- package/template/workers/content-shared/lib/types.ts +227 -0
- package/template/workers/content-shared/lib/variants.ts +595 -0
- package/template/workers/content-shared/package.json +51 -0
- package/template/workers/content-shared/pnpm-lock.yaml +39 -0
- package/template/workers/content-shared/test/sample-page.json +115 -0
- package/template/workers/content-shared/tsconfig.json +20 -0
- package/template/workers/dev-team/README.md +166 -0
- package/template/workers/dev-team/_template.yaml +70 -0
- package/template/workers/dev-team/architect/package.json +27 -0
- package/template/workers/dev-team/architect/skills/api-design.md +89 -0
- package/template/workers/dev-team/architect/skills/refactor-plan.md +96 -0
- package/template/workers/dev-team/architect/skills/system-design.md +100 -0
- package/template/workers/dev-team/architect/src/index.ts +49 -0
- package/template/workers/dev-team/architect/src/mcp-server.ts +122 -0
- package/template/workers/dev-team/architect/src/skills/api-design.ts +316 -0
- package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +264 -0
- package/template/workers/dev-team/architect/src/skills/system-design.ts +212 -0
- package/template/workers/dev-team/architect/tsconfig.json +19 -0
- package/template/workers/dev-team/architect/worker.yaml +128 -0
- package/template/workers/dev-team/backend-dev/package-lock.json +1252 -0
- package/template/workers/dev-team/backend-dev/package.json +27 -0
- package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +70 -0
- package/template/workers/dev-team/backend-dev/skills/implement-service.md +62 -0
- package/template/workers/dev-team/backend-dev/src/index.ts +51 -0
- package/template/workers/dev-team/backend-dev/src/mcp-server.ts +109 -0
- package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +122 -0
- package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +126 -0
- package/template/workers/dev-team/backend-dev/tsconfig.json +19 -0
- package/template/workers/dev-team/backend-dev/worker.yaml +128 -0
- package/template/workers/dev-team/code-reviewer/package-lock.json +1080 -0
- package/template/workers/dev-team/code-reviewer/package.json +24 -0
- package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +61 -0
- package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +54 -0
- package/template/workers/dev-team/code-reviewer/skills/request-changes.md +63 -0
- package/template/workers/dev-team/code-reviewer/skills/review-pr.md +77 -0
- package/template/workers/dev-team/code-reviewer/src/index.ts +56 -0
- package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +101 -0
- package/template/workers/dev-team/code-reviewer/tsconfig.json +19 -0
- package/template/workers/dev-team/code-reviewer/worker.yaml +90 -0
- package/template/workers/dev-team/database-dev/package.json +22 -0
- package/template/workers/dev-team/database-dev/skills/create-schema.md +48 -0
- package/template/workers/dev-team/database-dev/src/index.ts +50 -0
- package/template/workers/dev-team/database-dev/src/mcp-server.ts +76 -0
- package/template/workers/dev-team/database-dev/tsconfig.json +18 -0
- package/template/workers/dev-team/database-dev/worker.yaml +90 -0
- package/template/workers/dev-team/frontend-dev/package.json +22 -0
- package/template/workers/dev-team/frontend-dev/skills/create-component.md +26 -0
- package/template/workers/dev-team/frontend-dev/src/index.ts +50 -0
- package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +77 -0
- package/template/workers/dev-team/frontend-dev/tsconfig.json +18 -0
- package/template/workers/dev-team/frontend-dev/worker.yaml +132 -0
- package/template/workers/dev-team/infra-dev/package.json +24 -0
- package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +73 -0
- package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +80 -0
- package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +62 -0
- package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +63 -0
- package/template/workers/dev-team/infra-dev/src/index.ts +55 -0
- package/template/workers/dev-team/infra-dev/src/mcp-server.ts +82 -0
- package/template/workers/dev-team/infra-dev/tsconfig.json +19 -0
- package/template/workers/dev-team/infra-dev/worker.yaml +92 -0
- package/template/workers/dev-team/knowledge-curator/package.json +24 -0
- package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +63 -0
- package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +61 -0
- package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +76 -0
- package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +63 -0
- package/template/workers/dev-team/knowledge-curator/src/index.ts +53 -0
- package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +92 -0
- package/template/workers/dev-team/knowledge-curator/tsconfig.json +19 -0
- package/template/workers/dev-team/knowledge-curator/worker.yaml +80 -0
- package/template/workers/dev-team/motion-designer/package.json +22 -0
- package/template/workers/dev-team/motion-designer/skills/add-animation.md +25 -0
- package/template/workers/dev-team/motion-designer/skills/generate-image.md +36 -0
- package/template/workers/dev-team/motion-designer/src/index.ts +63 -0
- package/template/workers/dev-team/motion-designer/src/mcp-server.ts +79 -0
- package/template/workers/dev-team/motion-designer/tsconfig.json +18 -0
- package/template/workers/dev-team/motion-designer/worker.yaml +84 -0
- package/template/workers/dev-team/product-planner/queue.json +4 -0
- package/template/workers/dev-team/product-planner/worker.yaml +220 -0
- package/template/workers/dev-team/project-manager/package-lock.json +1252 -0
- package/template/workers/dev-team/project-manager/package.json +27 -0
- package/template/workers/dev-team/project-manager/skills/create-prd.md +66 -0
- package/template/workers/dev-team/project-manager/skills/next-issue.md +51 -0
- package/template/workers/dev-team/project-manager/skills/project-status.md +59 -0
- package/template/workers/dev-team/project-manager/skills/update-learnings.md +65 -0
- package/template/workers/dev-team/project-manager/src/index.ts +54 -0
- package/template/workers/dev-team/project-manager/src/mcp-server.ts +207 -0
- package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +86 -0
- package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +137 -0
- package/template/workers/dev-team/project-manager/src/skills/project-status.ts +131 -0
- package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +94 -0
- package/template/workers/dev-team/project-manager/tsconfig.json +19 -0
- package/template/workers/dev-team/project-manager/worker.yaml +96 -0
- package/template/workers/dev-team/qa-tester/package.json +24 -0
- package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +36 -0
- package/template/workers/dev-team/qa-tester/skills/run-tests.md +36 -0
- package/template/workers/dev-team/qa-tester/skills/write-test.md +27 -0
- package/template/workers/dev-team/qa-tester/src/index.ts +61 -0
- package/template/workers/dev-team/qa-tester/src/mcp-server.ts +88 -0
- package/template/workers/dev-team/qa-tester/tsconfig.json +18 -0
- package/template/workers/dev-team/qa-tester/worker.yaml +116 -0
- package/template/workers/dev-team/task-executor/package-lock.json +1252 -0
- package/template/workers/dev-team/task-executor/package.json +27 -0
- package/template/workers/dev-team/task-executor/skills/analyze-issue.md +101 -0
- package/template/workers/dev-team/task-executor/skills/execute.md +133 -0
- package/template/workers/dev-team/task-executor/skills/report-learnings.md +106 -0
- package/template/workers/dev-team/task-executor/skills/validate-completion.md +121 -0
- package/template/workers/dev-team/task-executor/src/index.ts +54 -0
- package/template/workers/dev-team/task-executor/src/mcp-server.ts +139 -0
- package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +219 -0
- package/template/workers/dev-team/task-executor/src/skills/execute.ts +132 -0
- package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +119 -0
- package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +142 -0
- package/template/workers/dev-team/task-executor/tsconfig.json +19 -0
- package/template/workers/dev-team/task-executor/worker.yaml +110 -0
- package/template/workers/registry.yaml +171 -0
- package/template/workers/security-scanner/README.md +73 -0
- package/template/workers/security-scanner/skills/pre-deploy-check.md +205 -0
- package/template/workers/security-scanner/worker.yaml +26 -0
- package/template/workspace/checkpoints/.gitkeep +0 -0
- package/template/workspace/content-ideas/inbox.jsonl +0 -0
- package/template/workspace/drafts/.gitkeep +0 -0
- package/template/workspace/learnings/.gitkeep +3 -0
- package/template/workspace/orchestrator/.gitkeep +0 -0
- package/template/workspace/ralph-test/COMPLETE.md +18 -0
- package/template/workspace/ralph-test/hello.txt +2 -0
- package/template/workspace/reports/.gitkeep +0 -0
- package/template/workspace/scratch/.gitkeep +0 -0
- package/template/workspace/threads/.gitkeep +3 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hq/code-reviewer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Code reviewer worker - PR review, merge management, code quality",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"code-reviewer": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"mcp": "node dist/mcp-server.js"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
18
|
+
"commander": "^12.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"typescript": "^5.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# merge-to-production
|
|
2
|
+
|
|
3
|
+
Merge staging to production branch.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
`$ARGUMENTS` = `--repo <path>` (required)
|
|
8
|
+
|
|
9
|
+
Optional:
|
|
10
|
+
- `--tag <version>` - Version tag to create
|
|
11
|
+
- `--skip-checks` - Skip pre-merge checks (NOT RECOMMENDED)
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. Verify staging is stable:
|
|
16
|
+
- All tests pass
|
|
17
|
+
- No pending hotfixes
|
|
18
|
+
- Staging environment healthy
|
|
19
|
+
2. Create release PR (staging → main/production)
|
|
20
|
+
3. Run final checks:
|
|
21
|
+
- Security scan
|
|
22
|
+
- Performance regression check
|
|
23
|
+
- Breaking change detection
|
|
24
|
+
4. Present to human for approval
|
|
25
|
+
5. Merge with merge commit (preserve history)
|
|
26
|
+
6. Create version tag (if specified)
|
|
27
|
+
7. Trigger production deploy (if configured)
|
|
28
|
+
|
|
29
|
+
## Pre-production Checklist
|
|
30
|
+
|
|
31
|
+
- [ ] Staging has been validated
|
|
32
|
+
- [ ] No breaking changes without migration
|
|
33
|
+
- [ ] Database migrations are backward compatible
|
|
34
|
+
- [ ] Feature flags configured correctly
|
|
35
|
+
- [ ] Rollback plan documented
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Create release PR
|
|
41
|
+
gh pr create --base main --head staging --title "Release v1.x.x"
|
|
42
|
+
|
|
43
|
+
# Merge to production
|
|
44
|
+
gh pr merge <number> --merge
|
|
45
|
+
|
|
46
|
+
# Create tag
|
|
47
|
+
git tag -a v1.x.x -m "Release v1.x.x"
|
|
48
|
+
git push origin v1.x.x
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Output
|
|
52
|
+
|
|
53
|
+
- Production merge confirmation
|
|
54
|
+
- Version tag (if created)
|
|
55
|
+
- Deploy trigger status
|
|
56
|
+
|
|
57
|
+
## Human Checkpoints
|
|
58
|
+
|
|
59
|
+
- **ALWAYS** require human approval before production merge
|
|
60
|
+
- Review breaking changes
|
|
61
|
+
- Confirm rollback plan exists
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# merge-to-staging
|
|
2
|
+
|
|
3
|
+
Merge approved PR to staging branch.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
`$ARGUMENTS` = `--pr <number>` (required)
|
|
8
|
+
|
|
9
|
+
Optional:
|
|
10
|
+
- `--repo <path>` - Target repository
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
1. Verify PR is approved
|
|
15
|
+
2. Verify all checks pass via `gh pr checks`
|
|
16
|
+
3. Detect branch strategy:
|
|
17
|
+
- Check for develop/staging branch
|
|
18
|
+
- Read CONTRIBUTING.md for conventions
|
|
19
|
+
4. Merge PR:
|
|
20
|
+
- `gh pr merge --squash` (default)
|
|
21
|
+
- Or `--merge` / `--rebase` per project convention
|
|
22
|
+
5. Verify merge succeeded
|
|
23
|
+
6. Report status
|
|
24
|
+
|
|
25
|
+
## Pre-merge Checklist
|
|
26
|
+
|
|
27
|
+
- [ ] PR is approved by required reviewers
|
|
28
|
+
- [ ] All CI checks pass
|
|
29
|
+
- [ ] No merge conflicts
|
|
30
|
+
- [ ] Branch is up to date with target
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Check PR status
|
|
36
|
+
gh pr view <number> --json state,reviews,statusCheckRollup
|
|
37
|
+
|
|
38
|
+
# Merge with squash
|
|
39
|
+
gh pr merge <number> --squash --delete-branch
|
|
40
|
+
|
|
41
|
+
# Merge with merge commit
|
|
42
|
+
gh pr merge <number> --merge --delete-branch
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Output
|
|
46
|
+
|
|
47
|
+
- Merge confirmation
|
|
48
|
+
- Commit SHA
|
|
49
|
+
- Branch cleanup status
|
|
50
|
+
|
|
51
|
+
## Human Checkpoints
|
|
52
|
+
|
|
53
|
+
- Confirm merge before execution
|
|
54
|
+
- Handle merge conflicts (escalate to human)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# request-changes
|
|
2
|
+
|
|
3
|
+
Request changes on a pull request with actionable feedback.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
`$ARGUMENTS` = `--pr <number>` (required)
|
|
8
|
+
|
|
9
|
+
Optional:
|
|
10
|
+
- `--repo <path>` - Target repository
|
|
11
|
+
- `--blocking` - Mark as blocking review
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. Fetch current review state
|
|
16
|
+
2. Formulate change requests:
|
|
17
|
+
- Specific, actionable items
|
|
18
|
+
- Reference line numbers
|
|
19
|
+
- Suggest concrete fixes
|
|
20
|
+
3. Categorize issues:
|
|
21
|
+
- Must fix (blocking)
|
|
22
|
+
- Should fix (non-blocking)
|
|
23
|
+
- Consider (optional)
|
|
24
|
+
4. Present to human for approval
|
|
25
|
+
5. Submit review via `gh pr review`
|
|
26
|
+
|
|
27
|
+
## Change Request Format
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
### Must Fix
|
|
31
|
+
- [ ] **Line 42**: SQL injection vulnerability - use parameterized query
|
|
32
|
+
- [ ] **Line 87**: Missing null check before accessing `.length`
|
|
33
|
+
|
|
34
|
+
### Should Fix
|
|
35
|
+
- [ ] **Line 23**: Consider extracting to helper function for reuse
|
|
36
|
+
- [ ] **Line 56**: Magic number - extract to named constant
|
|
37
|
+
|
|
38
|
+
### Consider
|
|
39
|
+
- [ ] **Line 12**: Could use optional chaining for cleaner code
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Submit review requesting changes
|
|
46
|
+
gh pr review <number> --request-changes --body "Review comments..."
|
|
47
|
+
|
|
48
|
+
# Add line comment
|
|
49
|
+
gh pr comment <number> --body "Comment text"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Best Practices
|
|
53
|
+
|
|
54
|
+
- Be specific, not vague
|
|
55
|
+
- Explain why, not just what
|
|
56
|
+
- Offer solutions, not just problems
|
|
57
|
+
- Be respectful and constructive
|
|
58
|
+
- Acknowledge good work too
|
|
59
|
+
|
|
60
|
+
## Human Checkpoints
|
|
61
|
+
|
|
62
|
+
- Approve review content before submission
|
|
63
|
+
- Confirm blocking vs non-blocking classification
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# review-pr
|
|
2
|
+
|
|
3
|
+
Review a pull request for code quality, correctness, and best practices.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
`$ARGUMENTS` = `--pr <number>` (required)
|
|
8
|
+
|
|
9
|
+
Optional:
|
|
10
|
+
- `--repo <path>` - Target repository
|
|
11
|
+
- `--focus <area>` - Focus area: security|performance|style|all
|
|
12
|
+
- `--strict` - Enable strict review mode
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
1. Fetch PR details via `gh pr view`
|
|
17
|
+
2. Get diff via `gh pr diff`
|
|
18
|
+
3. Analyze changes:
|
|
19
|
+
- Code correctness
|
|
20
|
+
- Security vulnerabilities
|
|
21
|
+
- Performance implications
|
|
22
|
+
- Style consistency
|
|
23
|
+
- Test coverage
|
|
24
|
+
4. Check against project standards:
|
|
25
|
+
- CONTRIBUTING.md
|
|
26
|
+
- Existing patterns in codebase
|
|
27
|
+
5. Generate review comments
|
|
28
|
+
6. Present findings to human for approval
|
|
29
|
+
7. Submit review via `gh pr review`
|
|
30
|
+
|
|
31
|
+
## Review Checklist
|
|
32
|
+
|
|
33
|
+
### Code Quality
|
|
34
|
+
- [ ] Logic is correct and handles edge cases
|
|
35
|
+
- [ ] No obvious bugs or regressions
|
|
36
|
+
- [ ] Code is readable and maintainable
|
|
37
|
+
- [ ] Functions/methods are appropriately sized
|
|
38
|
+
|
|
39
|
+
### Security
|
|
40
|
+
- [ ] No hardcoded secrets
|
|
41
|
+
- [ ] Input validation present
|
|
42
|
+
- [ ] No SQL injection / XSS vulnerabilities
|
|
43
|
+
- [ ] Auth/authz properly implemented
|
|
44
|
+
|
|
45
|
+
### Performance
|
|
46
|
+
- [ ] No N+1 queries
|
|
47
|
+
- [ ] Appropriate caching
|
|
48
|
+
- [ ] No memory leaks
|
|
49
|
+
- [ ] Efficient algorithms
|
|
50
|
+
|
|
51
|
+
### Testing
|
|
52
|
+
- [ ] Tests cover new functionality
|
|
53
|
+
- [ ] Edge cases tested
|
|
54
|
+
- [ ] Tests are meaningful (not just coverage)
|
|
55
|
+
|
|
56
|
+
### E2E Tests (if applicable)
|
|
57
|
+
- [ ] Pages modified in the PR have corresponding E2E spec updates
|
|
58
|
+
- [ ] Test manifest is fresh (no diff after regeneration)
|
|
59
|
+
- [ ] Coverage check passes (all app routes covered)
|
|
60
|
+
- [ ] New pages include at minimum a page-load spec with 200 status + title checks
|
|
61
|
+
|
|
62
|
+
If any E2E check fails, request changes with instructions to run:
|
|
63
|
+
```bash
|
|
64
|
+
npm run generate-manifest # regenerate manifest
|
|
65
|
+
npm run check-coverage # verify coverage
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Output
|
|
69
|
+
|
|
70
|
+
- Review summary
|
|
71
|
+
- Line-by-line comments (via gh)
|
|
72
|
+
- Approval / request changes / comment
|
|
73
|
+
|
|
74
|
+
## Human Checkpoints
|
|
75
|
+
|
|
76
|
+
- Approve review before submission
|
|
77
|
+
- Confirm severity of issues found
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
|
|
4
|
+
const program = new Command();
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.name('code-reviewer')
|
|
8
|
+
.description('PR review, merge management, and code quality gating')
|
|
9
|
+
.version('1.0.0');
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.command('review-pr')
|
|
13
|
+
.description('Review a pull request')
|
|
14
|
+
.requiredOption('--pr <number>', 'PR number')
|
|
15
|
+
.option('--repo <path>', 'Target repository')
|
|
16
|
+
.option('--focus <area>', 'Focus: security|performance|style|all')
|
|
17
|
+
.option('--strict', 'Enable strict review mode')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
console.log('review-pr:', options);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
program
|
|
23
|
+
.command('merge-to-staging')
|
|
24
|
+
.description('Merge approved PR to staging')
|
|
25
|
+
.requiredOption('--pr <number>', 'PR number')
|
|
26
|
+
.option('--repo <path>', 'Target repository')
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
console.log('merge-to-staging:', options);
|
|
29
|
+
console.log('\n[Human approval required]');
|
|
30
|
+
console.log('Confirm merge to staging? [y/n]');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
program
|
|
34
|
+
.command('merge-to-production')
|
|
35
|
+
.description('Merge staging to production')
|
|
36
|
+
.requiredOption('--repo <path>', 'Target repository')
|
|
37
|
+
.option('--tag <version>', 'Version tag to create')
|
|
38
|
+
.option('--skip-checks', 'Skip pre-merge checks')
|
|
39
|
+
.action(async (options) => {
|
|
40
|
+
console.log('merge-to-production:', options);
|
|
41
|
+
console.log('\n[HUMAN APPROVAL REQUIRED]');
|
|
42
|
+
console.log('This will deploy to PRODUCTION.');
|
|
43
|
+
console.log('Confirm merge to production? [y/n]');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.command('request-changes')
|
|
48
|
+
.description('Request changes on a PR')
|
|
49
|
+
.requiredOption('--pr <number>', 'PR number')
|
|
50
|
+
.option('--repo <path>', 'Target repository')
|
|
51
|
+
.option('--blocking', 'Mark as blocking review')
|
|
52
|
+
.action(async (options) => {
|
|
53
|
+
console.log('request-changes:', options);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
program.parse();
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
|
|
6
|
+
const server = new Server(
|
|
7
|
+
{ name: 'code-reviewer', version: '1.0.0' },
|
|
8
|
+
{ capabilities: { tools: {} } }
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
12
|
+
tools: [
|
|
13
|
+
{
|
|
14
|
+
name: 'review_pr',
|
|
15
|
+
description: 'Review a pull request for code quality and correctness',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
pr: { type: 'number', description: 'PR number' },
|
|
20
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
21
|
+
focus: { type: 'string', enum: ['security', 'performance', 'style', 'all'], description: 'Review focus area' },
|
|
22
|
+
strict: { type: 'boolean', description: 'Enable strict review mode' },
|
|
23
|
+
},
|
|
24
|
+
required: ['pr'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'merge_to_staging',
|
|
29
|
+
description: 'Merge approved PR to staging branch',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
pr: { type: 'number', description: 'PR number' },
|
|
34
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
35
|
+
},
|
|
36
|
+
required: ['pr'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'merge_to_production',
|
|
41
|
+
description: 'Merge staging to production (requires human approval)',
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
46
|
+
tag: { type: 'string', description: 'Version tag to create' },
|
|
47
|
+
},
|
|
48
|
+
required: ['repo'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'request_changes',
|
|
53
|
+
description: 'Request changes on a pull request',
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
pr: { type: 'number', description: 'PR number' },
|
|
58
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
59
|
+
blocking: { type: 'boolean', description: 'Mark as blocking review' },
|
|
60
|
+
},
|
|
61
|
+
required: ['pr'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'get_pr_diff',
|
|
66
|
+
description: 'Get the diff for a pull request',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
pr: { type: 'number', description: 'PR number' },
|
|
71
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
72
|
+
},
|
|
73
|
+
required: ['pr'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'list_pr_comments',
|
|
78
|
+
description: 'List comments on a pull request',
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
pr: { type: 'number', description: 'PR number' },
|
|
83
|
+
repo: { type: 'string', description: 'Target repository path' },
|
|
84
|
+
},
|
|
85
|
+
required: ['pr'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
92
|
+
const { name, arguments: args } = request.params;
|
|
93
|
+
return { content: [{ type: 'text', text: `Tool ${name} called with: ${JSON.stringify(args)}` }] };
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
async function main() {
|
|
97
|
+
const transport = new StdioServerTransport();
|
|
98
|
+
await server.connect(transport);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
worker:
|
|
2
|
+
id: code-reviewer
|
|
3
|
+
name: "Code Reviewer"
|
|
4
|
+
description: "PR review, merge management, and code quality gating"
|
|
5
|
+
type: CodeWorker
|
|
6
|
+
version: "1.0"
|
|
7
|
+
team: dev-team
|
|
8
|
+
|
|
9
|
+
execution:
|
|
10
|
+
mode: on_demand
|
|
11
|
+
max_runtime: 15m
|
|
12
|
+
retry_attempts: 1
|
|
13
|
+
spawn_method: task_tool
|
|
14
|
+
|
|
15
|
+
context:
|
|
16
|
+
base:
|
|
17
|
+
- workers/public/dev-team/code-reviewer/skills/
|
|
18
|
+
- knowledge/public/dev-team/patterns/
|
|
19
|
+
- knowledge/public/dev-team/workflows/code-review.md
|
|
20
|
+
dynamic:
|
|
21
|
+
- pattern: "{target_repo}/src/"
|
|
22
|
+
when: always
|
|
23
|
+
- pattern: "{target_repo}/.github/CODEOWNERS"
|
|
24
|
+
when: always
|
|
25
|
+
- pattern: "{target_repo}/CONTRIBUTING.md"
|
|
26
|
+
when: always
|
|
27
|
+
- pattern: "{target_repo}/package.json"
|
|
28
|
+
when: always
|
|
29
|
+
exclude:
|
|
30
|
+
- node_modules/
|
|
31
|
+
- dist/
|
|
32
|
+
- "*.log"
|
|
33
|
+
- "*.lock"
|
|
34
|
+
|
|
35
|
+
skills:
|
|
36
|
+
- id: review-pr
|
|
37
|
+
file: skills/review-pr.md
|
|
38
|
+
- id: merge-to-staging
|
|
39
|
+
file: skills/merge-to-staging.md
|
|
40
|
+
- id: merge-to-production
|
|
41
|
+
file: skills/merge-to-production.md
|
|
42
|
+
- id: request-changes
|
|
43
|
+
file: skills/request-changes.md
|
|
44
|
+
|
|
45
|
+
verification:
|
|
46
|
+
post_execute:
|
|
47
|
+
- check: pr_checks_passed
|
|
48
|
+
command: gh pr checks {pr_number}
|
|
49
|
+
approval_required: true
|
|
50
|
+
human_checkpoints:
|
|
51
|
+
- before_merge_staging
|
|
52
|
+
- before_merge_production
|
|
53
|
+
- on_breaking_changes
|
|
54
|
+
|
|
55
|
+
external_skills:
|
|
56
|
+
- vercel/code-review-excellence
|
|
57
|
+
- vercel/systematic-debugging
|
|
58
|
+
|
|
59
|
+
mcp:
|
|
60
|
+
server:
|
|
61
|
+
command: node
|
|
62
|
+
args: [dist/mcp-server.js]
|
|
63
|
+
tools:
|
|
64
|
+
- review_pr
|
|
65
|
+
- merge_to_staging
|
|
66
|
+
- merge_to_production
|
|
67
|
+
- request_changes
|
|
68
|
+
- get_pr_diff
|
|
69
|
+
- list_pr_comments
|
|
70
|
+
|
|
71
|
+
# State Machine (Loom pattern)
|
|
72
|
+
state_machine:
|
|
73
|
+
enabled: true
|
|
74
|
+
max_retries: 1
|
|
75
|
+
hooks:
|
|
76
|
+
post_execute:
|
|
77
|
+
- auto_checkpoint
|
|
78
|
+
- log_metrics
|
|
79
|
+
on_error:
|
|
80
|
+
- log_error
|
|
81
|
+
- checkpoint_error_state
|
|
82
|
+
|
|
83
|
+
reporting:
|
|
84
|
+
on_complete:
|
|
85
|
+
- log_review
|
|
86
|
+
- extract_learnings
|
|
87
|
+
metrics:
|
|
88
|
+
- review_time
|
|
89
|
+
- issues_found
|
|
90
|
+
- merge_success_rate
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hq/database-dev",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Schema design, migrations, and query optimization",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": { "database-dev": "dist/index.js" },
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"dev": "ts-node src/index.ts",
|
|
11
|
+
"mcp": "node dist/mcp-server.js"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
15
|
+
"commander": "^12.1.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.10.0",
|
|
19
|
+
"typescript": "^5.7.2",
|
|
20
|
+
"ts-node": "^10.9.2"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# create-schema
|
|
2
|
+
|
|
3
|
+
Design database schema for a feature.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
`$ARGUMENTS` = `--entity <name>` or `--feature <description>` (required)
|
|
8
|
+
|
|
9
|
+
Optional:
|
|
10
|
+
- `--repo <path>` - Target repository
|
|
11
|
+
- `--orm <prisma|drizzle>` - ORM to use
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. Analyze existing schema
|
|
16
|
+
2. Design new tables/models
|
|
17
|
+
3. Define relationships
|
|
18
|
+
4. Add indexes for common queries
|
|
19
|
+
5. Present for approval
|
|
20
|
+
|
|
21
|
+
## Output
|
|
22
|
+
|
|
23
|
+
- Schema definition (Prisma/Drizzle)
|
|
24
|
+
- Relationship diagram (Mermaid)
|
|
25
|
+
- Migration file
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
node dist/index.js create-schema --entity "Comment" --repo repos/my-app
|
|
31
|
+
|
|
32
|
+
# Output:
|
|
33
|
+
# === Schema Design: Comment ===
|
|
34
|
+
#
|
|
35
|
+
# model Comment {
|
|
36
|
+
# id String @id @default(cuid())
|
|
37
|
+
# content String
|
|
38
|
+
# authorId String
|
|
39
|
+
# postId String
|
|
40
|
+
# author User @relation(fields: [authorId], references: [id])
|
|
41
|
+
# post Post @relation(fields: [postId], references: [id])
|
|
42
|
+
# createdAt DateTime @default(now())
|
|
43
|
+
# }
|
|
44
|
+
#
|
|
45
|
+
# Indexes: authorId, postId, createdAt
|
|
46
|
+
#
|
|
47
|
+
# [Approve? y/n/modify]
|
|
48
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
|
|
4
|
+
const program = new Command();
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.name('database-dev')
|
|
8
|
+
.description('Schema design, migrations, and query optimization')
|
|
9
|
+
.version('1.0.0');
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.command('create-schema')
|
|
13
|
+
.description('Design database schema for feature')
|
|
14
|
+
.option('--entity <name>', 'Entity name')
|
|
15
|
+
.option('--feature <description>', 'Feature description')
|
|
16
|
+
.option('--repo <path>', 'Target repository')
|
|
17
|
+
.option('--orm <type>', 'ORM type: prisma|drizzle')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
console.log('create-schema:', options);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
program
|
|
23
|
+
.command('create-migration')
|
|
24
|
+
.description('Create database migration')
|
|
25
|
+
.requiredOption('--name <name>', 'Migration name')
|
|
26
|
+
.option('--repo <path>', 'Target repository')
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
console.log('create-migration:', options);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
program
|
|
32
|
+
.command('optimize-query')
|
|
33
|
+
.description('Optimize slow query')
|
|
34
|
+
.requiredOption('--query <sql>', 'Query to optimize')
|
|
35
|
+
.option('--repo <path>', 'Target repository')
|
|
36
|
+
.action(async (options) => {
|
|
37
|
+
console.log('optimize-query:', options);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
program
|
|
41
|
+
.command('add-indexes')
|
|
42
|
+
.description('Add database indexes')
|
|
43
|
+
.requiredOption('--table <name>', 'Table name')
|
|
44
|
+
.option('--columns <list>', 'Comma-separated columns')
|
|
45
|
+
.option('--repo <path>', 'Target repository')
|
|
46
|
+
.action(async (options) => {
|
|
47
|
+
console.log('add-indexes:', options);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
program.parse();
|