larksuite / larksuite/cli

[Windows][IM] Multiline --text is truncated via npm .cmd shim, with no stdin/file fallback

Open
#1,989 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domain/im enhancement
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Environment

  • Windows PowerShell 5.1
  • @larksuite/cli v1.0.73
  • Installed globally through npm
  • Command: im +messages-send

Problem

When multiline text is passed through the npm-generated lark-cli.cmd wrapper, only the content before the first newline reaches the CLI.

$msg = "line 1`nline 2`nline 3"

& "$env:APPDATA\npm\lark-cli.cmd" `
  im +messages-send `
  --as user `
  --chat-id oc_dryrun_test `
  --dry-run `
  --format json `
  --text $msg

The dry-run request contains only:

{"text":"line 1"}

There is also a safety concern: if --dry-run is placed after the multiline argument, the newline may truncate that flag as well, causing the CLI to attempt a real API request.

The npm-generated lark-cli.ps1 entry preserves all lines, but embedded double quotes are removed under Windows PowerShell 5.1.

$msg = "line 1`nline 2`nreply `"confirm`""

The resulting text preserves the lines but becomes:

line 1
line 2
reply confirm

I also tested possible shell-safe fallbacks:

  • --text - sends the literal -; stdin is not read.
  • --text @message.txt sends the literal @message.txt; file input is not supported.

Expected behavior

im +messages-send --text should preserve all line breaks and embedded quotes, or provide a shell-safe input mechanism on Windows.

Suggested solution

Please consider supporting one or more of:

  • --text-file message.txt
  • --text - for stdin
  • --text @message.txt
  • Equivalent file/stdin support for --markdown and message replies
  • Windows-specific tests and documentation for multiline text

A Node wrapper using an argument array preserves the content correctly, which confirms that the message-processing logic itself can handle the full text.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the im +messages-send argument handling and the npm-generated lark-cli.cmd and lark-cli.ps1 entry points described in the report. Reproduce the multiline and embedded-quote cases in Windows PowerShell 5.1, then add Windows-specific coverage for the selected input behavior. Done means multiline text and quotes survive safely, including when --dry-run follows the text argument, or the supported file/stdin fallback is documented and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, node.js, powershell
Domain
cli, operating-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.