fix(please-plugins): setup command fails to find root package.json#130
fix(please-plugins): setup command fails to find root package.json#130
Conversation
Add bugfix track for setup command failing to find root package.json due to Glob result truncation by node_modules entries. Plan: delegate dependency scanning to check-dependencies.ts via --setup CLI mode. Refs: #129
Add scanForSetup() function that outputs structured JSON with detected plugins and their source packages/files, separated by install status. Update main() to handle --setup flag bypassing stdin hook protocol. Refs: #129
Replace ambiguous LLM prose instructions with direct script invocation of check-dependencies.ts --setup. Eliminates Glob truncation bug where node_modules entries buried the root package.json. Refs: #129
All 9 tasks completed. Tests pass (46/46). Manual verification confirms setup --setup mode correctly finds root package.json in project with node_modules/. Refs: #129
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug where the setup command failed to find the root package.json in projects with large node_modules directories. The fix involves delegating dependency scanning to a new --setup CLI mode in the check-dependencies.ts script, which uses direct path construction instead of ambiguous glob patterns. The setup.md command was rewritten to utilize this script and parse its JSON output. A review comment suggests refactoring scanForSetup to reduce logic duplication with existing detection functions and improve maintainability.
- Use ESM import for mkdirSync instead of require() in test - Remove redundant truthiness check on loadEnabledPlugins result Refs: #129
There was a problem hiding this comment.
No issues found across 8 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant User as End User
participant Claude as Claude Code (Runtime)
participant Script as check-dependencies.ts
participant FS as Local Filesystem
Note over Claude, FS: NEW: Script-Delegated Setup Flow
User->>Claude: /please-plugins:setup
Claude->>Script: NEW: bun run check-dependencies.ts --setup
activate Script
Script->>FS: CHANGED: Load root package.json (Direct Path)
FS-->>Script: JSON content
Script->>FS: Scan for tooling indicators (lockfiles, configs)
Note right of Script: Avoids Glob truncation bugs
Script->>FS: Read .claude/settings.json
FS-->>Script: Enabled plugins list
Script->>Script: NEW: Map dependencies to plugin-mappings.json
alt Scan Successful
Script-->>Claude: NEW: Return JSON {detected, installed}
else Scan Failed (e.g. no package.json)
Script-->>Claude: Exit code 1 + Error message
Claude->>User: Inform error and stop
end
deactivate Script
alt No matching plugins
Claude->>User: "No matching plugins found"
else Plugins found
Claude->>User: NEW: AskUserQuestion (Multi-select)
User-->>Claude: Selected plugins to install
loop for each selected plugin
Claude->>Claude: claude plugin install {pluginName}@pleaseai
end
Claude->>User: Final summary of installations
end
…ng detectPackages/detectTooling Extract resolvePackageSource and resolveToolingSource helpers to annotate detection results with source info, so scanForSetup can delegate all detection logic to the existing functions rather than duplicating it.
Summary
--setupCLI mode tocheck-dependencies.tswithscanForSetup()function that outputs structured JSONsetup.mdcommand to delegate dependency scanning to the script instead of ambiguous LLM prose instructionsnode_modules/entries buried rootpackage.jsonTest plan
scanForSetup)--setupcorrectly detects plugins in project withnode_modules//please-plugins:setupin a real projectCloses #129
Summary by cubic
Fixes the setup command not finding the root
package.jsonby delegating dependency scanning to a new--setupmode incheck-dependencies.ts. Also refactorsscanForSetup()to reuse detection helpers and annotate sources cleanly. Fixes #129.New Features
scanForSetup()and a--setupCLI mode incheck-dependencies.tsthat outputs JSON{ detected, installed }with source info.setup.mdnow invokesbun run "${CLAUDE_PLUGIN_ROOT}/hooks/check-dependencies.ts" --setupand parses the JSON for selection.Refactors
scanForSetup()now reusesdetectPackages()anddetectTooling()withresolvePackageSource()andresolveToolingSource()helpers to deduplicate and label sources.Written for commit 1f1573e. Summary will update on new commits.