Conversation
Consolidate duplicated detectLibc, getPackageSuffix, and findBinary functions from cli.ts and mcp.ts into a shared scripts/launcher/util.ts module. Each launcher is reduced from ~119 lines to ~17 lines. Also apply minor else-block style fix in scripts/bump-version.ts. Closes #111
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the launcher scripts by centralizing common utility functions into a new shared module. This significantly reduces code duplication in the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively refactors duplicated launcher logic into a new shared utility file, scripts/launcher/util.ts, which significantly improves code reuse and maintainability across the cli.ts and mcp.ts launchers. The changes are well-executed. I have a couple of suggestions for the new util.ts file to further enhance its readability and maintainability.
|
|
||
| // 2. Walk up directory tree from this file looking for node_modules/<package>/ | ||
| let dir = __dirname | ||
| for (let i = 0; i < 10; i++) { |
| throw new Error( | ||
| `Could not find the ${packageName} binary.\n` | ||
| + `Searched:\n${searchPaths.map(p => ` - ${p}`).join('\n')}\n\n` | ||
| + `Make sure @pleaseai/soop is installed — the optional platform package ` | ||
| + `should be installed automatically on supported platforms.\n` | ||
| + `If you used --no-optional, re-run without that flag.`, | ||
| ) |
There was a problem hiding this comment.
The construction of this multi-line error message using string concatenation can be simplified. Using an array of strings and join('\n') would be more readable and easier to maintain.
throw new Error(
[
`Could not find the ${packageName} binary.`,
'Searched:',
...searchPaths.map(p => ` - ${p}`),
'',
'Make sure @pleaseai/soop is installed — the optional platform package should be installed automatically on supported platforms.',
'If you used --no-optional, re-run without that flag.',
].join('\n'),
)
|


Summary
detectLibc,getPackageSuffix, andfindBinaryfunctions fromscripts/launcher/cli.tsandscripts/launcher/mcp.tsinto a new sharedscripts/launcher/util.tsmoduleutil.tsscripts/bump-version.tsChanges
scripts/launcher/util.ts— new shared utility withdetectLibc,getPackageSuffix,findBinaryscripts/launcher/cli.ts— simplified to delegate binary lookup tofindBinary('soop', import.meta.url)scripts/launcher/mcp.ts— simplified to delegate binary lookup tofindBinary('soop-mcp', import.meta.url)scripts/bump-version.ts— minor else-block formatting fixTest Plan
soopCLI binary resolves correctly on Linux (glibc and musl) and macOSsoop-mcpbinary resolves correctly on the same platformsCloses #111
Summary by cubic
Extracted shared launcher logic into scripts/launcher/util.ts to remove duplication and simplify the CLI and MCP launchers. Improves cross‑platform binary resolution and satisfies Linear #111.
Written for commit 8ec8eb9. Summary will update on new commits.