@rlarua/agentteams-cli 0.0.10 → 0.0.11

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.
Files changed (109) hide show
  1. package/API-CLI-WORKFLOW.md +418 -0
  2. package/README.md +117 -2
  3. package/dist/api/comment.d.ts +11 -0
  4. package/dist/api/comment.d.ts.map +1 -0
  5. package/dist/api/comment.js +33 -0
  6. package/dist/api/comment.js.map +1 -0
  7. package/dist/api/plan.d.ts +13 -0
  8. package/dist/api/plan.d.ts.map +1 -0
  9. package/dist/api/plan.js +43 -0
  10. package/dist/api/plan.js.map +1 -0
  11. package/dist/api/postmortem.d.ts +6 -0
  12. package/dist/api/postmortem.d.ts.map +1 -0
  13. package/dist/api/postmortem.js +33 -0
  14. package/dist/api/postmortem.js.map +1 -0
  15. package/dist/api/report.d.ts +6 -0
  16. package/dist/api/report.d.ts.map +1 -0
  17. package/dist/api/report.js +33 -0
  18. package/dist/api/report.js.map +1 -0
  19. package/dist/api/status.d.ts +12 -0
  20. package/dist/api/status.d.ts.map +1 -0
  21. package/dist/api/status.js +33 -0
  22. package/dist/api/status.js.map +1 -0
  23. package/dist/commands/agentConfig.d.ts.map +1 -1
  24. package/dist/commands/agentConfig.js +10 -3
  25. package/dist/commands/agentConfig.js.map +1 -1
  26. package/dist/commands/agentConfigCommand.d.ts +2 -0
  27. package/dist/commands/agentConfigCommand.d.ts.map +1 -0
  28. package/dist/commands/agentConfigCommand.js +20 -0
  29. package/dist/commands/agentConfigCommand.js.map +1 -0
  30. package/dist/commands/comment.d.ts +2 -0
  31. package/dist/commands/comment.d.ts.map +1 -0
  32. package/dist/commands/comment.js +55 -0
  33. package/dist/commands/comment.js.map +1 -0
  34. package/dist/commands/config.d.ts +2 -0
  35. package/dist/commands/config.d.ts.map +1 -0
  36. package/dist/commands/config.js +30 -0
  37. package/dist/commands/config.js.map +1 -0
  38. package/dist/commands/convention.d.ts +25 -0
  39. package/dist/commands/convention.d.ts.map +1 -1
  40. package/dist/commands/convention.js +459 -17
  41. package/dist/commands/convention.js.map +1 -1
  42. package/dist/commands/conventionRouter.d.ts +3 -0
  43. package/dist/commands/conventionRouter.d.ts.map +1 -0
  44. package/dist/commands/conventionRouter.js +46 -0
  45. package/dist/commands/conventionRouter.js.map +1 -0
  46. package/dist/commands/dependency.d.ts.map +1 -1
  47. package/dist/commands/dependency.js +2 -1
  48. package/dist/commands/dependency.js.map +1 -1
  49. package/dist/commands/dependencyCommand.d.ts +2 -0
  50. package/dist/commands/dependencyCommand.d.ts.map +1 -0
  51. package/dist/commands/dependencyCommand.js +27 -0
  52. package/dist/commands/dependencyCommand.js.map +1 -0
  53. package/dist/commands/index.d.ts.map +1 -1
  54. package/dist/commands/index.js +14 -592
  55. package/dist/commands/index.js.map +1 -1
  56. package/dist/commands/plan.d.ts +11 -0
  57. package/dist/commands/plan.d.ts.map +1 -0
  58. package/dist/commands/plan.js +370 -0
  59. package/dist/commands/plan.js.map +1 -0
  60. package/dist/commands/postmortem.d.ts +2 -0
  61. package/dist/commands/postmortem.d.ts.map +1 -0
  62. package/dist/commands/postmortem.js +114 -0
  63. package/dist/commands/postmortem.js.map +1 -0
  64. package/dist/commands/report.d.ts +2 -0
  65. package/dist/commands/report.d.ts.map +1 -0
  66. package/dist/commands/report.js +221 -0
  67. package/dist/commands/report.js.map +1 -0
  68. package/dist/commands/status.d.ts +2 -0
  69. package/dist/commands/status.d.ts.map +1 -0
  70. package/dist/commands/status.js +60 -0
  71. package/dist/commands/status.js.map +1 -0
  72. package/dist/index.js +212 -34
  73. package/dist/index.js.map +1 -1
  74. package/dist/types/index.d.ts +11 -6
  75. package/dist/types/index.d.ts.map +1 -1
  76. package/dist/utils/errors.d.ts.map +1 -1
  77. package/dist/utils/errors.js +60 -6
  78. package/dist/utils/errors.js.map +1 -1
  79. package/dist/utils/formatter.js +11 -1
  80. package/dist/utils/formatter.js.map +1 -1
  81. package/dist/utils/git.d.ts +19 -0
  82. package/dist/utils/git.d.ts.map +1 -0
  83. package/dist/utils/git.js +41 -0
  84. package/dist/utils/git.js.map +1 -0
  85. package/dist/utils/httpHeaders.d.ts +3 -0
  86. package/dist/utils/httpHeaders.d.ts.map +1 -0
  87. package/dist/utils/httpHeaders.js +11 -0
  88. package/dist/utils/httpHeaders.js.map +1 -0
  89. package/dist/utils/initOutput.d.ts +3 -0
  90. package/dist/utils/initOutput.d.ts.map +1 -0
  91. package/dist/utils/initOutput.js +34 -0
  92. package/dist/utils/initOutput.js.map +1 -0
  93. package/dist/utils/legacyCompat.d.ts +3 -0
  94. package/dist/utils/legacyCompat.d.ts.map +1 -0
  95. package/dist/utils/legacyCompat.js +20 -0
  96. package/dist/utils/legacyCompat.js.map +1 -0
  97. package/dist/utils/outputPolicy.d.ts +12 -0
  98. package/dist/utils/outputPolicy.d.ts.map +1 -0
  99. package/dist/utils/outputPolicy.js +132 -0
  100. package/dist/utils/outputPolicy.js.map +1 -0
  101. package/dist/utils/parsers.d.ts +7 -0
  102. package/dist/utils/parsers.d.ts.map +1 -0
  103. package/dist/utils/parsers.js +52 -0
  104. package/dist/utils/parsers.js.map +1 -0
  105. package/dist/utils/planFormat.d.ts +17 -0
  106. package/dist/utils/planFormat.d.ts.map +1 -0
  107. package/dist/utils/planFormat.js +80 -0
  108. package/dist/utils/planFormat.js.map +1 -0
  109. package/package.json +4 -1
@@ -0,0 +1,418 @@
1
+ ---
2
+ trigger:
3
+ description:
4
+ agentInstruction: |
5
+ 본 문서는 한국어로 작성해주세요.
6
+ ---
7
+ # API ↔ CLI 워크플로우
8
+
9
+ 이 문서는 AgentTeams CLI(`agentteams`)가 API 서버와 어떻게 통신하는지, 그리고 그 결과로 로컬 워크스페이스에 어떤 파일이 생성/업데이트되는지를 설명합니다.
10
+
11
+ ## 범위(Scope)
12
+
13
+ - CLI 인증/설정(config) 로딩 규칙
14
+ - 요청/응답 컨벤션(엔벨로프, 페이지네이션)
15
+ - 엔드투엔드 흐름(Plan → Comments/Status → Completion Report → Postmortem)
16
+ - CLI가 생성하는 로컬 파일 위치 및 역할
17
+ - (추가) 공통 출력 UX(`--output-file`, `--verbose`)와 단축 워크플로우(`plan start/finish`)
18
+
19
+ > 최종 소스 오브 트루스는 코드입니다. 이 문서는 운영/사용 가이드입니다.
20
+
21
+ ---
22
+
23
+ ## 구성 요소와 책임
24
+
25
+ - CLI(`/cli`)
26
+ - 커맨드 파싱: `commander`
27
+ - HTTP 호출: `axios`
28
+ - 설정 로딩: `.agentteams/config.json`, `~/.agentteams/config.json`, `AGENTTEAMS_*`
29
+ - 로컬 아티팩트 생성: 플랜 스냅샷(runbook), 컨벤션/가이드 다운로드 파일
30
+ - (추가) 공통 출력 UX: `--output-file`, `--verbose`
31
+ - (추가) 단축 워크플로우: `agentteams plan start|finish`
32
+ - API(`/api`)
33
+ - REST API: Fastify
34
+ - 인증/권한: 주로 `X-API-Key` 기반
35
+ - DB 접근: Prisma
36
+ - Swagger UI: `/docs`
37
+
38
+ ---
39
+
40
+ ## 인증(Authentication)과 설정(Config) 로딩
41
+
42
+ ### `agentteams init` (최초 설정)
43
+
44
+ 개요 흐름:
45
+
46
+ 1. 로컬 OAuth 콜백 서버를 실행합니다.
47
+ 2. 브라우저에서 authorize 페이지를 엽니다(SSH 환경에서는 URL을 출력).
48
+ 3. `apiUrl`, `apiKey`, `teamId`, `projectId`, `agentName`을 수신하고 로컬에 저장합니다.
49
+ 4. 컨벤션 템플릿을 `.agentteams/convention.md`로 저장합니다.
50
+ 5. 컨벤션/플랫폼 가이드를 `.agentteams/*`로 다운로드합니다.
51
+
52
+ ```mermaid
53
+ sequenceDiagram
54
+ participant U as "User"
55
+ participant CLI as "CLI (agentteams)"
56
+ participant WEB as "Web (Authorize)"
57
+ participant API as "API"
58
+ participant FS as "Local FS"
59
+
60
+ U->>CLI: agentteams init
61
+ CLI->>CLI: Start local OAuth callback server
62
+ CLI->>WEB: Open/print authorize URL
63
+ WEB->>CLI: OAuth callback (auth result)
64
+ CLI->>FS: Write .agentteams/config.json
65
+ CLI->>API: Fetch convention template
66
+ API-->>CLI: template(content)
67
+ CLI->>FS: Write .agentteams/convention.md
68
+ CLI->>API: Download conventions
69
+ API-->>CLI: conventions (+ platform guides)
70
+ CLI->>FS: Write .agentteams/<category>/*.md and manifest
71
+ ```
72
+
73
+ ### 설정 우선순위(높음 → 낮음)
74
+
75
+ 1. CLI option overrides (some commands only)
76
+ 2. Env vars `AGENTTEAMS_*`
77
+ 3. Project config: nearest `.agentteams/config.json` found by walking up from `cwd`
78
+ 4. Global config: `~/.agentteams/config.json`
79
+
80
+ 지원 환경변수:
81
+
82
+ - `AGENTTEAMS_API_KEY`
83
+ - `AGENTTEAMS_API_URL`
84
+ - `AGENTTEAMS_TEAM_ID`
85
+ - `AGENTTEAMS_PROJECT_ID`
86
+ - `AGENTTEAMS_AGENT_NAME`
87
+
88
+ ### 기본 요청 헤더
89
+
90
+ - `X-API-Key: key_...`
91
+ - `Content-Type: application/json`
92
+
93
+ 예외:
94
+
95
+ - `DELETE` 요청은 서버의 빈 JSON body 검증 충돌을 피하기 위해 `Content-Type`을 포함하지 않습니다.
96
+
97
+ API는 다음 중 하나를 허용합니다:
98
+
99
+ - `Authorization: Bearer <token>`
100
+ - `X-API-Key: key_...` (API keys must have the `key_` prefix)
101
+
102
+ ---
103
+
104
+ ## 공통 API 컨벤션
105
+
106
+ ### Base URL
107
+
108
+ The CLI calls `{apiUrl}/api/...`.
109
+
110
+ Example: `GET {apiUrl}/api/projects/{projectId}/plans`
111
+
112
+ ### Response envelopes
113
+
114
+ - Single: `{ data: {...} }`
115
+ - List: `{ data: [...], meta: {...} }`
116
+ - Error: `{ statusCode, error, message, errorCode? }`
117
+
118
+ 에러 응답의 `errorCode`는 선택 필드이며, CLI는 `errorCode`가 있을 때 이를 우선 사용해 에러를 분기합니다.
119
+ `errorCode`가 없는 구버전/부분 적용 응답에서는 기존 `statusCode + message` 기반 동작으로 fallback합니다.
120
+
121
+ ### Pagination
122
+
123
+ Many list endpoints accept `page` and `pageSize`.
124
+
125
+ ---
126
+
127
+ ## 공통 출력 UX(추가)
128
+
129
+ ### `--output-file <path>` / `--verbose`
130
+
131
+ 대상(주요 커맨드 전반): `init`, `sync`, `status`, `plan`, `comment`, `report`, `postmortem`, `dependency`, `agent-config`, `config`, `convention`
132
+
133
+ - `--output-file <path>`
134
+ - “원래 stdout에 출력될 전체 결과”를 지정한 파일에 그대로 저장합니다.
135
+ - stdout에는 기본적으로 **요약 1~3줄**만 출력합니다.
136
+ - 상대 경로는 `cwd` 기준이며 내부에서 `path.resolve`로 절대경로로 변환합니다.
137
+ - 부모 디렉토리가 없으면 생성합니다.
138
+ - `--verbose`
139
+ - `--output-file`과 함께 사용하면 stdout에도 전체 결과를 출력합니다(파일 저장은 유지).
140
+
141
+ 요약 출력은 기본 영어 메시지로 출력됩니다(자동화/로그 파싱 관점에서 고정된 문구를 선호).
142
+
143
+ text 출력에서 객체 필드는 핵심 식별 필드(`id/title/status/priority/updatedAt/createdAt`)를 우선 표시한 뒤 나머지를 정렬해 출력합니다.
144
+
145
+ ---
146
+
147
+ ## 커맨드별 워크플로우
148
+
149
+ ### Plan
150
+
151
+ - Create: `POST /api/projects/:projectId/plans`
152
+ - Plans are always created as `DRAFT` (server-enforced). Even if a client sends `status`, it will be ignored on creation.
153
+ - Use `--content` or `--file` for the body.
154
+ - `--template refactor-minimal`로 최소 리팩터링 체크리스트 본문을 자동 채울 수 있습니다(내용이 비어 있을 때).
155
+ - 멀티라인을 `--content`로 전달해야 하는 경우, `--interpret-escapes`를 사용하면 `\\n` 시퀀스를 실제 줄바꿈으로 변환합니다(기본 OFF).
156
+ - Get alias: `plan show --id <id>`는 `plan get --id <id>`와 동일 동작입니다.
157
+ - Include dependencies: `plan get|show --id <id> --include-deps`
158
+ - 내부적으로 `GET /plans/:id` + `GET /plans/:id/dependencies`를 호출해 응답을 합성합니다.
159
+ - `--format json`: `data.dependencies = { blocking: [...], dependents: [...] }`
160
+ - `--format text`: Plan 필드 출력 뒤 `## Dependencies` 섹션을 추가합니다.
161
+ - Download snapshot: `GET /api/projects/:projectId/plans/:id`
162
+ - Saved to `.agentteams/active-plan/{safe-title}.md` with frontmatter.
163
+ - (추가) 단축 커맨드
164
+ - `agentteams plan start --id <planId>`
165
+ - 내부적으로 `GET /plans/:id` → `PUT /plans/:id(status=IN_PROGRESS)` → `POST /agent-statuses(status=IN_PROGRESS)`를 순서대로 호출합니다.
166
+ - 플랜이 `DRAFT`인 경우, UX 개선을 위해 `DRAFT → PENDING → IN_PROGRESS`로 자동 승격합니다.
167
+ - `agentteams plan finish --id <planId>`
168
+ - 내부적으로 `GET /plans/:id` → `PUT /plans/:id(status=DONE)` → `POST /agent-statuses(status=DONE)`를 순서대로 호출합니다.
169
+
170
+ ### Comment (plan-scoped)
171
+
172
+ - List: `GET /api/projects/:projectId/plans/:planId/comments`
173
+ - Create: `POST /api/projects/:projectId/plans/:planId/comments`
174
+ - Get/Update/Delete by ID: `GET/PUT/DELETE /api/projects/:projectId/comments/:id`
175
+
176
+ Types: `RISK`, `MODIFICATION`, `GENERAL`
177
+
178
+ ### Status
179
+
180
+ - Report: `POST /api/projects/:projectId/agent-statuses`
181
+ - List/Get/Update/Delete: `GET/PUT/DELETE /api/projects/:projectId/agent-statuses...`
182
+
183
+ ### Convention
184
+
185
+ Convention commands are tightly coupled to `.agentteams/`.
186
+
187
+ - Sync download: `agentteams sync` (internally runs `convention download`)
188
+ - Writes conventions and platform guides under `.agentteams/`
189
+ - Updates `.agentteams/conventions.manifest.json`
190
+ - Create/Update/Delete: `agentteams convention create|update|delete`
191
+ - Files are expected under `.agentteams/<category>/...`
192
+ - `update/delete` default to a non-destructive preview; use `--apply` to execute.
193
+
194
+ ### Completion report / Postmortem
195
+
196
+ - Completion reports: `.../completion-reports`
197
+ - Postmortems: `.../post-mortems`
198
+
199
+ CLI supports `--api-url`, `--api-key`, `--team-id`, `--project-id`, `--agent-name` overrides for environments without local config.
200
+
201
+ #### (추가) `report create`의 템플릿/Deprecated 옵션
202
+
203
+ - `--template minimal`
204
+ - `--content`가 없을 때 최소 템플릿을 자동으로 채워서 생성할 수 있습니다.
205
+ - Deprecated(호환 유지, 경고 출력)
206
+ - `--summary`: `--title`의 별칭(Deprecated)
207
+ - `--details`: `--content`가 없을 때 Details 섹션으로 삽입(Deprecated)
208
+
209
+ ---
210
+
211
+ ## CLI가 생성/관리하는 로컬 파일
212
+
213
+ - Project config: `.agentteams/config.json`
214
+ - Global config: `~/.agentteams/config.json`
215
+ - Convention template: `.agentteams/convention.md`
216
+ - Download manifest: `.agentteams/conventions.manifest.json`
217
+ - Plan snapshots: `.agentteams/active-plan/*.md`
218
+ - Output capture: `--output-file <path>`로 지정한 임의 경로(사용자 지정)
219
+
220
+ ---
221
+
222
+ ## 엔드투엔드: plan 생성 → 완료 보고서
223
+
224
+ ```mermaid
225
+ sequenceDiagram
226
+ participant U as "User/Agent"
227
+ participant CLI as "CLI (agentteams)"
228
+ participant API as "API"
229
+ participant FS as "Local FS"
230
+
231
+ U->>CLI: plan create (title, content, priority)
232
+ CLI->>API: POST /api/projects/:projectId/plans
233
+ API-->>CLI: { data: plan(status=DRAFT) }
234
+
235
+ U->>CLI: plan update --status IN_PROGRESS
236
+ CLI->>API: PUT /api/projects/:projectId/plans/:id
237
+ API-->>CLI: { data: plan }
238
+
239
+ U->>CLI: plan download --id {planId}
240
+ CLI->>API: GET /api/projects/:projectId/plans/:id
241
+ API-->>CLI: { data: plan(contentMarkdown) }
242
+ CLI->>FS: Write .agentteams/active-plan/{safe-title}.md
243
+
244
+ U->>CLI: comment create --type RISK|MODIFICATION|GENERAL
245
+ CLI->>API: POST /api/projects/:projectId/plans/:planId/comments
246
+ API-->>CLI: { data: comment }
247
+
248
+ U->>CLI: status report --status IN_PROGRESS|DONE|BLOCKED
249
+ CLI->>API: POST /api/projects/:projectId/agent-statuses
250
+ API-->>CLI: { data: status }
251
+
252
+ U->>CLI: plan update --status DONE
253
+ CLI->>API: PUT /api/projects/:projectId/plans/:id
254
+ API-->>CLI: { data: plan }
255
+
256
+ U->>CLI: report create --plan-id {planId}
257
+ CLI->>API: POST /api/projects/:projectId/completion-reports
258
+ API-->>CLI: { data: report }
259
+ ```
260
+
261
+ ## 엔드투엔드(추가): plan start / plan finish
262
+
263
+ ```mermaid
264
+ sequenceDiagram
265
+ participant U as "User/Agent"
266
+ participant CLI as "CLI (agentteams)"
267
+ participant API as "API"
268
+
269
+ U->>CLI: plan start --id {planId}
270
+ CLI->>API: GET /api/projects/:projectId/plans/:id
271
+ API-->>CLI: { data: plan(title, ...) }
272
+ CLI->>API: PUT /api/projects/:projectId/plans/:id (status=PENDING) %% only when current status is DRAFT
273
+ API-->>CLI: { data: plan }
274
+ CLI->>API: PUT /api/projects/:projectId/plans/:id (status=IN_PROGRESS)
275
+ API-->>CLI: { data: plan }
276
+ CLI->>API: POST /api/projects/:projectId/agent-statuses (IN_PROGRESS)
277
+ API-->>CLI: { data: status }
278
+
279
+ U->>CLI: plan finish --id {planId}
280
+ CLI->>API: GET /api/projects/:projectId/plans/:id
281
+ API-->>CLI: { data: plan(title, ...) }
282
+ CLI->>API: PUT /api/projects/:projectId/plans/:id (status=DONE)
283
+ API-->>CLI: { data: plan }
284
+ CLI->>API: POST /api/projects/:projectId/agent-statuses (DONE)
285
+ API-->>CLI: { data: status }
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Plan status model and constraints
291
+
292
+ ### Status values
293
+
294
+ - `DRAFT`
295
+ - `PENDING`
296
+ - `ASSIGNED`
297
+ - `IN_PROGRESS`
298
+ - `BLOCKED`
299
+ - `DONE` (terminal)
300
+ - `CANCELLED` (terminal)
301
+
302
+ ### Allowed status transitions (server-validated)
303
+
304
+ ```mermaid
305
+ stateDiagram-v2
306
+ [*] --> DRAFT
307
+
308
+ DRAFT --> PENDING
309
+
310
+ PENDING --> ASSIGNED
311
+ PENDING --> IN_PROGRESS
312
+ PENDING --> DONE
313
+ PENDING --> CANCELLED
314
+
315
+ ASSIGNED --> PENDING
316
+ ASSIGNED --> IN_PROGRESS
317
+ ASSIGNED --> DONE
318
+ ASSIGNED --> CANCELLED
319
+
320
+ IN_PROGRESS --> DONE
321
+ IN_PROGRESS --> BLOCKED
322
+ IN_PROGRESS --> CANCELLED
323
+
324
+ BLOCKED --> IN_PROGRESS
325
+ BLOCKED --> CANCELLED
326
+
327
+ DONE --> [*]
328
+ CANCELLED --> [*]
329
+ ```
330
+
331
+ If you attempt a disallowed transition, the API returns `400` with `허용되지 않은 상태 전이입니다`.
332
+
333
+ ### `plan assign` behavior
334
+
335
+ `agentteams plan assign` sets the plan to `ASSIGNED` as long as the plan is not terminal.
336
+
337
+ - Not allowed when current status is `DONE` or `CANCELLED`
338
+ - Otherwise allowed and results in `ASSIGNED`
339
+
340
+ ### Content edit/delete constraints (status-based)
341
+
342
+ ```mermaid
343
+ flowchart TD
344
+ A["plan update (title/content/priority change)"] --> B{Current status is<br/>DRAFT or PENDING?}
345
+ B -- "No" --> E["400: Content edits allowed only in DRAFT or PENDING"]
346
+ B -- "Yes" --> F["Allowed"]
347
+
348
+ C["plan delete"] --> D{Current status is<br/>PENDING, DRAFT, or CANCELLED?}
349
+ D -- "No" --> G["400: Delete allowed only in PENDING, DRAFT, or CANCELLED"]
350
+ D -- "Yes" --> H["204 No Content"]
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Completion report writing rules (practical)
356
+
357
+ - Prefer the platform template if available: `.agentteams/platform/guides/completion-report-guide.md`
358
+ - Include reproducible verification evidence (commands + outcomes).
359
+ - Keep outcomes short: write `pass/fail + 1–3 lines of summary`; do not paste long raw logs into the report body.
360
+
361
+ ---
362
+
363
+ ## Troubleshooting
364
+
365
+ - `401 Unauthorized`
366
+ - Check `AGENTTEAMS_API_KEY` / `.agentteams/config.json` `apiKey`.
367
+ - API keys must have the `key_` prefix.
368
+ - `403 Forbidden`
369
+ - You likely lack project/role permissions (especially for convention writes).
370
+ - `400 Bad Request`
371
+ - 플랜 상태 전이처럼 서버가 검증하는 제약을 위반했을 수 있습니다.
372
+ - 예: 허용되지 않은 상태 전이 시 `400` + `허용되지 않은 상태 전이입니다`
373
+ - Connection issues (`ECONNREFUSED`, `ENOTFOUND`)
374
+ - Check `AGENTTEAMS_API_URL` / config `apiUrl`, and ensure the server is reachable.
375
+
376
+ ---
377
+
378
+ ## 최소 사용 예시
379
+
380
+ ```bash
381
+ # First-time setup
382
+ agentteams init
383
+
384
+ # Create plan (always DRAFT)
385
+ agentteams plan create --title "My plan" --content "# TODO\n- ..." --priority MEDIUM
386
+
387
+ # Download local snapshot/runbook
388
+ agentteams plan download --id <planId>
389
+
390
+ # Add a risk comment
391
+ agentteams comment create --plan-id <planId> --type RISK --content "Potential failure mode..."
392
+
393
+ # Report agent status
394
+ agentteams status report --status IN_PROGRESS --task "Working on plan" --issues "" --remaining ""
395
+
396
+ # Move plan forward (manual)
397
+ agentteams plan update --id <planId> --status IN_PROGRESS
398
+ agentteams plan update --id <planId> --status DONE
399
+
400
+ # Start/finish shortcuts (auto status report)
401
+ agentteams plan start --id <planId>
402
+ agentteams plan finish --id <planId>
403
+
404
+ # Create completion report (recommended flags)
405
+ agentteams report create --plan-id <planId> --title "Done" --template minimal
406
+ ```
407
+
408
+ Environment-only mode (no config file):
409
+
410
+ ```bash
411
+ export AGENTTEAMS_API_URL="https://..."
412
+ export AGENTTEAMS_API_KEY="key_..."
413
+ export AGENTTEAMS_TEAM_ID="..."
414
+ export AGENTTEAMS_PROJECT_ID="..."
415
+ export AGENTTEAMS_AGENT_NAME="..."
416
+
417
+ agentteams plan list --page 1 --page-size 20
418
+ ```
package/README.md CHANGED
@@ -75,6 +75,11 @@ export AGENTTEAMS_API_URL="https://your-agentteams-api.example.com"
75
75
  agentteams convention list
76
76
  agentteams convention show
77
77
  agentteams convention download
78
+ agentteams convention create --file .agentteams/rules/new-rule.md
79
+ agentteams convention update --file .agentteams/rules/context.md
80
+ agentteams convention update --file .agentteams/rules/context.md --apply
81
+ agentteams convention delete --file .agentteams/rules/context.md
82
+ agentteams convention delete --file .agentteams/rules/context.md --apply
78
83
  ```
79
84
 
80
85
  ## Core Commands
@@ -89,17 +94,64 @@ agentteams init
89
94
 
90
95
  ### `convention`
91
96
 
92
- View and download project conventions.
97
+ Manage project conventions.
93
98
 
94
99
  ```bash
95
100
  agentteams convention list
96
101
  agentteams convention show
97
102
  agentteams convention download
103
+ agentteams convention create --file .agentteams/rules/new-rule.md
104
+ agentteams convention update --file .agentteams/rules/context.md
105
+ agentteams convention update --file .agentteams/rules/context.md --apply
106
+ agentteams convention delete --file .agentteams/rules/context.md
107
+ agentteams convention delete --file .agentteams/rules/context.md --apply
98
108
  ```
99
109
 
100
110
  `convention download` saves files by category in `.agentteams/<category>/`.
101
111
  If file names collide within the same category, suffixes like `-2`, `-3` are added.
102
112
 
113
+ #### `convention create`
114
+
115
+ Create a new convention.
116
+
117
+ - The input file must be under `.agentteams/<category>/*.md`, and `<category>` is inferred from the path.
118
+ - Frontmatter is optional. Supported fields: `trigger`, `description`, `agentInstruction`, `title` (optional).
119
+ - After creation, the CLI immediately updates `.agentteams/conventions.manifest.json`, so you can `update/delete` the same file right away.
120
+ - Run `agentteams convention download` if you want to refresh `convention.md` and the server-normalized (downloadable) markdown.
121
+
122
+ Examples:
123
+
124
+ ```bash
125
+ agentteams convention create --file .agentteams/rules/new-rule.md
126
+ ```
127
+
128
+ #### `convention update` / `convention delete`
129
+
130
+ - By default, `update` and `delete` run in **dry-run** mode. They print a diff/plan and do not modify the server.
131
+ - Use `--apply` to actually update/delete the server resource.
132
+ - Only files produced by `agentteams convention download` are allowed. The CLI uses `.agentteams/conventions.manifest.json` to map local files to server conventions.
133
+
134
+ Examples:
135
+
136
+ ```bash
137
+ # Preview changes (dry-run)
138
+ agentteams convention update --file .agentteams/rules/context.md
139
+
140
+ # Apply update to server
141
+ agentteams convention update --file .agentteams/rules/context.md --apply
142
+
143
+ # Preview deletion (dry-run)
144
+ agentteams convention delete --file .agentteams/rules/context.md
145
+
146
+ # Apply deletion to server
147
+ agentteams convention delete --file .agentteams/rules/context.md --apply
148
+ ```
149
+
150
+ Common errors:
151
+
152
+ - `403 Forbidden`: the server rejected the operation due to missing write permissions.
153
+ - `409 Conflict`: optimistic-lock conflict (someone else updated the convention). Download again and retry.
154
+
103
155
  ### `sync`
104
156
 
105
157
  Resync convention files.
@@ -134,16 +186,25 @@ Status values: `IN_PROGRESS`, `DONE`, `BLOCKED`
134
186
 
135
187
  Manage plans.
136
188
 
189
+ Note: Plans are always created as `DRAFT`. Even if you pass `--status` to `plan create`, the server will ignore it. Use `plan update` to change status after creation.
190
+
137
191
  ```bash
138
192
  agentteams plan list
139
193
  agentteams plan get --id <plan-id>
194
+ agentteams plan get --id <plan-id> --include-deps --format text
195
+ agentteams plan show --id <plan-id> # alias of get
140
196
 
141
197
  agentteams plan create \
142
198
  --title "Implement feature" \
143
199
  --content "Detailed content" \
144
- --status "PENDING" \
145
200
  --priority "HIGH"
146
201
 
202
+ # optional checklist template for create
203
+ agentteams plan create \
204
+ --title "Refactor module" \
205
+ --template "refactor-minimal"
206
+
207
+ agentteams plan update --id <plan-id> --status "PENDING"
147
208
  agentteams plan update --id <plan-id> --status "IN_PROGRESS"
148
209
  agentteams plan assign --id <plan-id> --agent "agent-name"
149
210
  agentteams plan download --id <plan-id>
@@ -155,6 +216,10 @@ Status values: `DRAFT`, `PENDING`, `ASSIGNED`, `IN_PROGRESS`, `BLOCKED`, `DONE`,
155
216
 
156
217
  Priorities: `LOW`, `MEDIUM`, `HIGH`
157
218
 
219
+ Plan template values (create): `refactor-minimal`
220
+
221
+ `--include-deps` (get/show): also fetches dependency data and appends a `Dependencies` section in text output; in json output it adds `data.dependencies` with `blocking` and `dependents` arrays.
222
+
158
223
  ### `comment`
159
224
 
160
225
  Manage plan comments.
@@ -197,6 +262,8 @@ agentteams agent-config delete --id <config-id>
197
262
 
198
263
  Manage completion reports.
199
264
 
265
+ Tip: Include reproducible verification evidence (commands + outcomes), but keep outcomes short: `pass/fail + 1–3 lines of summary`. Do not paste long raw logs into the report body.
266
+
200
267
  ```bash
201
268
  agentteams report list
202
269
 
@@ -205,16 +272,39 @@ agentteams report create \
205
272
  --content "## TL;DR\n- done" \
206
273
  --report-type IMPL_PLAN \
207
274
  --status COMPLETED
275
+
276
+ # with metrics (auto + manual)
277
+ agentteams report create \
278
+ --title "CLI metrics report" \
279
+ --content "## Summary\n- done" \
280
+ --files-modified 5 \
281
+ --lines-added 120 \
282
+ --lines-deleted 30 \
283
+ --quality-score 95
284
+
285
+ # disable git auto collection
286
+ agentteams report create \
287
+ --title "Manual metrics report" \
288
+ --content "## Summary\n- done" \
289
+ --no-git
208
290
  ```
209
291
 
210
292
  Report types: `IMPL_PLAN`, `COMMIT_RANGE`, `TASK_COMPLETION`
211
293
 
212
294
  Status values: `COMPLETED`, `FAILED`, `PARTIAL`
213
295
 
296
+ Metrics behavior:
297
+
298
+ - Auto-collected on `report create` (unless `--no-git`): `commitHash`, `branchName`, `filesModified`, `linesAdded`, `linesDeleted`
299
+ - Manual only: `durationSeconds`, `commitStart`, `commitEnd`, `pullRequestId`
300
+ - Manual options always override auto-collected values
301
+
214
302
  ### `postmortem`
215
303
 
216
304
  Manage post mortems.
217
305
 
306
+ Tip: If you have platform guides downloaded under `.agentteams/platform/guides/`, prefer the template in `post-mortem-guide.md`.
307
+
218
308
  ```bash
219
309
  agentteams postmortem list
220
310
 
@@ -271,15 +361,40 @@ export AGENTTEAMS_AGENT_NAME="my-agent"
271
361
 
272
362
  Most resource commands support `--format json|text`.
273
363
 
364
+ Output behavior by default:
365
+
366
+ - `plan create|update|start|finish`: prints short summary lines on stdout by default.
367
+ - `plan list|get` and other read-oriented commands: keep full output by default.
368
+ - `--verbose`: always prints full output to stdout.
369
+ - `--output-file <path>`: always writes full output to file and keeps stdout short.
370
+
371
+ Compatibility note:
372
+
373
+ - If you need full JSON on stdout for automation, pass `--format json` explicitly.
374
+
274
375
  ```bash
275
376
  agentteams plan list --format json
276
377
  agentteams plan list --format text
378
+ agentteams plan update --id <plan-id> --status IN_PROGRESS --format json
277
379
  ```
278
380
 
279
381
  Note: `convention` does not support `--format`.
280
382
 
281
383
  ## Error Guide
282
384
 
385
+ The API may include an optional machine-readable `errorCode` in error responses:
386
+
387
+ ```json
388
+ {
389
+ "statusCode": 403,
390
+ "error": "Forbidden",
391
+ "message": "Cross-project access denied",
392
+ "errorCode": "CROSS_PROJECT_ACCESS_DENIED"
393
+ }
394
+ ```
395
+
396
+ The CLI prioritizes `errorCode` when present and falls back to message/status-based handling for older API responses.
397
+
283
398
  | Error | Meaning | Resolution |
284
399
  |---|---|---|
285
400
  | `401 Unauthorized` | Invalid API key | Check `apiKey` or `AGENTTEAMS_API_KEY` |
@@ -0,0 +1,11 @@
1
+ export declare function listComments(apiUrl: string, projectId: string, headers: any, planId: string, params?: Record<string, string | number>): Promise<any>;
2
+ export declare function getComment(apiUrl: string, projectId: string, headers: any, commentId: string): Promise<any>;
3
+ export declare function createComment(apiUrl: string, projectId: string, headers: any, planId: string, body: {
4
+ type: string;
5
+ content: string;
6
+ }): Promise<any>;
7
+ export declare function updateComment(apiUrl: string, projectId: string, headers: any, commentId: string, body: {
8
+ content: string;
9
+ }): Promise<any>;
10
+ export declare function deleteComment(apiUrl: string, projectId: string, headers: any, commentId: string): Promise<any>;
11
+ //# sourceMappingURL=comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/api/comment.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACvC,OAAO,CAAC,GAAG,CAAC,CAQd;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAId;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACJ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,GAAG,CAAC,CAId;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,GAAG,CAAC,CAId;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAMd"}
@@ -0,0 +1,33 @@
1
+ import axios from 'axios';
2
+ import { withoutJsonContentType } from '../utils/httpHeaders.js';
3
+ export async function listComments(apiUrl, projectId, headers, planId, params) {
4
+ const baseUrl = `${apiUrl}/api/projects/${projectId}/plans/${planId}/comments`;
5
+ const requestConfig = params && Object.keys(params).length > 0
6
+ ? { headers, params }
7
+ : { headers };
8
+ const response = await axios.get(baseUrl, requestConfig);
9
+ return response.data;
10
+ }
11
+ export async function getComment(apiUrl, projectId, headers, commentId) {
12
+ const baseUrl = `${apiUrl}/api/projects/${projectId}/comments/${commentId}`;
13
+ const response = await axios.get(baseUrl, { headers });
14
+ return response.data;
15
+ }
16
+ export async function createComment(apiUrl, projectId, headers, planId, body) {
17
+ const baseUrl = `${apiUrl}/api/projects/${projectId}/plans/${planId}/comments`;
18
+ const response = await axios.post(baseUrl, body, { headers });
19
+ return response.data;
20
+ }
21
+ export async function updateComment(apiUrl, projectId, headers, commentId, body) {
22
+ const baseUrl = `${apiUrl}/api/projects/${projectId}/comments/${commentId}`;
23
+ const response = await axios.put(baseUrl, body, { headers });
24
+ return response.data;
25
+ }
26
+ export async function deleteComment(apiUrl, projectId, headers, commentId) {
27
+ const baseUrl = `${apiUrl}/api/projects/${projectId}/comments/${commentId}`;
28
+ const response = await axios.delete(baseUrl, {
29
+ headers: withoutJsonContentType(headers),
30
+ });
31
+ return response.data;
32
+ }
33
+ //# sourceMappingURL=comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.js","sourceRoot":"","sources":["../../src/api/comment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,SAAiB,EACjB,OAAY,EACZ,MAAc,EACd,MAAwC;IAExC,MAAM,OAAO,GAAG,GAAG,MAAM,iBAAiB,SAAS,UAAU,MAAM,WAAW,CAAC;IAC/E,MAAM,aAAa,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;QAC5D,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;QACrB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;IAEhB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACzD,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,SAAiB,EACjB,OAAY,EACZ,SAAiB;IAEjB,MAAM,OAAO,GAAG,GAAG,MAAM,iBAAiB,SAAS,aAAa,SAAS,EAAE,CAAC;IAC5E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,SAAiB,EACjB,OAAY,EACZ,MAAc,EACd,IAGC;IAED,MAAM,OAAO,GAAG,GAAG,MAAM,iBAAiB,SAAS,UAAU,MAAM,WAAW,CAAC;IAC/E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,SAAiB,EACjB,OAAY,EACZ,SAAiB,EACjB,IAEC;IAED,MAAM,OAAO,GAAG,GAAG,MAAM,iBAAiB,SAAS,aAAa,SAAS,EAAE,CAAC;IAC5E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,SAAiB,EACjB,OAAY,EACZ,SAAiB;IAEjB,MAAM,OAAO,GAAG,GAAG,MAAM,iBAAiB,SAAS,aAAa,SAAS,EAAE,CAAC;IAC5E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;QAC3C,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;KACzC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare function listPlans(apiUrl: string, projectId: string, headers: any, params?: Record<string, string | number>): Promise<any>;
2
+ export declare function getPlan(apiUrl: string, projectId: string, headers: any, id: string): Promise<any>;
3
+ export declare function getPlanDependencies(apiUrl: string, projectId: string, headers: any, id: string): Promise<any>;
4
+ export declare function createPlan(apiUrl: string, projectId: string, headers: any, body: {
5
+ title: string;
6
+ content: string;
7
+ priority: string;
8
+ status: 'DRAFT';
9
+ }): Promise<any>;
10
+ export declare function updatePlan(apiUrl: string, projectId: string, headers: any, id: string, body: Record<string, unknown>): Promise<any>;
11
+ export declare function assignPlan(apiUrl: string, projectId: string, headers: any, id: string, assignedTo: string): Promise<any>;
12
+ export declare function deletePlan(apiUrl: string, projectId: string, headers: any, id: string): Promise<any>;
13
+ //# sourceMappingURL=plan.d.ts.map