Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Add outfitter CLI with init command for new projects:

  • createInitCommand(): Commander-style with @outfitter/cli
  • Template scaffolding from templates/basic/
  • Interactive prompts with @clack/prompts
  • Package.json generation with user inputs
  • File copying with proper permissions
  • Basic template with Bun + TypeScript + Outfitter deps

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Contributes to #57

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greetings Summary

  • Implements the outfitter umbrella CLI with an init command for project scaffolding from the templates/basic/ directory
  • Adds comprehensive template system with mustache-style variable replacement for generating new Bun+TypeScript projects
  • Creates modular CLI architecture using Commander.js with interactive prompts via @clack/prompts for project configuration

Important Files Changed

Filename Overview
apps/outfitter/src/commands/init.ts Core scaffolding logic with potential binary name extraction bug in package.json parsing
apps/outfitter/package.json New CLI package configuration establishing the umbrella tool with proper dependencies and binary setup

Confidence score: 4/5

  • This PR is generally safe to merge with careful review of the binary name logic
  • Score reflects solid architecture and comprehensive implementation, but lowered due to potential bug in binary name resolution from package.json objects
  • Pay close attention to apps/outfitter/src/commands/init.ts lines 222-232 for the binary name extraction logic

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as "CLI (cli.ts)"
    participant InitCmd as "InitCommand"
    participant FS as "File System"
    participant Templates as "Template Directory"
    participant Prompts as "@clack/prompts"

    User->>CLI: "outfitter init [directory]"
    CLI->>InitCmd: "runInit(options)"
    InitCmd->>FS: "resolve target directory"
    InitCmd->>FS: "read existing package.json"
    InitCmd->>Prompts: "prompt for project name"
    Prompts->>User: "Project name?"
    User->>Prompts: "enter name"
    InitCmd->>Prompts: "prompt for binary name"
    Prompts->>User: "Binary name?"
    User->>Prompts: "enter bin name"
    InitCmd->>Templates: "validate template exists"
    Templates->>InitCmd: "template path"
    InitCmd->>Templates: "read template files"
    InitCmd->>InitCmd: "replace placeholders in content"
    InitCmd->>FS: "create target directory"
    InitCmd->>FS: "copy processed files"
    InitCmd->>CLI: "success result"
    CLI->>User: "Project initialized successfully"
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 223 to 225
if (typeof bin === "string") {
if (resolvedName) {
resolvedBin = deriveBinName(resolvedName);
}
} else if (typeof bin === "object" && bin !== null) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Logic issue: when bin is a string, you derive the bin name from the project name, but you should use the string value of bin directly

Suggested change
if (typeof bin === "string") {
if (resolvedName) {
resolvedBin = deriveBinName(resolvedName);
}
} else if (typeof bin === "object" && bin !== null) {
if (typeof bin === "string") {
resolvedBin = bin;
} else if (typeof bin === "object" && bin !== null) {
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/outfitter/src/commands/init.ts
Line: 223:227

Comment:
**logic:** Logic issue: when `bin` is a string, you derive the bin name from the project name, but you should use the string value of `bin` directly

```suggestion
		if (typeof bin === "string") {
			resolvedBin = bin;
		} else if (typeof bin === "object" && bin !== null) {
```

How can I resolve this? If you propose a fix, please make it concise.

@galligan galligan changed the base branch from p3-22/daemon/ipc-health to graphite-base/85 January 23, 2026 21:58
@galligan galligan force-pushed the p3-23/outfitter/init-cmd branch from 42a3d3b to 2bc18cb Compare January 23, 2026 22:06
@galligan galligan changed the base branch from graphite-base/85 to p3-22/daemon/ipc-health January 23, 2026 22:06
@galligan
Copy link
Contributor Author

Updated init test to avoid interactive prompts (force isTTY false) and use .js ESM import. Pre-push test hook ran clean.

@galligan
Copy link
Contributor Author

Addressed review feedback: init now uses string "bin" values directly from package.json, and added outfitter init smoke coverage (missing-template error + public API export check) so bun test runs in the app package.

@galligan galligan force-pushed the p3-23/outfitter/init-cmd branch from 2bc18cb to a826534 Compare January 23, 2026 23:09
@galligan galligan force-pushed the p3-22/daemon/ipc-health branch from c054bed to 4ea0f4d Compare January 23, 2026 23:09
@galligan
Copy link
Contributor Author

Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR.

@galligan galligan changed the base branch from p3-22/daemon/ipc-health to graphite-base/85 January 24, 2026 03:13
@galligan galligan force-pushed the p3-23/outfitter/init-cmd branch from a826534 to 4159d2a Compare January 24, 2026 03:15
@galligan galligan changed the base branch from graphite-base/85 to p3-22/daemon/ipc-health January 24, 2026 03:15
@galligan
Copy link
Contributor Author

Reviewed greptile note on bin handling — string values are used directly (no derivation) and the prompt flow remains name → bin with fallback. Restacked and resubmitted.

@galligan galligan force-pushed the p3-22/daemon/ipc-health branch from 1bf4162 to aa9d003 Compare January 24, 2026 12:41
@galligan galligan force-pushed the p3-23/outfitter/init-cmd branch from 4159d2a to 23f0e8b Compare January 24, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants