Repository navigation
feat(locate): resolve where every tool takes skills, with a Windows job (#1221) - #1252
Conversation
… a variable moves (Tencent#1221) One resolver, locate(tool, 'skills', install, host), answers where each tool takes skills for every tool, scope and platform. Every skills writer and reader asks it, and skillsDirForTool is gone. A home moved by XDG_CONFIG_HOME, OPENCODE_CONFIG_DIR, HERMES_HOME, PI_CODING_AGENT_DIR, COPILOT_HOME, DSH_HOME, OpenClaw's state dir or profile, or Hermes's Windows default is recorded once per machine in ~/.teamai/tool-homes.json, and the record wins over a shell without the variable. When a tool's skills directory moves, pull releases teamai's unchanged copies from the old one in one pass over every tool, after the built-in stub; an edited or still-used copy is kept.
…ndows runner (Tencent#1221) A windows-latest job runs an allow-list of tests that pass on Windows, guarded by windows-test-list.test.ts, and one real hook-dispatch session-start per hook shell. The hook-command tests pin the platform they render for, so they assert the same exact strings on every OS.
…orrect (Tencent#1221) The skill-use captures come from POSIX shells, so a Windows home goes into them with forward slashes: a raw backslash broke the JSON and a bash command. The retire fixtures are compared byte for byte, so they stay LF on checkout like the hook golden fixtures.
…x on Windows (Tencent#1221) session-start leaves a detached background dispatch running in the sandbox home, and Windows refuses to remove a directory a process still holds (EBUSY). rmSync's own retries wait for it.
…dirs (Tencent#1221) A pull with no record of where skills went cannot take the fast path: a home moved since the last delivery would never get skills. The push half still runs against an install with no user-scope record.
…Tencent#1221) The detached background pass of session-start runs in the payload's cwd, and Windows cannot remove a directory that is a live process's cwd, however long rmSync retries. The payload now names the temp dir, and the sandbox teardown goes back to a plain remove.
The description supplies sufficient built-CLI verification; the older evidence commit and explicitly deferred provider/host coverage are not blocking. No PR code was run, built, or installed. |
… sameSkillDir (Tencent#1221) The pull's fast path, the release of old skills directories and doctor each compared directories their own way: by spelling in the host's flavor, by realpath, or by samePath. They now all ask sameSkillDir: the same path (samePath) once each side is resolved through its links, a directory that does not exist yet compared as written.
…l still reads (Tencent#1221) A pull released an old skills directory once no tool wrote there, although a tool that is installed or selected could still read it: with HERMES_HOME=~/.claude and only Hermes selected, moving Hermes deleted the skills and the stub in ~/.claude/skills that an installed OpenCode or Claude Code still loads. The release now also keeps every directory such a tool reads or may take skills in.
…sion directory (Tencent#1221) HERMES_HOME, COPILOT_HOME, DSH_HOME and the other variables a tool reads for its own home resolve a relative value against the directory the tool runs in, and so did teamai before this change. Only XDG_CONFIG_HOME and LOCALAPPDATA stay absolute-only, as the XDG spec has it.
Both earlier findings are resolved in their reported cases: user-scope readers are protected, and relative tool-specific home overrides resolve against the session directory. The description supplies sufficient built-CLI verification; deferred host/provider coverage is not blocking. No PR code was run, built, or installed. The shallow checkout prevented three-dot resolution; review used the common parent |
…d name it once (Tencent#1221) Pull deleted teamai's unchanged copies from a skills directory a tool moved off unless a tool of the pulling scope read it. A reader in another scope, another project, another shell's environment or a tool teamai does not manage was invisible to that check, so a project pull could empty ~/.claude/skills while OpenCode, installed for the user, still read it. No pull can see every reader, so pull no longer deletes there. It records the new directory and names the old one once; the member deletes the copies when nothing reads them. formerSkillDirs and the in-use scan only served the deletion and are gone.
|
No new findings I’m confident are real in the current diff.
The shallow checkout prevented three-dot resolution. Both commit histories confirm |
Review it one commit at a time: A2 is
b9e03a93and61230293, E is1ea413c9,0cb7e559,6929ed05andb9bc6225, and the skills-directory and home rules aref1d85597,2d34ca25,88c8e8baand50fb7283. A1 merged in #1245.Summary
This PR is steps A2 and E of #1221:
locate, which answers where each tool takes skills.flowchart LR subgraph callers ["callers"] init["init, pull<br/>record moved homes"]:::added skills["skills: pull, push, uninstall, skill-use,<br/>doctor, dashboard, local agent"]:::added other["rules, blocks, agents, MCP, hooks"]:::todo matrix["matrix test<br/>darwin, linux, win32"]:::added end subgraph core ["src/tools.ts + src/locate.ts"] desc["TOOLS (#1245)<br/>home, moves, skill reads"] locate["locate(tool, 'skills', install, host)"]:::added end host{{"Host<br/>platform, env, cwd, recorded homes"}}:::added record[("~/.teamai/tool-homes.json")]:::added left["name old skill dirs<br/>copies stay"]:::added win["Windows job"]:::added page["docs/guide/tool-support.md"]:::todo old["skillsDirForTool"]:::removed init --> record skills & matrix --> locate --> desc locate --> host --> record skills --> left other -.-> locate desc -.-> page win --> matrix skills -.-> old classDef added fill:#2f8f4f,stroke:#1f6b39,color:#fff; classDef todo fill:#5c6670,stroke:#3d454c,color:#fff,stroke-dasharray:4 3; classDef removed fill:#a33a3a,stroke:#7a2a2a,color:#fff,stroke-dasharray:4 3;Green: this PR. Gray: later steps of #1221 (B1, B2 and B3 are #1265, then B4, C and D). Red: removed.
Where skills go (A2).
locate, including the skill-use check.XDG_CONFIG_HOME(OpenCode, Muse),OPENCODE_CONFIG_DIR,HERMES_HOME,PI_CODING_AGENT_DIR,COPILOT_HOME,DSH_HOME, OpenClaw's state dir and profile, and Hermes's Windows default.~/.teamai/tool-homes.json. The record wins over a shell without the variable; doctor reports a shell that disagrees.The rules this PR holds to.
sameSkillDir:samePathafter resolving links; a missing directory compares as written. The pull's fast path, the left-directory notice and doctor all ask it.~expanded, relative against the current directory (as onmain).XDG_CONFIG_HOMEandLOCALAPPDATAcount only when absolute.Windows (E). A
windows-latestjob runs the matrix, an allow-list of Windows-safe tests (a guard test enforces the list) and one realhook-dispatch session-startper hook shell. It is not required yet.Evidence
Built CLI, isolated
HOME,gitprovider, project-only install, only Hermes selected,HERMES_HOME=~/.claude, OpenCode installed at~/.config/opencode, no project.opencode. Then Hermes moves tohermes-band the project pulls:pull-skill-dirs.test.ts"keeps teamai's copies there and names the directory once" failed in three of its four rows (project pull with a user-scope reader, user pull with a project's reader, no reader at all): the old copies were deleted.After: all four rows pass. A relative
HERMES_HOME,COPILOT_HOME,DSH_HOME,OPENCODE_CONFIG_DIR,PI_CODING_AGENT_DIRorOPENCLAW_STATE_DIRresolves against the current directory, as onmain. Table tests coversameSkillDir, which directories a tool left, and every home variable inTOOLS.tsc,lint,vitest run: 11945 passed, 21 skipped.test:e2eat50fb7283: 162 files passed, 4 skipped, 1 failed.workflow-signals(terminal Ctrl-C) fails the same way onmain(fa6a361b) on this macOS machine, and passes in CI.XDG_CONFIG_HOMEhomes for OpenCode and Muse, an OpenClaw workspace flip that deletes nothing, an invalidtool-homes.jsonthat stops the pull, and this PR'swindows-latestjob (632 unit tests, three hook shells).gitlabandgithubproviders.Merge Danger
Door: two-way. Older releases ignore
tool-homes.json, and a revert writes skills to the default paths on the next pull.Blast Radius: where skills land.
OMP_PROFILE,OPENCLAW_HOME,CODEBUDDY_CONFIG_DIR,HERMES_DATA_DIR_SUFFIX.Part of #1221.