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 +524 -149
- package/dist/templates/commands/engineer/work.md +24 -20
- package/package.json +1 -1
- package/templates/commands/engineer/work.md +24 -20
package/README.md
CHANGED
|
@@ -1,276 +1,651 @@
|
|
|
1
1
|
# Context-First CLI
|
|
2
2
|
|
|
3
|
-
A
|
|
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
|
+
[](https://www.npmjs.com/package/context-first-cli)
|
|
8
|
+
[](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
|
-
##
|
|
70
|
+
## Core Concepts
|
|
8
71
|
|
|
9
|
-
|
|
72
|
+
### 1. Orchestrator Repository
|
|
10
73
|
|
|
11
|
-
|
|
74
|
+
The **single source of truth** for your project's development process.
|
|
12
75
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
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.
|
|
100
|
+
### 3. Git Worktree
|
|
28
101
|
|
|
29
|
-
|
|
102
|
+
**Efficient branch management** without multiple clones.
|
|
103
|
+
|
|
104
|
+
**How it works**:
|
|
105
|
+
```
|
|
106
|
+
Main Repository (~/dev/backend):
|
|
107
|
+
└── main branch
|
|
30
108
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
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
|
-
##
|
|
120
|
+
## Installation
|
|
38
121
|
|
|
39
|
-
|
|
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
|
-
##
|
|
142
|
+
## Commands
|
|
48
143
|
|
|
49
144
|
### Setup Commands
|
|
50
145
|
|
|
51
146
|
| Command | Description |
|
|
52
|
-
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
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
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
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
|
-
###
|
|
164
|
+
### Utility Commands
|
|
70
165
|
|
|
71
166
|
| Command | Description |
|
|
72
|
-
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
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
|
-
##
|
|
79
|
-
|
|
80
|
-
The primary workflow is designed to be simple and centralized within the Orchestrator.
|
|
174
|
+
## Workflow Guide
|
|
81
175
|
|
|
82
|
-
###
|
|
176
|
+
### Initial Setup (Once Per Project)
|
|
83
177
|
|
|
84
|
-
|
|
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
|
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
198
|
+
#### Step 2: Configure Local Environment
|
|
100
199
|
|
|
101
200
|
```bash
|
|
102
|
-
cd
|
|
201
|
+
cd my-project-orchestrator/
|
|
103
202
|
npx context-first-cli@latest config:setup
|
|
104
203
|
```
|
|
105
204
|
|
|
106
|
-
|
|
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
|
-
|
|
210
|
+
**Creates**: `ai.properties.md` with your local settings
|
|
109
211
|
|
|
110
|
-
|
|
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
|
-
|
|
218
|
+
**Prompts**:
|
|
219
|
+
- Repository folder name (e.g., `backend`)
|
|
220
|
+
- Git URL
|
|
221
|
+
- Role: `backend`, `frontend`, `metaspecs`, or `other`
|
|
222
|
+
- Description
|
|
118
223
|
|
|
119
|
-
|
|
224
|
+
**Repeat** for each repository in your project.
|
|
120
225
|
|
|
121
|
-
|
|
226
|
+
#### Step 4: Commit Orchestrator
|
|
122
227
|
|
|
123
228
|
```bash
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
239
|
+
#### Start Feature
|
|
137
240
|
|
|
138
|
-
**Running Services:**
|
|
139
241
|
```bash
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
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
|
-
|
|
150
|
-
|
|
255
|
+
cd .sessions/FIN-123
|
|
256
|
+
```
|
|
151
257
|
|
|
152
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
260
|
+
```bash
|
|
261
|
+
docker-compose up -d
|
|
262
|
+
```
|
|
159
263
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
284
|
+
#### Stop Services
|
|
285
|
+
|
|
173
286
|
```bash
|
|
174
|
-
|
|
175
|
-
|
|
287
|
+
docker-compose down
|
|
288
|
+
```
|
|
176
289
|
|
|
177
|
-
|
|
178
|
-
npx context-first-cli@latest feature merge FIN-123 --no-push
|
|
290
|
+
#### Finish Feature
|
|
179
291
|
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
184
|
-
|
|
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
|
-
##
|
|
308
|
+
## Docker Support
|
|
309
|
+
|
|
310
|
+
### Automatic Generation
|
|
190
311
|
|
|
191
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
314
|
+
- **Backend** (if `role: "backend"` exists)
|
|
315
|
+
- **Frontend** (if `role: "frontend"` exists)
|
|
316
|
+
- **PostgreSQL** (always included)
|
|
317
|
+
- **Redis** (always included)
|
|
201
318
|
|
|
202
|
-
|
|
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
|
-
|
|
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
|
-
|
|
330
|
+
### Configuration
|
|
221
331
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
##
|
|
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
|
-
#
|
|
433
|
+
# Create orchestrator
|
|
232
434
|
npx context-first-cli@latest create:orchestrator
|
|
233
|
-
#
|
|
435
|
+
# Name: my-saas-orchestrator
|
|
436
|
+
# Description: SaaS project orchestrator
|
|
234
437
|
|
|
235
|
-
#
|
|
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
|
-
#
|
|
447
|
+
# Add repositories
|
|
242
448
|
npx context-first-cli@latest add:repo
|
|
243
|
-
#
|
|
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
|
-
#
|
|
454
|
+
# Folder name: my-saas-frontend
|
|
455
|
+
# URL: git@github.com:myorg/my-saas-frontend.git
|
|
456
|
+
# Role: frontend
|
|
247
457
|
|
|
248
|
-
#
|
|
458
|
+
# Commit
|
|
249
459
|
git add .
|
|
250
|
-
git commit -m "feat:
|
|
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
|
-
|
|
255
|
-
#
|
|
256
|
-
npx context-first-cli@latest feature start
|
|
466
|
+
```bash
|
|
467
|
+
# Start feature
|
|
468
|
+
npx context-first-cli@latest feature start SAAS-456
|
|
257
469
|
|
|
258
|
-
#
|
|
259
|
-
cd .sessions/
|
|
470
|
+
# Enter workspace
|
|
471
|
+
cd .sessions/SAAS-456
|
|
472
|
+
|
|
473
|
+
# Start services
|
|
474
|
+
docker-compose up -d
|
|
475
|
+
|
|
476
|
+
# Work
|
|
260
477
|
code .
|
|
261
|
-
|
|
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
|
-
##
|
|
588
|
+
## Advanced Usage
|
|
589
|
+
|
|
590
|
+
### Custom Docker Ports
|
|
591
|
+
|
|
592
|
+
Edit `ai.properties.md`:
|
|
267
593
|
|
|
268
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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.
|
|
131
|
+
### 5. Atualização do Plan.md
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
**A CADA tarefa completada**, atualize `./.sessions/<ISSUE-ID>/plan.md`:
|
|
134
134
|
|
|
135
135
|
```markdown
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
- [ ]
|
|
167
|
+
- [ ] `plan.md` atualizado com progresso e comentários
|
|
164
168
|
|
|
165
169
|
## ⚠️ Princípio Jidoka
|
|
166
170
|
|
package/package.json
CHANGED
|
@@ -128,30 +128,34 @@ Refs: <ISSUE-ID>"
|
|
|
128
128
|
|
|
129
129
|
**Tipos de commit**: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
|
|
130
130
|
|
|
131
|
-
### 5.
|
|
131
|
+
### 5. Atualização do Plan.md
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
**A CADA tarefa completada**, atualize `./.sessions/<ISSUE-ID>/plan.md`:
|
|
134
134
|
|
|
135
135
|
```markdown
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
- [ ]
|
|
167
|
+
- [ ] `plan.md` atualizado com progresso e comentários
|
|
164
168
|
|
|
165
169
|
## ⚠️ Princípio Jidoka
|
|
166
170
|
|