feat(cli): init command — scaffold workflow workspace #56

Merged
xiaomo merged 3 commits from feat/36-init-command into main 2026-05-07 13:37:57 +00:00
Owner

What

Add uncaged-workflow init workspace <name> and uncaged-workflow init template <name> CLI commands to scaffold local workflow development monorepos.

Why

No standardized way to create workflow projects. Developers and coding agents need a consistent project structure with proper dependencies, conventions, and instructions.

Changes

  • packages/cli-workflow/src/cmd-init.tscmdInitWorkspace and cmdInitTemplate implementations
  • packages/cli-workflow/src/cli-dispatch.ts — wire init subcommands, refactor usage() to formatCliUsage()
  • packages/cli-workflow/__tests__/init-workspace.test.ts — workspace generation tests
  • packages/cli-workflow/__tests__/init-template.test.ts — template generation tests
  • AGENTS.md generation with comprehensive coding agent instructions

Testing

  • Phase 1 (#46): init workspace
  • Phase 2 (#47): init template
  • Phase 3 (#48): AGENTS.md
  • All 159 tests pass, bun run check clean

Ref: #36

## What Add `uncaged-workflow init workspace <name>` and `uncaged-workflow init template <name>` CLI commands to scaffold local workflow development monorepos. ## Why No standardized way to create workflow projects. Developers and coding agents need a consistent project structure with proper dependencies, conventions, and instructions. ## Changes - `packages/cli-workflow/src/cmd-init.ts` — `cmdInitWorkspace` and `cmdInitTemplate` implementations - `packages/cli-workflow/src/cli-dispatch.ts` — wire `init` subcommands, refactor `usage()` to `formatCliUsage()` - `packages/cli-workflow/__tests__/init-workspace.test.ts` — workspace generation tests - `packages/cli-workflow/__tests__/init-template.test.ts` — template generation tests - AGENTS.md generation with comprehensive coding agent instructions ## Testing - Phase 1 (#46): init workspace ✅ - Phase 2 (#47): init template ✅ - Phase 3 (#48): AGENTS.md ✅ - All 159 tests pass, `bun run check` clean Ref: #36
xingyue added 3 commits 2026-05-07 13:34:35 +00:00
- Add cmd-init.ts with cmdInitWorkspace and stub cmdInitTemplate
- Wire init subcommands into cli-dispatch.ts
- Generate monorepo skeleton: package.json (bun workspace), biome.json,
  tsconfig.json, AGENTS.md placeholder, README.md, templates/, workflows/
- Error on existing directory
- Add init-workspace.test.ts (all passing)

Testing: #46
- Implement cmdInitTemplate: find workspace root, generate template package
- Generate roles.ts, moderator.ts, index.ts with hello-world boilerplate
- Detect workspace by walking up to find package.json with workspaces
- Error on existing template dir or outside workspace
- Add init-template.test.ts

Testing: #47
- Replace placeholder with comprehensive coding agent instructions
- Covers: project structure, core concepts, dev workflow, coding
  conventions, template reuse, build/test, common pitfalls
- Add test coverage for AGENTS.md sections and terms

Testing: #48
xiaomo approved these changes 2026-05-07 13:37:36 +00:00
Dismissed
xiaomo left a comment
Owner

Review: command

整体质量不错,conventions 遵守得很好

Minor

  1. ** 返回类型** — 等价于 ,建议改成更具体的类型或直接
  2. ** 复用给 template** — 校验失败时错误信息说 "workspace name",但实际在校验 template name,建议参数化 entity name
  3. AGENTS.md 中文 vs README 英文 — 混合语言,确认是否有意为之
  4. **** — parent 不存在会报错。当前行为(fail fast)可以接受,但 更安全

都是小问题,不阻塞合并。

## Review: command 整体质量不错,conventions 遵守得很好 ✅ ### Minor 1. ** 返回类型** — 等价于 ,建议改成更具体的类型或直接 2. ** 复用给 template** — 校验失败时错误信息说 "workspace name",但实际在校验 template name,建议参数化 entity name 3. **AGENTS.md 中文 vs README 英文** — 混合语言,确认是否有意为之 4. **** — parent 不存在会报错。当前行为(fail fast)可以接受,但 更安全 都是小问题,不阻塞合并。
xiaomo approved these changes 2026-05-07 13:37:48 +00:00
xiaomo left a comment
Owner

Review: init command

整体质量不错,conventions 遵守得很好

Minor

  1. readPackageJsonWorkspaces 返回类型 Promise<unknown | null> 等价于 Promise,建议改成更具体的类型
  2. validateWorkspaceSegment 复用给 template 时,错误信息说 workspace name 但实际在校验 template name,建议参数化 entity name
  3. AGENTS.md 中文 vs README 英文,混合语言确认是否有意为之
  4. mkdir recursive false,parent 不存在会报错,recursive true 更安全

都是小问题,不阻塞合并。

## Review: init command 整体质量不错,conventions 遵守得很好 ### Minor 1. readPackageJsonWorkspaces 返回类型 Promise<unknown | null> 等价于 Promise<unknown>,建议改成更具体的类型 2. validateWorkspaceSegment 复用给 template 时,错误信息说 workspace name 但实际在校验 template name,建议参数化 entity name 3. AGENTS.md 中文 vs README 英文,混合语言确认是否有意为之 4. mkdir recursive false,parent 不存在会报错,recursive true 更安全 都是小问题,不阻塞合并。
xiaomo merged commit 19769efea6 into main 2026-05-07 13:37:57 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#56