Refactor: Extract agent detection and add workspace support - #1
Merged
Merged
Conversation
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
This PR significantly refactors the codebase to improve maintainability and add new features. The main changes include extracting package manager detection logic into a dedicated
agentsmodule, adding monorepo/workspace support, and introducing new CLI commands (nlxfor package execution andncifor clean installs).Key Changes
New
agents.tsmodule: Centralized package manager detection and command buildingpackageManagerfield in package.json (takes priority), then lockfilesgetCommand()to build commands for different operations (run, install, add, remove, execute, frozen)--separator for passing flags to scriptsNew
workspaces.tsmodule: Monorepo/workspace supportEnhanced
nrcommand:-w/--workspaceflag to select and run scripts in workspace packages-flag to rerun the last script of the current projectNew
nlxcommand: Execute packages without installing (npx/pnpm dlx/bunx/upx)New
ncicommand: Clean install for CI environments (npm ci/pnpm install --frozen-lockfile/etc)Simplified
niandnucommands: Now use centralized agent detection and command buildingUpdated dependencies: Switched from
unpromptsto@clack/promptsfor better UXImproved storage: Changed from single
lastRunCommandtolastRunCommandskeyed by project directoryAdded comprehensive tests: Test coverage for agent detection, command building, and workspace resolution
Notable Implementation Details
packageManagerfield over lockfiles for explicit configurationhttps://claude.ai/code/session_01VYGczmXF4CDqqMFj25NM5e