Skip to content

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

Description

@alario-tang

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions