autonomous-flow-daemon 1.0.0 → 1.1.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/README.ko.md +93 -36
- package/README.md +84 -28
- package/package.json +1 -1
- package/src/adapters/index.ts +2 -1
- package/src/cli.ts +9 -1
- package/src/commands/lang.ts +41 -0
- package/src/commands/score.ts +91 -31
- package/src/commands/start.ts +64 -23
- package/src/commands/stop.ts +19 -5
- package/src/constants.ts +2 -1
- package/src/core/boast.ts +265 -0
- package/src/core/config.ts +49 -0
- package/src/core/discovery.ts +65 -0
- package/src/core/i18n/messages.ts +266 -0
- package/src/core/locale.ts +88 -0
- package/src/core/notify.ts +43 -12
- package/src/daemon/server.ts +150 -17
- package/src/platform.ts +39 -0
package/README.ko.md
CHANGED
|
@@ -6,7 +6,16 @@
|
|
|
6
6
|
<p align="center"><strong>AI가 스스로 고치는 개발 환경. 복구까지 단 0.2초.</strong></p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<img src="
|
|
9
|
+
<img src="demo.gif" width="850" alt="afd demo" style="border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
|
|
10
|
+
<br>
|
|
11
|
+
<br>
|
|
12
|
+
<b>🛡️ 불멸의 컨텍스트 흐름:</b>
|
|
13
|
+
<em>"afd는 지연 시간이 거의 없는 즉각적인 복구를 통해, AI 개발 흐름이 끊기지 않도록 보호하고 토큰 비용을 혁신적으로 절감합니다."</em>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<img src="https://img.shields.io/badge/version-1.1.0-blue?style=flat-square" alt="version" />
|
|
18
|
+
<a href="https://www.npmjs.com/package/autonomous-flow-daemon"><img src="https://img.shields.io/npm/v/autonomous-flow-daemon?style=flat-square&logo=npm&color=cb0000" alt="npm" /></a>
|
|
10
19
|
<img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square&logo=bun" alt="Bun" />
|
|
11
20
|
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT" />
|
|
12
21
|
<img src="https://img.shields.io/badge/built%20for-Claude%20Code-7c3aed?style=flat-square" alt="Claude Code" />
|
|
@@ -35,6 +44,30 @@
|
|
|
35
44
|
|
|
36
45
|
---
|
|
37
46
|
|
|
47
|
+
## 🚀 제로-간섭 약속 (Zero-Interference Promise)
|
|
48
|
+
|
|
49
|
+
`afd`는 개발 흐름을 방해하는 것이 아니라, 보호하기 위해 설계되었습니다.
|
|
50
|
+
|
|
51
|
+
* **성능 저하 없음:** Bun 기반의 네이티브 백그라운드 데몬으로 실행되어, **CPU 점유율 0.1% 미만**, **메모리 약 40MB**만을 사용합니다.
|
|
52
|
+
* **매끄러운 복구:** **밀리초 미만(Sub-millisecond)의 복구 속도**를 통해, Claude Code가 컨텍스트 오류를 인지하기도 전에 파일을 원래대로 되돌려 놓습니다.
|
|
53
|
+
* **비침습적 설계:** `afd`는 OS 계층에서 파일 시스템 이벤트만 관찰합니다. Claude Code의 내부 실행이나 API 호출을 가로채거나 수정하지 않습니다.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## ✨ 주요 기능 (v1.1.0)
|
|
58
|
+
|
|
59
|
+
| 기능 | 설명 |
|
|
60
|
+
|:-----|:-----|
|
|
61
|
+
| **🛡️ S.E.A.M 자율 치유** | 파일 삭제를 감지하고 270ms 이내에 복구 — AI 에이전트가 눈치채기도 전에 |
|
|
62
|
+
| **🔍 스마트 탐색** | `.claude/`, `.cursorrules`, `.mcp.json` 등 AI 설정 파일을 자동 감지 — 설정 필요 없음 |
|
|
63
|
+
| **🏥 위트 있는 닥터** | 실시간 가치 추적: 절약한 토큰, 시간, 비용을 매 치유마다 위트 있게 알려줍니다 |
|
|
64
|
+
| **🌐 자동 다국어** | 시스템 언어에 따라 한국어/영어를 자동 전환. 직접 설정도 가능: `afd lang ko` |
|
|
65
|
+
| **🧬 더블탭 감지** | 실수와 의도를 구분 — 한 번 지우면 복구, 30초 내 다시 지우면 삭제를 존중 |
|
|
66
|
+
| **💉 백신 네트워크** | `afd sync`로 학습된 항체를 팀 전체에 전파 |
|
|
67
|
+
| **📊 홀로그램 추출** | AI 에이전트에게 80%+ 가벼운 파일 뼈대를 제공해 토큰 비용 절감 |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
38
71
|
## 🚀 명령어 한 줄로 끝나는 경험
|
|
39
72
|
|
|
40
73
|
> **"더 이상의 설정 삽질은 없습니다. 완전한 방어 환경을 구축하세요."**
|
|
@@ -52,15 +85,15 @@ bun link && afd start
|
|
|
52
85
|
이게 전부입니다. 나머지는 `afd`가 알아서 처리합니다:
|
|
53
86
|
|
|
54
87
|
- **자동 훅(Hook) 주입** — Claude Code의 `PreToolUse` 훅을 자동으로 설치합니다. 더 이상 `.json` 파일을 직접 수정하며 고생하지 마세요.
|
|
55
|
-
- **초고속 실시간 감시** — `.claude/`, `CLAUDE.md`, `.cursorrules`
|
|
88
|
+
- **초고속 실시간 감시** — `.claude/`, `CLAUDE.md`, `.cursorrules`, `.claudeignore`, `.gitignore` 핵심 파일을 10ms 단위로 모니터링합니다.
|
|
56
89
|
- **배경 자율 치유** — 파일이 삭제되거나 손상되면 **S.E.A.M 사이클**이 조용히 복구합니다. 사용자가 눈치채기도 전에 모든 상황은 종료됩니다.
|
|
57
90
|
|
|
58
91
|
```
|
|
59
92
|
$ afd start
|
|
60
|
-
🛡️
|
|
93
|
+
🛡️ 데몬 시작 (pid 4812, port 52413)
|
|
94
|
+
🛡️ 스마트 탐색 중: AI 컨텍스트 대상 7개 감시 시작
|
|
95
|
+
Targets: .claude/, CLAUDE.md, .cursorrules, .claudeignore, .gitignore, mcp-config.json, .mcp.json
|
|
61
96
|
✅ .claude/hooks.json에 감시 훅 주입 완료
|
|
62
|
-
👀 감시 중: .claude/, CLAUDE.md, .cursorrules
|
|
63
|
-
✨ 준비되었습니다.
|
|
64
97
|
```
|
|
65
98
|
|
|
66
99
|
> `afd start`를 치고 나면 그냥 잊어버리세요. 그것이 우리가 추구하는 최고의 UX입니다.
|
|
@@ -92,19 +125,40 @@ graph LR
|
|
|
92
125
|
|
|
93
126
|
> **최종 성적표:** 파일 삭제 감지부터 복구 완료까지 **270ms 미만**.
|
|
94
127
|
|
|
128
|
+
### 감시 대상 (Watch Targets)
|
|
129
|
+
|
|
130
|
+
아래 파일들이 실시간 감시됩니다. 면역 파일(IMM-*)은 삭제 시 자동으로 복구됩니다:
|
|
131
|
+
|
|
132
|
+
| 대상 | 유형 | 항체 | 자동 복구 |
|
|
133
|
+
|:-----|:-----|:-----|:----------|
|
|
134
|
+
| `.claude/` | 디렉토리 | IMM-002 (`hooks.json`) | ✅ |
|
|
135
|
+
| `CLAUDE.md` | 파일 | IMM-003 | ✅ |
|
|
136
|
+
| `.claudeignore` | 파일 | IMM-001 | ✅ |
|
|
137
|
+
| `.cursorrules` | 파일 | — | 이벤트 로깅만 |
|
|
138
|
+
| `.gitignore` | 파일 | — | 이벤트 로깅만 |
|
|
139
|
+
| `mcp-config.json` | 파일 | — | 🔍 스마트 탐색 |
|
|
140
|
+
| `.mcp.json` | 파일 | — | 🔍 스마트 탐색 |
|
|
141
|
+
| `.ai/` | 디렉토리 | — | 🔍 스마트 탐색 |
|
|
142
|
+
| `.windsurfrules` | 파일 | — | 🔍 스마트 탐색 |
|
|
143
|
+
|
|
144
|
+
> 항체는 **데몬 시작 시 자동으로 학습**되며, **파일 변경 시마다 갱신**됩니다 — 복구 시 항상 최신 내용이 반영됩니다.
|
|
145
|
+
>
|
|
146
|
+
> 🔍 **스마트 탐색**은 시작 시 12개 이상의 AI 설정 패턴을 0.1ms 미만으로 스캔하여, 발견된 파일을 자동으로 감시 목록에 추가합니다.
|
|
147
|
+
|
|
95
148
|
---
|
|
96
149
|
|
|
97
|
-
## 🛠️
|
|
150
|
+
## 🛠️ 명령어
|
|
98
151
|
|
|
99
|
-
복잡한 건 빼고, 꼭 필요한
|
|
152
|
+
복잡한 건 빼고, 꼭 필요한 것만 담았습니다.
|
|
100
153
|
|
|
101
154
|
| 명령어 | 역할 | 핵심 지능 |
|
|
102
155
|
|:-------|:-----|:----------|
|
|
103
|
-
| `afd start` | **시동** |
|
|
156
|
+
| `afd start` | **시동** | 스마트 탐색 + 데몬 가동 + 자동 훅 주입 |
|
|
104
157
|
| `afd fix` | **수술** | 현재 프로젝트 진단 및 새로운 항체 학습 |
|
|
105
|
-
| `afd score` | **대시보드** |
|
|
158
|
+
| `afd score` | **대시보드** | 다국어 건강 검진 리포트 & 가치 분석 |
|
|
106
159
|
| `afd sync` | **전파** | 학습된 항체를 백신 파일로 추출 (팀 공유용) |
|
|
107
|
-
| `afd
|
|
160
|
+
| `afd lang` | **언어** | 표시 언어 전환 (`afd lang ko` / `afd lang en`) |
|
|
161
|
+
| `afd stop` | **종료** | 근무 요약 리포트 + 안전한 종료 |
|
|
108
162
|
|
|
109
163
|
---
|
|
110
164
|
|
|
@@ -112,30 +166,33 @@ graph LR
|
|
|
112
166
|
|
|
113
167
|
```
|
|
114
168
|
┌──────────────────────────────────────────────┐
|
|
115
|
-
│ afd score — 프로젝트 건강 검진
|
|
169
|
+
│ afd score — 프로젝트 건강 검진 │
|
|
116
170
|
├──────────────────────────────────────────────┤
|
|
117
|
-
│ 에코시스템
|
|
171
|
+
│ 에코시스템 : Claude Code │
|
|
118
172
|
├──────────────────────────────────────────────┤
|
|
119
|
-
│ 가동 시간
|
|
120
|
-
│
|
|
121
|
-
│
|
|
173
|
+
│ 가동 시간 : 1h 23m │
|
|
174
|
+
│ 이벤트 : 156 │
|
|
175
|
+
│ 감지된 파일 : 8 │
|
|
122
176
|
├──────────────────────────────────────────────┤
|
|
123
|
-
│ 면역 시스템
|
|
177
|
+
│ 면역 시스템 │
|
|
124
178
|
│ ────────────────────────────── │
|
|
125
|
-
│
|
|
126
|
-
│ 방어 레벨
|
|
127
|
-
│ 자동 치유
|
|
128
|
-
│ 최근 치유 : IMM-003 (.claudeignore 복구) │
|
|
179
|
+
│ 항체 수 : 7 │
|
|
180
|
+
│ 방어 레벨 : 철통 방어 │
|
|
181
|
+
│ 자동 치유 : 3건 백그라운드 치유됨 │
|
|
129
182
|
├──────────────────────────────────────────────┤
|
|
130
|
-
│
|
|
183
|
+
│ 📈 전달된 가치 │
|
|
131
184
|
│ ────────────────────────────── │
|
|
132
|
-
│
|
|
133
|
-
│
|
|
185
|
+
│ 절약한 토큰 : ~2.9K │
|
|
186
|
+
│ 아낀 시간 : ~40 min │
|
|
187
|
+
│ 절감 비용 : ~$0.01 │
|
|
134
188
|
├──────────────────────────────────────────────┤
|
|
135
|
-
│
|
|
189
|
+
│ 🗣️ 면역 체계 이상 무. 오늘도 한 건 │
|
|
190
|
+
│ 해결했습니다 💪 │
|
|
136
191
|
└──────────────────────────────────────────────┘
|
|
137
192
|
```
|
|
138
193
|
|
|
194
|
+
> `afd lang en` 을 실행하면 대시보드의 모든 레이블이 영어로 전환됩니다.
|
|
195
|
+
|
|
139
196
|
---
|
|
140
197
|
|
|
141
198
|
## 💎 고도로 설계된 안전 장치
|
|
@@ -145,12 +202,13 @@ graph LR
|
|
|
145
202
|
`afd`는 바보처럼 무조건 되살리지 않습니다. 사용자의 **진짜 의도**를 읽습니다:
|
|
146
203
|
|
|
147
204
|
```bash
|
|
148
|
-
$rm .claudeignore # 1차 삭제: "실수인가 보군."
|
|
149
|
-
|
|
205
|
+
$ rm .claudeignore # 1차 삭제: "실수인가 보군." → 즉시 복구
|
|
206
|
+
$ rm .claudeignore # 30초 내 재삭제: "진짜 지우고 싶구나?"
|
|
207
|
+
🫡 [afd] 사용자 의도 확인. 항체 IMM-001 휴면 전환. 삭제를 존중합니다.
|
|
150
208
|
```
|
|
151
209
|
|
|
152
210
|
- **실수 방어:** 한 번의 삭제는 0.2초 만에 즉시 복구합니다.
|
|
153
|
-
- **의도 존중:**
|
|
211
|
+
- **의도 존중:** 30초 내에 같은 파일을 또 지우면 사용자의 확고한 의지로 판단해 복구를 멈춥니다.
|
|
154
212
|
- **Git 쇼크 방지:** `git checkout`처럼 수많은 파일이 한꺼번에 바뀌는 상황(1초 내 3개 이상)은 '대규모 이벤트'로 자동 인식하여 과도한 치유 동작을 멈춥니다.
|
|
155
213
|
|
|
156
214
|
### 백신 네트워크 (팀 전파)
|
|
@@ -188,12 +246,6 @@ Claude Code MCP 설정(`~/.claude/mcp.json` 또는 프로젝트 `.mcp.json`)에
|
|
|
188
246
|
}
|
|
189
247
|
```
|
|
190
248
|
|
|
191
|
-
또는 포함된 매니페스트를 바로 복사하세요:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
cp mcp-config.json .mcp.json
|
|
195
|
-
```
|
|
196
|
-
|
|
197
249
|
### 수동 실행
|
|
198
250
|
|
|
199
251
|
```bash
|
|
@@ -210,9 +262,14 @@ afd start # 백그라운드 데몬 시작 및 훅 자동 주입
|
|
|
210
262
|
|
|
211
263
|
## 🛠️ 기술 스택
|
|
212
264
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
265
|
+
| 계층 | 기술 | 선택 이유 |
|
|
266
|
+
|:-----|:-----|:----------|
|
|
267
|
+
| 런타임 | **Bun** | 네이티브 TypeScript, 초고속 SQLite, 단일 바이너리 |
|
|
268
|
+
| 데이터베이스 | **Bun SQLite (WAL)** | 읽기 0.29ms, 쓰기 24ms, 크래시 안전 |
|
|
269
|
+
| 파일 감시 | **Chokidar** | 크로스플랫폼, 실전 검증된 와처 |
|
|
270
|
+
| 패칭 | **RFC 6902 JSON-Patch** | 결정론적이고 조합 가능한 파일 변이 |
|
|
271
|
+
| CLI | **Commander.js** | 표준적이고 예측 가능한 커맨드 파싱 |
|
|
272
|
+
| 다국어 | **자체 i18n 엔진** | 외부 의존성 없이 0.01ms로 언어 전환 |
|
|
216
273
|
|
|
217
274
|
---
|
|
218
275
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,20 @@
|
|
|
6
6
|
<p align="center"><strong>Self-healing AI development environments in < 270ms.</strong></p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<
|
|
9
|
+
<a href="https://github.com/dotoricode/autonomous-flow-daemon">
|
|
10
|
+
<img src="demo.gif" width="850" alt="afd demo" style="border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
|
|
11
|
+
</a>
|
|
12
|
+
<br>
|
|
13
|
+
<br>
|
|
14
|
+
<b>🛡️ Immortal Context Flow:</b>
|
|
15
|
+
<em>"afd restores critical config files with <b>near-zero latency</b>, ensuring your AI workflow remains unbroken and cost-efficient."</em>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="https://img.shields.io/badge/version-1.1.0-blue?style=flat-square" alt="version" />
|
|
22
|
+
<a href="https://www.npmjs.com/package/autonomous-flow-daemon"><img src="https://img.shields.io/npm/v/autonomous-flow-daemon?style=flat-square&logo=npm&color=cb0000" alt="npm" /></a>
|
|
10
23
|
<img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square&logo=bun" alt="Bun" />
|
|
11
24
|
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT" />
|
|
12
25
|
<img src="https://img.shields.io/badge/built%20for-Claude%20Code-7c3aed?style=flat-square" alt="Claude Code" />
|
|
@@ -35,6 +48,30 @@ With `afd`, the daemon noticed in 10ms, restored the file in 184ms, and logged i
|
|
|
35
48
|
|
|
36
49
|
---
|
|
37
50
|
|
|
51
|
+
## 🚀 Zero-Interference Promise
|
|
52
|
+
|
|
53
|
+
We built `afd` to protect your flow, not to slow it down.
|
|
54
|
+
|
|
55
|
+
* **No Performance Hit:** Running as a native background daemon via Bun, `afd` consumes **< 0.1% CPU** and **~40MB RAM**.
|
|
56
|
+
* **Seamless Recovery:** With **sub-millisecond healing**, files are restored before Claude Code can even register a missing context error.
|
|
57
|
+
* **Non-Invasive:** `afd` observes file system events from the OS layer. It never intercepts or modifies Claude Code's internal execution or API calls.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## ✨ Key Features (v1.1.0)
|
|
62
|
+
|
|
63
|
+
| Feature | What it does |
|
|
64
|
+
|:--------|:-------------|
|
|
65
|
+
| **🛡️ S.E.A.M Auto-Heal** | Detects file deletion and restores it in < 270ms — before your AI agent notices |
|
|
66
|
+
| **🔍 Smart Discovery** | Automatically scans for AI-context files (`.claude/`, `.cursorrules`, `.mcp.json`, etc.) — zero config required |
|
|
67
|
+
| **🏥 Boastful Doctor** | Real-time value tracking: saved tokens, time, and cost — with witty feedback after every heal |
|
|
68
|
+
| **🌐 Auto-Localization** | Seamlessly switches between Korean and English based on your system locale. Or set it: `afd lang ko` |
|
|
69
|
+
| **🧬 Double-Tap Heuristic** | Distinguishes accidents from intent — delete once, afd heals it; delete again within 30s, afd respects your decision |
|
|
70
|
+
| **💉 Vaccine Network** | Export learned antibodies via `afd sync` for cross-project, cross-team immunity |
|
|
71
|
+
| **📊 Hologram Extraction** | Serves 80%+ lighter file skeletons to AI agents, slashing token costs |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
38
75
|
## The One-Command Experience
|
|
39
76
|
|
|
40
77
|
> **Zero-Config. Total Protection.**
|
|
@@ -52,15 +89,15 @@ bun link && afd start
|
|
|
52
89
|
That's it. One command. `afd` takes over from here:
|
|
53
90
|
|
|
54
91
|
- **Auto-Injection** — Installs `PreToolUse` hooks into Claude Code silently. No manual config editing.
|
|
55
|
-
- **Sense (Watcher)** — 10ms real-time monitoring of critical configs: `.claude/`, `CLAUDE.md`, `.cursorrules`.
|
|
92
|
+
- **Sense (Watcher)** — 10ms real-time monitoring of critical configs: `.claude/`, `CLAUDE.md`, `.cursorrules`, `.claudeignore`, `.gitignore`.
|
|
56
93
|
- **Auto-Heal** — Silent background repair of missing or corrupted files using the **S.E.A.M cycle**. You won't even notice it happened.
|
|
57
94
|
|
|
58
95
|
```
|
|
59
96
|
$ afd start
|
|
60
|
-
|
|
97
|
+
🛡️ Daemon started (pid 4812, port 52413)
|
|
98
|
+
🛡️ Smart Discovery: Watching 7 AI-context targets
|
|
99
|
+
Targets: .claude/, CLAUDE.md, .cursorrules, .claudeignore, .gitignore, mcp-config.json, .mcp.json
|
|
61
100
|
Hook injected into .claude/hooks.json
|
|
62
|
-
Watching: .claude/, CLAUDE.md, .cursorrules
|
|
63
|
-
Ready.
|
|
64
101
|
```
|
|
65
102
|
|
|
66
103
|
> You type `afd start`. Then you forget about it. That's the entire UX.
|
|
@@ -92,28 +129,50 @@ graph LR
|
|
|
92
129
|
|
|
93
130
|
> Full cycle: **< 270ms** from file deletion to full recovery.
|
|
94
131
|
|
|
132
|
+
### Watch Targets
|
|
133
|
+
|
|
134
|
+
These files are monitored in real-time. Immune files (IMM-*) are automatically restored on deletion:
|
|
135
|
+
|
|
136
|
+
| Target | Type | Antibody | Auto-Restore |
|
|
137
|
+
|:-------|:-----|:---------|:-------------|
|
|
138
|
+
| `.claude/` | Directory | IMM-002 (`hooks.json`) | ✅ |
|
|
139
|
+
| `CLAUDE.md` | File | IMM-003 | ✅ |
|
|
140
|
+
| `.claudeignore` | File | IMM-001 | ✅ |
|
|
141
|
+
| `.cursorrules` | File | — | Event logging only |
|
|
142
|
+
| `.gitignore` | File | — | Event logging only |
|
|
143
|
+
| `mcp-config.json` | File | — | 🔍 Smart Discovery |
|
|
144
|
+
| `.mcp.json` | File | — | 🔍 Smart Discovery |
|
|
145
|
+
| `.ai/` | Directory | — | 🔍 Smart Discovery |
|
|
146
|
+
| `.windsurfrules` | File | — | 🔍 Smart Discovery |
|
|
147
|
+
|
|
148
|
+
> Antibodies are **auto-seeded on startup** with each file's current content, and **refreshed on every change** — so restores always reflect the latest version.
|
|
149
|
+
>
|
|
150
|
+
> 🔍 **Smart Discovery** scans for 12+ known AI-config patterns at startup (< 0.1ms) and adds any found files to the active watch list automatically.
|
|
151
|
+
|
|
95
152
|
---
|
|
96
153
|
|
|
97
|
-
##
|
|
154
|
+
## Commands
|
|
98
155
|
|
|
99
156
|
Everything you need. Nothing you don't.
|
|
100
157
|
|
|
101
158
|
| Command | Essence | Intelligence Inside |
|
|
102
159
|
|:--------|:--------|:--------------------|
|
|
103
|
-
| `afd start` | **Ignite** | Daemon spawn + Hook injection |
|
|
160
|
+
| `afd start` | **Ignite** | Daemon spawn + Smart Discovery + Hook injection |
|
|
104
161
|
| `afd fix` | **Diagnose** | Symptom detection & Antibody learning |
|
|
105
|
-
| `afd score` | **Vitals** |
|
|
162
|
+
| `afd score` | **Vitals** | Localized health dashboard & Value metrics |
|
|
106
163
|
| `afd sync` | **Federate** | Vaccine payload export for cross-project immunity |
|
|
107
|
-
| `afd
|
|
164
|
+
| `afd lang` | **Localize** | Switch display language (`afd lang ko` / `afd lang en`) |
|
|
165
|
+
| `afd stop` | **Quarantine** | Shift summary & Graceful shutdown |
|
|
108
166
|
|
|
109
167
|
### Quick Reference
|
|
110
168
|
|
|
111
169
|
```bash
|
|
112
170
|
afd start # Start daemon, inject hooks, begin watching
|
|
113
171
|
afd fix # Scan for issues, auto-patch, learn antibodies
|
|
114
|
-
afd score # Full diagnostic dashboard
|
|
172
|
+
afd score # Full diagnostic dashboard (localized)
|
|
115
173
|
afd sync # Export antibodies to .afd/global-vaccine-payload.json
|
|
116
|
-
afd
|
|
174
|
+
afd lang ko # Switch to Korean / afd lang en for English
|
|
175
|
+
afd stop # Shift summary + graceful shutdown
|
|
117
176
|
```
|
|
118
177
|
|
|
119
178
|
---
|
|
@@ -134,19 +193,21 @@ afd stop # Graceful shutdown
|
|
|
134
193
|
│ ────────────────────────────── │
|
|
135
194
|
│ Antibodies : 7 │
|
|
136
195
|
│ Level : Fortified │
|
|
137
|
-
│ Auto-healed : 3 background events
|
|
138
|
-
│ Last heal : IMM-003 (12m ago) │
|
|
196
|
+
│ Auto-healed : 3 background events │
|
|
139
197
|
├──────────────────────────────────────────────┤
|
|
140
|
-
│
|
|
198
|
+
│ 📈 Value Delivered │
|
|
141
199
|
│ ────────────────────────────── │
|
|
142
|
-
│
|
|
143
|
-
│
|
|
144
|
-
│
|
|
200
|
+
│ Tokens saved : ~2.9K │
|
|
201
|
+
│ Time saved : ~40 min │
|
|
202
|
+
│ Cost saved : ~$0.01 │
|
|
145
203
|
├──────────────────────────────────────────────┤
|
|
146
|
-
│
|
|
204
|
+
│ 🗣️ The immune system holds. Another day, │
|
|
205
|
+
│ another heal. 💪 │
|
|
147
206
|
└──────────────────────────────────────────────┘
|
|
148
207
|
```
|
|
149
208
|
|
|
209
|
+
> The dashboard is fully localized. Run `afd lang ko` and every label switches to Korean.
|
|
210
|
+
|
|
150
211
|
---
|
|
151
212
|
|
|
152
213
|
## Advanced Intelligence
|
|
@@ -157,15 +218,15 @@ afd stop # Graceful shutdown
|
|
|
157
218
|
|
|
158
219
|
```
|
|
159
220
|
$ rm .claudeignore # First tap → afd heals it silently
|
|
160
|
-
$ rm .claudeignore # Second tap within
|
|
161
|
-
[afd] Antibody IMM-001
|
|
221
|
+
$ rm .claudeignore # Second tap within 30s → "You meant it."
|
|
222
|
+
[afd] 🫡 Antibody IMM-001 retired. Double-tap detected. Standing down.
|
|
162
223
|
```
|
|
163
224
|
|
|
164
225
|
| Scenario | Response |
|
|
165
226
|
|:---------|:---------|
|
|
166
227
|
| Single delete (accident) | Auto-heal + record first tap |
|
|
167
|
-
| Re-delete within
|
|
168
|
-
| Re-delete after
|
|
228
|
+
| Re-delete within 30s (intent) | Antibody goes dormant, deletion respected |
|
|
229
|
+
| Re-delete after 30s | Fresh first tap, heals again |
|
|
169
230
|
| 3+ deletes in 1s (git checkout) | Mass-event detected, all suppression paused |
|
|
170
231
|
|
|
171
232
|
### Vaccine Network (Team Federation)
|
|
@@ -223,12 +284,6 @@ Add to your Claude Code MCP config (`~/.claude/mcp.json` or project-level `.mcp.
|
|
|
223
284
|
}
|
|
224
285
|
```
|
|
225
286
|
|
|
226
|
-
Or copy the included manifest directly:
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
cp mcp-config.json .mcp.json
|
|
230
|
-
```
|
|
231
|
-
|
|
232
287
|
### Manual
|
|
233
288
|
|
|
234
289
|
```bash
|
|
@@ -252,6 +307,7 @@ Once registered, Claude Code will display the live status line:
|
|
|
252
307
|
| Watching | **Chokidar** | Cross-platform, battle-tested file watcher |
|
|
253
308
|
| Patching | **RFC 6902 JSON-Patch** | Deterministic, composable file mutations |
|
|
254
309
|
| CLI | **Commander.js** | Standard, zero-surprise command parsing |
|
|
310
|
+
| i18n | **Built-in engine** | Zero-dependency locale switching in 0.01ms |
|
|
255
311
|
|
|
256
312
|
---
|
|
257
313
|
|
package/package.json
CHANGED
package/src/adapters/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
2
2
|
import { join, dirname } from "path";
|
|
3
|
+
import { resolveHookCommand } from "../platform";
|
|
3
4
|
|
|
4
5
|
export interface HarnessSchema {
|
|
5
6
|
configFiles: string[];
|
|
@@ -48,7 +49,7 @@ export const ClaudeCodeAdapter: EcosystemAdapter = {
|
|
|
48
49
|
},
|
|
49
50
|
injectHooks(cwd: string): { injected: boolean; message: string } {
|
|
50
51
|
const hooksPath = join(cwd, ".claude", "hooks.json");
|
|
51
|
-
const hookCommand =
|
|
52
|
+
const hookCommand = resolveHookCommand();
|
|
52
53
|
|
|
53
54
|
const newHook: HookEntry = {
|
|
54
55
|
id: AFD_HOOK_MARKER,
|
package/src/cli.ts
CHANGED
|
@@ -6,17 +6,19 @@ import { scoreCommand } from "./commands/score";
|
|
|
6
6
|
import { fixCommand } from "./commands/fix";
|
|
7
7
|
import { syncCommand } from "./commands/sync";
|
|
8
8
|
import { diagnoseCommand } from "./commands/diagnose";
|
|
9
|
+
import { langCommand } from "./commands/lang";
|
|
9
10
|
|
|
10
11
|
const program = new Command();
|
|
11
12
|
|
|
12
13
|
program
|
|
13
14
|
.name("afd")
|
|
14
15
|
.description("Autonomous Flow Daemon - The Immune System for AI Workflows")
|
|
15
|
-
.version("1.
|
|
16
|
+
.version("1.1.0");
|
|
16
17
|
|
|
17
18
|
program
|
|
18
19
|
.command("start")
|
|
19
20
|
.description("Start the afd daemon (background file watcher)")
|
|
21
|
+
.option("--mcp", "Run in MCP stdio mode (for Claude Code tool integration)")
|
|
20
22
|
.action(startCommand);
|
|
21
23
|
|
|
22
24
|
program
|
|
@@ -46,4 +48,10 @@ program
|
|
|
46
48
|
.option("--auto-heal", "Auto-apply patches for known antibodies")
|
|
47
49
|
.action(diagnoseCommand);
|
|
48
50
|
|
|
51
|
+
program
|
|
52
|
+
.command("lang [language]")
|
|
53
|
+
.description("Show or change display language (en, ko)")
|
|
54
|
+
.option("--list", "Show all supported languages")
|
|
55
|
+
.action(langCommand);
|
|
56
|
+
|
|
49
57
|
program.parse();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getSystemLanguage, getSupportedLanguages, setLanguageOverride } from "../core/locale";
|
|
2
|
+
import type { SupportedLang } from "../core/locale";
|
|
3
|
+
import { writeConfig, getConfigPath } from "../core/config";
|
|
4
|
+
import { getMessages, t } from "../core/i18n/messages";
|
|
5
|
+
|
|
6
|
+
export function langCommand(targetLang?: string, options?: { list?: boolean }) {
|
|
7
|
+
const currentLang = getSystemLanguage();
|
|
8
|
+
const msg = getMessages(currentLang);
|
|
9
|
+
const supported = getSupportedLanguages();
|
|
10
|
+
|
|
11
|
+
// afd lang --list
|
|
12
|
+
if (options?.list) {
|
|
13
|
+
console.log(msg.LANG_LIST_TITLE);
|
|
14
|
+
for (const lang of supported) {
|
|
15
|
+
const marker = lang === currentLang ? " ← current" : "";
|
|
16
|
+
console.log(` ${lang}${marker}`);
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// afd lang (no argument) — show current
|
|
22
|
+
if (!targetLang) {
|
|
23
|
+
console.log(t(msg.LANG_CURRENT, { lang: currentLang }));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// afd lang <en|ko> — change language
|
|
28
|
+
if (!supported.includes(targetLang as SupportedLang)) {
|
|
29
|
+
console.error(t(msg.LANG_INVALID, { lang: targetLang, supported: supported.join(", ") }));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const newLang = targetLang as SupportedLang;
|
|
34
|
+
writeConfig({ lang: newLang });
|
|
35
|
+
setLanguageOverride(newLang);
|
|
36
|
+
|
|
37
|
+
// Print feedback in the NEW language
|
|
38
|
+
const newMsg = getMessages(newLang);
|
|
39
|
+
console.log(t(newMsg.LANG_CHANGED, { lang: newLang }));
|
|
40
|
+
console.log(t(newMsg.LANG_SAVED, { path: getConfigPath() }));
|
|
41
|
+
}
|