feat(cli): add --cwd option to thread start command #562

Closed
xiaoju wants to merge 0 commits from fix/561-thread-start-cwd-option into main
Owner

What

This PR adds the --cwd CLI option to uwf thread start, allowing users to specify a custom working directory for thread execution.

Why

Issue #561 requested exposing the existing cwd parameter from cmdThreadStart (implemented in PR #558) to the CLI layer. The core functionality already existed — the CLI just needed to pass through the option.

Changes

  1. CLI Implementation (packages/cli-workflow/src/cli.ts)

    • Added --cwd <path> option to thread start command
    • Option is optional and defaults to process.cwd() when not provided
    • Type-safe with cwd: string | undefined
  2. Test Suite (packages/cli-workflow/src/__tests__/thread-start-cwd-cli.test.ts)

    • Created comprehensive test suite with 4 test cases:
      • Custom absolute path via cmdThreadStart
      • Default behavior (omitting --cwd defaults to process.cwd())
      • Relative path validation (correctly rejects relative paths)
      • CLI option acceptance (integration test)

Test Results

  • 4/4 new tests pass
  • 328/328 total tests pass in cli-workflow package
  • bun run check passes (typecheck + lint)
  • bun run build succeeds

Verification

$ uwf thread start --help
Usage: uwf thread start [options] <workflow>

Create a thread without executing

Arguments:
  workflow             Workflow name or hash

Options:
  -p, --prompt <text>  User prompt
  --cwd <path>         Working directory for thread execution (default:
                       process.cwd())
  -h, --help           display help for command

Ref

Fixes #561

## What This PR adds the `--cwd` CLI option to `uwf thread start`, allowing users to specify a custom working directory for thread execution. ## Why Issue #561 requested exposing the existing `cwd` parameter from `cmdThreadStart` (implemented in PR #558) to the CLI layer. The core functionality already existed — the CLI just needed to pass through the option. ## Changes 1. **CLI Implementation** (`packages/cli-workflow/src/cli.ts`) - Added `--cwd <path>` option to `thread start` command - Option is optional and defaults to `process.cwd()` when not provided - Type-safe with `cwd: string | undefined` 2. **Test Suite** (`packages/cli-workflow/src/__tests__/thread-start-cwd-cli.test.ts`) - Created comprehensive test suite with 4 test cases: - Custom absolute path via `cmdThreadStart` - Default behavior (omitting `--cwd` defaults to `process.cwd()`) - Relative path validation (correctly rejects relative paths) - CLI option acceptance (integration test) ## Test Results - ✅ **4/4 new tests pass** - ✅ **328/328 total tests pass** in cli-workflow package - ✅ `bun run check` passes (typecheck + lint) - ✅ `bun run build` succeeds ## Verification ``` $ uwf thread start --help Usage: uwf thread start [options] <workflow> Create a thread without executing Arguments: workflow Workflow name or hash Options: -p, --prompt <text> User prompt --cwd <path> Working directory for thread execution (default: process.cwd()) -h, --help display help for command ``` ## Ref Fixes #561
xiaoju added 1 commit 2026-05-27 16:15:56 +00:00
feat(cli): add --cwd option to thread start command
CI / test (pull_request) Successful in 1m41s
a2e9dd9785
Exposes the existing cwd parameter from cmdThreadStart to the CLI layer,
allowing users to specify a custom working directory for thread execution.

- Added --cwd <path> option to uwf thread start
- Option defaults to process.cwd() when not provided
- Added comprehensive test suite with 4 test cases
- All 328 tests in cli-workflow package pass

Fixes #561
xiaonuo closed this pull request 2026-05-27 23:50:15 +00:00
Some checks are pending
CI / test (pull_request) Successful in 1m41s

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#562