larksuite / larksuite/cli

docs +script init-draft should not create generated workspaces in the caller project root

Open
#2,761 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

lark-cli docs +script --command init-draft creates its generated workspace in the current working directory by default. When the command is run from an existing project or Git repository, this leaves a draft_<id>_folder/ directory in the project root.

The directory is a CLI work area rather than user-authored project content. It contains the Presentation Decision baseline and draft XML, and later document-authoring steps can add diagrams, downloaded media, and preview artifacts. This makes an otherwise clean repository appear dirty and makes it easy to accidentally commit generated files.

Environment

  • @larksuite/cli: 1.0.96
  • macOS arm64
  • Command identity: lark-cli docs +script

Reproduction

From the root of an existing Git repository:

lark-cli docs +script \
  --command init-draft \
  --presentation-decision '{}' \
  --format json

The command creates a workspace matching this pattern in the current directory:

draft_<8-hex-chars>_folder/
└── .presentation-decision.json

The dry-run response also reports:

{
  "creates_workspace": true,
  "directory_pattern": "draft_*_folder",
  "xml_file_name": "draft.xml"
}

Expected behavior

Please consider one of these options:

  1. Default the generated workspace to the operating system temporary directory, while returning its absolute path in data.cwd / data.workspace.
  2. Add an explicit --work-dir or --output-dir option for callers that need to choose the location.
  3. Support an environment variable for the default workspace root, with the current-directory behavior as an explicit opt-in.

The workspace should remain persistent for the duration of the document-authoring workflow, but it should not silently pollute the caller's project directory.

Compatibility consideration

The existing returned draft_path and data.cwd contract can remain unchanged. Only the default parent directory would change, so callers that use the returned path should continue to work.

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 at the docs +script --command init-draft workspace-creation path and inspect how the dry-run response reports draft_path, data.cwd, and data.workspace. Ensure the default workspace is outside the caller’s project while preserving the returned path contract, and verify that the generated workspace remains persistent for the authoring workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.