Windows: Node execFile/execFileSync cannot run global lark-cli (.cmd shim)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, node.js, powershell
- Domain
- cli, documentation
Research direction
Start with the bin entry in package.json and the entry script at scripts/run.js, then check the README for any existing install or usage notes. Confirm the reported Windows behaviour by running the .cmd shim versus node scripts/run.js with execFileSync. Done means a short "Programmatic usage" section that shows the node …/scripts/run.js invocation for Windows without shell: true, pending maintainer agreement on whether an install-layout change is also wanted.
Written by the indexing model from the issue text.
Description
Summary
On Windows, after a normal npm global install of @larksuite/cli, calling:
import { execFileSync } from 'node:child_process'
execFileSync('lark-cli', ['--profile', '…', 'docs', '+fetch', /* … */], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe'],
})
fails, while the same command works when typed in PowerShell/cmd.
This affects programmatic / Agent callers that intentionally use execFile (no shell) to keep argv unescaped and avoid shell injection.
Environment
- OS: Windows 10/11
- Package:
@larksuite/cli(reproduced on 1.0.97) - Install: npm global (
lark-clion PATH) - Node: 22+ / 24.x
What npm installs on Windows
Global bin typically creates:
lark-cli.cmdlark-cli.ps1- real entry:
node_modules/@larksuite/cli/scripts/run.js(package.jsonbin: { lark-cli: scripts/run.js }`)
The .cmd shim ultimately runs:
node ...\node_modules\@larksuite\cli\scripts\run.js %*
PowerShell/cmd resolve lark-cli to that shim, so interactive use works.
Node execFile / execFileSync does not run .cmd without shell: true, so looking up the bare command name lark-cli fails in Agent/tooling code.
Workaround (works today)
Spawn the Node entry directly (no shell):
execFileSync(process.execPath, [
String.raw`C:\path\to\node_global\node_modules\@larksuite\cli\scripts\run.js`,
'--profile', profile,
'docs', '+fetch',
'--doc', url,
'--as', 'user',
'--format', 'json',
], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
(or resolve run.js from PATH’s */node_modules/@larksuite/cli/scripts/run.js)
Using shell: true also “works” but is undesirable for untrusted/argv-sensitive automation.
Request
- Document the recommended Windows programmatic invocation (
node …/scripts/run.js …) for humans and AI Agents that must avoidshell: true. - Optionally consider a Windows-friendly install story for non-shell spawners (e.g. document PATH layout, or ship/clarify a non-
.cmdentry if feasible). Understanding this is partly an npm-on-Windows convention; even a short “Programmatic usage” note would unblock Agent integrations.
Not asking for
- Changing Feishu OpenAPI auth or docs APIs — this is only about the CLI process entrypoint on Windows.
Thanks!
- Dominant language
- Go
- Stars
- 18.2k
- Forks
- 1.4k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from larksuite/cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
domain/im
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug domain/doc
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
mail: all-ASCII draft bodies are hard-wrapped every 998 bytes, inserting newlines inside words and tagsPossibly taken @linye157 claimed this 26 days ago. Opendomain/mail
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
auth: a 429 from the Token Endpoint during refresh deletes a still-valid loginPossibly taken @linye157 claimed this 26 days ago. Openbug domain/auth domain/im
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
larksuite/cli#2869 · 5 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
github/github-mcp-server#3960 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
JuliusBrussee/caveman#1594 ·
Maintainers usually reply within 1 day
-
C-bug O-community X-blathers-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
cockroachdb/cockroach#176264 · 1 comment ·
-
security trivy
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
kubefleet-dev/kubefleet#1068 ·
Maintainers usually reply within 3 days