context-first-cli 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,276 +1,651 @@
1
1
  # Context-First CLI
2
2
 
3
- A generic, cross-platform CLI to manage the **Context-First** development methodology across any project ecosystem. This tool provides a robust framework for orchestrating development workflows, managing multiple repositories, and ensuring consistency for both human developers and AI agents.
3
+ > A universal CLI for managing Context-First development methodology across any project ecosystem.
4
+
5
+ Orchestrate multi-repository workflows, create isolated feature workspaces, and maintain consistency for both human developers and AI agents.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/context-first-cli.svg)](https://www.npmjs.com/package/context-first-cli)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ---
11
+
12
+ ## Table of Contents
13
+
14
+ - [Why Context-First CLI?](#why-context-first-cli)
15
+ - [Quick Start](#quick-start)
16
+ - [Core Concepts](#core-concepts)
17
+ - [Installation](#installation)
18
+ - [Commands](#commands)
19
+ - [Workflow Guide](#workflow-guide)
20
+ - [Docker Support](#docker-support)
21
+ - [Architecture](#architecture)
22
+ - [Examples](#examples)
23
+ - [Troubleshooting](#troubleshooting)
24
+
25
+ ---
26
+
27
+ ## Why Context-First CLI?
28
+
29
+ **The Problem**: Managing multiple repositories, coordinating feature development, and maintaining consistent processes across teams is complex and error-prone.
30
+
31
+ **The Solution**: Context-First CLI provides:
32
+
33
+ ✅ **Isolated Feature Workspaces** - Work on multiple features simultaneously without conflicts
34
+ ✅ **Git Worktree Integration** - Efficient branch management without re-cloning repositories
35
+ ✅ **Docker Support** - Automatic `docker-compose.yml` generation with dynamic ports
36
+ ✅ **AI-Ready** - Pre-configured command templates for AI assistants (Claude, Cursor)
37
+ ✅ **Cross-Platform** - Works on Windows, macOS, and Linux
38
+ ✅ **Project-Agnostic** - One CLI for all your projects
39
+
40
+ ---
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ # 1. Install globally
46
+ npm install -g context-first-cli
47
+
48
+ # 2. Create orchestrator (project control center)
49
+ npx context-first-cli@latest create:orchestrator
50
+
51
+ # 3. Configure local environment
52
+ cd your-orchestrator/
53
+ npx context-first-cli@latest config:setup
54
+
55
+ # 4. Add repositories
56
+ npx context-first-cli@latest add:repo
57
+
58
+ # 5. Start working on a feature
59
+ npx context-first-cli@latest feature start FIN-123
60
+
61
+ # 6. Enter workspace and start services
62
+ cd .sessions/FIN-123
63
+ docker-compose up -d
64
+ ```
65
+
66
+ **That's it!** You now have an isolated workspace with all repositories checked out and services running.
4
67
 
5
68
  ---
6
69
 
7
- ## 🚀 Core Concepts
70
+ ## Core Concepts
8
71
 
9
- This CLI is built on three core concepts that enable scalable, parallel, and context-aware development.
72
+ ### 1. Orchestrator Repository
10
73
 
11
- ### 1. The Orchestrator Repository
74
+ The **single source of truth** for your project's development process.
12
75
 
13
- Instead of embedding process logic into each of your application repositories, you define it in one central **Orchestrator Repository**. This repository acts as the single source of truth for your development methodology. It contains:
76
+ **Contains**:
77
+ - `context-manifest.json` - Repository definitions and relationships
78
+ - `.claude/commands/` - AI command templates
79
+ - `ai.properties.md` - Local configuration (gitignored)
80
+ - `.contextrc.json` - Makes orchestrator self-aware
14
81
 
15
- - **Command Definitions**: Markdown files (`.claude/commands/`) that instruct an AI (like Claude) on the purpose and logic of each step in your process (e.g., `/work`, `/spec`, `/pr`).
16
- - **Repository Manifest**: A `context-manifest.json` file that maps out your entire project ecosystem, defining all repositories (including MetaSpecs) and their relationships.
17
- - **Configuration Templates**: Files like `ai.properties.md` that define project-specific commands (lint, test, build) and settings.
82
+ **Purpose**: Define your development methodology once, use everywhere.
18
83
 
19
84
  ### 2. Feature Workspaces
20
85
 
21
- To enable parallel development without conflicts, the CLI uses **Feature Workspaces**. When you start working on a new feature (e.g., an issue from Jira), the CLI creates a dedicated, isolated directory. Inside this workspace, it uses `git worktree` to check out a specific branch for each relevant repository. This is extremely efficient, as it doesn't re-clone the entire repository, saving disk space and time.
86
+ **Isolated environments** for each feature you work on.
87
+
88
+ **Location**: `orchestrator/.sessions/<ISSUE-ID>/`
89
+
90
+ **Contains**:
91
+ - Git worktrees for each repository (efficient, no re-cloning)
92
+ - `docker-compose.yml` with dynamic ports
93
+ - Feature-specific documentation
22
94
 
23
- - **Isolation**: Every feature has its own folder, preventing any overlap or context-clash between concurrent tasks.
24
- - **Efficiency**: Powered by `git worktree`, creating and switching between workspaces is nearly instantaneous.
25
- - **Docker Support**: Automatically generates `docker-compose.yml` with dynamic ports based on issue number, allowing multiple workspaces to run simultaneously without port conflicts.
95
+ **Benefits**:
96
+ - Work on multiple features simultaneously
97
+ - No port conflicts (FIN-11 3011, FIN-12 3012)
98
+ - Clean separation of concerns
26
99
 
27
- ### 3. The Agnostic CLI (`context-cli`)
100
+ ### 3. Git Worktree
28
101
 
29
- This is the tool you install on your machine. It's completely project-agnostic. You can use the same CLI to manage any project.
102
+ **Efficient branch management** without multiple clones.
103
+
104
+ **How it works**:
105
+ ```
106
+ Main Repository (~/dev/backend):
107
+ └── main branch
30
108
 
31
- - **Cross-Platform**: Built with Node.js/TypeScript, it works seamlessly on Windows, macOS, and Linux.
32
- - **Configurable**: The `init` command creates a `.contextrc.json` file in your project, telling the CLI which Orchestrator to use.
33
- - **AI-Agnostic**: You can configure it to create command structures for different AI providers (e.g., `.claude/commands` for Claude, `.cursor/commands` for Cursor).
109
+ Workspace 1 (.sessions/FIN-11/backend):
110
+ └── feature/FIN-11 branch (worktree)
111
+
112
+ Workspace 2 (.sessions/FIN-12/backend):
113
+ └── feature/FIN-12 branch (worktree)
114
+ ```
115
+
116
+ **All share the same `.git/`** - saving disk space and time.
34
117
 
35
118
  ---
36
119
 
37
- ## 📦 Installation
120
+ ## Installation
38
121
 
39
- Install the CLI globally on your machine via NPM.
122
+ ### Global Installation (Recommended)
40
123
 
41
124
  ```bash
42
125
  npm install -g context-first-cli
43
126
  ```
44
127
 
128
+ ### Use Without Installing
129
+
130
+ ```bash
131
+ npx context-first-cli@latest <command>
132
+ ```
133
+
134
+ ### Requirements
135
+
136
+ - Node.js >= 18.0.0
137
+ - Git >= 2.5.0
138
+ - Docker (optional, for container support)
139
+
45
140
  ---
46
141
 
47
- ## 📋 Commands Reference
142
+ ## Commands
48
143
 
49
144
  ### Setup Commands
50
145
 
51
146
  | Command | Description |
52
- | :--- | :--- |
53
- | `context-cli init` | Initialize Context-First in an existing project by creating `.contextrc.json`. |
54
- | `context-cli create:orchestrator` | Create a new orchestrator repository from a template with all necessary structure. |
55
- | `context-cli add:repo` | Add a new code repository to `context-manifest.json` interactively. |
56
- | `context-cli add:repo-metaspec` | Add or update the MetaSpecs repository in `context-manifest.json`. |
57
- | `context-cli config:setup` | Interactively configure `ai.properties.md` for local development. |
147
+ |---------|-------------|
148
+ | `create:orchestrator` | Create new orchestrator repository |
149
+ | `config:setup` | Configure local environment (`ai.properties.md`) |
150
+ | `add:repo` | Add repository to manifest |
151
+ | `add:repo-metaspec` | Add MetaSpecs repository |
152
+ | `init` | Initialize Context-First in existing project |
58
153
 
59
154
  ### Workspace Commands
60
155
 
61
156
  | Command | Description |
62
- | :--- | :--- |
63
- | `context-cli feature start <issue-id>` | Create a new feature workspace with isolated git worktrees. |
64
- | `context-cli feature list` | List all active feature workspaces on your machine. |
65
- | `context-cli feature switch <issue-id>` | Get the command to switch to an existing feature workspace. |
66
- | `context-cli feature merge <issue-id>` | Merge feature branch into target branch, push changes, and clean up workspace. |
67
- | `context-cli feature end <issue-id>` | Archive and clean up a completed feature workspace. |
157
+ |---------|-------------|
158
+ | `feature start <id>` | Create isolated workspace with worktrees |
159
+ | `feature list` | List all active workspaces |
160
+ | `feature switch <id>` | Get command to switch workspace |
161
+ | `feature merge <id>` | Merge feature and clean up |
162
+ | `feature end <id>` | Clean up workspace without merging |
68
163
 
69
- ### Diagnostic Commands
164
+ ### Utility Commands
70
165
 
71
166
  | Command | Description |
72
- | :--- | :--- |
73
- | `context-cli doctor` | Check environment and configuration for issues. |
74
- | `context-cli status` | Show detailed status of the current workspace. |
167
+ |---------|-------------|
168
+ | `status` | Show workspace status |
169
+ | `doctor` | Check environment health |
170
+ | `update:commands` | Update AI command templates |
75
171
 
76
172
  ---
77
173
 
78
- ## 🚀 Getting Started: The 5-Minute Workflow
79
-
80
- The primary workflow is designed to be simple and centralized within the Orchestrator.
174
+ ## Workflow Guide
81
175
 
82
- ### Step 1: Create Your Orchestrator
176
+ ### Initial Setup (Once Per Project)
83
177
 
84
- This is your project's "home base". It defines your development process and the repositories involved.
178
+ #### Step 1: Create Orchestrator
85
179
 
86
180
  ```bash
87
- # Run this once per project ecosystem
88
181
  npx context-first-cli@latest create:orchestrator
89
182
  ```
90
183
 
91
- This command interactively sets up your orchestrator, which includes:
92
- - `.contextrc.json`: A file that makes the orchestrator self-aware, so you can run all commands from here.
93
- - `context-manifest.json`: Defines all repositories in your project.
94
- - `.claude/commands/`: Pre-built command templates for your AI assistant.
95
- - `ai.properties.md`: A template for your local configuration (which is gitignored).
184
+ **Prompts**:
185
+ - Project name
186
+ - Description
187
+ - MetaSpecs repository URL (optional)
96
188
 
97
- ### Step 2: Configure Your Local Environment
189
+ **Creates**:
190
+ ```
191
+ my-project-orchestrator/
192
+ ├── .contextrc.json
193
+ ├── context-manifest.json
194
+ ├── .claude/commands/
195
+ └── ai.properties.md (template)
196
+ ```
98
197
 
99
- Navigate into the new orchestrator directory and tell the CLI where your code is located.
198
+ #### Step 2: Configure Local Environment
100
199
 
101
200
  ```bash
102
- cd your-orchestrator-name/
201
+ cd my-project-orchestrator/
103
202
  npx context-first-cli@latest config:setup
104
203
  ```
105
204
 
106
- This will ask for your **`base_path`**, which is the absolute path to the folder where you keep all your git repositories (e.g., `~/workspace` or `~/dev`). It also asks if you want to enable `auto_clone`.
205
+ **Prompts**:
206
+ - `base_path`: Where your repositories live (e.g., `~/dev`)
207
+ - `auto_clone`: Automatically clone missing repos?
208
+ - Task manager: Jira, Linear, GitHub, or none
107
209
 
108
- ### Step 3: Add Your Repositories
210
+ **Creates**: `ai.properties.md` with your local settings
109
211
 
110
- Now, define the repositories that make up your project.
212
+ #### Step 3: Add Repositories
111
213
 
112
214
  ```bash
113
- # Still inside the orchestrator directory
114
215
  npx context-first-cli@latest add:repo
115
216
  ```
116
217
 
117
- Run this command for each repository (e.g., `backend`, `frontend`, `admin`). It will interactively ask for the repository's ID, Git URL, and role, and save it to `context-manifest.json`.
218
+ **Prompts**:
219
+ - Repository folder name (e.g., `backend`)
220
+ - Git URL
221
+ - Role: `backend`, `frontend`, `metaspecs`, or `other`
222
+ - Description
118
223
 
119
- ### Step 4: Start a Feature
224
+ **Repeat** for each repository in your project.
120
225
 
121
- That's it for setup! Now you can start working on a feature. **From the orchestrator directory**, run:
226
+ #### Step 4: Commit Orchestrator
122
227
 
123
228
  ```bash
124
- npx context-first-cli@latest feature start <issue-id>
125
- # Example: npx context-first-cli@latest feature start FIN-123
229
+ git add .
230
+ git commit -m "feat: setup orchestrator"
231
+ git remote add origin <your-orchestrator-repo-url>
232
+ git push -u origin main
126
233
  ```
127
234
 
128
- This command will:
129
- 1. Read your `context-manifest.json`.
130
- 2. Look for your repositories in the `base_path` you configured.
131
- 3. If a repository isn't found and `auto_clone` is true, it will clone it for you.
132
- 4. Create a new, isolated workspace in the orchestrator (e.g., `orchestrator/.sessions/FIN-123/`).
133
- 5. Use `git worktree` to efficiently check out a new feature branch for each selected repository into the workspace.
134
- 6. **Generate a `docker-compose.yml`** with dynamic ports based on the issue number (e.g., FIN-11 → backend:3011, frontend:8011, postgres:5411).
235
+ ---
236
+
237
+ ### Daily Development
135
238
 
136
- Your isolated, multi-repo development environment is ready, organized within your orchestrator!
239
+ #### Start Feature
137
240
 
138
- **Running Services:**
139
241
  ```bash
140
- cd orchestrator/.sessions/FIN-123
141
- docker-compose up -d # Start all services
142
- # Access: Backend at http://localhost:3123, Frontend at http://localhost:8123
143
- docker-compose down # Stop all services
242
+ # From orchestrator directory
243
+ npx context-first-cli@latest feature start FIN-123
144
244
  ```
145
245
 
146
- ### Step 5: Manage Your Workspaces
246
+ **What happens**:
247
+ 1. Creates `.sessions/FIN-123/`
248
+ 2. Creates git worktrees for each repo
249
+ 3. Generates `docker-compose.yml` with ports 3123, 8123, 5523, 6423
250
+ 4. Ready to work!
251
+
252
+ #### Enter Workspace
147
253
 
148
254
  ```bash
149
- # List all active workspaces
150
- npx context-first-cli@latest feature list
255
+ cd .sessions/FIN-123
256
+ ```
151
257
 
152
- # Get the command to switch to a workspace
153
- npx context-first-cli@latest feature switch FIN-123
154
- # Then run the displayed command: cd orchestrator/.sessions/FIN-123
258
+ #### Start Services (Optional)
155
259
 
156
- # Check the status of your current workspace
157
- cd orchestrator/.sessions/FIN-123/
158
- npx context-first-cli@latest status
260
+ ```bash
261
+ docker-compose up -d
262
+ ```
159
263
 
160
- # Merge feature and clean up workspace
161
- npx context-first-cli@latest feature merge FIN-123
162
- # This will:
163
- # 1. Merge feature/FIN-123 into main (or specified target branch)
164
- # 2. Push changes to remote
165
- # 3. Delete feature branch
166
- # 4. Clean up workspace
264
+ **Access**:
265
+ - Backend: `http://localhost:3123`
266
+ - Frontend: `http://localhost:8123`
267
+ - Postgres: `localhost:5523`
268
+ - Redis: `localhost:6423`
167
269
 
168
- # Or manually clean up without merging
169
- npx context-first-cli@latest feature end FIN-123
270
+ #### Work on Feature
271
+
272
+ ```bash
273
+ # Open in editor
274
+ code .
275
+
276
+ # Use AI commands (if configured)
277
+ /start # Create context.md and architecture.md
278
+ /plan # Create plan.md
279
+ /work # Implement feature
280
+ /pre-pr # Review before PR
281
+ /pr # Create pull request
170
282
  ```
171
283
 
172
- **Merge Options**:
284
+ #### Stop Services
285
+
173
286
  ```bash
174
- # Merge into a different branch
175
- npx context-first-cli@latest feature merge FIN-123 --target-branch develop
287
+ docker-compose down
288
+ ```
176
289
 
177
- # Merge without pushing (for manual review)
178
- npx context-first-cli@latest feature merge FIN-123 --no-push
290
+ #### Finish Feature
179
291
 
180
- # Keep workspace after merge (for reference)
181
- npx context-first-cli@latest feature merge FIN-123 --keep-workspace
292
+ **Option 1: Merge via CLI**
293
+ ```bash
294
+ # From orchestrator directory
295
+ npx context-first-cli@latest feature merge FIN-123
296
+ ```
182
297
 
183
- # Force merge without confirmation
184
- npx context-first-cli@latest feature merge FIN-123 --force
298
+ **Option 2: Merge via GitHub + Clean Up**
299
+ ```bash
300
+ # 1. Create PR via /pr command or manually
301
+ # 2. Merge PR on GitHub
302
+ # 3. Clean up workspace
303
+ npx context-first-cli@latest feature end FIN-123
185
304
  ```
186
305
 
187
306
  ---
188
307
 
189
- ## 🏗️ Architecture Overview
308
+ ## Docker Support
309
+
310
+ ### Automatic Generation
190
311
 
191
- ```mermaid
192
- graph TD
193
- subgraph User Machine
194
- Dev[Developer] -->|uses| CLI[context-cli]
195
- end
312
+ When you run `feature start`, the CLI generates `docker-compose.yml` with:
196
313
 
197
- subgraph Project Setup
198
- CLI -->|reads| Config[.contextrc.json]
199
- Config -->|points to| Orchestrator
200
- end
314
+ - **Backend** (if `role: "backend"` exists)
315
+ - **Frontend** (if `role: "frontend"` exists)
316
+ - **PostgreSQL** (always included)
317
+ - **Redis** (always included)
201
318
 
202
- subgraph Orchestrator [Orchestrator Repository]
203
- style Orchestrator fill:#cde,stroke:#333,stroke-width:2px
204
- Manifest[context-manifest.json<br/>Repository definitions]
205
- Commands[.claude/commands/<br/>AI command definitions]
206
- Props[ai.properties.md<br/>Local configuration]
207
- end
319
+ ### Dynamic Ports
208
320
 
209
- subgraph Workspace [Feature Workspace: FIN-123]
210
- style Workspace fill:#f9f,stroke:#333,stroke-width:2px
211
- WT1[metaspecs/<br/>git worktree]
212
- WT2[backend/<br/>git worktree]
213
- WT3[frontend/<br/>git worktree]
214
- end
321
+ Ports are calculated from issue number:
215
322
 
216
- CLI -->|reads| Manifest
217
- CLI -->|creates/manages| Workspace
218
323
  ```
324
+ FIN-11: Backend 3011, Frontend 8011, Postgres 5411, Redis 6311
325
+ FIN-123: Backend 3123, Frontend 8123, Postgres 5523, Redis 6423
326
+ ```
327
+
328
+ **Benefit**: Run multiple workspaces simultaneously without conflicts!
219
329
 
220
- This structure ensures a clean separation of concerns:
330
+ ### Configuration
221
331
 
222
- - **The CLI** is the universal engine that works for any project
223
- - **The Orchestrator** defines the process and ecosystem for a specific project
224
- - **The Workspace** is the temporary, isolated environment where work happens
332
+ Edit `ai.properties.md` to customize base ports:
333
+
334
+ ```markdown
335
+ ## Docker Configuration
336
+
337
+ docker.backend_base_port=3000
338
+ docker.frontend_base_port=8000
339
+ docker.postgres_base_port=5400
340
+ docker.redis_base_port=6300
341
+ ```
342
+
343
+ ### Example `docker-compose.yml`
344
+
345
+ ```yaml
346
+ version: '3.8'
347
+
348
+ services:
349
+ backend:
350
+ build: ./backend
351
+ ports:
352
+ - "3011:3000"
353
+ environment:
354
+ - DATABASE_URL=postgresql://user:password@postgres:5432/app
355
+ networks:
356
+ - fin-11-network
357
+
358
+ frontend:
359
+ build: ./frontend
360
+ ports:
361
+ - "8011:8080"
362
+ environment:
363
+ - VITE_API_URL=http://localhost:3011
364
+ networks:
365
+ - fin-11-network
366
+
367
+ postgres:
368
+ image: postgres:15-alpine
369
+ ports:
370
+ - "5411:5432"
371
+ networks:
372
+ - fin-11-network
373
+
374
+ redis:
375
+ image: redis:7-alpine
376
+ ports:
377
+ - "6311:6379"
378
+ networks:
379
+ - fin-11-network
380
+
381
+ networks:
382
+ fin-11-network:
383
+ ```
225
384
 
226
385
  ---
227
386
 
228
- ## 📝 Example: Complete Setup for a New Project
387
+ ## Architecture
388
+
389
+ ```
390
+ ┌─────────────────────────────────────────────────────────────┐
391
+ │ Developer Machine │
392
+ │ │
393
+ │ ┌───────────────┐ │
394
+ │ │ context-cli │ (Universal CLI) │
395
+ │ └───────┬───────┘ │
396
+ │ │ │
397
+ │ ├─────────────────────────────────────────┐ │
398
+ │ │ │ │
399
+ │ ┌───────▼────────────────────────┐ ┌───────▼─────┐ │
400
+ │ │ Orchestrator Repository │ │ Workspaces │ │
401
+ │ │ │ │ │ │
402
+ │ │ • context-manifest.json │ │ FIN-11/ │ │
403
+ │ │ • .claude/commands/ │ │ FIN-12/ │ │
404
+ │ │ • ai.properties.md │ │ FIN-13/ │ │
405
+ │ └─────────────────────────────────┘ └─────────────┘ │
406
+ │ │
407
+ └───────────────────────────────────────────────────────────────┘
408
+
409
+ ┌─────────────────────────────────────────────────────────────┐
410
+ │ Main Repositories │
411
+ │ │
412
+ │ ~/dev/backend/ (main branch) │
413
+ │ ~/dev/frontend/ (main branch) │
414
+ │ ~/dev/metaspecs/ (main branch) │
415
+ │ │
416
+ └─────────────────────────────────────────────────────────────┘
417
+ ```
418
+
419
+ **Flow**:
420
+ 1. CLI reads orchestrator configuration
421
+ 2. Creates workspace with worktrees
422
+ 3. Worktrees link to main repositories
423
+ 4. Developer works in isolated workspace
424
+ 5. Changes pushed to main repositories
425
+
426
+ ---
427
+
428
+ ## Examples
429
+
430
+ ### Example 1: Complete Setup
229
431
 
230
432
  ```bash
231
- # 1. Create the orchestrator (once per project)
433
+ # Create orchestrator
232
434
  npx context-first-cli@latest create:orchestrator
233
- # Follow prompts: name, description, metaspecs URL...
435
+ # Name: my-saas-orchestrator
436
+ # Description: SaaS project orchestrator
234
437
 
235
- # 2. Enter the orchestrator and configure your local environment
438
+ # Configure
236
439
  cd my-saas-orchestrator/
237
440
  npx context-first-cli@latest config:setup
238
441
  # Base path: ~/dev
239
442
  # Auto-clone: Yes
443
+ # Task manager: Jira
444
+ # Jira site: https://mycompany.atlassian.net
445
+ # Jira project: SAAS
240
446
 
241
- # 3. Add all your project's repositories to the manifest
447
+ # Add repositories
242
448
  npx context-first-cli@latest add:repo
243
- # ID: backend, URL: git@github.com:myorg/my-saas-backend.git
449
+ # Folder name: my-saas-backend
450
+ # URL: git@github.com:myorg/my-saas-backend.git
451
+ # Role: backend
244
452
 
245
453
  npx context-first-cli@latest add:repo
246
- # ID: frontend, URL: git@github.com:myorg/my-saas-frontend.git
454
+ # Folder name: my-saas-frontend
455
+ # URL: git@github.com:myorg/my-saas-frontend.git
456
+ # Role: frontend
247
457
 
248
- # 4. Commit and push your orchestrator setup
458
+ # Commit
249
459
  git add .
250
- git commit -m "feat: configure orchestrator with project repositories"
251
- git remote add origin git@github.com:myorg/my-saas-orchestrator.git
460
+ git commit -m "feat: setup orchestrator"
252
461
  git push -u origin main
462
+ ```
463
+
464
+ ### Example 2: Working on Feature
253
465
 
254
- # 5. Start working on a feature!
255
- # (Make sure your repos like 'my-saas-backend' exist in '~/dev' or enable auto_clone)
256
- npx context-first-cli@latest feature start PROJ-123
466
+ ```bash
467
+ # Start feature
468
+ npx context-first-cli@latest feature start SAAS-456
257
469
 
258
- # 6. Switch to the new workspace directory to begin work
259
- cd .sessions/PROJ-123/
470
+ # Enter workspace
471
+ cd .sessions/SAAS-456
472
+
473
+ # Start services
474
+ docker-compose up -d
475
+
476
+ # Work
260
477
  code .
261
- # All selected repositories are now checked out here as worktrees!
478
+
479
+ # Stop services
480
+ docker-compose down
481
+
482
+ # Merge and clean up
483
+ cd ../..
484
+ npx context-first-cli@latest feature merge SAAS-456
485
+ ```
486
+
487
+ ### Example 3: Parallel Development
488
+
489
+ ```bash
490
+ # Developer working on two features simultaneously
491
+
492
+ # Feature 1
493
+ npx context-first-cli@latest feature start FIN-11
494
+ cd .sessions/FIN-11
495
+ docker-compose up -d
496
+ # Backend at http://localhost:3011
497
+
498
+ # Feature 2 (in another terminal)
499
+ cd ~/my-orchestrator
500
+ npx context-first-cli@latest feature start FIN-12
501
+ cd .sessions/FIN-12
502
+ docker-compose up -d
503
+ # Backend at http://localhost:3012
504
+
505
+ # Both running simultaneously! No conflicts!
506
+ ```
507
+
508
+ ---
509
+
510
+ ## Troubleshooting
511
+
512
+ ### Issue: "Workspace already exists"
513
+
514
+ **Cause**: You already created a workspace for this issue.
515
+
516
+ **Solution**:
517
+ ```bash
518
+ # Option 1: Use existing workspace
519
+ cd .sessions/FIN-123
520
+
521
+ # Option 2: Clean up and recreate
522
+ npx context-first-cli@latest feature end FIN-123
523
+ npx context-first-cli@latest feature start FIN-123
524
+ ```
525
+
526
+ ### Issue: "Repository not found"
527
+
528
+ **Cause**: Repository doesn't exist in `base_path`.
529
+
530
+ **Solution**:
531
+ ```bash
532
+ # Option 1: Clone manually
533
+ cd ~/dev
534
+ git clone <repo-url> <repo-folder-name>
535
+
536
+ # Option 2: Enable auto_clone
537
+ # Edit ai.properties.md:
538
+ auto_clone=true
539
+ ```
540
+
541
+ ### Issue: "Branch already in use"
542
+
543
+ **Cause**: Main repository is on the feature branch.
544
+
545
+ **Solution**:
546
+ ```bash
547
+ # Go to main repository
548
+ cd ~/dev/<repo-name>
549
+
550
+ # Switch to main branch
551
+ git checkout main
552
+
553
+ # Try again
554
+ cd ~/orchestrator
555
+ npx context-first-cli@latest feature start FIN-123
556
+ ```
557
+
558
+ ### Issue: "Port already in use"
559
+
560
+ **Cause**: Another workspace with same issue number is running.
561
+
562
+ **Solution**:
563
+ ```bash
564
+ # Stop other workspace
565
+ cd .sessions/FIN-123
566
+ docker-compose down
567
+
568
+ # Or use different issue number
569
+ ```
570
+
571
+ ### Issue: "Docker containers not stopping"
572
+
573
+ **Cause**: `feature end` failed to stop containers.
574
+
575
+ **Solution**:
576
+ ```bash
577
+ # Manually stop containers
578
+ cd .sessions/FIN-123
579
+ docker-compose down -v
580
+
581
+ # Then clean up workspace
582
+ cd ../..
583
+ npx context-first-cli@latest feature end FIN-123
262
584
  ```
263
585
 
264
586
  ---
265
587
 
266
- ## 📝 License
588
+ ## Advanced Usage
589
+
590
+ ### Custom Docker Ports
591
+
592
+ Edit `ai.properties.md`:
267
593
 
268
- MIT
594
+ ```markdown
595
+ docker.backend_base_port=4000
596
+ docker.frontend_base_port=9000
597
+ docker.postgres_base_port=6000
598
+ docker.redis_base_port=7000
599
+ ```
600
+
601
+ Now FIN-11 will use ports 4011, 9011, 6011, 7011.
602
+
603
+ ### Merge Options
604
+
605
+ ```bash
606
+ # Merge to develop instead of main
607
+ npx context-first-cli@latest feature merge FIN-123 --target-branch develop
608
+
609
+ # Merge without pushing (review first)
610
+ npx context-first-cli@latest feature merge FIN-123 --no-push
611
+
612
+ # Keep workspace after merge
613
+ npx context-first-cli@latest feature merge FIN-123 --keep-workspace
614
+
615
+ # Force merge without confirmation
616
+ npx context-first-cli@latest feature merge FIN-123 --force
617
+ ```
618
+
619
+ ### Update Commands
620
+
621
+ When CLI is updated, refresh AI command templates:
622
+
623
+ ```bash
624
+ cd ~/orchestrator
625
+ npx context-first-cli@latest update:commands
626
+ ```
627
+
628
+ ---
629
+
630
+ ## Contributing
631
+
632
+ Contributions are welcome! Please open an issue or PR on [GitHub](https://github.com/thatix-io/context-first-cli).
633
+
634
+ ---
635
+
636
+ ## License
637
+
638
+ MIT © [Thiago Abreu](https://github.com/thatix-io)
269
639
 
270
640
  ---
271
641
 
272
- ## 🔗 Links
642
+ ## Links
643
+
644
+ - **NPM**: https://www.npmjs.com/package/context-first-cli
645
+ - **GitHub**: https://github.com/thatix-io/context-first-cli
646
+ - **Issues**: https://github.com/thatix-io/context-first-cli/issues
647
+ - **Documentation**: https://github.com/thatix-io/context-first-cli#readme
648
+
649
+ ---
273
650
 
274
- - **NPM Package**: https://www.npmjs.com/package/context-first-cli
275
- - **GitHub Repository**: https://github.com/thatix-io/context-first-cli
276
- - **Issues & Support**: https://github.com/thatix-io/context-first-cli/issues
651
+ **Made with ❤️ for developers who value context and efficiency.**
@@ -128,30 +128,34 @@ Refs: <ISSUE-ID>"
128
128
 
129
129
  **Tipos de commit**: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
130
130
 
131
- ### 5. Documentação da Sessão
131
+ ### 5. Atualização do Plan.md
132
132
 
133
- Atualize `./.sessions/<ISSUE-ID>/work.md`:
133
+ **A CADA tarefa completada**, atualize `./.sessions/<ISSUE-ID>/plan.md`:
134
134
 
135
135
  ```markdown
136
- # [Título da Feature] - Trabalho Executado
137
-
138
- ## [Data/Hora] - [Descrição da Unidade]
139
-
140
- ### Repositórios Modificados
141
- - **repo-1**: [Arquivos modificados e o que foi feito]
142
- - **repo-2**: [Arquivos modificados e o que foi feito]
143
-
144
- ### Decisões Tomadas
145
- - [Decisão 1 e justificativa]
146
- - [Decisão 2 e justificativa]
147
-
148
- ### Testes Adicionados
149
- - [Descrição dos testes]
150
-
151
- ### Próxima Unidade
152
- - [O que será feito a seguir]
136
+ #### 1.1 - [Nome da Tarefa] [Completada ✅]
137
+ - [Detalhe 1]
138
+ - [Detalhe 2]
139
+ - [Detalhe 3]
140
+
141
+ **Arquivos**:
142
+ - `path/to/file1.ts`
143
+ - `path/to/file2.vue` ✅
144
+
145
+ **Testes**:
146
+ - Unit test: [Descrição]
147
+ - Integration test: [Descrição] ✅
148
+
149
+ **Comentários**:
150
+ - Decisão: [Explicação de decisão técnica importante]
151
+ - Aprendizado: [Algo aprendido durante implementação]
153
152
  ```
154
153
 
154
+ **Marque status das tarefas**:
155
+ - `[Não Iniciada ⏳]` - Tarefa ainda não começou
156
+ - `[Em Progresso ⏰]` - Tarefa sendo trabalhada agora
157
+ - `[Completada ✅]` - Tarefa finalizada e validada
158
+
155
159
  ## 🔍 Checklist de Qualidade
156
160
 
157
161
  Antes de considerar a unidade completa:
@@ -160,7 +164,7 @@ Antes de considerar a unidade completa:
160
164
  - [ ] Linting/formatação OK
161
165
  - [ ] Documentação atualizada (se necessário)
162
166
  - [ ] Commit realizado em todos os repos afetados
163
- - [ ] Sessão documentada
167
+ - [ ] `plan.md` atualizado com progresso e comentários
164
168
 
165
169
  ## ⚠️ Princípio Jidoka
166
170
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-first-cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "A generic CLI to manage the Context-First development methodology across any project.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -128,30 +128,34 @@ Refs: <ISSUE-ID>"
128
128
 
129
129
  **Tipos de commit**: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
130
130
 
131
- ### 5. Documentação da Sessão
131
+ ### 5. Atualização do Plan.md
132
132
 
133
- Atualize `./.sessions/<ISSUE-ID>/work.md`:
133
+ **A CADA tarefa completada**, atualize `./.sessions/<ISSUE-ID>/plan.md`:
134
134
 
135
135
  ```markdown
136
- # [Título da Feature] - Trabalho Executado
137
-
138
- ## [Data/Hora] - [Descrição da Unidade]
139
-
140
- ### Repositórios Modificados
141
- - **repo-1**: [Arquivos modificados e o que foi feito]
142
- - **repo-2**: [Arquivos modificados e o que foi feito]
143
-
144
- ### Decisões Tomadas
145
- - [Decisão 1 e justificativa]
146
- - [Decisão 2 e justificativa]
147
-
148
- ### Testes Adicionados
149
- - [Descrição dos testes]
150
-
151
- ### Próxima Unidade
152
- - [O que será feito a seguir]
136
+ #### 1.1 - [Nome da Tarefa] [Completada ✅]
137
+ - [Detalhe 1]
138
+ - [Detalhe 2]
139
+ - [Detalhe 3]
140
+
141
+ **Arquivos**:
142
+ - `path/to/file1.ts`
143
+ - `path/to/file2.vue` ✅
144
+
145
+ **Testes**:
146
+ - Unit test: [Descrição]
147
+ - Integration test: [Descrição] ✅
148
+
149
+ **Comentários**:
150
+ - Decisão: [Explicação de decisão técnica importante]
151
+ - Aprendizado: [Algo aprendido durante implementação]
153
152
  ```
154
153
 
154
+ **Marque status das tarefas**:
155
+ - `[Não Iniciada ⏳]` - Tarefa ainda não começou
156
+ - `[Em Progresso ⏰]` - Tarefa sendo trabalhada agora
157
+ - `[Completada ✅]` - Tarefa finalizada e validada
158
+
155
159
  ## 🔍 Checklist de Qualidade
156
160
 
157
161
  Antes de considerar a unidade completa:
@@ -160,7 +164,7 @@ Antes de considerar a unidade completa:
160
164
  - [ ] Linting/formatação OK
161
165
  - [ ] Documentação atualizada (se necessário)
162
166
  - [ ] Commit realizado em todos os repos afetados
163
- - [ ] Sessão documentada
167
+ - [ ] `plan.md` atualizado com progresso e comentários
164
168
 
165
169
  ## ⚠️ Princípio Jidoka
166
170