fix(onboard): add Windows PowerShell alternatives for shell commands#638
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughReplaces the onboarding preflight check's status-based validation with a CLI version check and removes "initialized" prerequisites. Adds Windows PowerShell alternatives for platform-specific shell commands across onboarding templates and documents the fix in a changeset. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review CompleteYour review story is ready! Comment !reviewfast on this PR to re-generate the story. |
16bdf21 to
11dbd5c
Compare
Greptile OverviewGreptile SummaryImproved cross-platform compatibility of the onboarding skill by removing the non-portable Key Changes:
Impact:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant OnboardSkill as Onboard Skill
participant CLI as OpenSpec CLI
participant Shell as Shell (Unix/Windows)
User->>OnboardSkill: Start /opsx:onboard
Note over OnboardSkill: Preflight Check Phase
OnboardSkill->>Shell: Execute: openspec --version
alt Unix/macOS
Shell->>CLI: Run command with 2>&1 || echo
else Windows PowerShell
Shell->>CLI: Run command with LASTEXITCODE check
end
alt CLI Installed
CLI-->>OnboardSkill: Version info returned
OnboardSkill->>User: Continue with onboarding
else CLI Not Installed
CLI-->>OnboardSkill: Error
OnboardSkill->>User: Show "CLI_NOT_INSTALLED" message
OnboardSkill->>OnboardSkill: Stop execution
end
Note over OnboardSkill: Task Selection Phase
OnboardSkill->>Shell: Execute: git log --oneline -10
alt Unix/macOS
Shell->>Shell: Redirect stderr to 2>/dev/null
else Windows PowerShell
Shell->>Shell: Redirect stderr to 2>$null
end
Shell-->>OnboardSkill: Git history or error message
Note over OnboardSkill: Spec Creation Phase
OnboardSkill->>Shell: Create directory
alt Unix/macOS
Shell->>Shell: mkdir -p openspec/changes/.../specs/...
else Windows PowerShell
Shell->>Shell: New-Item -ItemType Directory -Force
end
Shell-->>OnboardSkill: Directory created
OnboardSkill->>User: Continue with spec creation
|
| # Unix/macOS | ||
| mkdir -p openspec/changes/<name>/specs/<capability-name> | ||
| # Windows (PowerShell) | ||
| # New-Item -ItemType Directory -Force -Path "openspec\\changes\\<name>\\specs\\<capability-name>" |
There was a problem hiding this comment.
PowerShell accepts forward slashes in paths, consider using / instead of \ for consistency with the Unix command above
| # New-Item -ItemType Directory -Force -Path "openspec\\changes\\<name>\\specs\\<capability-name>" | |
| # New-Item -ItemType Directory -Force -Path "openspec/changes/<name>/specs/<capability-name>" |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/core/templates/skill-templates.ts
Line: 1196:1196
Comment:
PowerShell accepts forward slashes in paths, consider using `/` instead of `\` for consistency with the Unix command above
```suggestion
# New-Item -ItemType Directory -Force -Path "openspec/changes/<name>/specs/<capability-name>"
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/core/templates/skill-templates.ts`:
- Around line 940-947: Replace the commented PowerShell check that relies on
$LASTEXITCODE with a Get-Command based existence check: use Get-Command -Name
"openspec" -ErrorAction SilentlyContinue to detect whether the openspec command
is available, and only run openspec --version if Get-Command returns truthy;
otherwise output "CLI_NOT_INSTALLED". Update the commented guidance in
src/core/templates/skill-templates.ts (the PowerShell guidance surrounding the
"openspec --version" snippet) to use this pattern so missing-command detection
is robust across PowerShell sessions.
11dbd5c to
64e50d1
Compare
…ility
The onboarding preflight used `openspec status --json` to detect if a
project was initialized, but that command requires an existing change
to succeed. After a fresh `openspec init` (no changes yet), it always
failed — causing the onboarding to incorrectly tell users to run init
again.
Replace with `openspec --version` to verify the CLI is installed.
Also add Windows PowerShell alternatives for all platform-specific
shell commands in the onboarding skill:
- `2>&1 ||` → `; if ($LASTEXITCODE -ne 0) {}`
- `2>/dev/null` → `2>$null`
- `mkdir -p` → `New-Item -ItemType Directory -Force`
64e50d1 to
a5dd4aa
Compare
Use Get-Command for robust CLI detection instead of $LASTEXITCODE (which stays stale when a command isn't found), and use forward slashes in PowerShell paths for consistency with Unix commands.
…ission-AI#638) * fix(onboard): replace broken preflight check and add Windows compatibility The onboarding preflight used `openspec status --json` to detect if a project was initialized, but that command requires an existing change to succeed. After a fresh `openspec init` (no changes yet), it always failed — causing the onboarding to incorrectly tell users to run init again. Replace with `openspec --version` to verify the CLI is installed. Also add Windows PowerShell alternatives for all platform-specific shell commands in the onboarding skill: - `2>&1 ||` → `; if ($LASTEXITCODE -ne 0) {}` - `2>/dev/null` → `2>$null` - `mkdir -p` → `New-Item -ItemType Directory -Force` * fix(onboard): address PR review feedback for PowerShell commands Use Get-Command for robust CLI detection instead of $LASTEXITCODE (which stays stale when a command isn't found), and use forward slashes in PowerShell paths for consistency with Unix commands.
…ission-AI#638) * fix(onboard): replace broken preflight check and add Windows compatibility The onboarding preflight used `openspec status --json` to detect if a project was initialized, but that command requires an existing change to succeed. After a fresh `openspec init` (no changes yet), it always failed — causing the onboarding to incorrectly tell users to run init again. Replace with `openspec --version` to verify the CLI is installed. Also add Windows PowerShell alternatives for all platform-specific shell commands in the onboarding skill: - `2>&1 ||` → `; if ($LASTEXITCODE -ne 0) {}` - `2>/dev/null` → `2>$null` - `mkdir -p` → `New-Item -ItemType Directory -Force` * fix(onboard): address PR review feedback for PowerShell commands Use Get-Command for robust CLI detection instead of $LASTEXITCODE (which stays stale when a command isn't found), and use forward slashes in PowerShell paths for consistency with Unix commands.
Summary
test -f openspec/config.yamlcheck (not cross-platform) added in fix(onboard): replace broken preflight check with direct config file test #637, keeping justopenspec --version2>&1 ||→; if ($LASTEXITCODE -ne 0) {}2>/dev/null→2>$nullmkdir -p→New-Item -ItemType Directory -ForceTest plan
openspec initon a fresh project to regenerate skill files and confirm template output matches🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.