---
phase: 01-core-infrastructure
plan: 01
type: execute
wave: 1
depends_on: []
files_modified: [package.json, tsconfig.json, src/index.ts, bin/cw]
autonomous: true
---

<objective>
Initialize TypeScript project with ESM, build tooling, and bin directory structure.

Purpose: Establish the project foundation that all other Phase 1 plans depend on.
Output: Buildable TypeScript project with `npm run build` and `npm run dev` working.
</objective>

<execution_context>
@~/.claude/get-shit-done/workflows/execute-plan.md
@~/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Initialize Node.js project with TypeScript and ESM</name>
  <files>package.json, tsconfig.json, .gitignore</files>
  <action>
    Initialize project with `npm init -y`. Configure for ESM:
    - package.json: "type": "module"
    - Add dependencies: typescript, @types/node, commander (CLI), execa (process mgmt)
    - Add devDependencies: tsx (dev runner), rimraf (clean)
    - Configure scripts: build (tsc), dev (tsx watch), clean (rimraf dist)
    - Set "bin": { "cw": "./dist/bin/cw.js" }
    - Set "main": "./dist/index.js"

    tsconfig.json:
    - target: ES2022
    - module: NodeNext
    - moduleResolution: NodeNext
    - outDir: ./dist
    - rootDir: ./src
    - strict: true
    - esModuleInterop: true
    - declaration: true

    Add node_modules and dist to .gitignore.
  </action>
  <verify>npm install succeeds, npm run build succeeds (even with empty src)</verify>
  <done>package.json has correct config, tsconfig.json exists, dependencies installed</done>
</task>

<task type="auto">
  <name>Task 2: Create source structure and entry point</name>
  <files>src/index.ts, src/bin/cw.ts</files>
  <action>
    Create directory structure:
    - src/bin/cw.ts - CLI entry point (will be built to dist/bin/cw.js)
    - src/index.ts - library entry point (exports public API)

    src/bin/cw.ts:
    - Add shebang: #!/usr/bin/env node
    - Import and call main function placeholder
    - Log "cw cli v0.0.1" for now

    src/index.ts:
    - Export version constant
    - Export placeholder for future modules

    Ensure the bin file is executable after build.
  </action>
  <verify>npm run build succeeds, node dist/bin/cw.js prints version message</verify>
  <done>Build outputs to dist/, bin entry point runs, prints version</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] `npm install` runs without errors
- [ ] `npm run build` compiles TypeScript without errors
- [ ] `node dist/bin/cw.js` outputs version message
- [ ] dist/ contains compiled .js and .d.ts files
- [ ] .gitignore includes node_modules and dist
</verification>

<success_criteria>

- All tasks completed
- All verification checks pass
- Project builds successfully
- Bin entry point executes
</success_criteria>

<output>
After completion, create `.planning/phases/01-core-infrastructure/01-01-SUMMARY.md`
</output>
