Skills
dotagents._skills
Publish an overlay's skills into a scope's shared skills/ dir, so every
agent that reads that dir sees the same skills (the "skills synced between agents"
behavior).
An overlay may ship skills/<skill-name>/ directories. Publishing symlinks (or,
where symlinks aren't available, copies) each into <scope>/skills/<skill-name>/.
Removing an overlay unpublishes only the skills it published (matched against
its own skills/ source), never a skill another overlay or the user placed there,
then sweeps any now-broken symlinks.
Pure stdlib (os/shutil) -- no pathlib_next -- so it works in a plain
pip install and inside the .pyz. Symlink-preferred with a copy fallback is
the contract; --copy forces the copy path up front (Windows / no-symlink).
Ported from the precursor's managers/skills.py + helpers.py sync
primitives; the external skills-CLI registry (register/skills.txt) is
deliberately dropped -- publish-to-shared-dir is the stdlib, useful part.
SyncResult(success, mode, message='')
Source code in src/dotagents/_skills.py
30 31 32 33 | |
__slots__ = ('success', 'mode', 'message')
class-attribute
instance-attribute
message = message
instance-attribute
mode = mode
instance-attribute
success = success
instance-attribute
__bool__()
Source code in src/dotagents/_skills.py
35 36 | |
clean_broken_syncs(shared_skills, logger=None)
Drop symlinks under shared_skills whose target no longer exists (an
overlay's skills/ went away), then remove the dir if it emptied.
Source code in src/dotagents/_skills.py
151 152 153 154 155 156 157 158 159 160 161 162 163 | |
publish_overlay_skills(overlay_dir, shared_skills, *, copy=False, logger=None)
Publish each overlay_dir/skills/<name>/ into shared_skills.
Symlink-preferred unless copy forces copies. A conflicting target is
overwritten (the overlay owns its skill names). Returns the count published.
Sweeps broken syncs first so a stale symlink can't block a re-publish.
Source code in src/dotagents/_skills.py
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 | |
remove_overlay_skills(overlay_dir, shared_skills, *, logger=None)
Unpublish only the skills this overlay published (matched to its source), then sweep broken syncs. Returns the count removed.
Source code in src/dotagents/_skills.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
resync_overlay_skills(overlay_dir, shared_skills, *, logger=None)
Refresh already-published skills of this overlay (copy-mode drift). New skills are published; symlinks are inherently current.
Source code in src/dotagents/_skills.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
resync_path(source, target)
Refresh a published skill from its overlay source. A symlink is inherently current; a copy is re-copied when its file set drifted.
Source code in src/dotagents/_skills.py
123 124 125 126 127 128 129 130 131 132 133 134 | |
sync_path(source, target, *, prefer_symlink=True, force=False)
Publish source at target -- symlink if possible, else copy.
An existing correct symlink / matching copy is a no-op success. A conflicting
target is only replaced with force=True; otherwise it is reported as a
conflict so the caller can decide (the publish path retries once with force).
Source code in src/dotagents/_skills.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
unsync_path(target, source)
Unpublish target -- but only if it is this overlay's (a symlink to
source, or a copy matching it). A symlink pointing elsewhere, or a copy whose
content differs, is left untouched (it is someone else's).
Source code in src/dotagents/_skills.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |