feat(cli): add init subcommand for project scaffolding#99
Open
izumin5210 wants to merge 3 commits intomainfrom
Open
feat(cli): add init subcommand for project scaffolding#99izumin5210 wants to merge 3 commits intomainfrom
izumin5210 wants to merge 3 commits intomainfrom
Conversation
Add `gqlkit init` command to initialize a new gqlkit project with: - Directory resolution with upward search for project root - Existing gqlkit configuration detection to skip redundant files - Initial file generation (context.ts, gqlkit.ts, schema.ts, .gitkeep) - Package.json dependency updates (@gqlkit-ts/runtime, @graphql-tools/schema) - Package manager detection (npm, yarn, pnpm) and auto-install - Integration with gqlkit gen command Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive gqlkit init command to initialize new gqlkit projects with automatic scaffolding. The implementation includes directory resolution, existing project detection, file generation, dependency management, and automatic package installation.
Changes:
- Adds
initsubcommand with orchestrator modules for project initialization - Implements smart detection of existing gqlkit setups to avoid redundant file generation
- Integrates with
gqlkit gencommand to generate initial schema files
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/init-orchestrator/subprocess-runner.ts | Utility for executing shell commands with stdio capture |
| packages/cli/src/init-orchestrator/subprocess-runner.test.ts | Test coverage for subprocess execution |
| packages/cli/src/init-orchestrator/package-manager-detector.ts | Auto-detects npm, yarn, or pnpm from package.json field or lockfiles |
| packages/cli/src/init-orchestrator/package-manager-detector.test.ts | Test coverage for package manager detection logic |
| packages/cli/src/init-orchestrator/package-json-updater.ts | Updates package.json with required dependencies |
| packages/cli/src/init-orchestrator/package-json-updater.test.ts | Test coverage for package.json modification |
| packages/cli/src/init-orchestrator/file-generator.ts | Generates initial project files (context.ts, gqlkit.ts, schema.ts) |
| packages/cli/src/init-orchestrator/file-generator.test.ts | Test coverage for file generation and skip logic |
| packages/cli/src/init-orchestrator/existing-project-detector.ts | Scans directories for existing createGqlkitApis usage |
| packages/cli/src/init-orchestrator/existing-project-detector.test.ts | Test coverage for existing project detection |
| packages/cli/src/init-orchestrator/directory-resolver.ts | Resolves project root by searching upward for package.json or config |
| packages/cli/src/init-orchestrator/directory-resolver.test.ts | Test coverage for directory resolution |
| packages/cli/src/init-orchestrator/index.ts | Exports all orchestrator module interfaces and functions |
| packages/cli/src/commands/init.ts | Main init command implementation coordinating all orchestrator modules |
| packages/cli/src/commands/init.test.ts | Integration tests for full init command flow |
| packages/cli/src/cli.ts | Registers init command with CLI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
Replace `pwd` with `node -e "console.log(process.cwd())"` to fix Windows CI failures. Git Bash's pwd returns Unix-style paths (/tmp/...) which don't match Node.js tmpdir() Windows paths (C:\Users\...). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Capture error details in subprocess-runner error handler - Remove redundant conditional for installArgs - Simplify sourceDir resolution logic in directory-resolver Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Code Metrics Report
Details | | main (a493e71) | #99 (d5aca1c) | +/- |
|---------------------|----------------|---------------|-------|
+ | Coverage | 85.7% | 85.8% | +0.0% |
| Files | 55 | 63 | +8 |
| Lines | 3416 | 3606 | +190 |
+ | Covered | 2930 | 3094 | +164 |
- | Test Execution Time | 4m36s | 4m40s | +4s |Code coverage of files in pull request scope (0.0% → 86.3%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gqlkit initcommand to initialize a new gqlkit projectcontext.ts,gqlkit.ts,schema.ts,schema/.gitkeeppackage.jsonwith required dependencies (@gqlkit-ts/runtime,@graphql-tools/schema)gqlkit gento generate initial schemaTest plan
🤖 Generated with Claude Code