@tienne/gestalt 0.126.0 → 0.128.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.md +1 -0
- package/README.ko.md +15 -5
- package/README.md +19 -6
- package/dist/bin/gestalt.js +28 -3
- package/dist/bin/gestalt.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/scripts/gestalt-cli.mjs +1 -0
- package/dist/src/agent-sync/config.d.ts +76 -0
- package/dist/src/agent-sync/config.d.ts.map +1 -0
- package/dist/src/agent-sync/config.js +55 -0
- package/dist/src/agent-sync/config.js.map +1 -0
- package/dist/src/agent-sync/doctor.d.ts +48 -0
- package/dist/src/agent-sync/doctor.d.ts.map +1 -0
- package/dist/src/agent-sync/doctor.js +150 -0
- package/dist/src/agent-sync/doctor.js.map +1 -0
- package/dist/src/agent-sync/format.d.ts +8 -0
- package/dist/src/agent-sync/format.d.ts.map +1 -0
- package/dist/src/agent-sync/format.js +81 -0
- package/dist/src/agent-sync/format.js.map +1 -0
- package/dist/src/agent-sync/fs-ops.d.ts +17 -0
- package/dist/src/agent-sync/fs-ops.d.ts.map +1 -0
- package/dist/src/agent-sync/fs-ops.js +79 -0
- package/dist/src/agent-sync/fs-ops.js.map +1 -0
- package/dist/src/agent-sync/inspect.d.ts +53 -0
- package/dist/src/agent-sync/inspect.d.ts.map +1 -0
- package/dist/src/agent-sync/inspect.js +106 -0
- package/dist/src/agent-sync/inspect.js.map +1 -0
- package/dist/src/agent-sync/orca.d.ts +33 -0
- package/dist/src/agent-sync/orca.d.ts.map +1 -0
- package/dist/src/agent-sync/orca.js +110 -0
- package/dist/src/agent-sync/orca.js.map +1 -0
- package/dist/src/agent-sync/paths.d.ts +20 -0
- package/dist/src/agent-sync/paths.d.ts.map +1 -0
- package/dist/src/agent-sync/paths.js +31 -0
- package/dist/src/agent-sync/paths.js.map +1 -0
- package/dist/src/agent-sync/revert.d.ts +41 -0
- package/dist/src/agent-sync/revert.d.ts.map +1 -0
- package/dist/src/agent-sync/revert.js +318 -0
- package/dist/src/agent-sync/revert.js.map +1 -0
- package/dist/src/agent-sync/run-store.d.ts +690 -0
- package/dist/src/agent-sync/run-store.d.ts.map +1 -0
- package/dist/src/agent-sync/run-store.js +241 -0
- package/dist/src/agent-sync/run-store.js.map +1 -0
- package/dist/src/agent-sync/sync.d.ts +79 -0
- package/dist/src/agent-sync/sync.d.ts.map +1 -0
- package/dist/src/agent-sync/sync.js +294 -0
- package/dist/src/agent-sync/sync.js.map +1 -0
- package/dist/src/agent-sync/targets.d.ts +35 -0
- package/dist/src/agent-sync/targets.d.ts.map +1 -0
- package/dist/src/agent-sync/targets.js +112 -0
- package/dist/src/agent-sync/targets.js.map +1 -0
- package/dist/src/cli/commands/agent-sync.d.ts +22 -0
- package/dist/src/cli/commands/agent-sync.d.ts.map +1 -0
- package/dist/src/cli/commands/agent-sync.js +85 -0
- package/dist/src/cli/commands/agent-sync.js.map +1 -0
- package/dist/src/cli/commands/update.d.ts +1 -0
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +19 -2
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/cli/follow-plugin.d.ts +58 -0
- package/dist/src/cli/follow-plugin.d.ts.map +1 -0
- package/dist/src/cli/follow-plugin.js +250 -0
- package/dist/src/cli/follow-plugin.js.map +1 -0
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +20 -0
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +5 -2
- package/plugin/mcp.json +5 -2
- package/plugin/scripts/gestalt-cli.mjs +1 -0
package/CLAUDE.md
CHANGED
|
@@ -31,6 +31,7 @@ MCP 도구 목록과 액션 스키마는 `src/mcp/`의 툴 정의가 기준이
|
|
|
31
31
|
아키텍처 그림 → [`docs/architecture-view.md`](./docs/architecture-view.md)
|
|
32
32
|
WebFetch 캐시 훅 → [`docs/webfetch-cache.md`](./docs/webfetch-cache.md)
|
|
33
33
|
Codex 훅 지원 범위 → [`docs/codex-hooks.md`](./docs/codex-hooks.md)
|
|
34
|
+
규칙과 스킬 동기화 → [`docs/agent-sync.md`](./docs/agent-sync.md)
|
|
34
35
|
설계 제안 → [docs/proposals/](./docs/proposals/README.md)
|
|
35
36
|
|
|
36
37
|
## Role Agent 자동 라우팅
|
package/README.ko.md
CHANGED
|
@@ -125,7 +125,7 @@ Spec과 실행 결과는 레포 루트의 `.gestalt/memory.json`에 자동으로
|
|
|
125
125
|
|
|
126
126
|
## 설치
|
|
127
127
|
|
|
128
|
-
> **Windows 호스트는 지원하지 않아요.** 플러그인이 MCP 서버를 `sh -c`로 띄우는데 Windows 호스트에서는 이게 안 돌고 CI도 Ubuntu와 macOS에서만 돌려요. 그래도 Windows에서 써보려면 `npm i -g @tienne/gestalt`로 전역 설치한 다음 MCP 설정에 `"command": "gestalt"`, `"args": ["serve"]
|
|
128
|
+
> **Windows 호스트는 지원하지 않아요.** 플러그인이 MCP 서버를 `sh -c`로 띄우는데 Windows 호스트에서는 이게 안 돌고 CI도 Ubuntu와 macOS에서만 돌려요. 그래도 Windows에서 써보려면 `npm i -g @tienne/gestalt`로 전역 설치한 다음 MCP 설정에 `"command": "gestalt"`, `"args": ["serve"]`, `"env": { "GESTALT_FOLLOW_PLUGIN": "0" }`을 직접 넣으세요. [옵션 3](#옵션-3-claude-code-cli)과 같은 방식이에요.
|
|
129
129
|
|
|
130
130
|
### 옵션 1: Claude Code 플러그인 (권장)
|
|
131
131
|
|
|
@@ -173,7 +173,8 @@ npm install -g @tienne/gestalt
|
|
|
173
173
|
"mcpServers": {
|
|
174
174
|
"gestalt": {
|
|
175
175
|
"command": "gestalt",
|
|
176
|
-
"args": ["serve"]
|
|
176
|
+
"args": ["serve"],
|
|
177
|
+
"env": { "GESTALT_FOLLOW_PLUGIN": "0" }
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
}
|
|
@@ -189,7 +190,7 @@ Claude Code Desktop을 재시작하면 MCP 도구가 즉시 사용 가능해요.
|
|
|
189
190
|
|
|
190
191
|
```bash
|
|
191
192
|
npm install -g @tienne/gestalt
|
|
192
|
-
claude mcp add gestalt -- gestalt serve
|
|
193
|
+
claude mcp add gestalt -e GESTALT_FOLLOW_PLUGIN=0 -- gestalt serve
|
|
193
194
|
```
|
|
194
195
|
|
|
195
196
|
또는 `~/.claude/settings.json`을 직접 편집하세요:
|
|
@@ -199,7 +200,8 @@ claude mcp add gestalt -- gestalt serve
|
|
|
199
200
|
"mcpServers": {
|
|
200
201
|
"gestalt": {
|
|
201
202
|
"command": "gestalt",
|
|
202
|
-
"args": ["serve"]
|
|
203
|
+
"args": ["serve"],
|
|
204
|
+
"env": { "GESTALT_FOLLOW_PLUGIN": "0" }
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
}
|
|
@@ -225,6 +227,12 @@ claude mcp add gestalt -- gestalt serve
|
|
|
225
227
|
|
|
226
228
|
플러그인 설치(옵션 1)는 앞의 둘을 `scripts/mcp-serve.sh`가 알아서 처리해요. Node는 nvm, fnm, Volta, Homebrew 밑에서 찾고요. 전역 설치된 `gestalt`는 버전이 플러그인 핀과 같을 때만 씁니다. 핀과 다른 버전이 깔려 있으면 경고만 남기고 무시해서 플러그인만 업데이트해도 최신으로 뜨고요. 그 외에는 핀된 버전을 npm 캐시에서 바로 해석합니다.
|
|
227
229
|
|
|
230
|
+
터미널의 `gestalt`도 같은 식으로 플러그인을 따라가요. `npm i -g`로 깐 전역 설치본은 설치된 gestalt 플러그인을 찾아서 버전이 다르면 그 플러그인의 런처로 명령을 넘겨요. 그래서 플러그인만 업데이트해도 CLI가 같이 올라가요.
|
|
231
|
+
|
|
232
|
+
찾는 자리는 Claude Code에서 사용자 범위로 설치한 `gestalt@gestalt`와 Codex에서 켜 둔 gestalt 마켓플레이스 플러그인(`CODEX_HOME`이나 `~/.codex`)이에요. Claude Code는 `CLAUDE_CONFIG_DIR`과 `~/.claude`의 `installed_plugins.json`을 모두 보고 그 자리의 `settings.json`에서 플러그인을 꺼 뒀으면 건너뛰어요. 설치가 여럿이면 가장 높은 버전을 따르고 전역 쪽이 더 새 버전이어도 플러그인을 따라요.
|
|
233
|
+
|
|
234
|
+
레포 체크아웃이나 프로젝트 의존성, npx 캐시에서 도는 실행은 그 버전 그대로 돌아요. 다만 버전을 고정하지 않은 `npx -y @tienne/gestalt`는 전역에 어떤 버전이 깔려 있든 전역 실행 파일을 부르니, 버전을 꼭 고정해야 하면 `GESTALT_FOLLOW_PLUGIN=0`을 함께 주세요. 플러그인 매니페스트의 MCP 기동과 `gestalt update`, 이 문서의 Claude Code와 Codex 예시는 이미 그렇게 해 뒀어요. Grok이나 Gemini 명령처럼 다른 방법으로 등록하면 그 env에도 같은 값을 넣어 주세요. 이미 등록해 둔 Codex는 `config.toml`(`CODEX_HOME`이나 `~/.codex`)의 `[mcp_servers.gestalt.env]`에 `GESTALT_FOLLOW_PLUGIN = "0"`을 직접 넣어 주세요. `gestalt update`는 npx 등록을 건드리지 않아요. 넘길 때 npm 캐시를 한 번 거쳐서 전역 버전이 플러그인과 다시 같아질 때까지 호출마다 2초쯤 더 걸려요.
|
|
235
|
+
|
|
228
236
|
---
|
|
229
237
|
|
|
230
238
|
### 옵션 4: OpenAI Codex 플러그인
|
|
@@ -273,7 +281,7 @@ Codex desktop 자체는 수동 설치한 플러그인의 훅을 지원하지만
|
|
|
273
281
|
스킬 없이 MCP 도구만 쓰려면 이렇게 해요.
|
|
274
282
|
|
|
275
283
|
```bash
|
|
276
|
-
codex mcp add gestalt -- npx -y @tienne/gestalt serve
|
|
284
|
+
codex mcp add gestalt --env GESTALT_FOLLOW_PLUGIN=0 -- npx -y @tienne/gestalt serve
|
|
277
285
|
```
|
|
278
286
|
|
|
279
287
|
그리고 프로젝트의 `gestalt.json`에 `"client": "codex"`를 넣으면 실행 컨텍스트가 `AGENTS.md`에 기록돼요 (Codex가 자동으로 읽는 파일이에요).
|
|
@@ -323,6 +331,8 @@ Grok도 호스트 패스스루로 동작해요 — Gestalt가 프롬프트와
|
|
|
323
331
|
grok mcp add gestalt -- npx -y @tienne/gestalt serve
|
|
324
332
|
```
|
|
325
333
|
|
|
334
|
+
`gestalt`를 전역에도 깔았다면 버전과 상관없이 이 서버 env에 `GESTALT_FOLLOW_PLUGIN=0`을 넣어 주세요.
|
|
335
|
+
|
|
326
336
|
그리고 옵션 6처럼 `"client": "grok"`를 넣으면 실행 컨텍스트가 `.grok/rules/gestalt-active.md`에 기록돼요. 워크플로 스킬이 필요하면 옵션 6을 쓰세요.
|
|
327
337
|
|
|
328
338
|
---
|
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ Then run the pipeline:
|
|
|
103
103
|
|
|
104
104
|
## Installation
|
|
105
105
|
|
|
106
|
-
> **Windows hosts are not supported.** The plugin starts its MCP server through `sh -c`, which a Windows host cannot run, and CI covers only Ubuntu and macOS. If you want to try it on Windows anyway, install globally with `npm i -g @tienne/gestalt` and register the server yourself with `"command": "gestalt"
|
|
106
|
+
> **Windows hosts are not supported.** The plugin starts its MCP server through `sh -c`, which a Windows host cannot run, and CI covers only Ubuntu and macOS. If you want to try it on Windows anyway, install globally with `npm i -g @tienne/gestalt` and register the server yourself with `"command": "gestalt"`, `"args": ["serve"]`, and `"env": { "GESTALT_FOLLOW_PLUGIN": "0" }`, as in [Option 3](#option-3-claude-code-cli).
|
|
107
107
|
|
|
108
108
|
### Option 1: Claude Code Plugin (Recommended)
|
|
109
109
|
|
|
@@ -146,7 +146,8 @@ npm install -g @tienne/gestalt
|
|
|
146
146
|
"mcpServers": {
|
|
147
147
|
"gestalt": {
|
|
148
148
|
"command": "gestalt",
|
|
149
|
-
"args": ["serve"]
|
|
149
|
+
"args": ["serve"],
|
|
150
|
+
"env": { "GESTALT_FOLLOW_PLUGIN": "0" }
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
}
|
|
@@ -162,7 +163,7 @@ MCP tools are available immediately after restart. Slash commands require the pl
|
|
|
162
163
|
|
|
163
164
|
```bash
|
|
164
165
|
npm install -g @tienne/gestalt
|
|
165
|
-
claude mcp add gestalt -- gestalt serve
|
|
166
|
+
claude mcp add gestalt -e GESTALT_FOLLOW_PLUGIN=0 -- gestalt serve
|
|
166
167
|
```
|
|
167
168
|
|
|
168
169
|
Or add directly to `~/.claude/settings.json`:
|
|
@@ -172,7 +173,8 @@ Or add directly to `~/.claude/settings.json`:
|
|
|
172
173
|
"mcpServers": {
|
|
173
174
|
"gestalt": {
|
|
174
175
|
"command": "gestalt",
|
|
175
|
-
"args": ["serve"]
|
|
176
|
+
"args": ["serve"],
|
|
177
|
+
"env": { "GESTALT_FOLLOW_PLUGIN": "0" }
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
}
|
|
@@ -198,6 +200,12 @@ If the server connects sometimes and reports `Connection closed` other times, th
|
|
|
198
200
|
|
|
199
201
|
The plugin install (Option 1) already handles the first two through `scripts/mcp-serve.sh`: it finds Node under nvm, fnm, Volta, or Homebrew, uses a globally installed `gestalt` only when its version matches the plugin's pin (a global of any other version is ignored with a warning, so updating the plugin is enough), and otherwise resolves the pinned version from the npm cache, falling back to the network only when the cache misses.
|
|
200
202
|
|
|
203
|
+
The terminal `gestalt` follows the plugin the same way. When an `npm i -g` install finds an installed gestalt plugin at a different version, it hands the command to that plugin's launcher, so updating the plugin also updates the CLI.
|
|
204
|
+
|
|
205
|
+
It looks at the user-scope `gestalt@gestalt` install for Claude Code (`installed_plugins.json` under both `CLAUDE_CONFIG_DIR` and `~/.claude`, unless `settings.json` turns the plugin off) and the enabled plugin from the gestalt marketplace for Codex (`CODEX_HOME` or `~/.codex`). With several installs it follows the highest version, even when the global itself is newer.
|
|
206
|
+
|
|
207
|
+
Runs from a repo checkout, a project dependency, or the npx cache keep their own version. An unpinned `npx -y @tienne/gestalt` still runs the global binary whatever version is installed there, so set `GESTALT_FOLLOW_PLUGIN=0` wherever the version must stay pinned. The plugin's MCP manifests and `gestalt update` already do, and so do the Claude Code and Codex examples in this README. If you register the server another way, such as the Grok and Gemini commands, add the same variable to its env. For an existing Codex registration, add `GESTALT_FOLLOW_PLUGIN = "0"` under `[mcp_servers.gestalt.env]` in `config.toml` (`CODEX_HOME` or `~/.codex`); `gestalt update` leaves npx registrations as they are. Delegation goes through the npm cache, so each call takes about two seconds longer until the global matches the plugin again.
|
|
208
|
+
|
|
201
209
|
---
|
|
202
210
|
|
|
203
211
|
### Option 4: OpenAI Codex Plugin
|
|
@@ -256,7 +264,7 @@ the public directory. See [Codex hook support](./docs/codex-hooks.md) for the
|
|
|
256
264
|
If you want the MCP tools without the bundled skills:
|
|
257
265
|
|
|
258
266
|
```bash
|
|
259
|
-
codex mcp add gestalt -- npx -y @tienne/gestalt serve
|
|
267
|
+
codex mcp add gestalt --env GESTALT_FOLLOW_PLUGIN=0 -- npx -y @tienne/gestalt serve
|
|
260
268
|
```
|
|
261
269
|
|
|
262
270
|
Then add `"client": "codex"` to your project's `gestalt.json` so the active session context is written to `AGENTS.md` (which Codex reads automatically):
|
|
@@ -314,6 +322,8 @@ If you want the MCP tools without the bundled skills:
|
|
|
314
322
|
grok mcp add gestalt -- npx -y @tienne/gestalt serve
|
|
315
323
|
```
|
|
316
324
|
|
|
325
|
+
If `gestalt` is also installed globally (any version), add `GESTALT_FOLLOW_PLUGIN=0` to this server's env.
|
|
326
|
+
|
|
317
327
|
Then add `"client": "grok"` as in Option 6. This option ships no skills — the pipeline runs entirely through MCP tool calls. Use Option 6 if you want the workflow skills. During execution, active context is written to `.grok/rules/gestalt-active.md`.
|
|
318
328
|
|
|
319
329
|
---
|
|
@@ -324,6 +334,8 @@ Then add `"client": "grok"` as in Option 6. This option ships no skills — the
|
|
|
324
334
|
gemini mcp add gestalt -- npx -y @tienne/gestalt serve
|
|
325
335
|
```
|
|
326
336
|
|
|
337
|
+
If `gestalt` is also installed globally (any version), add `GESTALT_FOLLOW_PLUGIN=0` to this server's env.
|
|
338
|
+
|
|
327
339
|
Or add directly to `~/.gemini/settings.json`:
|
|
328
340
|
|
|
329
341
|
```json
|
|
@@ -331,7 +343,8 @@ Or add directly to `~/.gemini/settings.json`:
|
|
|
331
343
|
"mcpServers": {
|
|
332
344
|
"gestalt": {
|
|
333
345
|
"command": "npx",
|
|
334
|
-
"args": ["-y", "@tienne/gestalt", "serve"]
|
|
346
|
+
"args": ["-y", "@tienne/gestalt", "serve"],
|
|
347
|
+
"env": { "GESTALT_FOLLOW_PLUGIN": "0" }
|
|
335
348
|
}
|
|
336
349
|
}
|
|
337
350
|
}
|
package/dist/bin/gestalt.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
2
3
|
const major = Number(process.versions.node.split('.')[0]);
|
|
3
4
|
if (major < 22) {
|
|
4
5
|
console.error(`\n gestalt requires Node.js >= 22.0.0 (current: ${process.version})\n\n` +
|
|
@@ -7,7 +8,31 @@ if (major < 22) {
|
|
|
7
8
|
` or: https://nodejs.org/\n`);
|
|
8
9
|
process.exit(1);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const { resolvePluginDelegation, runDelegated } = await import('../src/cli/follow-plugin.js');
|
|
12
|
+
const { getVersion } = await import('../src/core/version.js');
|
|
13
|
+
const target = resolvePluginDelegation({
|
|
14
|
+
selfPath: fileURLToPath(import.meta.url),
|
|
15
|
+
currentVersion: getVersion(),
|
|
16
|
+
});
|
|
17
|
+
if (target) {
|
|
18
|
+
// 사람이 보는 터미널에서만 알린다. 파이프로 읽는 스크립트의 stderr는 건드리지 않는다
|
|
19
|
+
if (process.stderr.isTTY) {
|
|
20
|
+
console.error(`gestalt: following plugin ${target.version} (${target.host}) — GESTALT_FOLLOW_PLUGIN=0 to disable`);
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const { code, signal } = await runDelegated(target, process.argv.slice(2));
|
|
24
|
+
if (signal)
|
|
25
|
+
process.kill(process.pid, signal);
|
|
26
|
+
else
|
|
27
|
+
process.exit(code ?? 1);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(`gestalt: plugin launcher failed (${error.message})`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const { createCli } = await import('../src/cli/index.js');
|
|
36
|
+
createCli().parse();
|
|
37
|
+
}
|
|
13
38
|
//# sourceMappingURL=gestalt.js.map
|
package/dist/bin/gestalt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestalt.js","sourceRoot":"","sources":["../../bin/gestalt.ts"],"names":[],"mappings":";AAEA,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CACX,oDAAoD,OAAO,CAAC,OAAO,OAAO;
|
|
1
|
+
{"version":3,"file":"gestalt.js","sourceRoot":"","sources":["../../bin/gestalt.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CACX,oDAAoD,OAAO,CAAC,OAAO,OAAO;QACxE,mBAAmB;QACnB,oCAAoC;QACpC,+BAA+B,CAClC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,EAAE,uBAAuB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3
|
-
"version": "0.
|
|
3
|
+
"version": "0.128.0",
|
|
4
4
|
"description": "Gestalt psychology-driven AI development harness. Transforms scattered requirements into structured, validated specifications through interactive interviews.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tienne"
|
|
@@ -130,6 +130,7 @@ const terminate = () => child.kill('SIGTERM');
|
|
|
130
130
|
const hangup = () => child.kill('SIGHUP');
|
|
131
131
|
// Group Ctrl-C reaches the child: do not forward it twice. Programmatic callers
|
|
132
132
|
// must use SIGTERM to cancel only this pid. Signal tests cover both delivery modes.
|
|
133
|
+
// bin/gestalt.ts relays the same way through runDelegated in src/cli/follow-plugin.ts.
|
|
133
134
|
const interrupt = () => {};
|
|
134
135
|
process.on('SIGTERM', terminate);
|
|
135
136
|
process.on('SIGHUP', hangup);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const schema: z.ZodObject<{
|
|
3
|
+
/** 호스트에 있어야 하는 도구. 이 목록에 없는 도구는 doctor가 보지 않는다 */
|
|
4
|
+
tools: z.ZodDefault<z.ZodObject<{
|
|
5
|
+
all: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
6
|
+
claude: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
7
|
+
codex: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
codex?: string[] | undefined;
|
|
10
|
+
all?: string[] | undefined;
|
|
11
|
+
claude?: string[] | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
codex?: string[] | undefined;
|
|
14
|
+
all?: string[] | undefined;
|
|
15
|
+
claude?: string[] | undefined;
|
|
16
|
+
}>>;
|
|
17
|
+
/** 오르카 계정 id별 출력 이름과 제외 여부 */
|
|
18
|
+
accounts: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
19
|
+
label: z.ZodOptional<z.ZodString>;
|
|
20
|
+
skip: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
skip?: boolean | undefined;
|
|
23
|
+
label?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
skip?: boolean | undefined;
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
}>>>;
|
|
28
|
+
orcaCommand: z.ZodOptional<z.ZodString>;
|
|
29
|
+
orcaDataDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
30
|
+
rules: z.ZodDefault<z.ZodObject<{
|
|
31
|
+
/** CLAUDE.md를 나눌 때 Claude 쪽에 남길 줄. 줄에 이 문자열이 들어 있으면 남긴다 */
|
|
32
|
+
claudeOnly: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
claudeOnly: string[];
|
|
35
|
+
}, {
|
|
36
|
+
claudeOnly?: string[] | undefined;
|
|
37
|
+
}>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
rules: {
|
|
40
|
+
claudeOnly: string[];
|
|
41
|
+
};
|
|
42
|
+
tools: {
|
|
43
|
+
codex?: string[] | undefined;
|
|
44
|
+
all?: string[] | undefined;
|
|
45
|
+
claude?: string[] | undefined;
|
|
46
|
+
};
|
|
47
|
+
accounts: Record<string, {
|
|
48
|
+
skip?: boolean | undefined;
|
|
49
|
+
label?: string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
orcaCommand?: string | undefined;
|
|
52
|
+
orcaDataDir?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
rules?: {
|
|
55
|
+
claudeOnly?: string[] | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
tools?: {
|
|
58
|
+
codex?: string[] | undefined;
|
|
59
|
+
all?: string[] | undefined;
|
|
60
|
+
claude?: string[] | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
accounts?: Record<string, {
|
|
63
|
+
skip?: boolean | undefined;
|
|
64
|
+
label?: string | undefined;
|
|
65
|
+
}> | undefined;
|
|
66
|
+
orcaCommand?: string | undefined;
|
|
67
|
+
orcaDataDir?: string | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
export type AgentSyncConfig = z.infer<typeof schema>;
|
|
70
|
+
export declare function agentSyncConfigPath(): string;
|
|
71
|
+
export declare class AgentSyncConfigError extends Error {
|
|
72
|
+
}
|
|
73
|
+
export declare function loadAgentSyncConfig(path?: string): AgentSyncConfig;
|
|
74
|
+
export declare function toolsFor(config: AgentSyncConfig, kind: 'claude' | 'codex'): string[];
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/agent-sync/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,QAAA,MAAM,MAAM;IACV,kDAAkD;;;;;;;;;;;;;;IAElD,8BAA8B;;;;;;;;;;;;;;QAe1B,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/D,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAErD,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD,wBAAgB,mBAAmB,CAAC,IAAI,SAAwB,GAAG,eAAe,CAgBjF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,EAAE,CAIpF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { gestaltPath } from '../core/home.js';
|
|
5
|
+
const toolList = z.array(z.string().min(1)).default([]);
|
|
6
|
+
const schema = z.object({
|
|
7
|
+
/** 호스트에 있어야 하는 도구. 이 목록에 없는 도구는 doctor가 보지 않는다 */
|
|
8
|
+
tools: z.object({ all: toolList, claude: toolList, codex: toolList }).partial().default({}),
|
|
9
|
+
/** 오르카 계정 id별 출력 이름과 제외 여부 */
|
|
10
|
+
accounts: z
|
|
11
|
+
.record(z.string(), z.object({ label: z.string().optional(), skip: z.boolean().optional() }))
|
|
12
|
+
.default({}),
|
|
13
|
+
orcaCommand: z.string().min(1).optional(),
|
|
14
|
+
orcaDataDir: z
|
|
15
|
+
.string()
|
|
16
|
+
.min(1)
|
|
17
|
+
.refine((v) => isAbsolute(v) && resolve(v) === v, '절대 경로여야 하고 `.`, `..`, 끝의 `/`, 겹친 `/`가 없어야 해요')
|
|
18
|
+
.optional(),
|
|
19
|
+
rules: z
|
|
20
|
+
.object({
|
|
21
|
+
/** CLAUDE.md를 나눌 때 Claude 쪽에 남길 줄. 줄에 이 문자열이 들어 있으면 남긴다 */
|
|
22
|
+
claudeOnly: z.array(z.string().min(1)).default([]),
|
|
23
|
+
})
|
|
24
|
+
.default({}),
|
|
25
|
+
});
|
|
26
|
+
export function agentSyncConfigPath() {
|
|
27
|
+
return gestaltPath('agent-sync.json');
|
|
28
|
+
}
|
|
29
|
+
export class AgentSyncConfigError extends Error {
|
|
30
|
+
}
|
|
31
|
+
export function loadAgentSyncConfig(path = agentSyncConfigPath()) {
|
|
32
|
+
if (!existsSync(path))
|
|
33
|
+
return schema.parse({});
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = JSON.parse(readFileSync(path, 'utf-8'));
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
throw new AgentSyncConfigError(`${path}를 JSON으로 읽지 못했어요: ${e.message}`);
|
|
40
|
+
}
|
|
41
|
+
const parsed = schema.safeParse(raw);
|
|
42
|
+
if (!parsed.success) {
|
|
43
|
+
const detail = parsed.error.issues
|
|
44
|
+
.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`)
|
|
45
|
+
.join('; ');
|
|
46
|
+
throw new AgentSyncConfigError(`${path} 형식이 맞지 않아요: ${detail}`);
|
|
47
|
+
}
|
|
48
|
+
return parsed.data;
|
|
49
|
+
}
|
|
50
|
+
export function toolsFor(config, kind) {
|
|
51
|
+
const all = config.tools.all ?? [];
|
|
52
|
+
const own = config.tools[kind] ?? [];
|
|
53
|
+
return [...new Set([...all, ...own])];
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/agent-sync/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAExD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,kDAAkD;IAClD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3F,8BAA8B;IAC9B,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CA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AO,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;aAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aAC3D,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,oBAAoB,CAAC,GAAG,IAAI,gBAAgB,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAuB,EAAE,IAAwB;IACxE,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC;IACnC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AgentSyncConfig } from './config.js';
|
|
2
|
+
import type { Target } from './targets.js';
|
|
3
|
+
export type IssueKind = 'missing_link' | 'broken_link' | 'wrong_target' | 'replaced_by_file' | 'missing_import' | 'source_missing';
|
|
4
|
+
export interface DoctorIssue {
|
|
5
|
+
kind: IssueKind;
|
|
6
|
+
label: string;
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
fixable: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ToolWarning {
|
|
12
|
+
label: string;
|
|
13
|
+
tool: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/** 호스트에서 도구를 찾는다. 테스트는 가짜로 바꾼다 */
|
|
17
|
+
export type Which = (tool: string, target: Target) => boolean;
|
|
18
|
+
export declare function defaultWhich(tool: string): boolean;
|
|
19
|
+
export interface DoctorInput {
|
|
20
|
+
home: string;
|
|
21
|
+
targets: Target[];
|
|
22
|
+
config: AgentSyncConfig;
|
|
23
|
+
fix: boolean;
|
|
24
|
+
which?: Which;
|
|
25
|
+
now?: Date;
|
|
26
|
+
}
|
|
27
|
+
export interface DoctorResult {
|
|
28
|
+
issues: DoctorIssue[];
|
|
29
|
+
toolWarnings: ToolWarning[];
|
|
30
|
+
fixed: string[];
|
|
31
|
+
hints: string[];
|
|
32
|
+
/** 고친 뒤에도 남은 문제. 고치지 않았으면 issues와 같다 */
|
|
33
|
+
remaining: DoctorIssue[];
|
|
34
|
+
/** 읽지 못한 실행 기록. 종료 코드에는 안 걸린다 */
|
|
35
|
+
recordWarnings: string[];
|
|
36
|
+
pruned: string[];
|
|
37
|
+
run?: {
|
|
38
|
+
runId: string;
|
|
39
|
+
dir: string;
|
|
40
|
+
recordFile: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 어긋난 연결을 찾는다. `fix`면 백업하고 그 자리에서 고친다.
|
|
45
|
+
* 고친 기록은 run.json에 남지만 되돌리기 대상은 아니다.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runDoctor(input: DoctorInput): DoctorResult;
|
|
48
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/agent-sync/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAI7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,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AS,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAgD1D"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { accessSync, constants, statSync } from 'node:fs';
|
|
2
|
+
import { delimiter, join } from 'node:path';
|
|
3
|
+
import { toolsFor } from './config.js';
|
|
4
|
+
import { inspectSource, inspectTargets } from './inspect.js';
|
|
5
|
+
import { listRunsNewestFirst, pruneRuns, RunWriter } from './run-store.js';
|
|
6
|
+
import { applyPlan, fixSlotSteps, planContext, systemHomeRules } from './sync.js';
|
|
7
|
+
export function defaultWhich(tool) {
|
|
8
|
+
for (const dir of (process.env['PATH'] ?? '').split(delimiter)) {
|
|
9
|
+
if (!dir)
|
|
10
|
+
continue;
|
|
11
|
+
const file = join(dir, tool);
|
|
12
|
+
try {
|
|
13
|
+
if (!statSync(file).isFile())
|
|
14
|
+
continue;
|
|
15
|
+
accessSync(file, constants.X_OK);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// 없는 파일이거나 실행 권한이 없으면 PATH의 다음 폴더를 본다. which와 같은 동작이다
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
function issueKind(slot) {
|
|
25
|
+
const s = slot.status.state;
|
|
26
|
+
if (s === 'ok')
|
|
27
|
+
return null;
|
|
28
|
+
if (s === 'missing')
|
|
29
|
+
return slot.mode === 'link' ? 'missing_link' : 'missing_import';
|
|
30
|
+
return s;
|
|
31
|
+
}
|
|
32
|
+
function findIssues(input) {
|
|
33
|
+
const ctx = planContext(input.home);
|
|
34
|
+
const { src, t } = ctx;
|
|
35
|
+
const source = inspectSource(src);
|
|
36
|
+
const issues = [];
|
|
37
|
+
const slots = [];
|
|
38
|
+
if (!source.rulesFile) {
|
|
39
|
+
issues.push({
|
|
40
|
+
kind: 'source_missing',
|
|
41
|
+
label: '~/.agents',
|
|
42
|
+
path: src.rulesFile,
|
|
43
|
+
message: `${t(src.rulesFile)}가 없어요. 처음이면 gestalt sync를 먼저 돌려 주세요`,
|
|
44
|
+
fixable: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (!source.skillsDir) {
|
|
48
|
+
issues.push({
|
|
49
|
+
kind: 'source_missing',
|
|
50
|
+
label: '~/.agents',
|
|
51
|
+
path: src.skillsDir,
|
|
52
|
+
message: `${t(src.skillsDir)} 폴더가 없어요. 처음이면 gestalt sync를 먼저 돌려 주세요`,
|
|
53
|
+
fixable: false,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
for (const slot of inspectTargets(input.targets, src)) {
|
|
57
|
+
const kind = issueKind(slot);
|
|
58
|
+
if (!kind)
|
|
59
|
+
continue;
|
|
60
|
+
const st = slot.status;
|
|
61
|
+
const p = t(slot.path);
|
|
62
|
+
let message;
|
|
63
|
+
if (kind === 'missing_link')
|
|
64
|
+
message = `${p} 링크가 없어요`;
|
|
65
|
+
else if (st.state === 'missing')
|
|
66
|
+
message = `${p}가 없어요 (${slot.importLine} 줄을 넣을 파일)`;
|
|
67
|
+
else if (st.state === 'broken_link')
|
|
68
|
+
message = `${p}가 없는 ${t(st.linkTarget)}를 가리켜요`;
|
|
69
|
+
else if (st.state === 'wrong_target')
|
|
70
|
+
message =
|
|
71
|
+
slot.mode === 'link'
|
|
72
|
+
? `${p}가 ${t(slot.linkTo)} 대신 ${t(st.linkTarget)}를 가리켜요`
|
|
73
|
+
: `${p}가 ${slot.importLine} 줄이 없는 ${t(st.linkTarget)}를 가리켜요`;
|
|
74
|
+
else if (st.state === 'replaced_by_file')
|
|
75
|
+
message = `${p}가 링크 대신 실제 ${st.isDir ? '폴더' : '파일'}예요`;
|
|
76
|
+
else
|
|
77
|
+
message = `${p}에 ${slot.importLine} 줄이 없어요`;
|
|
78
|
+
// `~/.agents` 쪽이 없는데 링크만 다시 걸면 또 끊긴 링크가 된다
|
|
79
|
+
const sourceReady = slot.mode === 'import' || (slot.name === 'skills' ? source.skillsDir : source.rulesFile);
|
|
80
|
+
issues.push({ kind, label: slot.target.label, path: slot.path, message, fixable: sourceReady });
|
|
81
|
+
if (sourceReady)
|
|
82
|
+
slots.push(slot);
|
|
83
|
+
}
|
|
84
|
+
return { issues, slots };
|
|
85
|
+
}
|
|
86
|
+
function findToolWarnings(input) {
|
|
87
|
+
const which = input.which ?? ((tool) => defaultWhich(tool));
|
|
88
|
+
const out = [];
|
|
89
|
+
for (const target of input.targets) {
|
|
90
|
+
for (const tool of toolsFor(input.config, target.kind)) {
|
|
91
|
+
if (which(tool, target))
|
|
92
|
+
continue;
|
|
93
|
+
out.push({
|
|
94
|
+
label: target.label,
|
|
95
|
+
tool,
|
|
96
|
+
message: `${target.label}: ${tool}를 PATH에서 찾지 못했어요`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 어긋난 연결을 찾는다. `fix`면 백업하고 그 자리에서 고친다.
|
|
104
|
+
* 고친 기록은 run.json에 남지만 되돌리기 대상은 아니다.
|
|
105
|
+
*/
|
|
106
|
+
export function runDoctor(input) {
|
|
107
|
+
const found = findIssues(input);
|
|
108
|
+
const toolWarnings = findToolWarnings(input);
|
|
109
|
+
const recordWarnings = listRunsNewestFirst().corrupt.map((c) => `${c.dirName} 실행 기록을 읽지 못했어요 (${c.reason}). 정리하지 않고 남겨 뒀으니 직접 확인해 주세요`);
|
|
110
|
+
if (!input.fix || found.slots.length === 0) {
|
|
111
|
+
return {
|
|
112
|
+
issues: found.issues,
|
|
113
|
+
toolWarnings,
|
|
114
|
+
fixed: [],
|
|
115
|
+
hints: [],
|
|
116
|
+
remaining: found.issues,
|
|
117
|
+
recordWarnings,
|
|
118
|
+
pruned: [],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const ctx = planContext(input.home);
|
|
122
|
+
const steps = [];
|
|
123
|
+
const hints = [];
|
|
124
|
+
const handledPaths = systemHomeRules(input.targets);
|
|
125
|
+
for (const slot of found.slots) {
|
|
126
|
+
const plan = fixSlotSteps(slot, ctx, {
|
|
127
|
+
mergeSkills: false,
|
|
128
|
+
sourceNames: new Set(),
|
|
129
|
+
handledPaths,
|
|
130
|
+
});
|
|
131
|
+
steps.push(...plan.steps);
|
|
132
|
+
hints.push(...plan.hints);
|
|
133
|
+
}
|
|
134
|
+
const now = input.now ?? new Date();
|
|
135
|
+
const pruned = pruneRuns(now);
|
|
136
|
+
const run = new RunWriter('doctor', input.home, now);
|
|
137
|
+
applyPlan({ steps, hints }, run);
|
|
138
|
+
const after = findIssues(input);
|
|
139
|
+
return {
|
|
140
|
+
issues: found.issues,
|
|
141
|
+
toolWarnings,
|
|
142
|
+
fixed: steps.map((s) => s.summary),
|
|
143
|
+
hints,
|
|
144
|
+
remaining: after.issues,
|
|
145
|
+
recordWarnings,
|
|
146
|
+
pruned,
|
|
147
|
+
run: { runId: run.record.runId, dir: run.dir, recordFile: run.recordFile },
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/agent-sync/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAwB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAsB,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAiB,MAAM,WAAW,CAAC;AA4BjG,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,KA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C,IAAI,EAAE,GAAG,EAAE;YACnC,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,IAAI,GAAG,EAAE;YACtB,YAAY;SACb,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,YAAY;QACZ,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAClC,KAAK;QACL,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,cAAc;QACd,MAAM;QACN,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;KAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DoctorResult } from './doctor.js';
|
|
2
|
+
import type { RevertResult } from './revert.js';
|
|
3
|
+
import type { ApplyResult } from './sync.js';
|
|
4
|
+
import type { TargetDiscovery } from './targets.js';
|
|
5
|
+
export declare function formatSync(home: string, d: TargetDiscovery, r: ApplyResult, dryRun: boolean): string;
|
|
6
|
+
export declare function formatRevert(home: string, r: RevertResult, dryRun: boolean): string;
|
|
7
|
+
export declare function formatDoctor(home: string, d: TargetDiscovery, r: DoctorResult, fix: boolean): string;
|
|
8
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/agent-sync/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAmCpD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,WAAW,EACd,MAAM,EAAE,OAAO,GACd,MAAM,CAsBR;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CASnF;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,YAAY,EACf,GAAG,EAAE,OAAO,GACX,MAAM,CAgCR"}
|