@phyzess/kitto 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Kitto
2
2
 
3
+ ## 0.3.0
4
+
5
+ - Hosts: add the explicit `kitto hosts [--check|--apply] [--host NAME] [--version VERSION]` command for host-CLI upgrade policy (also exposed as the maintenance runner's `hosts` operation). It lists each selected host's installed `--version`, Kitto's validated baseline (`hosts[name].version`) and the exact native-manager command; `--check` is the default and writes nothing. `--apply` installs only the pinned target through `npm install --global <package>@<version>` — Pi and Codex through their npm packages, the DSH CLI through `@deepseek-ai/dsh@<baseline>` with a prerelease baseline kept exact — never `npx`, dist-tags or "latest", never an unselected host, and never automatically. Hosts already newer than the baseline are not downgraded implicitly; `--version` accepts one exact version for one host and warns in check and apply when it is not the validated baseline. The app-managed `desktop` DSH profile (matched case-insensitively) is reported and skipped, not npm-installed. Missing npm, unreadable host versions, permission failures (with npm-prefix/sudo guidance) and post-install verification mismatches fail with actionable errors before or without writing `state.json`; a multi-host failure reports which hosts changed and which did not. `kitto update` is unchanged: it prints host versions/baselines and never upgrades a host.
6
+ - Docs: add `docs/roadmap.md` for the deferred DSH Desktop deep-support TODO: controlled writes of Kitto-owned rows in `profiles/desktop/cordis.patch.yml` (with full-App-exit, restore and HMR/watch race guardrails plus macOS verification), Desktop built-in CLI detection/use, and bundle/package/lockfile ownership boundaries, including acceptance criteria, risks and non-goals. v1 stays global-only; the roadmap promises no dates and changes no behavior. Linked from the README and usage guide; the maintenance skill now points at `kitto hosts`.
7
+ - Instructions: add `config/instructions/common.md` as the shared rules layer for Pi, Codex and DSH (language, read-only review, preserving existing changes, confirming publish/external/irreversible operations, verification, tool availability/CodeGraph, session-start `i-have-adhd`/`hindsight` loading). `config/<host>/AGENTS.md` now holds only host-specific addenda. Codex and DSH compose the shared layer with their addendum inside the existing Kitto block (block-external content and local-edit protection unchanged); the Pi adapter composes shared rules plus the Pi addendum into `$PI_CODING_AGENT_DIR/AGENTS.md` and keeps its whole-file deployment, so a legacy whole-file AGENTS.md is replaced once without duplicating the shared rules. Both composers normalize a UTF-8 BOM and CRLF to canonical LF, produce identical bytes, and insert an explicit `<!-- kitto:host-addendum -->` boundary between the shared layer and the addendum. `sync.sh push` validates and stages the Pi addendum before writing the repository, splits only at that boundary, requires the shared section to equal the current common layer exactly (so deleting a trailing line or a whole section cannot leak shared rules upstream), refuses a composition without the boundary, and exports only the addendum; configuration checkouts without `config/instructions/common.md` keep the legacy whole-file behavior, except that a legacy push now refuses a deployed file carrying the shared-layer boundary instead of copying it into the addendum. Docs describe the layer, composition, env-controlled paths and push semantics.
8
+ - MCP credentials: DSH and Codex sync now accept reference-only credentials. stdio `env` and HTTP `headers` values must be a whole `${VAR}`; `Authorization` may instead use `Bearer ${VAR}`. DSH maps each reference to the mcp-client `${credential:VAR}` template and sets `expandTemplates: true` on that row, so the credentials provider resolves it at runtime and the patch never contains the secret; a native `dsh --dump-config` test proves the rows load. Codex maps a single HTTP `Authorization: Bearer ${VAR}` to `codex mcp add ... --bearer-token-env-var VAR`, recording only the variable name in its ownership fingerprint. Literal values, literal token shapes (the same patterns the Pi export guard refuses), partial/composed templates and templates in `url`/`command`/`args` skip the whole server with a reason that names only the key path or token type; no value is logged. URLs carrying userinfo (`user:pass@host`) or a credential-like query/fragment parameter (token/key/secret/password/sig/signature/auth/credential/bearer/apikey/access_token/refresh_token), and commands/arguments containing a credential-shaped flag (including `--header`/`-H` followed by a sensitive header name or credential value), env assignment or literal Authorization value, are rejected before they reach a host configuration. Native Codex errors no longer append argv to the message, so a failed add cannot echo a credential. Codex still skips stdio `env`, other headers, `env_http_headers` and `bearer_token_env_var` because `codex mcp add --env` cannot express them without writing the literal, and now warns about every skip during apply as well as in the plan.
9
+ - DSH baseline: raise the validated host baseline and `package.json` engines range to `0.2.2-rc.2`, the first mcp-client release with credential templates. The new prerelease-aware baseline comparison rejects an installed `0.2.2-rc.1` during setup instead of silently syncing templates that host ignores, and `--install-agents` now pins `0.2.2-rc.2` (an already-installed newer build still passes the check).
10
+ - MCP sources: `config/pi/mcp.private.json` and `config/pi/local/mcp.json` are read for DSH/Codex sync only when the new global `setup`/`update` option `--include-private` is set; the default stays base+platform so machine-specific servers and credentials do not spread accidentally. The choice is remembered in `state.json` (`includePrivate`), later `setup` runs without the flag keep it, and `--no-include-private` turns it off. Precedence is base < platform < local < private, both files are optional, and entries still carrying `YOUR_*` placeholders are skipped instead of syncing a template URL. Scoped setup rejects the new options because it does not sync MCP servers.
11
+ - Docs/tests: the capability matrix and manual-migration steps describe which host/transport supports references and which still needs native configuration; unit coverage adds DSH template mapping/literal refusal/URL/command credential refusal/private opt-in/removal and Codex bearer argv, skip warnings, literal-secret/URL/command refusal, private opt-in, argv-safe failure messages and the persisted `--include-private` CLI flow. `tests/native.test.mjs` now runs a real Codex 0.170.0 and DSH 0.2.2-rc.2 against a reference-only fixture (bearer env var, DSH credential templates, dump-config load and removal).
12
+ - Entry points: `setup.sh` now always delegates to `kitto setup` (interactive, non-interactive and `--dry-run` alike), so a non-TTY run no longer executes the old `sync.sh deps` + `sync.sh pull` Pi path. `--force` is deprecated: it prints one warning and keeps its historical non-interactive meaning (the wizard cannot start, even in a TTY). `sync.sh` remains the internal Pi adapter used by `lib/kitto.mjs`, but direct runs print a deprecated-entry warning and skip shared `~/.agents/skills` deployment unless `KITTO_ALLOW_LEGACY_SKILL_SYNC=1` is set explicitly; direct `status` no longer reports those skipped skills as missing/differs, while Pi settings, MCP, `AGENTS.md`, extensions and packages still work for compatibility. Docs now recommend one setup entry, `--source .` for a source checkout without state, describe the changed `--dry-run` preview and the shared-skill opt-in.
13
+ - Update: add the public `kitto update [--check|--apply]` command (default preview; `--check` is the explicit form; the maintenance runner also accepts it). Apply fetches and fast-forwards a clean tracked source branch; a local branch that is ahead of (or equal to) its remote is allowed, and only true divergence (neither commit is an ancestor of the other) is refused before any change. It then refreshes the installed runtime copy from the executing Kitto package through the existing checkpointed swap, then deploys configuration, skills and MCP. The replaced runtime stays pending until the deployment succeeds: a failed update neither verifies it nor becomes the recovery checkpoint, so a retry or `setup --recover` returns to the last successfully deployed version. Preview writes nothing. Dirty worktrees, detached/tag checkouts, missing upstreams and non-fast-forward remotes stop before any write with actionable errors. `state.json` now records `sourceUrl` and `sourceRef` (branch or tag, written at setup and after tag switches) and follows a changed origin; a lost managed checkout is re-cloned only on the recorded branch — tags, unknown refs and non-Git URLs are never guessed and instead explain how to recreate the checkout in place or use a new `KITTO_HOME`. Older state files are backfilled from the bootstrap marker and keep working. Host CLIs are never upgraded: update prints installed and tested-baseline versions and points at each host's native manager. The running process finishes its deployment with the code it started with; later Kitto calls and restarted hosts use the refreshed runtime.
14
+ - DSH Desktop: allow `--dsh-profile desktop` (and the same value in the setup wizard) in a global-only mode. Kitto deploys `$DSH_HOME/AGENTS.md`, `$DSH_HOME/skills` and shared `~/.agents/skills`, but never runs `dsh plugin --profile desktop add/remove`, requires pnpm or a local dsh CLI, writes `profiles/desktop/cordis.patch.yml`, registers a scope adapter or syncs the MCP home patch for it. `--install-agents` never installs the npm dsh CLI for this profile. A best-effort probe copies the profile manifest to a scratch `DSH_HOME` (the real profile is not touched), skips the probe when the manifest is missing and distinguishes the npm CLI, an initialized in-app CLI, timeouts and missing CLIs with actionable guidance. Scoped setup rejects the app-managed profile, `--dsh-service` and shared-rules-only mode (or skips desktop while configuring other hosts), MCP parity marks DSH as global-only, and removal no longer looks for a bundle Kitto never installed. Web/headless behavior is unchanged.
15
+ - Scope lifecycle: add `kitto scope list [--json]` and `kitto scope remove --global|--workspace|--workspace-parent`. Removal canonicalizes paths with realpath (falling back to an absolute path), reuses the setup lock, and only unregisters a scope: instructions, skills, host adapters and user files are never deleted. Setup and removal share one validated atomic registry writer (temp file + rename, mode 0600) that preserves unknown top-level fields.
16
+ - DSH: sync the repository's portable Pi MCP servers into `$DSH_HOME/cordis.patch.yml` as `kitto-mcp-*` rows during `setup` and `sync`, preserving unrelated YAML lines, comments and `!!js` (Kitto rows are appended in source order). Servers with literal `env`/`headers`, and names already declared by the home patch, a profile patch or an enabled `mcp-manager` entry are skipped with a warning; private/local Pi files are read only with `--include-private`. Generated YAML is validated before writing (a trailing `...` is kept as the document end); non-empty flow-style patches and mixed Kitto `insert` items abort without writing. `maintain remove` deletes the Kitto rows, or keeps an unreadable patch with a warning; set `KITTO_NO_MCP_SYNC=1` to opt out.
17
+ - Codex: sync enabled Pi MCP servers through `codex mcp list/get/add/remove`. Record a pending fingerprint before each native write and adopt it after an interrupted save or a post-write OAuth timeout, reconcile pending-only records when their source disappears, prune stale ownership when a live server disappears, preserve unowned or locally changed servers, skip the env/header forms Codex cannot express safely (only an HTTP `Authorization: Bearer ${VAR}` maps to `--bearer-token-env-var`), skip OAuth/tool-filter fields, use a scratch `CODEX_HOME` for read-only probes, and remove only unchanged Kitto-owned servers when detaching.
18
+ - DSH: report missing CodeGraph indexes in `status`, and initialize registered scoped workspaces during `setup` when the CodeGraph CLI is available. General `sync`/`deps`/`export` never write indexes; set `KITTO_NO_CODEGRAPH_INIT=1` to keep setup report-only.
19
+ - DSH/Codex: make the Codex `i-have-adhd` skill model-invocable (`allow_implicit_invocation: true`), align its startup instruction with DSH, and support a custom `DSH_HOME` in the fallback path.
20
+ - Skills: replace deployed skill directories with a temp directory and rename, so an interrupted sync cannot leave a half-copied tree that is permanently reported as a conflict.
21
+ - Pi export: stage newly added managed extensions and skills with `git add -A` so a new file is committed, not silently left untracked.
22
+ - Docs: add a Pi/Codex/DSH capability matrix and the manual steps that remain in a one-command migration.
23
+ - Status: report MCP names per selected host and the servers missing on each host; read-only, no host writes.
24
+ - DSH: warn when a registered workspace is not writable by the current user, so agents do not fail later on `.codegraph`, `.pi` or file edits.
25
+ - Config: make the DSH `i-have-adhd` skill model-invocable and make the session-start instruction explicit.
26
+ - Config: correct CodeGraph MCP tool names, add the DSH `mcp__codegraph__*` and `projectPath` guidance, and mark `codegraph affected` as CLI-only.
27
+ - Config: stop claiming Hindsight auto-loads in DSH; document manual recall and the optional `atlas/` layers.
28
+ - Export: only repository-declared settings keys and MCP servers travel upstream; machine-only entries are previewed and skipped, credential-shaped keys are dropped, and literal token shapes refuse the export.
29
+
30
+ ## 0.2.1
31
+
32
+ - Select hosts with arrow keys and Space in the setup wizard, then choose a configuration source and preview or apply the plan. Scripted input remains supported.
33
+ - Use the pinned i-have-adhd skill in the default Codex and DSH configuration alongside the existing Pi extension.
34
+
3
35
  ## 0.2.0
4
36
 
5
37
  - Guide users through host selection, configuration sources, dependencies, preview and installation in one interactive setup.
package/README.md CHANGED
@@ -10,7 +10,9 @@ Kitto 把一套工作规则和 skills 带到 Pi、Codex 和 DeepSeek Harness(D
10
10
  npx --yes @phyzess/kitto@latest setup
11
11
  ```
12
12
 
13
- 向导会让你选择宿主和配置仓库。选「使用默认 Kitto 配置」即可部署仓库里的规则、skills 和各宿主的 Kitto 集成。选择 Pi 时还会同步 Pi 包、扩展和 MCP 设置。已有自己的配置仓库时,可以填 Git URL 或本地路径。向导会询问是否补装缺少的 CLI 和辅助依赖,也可以在同一次运行里先预览,再确认安装。已有 Kitto 源码的机器可直接运行 `./setup.sh`。
13
+ 用 ↑↓ 移动、空格勾选宿主、Enter 确认。随后从菜单选择配置来源,指定本地路径或 Git URL 时直接输入。选「使用默认 Kitto 配置」即可部署仓库里的规则、skills 和各宿主的 Kitto 集成。选择 Pi 时还会同步 Pi 包、扩展和 MCP 设置。已有自己的配置仓库时,可以填 Git URL 或本地路径。向导会询问是否补装缺少的 CLI 和辅助依赖,也可以在同一次运行里先预览,再确认安装。
14
+
15
+ 这是新机器唯一的安装入口。已经有 Kitto 源码时,在源码根目录运行 `./setup.sh --source .`;如果这台机器已经完成过 setup,直接 `./setup.sh` 会复用 state 里记录的配置源(没有 state 时会 clone 默认的 GitHub 仓库)。两种方式最终都执行 `kitto setup`。不要再直接运行 `sync.sh`:它只是 Kitto 内部的 Pi 适配器,见 [Pi 配置参考](docs/pi.md#syncsh内部适配器兼容用)。
14
16
 
15
17
  ## 以后才建工作区怎么办?
16
18
 
@@ -24,10 +26,40 @@ npx --yes @phyzess/kitto@latest setup
24
26
 
25
27
  全局和工作区的 skills 放在同层的 `.agents/skills/<名称>/SKILL.md`。没有额外约定时,工作区可以保持空白。父目录之外的项目也能使用账号的全局配置。
26
28
 
27
- Codex 首次需要在 `/hooks` 中信任 Kitto 的 SessionStart hook。正在运行的 DSH 服务需要重启对应 profile。宿主登录和私有 MCP 凭据由各账号配置。
29
+ Codex 首次需要在 `/hooks` 中信任 Kitto 的 SessionStart hook。正在运行的 DSH 非 Desktop profile/服务需要重启对应 profile。宿主登录和私有 MCP 凭据由各账号配置。
30
+
31
+ ### DSH Desktop
32
+
33
+ DSH Desktop 独占 `desktop` 配置档。Kitto v1 可以为它部署全局 `AGENTS.md`、DSH 专属 skills 和共享 `~/.agents/skills`,但不会安装 Kitto bundle、写 `profiles/desktop/cordis.patch.yml` 或注册 workspace scope。Kitto 不要求本机 `dsh` CLI,也不会用 npm 补装它,也不需要 pnpm。启动一次 Desktop 初始化 profile,然后完全退出 App,运行:
34
+
35
+ ```bash
36
+ npx --yes @phyzess/kitto setup --agents dsh --dsh-profile desktop
37
+ ```
38
+
39
+ 重新打开 Desktop 后生效。需要 Kitto bundle、scoped 规则或 MCP 同步时,改用 `--dsh-profile web`;Desktop 内置 CLI 不能为 Kitto 提供这些能力。切换 profile 前先运行维护 skill 的 `maintain remove --apply` 解除当前集成。细节见[使用指南](https://github.com/phyzess/kitto/blob/main/docs/usage.md#dsh-desktop-配置档v1仅全局规则与-skills)。Desktop 的深度支持(受控写 profile patch、内置 CLI、bundle 边界)仍暂缓,只记录在 [DSH Desktop roadmap](https://github.com/phyzess/kitto/blob/main/docs/roadmap.md) 中。
40
+
41
+ ## 规则共享层
42
+
43
+ 三个宿主的共同工作规则集中在 [config/instructions/common.md](config/instructions/common.md),各宿主的 `config/<宿主>/AGENTS.md` 只保留自己的 addendum(Pi 的 MCP 工具表、浏览器与评审约定;Codex/DSH 的 skill 回退路径等)。Kitto 部署时直接拼接两者(中间有一行 `<!-- kitto:host-addendum -->` 分隔哨兵),不使用模板:Pi 组合后整份写入 `$PI_CODING_AGENT_DIR/AGENTS.md`(默认 `~/.pi/agent/AGENTS.md`);Codex 和 DSH 写入各自全局 `AGENTS.md` 的 Kitto 标记块,块外内容保持本机所有。改共享规则只改 `common.md`;Pi 的 `sync.sh push` 只导出 Pi 专属段,不会把共享规则写回 addendum。细节见[配置与同步指南](https://github.com/phyzess/kitto/blob/main/docs/usage.md#规则共享层与宿主-addendum)。
28
44
 
29
45
  ## 把改动带到下一台机器
30
46
 
31
- 把需要跨机器分发的内容改在配置仓库里,提交并推送。另一台机器的完整安装可以在 agent 会话里说「用 Kitto 检查并同步配置」。直接编辑全局或工作区文件会在对应目录生效,想跨机器复用时需将它们纳入自己的版本管理。
47
+ 把需要跨机器分发的内容改在配置仓库里,提交并推送。另一台机器运行:
48
+
49
+ ```bash
50
+ npx --yes @phyzess/kitto@latest update # 预览,不写入
51
+ npx --yes @phyzess/kitto@latest update --apply # 拉取配置、刷新 runtime、部署
52
+ ```
53
+
54
+ `update` 先按 checkout 记录的分支/tag 更新配置源,再刷新 Kitto 自己的 runtime 副本,最后重新部署规则、skills 与 MCP(原生插件注册仍指向 runtime 路径,无需重装)。它不会升级 Pi、Codex、DSH 宿主 CLI;宿主升级用独立的 `kitto hosts`(只升到基线)或各自的原生包管理器,升级后重启宿主以加载新的插件代码。checkout 丢失时按记录的 `sourceUrl`/`sourceRef` 恢复;tag 固定、ref 未知或远端分支已删除时不会猜测,会提示原地重建 checkout 后重跑 setup,或换一个 `KITTO_HOME`。在 agent 会话里也可以说「用 Kitto 检查并同步配置」。直接编辑全局或工作区文件会在对应目录生效,想跨机器复用时需将它们纳入自己的版本管理。
55
+
56
+ 宿主 CLI 的升级同样是显式操作,并且只升到 Kitto 已验证的基线,不追最新版,也不会自动发生:
57
+
58
+ ```bash
59
+ npx --yes @phyzess/kitto@latest hosts # 只读:当前版本、Kitto 基线、升级命令
60
+ npx --yes @phyzess/kitto@latest hosts --apply # 只把低于基线的已选宿主升到基线
61
+ ```
62
+
63
+ `--host NAME` 限定一个宿主;`--version X.Y.Z` 是显式覆盖(默认仍用已验证基线),固定非基线版本时 `--check` 和 `--apply` 都会提示该版本未经 Kitto 验证。未选宿主不动,`desktop` DSH 由 Desktop App 管理。细节见[使用指南](https://github.com/phyzess/kitto/blob/main/docs/usage.md#宿主-cli只升到已验证基线不自动更新)。
32
64
 
33
- [配置与同步指南](https://github.com/phyzess/kitto/blob/main/docs/usage.md) · [Pi 配置参考](https://github.com/phyzess/kitto/blob/main/docs/pi.md) · [版本记录](CHANGELOG.md)
65
+ [配置与同步指南](https://github.com/phyzess/kitto/blob/main/docs/usage.md) · [开发任务编排](docs/orchestration.md) · [Pi 配置参考](https://github.com/phyzess/kitto/blob/main/docs/pi.md) · [DSH Desktop roadmap](https://github.com/phyzess/kitto/blob/main/docs/roadmap.md) · [版本记录](CHANGELOG.md)
package/bin/kitto.mjs CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { setup, parseOptions } from '../lib/kitto.mjs';
2
+ import { existsSync } from 'node:fs';
3
+ import { mkdir, realpath, rm } from 'node:fs/promises';
4
+ import { join, resolve } from 'node:path';
5
+ import { setup, parseOptions, update } from '../lib/kitto.mjs';
6
+ import { worktreeCommand } from '../lib/worktree-audit.mjs';
7
+ import { hostsCommand } from '../lib/hosts.mjs';
8
+ import { readScopeRegistry, scopeHome, writeScopeRegistry } from '../lib/scopes.mjs';
3
9
 
4
10
  const help = `Kitto — portable personal agent configuration
5
11
 
@@ -10,17 +16,182 @@ const help = `Kitto — portable personal agent configuration
10
16
  kitto setup --workspace PATH [--agents pi,codex,dsh] [--dsh-service UNIT] [--dry-run]
11
17
  kitto setup [--agents pi,codex,dsh] [--source PATH_OR_GIT_URL] [--ref BRANCH_OR_TAG]
12
18
  [--dsh-profile PROFILE] [--install-agents] [--dry-run]
19
+ [--include-private|--no-include-private]
13
20
  kitto setup --recover [--dry-run] Restore the last working Kitto code
21
+ kitto update [--check|--apply] [--include-private|--no-include-private]
22
+ Preview (the default; --check makes it explicit) or apply:
23
+ fetch and fast-forward the configuration source, refresh the
24
+ installed runtime copy, then deploy configuration, skills and MCP
25
+ kitto hosts [--check|--apply] [--host NAME] [--version VERSION]
26
+ List selected host CLIs, their Kitto-validated baselines and the
27
+ exact native-manager command. --check (the default) is read-only;
28
+ --apply installs only the pinned target, never the latest release.
29
+ --host limits this to one selected host; --version pins one host
30
+ to an exact version instead of its baseline.
31
+ kitto worktree audit [--workspace PATH] [--json]
32
+ Inventory Git worktrees by estimated size, without writing or cleaning
33
+ kitto scope list [--json] Show global, workspace and workspace-parent scope registrations
34
+ kitto scope remove --global
35
+ kitto scope remove --workspace PATH
36
+ kitto scope remove --workspace-parent PATH
14
37
 
15
38
  Scoped setup shares AGENTS.md and .agents/skills. Plain setup uses the phyzess/kitto configuration repository.
16
39
  After scoped setup, edit the shared files and start a new native agent session.
17
40
  Plain setup installs the Kitto maintenance skill for configuration synchronization.
41
+ kitto update only previews unless --apply is used (--check is the same preview, written explicitly);
42
+ it updates Kitto's code copy and configuration, never a host CLI or the Kitto package itself.
43
+ Host CLIs are upgraded separately and explicitly with kitto hosts --apply, only to Kitto's validated
44
+ baseline (or an explicit --version). Kitto never upgrades a host automatically.
18
45
  Kitto needs Node >=22 and Git. Pi sync also needs Bash and Python >=3.10.
19
- DSH needs pnpm and uses the web profile by default. Host CLIs have their own Node requirements.
46
+ DSH web/headless needs pnpm and uses the web profile by default. The Desktop app owns the desktop
47
+ profile: Kitto deploys only its global AGENTS.md and skills, never checks or installs a dsh CLI, and
48
+ adds no bundle, profile patch or scope.
49
+ Host CLIs have their own Node requirements.
50
+ MCP credentials are references only: env/header values must be a whole \${VAR}
51
+ (or Authorization: Bearer \${VAR}). Literal values and tokens are skipped, never copied.
52
+ config/pi/mcp.private.json and config/pi/local/mcp.json are excluded unless
53
+ --include-private is set; the choice is remembered in state.json and can be changed
54
+ with a later setup/update.
55
+ Scope removal only changes the scope registry; AGENTS.md, skills, host adapters and user files stay in place.
56
+ The DSH desktop profile is app-managed and cannot be configured as a scope or system service.
20
57
  `;
58
+
59
+ const scopeHelp = `Kitto scope registry
60
+
61
+ kitto scope list [--json] List registered global, workspace and workspace-parent scopes
62
+ kitto scope remove --global Unregister the global scope
63
+ kitto scope remove --workspace PATH Unregister one workspace
64
+ kitto scope remove --workspace-parent PATH
65
+ Unregister one workspace parent
66
+
67
+ kitto scope remove only changes the scope registry. It keeps AGENTS.md, .agents/skills,
68
+ host adapters, hooks, symlinks and profile patches. Choose exactly one removal target.
69
+ A relative PATH is resolved from the current directory; existing paths are canonicalized
70
+ with realpath, matching how setup registers workspaces and workspace parents.
71
+ The DSH desktop profile is managed by the Desktop app; Kitto v1 installs no scoped DSH
72
+ configuration for it.
73
+ `;
74
+
75
+ async function scopePathCandidates(value) {
76
+ const path = resolve(value);
77
+ try { return [...new Set([await realpath(path), path])]; }
78
+ catch (error) {
79
+ if (error.code === 'ENOENT' || error.code === 'ENOTDIR') return [path];
80
+ throw error;
81
+ }
82
+ }
83
+
84
+ function formatScopeList(registry) {
85
+ const section = paths => paths.length ? paths.map(path => ` ${path}`) : [' (none)'];
86
+ return [
87
+ `Global: ${registry.global ? 'enabled' : 'disabled'}`,
88
+ 'Workspaces:', ...section(registry.workspaces),
89
+ 'Workspace parents:', ...section(registry.workspaceParents),
90
+ ].join('\n');
91
+ }
92
+
93
+ function parseScopeRemove(args) {
94
+ const targets = [];
95
+ for (let i = 0; i < args.length; i++) {
96
+ const arg = args[i];
97
+ if (arg === '--global') targets.push({ global: true });
98
+ else if (arg === '--workspace' || arg === '--workspace-parent') {
99
+ if (!args[i + 1] || args[i + 1].startsWith('-')) throw new Error(`Missing path for ${arg}.`);
100
+ targets.push({ kind: arg.slice(2), value: args[++i] });
101
+ } else throw new Error(`Unknown scope remove option: ${arg}.`);
102
+ }
103
+ if (targets.length !== 1) throw new Error('Choose exactly one of --global, --workspace PATH or --workspace-parent PATH.');
104
+ return targets[0];
105
+ }
106
+
107
+ async function removeScope(args) {
108
+ const target = parseScopeRemove(args);
109
+ const home = scopeHome();
110
+ const workspace = target.kind === 'workspace';
111
+ const key = workspace ? 'workspaces' : 'workspaceParents';
112
+ const candidates = target.global ? [] : await scopePathCandidates(target.value);
113
+ const lock = join(home, '.scope-setup.lock');
114
+ let locked = false;
115
+ if (existsSync(home)) {
116
+ try { await mkdir(lock); locked = true; }
117
+ catch (error) {
118
+ if (error.code === 'EEXIST') throw new Error('Scope registry is locked by setup: ' + lock);
119
+ throw error;
120
+ }
121
+ }
122
+ try {
123
+ const registry = await readScopeRegistry(home);
124
+ if (target.global) {
125
+ if (!registry.global) throw new Error('Global scope is not registered.');
126
+ await writeScopeRegistry(home, { ...registry, global: false });
127
+ console.log('Removed global scope registration. Instructions, skills and host adapters were left in place.');
128
+ return;
129
+ }
130
+ const registered = registry[key] ?? [];
131
+ const matched = registered.filter(entry => candidates.includes(entry));
132
+ if (!matched.length) {
133
+ throw new Error(`No ${target.kind} scope registered at ${candidates[0]}. Run kitto scope list to see registered paths.`);
134
+ }
135
+ await writeScopeRegistry(home, { ...registry, [key]: registered.filter(entry => !candidates.includes(entry)) });
136
+ console.log(`Removed ${target.kind} scope registration: ${matched[0]}. Instructions, skills and host adapters were left in place.`);
137
+ } finally {
138
+ if (locked) await rm(lock, { recursive: true, force: true });
139
+ }
140
+ }
141
+
142
+ async function scopeCommand(args) {
143
+ const [operation, ...rest] = args;
144
+ if (!operation || operation === '--help' || operation === '-h') {
145
+ console.log(scopeHelp);
146
+ return;
147
+ }
148
+ if (operation === 'list') {
149
+ if (rest.length === 1 && (rest[0] === '--help' || rest[0] === '-h')) {
150
+ console.log(scopeHelp);
151
+ return;
152
+ }
153
+ if (rest.length && (rest.length !== 1 || rest[0] !== '--json')) throw new Error('scope list accepts only --json.');
154
+ const registry = await readScopeRegistry(scopeHome());
155
+ const normalized = {
156
+ ...registry,
157
+ workspaces: [...registry.workspaces],
158
+ workspaceParents: [...(registry.workspaceParents ?? [])],
159
+ };
160
+ console.log(rest.length ? JSON.stringify(normalized, null, 2) : formatScopeList(normalized));
161
+ return;
162
+ }
163
+ if (operation === 'remove') {
164
+ if (rest.length === 1 && (rest[0] === '--help' || rest[0] === '-h')) {
165
+ console.log(scopeHelp);
166
+ return;
167
+ }
168
+ return removeScope(rest);
169
+ }
170
+ throw new Error(`Unknown scope command: ${operation}. Use kitto scope --help.`);
171
+ }
172
+
21
173
  try {
22
174
  const [command, ...args] = process.argv.slice(2);
23
175
  if (!command || command === '--help' || command === '-h') console.log(help);
176
+ else if (command === 'worktree') {
177
+ if (['start', 'finish', 'apply'].includes(args[0])) {
178
+ const { lifecycleCommand } = await import('../lib/worktree-lifecycle.mjs');
179
+ await lifecycleCommand(args[0], args.slice(1));
180
+ } else if (!args.length || ['--help', '-h'].includes(args[0])) {
181
+ const { lifecycleUsage } = await import('../lib/worktree-lifecycle.mjs');
182
+ await worktreeCommand(args);
183
+ console.log(lifecycleUsage);
184
+ } else await worktreeCommand(args);
185
+ }
186
+ else if (command === 'scope') await scopeCommand(args);
187
+ else if (command === 'update') {
188
+ if (args.length === 1 && (args[0] === '--help' || args[0] === '-h')) console.log(help);
189
+ else await update(args);
190
+ }
191
+ else if (command === 'hosts') {
192
+ if (args.length === 1 && (args[0] === '--help' || args[0] === '-h')) console.log(help);
193
+ else await hostsCommand(args);
194
+ }
24
195
  else if (command === 'setup') {
25
196
  if ((args.length === 0 && process.stdin.isTTY && process.stdout.isTTY) ||
26
197
  (args.length === 1 && args[0] === '--interactive')) {
@@ -0,0 +1,55 @@
1
+ import { createRequire } from 'node:module';
2
+ import { isAbsolute } from 'node:path';
3
+
4
+ const messages = {
5
+ 'review-pending': 'DSH persistently archives this bound session. Offer manual worktree review in the current conversation; this does not establish quiescence, release a claim, or authorize cleanup.',
6
+ 'not-archived': 'The bound session is not in the DSH archive set. No archive reminder is pending.',
7
+ unavailable: 'No verified local binding or authoritative DSH archive state is available. Leave the worktree and its claim alone.',
8
+ };
9
+
10
+ export function registerArchiveReview(ctx, enabled) {
11
+ if (enabled !== true) return;
12
+ ctx.inject(['profileContext', 'tools', 'workspaceRegistry', 'sessionPersistence'], (host) => {
13
+ // DSH_PROFILE and DSH_INSTALL_DIR are projected into tool shell calls;
14
+ // plugin activation must use the launcher's actual profile service instead.
15
+ const { name, installAnchor } = host.profileContext;
16
+ if (name !== 'web' || typeof installAnchor !== 'string' || !isAbsolute(installAnchor)) return;
17
+ const require = createRequire(installAnchor);
18
+ let defineTool;
19
+ try {
20
+ if (require('./package.json').name !== '@deepseek-ai/dsh') return;
21
+ ({ defineTool } = require('@deepseek-ai/dsh-tools'));
22
+ } catch { return; }
23
+ if (typeof defineTool !== 'function') return;
24
+ host.tools.register(defineTool({
25
+ name: 'kitto_worktree_archive_review',
26
+ description: 'Verify a named Kitto claim against the local DSH archive set. Read-only; call only for an explicit manual handoff or archive review. Never use this as cleanup authorization.',
27
+ parameters: {
28
+ repo: { type: 'string', required: true, description: 'Absolute path to the scoped primary checkout.' },
29
+ task: { type: 'string', required: true, description: 'The explicitly named Kitto task ID.' },
30
+ session: { type: 'string', required: true, description: 'The native DSH session ID deliberately registered as the Kitto claim ID.' },
31
+ },
32
+ output: {
33
+ schema: { type: 'string', enum: Object.keys(messages) },
34
+ render: (_args, state) => [{ type: 'text', text: messages[state] }],
35
+ },
36
+ async execute(args, exec) {
37
+ if (exec.signal.aborted) return 'unavailable';
38
+ try {
39
+ // The durable archive set is the source of truth after reload and unarchive.
40
+ // Do not cache notifications or append to a conversation from a host event.
41
+ const prior = host.workspaceRegistry.archivedSessionIds;
42
+ if (!Array.isArray(prior)) return 'unavailable';
43
+ const headers = (await host.sessionPersistence.list())
44
+ .filter(snapshot => snapshot.header?.id === args.session);
45
+ if (headers.length !== 1 || exec.signal.aborted) return 'unavailable';
46
+ const { matchesArchiveClaim } = await import('../lib/worktree-lifecycle.mjs');
47
+ if (!await matchesArchiveClaim(args, headers[0].header)) return 'unavailable';
48
+ const current = host.workspaceRegistry.archivedSessionIds;
49
+ if (exec.signal.aborted || !Array.isArray(current)) return 'unavailable';
50
+ return current.includes(args.session) ? 'review-pending' : 'not-archived';
51
+ } catch { return 'unavailable'; }
52
+ },
53
+ }));
54
+ });
55
+ }
@@ -1,11 +1,12 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { registerArchiveReview } from './dsh-archive-review.mjs';
3
4
 
4
5
  export const name = 'phyzess-kitto';
5
6
  export const inject = ['skills'];
6
7
 
7
8
  // Only one catalog entry at startup; the body is loaded on demand.
8
- export function apply(ctx) {
9
+ export function apply(ctx, config) {
9
10
  const path = fileURLToPath(new URL('./skills/kitto/SKILL.md', import.meta.url));
10
11
  const candidate = {
11
12
  name: 'kitto', description: 'Inspect, synchronize and update personal agent configuration with Kitto.',
@@ -18,4 +19,5 @@ export function apply(ctx) {
18
19
  list: async () => [candidate],
19
20
  get: async () => ({ ...candidate, content: (await readFile(path, 'utf8')).replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '') }),
20
21
  }));
22
+ registerArchiveReview(ctx, config?.archiveReview);
21
23
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "kitto",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "Maintain personal agent configuration on request"
6
6
  }
@@ -1,8 +1,40 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { constants } from 'node:fs';
3
+ import { access, lstat, realpath } from 'node:fs/promises';
1
4
  import { createRequire } from 'node:module';
2
- import { realpath } from 'node:fs/promises';
5
+ import { delimiter, resolve } from 'node:path';
3
6
  import { pathToFileURL } from 'node:url';
4
7
 
8
+ /** Locate the DSH launcher, resolving mise shims to the real entry point. */
9
+ export async function dshExecutable() {
10
+ for (const dir of (process.env.PATH ?? '').split(delimiter)) {
11
+ const candidate = resolve(dir, 'dsh');
12
+ try {
13
+ await access(candidate, constants.X_OK);
14
+ if ((await lstat(candidate)).isDirectory()) continue;
15
+ const entry = await realpath(candidate);
16
+ if (entry.endsWith('/mise') || dir.endsWith('/shims')) {
17
+ const result = spawnSync(entry.endsWith('/mise') ? entry : 'mise', ['which', 'dsh'], { encoding: 'utf8', timeout: 8000 });
18
+ if (result.status === 0 && result.stdout.trim()) return result.stdout.trim();
19
+ }
20
+ return candidate;
21
+ } catch (error) {
22
+ if (!['ENOENT', 'EACCES', 'ENOTDIR'].includes(error.code)) throw error;
23
+ }
24
+ }
25
+ throw new Error('DSH must be installed and available on PATH to configure its profile.');
26
+ }
27
+
5
28
  export async function importFromDsh(entry, name) {
6
29
  const require = createRequire(await realpath(entry));
7
30
  return import(pathToFileURL(require.resolve(name)).href);
8
31
  }
32
+
33
+ /** Load a module from the DSH installation instead of adding a second copy. */
34
+ export async function loadDshModule(name, executable) {
35
+ return importFromDsh(executable ?? await dshExecutable(), name);
36
+ }
37
+
38
+ export async function loadDshYaml(executable) {
39
+ return loadDshModule('yaml', executable);
40
+ }
@@ -18,8 +18,9 @@ Keep normal work in the current native agent. Do not introduce a launcher or mod
18
18
  | `versions --online` | Also query registry release channels; no installation |
19
19
  | `sync` | Preview repository-to-machine configuration deployment |
20
20
  | `sync --apply` | Deploy configuration and reconnect native integrations |
21
- | `update` | Preview the source branch's remote head without fetching |
22
- | `update --apply` | Fast-forward a clean tracked source branch, then deploy |
21
+ | `update` / `update --check` | Preview the source branch's remote head, the runtime copy and the deployment plan without fetching or writing |
22
+ | `update --apply` | Fast-forward a clean tracked source branch, refresh the installed runtime copy when run from an external Kitto package, then deploy |
23
+ | `hosts` / `hosts --apply` | Preview / install selected hosts' pinned tested baseline through npm; exact `--version` and one `--host` only, never automatic |
23
24
  | `export` | Preview sanitized Pi machine-to-repository export |
24
25
  | `export --apply` | Write that export to the local source checkout; never commit or push |
25
26
  | `deps` / `deps --apply` | Preview / install CLI dependencies needed by the selected hosts and enabled capabilities, only when requested |
@@ -28,11 +29,11 @@ Keep normal work in the current native agent. Do not introduce a launcher or mod
28
29
 
29
30
  Begin with `status`. For changes, inspect the corresponding preview, explain concrete conflicts or scope, and apply within the user's authorization. A sync may install the source's declared Pi packages. Existing shared skill directories are preserved when different; report conflicts and resolve them with the user rather than deleting them. Local edits or diverged source history stop an update; never reset or stash them automatically.
30
31
 
31
- Use `versions --online` when asked about upgrades. Distinguish installed, declared and upstream versions, including prereleases and engine requirements. Registry metadata is not a compatibility test. Kitto does not bulk-upgrade hosts or plugins: use each native manager for explicitly selected upgrades, test the relevant host, and update the source only after validation. Update Kitto itself by rerunning its npm setup entry with the intended package version.
32
+ Use `versions --online` when asked about upgrades. Distinguish installed, declared and upstream versions, including prereleases and engine requirements. Registry metadata is not a compatibility test. Kitto does not bulk-upgrade hosts or plugins: for selected hosts, `kitto hosts` previews installed versions, the tested baselines and the exact native-manager commands, and only an explicit `kitto hosts --apply` installs those pinned baselines through npm; it never follows `latest` and never upgrades automatically. Use each native manager for anything beyond that baseline, test the relevant host, and update the source only after validation. Update Kitto itself by rerunning its npm setup entry with the intended package version; `update --apply` prints the installed and tested-baseline host versions but never upgrades a host CLI. `update` and `update --check` are previews; `update --apply` also refuses dirty, detached/tag, upstream-less and diverged checkouts before writing. This bundled runner cannot replace its own runtime copy, so `node KITTO_RUNNER update --apply` only fast-forwards and redeploys; refresh the runtime with the intended Kitto package instead. A replaced runtime is verified only after its deployment succeeds, so `recover` returns to the last successfully deployed version. A lost checkout is restored only from its recorded branch; tag-pinned or unknown refs must be recreated in place, or the machine reinstalled with a new KITTO_HOME. The running process completes its deployment with the code it started with; later calls use the refreshed runtime.
32
33
 
33
34
  For a change intended for every machine, edit the source checkout. Write host-specific changes under the corresponding `config/<agent>/` and common workflows under `skills/`. Show the Git diff, preview and apply sync, and report whether the changes have reached the remote. For this machine only, use the native host's local override. For Codex and DSH instructions, keep local text outside Kitto's managed block. For Pi, use its existing local settings and MCP overrides. When migrating an existing machine, first identify shared content, local changes and machine-specific tools, then transfer only the selected portable items.
34
35
 
35
- The source checkout owns shared skills, host-specific skills, Pi settings, and managed instruction blocks for Codex and DSH. Codex and DSH keep their own authentication, model choices, permissions and MCP configuration. Check the current session for any optional tools a skill needs. Read the source's documentation before changing personal assets. Report what changed, skipped conflicts, failures and any required native reload. Stop on errors; rerun only after resolving the cause.
36
+ The source checkout owns shared skills, host-specific skills, Pi settings, and managed instruction blocks for Codex and DSH. Codex and DSH keep their own authentication, model choices and permissions. Codex MCP is synced from the enabled Pi source as a credential-free whitelist; DSH MCP remains native. Check the current session for any optional tools a skill needs. Read the source's documentation before changing personal assets. Report what changed, skipped conflicts, failures and any required native reload. Stop on errors; rerun only after resolving the cause.
36
37
 
37
38
  Recovery only changes Kitto code and its native registration, preserving the currently deployed personal configuration. It is not a transaction rollback of all earlier file changes or dependency installs. If the installed runner cannot start, use the same package setup entry with `--recover --dry-run`, then `--recover` within the user's request. This external entry also works when recovering an older Kitto version whose skill lacks recovery commands. With no verified checkpoint, rerun setup from a known working package version.
38
39
 
@@ -0,0 +1,135 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { accessSync, constants, existsSync, readdirSync, statSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
5
+ import { readScopeRegistry, scopeHome } from './scopes.mjs';
6
+
7
+ const INDEX_DIR = '.codegraph';
8
+
9
+ function isInside(path, root) {
10
+ const rel = relative(root, path);
11
+ return rel === '' || (rel !== '..' && !rel.startsWith('..' + sep) && !isAbsolute(rel));
12
+ }
13
+
14
+ function isDirectory(path) {
15
+ try { return statSync(path).isDirectory(); } catch { return false; }
16
+ }
17
+
18
+ function gitRoot(path) {
19
+ let directory;
20
+ try { directory = resolve(path); } catch { return undefined; }
21
+ for (;;) {
22
+ try {
23
+ const stat = statSync(join(directory, '.git'));
24
+ if (stat.isDirectory() || stat.isFile()) return directory;
25
+ } catch { /* keep walking */ }
26
+ const parent = dirname(directory);
27
+ if (parent === directory) return undefined;
28
+ directory = parent;
29
+ }
30
+ }
31
+
32
+ function childRepos(parent) {
33
+ try {
34
+ return readdirSync(parent, { withFileTypes: true })
35
+ .filter(entry => entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules')
36
+ .map(entry => gitRoot(join(parent, entry.name)))
37
+ .filter(Boolean);
38
+ } catch {
39
+ return [];
40
+ }
41
+ }
42
+
43
+ /** Repositories that should have a CodeGraph index for the registered scopes. */
44
+ export async function codegraphTargets(options = {}) {
45
+ const { source, dshHome, agentsHome, home = scopeHome(), cwd = process.cwd(), registeredOnly = false } = options;
46
+ const registry = await readScopeRegistry(home);
47
+ const targets = new Set();
48
+ const excluded = [source, dshHome, agentsHome].filter(Boolean).map(path => resolve(path));
49
+ const add = path => {
50
+ const repo = gitRoot(path);
51
+ if (!repo || excluded.some(root => isInside(repo, root))) return;
52
+ targets.add(repo);
53
+ };
54
+ const addWorkspace = root => {
55
+ if (!existsSync(root)) return;
56
+ const repo = gitRoot(root);
57
+ if (repo) add(repo);
58
+ else for (const child of childRepos(root)) add(child);
59
+ };
60
+ for (const root of registry.workspaces ?? []) addWorkspace(root);
61
+ for (const parent of registry.workspaceParents ?? []) addWorkspace(parent);
62
+ if (!registeredOnly) {
63
+ if (targets.size === 0) add(cwd);
64
+ if (targets.size === 0 && resolve(cwd) !== resolve(homedir())) for (const child of childRepos(cwd)) add(child);
65
+ }
66
+ return [...targets].sort();
67
+ }
68
+
69
+ export function canWrite(path) {
70
+ try {
71
+ accessSync(path, constants.W_OK);
72
+ return true;
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ export function hasCodegraph() {
79
+ return spawnSync('codegraph', ['--version'], { stdio: 'ignore', timeout: 8000 }).status === 0;
80
+ }
81
+
82
+ export function codegraphPlan(targets, { available = true, writable = canWrite } = {}) {
83
+ return targets.map(path => {
84
+ const indexed = isDirectory(join(path, INDEX_DIR));
85
+ const action = indexed ? 'ready' : !available ? 'missing-cli' : !writable(path) ? 'unwritable' : 'init';
86
+ return { path, action };
87
+ });
88
+ }
89
+
90
+ function defaultRun(path) {
91
+ return spawnSync('codegraph', ['init', '-y', path], { stdio: 'inherit', timeout: 600_000 });
92
+ }
93
+
94
+ /** Report missing indexes without changing anything. */
95
+ export async function reportCodeGraphIndexes(state = {}) {
96
+ const plan = codegraphPlan(await codegraphTargets(state), { available: hasCodegraph() });
97
+ for (const item of plan) {
98
+ if (item.action === 'ready') continue;
99
+ if (item.action === 'missing-cli') console.log(`codegraph index unavailable: ${item.path} (codegraph CLI not found)`);
100
+ else if (item.action === 'unwritable') console.log(`codegraph index missing: ${item.path} (not writable by the current user)`);
101
+ else console.log(`codegraph index missing: ${item.path} (run codegraph init ${item.path})`);
102
+ }
103
+ return plan;
104
+ }
105
+
106
+ /** Report missing indexes and initialize them when applying. */
107
+ export async function ensureCodeGraphIndexes(state = {}, options = {}) {
108
+ const { apply = false, log = console.log, targets, available = hasCodegraph(), writable = canWrite, run = defaultRun, registeredOnly = false } = options;
109
+ const paths = targets ?? await codegraphTargets({ ...state, registeredOnly });
110
+ if (paths.length === 0) return [];
111
+ const plan = codegraphPlan(paths, { available, writable });
112
+ const disabled = process.env.KITTO_NO_CODEGRAPH_INIT === '1';
113
+ for (const item of plan) {
114
+ if (item.action === 'ready') {
115
+ log(`codegraph index ready: ${item.path}`);
116
+ continue;
117
+ }
118
+ if (item.action === 'missing-cli') {
119
+ log(`codegraph index unavailable: ${item.path} (codegraph CLI not found; install @colbymchenry/codegraph)`);
120
+ continue;
121
+ }
122
+ if (item.action === 'unwritable') {
123
+ log(`codegraph index missing: ${item.path} (not writable by the current user; run codegraph init as the workspace owner)`);
124
+ continue;
125
+ }
126
+ if (!apply || disabled) {
127
+ log(`codegraph index missing: ${item.path} (run codegraph init ${item.path})`);
128
+ continue;
129
+ }
130
+ const result = run(item.path);
131
+ if (result?.status === 0) log(`codegraph index created: ${item.path}`);
132
+ else log(`codegraph index failed: ${item.path} (${result?.error?.message || `exit ${result?.status}`})`);
133
+ }
134
+ return plan;
135
+ }