Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new interactive installation wizard ( Changes
Sequence DiagramsequenceDiagram
participant User
participant CLI as run.js
participant Wizard as install-wizard.js
participant NPM as npm/npx
participant Binary as lark-cli
participant Skills as Skills System
participant Config as Config System
participant Auth as Auth System
User->>CLI: run `lark-cli install` (or other cmd)
CLI->>CLI: parse args
alt args == "install"
CLI->>Wizard: load & execute install-wizard.js
Wizard->>NPM: check for global `lark-cli` (which / --version)
alt not found
Wizard->>NPM: `npm install -g `@larksuite/cli``
NPM-->>Wizard: install result
else found
NPM-->>Wizard: version info
end
Wizard->>NPM: `npx skills ls -g --json`
alt no lark-* skills
Wizard->>NPM: `npx skills add https://github.com/larksuite/cli -y -g`
NPM-->>Wizard: install result
else skills present
NPM-->>Wizard: skills list
end
Wizard->>Binary: `lark-cli config show`
alt appId exists
Binary-->>Wizard: appId
Wizard->>User: prompt reuse or reinit
else no config
Wizard->>Binary: `lark-cli config init --new`
Binary-->>Wizard: init result
end
Wizard->>User: prompt for auth
alt consent
Wizard->>Binary: `lark-cli auth login`
Binary->>Auth: auth flow
Auth-->>Binary: result
Binary-->>Wizard: result
else decline
Wizard-->>User: skip auth
end
Wizard->>User: completion guidance
else
CLI->>CLI: detect native binary
alt binary missing
CLI->>NPM: exec scripts/install.js with LARK_CLI_RUN to auto-install
NPM-->>CLI: install result
CLI->>Binary: execFileSync(bin, args)
else binary present
CLI->>Binary: execFileSync(bin, args)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 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 |
Greptile SummaryThis PR adds an interactive 4-step setup wizard ( Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant npx
participant run.js
participant install-wizard.js
participant npm
participant lark-cli
User->>npx: "npx @larksuite/cli install"
npx->>run.js: "spawn (postinstall skipped via npm_command=exec)"
run.js->>run.js: "args[0] === "install""
run.js->>install-wizard.js: require()
install-wizard.js->>install-wizard.js: [1/4] whichLarkCli()
alt not installed
install-wizard.js->>npm: "npm install -g @larksuite/cli"
npm-->>install-wizard.js: postinstall → binary downloaded
end
install-wizard.js->>install-wizard.js: [2/4] skillsAlreadyInstalled()
alt skills missing
install-wizard.js->>npx: npx skills add SKILLS_REPO -y -g
npx-->>install-wizard.js: skills installed
end
install-wizard.js->>lark-cli: [3/4] config show (check existing app)
alt no existing config
install-wizard.js->>lark-cli: lark-cli config init --new
end
install-wizard.js->>User: [4/4] Prompt: allow AI data access?
alt User says Y
install-wizard.js->>lark-cli: lark-cli auth login
end
install-wizard.js-->>User: ✅ You're all set!
Reviews (5): Last reviewed commit: "feat: 一键安装并配置" | Re-trigger Greptile |
7078825 to
f05de96
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/install-wizard.js`:
- Around line 32-35: The confirm() function currently treats every input except
exact "n" as consent; update it so empty answer returns true (default yes), but
otherwise normalize the response (trim + toLowerCase) and only return true for
accepted affirmative tokens like "y" or "yes", and return false for "n" or "no"
(and any other non-affirmative). Modify the async function confirm(question)
that calls ask(...) to perform this normalization and explicit checks rather
than the current answer === "" || answer.toLowerCase() !== "n" expression.
- Around line 87-99: The global installer in stepInstallGlobally currently runs
run("npm", ["install", "-g", PKG]) which allows npm to pick the latest dist-tag;
change it to install the exact version by using the PKG@VERSION token (use
`${PKG}@${VERSION}`) so the global install matches the wizard's VERSION, and
before early-return after whichLarkCli()/getLarkCliVersion() compare the found
ver to VERSION and only skip installation if they match (otherwise proceed to
reinstall/update).
- Around line 37-45: The run/runSilent helpers currently call execFileSync(cmd,
...) directly which fails on Windows when cmd points to a .cmd shim; update run
and runSilent to detect Windows (process.platform === "win32") and when the
command path ends with ".cmd" or ".bat" wrap the call through cmd.exe by
invoking execFileSync("cmd.exe", ["/c", cmd, ...args], ...) so .cmd shims
execute correctly; keep existing stdio behavior and preserve opts; ensure both
run and runSilent use the same wrapper so calls originating from whichLarkCli()
(the resolved lark-cli path) work on Windows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b19c0f46-0948-438d-9f0d-7719cea1f4ad
📒 Files selected for processing (5)
cmd/auth/login_interactive.gopackage.jsonscripts/install-wizard.jsscripts/install.jsscripts/run.js
💤 Files with no reviewable changes (1)
- cmd/auth/login_interactive.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@823df70fa6a8a0a6e1a0e16dcfd17e3a8e758899🧩 Skill updatenpx skills add larksuite/cli#feature/easy-setup -y -g |
There was a problem hiding this comment.
♻️ Duplicate comments (3)
scripts/install-wizard.js (3)
32-35:⚠️ Potential issue | 🟠 MajorFix
confirm()so non-affirmative input is not treated as consent.At Line 34, anything except exact
"n"becomestrue, so"no"and typos are accepted as yes.Proposed fix
async function confirm(question) { - const answer = await ask(`${question} (Y/n) `); - return answer === "" || answer.toLowerCase() !== "n"; + const answer = (await ask(`${question} (Y/n) `)).trim().toLowerCase(); + if (answer === "" || answer === "y" || answer === "yes") return true; + if (answer === "n" || answer === "no") return false; + console.log(" Please answer y/yes or n/no."); + return confirm(question); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 32 - 35, The confirm() helper currently treats any input other than exact "n" as consent; update it so consent is returned only for explicit affirmative responses: capture the answer from ask(), normalize it (trim and toLowerCase()), and return true only if the answer is empty or matches an affirmative token such as "y" or "yes" (and false otherwise); modify the confirm function's condition to use the normalized answer and check for these affirmative values (reference function name: confirm and the ask call).
87-99:⚠️ Potential issue | 🟠 MajorInstall the same package version as the running wizard and only skip on version match.
At Line 98, unpinned
npm install -g@larksuite/cli`` can install a different dist-tag version than the currently executed wizard.Proposed fix
async function stepInstallGlobally() { console.log("\n[1/4] Installing %s globally...", PKG); const existing = whichLarkCli(); if (existing) { const ver = getLarkCliVersion(existing); - console.log(" Already installed (v%s). Skipped.", ver || "unknown"); - return; + if (ver === VERSION) { + console.log(" Already installed (v%s). Skipped.", ver || "unknown"); + return; + } + console.log(" Found v%s; reinstalling v%s...", ver || "unknown", VERSION); } try { - run("npm", ["install", "-g", PKG]); + run("npm", ["install", "-g", `${PKG}@${VERSION}`]); console.log(" Done.");When running `npm install -g `@larksuite/cli`` without a version, does npm resolve the current dist-tag (e.g., latest) rather than the version used by `npx `@larksuite/cli`@<version>`?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 87 - 99, The global installer currently runs an unpinned npm install which may install a different dist-tag than the version of the running wizard; in stepInstallGlobally(), fetch the running wizard's exact package version (e.g., from package.json or process.env.npm_package_version) and use it to pin the global install (install PKG@<version> instead of PKG), and change the skip logic that uses whichLarkCli()/getLarkCliVersion() so it only returns early when the installed ver strictly equals the running wizard version; update the call to run("npm", ["install", "-g", ...]) to include PKG + "@" + currentVersion and keep using whichLarkCli, getLarkCliVersion, and run to locate and install.
37-45:⚠️ Potential issue | 🔴 CriticalHandle Windows
.cmd/.batexecution inrun()andrunSilent().
whichLarkCli()can resolve to a.cmdshim on Windows, and directexecFileSync(cmd, ...)can fail for those commands.Proposed fix
function run(cmd, args, opts = {}) { + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: "inherit", + ...opts, + }); + return; + } execFileSync(cmd, args, { stdio: "inherit", ...opts }); } function runSilent(cmd, args, opts = {}) { + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + return execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: ["ignore", "pipe", "pipe"], + ...opts, + }); + } return execFileSync(cmd, args, { stdio: ["ignore", "pipe", "pipe"], ...opts, }); }#!/bin/bash # Verify current implementation and impacted call chain. cat -n scripts/install-wizard.js | sed -n '37,55p;48,70p;168,206p' # Verify Node docs mention execFile + .cmd/.bat behavior on Windows. curl -s https://nodejs.org/api/child_process.html | rg -n "execFile|\\.bat|\\.cmd|Windows"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 37 - 45, The run() and runSilent() helpers must handle Windows .cmd/.bat shims; detect if process.platform === "win32" and the resolved command (from whichLarkCli() callers) endsWith ".cmd" or ".bat", and in that case invoke execFileSync against the Windows shell (cmd.exe) with arguments ['/c', cmd, ...args] rather than execFileSync(cmd, ...), preserving the same stdio options used by run and runSilent (inherit vs ["ignore","pipe","pipe"]) and forwarding opts; update both run and runSilent to perform this platform-specific branch so .cmd/.bat shims execute correctly on Windows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@scripts/install-wizard.js`:
- Around line 32-35: The confirm() helper currently treats any input other than
exact "n" as consent; update it so consent is returned only for explicit
affirmative responses: capture the answer from ask(), normalize it (trim and
toLowerCase()), and return true only if the answer is empty or matches an
affirmative token such as "y" or "yes" (and false otherwise); modify the confirm
function's condition to use the normalized answer and check for these
affirmative values (reference function name: confirm and the ask call).
- Around line 87-99: The global installer currently runs an unpinned npm install
which may install a different dist-tag than the version of the running wizard;
in stepInstallGlobally(), fetch the running wizard's exact package version
(e.g., from package.json or process.env.npm_package_version) and use it to pin
the global install (install PKG@<version> instead of PKG), and change the skip
logic that uses whichLarkCli()/getLarkCliVersion() so it only returns early when
the installed ver strictly equals the running wizard version; update the call to
run("npm", ["install", "-g", ...]) to include PKG + "@" + currentVersion and
keep using whichLarkCli, getLarkCliVersion, and run to locate and install.
- Around line 37-45: The run() and runSilent() helpers must handle Windows
.cmd/.bat shims; detect if process.platform === "win32" and the resolved command
(from whichLarkCli() callers) endsWith ".cmd" or ".bat", and in that case invoke
execFileSync against the Windows shell (cmd.exe) with arguments ['/c', cmd,
...args] rather than execFileSync(cmd, ...), preserving the same stdio options
used by run and runSilent (inherit vs ["ignore","pipe","pipe"]) and forwarding
opts; update both run and runSilent to perform this platform-specific branch so
.cmd/.bat shims execute correctly on Windows.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: af133049-85aa-4ccc-8c89-567cde21d636
📒 Files selected for processing (4)
package.jsonscripts/install-wizard.jsscripts/install.jsscripts/run.js
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (2)
- scripts/install.js
- scripts/run.js
f05de96 to
be8af5c
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (3)
scripts/install-wizard.js (3)
90-99:⚠️ Potential issue | 🟠 MajorPin global install version and only skip when versions match.
Line 93-Line 94 skips on any existing binary, and Line 98 installs unpinned
@larksuite/cli, which can drift from the wizard’sVERSION.Proposed fix
const existing = whichLarkCli(); if (existing) { const ver = getLarkCliVersion(existing); - console.log(" Already installed (v%s). Skipped.", ver || "unknown"); - return; + if (ver === VERSION) { + console.log(" Already installed (v%s). Skipped.", ver); + return; + } + console.log( + " Found version %s, upgrading to v%s...", + ver || "unknown", + VERSION + ); } try { - run("npm", ["install", "-g", PKG]); + run("npm", ["install", "-g", `${PKG}@${VERSION}`]); console.log(" Done."); } catch (_) { console.error( "\n Failed to install globally.\n" + - " Try running manually: npm install -g " + PKG + "\n" + " Try running manually: npm install -g " + `${PKG}@${VERSION}` + "\n" ); process.exit(1); }When running npm install -g `@scope/pkg` from code launched by npx `@scope/pkg`@<version>, does npm install that same version automatically, or resolve latest unless @<version> is specified?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 90 - 99, The script currently skips install if any existing binary is found and installs an unpinned PKG; change it to only skip when the detected version from getLarkCliVersion(existing) strictly equals the desired VERSION (do not skip if ver is falsy/unknown), and pin the global install by invoking run("npm", ["install", "-g", `${PKG}@${VERSION}`]) (or build a PKG_VERSION variable) instead of installing unpinned PKG; update references in whichLarkCli(), getLarkCliVersion(), and the run(...) call accordingly so the wizard only skips when versions match and always installs the explicit VERSION otherwise.
37-45:⚠️ Potential issue | 🔴 CriticalUse
cmd.exe /cfor.cmd/.batexecution on Windows.Line 38 and Line 42 call
execFileSyncdirectly; whenwhichLarkCli()returns a.cmdshim, these calls fail on Windows. This is the root cause for downstream failures in version/config/auth steps.Proposed fix
function run(cmd, args, opts = {}) { + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: "inherit", + ...opts, + }); + return; + } execFileSync(cmd, args, { stdio: "inherit", ...opts }); } function runSilent(cmd, args, opts = {}) { + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + return execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: ["ignore", "pipe", "pipe"], + ...opts, + }); + } return execFileSync(cmd, args, { stdio: ["ignore", "pipe", "pipe"], ...opts, }); }Does Node.js child_process.execFileSync support executing .cmd/.bat files directly on Windows without shell:true or cmd.exe /c?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 37 - 45, The run and runSilent helpers call execFileSync directly which fails when whichLarkCli() returns a .cmd/.bat shim on Windows; update both functions to detect Windows (process.platform === 'win32') and, when running a .cmd or .bat (or always on Windows), invoke the command via cmd.exe /c by passing 'cmd.exe' as the executable and ['/c', cmd, ...args] as the args (preserving the existing opts and stdio settings) so .cmd/.bat shims execute correctly on Windows.
32-35:⚠️ Potential issue | 🟠 MajorFix confirmation parsing:
nocurrently evaluates to consent.On Line 34, any value except exact
"n"returnstrue, so"no"and typos become opt-in.Proposed fix
async function confirm(question) { - const answer = await ask(`${question} (Y/n) `); - return answer === "" || answer.toLowerCase() !== "n"; + const answer = (await ask(`${question} (Y/n) `)).trim().toLowerCase(); + if (answer === "" || answer === "y" || answer === "yes") return true; + if (answer === "n" || answer === "no") return false; + return false; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 32 - 35, The confirm() function incorrectly treats any response except exact "n" as consent (so "no" becomes yes); update confirm to normalize the answer (trim and toLowerCase()) and return true only for explicit affirmative responses (e.g., empty string for default yes, "y", or "yes") rather than negating only "n". Locate the async function confirm and the ask() call and replace the current boolean expression with a check that accepts only the intended affirmative values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@scripts/install-wizard.js`:
- Around line 90-99: The script currently skips install if any existing binary
is found and installs an unpinned PKG; change it to only skip when the detected
version from getLarkCliVersion(existing) strictly equals the desired VERSION (do
not skip if ver is falsy/unknown), and pin the global install by invoking
run("npm", ["install", "-g", `${PKG}@${VERSION}`]) (or build a PKG_VERSION
variable) instead of installing unpinned PKG; update references in
whichLarkCli(), getLarkCliVersion(), and the run(...) call accordingly so the
wizard only skips when versions match and always installs the explicit VERSION
otherwise.
- Around line 37-45: The run and runSilent helpers call execFileSync directly
which fails when whichLarkCli() returns a .cmd/.bat shim on Windows; update both
functions to detect Windows (process.platform === 'win32') and, when running a
.cmd or .bat (or always on Windows), invoke the command via cmd.exe /c by
passing 'cmd.exe' as the executable and ['/c', cmd, ...args] as the args
(preserving the existing opts and stdio settings) so .cmd/.bat shims execute
correctly on Windows.
- Around line 32-35: The confirm() function incorrectly treats any response
except exact "n" as consent (so "no" becomes yes); update confirm to normalize
the answer (trim and toLowerCase()) and return true only for explicit
affirmative responses (e.g., empty string for default yes, "y", or "yes") rather
than negating only "n". Locate the async function confirm and the ask() call and
replace the current boolean expression with a check that accepts only the
intended affirmative values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 64541bda-f772-4623-a226-dd4dffe6a90a
📒 Files selected for processing (4)
package.jsonscripts/install-wizard.jsscripts/install.jsscripts/run.js
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/run.js
be8af5c to
5f3fa3d
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (2)
scripts/install-wizard.js (2)
29-32:⚠️ Potential issue | 🟠 Major
confirm()currently treatsno(and most typos) as “yes”.On Line 31, only exact
"n"is false;"no"incorrectly becomes true. This impacts consent flow in both app reuse and auth prompts.Proposed fix
async function confirm(question) { - const answer = await ask(`${question} (Y/n) `); - return answer === "" || answer.toLowerCase() !== "n"; + const answer = (await ask(`${question} (Y/n) `)).trim().toLowerCase(); + if (answer === "" || answer === "y" || answer === "yes") return true; + if (answer === "n" || answer === "no") return false; + return false; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 29 - 32, The confirm() helper currently treats "no" and typos starting with "n" as yes because it only checks for exact "n"; update confirm(question) to trim and lowercase the answer from ask(), treat an empty string as true (default yes), and return false for any answer that starts with "n" (e.g., "n", "no", "nah") — i.e., compute const a = answer.trim().toLowerCase(); if (a === "") return true; return !a.startsWith("n"); make this change in the confirm function that calls ask().
34-43:⚠️ Potential issue | 🔴 CriticalWindows
.cmd/.batexecution is not safely handled inrunhelpers.Lines 35 and 39 call
execFileSyncdirectly. Whencmdis a Windows shim (e.g.,lark-cli.cmd,npm.cmd,npx.cmd), these calls can fail withoutcmd.exe /c.Proposed fix
function run(cmd, args, opts = {}) { - execFileSync(cmd, args, { stdio: "inherit", ...opts }); + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: "inherit", + ...opts, + }); + return; + } + execFileSync(cmd, args, { stdio: "inherit", ...opts }); } function runSilent(cmd, args, opts = {}) { + if (isWindows && /\.(cmd|bat)$/i.test(cmd)) { + return execFileSync("cmd.exe", ["/d", "/s", "/c", cmd, ...args], { + stdio: ["ignore", "pipe", "pipe"], + ...opts, + }); + } return execFileSync(cmd, args, { stdio: ["ignore", "pipe", "pipe"], ...opts, }); }#!/bin/bash set -euo pipefail echo "Inspect current command execution helpers:" rg -n -C2 'function run\(|function runSilent\(|execFileSync\(|cmd\.exe|\.cmd|\.bat' scripts/install-wizard.js echo echo "Check Node docs references for .bat/.cmd + execFile behavior:" curl -fsSL https://nodejs.org/api/child_process.html | rg -n -i 'bat|cmd|execFile'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-wizard.js` around lines 34 - 43, The run and runSilent helpers call execFileSync directly and fail for Windows shims (e.g., lark-cli.cmd, npm.cmd); update both run and runSilent to detect Windows (process.platform === "win32") and when cmd ends with ".cmd" or ".bat" invoke cmd.exe /c by replacing cmd with "cmd.exe" and prefixing args with "/c" and the original cmd, or set windowsVerbatimArguments accordingly, then call execFileSync with the transformed cmd/args and original opts; reference the functions run, runSilent and the use of execFileSync so the fix is applied in both helpers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@scripts/install-wizard.js`:
- Around line 29-32: The confirm() helper currently treats "no" and typos
starting with "n" as yes because it only checks for exact "n"; update
confirm(question) to trim and lowercase the answer from ask(), treat an empty
string as true (default yes), and return false for any answer that starts with
"n" (e.g., "n", "no", "nah") — i.e., compute const a =
answer.trim().toLowerCase(); if (a === "") return true; return
!a.startsWith("n"); make this change in the confirm function that calls ask().
- Around line 34-43: The run and runSilent helpers call execFileSync directly
and fail for Windows shims (e.g., lark-cli.cmd, npm.cmd); update both run and
runSilent to detect Windows (process.platform === "win32") and when cmd ends
with ".cmd" or ".bat" invoke cmd.exe /c by replacing cmd with "cmd.exe" and
prefixing args with "/c" and the original cmd, or set windowsVerbatimArguments
accordingly, then call execFileSync with the transformed cmd/args and original
opts; reference the functions run, runSilent and the use of execFileSync so the
fix is applied in both helpers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 592d3a03-26c8-4ac2-9935-459aff0d7d18
📒 Files selected for processing (4)
package.jsonscripts/install-wizard.jsscripts/install.jsscripts/run.js
🚧 Files skipped from review as they are similar to previous changes (2)
- package.json
- scripts/run.js
5f3fa3d to
9b916af
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/install-wizard.js`:
- Around line 35-39: The execCmd function currently only wraps commands that
already end with .cmd/.bat; on Windows you must also treat bare "npm" and "npx"
as cmd shims and run them via cmd.exe. Update execCmd so that when isWindows is
true and the provided cmd either matches /\.cmd|\.bat$/i OR is a bare "npm" or
"npx" (case-insensitive) or otherwise has no file extension, you call
execFileSync("cmd.exe", ["/c", cmd, ...args], opts) instead of executing cmd
directly; leave direct execFileSync for non-Windows or when the command already
has an executable extension. Ensure you check the cmd string (the parameter to
execCmd) and use its basename/Lowercased value to detect "npm"/"npx".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4eb02b54-06ee-42d1-8513-6621dcd052f1
📒 Files selected for processing (4)
package.jsonscripts/install-wizard.jsscripts/install.jsscripts/run.js
✅ Files skipped from review due to trivial changes (2)
- package.json
- scripts/run.js
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/install.js
9b916af to
d63da22
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
d63da22 to
0204cac
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
0204cac to
0da3581
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
13a4859 to
9bfe696
Compare
da0db98 to
a997d3a
Compare
a997d3a to
823df70
Compare
Summary
新增
npx @larksuite/cli install一键安装命令,引导用户完成全局安装 CLI、安装 AISkills、应用配置和用户授权。
Changes
scripts/install-wizard.js:4 步交互式引导流程(全局安装 → Skills → config init → authlogin),零外部依赖
scripts/run.js:拦截install子命令走引导流程;二进制缺失时自动下载,通过LARK_CLI_RUN环境变量绕过 npx 检测
scripts/install.js:检测 npx 环境(npm_command === "exec")时跳过 postinstall 二进制下载,避免 npx因下载失败而中止
package.json:files 数组新增install-wizard.jsTest Plan
npx -y @larksuite/cli install在干净环境下完成全部安装流程npm install -g @larksuite/cli的 postinstall 仍正常下载二进制npx @larksuite/cli <其他命令>自动下载二进制并正常执行Related Issues
Summary by CodeRabbit
New Features
Chores