Commit 16135a6
authored
* feat(#69): ~/.apc/skills/ as single source of truth — dir-level symlinks, no inline skills
- apc collect: writes extracted skills to ~/.apc/skills/<name>/SKILL.md via
save_skill_file() instead of storing inline in cache bundle
- apc sync: uses sync_skills_dir() for SKILL_DIR_EXCLUSIVE tools (OpenClaw,
Claude Code) — replaces entire skills dir with one symlink → ~/.apc/skills/;
future apc installs are live immediately without re-running sync
- apc install: drops _apply_skill_to_targets(); saves to ~/.apc/skills/ only;
warns if per-skill tools need apc sync to pick up the new skill
- base.py: add SKILL_DIR_EXCLUSIVE flag + sync_skills_dir() method
- openclaw.py + claude.py: SKILL_DIR_EXCLUSIVE = True
- tests: updated to reflect no apply_skills() in sync path; per-skill
tools assert link_skills() called; exclusive tools assert sync_skills_dir()
* fix: CI failures — os.readlink crash, skills.json index, dir_sync manifest + status check
- base.py: fix OSError in sync_skills_dir() — os.readlink() was called before
is_symlink() check; restructured to guard correctly
- collect.py: restore save_skills() for index (metadata only, no body) so
apc skill list and existing tests still work
- manifest.py: add record_dir_sync() + dir_sync field in schema
- sync_helpers.py: call manifest.record_dir_sync() after sync_skills_dir() succeeds
- status.py: check dir_sync symlink integrity for exclusive-dir tools
- test_docker_integration.py: seed ~/.apc/skills/ instead of inline skills.json body;
update test_out_of_sync to break dir symlink for exclusive-dir tools
* feat: all tools use dir-level symlink — no per-skill fallback
- SKILL_DIR_EXCLUSIVE defaults to True in BaseApplier: all tools with
a SKILL_DIR now get a single symlink → ~/.apc/skills/ on apc sync
- Remove explicit SKILL_DIR_EXCLUSIVE=True from claude.py and openclaw.py
(now inherited from base)
- CursorApplier: inherits True; ~/.cursor/rules/ → ~/.apc/skills/
- CopilotApplier: SKILL_DIR_EXCLUSIVE=False (no dedicated skills dir)
- sync_helpers: remove link_skills() fallback entirely from sync path;
prune() only called for MCP orphans, not skills
- tests: update Cursor assertions from .mdc files to SKILL.md subdirs;
update mock appliers to default SKILL_DIR_EXCLUSIVE=True
* refactor: remove SKILL_DIR_EXCLUSIVE flag — SKILL_DIR=None is the only signal needed
If SKILL_DIR is set, sync_skills_dir() runs. If None (Copilot), it skips.
No boolean flag required.
* feat(#71): tool-native skill sync — Gemini, Windsurf, Copilot adapters + apc unsync (#72)
* feat(#71): tool-native skill sync — Gemini dir-symlink, Windsurf injection, Copilot per-file, apc unsync
- Add SKILL_DIR = ~/.gemini/skills/ — Gemini natively reads <name>/SKILL.md subdirs
- Dir-symlink on apc sync; new installs appear immediately
- No native skills dir; inject ## APC Skills section into global_rules.md
- sync_skills_dir(): writes managed block (<!-- apc-skills-start/end --> markers)
- apply_installed_skill(): regenerates block when new skill installed
- unsync_skills(): removes the managed block cleanly
- sync_skills_dir(): creates per-file symlinks in ~/.github/instructions/
<name>.instructions.md → ~/.apc/skills/<name>/SKILL.md
- apply_installed_skill(): creates one symlink for the new skill
- unsync_skills(): removes all apc-managed .instructions.md symlinks
- apply_installed_skill(name): default no-op for dir-symlink tools
- unsync_skills(): default removes dir symlink, recreates empty dir
- record_tool_sync(sync_method): records non-dir-symlink syncs
- sync_method property: returns sync method from stored dir_sync data
- _propagate_to_synced_tools(): after save_skill_file(), finds all synced
tools not in explicit targets and calls apply_installed_skill()
- apc unsync [TOOL...] --all --yes
- Calls unsync_skills() per tool, clears dir_sync from manifest
* fix: remove --target/-t from apc install; propagate to ALL synced tools
The --target flag was a legacy concept from when skills were copied into
each tool's directory. With dir-symlink + sync registry, skills always
land in ~/.apc/skills/ and propagate via sync — the target is irrelevant.
Changes:
- Drop --target/-t option from entirely
- _propagate_to_synced_tools() no longer takes explicit_targets arg —
calls apply_installed_skill() for every synced tool unconditionally
- Dir-symlink tools: still a no-op (symlink already propagates)
- Windsurf/Copilot: correctly get apply_installed_skill() even if they
were previously the only flag passed to --target
- Success message updated: 'to ~/.apc/skills/' instead of tool list
- Tests: replaced -t/--target usage with plain -y; updated target-all
test to test_install_saves_to_apc_skills
* fix: ruff format test_docker_integration.py (lint CI)
* test: 42 unit tests for tool-native sync (Gemini, Windsurf, Copilot, apc unsync)
* test: 15 docker integration tests for Windsurf injection + Copilot per-file sync
Also fixes sync_skills() to correctly record sync method for non-dir tools:
- record_dir_sync() only called when SKILL_DIR is set
- record_tool_sync(SYNC_METHOD) called for Windsurf (injection) and Copilot (per-file-symlink)
- SYNC_METHOD class attr added to BaseApplier (default: dir-symlink)
- WindsurfApplier.SYNC_METHOD = 'injection'
- CopilotApplier.SYNC_METHOD = 'per-file-symlink'
Windsurf tests (8):
- sync creates injection block in global_rules.md
- global_rules.md is a real file, not a symlink
- existing rules preserved when block appended
- apc install propagates to synced Windsurf (regenerates block)
- resync replaces stale block without duplicates
- unsync removes APC block cleanly
- unsync preserves surrounding rule content
- status reflects windsurf as synced
Copilot tests (7):
- sync creates .instructions.md symlinks in ~/.github/instructions/
- symlinks resolve to correct ~/.apc/skills/<name>/SKILL.md target
- apc install propagates to synced Copilot (creates new symlink)
- instructions dir is a real dir, not a dir-level symlink
- unsync removes all .instructions.md symlinks
- unsync preserves manually created (non-symlink) .instructions.md files
- resync after new installs refreshes all symlinks
* fix: remove unused imports call, pytest (lint)
* feat: apc skill remove — propagates deletion to Windsurf + Copilot
When a skill is removed from ~/.apc/skills/:
- Dir-symlink tools (Claude Code, OpenClaw, Gemini, Cursor): automatic —
the skill dir vanishes from the symlink with no extra action.
- Windsurf: regenerates global_rules.md block; removed skill omitted.
- Copilot: removes the now-dangling .instructions.md symlink.
New:
- skills.delete_skill_file(name): removes ~/.apc/skills/<name>/ tree
- BaseApplier.remove_installed_skill(name): default no-op
- WindsurfApplier.remove_installed_skill(name): regenerate block
- CopilotApplier.remove_installed_skill(name): delete symlink
- install.propagate_remove_to_synced_tools(name): calls remove_installed_skill
for all synced tools (mirrors _propagate_to_synced_tools pattern)
- apc skill remove NAME [NAME...] [--yes]: new CLI command
Tests (18 new):
- 10 unit tests: BaseApplier no-op, Windsurf regenerate, Copilot symlink
removal, propagate_remove_to_synced_tools (all synced, skip unsynced,
exception isolation)
- 8 docker integration tests: Windsurf block updated after remove, block
kept with remaining skills, empty block after last skill, Copilot symlink
deleted, other symlinks kept, ~/.apc/skills/ deleted, unknown skill warning,
no-sync path safe
1 parent 1c30488 commit 16135a6
17 files changed
Lines changed: 1963 additions & 182 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
143 | 213 | | |
144 | 214 | | |
145 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
99 | 172 | | |
100 | 173 | | |
101 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
78 | 87 | | |
79 | 88 | | |
80 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
64 | 86 | | |
65 | 87 | | |
66 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
100 | 178 | | |
101 | 179 | | |
102 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
202 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
203 | 214 | | |
204 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
205 | 224 | | |
206 | | - | |
207 | 225 | | |
208 | 226 | | |
| 227 | + | |
209 | 228 | | |
210 | 229 | | |
211 | | - | |
| 230 | + | |
212 | 231 | | |
213 | 232 | | |
0 commit comments