@pazmo/ai-workflow-kit 5.2.0 → 5.4.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.ko.md +34 -30
- package/README.md +34 -30
- package/assets/check.mjs +127 -4
- package/assets/graph.mjs +2 -1
- package/bin/ai-workflow-kit.mjs +63 -4
- package/package.json +1 -1
- package/skills/workflow/EVALS.md +36 -11
- package/skills/workflow/SKILL.md +7 -5
- package/skills/workflow/assets/STORY.md +30 -15
- package/skills/workflow/references/execution.md +26 -15
- package/skills/workflow/references/fast-path.md +23 -0
- package/skills/workflow/references/graph-advanced.md +126 -0
- package/skills/workflow/references/graph-engineering.md +1 -122
- package/skills/workflow/references/graph-minimal.md +52 -0
- package/skills/workflow/references/intake.md +25 -9
- package/skills/workflow/references/jira.md +3 -3
- package/skills/workflow/references/light-lane.md +31 -0
- package/skills/workflow/references/model-selection.md +14 -0
- package/skills/workflow/references/role-graphs.md +2 -2
- package/skills/workflow/references/skill-integration.md +4 -4
- package/skills/workflow/references/understanding-gate.md +49 -9
- package/skills/workflow/references/verification.md +3 -3
- package/src/graph/advance.mjs +180 -0
- package/src/graph/approvals.mjs +29 -1
- package/src/graph/approve.mjs +105 -0
- package/src/graph/cli.mjs +126 -8
- package/src/graph/copies.mjs +85 -0
- package/src/graph/light.mjs +182 -0
- package/src/graph/profile.mjs +129 -0
- package/src/graph/snapshot.mjs +2 -1
- package/src/graph/verification.mjs +92 -28
- package/src/graph/workflow.mjs +1 -1
- package/src/install.mjs +53 -14
- package/src/jira.mjs +14 -13
- package/src/managed-block.mjs +3 -3
- package/src/version.mjs +28 -0
package/README.ko.md
CHANGED
|
@@ -8,31 +8,16 @@ AI Workflow Kit은 Codex와 Claude Code에 작업 절차를 추가합니다. 무
|
|
|
8
8
|
|
|
9
9
|
그래프 실행기가 작업 목록과 실행 순서를 관리합니다.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 측정 결과
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- **결제 렌즈가 되돌릴 기준을 묻습니다.** 가격이나 청구 규칙을 바꾸는 Story는 무엇이 되돌림(rollback)의 기준인지, 이미 발행된 청구는 어떻게 되는지 묻습니다.
|
|
15
|
-
- **5.0.x에서 올리나요?** 5.1.0은 npm에 배포하지 않았기 때문에 5.2.0에는 아래 5.1.0 변경도 들어 있습니다. 업데이트 전에 시작한 역할 실행은 `Role assignment or graph changed`로 멈춥니다. 새 역할 실행을 시작하세요.
|
|
13
|
+
실제 서비스 저장소의 작업으로 측정했습니다. 채점은 기준표와 블라인드 쌍 비교로 했습니다.
|
|
16
14
|
|
|
17
|
-
5.
|
|
15
|
+
- **프런티어 모델에서는 품질이 조금 오르지만 비용이 큽니다.** Opus 5.5에서 kit는 기준표 항목의 92%를 통과했고(순정 Claude Code 세션은 84%), 블라인드 쌍 비교 14번 중 12번 이겼습니다. 비용은 6.4배, 시간은 10배였습니다.
|
|
16
|
+
- **main을 중간급 모델로 바꾸면 품질과 비용은 순정 Opus와 같지만, 시간은 같지 않습니다.** Sonnet 5.5를 main으로 쓰면 기준표 71%(순정 Opus 73%), 실행당 $1.16(순정 Opus $1.18)이었고, 시간은 약 2배였습니다. 같은 작업에서 순정 Sonnet은 42–48%, Sonnet에 kit를 쓰면 57–83%였습니다.
|
|
17
|
+
- **작은 변경은 절차를 건너뛸 수 있습니다.** 정할 것이 없는 변경을 Story, 승인, 서브에이전트 없이 바로 처리하는 길을 넣자, 작은 작업 두 개 모두 품질이 순정 Opus와 같았고 블라인드 쌍 비교에서 이겼습니다. 그중 하나는 비용도 더 적고 더 빨리 끝났습니다. 작업마다 1회씩 측정했습니다.
|
|
18
|
+
- **수치를 바꾼 것은 도구였고, 문서 규칙은 아니었습니다.** 변경이 닿는 코드의 평행 복사본을 나열하는 명령, 테스트를 그 테스트가 있는 모듈에서 돌리는 명령은 측정된 실패를 고쳤습니다. 규칙을 문장으로 더 적은 것은 효과가 없었습니다.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
- **Pstack 출처를 공식 저장소로 고쳤습니다.** 포함된 검증 파일은 그대로이고, 출처 기록만 `cursor/plugins`를 가리킵니다.
|
|
21
|
-
|
|
22
|
-
5.0.2에서 추가된 것:
|
|
23
|
-
|
|
24
|
-
- **위험한 선택을 G1 전에 드러냅니다.** 이제 승인 뒤뿐 아니라 G1 전 질문 단계에서도 도메인 위험 렌즈를 읽습니다. 결제나 데이터·시스템 이관 Story에서 요구사항이나 사람이 정하지 않은 렌즈 항목은 `ASSUMED`로 넘기지 않고 `OPEN BLOCKING`으로 남깁니다. 예를 들면 옛 경로와 새 경로를 얼마나 함께 둘지, 롤백 기준, 실패하면 열어 둘지 닫을지, 두 데이터가 다르면 어느 쪽이 기준인지, 팀 간 배포 순서입니다.
|
|
25
|
-
|
|
26
|
-
5.0.1에서 추가된 것:
|
|
27
|
-
|
|
28
|
-
- **검증 스킬을 Story마다 새로 만들지 않고 재사용합니다.** 기존 프로젝트 스킬·가이드를 profile의 `recipe`로 연결합니다. 작업 입력과 실행 기록에 경로·해시가 남고, 레시피나 입력으로 선언한 기능 문서가 바뀌면 이전 증거는 stale이 됩니다. 기존 검증으로 부족할 때만 절차를 보완하거나 만듭니다.
|
|
29
|
-
- **Pstack 검증 절차로 실제 제품을 실행합니다.** 예제는 Launch·Doctor·Drive·Evidence·Cleanup을 포함합니다. Superpowers가 같은 Graph 실행의 최신 증거를 확인하고, 전체 흐름은 kit이 관리합니다. [실행 예제](examples/verification/README.md)를 참고하세요.
|
|
30
|
-
- **리뷰는 기본 3명으로 조정합니다.** 작은 변경은 0~2명, 명확한 전문 위험이 있으면 4~5명으로 조정합니다. 메인이 단순화와 결과 통합을 맡고, 내부 위임도 같은 예산에 포함합니다. 실제 인원 제한은 호스트가 적용합니다.
|
|
31
|
-
- **검증 실행의 예외를 수정했습니다.** 분리된 자식이 출력 파이프를 유지해도 정해진 정리 시간 뒤 불완전한 수집을 실패로 기록합니다. `toString`, `hasOwnProperty` 같은 유효한 검사 ID도 실행 순서와 관계없이 사용할 수 있습니다.
|
|
32
|
-
|
|
33
|
-
기존 프로젝트는 `npx @pazmo/ai-workflow-kit@latest init`과 `npx @pazmo/ai-workflow-kit@latest doctor`로 업데이트한 뒤 새 Codex 작업 또는 Claude Code 세션을 여세요. 사용자가 수정한 관리 파일은 보존하고 알려주므로, 새 지침을 수동 반영해야 하는지 확인하세요.
|
|
34
|
-
|
|
35
|
-
**4.x에서 업데이트할 때:** 5.x는 실제 실행 기록을 요구하는 v3 형식을 사용합니다. [검증 가이드](skills/workflow/references/verification.md)에 따라 `.ai-workflow/verification.json`과 Story에 연결된 G1/G3 기록을 준비하세요. 기존 v1/v2는 조회 전용(`upgrade-required`)입니다. 기존 worker를 중지하고 증거·시도 기록을 보존한 뒤 v3에서 리뷰·검증해야 합니다. `graph delivery`는 최종 스냅샷에 연결된 실제 G4도 확인합니다. [전체 변경 이력](CHANGELOG.md)을 참고하세요.
|
|
20
|
+
측정 방법, 전체 수치와 한계: [docs/EVALUATION.md](https://github.com/syjkim0125/ai-workflow-kit/blob/main/docs/EVALUATION.md) (영문).
|
|
36
21
|
|
|
37
22
|
## 시작하기
|
|
38
23
|
|
|
@@ -56,6 +41,21 @@ npx @pazmo/ai-workflow-kit doctor
|
|
|
56
41
|
|
|
57
42
|
**ChatGPT:** 사용자 스킬을 지원하는 환경에서는 스킬이 자동 선택될 수 있습니다. 그래프 실행에는 Node.js와 프로젝트 파일 접근도 필요합니다. 일반 채팅만으로 전체 절차를 실행할 수는 없습니다.
|
|
58
43
|
|
|
44
|
+
## 업데이트
|
|
45
|
+
|
|
46
|
+
버전별 릴리스 노트: [docs/releases](https://github.com/syjkim0125/ai-workflow-kit/blob/main/docs/releases/README.ko.md). 전체 변경 이력: [CHANGELOG](CHANGELOG.md).
|
|
47
|
+
|
|
48
|
+
기존 프로젝트를 업데이트할 때는 `@latest` 대신 정확한 버전을 지정하고, 설치 전에 npx가 실제로 실행하는 CLI 버전을 확인하세요. 프로젝트의 `.npmrc`가 접속할 수 없는 사설 레지스트리를 가리키면, npx가 캐시된 옛 버전을 알리지 않고 실행할 수 있습니다. 정확한 버전을 지정하면 다른 버전의 캐시로 대신 실행되지 않습니다.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
VERSION=$(npm view @pazmo/ai-workflow-kit version --registry=https://registry.npmjs.org/)
|
|
52
|
+
npx @pazmo/ai-workflow-kit@$VERSION --version
|
|
53
|
+
npx @pazmo/ai-workflow-kit@$VERSION init
|
|
54
|
+
npx @pazmo/ai-workflow-kit@$VERSION doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`--version`이 `$VERSION`과 다른 값을 출력하면 멈추세요. `.npmrc`가 사설 레지스트리를 가리키는 프로젝트에서는 패키지 이름 앞에 `--registry=https://registry.npmjs.org/`를 넣으세요. 예: `npx --registry=https://registry.npmjs.org/ @pazmo/ai-workflow-kit@$VERSION init`. 패키지 이름 뒤에 두면 npm이 아니라 kit에 전달됩니다. `init`은 `Updated AI Workflow Kit 5.3.0 → 5.4.0.`처럼 두 버전을 출력하고, `doctor`는 `Kit version: CLI …, installed …` 줄을 출력합니다. 그다음 새 Codex 작업 또는 Claude Code 세션을 여세요. 사용자가 수정한 관리 파일은 보존하고 알려주므로, 새 지침을 수동 반영해야 하는지 확인하세요.
|
|
58
|
+
|
|
59
59
|
## 작업 흐름
|
|
60
60
|
|
|
61
61
|

|
|
@@ -68,6 +68,8 @@ npx @pazmo/ai-workflow-kit doctor
|
|
|
68
68
|
6. **쓸 만한 교훈을 남깁니다.** 확인된 내용만 저장합니다. 남길 것이 없으면 생략합니다.
|
|
69
69
|
7. **사람이 결과를 확인합니다.** 변경을 직접 설명한 뒤 실제 결과와 비교합니다.
|
|
70
70
|
|
|
71
|
+
**작은 변경은 바로 처리합니다.** 요청이 동작 하나와 그 위치를 말하고, 정할 것이 없고, 되돌릴 수 있는 한 모듈 안의 변경이면, 에이전트가 바로 고치고 말한 동작마다 테스트를 더해 돌린 뒤 보고합니다. Story, 승인, 서브에이전트를 건너뜁니다. 정할 것이 남으면 위 단계를 따릅니다.
|
|
72
|
+
|
|
71
73
|
위험한 변경은 구현 전에 설계를 확인합니다. 테스트가 통과해도 kit이 자동으로 머지하거나 배포하지 않습니다.
|
|
72
74
|
|
|
73
75
|
## 그래프가 하는 일
|
|
@@ -102,9 +104,9 @@ npx @pazmo/ai-workflow-kit doctor
|
|
|
102
104
|
| **G3: 설계** | 이 방법으로 진행해도 되는가? 실패하면 복구할 수 있는가? | 위험한 변경을 할 때 |
|
|
103
105
|
| **G4: 이해** | 무엇이 바뀌는가? 지켜야 할 규칙은 무엇인가? 테스트는 무엇을 확인했는가? | 완료 전 |
|
|
104
106
|
|
|
105
|
-
G4에서는 설명보다 바뀐 코드와 테스트 결과를 먼저
|
|
107
|
+
G4에는 두 방식이 있습니다. 기본(`ai-summary`)에서는 에이전트가 변경을 번호 붙은 네 줄로 짧게 설명합니다. 사용자가 겪는 변화, 지킨 규칙과 실패할 때 동작, 확인한 테스트, 확인하지 못한 것입니다. 사람은 이를 명시적으로 승인합니다. G3가 필요했던 위험한 작업은 `human-restatement`를 씁니다. 설명보다 바뀐 코드와 테스트 결과를 먼저 보고 사람이 먼저 답합니다. 에이전트는 맞은 내용, 빠진 내용, 틀린 내용을 짚고, 사람은 수정된 내용을 자기 말로 다시 설명합니다.
|
|
106
108
|
|
|
107
|
-
작은 변경은 규칙에 따라 G4를 생략할 수 있습니다. 구체적인 이유를 기록해야 합니다.
|
|
109
|
+
작은 변경은 규칙에 따라 G4를 생략할 수 있습니다. 구체적인 이유를 기록해야 합니다. 바로 처리한 변경에는 G1과 G4가 없습니다. 다른 작은 커밋처럼 diff와 테스트를 직접 확인하세요.
|
|
108
110
|
|
|
109
111
|
검사기는 **기록과 파일**을 검사합니다. 누가 승인했는지, 테스트 결과가 사실인지는 증명하지 못합니다. 사람과 실행 도구가 실제 승인과 증거를 제공해야 합니다.
|
|
110
112
|
|
|
@@ -114,14 +116,16 @@ G4에서는 설명보다 바뀐 코드와 테스트 결과를 먼저 봅니다.
|
|
|
114
116
|
|
|
115
117
|
| 항목 | 뜻 |
|
|
116
118
|
|---|---|
|
|
117
|
-
| Goal |
|
|
118
|
-
| Domain | 이 변경에서 지켜야 할 규칙 |
|
|
119
|
+
| Goal | 세 줄: 지금(As-is), 바뀐 뒤(To-be), 그대로 둘 것(Unchanged) |
|
|
120
|
+
| Domain | 번호로 적은 용어와 이 변경에서 지켜야 할 규칙 |
|
|
121
|
+
| Decisions | 합의한 결정과 표시한 가정. 요구사항보다 먼저 읽습니다 |
|
|
119
122
|
| MUST | 반드시 필요한 동작 |
|
|
120
123
|
| SHOULD | 있으면 좋은 개선 |
|
|
121
124
|
| OUT | 이번에 하지 않을 작업 |
|
|
122
|
-
| Decisions | 합의한 결정과 표시한 가정 |
|
|
123
125
|
| Verify | 필요한 동작을 확인할 방법 |
|
|
124
126
|
|
|
127
|
+
`Status`, `Owner`, 게이트 기록은 Verify 아래 `---` 줄 뒤의 꼬리말에 둡니다.
|
|
128
|
+
|
|
125
129
|
에이전트는 한 번에 최대 3개를 묻고, 최대 2회 질문합니다. 안전한 기본값은 `ASSUMED`로 표시합니다. 작업을 막는 미해결 결정은 `OPEN BLOCKING`으로 남깁니다. 승인 표시로 숨길 수 없습니다.
|
|
126
130
|
|
|
127
131
|
한 번에 리뷰하기 어려울 때만 Story를 Task로 나눕니다. Task는 빈 줄을 뺀 30줄 이하로 씁니다. Story의 요구사항과 검증 항목 번호를 가리킵니다. 구현 방법은 계획에 적습니다.
|
|
@@ -191,9 +195,9 @@ AGENTS.md / CLAUDE.md 표시된 구간에 작업 지침 추가
|
|
|
191
195
|
templates/ai-workflow/ Story와 Task 서식
|
|
192
196
|
```
|
|
193
197
|
|
|
194
|
-
`init`은 기존 설치도
|
|
198
|
+
`init`은 기존 설치도 업데이트하고, 실행한 버전과 교체한 버전을 출력합니다. 사용자가 고친 관리 파일은 보존하고 알려줍니다. 보존된 파일은 옛 내용 그대로이므로 설치에 여러 버전이 섞입니다. 포매터가 바꾼 것도 수정으로 봅니다. 새 버전을 받으려면 그 파일을 지우고 `init`을 다시 실행하세요. `remove`는 kit이 관리하는 파일과 지침 구간을 제거합니다. 사용자 변경, 실행 기록, 증거는 남깁니다.
|
|
195
199
|
|
|
196
|
-
설치 후 `doctor`를 실행하세요. 누락된
|
|
200
|
+
설치 후 `doctor`를 실행하세요. CLI 버전과 설치된 버전을 출력하고, 누락된 파일, 그 버전과 내용이 다른 관리 파일, 검사기·그래프를 숨기는 Git 무시 규칙을 찾습니다. CLI가 설치된 kit보다 오래된 버전이면 실패합니다. 프로젝트를 공유하기 전에 안내대로 수정하세요.
|
|
197
201
|
|
|
198
202
|
## 명령어
|
|
199
203
|
|
|
@@ -213,7 +217,7 @@ node .ai-workflow/bin/graph.mjs status .ai-workflow/runs/change.json
|
|
|
213
217
|
|
|
214
218
|
실제 Story와 run 경로로 바꿔 쓰세요. `check story`는 문서를 검사합니다. Draft 문서가 통과해도 승인된 것은 아닙니다. 승인 기록은 `gate` 명령으로 검사합니다.
|
|
215
219
|
|
|
216
|
-
에이전트는 `
|
|
220
|
+
에이전트는 G1과 G4 답을 `approve`로 기록하고, `go`로 실행을 시작하고, 단계마다 `complete`를 씁니다. light 경로의 작은 변경은 `light`, `check`, `review`, `delivery`를 씁니다. 입력 형식과 예시는 [그래프 안내](https://github.com/syjkim0125/ai-workflow-kit/blob/main/skills/workflow/references/graph-minimal.md)에 있습니다.
|
|
217
221
|
|
|
218
222
|
**Jira는 선택 사항입니다.** `npx @pazmo/ai-workflow-kit jira preview docs/STORY.md`는 로컬 미리보기만 출력합니다. 실제 발행에는 승인된 실행 환경의 연결 기능이 필요합니다. kit에는 Jira 인증정보나 클라이언트가 없습니다.
|
|
219
223
|
|
package/README.md
CHANGED
|
@@ -8,31 +8,16 @@ AI Workflow Kit adds a work process to Codex and Claude Code. It defines what to
|
|
|
8
8
|
|
|
9
9
|
A graph runner tracks the task list and the rules for which task runs next.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Measured results
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- **The payment lens asks about rollback.** A Story that changes a price or charge rule now asks what triggers a rollback and what happens to charges already issued.
|
|
15
|
-
- **Upgrading from 5.0.x?** 5.1.0 was not published to npm, so 5.2.0 also includes the 5.1.0 changes below. A role run started before the upgrade stops with `Role assignment or graph changed`. Start a new role run.
|
|
13
|
+
On real tasks from production repositories, graded by rubric and blind pairwise comparison:
|
|
16
14
|
|
|
17
|
-
5.
|
|
15
|
+
- **On a frontier model, the kit raised quality a little at a high price.** On Opus 5.5, it passed 92% of rubric items against 84% for a plain Claude Code session and won 12 of 14 blind pairings. It cost 6.4× as much and took 10× as long.
|
|
16
|
+
- **On a mid-tier main model, it matched plain Opus on quality and cost, but not on time.** With Sonnet 5.5 as the main session, it passed 71% against 73% for plain Opus, at $1.16 against $1.18 per run, and took about twice as long. On the same tasks, plain Sonnet scored 42–48% and the kit on Sonnet scored 57–83%.
|
|
17
|
+
- **Small changes can skip the process.** With a direct lane (no Story, gates or subagents when nothing is left to decide), both small tasks matched plain Opus on quality and won the blind pairing; one also cost less and finished sooner. One run each.
|
|
18
|
+
- **Tools moved the numbers; prose rules did not.** Deterministic commands, one that lists parallel copies of the code a change touches and one that routes tests to their module, fixed measured failures. Extra written rules did not.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
- **Pstack provenance points at the official source.** The bundled verification files are unchanged; their record now names `cursor/plugins`.
|
|
21
|
-
|
|
22
|
-
5.0.2 added:
|
|
23
|
-
|
|
24
|
-
- **Surface risky choices before G1.** Intake now reads the domain risk lenses before G1, not only after approval. In payment and data or system migration Stories, a lens item that the requirement or a human has not settled stays `OPEN BLOCKING` instead of being labeled `ASSUMED`. Examples: how long old and new paths coexist, the rollback trigger, whether a failure fails open or closed, which data wins when two sources disagree, and deploy order across teams.
|
|
25
|
-
|
|
26
|
-
5.0.1 added:
|
|
27
|
-
|
|
28
|
-
- **Reuse project verification skills across Stories.** Link an existing skill or guide with profile `recipe`. Task inputs and execution receipts retain its path/hash; recipe and declared feature-map edits invalidate old evidence. Create a procedure only when existing coverage is insufficient.
|
|
29
|
-
- **Drive the real product with Pstack's verification procedure.** The example covers Launch, Doctor, Drive, Evidence and Cleanup. Superpowers inspects that same Graph execution's fresh results; the kit keeps workflow ownership. See the [runnable example](examples/verification/README.md).
|
|
30
|
-
- **Keep review work bounded.** Default to three workers, reduce to 0–2 for small changes, and expand to 4–5 for named risks. Main simplifies and aggregates; nested workers share the same budget. The host enforces actual dispatch limits.
|
|
31
|
-
- **Fix verification edge cases.** Incomplete output collection fails after bounded cleanup when an escaped child keeps pipes open. Valid check IDs such as `toString` and `hasOwnProperty` work regardless of execution order.
|
|
32
|
-
|
|
33
|
-
To update an existing project, run `npx @pazmo/ai-workflow-kit@latest init`, then `npx @pazmo/ai-workflow-kit@latest doctor`. Open a new Codex task or Claude Code session. User-edited managed files are preserved and reported; inspect them for changes that need applying manually.
|
|
34
|
-
|
|
35
|
-
**Upgrading from 4.x:** 5.x uses persisted run format v3 and runner-issued receipts. Configure `.ai-workflow/verification.json` and Story-bound G1/G3 records using the [verification guide](skills/workflow/references/verification.md). Legacy v1/v2 runs are read-only (`upgrade-required`): stop old workers, preserve evidence/attempt history, and rerun review/checks in v3. `graph delivery` also requires a real G4 bound to the final snapshot. See [all changes](CHANGELOG.md).
|
|
20
|
+
Method, all numbers and limits: [docs/EVALUATION.md](https://github.com/syjkim0125/ai-workflow-kit/blob/main/docs/EVALUATION.md).
|
|
36
21
|
|
|
37
22
|
## Start
|
|
38
23
|
|
|
@@ -56,6 +41,21 @@ Use `init --host codex` or `init --host claude` to install for one tool only.
|
|
|
56
41
|
|
|
57
42
|
**ChatGPT:** In an environment that supports custom skills, skill selection may happen automatically. The graph also needs Node.js and access to project files. A chat by itself does not provide the full workflow.
|
|
58
43
|
|
|
44
|
+
## Updating
|
|
45
|
+
|
|
46
|
+
Release notes for each version: [docs/releases](https://github.com/syjkim0125/ai-workflow-kit/blob/main/docs/releases/README.md). Every change: [CHANGELOG](CHANGELOG.md).
|
|
47
|
+
|
|
48
|
+
To update an existing project, pin the exact release instead of `@latest`, and check which CLI npx runs before you install. npx can quietly run an older cached copy, for example when the project's `.npmrc` points at a private registry that is unreachable. An exact version cannot be met by a different cached copy.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
VERSION=$(npm view @pazmo/ai-workflow-kit version --registry=https://registry.npmjs.org/)
|
|
52
|
+
npx @pazmo/ai-workflow-kit@$VERSION --version
|
|
53
|
+
npx @pazmo/ai-workflow-kit@$VERSION init
|
|
54
|
+
npx @pazmo/ai-workflow-kit@$VERSION doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Stop if `--version` prints anything other than `$VERSION`. In a project whose `.npmrc` points at a private registry, put `--registry=https://registry.npmjs.org/` before the package name, for example `npx --registry=https://registry.npmjs.org/ @pazmo/ai-workflow-kit@$VERSION init`. After the package name it goes to the kit, not to npm. `init` names both versions, such as `Updated AI Workflow Kit 5.3.0 → 5.4.0.`, and `doctor` prints `Kit version: CLI …, installed …`. Then open a new Codex task or Claude Code session. User-edited managed files are preserved and reported; inspect them for changes that need applying manually.
|
|
58
|
+
|
|
59
59
|
## How work moves
|
|
60
60
|
|
|
61
61
|

|
|
@@ -68,6 +68,8 @@ Use `init --host codex` or `init --host claude` to install for one tool only.
|
|
|
68
68
|
6. **Save useful lessons.** Keep proven lessons for future tasks. Skip notes that add nothing.
|
|
69
69
|
7. **Check the result yourself.** Explain the change, then compare your understanding with the evidence.
|
|
70
70
|
|
|
71
|
+
**Small changes take a direct lane.** When the request names one behavior and its place, leaves nothing to decide, and stays reversible and inside one module, the agent edits, adds a test for each stated behavior, runs it and reports. It skips the Story, the approvals and the subagents. Anything left to decide takes the steps above.
|
|
72
|
+
|
|
71
73
|
High-risk changes need a design check before implementation. The kit does not merge or publish just because tests pass.
|
|
72
74
|
|
|
73
75
|
## What the graph does
|
|
@@ -103,9 +105,9 @@ When all nodes pass, the runner returns `action: g4`. **This means ready for hum
|
|
|
103
105
|
| **G3: design** | Is this approach acceptable? Can we recover if it fails? | For high-risk changes |
|
|
104
106
|
| **G4: understanding** | What changed? Which rules must hold? What do the tests prove? | Before completion |
|
|
105
107
|
|
|
106
|
-
For
|
|
108
|
+
G4 has two modes. By default (`ai-summary`), the agent explains the change in four short numbered lines: what changes for the user, the rule kept and what happens on failure, the tests that proved it, and what is still unproven. You approve it explicitly. For high-risk work that needed G3, G4 uses `human-restatement`: you see the changed code and test results before the explanation and answer first. The agent then points out what you understood, missed, or got wrong, and you explain the corrected version in your own words.
|
|
107
109
|
|
|
108
|
-
A small change may qualify for a documented G4 exception. The reason must be specific.
|
|
110
|
+
A small change may qualify for a documented G4 exception. The reason must be specific. A direct-lane change has no G1 or G4: you review its diff and test as you would any small commit.
|
|
109
111
|
|
|
110
112
|
The checker checks **records and files**. It cannot prove who wrote an approval or whether a test report is true. The person and the host must supply real approval and real evidence.
|
|
111
113
|
|
|
@@ -115,14 +117,16 @@ The requirements live in one short document called a **Story**.
|
|
|
115
117
|
|
|
116
118
|
| Field | Meaning |
|
|
117
119
|
|---|---|
|
|
118
|
-
| Goal |
|
|
119
|
-
| Domain |
|
|
120
|
+
| Goal | Three lines: what happens today (As-is), after the change (To-be), and what stays the same (Unchanged) |
|
|
121
|
+
| Domain | Numbered terms and the rules this change must respect |
|
|
122
|
+
| Decisions | Agreed choices and stated assumptions, read before the requirements |
|
|
120
123
|
| MUST | Required behavior |
|
|
121
124
|
| SHOULD | Optional improvements |
|
|
122
125
|
| OUT | Work excluded from this request |
|
|
123
|
-
| Decisions | Agreed choices and stated assumptions |
|
|
124
126
|
| Verify | How to check each required behavior |
|
|
125
127
|
|
|
128
|
+
`Status`, `Owner` and the gate records sit in a footer below Verify, after a `---` line.
|
|
129
|
+
|
|
126
130
|
The agent asks at most three questions per round, for up to two rounds. It marks safe defaults as `ASSUMED`. A decision that blocks the work stays `OPEN BLOCKING`; it cannot be hidden by approval.
|
|
127
131
|
|
|
128
132
|
Split a Story into Tasks only when it is too large to review in one change. Each Task is at most 30 non-empty lines and points to the Story's requirement and verification IDs. The plan explains how to build it.
|
|
@@ -192,9 +196,9 @@ AGENTS.md / CLAUDE.md Workflow instructions inside a marked block
|
|
|
192
196
|
templates/ai-workflow/ Story and Task templates
|
|
193
197
|
```
|
|
194
198
|
|
|
195
|
-
`init` also updates an existing installation. It preserves user-edited managed files and reports them. `remove` removes owned files and instruction blocks. It keeps user changes, run files, and evidence.
|
|
199
|
+
`init` also updates an existing installation and names the version it ran and the version it replaced. It preserves user-edited managed files and reports them. A preserved file keeps its old content, so the install then mixes versions. Formatter passes count as edits. To take the new copy, delete the file and run `init` again. `remove` removes owned files and instruction blocks. It keeps user changes, run files, and evidence.
|
|
196
200
|
|
|
197
|
-
Run `doctor` after installation. It finds missing files and Git ignore rules that hide the checker or graph runtime. Follow its suggested fixes before sharing the project.
|
|
201
|
+
Run `doctor` after installation. It prints the CLI and installed versions, finds missing files, warns about managed files that differ from that version, and finds Git ignore rules that hide the checker or graph runtime. It fails when the CLI is older than the installed kit. Follow its suggested fixes before sharing the project.
|
|
198
202
|
|
|
199
203
|
## Commands
|
|
200
204
|
|
|
@@ -214,7 +218,7 @@ node .ai-workflow/bin/graph.mjs status .ai-workflow/runs/change.json
|
|
|
214
218
|
|
|
215
219
|
Use your actual Story and run paths. `check story` checks the document; a valid Draft is not an approval. Use the gate commands to check approval records.
|
|
216
220
|
|
|
217
|
-
The agent
|
|
221
|
+
The agent records your G1 and G4 replies with `approve`, starts the run with `go`, and uses `complete` for each step. A small change on the light lane uses `light`, `check`, `review` and `delivery` instead. Full inputs and examples are in the [graph guide](https://github.com/syjkim0125/ai-workflow-kit/blob/main/skills/workflow/references/graph-minimal.md).
|
|
218
222
|
|
|
219
223
|
**Jira is optional.** `npx @pazmo/ai-workflow-kit jira preview docs/STORY.md` prints a local preview. Publishing needs an authorized host adapter. The kit includes no Jira credentials or client.
|
|
220
224
|
|
package/assets/check.mjs
CHANGED
|
@@ -3,7 +3,12 @@ import { access, readFile, realpath } from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
export const STORY_LAYOUTS = Object.freeze({
|
|
7
|
+
v1: Object.freeze(['Goal', 'Domain', 'MUST', 'SHOULD', 'OUT', 'Decisions', 'Verify']),
|
|
8
|
+
v2: Object.freeze(['Goal', 'Domain', 'Decisions', 'MUST', 'SHOULD', 'OUT', 'Verify']),
|
|
9
|
+
});
|
|
10
|
+
const REQUIRED_STORY_HEADINGS = STORY_LAYOUTS.v2;
|
|
11
|
+
const RECORD_LINE = /^(?:(?:Status|Owner|Lane):|Understanding gate \(G[134]\):|G4:)/iu;
|
|
7
12
|
const REQUIRED_TASK_HEADINGS = ['Outcome', 'Covers — Story M/V IDs', 'Scope', 'Constraints', 'Verify'];
|
|
8
13
|
|
|
9
14
|
async function exists(file) {
|
|
@@ -32,10 +37,43 @@ function hasG4Pass(text) {
|
|
|
32
37
|
return /^G4:\s*PASS\s*[—-]\s*\S.+$/imu.test(text);
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
function hasG4Approved(text) {
|
|
41
|
+
return /^G4:\s*APPROVED\s*[—-]\s*(?!<)\S.+$/imu.test(text);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const FENCE = /^\s*(?:`{3,}|~{3,})/u;
|
|
45
|
+
|
|
46
|
+
/** Lines outside code fences. */
|
|
47
|
+
function unfencedLines(text) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
let fenced = false;
|
|
50
|
+
for (const line of text.split(/\r?\n/u)) {
|
|
51
|
+
if (FENCE.test(line)) { fenced = !fenced; continue; }
|
|
52
|
+
if (!fenced) lines.push(line);
|
|
53
|
+
}
|
|
54
|
+
return lines;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Every record of one gate outside code fences. */
|
|
58
|
+
function gateLines(text, gate) {
|
|
59
|
+
return unfencedLines(text).map((line) => gateLine(line, gate)).filter(Boolean);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function duplicateGateErrors(text, gates) {
|
|
63
|
+
return gates.filter((gate) => gateLines(text, gate).length > 1)
|
|
64
|
+
.map((gate) => `Understanding gate (${gate}) must appear once; replace the existing line instead of adding another.`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** G4 mode from its gate record; a record without "Mode:" is the original human restatement. */
|
|
68
|
+
export function g4Mode(record) {
|
|
69
|
+
const mode = record?.match(/\bMode:\s*([\w-]+)/iu)?.[1]?.toLowerCase();
|
|
70
|
+
return mode === 'ai-summary' ? 'ai-summary' : 'human-restatement';
|
|
71
|
+
}
|
|
72
|
+
|
|
35
73
|
// The publisher must recognize the same gate spelling/spacing as validation.
|
|
36
74
|
export function isGateMetadataLine(line) {
|
|
37
75
|
return ['G1', 'G3', 'G4'].some((gate) => Boolean(gateLine(line, gate)))
|
|
38
|
-
|| /^Understanding gate \(G[134]\):\s*$/iu.test(line) || hasG4Pass(line);
|
|
76
|
+
|| /^Understanding gate \(G[134]\):\s*$/iu.test(line) || hasG4Pass(line) || hasG4Approved(line);
|
|
39
77
|
}
|
|
40
78
|
|
|
41
79
|
function parseArtifact(record) {
|
|
@@ -107,6 +145,8 @@ export async function checkGate({ root = process.cwd(), file, gate }) {
|
|
|
107
145
|
return { ok: false, errors: [`Cannot read Story: ${error.message}`] };
|
|
108
146
|
}
|
|
109
147
|
|
|
148
|
+
const duplicates = duplicateGateErrors(text, [gate]);
|
|
149
|
+
if (duplicates.length) return { ok: false, errors: duplicates };
|
|
110
150
|
const record = gateLine(text, gate);
|
|
111
151
|
if (!record) {
|
|
112
152
|
return { ok: false, errors: [`Missing Understanding gate (${gate}) record.`] };
|
|
@@ -136,7 +176,14 @@ export async function checkGate({ root = process.cwd(), file, gate }) {
|
|
|
136
176
|
const resolved = await evidencePath({ root, artifact, gate });
|
|
137
177
|
if (resolved.error) return { ok: false, errors: [resolved.error] };
|
|
138
178
|
|
|
139
|
-
if (gate === 'G4' &&
|
|
179
|
+
if (gate === 'G4' && g4Mode(record) === 'ai-summary') {
|
|
180
|
+
if (gateLines(text, 'G3').some((g3) => !/^<?pending\b/iu.test(g3))) {
|
|
181
|
+
return { ok: false, errors: ['A Story with a G3 decision needs G4 by human restatement (G4: PASS — …).'] };
|
|
182
|
+
}
|
|
183
|
+
if (!hasG4Approved(text)) {
|
|
184
|
+
return { ok: false, errors: ['G4 ai-summary needs the human approval record “G4: APPROVED — <owner> approved the AI summary”.'] };
|
|
185
|
+
}
|
|
186
|
+
} else if (gate === 'G4' && !hasG4Pass(text)) {
|
|
140
187
|
return { ok: false, errors: ['G4 evidence exists, but the Story is missing an explicit “G4: PASS — <human restatement evidence>” record.'] };
|
|
141
188
|
}
|
|
142
189
|
|
|
@@ -179,6 +226,61 @@ function verifyMappings(text) {
|
|
|
179
226
|
return { lines, mapped };
|
|
180
227
|
}
|
|
181
228
|
|
|
229
|
+
/** Which Story layout the present headings follow: 'v1', 'v2', or null. */
|
|
230
|
+
export function storyLayout(text) {
|
|
231
|
+
for (const [name, headings] of Object.entries(STORY_LAYOUTS)) {
|
|
232
|
+
const indexes = headings.map((heading) => headingIndex(text, heading));
|
|
233
|
+
if (indexes.every((value, index) => value >= 0 && (index === 0 || value > indexes[index - 1]))) return name;
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Status, Owner, Lane, gate and G4 lines: Story records, not content. */
|
|
239
|
+
export function isStoryRecordLine(line) {
|
|
240
|
+
return RECORD_LINE.test(line.trim());
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Story record zones, fence-aware: the preamble before the first "##", and the
|
|
245
|
+
* footer — the final run of record and blank lines after Verify, optionally
|
|
246
|
+
* opened by "---". footerStart is the line index where the footer (with its
|
|
247
|
+
* "---") begins, or the line count when there is none.
|
|
248
|
+
*/
|
|
249
|
+
export function storyRecordZones(text) {
|
|
250
|
+
const lines = text.split(/\r?\n/u);
|
|
251
|
+
const preamble = [];
|
|
252
|
+
const fencedAt = [];
|
|
253
|
+
let fenced = false;
|
|
254
|
+
let inSections = false;
|
|
255
|
+
let verifyStart = -1;
|
|
256
|
+
lines.forEach((line, index) => {
|
|
257
|
+
const marker = FENCE.test(line);
|
|
258
|
+
if (marker) fenced = !fenced;
|
|
259
|
+
fencedAt[index] = fenced || marker;
|
|
260
|
+
if (!fencedAt[index] && /^##\s+/u.test(line)) {
|
|
261
|
+
inSections = true;
|
|
262
|
+
verifyStart = /^##\s+Verify\s*$/iu.test(line) ? index + 1 : -1;
|
|
263
|
+
} else if (!inSections) preamble.push(line);
|
|
264
|
+
});
|
|
265
|
+
let start = lines.length;
|
|
266
|
+
if (verifyStart >= 0) {
|
|
267
|
+
const plain = (index) => !fencedAt[index] && (isStoryRecordLine(lines[index]) || !lines[index].trim());
|
|
268
|
+
while (start > verifyStart && plain(start - 1)) start -= 1;
|
|
269
|
+
if (!lines.slice(start).some((line) => isStoryRecordLine(line))) start = lines.length;
|
|
270
|
+
else if (start > verifyStart && !fencedAt[start - 1] && /^---\s*$/u.test(lines[start - 1])) start -= 1;
|
|
271
|
+
}
|
|
272
|
+
const footer = lines.slice(start).filter((line) => !/^---\s*$/u.test(line));
|
|
273
|
+
return { preamble, footer, footerStart: start };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function requireStoryLayout(text, errors) {
|
|
277
|
+
const missing = REQUIRED_STORY_HEADINGS.filter((heading) => !hasHeading(text, heading));
|
|
278
|
+
for (const heading of missing) errors.push(`Missing Story section: ${heading}.`);
|
|
279
|
+
if (!missing.length && !storyLayout(text)) {
|
|
280
|
+
errors.push('Story sections are out of order; keep the canonical template order (Goal, Domain, Decisions, MUST, SHOULD, OUT, Verify).');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
182
284
|
function requireOrderedHeadings(text, headings, errors, label) {
|
|
183
285
|
const indexes = headings.map((heading) => headingIndex(text, heading));
|
|
184
286
|
for (let index = 0; index < headings.length; index += 1) {
|
|
@@ -213,7 +315,28 @@ function checkTask(text) {
|
|
|
213
315
|
|
|
214
316
|
function checkStoryShape(text) {
|
|
215
317
|
const errors = [];
|
|
216
|
-
|
|
318
|
+
requireStoryLayout(text, errors);
|
|
319
|
+
if (storyLayout(text) === 'v2') {
|
|
320
|
+
const goal = sectionBody(text, 'Goal');
|
|
321
|
+
for (const [number, label] of [[1, 'As-is'], [2, 'To-be'], [3, 'Unchanged']]) {
|
|
322
|
+
if (!new RegExp(`^${number}\\.[\\t ]*${label}:[\\t ]*(?!<)\\S`, 'imu').test(goal)) {
|
|
323
|
+
errors.push(`Goal needs a "${number}. ${label}:" line.`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const { preamble, footer } = storyRecordZones(text);
|
|
328
|
+
const records = [...preamble, ...footer];
|
|
329
|
+
for (const record of ['Status', 'Owner', 'Lane']) {
|
|
330
|
+
if (records.filter((line) => new RegExp(`^${record}:`, 'iu').test(line.trim())).length > 1) {
|
|
331
|
+
errors.push(`${record} must appear once; keep the record lines in the footer.`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
for (const line of records.filter((record) => /^Lane:/iu.test(record.trim()))) {
|
|
335
|
+
if (!/^Lane:[\t ]*(?:light|standard|standard \(from light:[\t ]*[^\s)][^)]*\))[\t ]*$/iu.test(line.trim())) {
|
|
336
|
+
errors.push('Lane must be "light", "standard", or "standard (from light: <reason>)".');
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
errors.push(...duplicateGateErrors(text, ['G1', 'G3', 'G4']));
|
|
217
340
|
|
|
218
341
|
if (!/^#\s+Story:\s*(?!<|pending\b)\S.+$/imu.test(text)) errors.push('Story needs a descriptive “# Story:” title.');
|
|
219
342
|
if (!/^Status:\s*(Draft|Approved|Delivered)\s*$/imu.test(text)) {
|
package/assets/graph.mjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { runGraphCommand } from '../graph/cli.mjs';
|
|
4
4
|
import { checkArtifact, checkGate } from './check.mjs';
|
|
5
5
|
try {
|
|
6
|
-
|
|
6
|
+
// Compact JSON: an agent reads it, and every byte is context it carries.
|
|
7
|
+
console.log(JSON.stringify(await runGraphCommand(process.argv.slice(2), { checkArtifact, checkGate })));
|
|
7
8
|
} catch (error) {
|
|
8
9
|
console.error(error.message);
|
|
9
10
|
process.exitCode = 1;
|
package/bin/ai-workflow-kit.mjs
CHANGED
|
@@ -3,14 +3,17 @@ import { access, readFile, readdir } from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { checkArtifact, checkGate } from '../assets/check.mjs';
|
|
6
|
-
import { installWorkflow, removeWorkflow } from '../src/install.mjs';
|
|
6
|
+
import { installWorkflow, managedDrift, removeWorkflow } from '../src/install.mjs';
|
|
7
7
|
import { checkerVisibility, fileVisibilities, ignoredCheckerAdvice } from '../src/git-visibility.mjs';
|
|
8
8
|
import { END_MARKER, START_MARKER } from '../src/managed-block.mjs';
|
|
9
9
|
import { HOSTS } from '../src/paths.mjs';
|
|
10
10
|
import { publishStory } from '../src/jira.mjs';
|
|
11
11
|
import { runGraphCommand } from '../src/graph/cli.mjs';
|
|
12
|
+
import { compareVersions, readPackageVersion } from '../src/version.mjs';
|
|
12
13
|
|
|
13
14
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
15
|
+
const PACKAGE_NAME = '@pazmo/ai-workflow-kit';
|
|
16
|
+
const PUBLIC_REGISTRY = 'https://registry.npmjs.org/';
|
|
14
17
|
|
|
15
18
|
async function graphFiles() {
|
|
16
19
|
return ['.ai-workflow/bin/graph.mjs', ...(await readdir(path.join(packageRoot, 'src/graph')))
|
|
@@ -73,6 +76,38 @@ async function exists(file) {
|
|
|
73
76
|
try { await access(file); return true; } catch { return false; }
|
|
74
77
|
}
|
|
75
78
|
|
|
79
|
+
// A stale CLI (for example a cached npx copy behind an unreachable private registry)
|
|
80
|
+
// must not vouch for a newer install: that direction fails, the other only warns.
|
|
81
|
+
function versionCheck(cli, installed) {
|
|
82
|
+
const line = `Kit version: CLI ${cli}, installed ${installed ?? 'unknown'}`;
|
|
83
|
+
const order = compareVersions(cli, installed);
|
|
84
|
+
if (order === 0) return { status: 'PASS', line, advice: [], ok: true, sameVersion: true };
|
|
85
|
+
if (order === null) {
|
|
86
|
+
return { status: 'WARN', line, advice: ['The installed version is not recorded. Run init with this CLI to record it.'], ok: true };
|
|
87
|
+
}
|
|
88
|
+
if (order > 0) {
|
|
89
|
+
return {
|
|
90
|
+
status: 'WARN', line, ok: true,
|
|
91
|
+
advice: [
|
|
92
|
+
`The project has an older release. Run init with this CLI to update it, or check it with ${PACKAGE_NAME}@${installed}.`,
|
|
93
|
+
'File contents are compared only when the versions match.',
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
status: 'FAIL', line, ok: false,
|
|
99
|
+
advice: [
|
|
100
|
+
'This CLI is older than the installed kit: it cannot check that release, and its init would downgrade it.',
|
|
101
|
+
`npx may have run a cached copy (for example when a private registry in .npmrc is unreachable). Run: npx --registry=${PUBLIC_REGISTRY} ${PACKAGE_NAME}@${installed} doctor`,
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function listSome(items, limit = 3) {
|
|
107
|
+
const shown = items.slice(0, limit).join(', ');
|
|
108
|
+
return items.length > limit ? `${shown}, +${items.length - limit} more` : shown;
|
|
109
|
+
}
|
|
110
|
+
|
|
76
111
|
async function doctor(root) {
|
|
77
112
|
const configFile = path.join(root, '.ai-workflow/config.json');
|
|
78
113
|
if (!await exists(configFile)) {
|
|
@@ -88,6 +123,11 @@ async function doctor(root) {
|
|
|
88
123
|
return false;
|
|
89
124
|
}
|
|
90
125
|
|
|
126
|
+
const cliVersion = await readPackageVersion(packageRoot);
|
|
127
|
+
const version = versionCheck(cliVersion, config.packageVersion);
|
|
128
|
+
console.log(`${version.status} ${version.line}`);
|
|
129
|
+
for (const line of version.advice) console.log(` ${line}`);
|
|
130
|
+
|
|
91
131
|
const hosts = Array.isArray(config.hosts) ? config.hosts : [];
|
|
92
132
|
if (hosts.length === 0 || hosts.some((host) => !HOSTS[host])) {
|
|
93
133
|
console.log('MISS configured hosts');
|
|
@@ -110,7 +150,7 @@ async function doctor(root) {
|
|
|
110
150
|
if (name.endsWith('.mjs')) checks.push([`Graph runtime ${name}`, `.ai-workflow/graph/${name}`]);
|
|
111
151
|
}
|
|
112
152
|
|
|
113
|
-
let ok =
|
|
153
|
+
let ok = version.ok;
|
|
114
154
|
for (const [label, relative, routing] of checks) {
|
|
115
155
|
const file = path.join(root, relative);
|
|
116
156
|
let present = await exists(file);
|
|
@@ -122,6 +162,16 @@ async function doctor(root) {
|
|
|
122
162
|
ok &&= present;
|
|
123
163
|
}
|
|
124
164
|
|
|
165
|
+
if (version.sameVersion) {
|
|
166
|
+
const drift = await managedDrift({ root, packageRoot, hosts });
|
|
167
|
+
for (const { relative, files } of drift) {
|
|
168
|
+
console.log(`WARN Mixed version: ${relative} differs from ${cliVersion}${files.length ? ` (${listSome(files)})` : ''}`);
|
|
169
|
+
}
|
|
170
|
+
if (drift.length) {
|
|
171
|
+
console.log(` Kept from an older release or edited locally (a formatter pass counts). To take ${cliVersion}, delete each listed path and re-run init; copy any edits you want to keep first.`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
125
175
|
const visibility = await checkerVisibility(root);
|
|
126
176
|
if (visibility.status === 'ignored') {
|
|
127
177
|
console.log(`MISS Checker reaches git: ${visibility.source}`);
|
|
@@ -172,9 +222,18 @@ async function main(argv) {
|
|
|
172
222
|
|
|
173
223
|
if (command === 'init') {
|
|
174
224
|
const result = await installWorkflow({ root, packageRoot, hosts });
|
|
175
|
-
|
|
225
|
+
const { version, previousVersion } = result;
|
|
226
|
+
if (!result.changed) console.log(`AI Workflow Kit ${version} is already up to date (installed ${previousVersion ?? version}).`);
|
|
227
|
+
else if (!previousVersion) console.log(`Installed AI Workflow Kit ${version}.`);
|
|
228
|
+
else console.log(`Updated AI Workflow Kit ${previousVersion} → ${version}.`);
|
|
229
|
+
if (compareVersions(version, previousVersion) < 0) {
|
|
230
|
+
console.log(`WARNING This CLI (${version}) is older than the kit it replaced (${previousVersion}), so the project was downgraded. If npx ran a cached copy, re-run: npx --registry=${PUBLIC_REGISTRY} ${PACKAGE_NAME}@${previousVersion} init`);
|
|
231
|
+
}
|
|
176
232
|
console.log(`Hosts: ${result.hosts.join(', ')}`);
|
|
177
|
-
if (result.preserved.length)
|
|
233
|
+
if (result.preserved.length) {
|
|
234
|
+
console.log(`Preserved modified files: ${result.preserved.join(', ')}`);
|
|
235
|
+
console.log(`WARNING Mixed-version install: the files above were kept as they were and do not match ${version}. To take ${version}, delete each one and re-run init; copy any local edits you want to keep first.`);
|
|
236
|
+
}
|
|
178
237
|
const visibility = await checkerVisibility(root);
|
|
179
238
|
if (visibility.status === 'ignored') {
|
|
180
239
|
console.log('');
|