Cleanup after #523: install.MoveLockPins shared by skillmove and the project reconcile; one server store reload and reconcile dispatcher; adoption skips the source walk when no plain record's directory is missing.
After a plain mv, only install or Install missing moved an installed skill's record; sync now adopts it too (CLI global, CLI project, dashboard), never prunes, and skips on --dry-run. A hand-moved project skill keeps its lock pin; a same-name nested skill never takes a live record; metadata load failures are sync warnings.
Add skillshare move and POST /api/resources/batch/move so skills and
whole folders can change folder inside the source while keeping their
.metadata.json entry, accepted audit findings, lockfile pin, config
group, .gitignore and literal .skillignore lines. Moving by hand lost
the record and made the next install start over. install --into now
refuses a folder inside a skill or a tracked checkout.
Refs #510
AgentKind.Discover and the skill detail file listing skipped every
hidden directory, including the walk root itself. The `!= "."` guard in
agent.go never fires because walkRoot is an absolute resolved path, so a
sources.agents directory such as ~/.agents discovered zero agents.
Exempt the walk root (`path != walkRoot`), matching the other walks in
the repo. Nested hidden directories are still skipped.
Related to #511 (same class as #514).
* fix(collect,install): collect only real skills; let --track take a local git path
collect treated every directory in a target as a local skill, so a scratch
folder was listed and `collect --force` copied it into the source. A folder
now counts only when it holds SKILL.md; the dashboard scan shares
FindLocalSkills and the dashboard collect request rejects such a folder.
`install /path/to/repo --track` failed with "requires a git repository
source" while file:///path worked. A local path that is a git repository
root is now normalized to the same file:// clone URL for --track (also past
the --branch guard); other local folders get an error that names file://.
Help text, docs (English and i18n) and the built-in skill reference follow.
* fix(install): keep the drive letter in file:// clone URLs for local --track paths
A Windows path such as C:/repo produced file://C:/repo, which makes C: the
URI authority instead of part of the path, so a tracked install from a local
Windows repository could clone the wrong location. Prefix the missing slash
so the URL is file:///C:/repo; POSIX paths are unchanged. Also cover the
dashboard install endpoint with a local-path --track test.
* fix(collect,install): keep UNC file URLs intact; require SKILL.md to be a file
The drive-letter fix lived in the helper shared with explicit file:// URLs,
which rewrote file://server/share/repo into a local path. Keep the slash
logic in the local-path --track case only and leave explicit URLs as parsed.
A subdirectory named SKILL.md passed the existence check, so a scratch folder
holding one was still collected. Both collect entry points (scan and the
dashboard request) now share sync.HasSkillFile, which rejects directories.
* fix(install): escape the local path in the file:// URL used by --track
Git decodes a file:// URL, so a repository path containing %20, %2F, a space
or # was cloned from a different path than the one IsGitRepo accepted. Build
the URL with net/url so those characters are escaped; drive-letter and POSIX
paths keep their form. The integration test now installs from a directory
whose name contains a space and a literal %20.
* fix(install): accept a local bare repository path for --track
A bare repository has HEAD and objects at its root but no .git entry, so the
local-path check rejected it while file:///same/path cloned fine. Add
IsLocalGitRepo (working tree or bare) and use it for both the --track
normalization and the --branch guard.
* test(install): build the bare repo path from a Windows file URL correctly
makeRemote returns file:///C:/dir on Windows; trimming only file:// left
/C:/dir, which filepath.Abs turned into D:\C:\dir, so the bare-repo test
failed on the Windows runner. Drop the slash before the drive letter.
* fix(install): refuse a --track local source that is the install destination
--force removes the tracked destination before cloning. When the local path
given to --track is that same directory, the removal deleted the only clone
source (and any unpushed work) before the clone failed. Compare the two with
os.SameFile, which also covers symlinked paths, and stop before touching the
destination.
* fix(install,collect): keep a tracked source inside its destination; reject special SKILL.md files
--track --force removed the destination before cloning, so a local source
nested below it (or given as an explicit file:// URL) was deleted along with
any unpushed work, and the clone then failed. Resolve the source and refuse
when it is the destination or lies under it, for dry runs too.
HasSkillFile used a not-a-directory test, so a FIFO named SKILL.md counted as
a skill and the collect copy blocked on it. Require a regular file; a
symlinked SKILL.md still resolves through os.Stat.
* fix(install): treat file://localhost URLs as local clone sources
Git clones file://localhost/path from the local filesystem, but the
containment guard only recognised an empty authority, so --track --force
could still delete a source given that way. Accept localhost (any case) as
local.
* test(install): build the localhost file URL from a slash path
On Windows the temp path starts with a drive letter, so prefixing it onto
file://localhost produced file://localhostC:\... instead of a valid URL and
the case failed on the Windows runner. Convert to slashes and add the
separator explicitly.
* fix(install): clone --track --force into a staging dir and swap it in last
--force removed the existing tracked repo before cloning, so any source that
lived under it (plain path, file:///, file://localhost, UNC, symlink or 8.3
alias) was destroyed before git could read it, and a failed clone also lost
the old repo. Clone beside the destination, run the checks and the audit on
the staging copy, then move the old repo aside, rename the new one in and
drop the backup; on any failure the staging copy is removed and the old repo
stays. The pre-removal containment refusal now covers plain local paths only
(the url.Parse special-casing is gone).
* fix(install): refuse a file:// --track source inside the forced destination
The staged swap in 7375400 still lost data for a file:///, file://localhost
or UNC source nested under the destination: the clone succeeded, the old repo
(with the source inside it) was renamed to the backup, and removing the backup
deleted the source's uncommitted work, which a clone cannot carry.
Restore the file URL to local path mapping (now including UNC hosts) so the
containment refusal covers every local spelling, not only plain paths. The
test now keeps an uncommitted file in the source and requires it to survive.
* fix(install): apply the source-inside-destination refusal only to --force
The refusal ran before the --update branch, so `install <tracked repo path>
--track --update` was rejected even though an update pulls the existing
checkout in place and removes nothing. Only the forced replacement can
destroy a source that lives under the destination, so check there.
* fix(install): report a forced clone's root skill under its tracked name
With --force the repo is discovered in the .skillshare-clone-<stamp> staging
directory, and discoverSkills names a root SKILL.md after the directory, so
the CLI summary, dashboard response and oplog listed a random staging name
instead of _foo. Use the tracked name for the root entry.
* fix(install): stage fresh tracked clones so cleanup never hits another installer
A fresh tracked install cloned straight into the destination, and the
deferred cleanup removed it on any failure. If another process created the
same tracked repo between the existence check and the clone, the failing
install deleted that process's checkout. Clone every install into its own
staging directory and rename it in last; a claimed destination makes the
rename fail and only the staging copy is removed.
* fix(sync): replace copy-mode copies with links when switching back to merge
Switching a target from copy back to merge left every copy whose entry name
did not change as a real folder. Merge sync treated it as the user's own
folder, so status and doctor kept saying "run skillshare sync" while sync
changed nothing, and only `sync --force` turned it into a link.
Copy mode already replaces merge-mode links with copies on its own, so merge
sync now replaces a folder the manifest records with a checksum (a copy-mode
copy) with a link, without --force. Folders the manifest does not record, or
records as a link, stay untouched. The pre-sync target backup is unchanged.
The CLI and dashboard diffs name these entries as copies sync replaces
instead of suggesting --force, and the sync-modes docs describe the switch.
* fix(sync): keep copy-mode copies the user edited when switching to merge
The first version replaced any folder the manifest recorded as a copy-mode
copy. The manifest checksum is only a record, so a copy edited since copy
mode made it was deleted too, and `sync --json` and project-mode dashboard
sync take no pre-sync backup to restore it from.
Replace the folder only while it still hashes to the recorded checksum
(Manifest.OwnsCopy). An edited copy is kept and `sync --force` still
replaces it; diff keeps suggesting --force for it. A copy whose name: was
rewritten by prefixed naming, or that was made with custom ignore patterns,
no longer hashes to the source checksum and is kept the same way.
* fix(ui): say a copy-mode copy in a merge target is replaced by a link
The Sync page picks a row's text from the diff item's action alone. The
copy-mode copy that merge sync now replaces comes from the server as an
update, which the page worded as "Link is broken or points elsewhere. Will
be relinked" even though no link exists yet.
Match the server's reason and show "Copy made by copy mode. Will be replaced
by a link" instead, in all eleven dashboard languages.
* docs(sync): say only unedited copy-mode copies are replaced on merge sync
The sync-modes paragraph promised that copies copy mode made are replaced
with links without --force. Merge sync keeps a copy that no longer hashes to
the checksum copy mode recorded, so an edited copy, or one whose name: copy
mode rewrote for prefixed naming, still needs --force.
State the three cases in sync-modes and qualify the diff Modified and Local
override labels, in English and the ja, ko, zh-Hans and zh-Hant copies.
* fix(sync): keep the copy until its replacement link exists
Replacing a copy-mode copy removed the folder first and then created the
link. If creating the link failed (no symlink or junction rights on a
Windows or network filesystem), sync returned an error with the skill gone
from the target. This path now also runs on a plain sync, not only on
--force.
Park the folder beside the entry, create the link, then delete the parked
folder; on failure the folder is moved back. A parked folder left by a run
that died mid-way may be the only copy, so the next sync stops with a message
instead of deleting it. The manifest also forgets the copy-mode mtime and
naming records of an entry that is now a link.
* test(sourcefs): register replaceWithLink's target writes in the raw-write ratchet
The previous commit moved the merge-mode folder replacement into
replaceWithLink, which the ratchet reports as new raw os calls and the old
os.RemoveAll allowance as stale. All of them act on the sync target, not the
skills source, like the neighbouring entries.
* fix(sync): bound the parked copy's name and document the naming exception
The folder parked while a link is created was named after the entry, so an
entry near the 255-byte filename limit (a long flattened nested skill)
could not be moved aside and its replacement failed. The parked name is now
a fixed-length hash of the entry name.
sync-modes also says what happens when `target_naming` changes in the same
sync: the copy gets a new entry name and the prune pass removes it as an
orphan whether or not it was edited, as it did before this change.
* fix(sync): close gaps found while simulating the prefixed naming switch
Simulating the #497 reporter's switch from merge + flat to copy + prefixed
turned up four problems:
- `target X --mode copy --target-naming prefixed` applied only --mode, since
the setter dispatch returned after the first flag. Both flags given
together now check the final pair, then apply in an order that keeps the
saved pair valid (copy mode first, any other mode last).
- Skipped skills were only counted, so a prefixed name over 64 characters
vanished with "1 skill(s) skipped". Sync now names the first five with
their reason; the cap keeps huge sources from flooding the output.
- In copy mode a merge-mode link to the skill was not a managed entry, so
when a local folder held the new name the old link was pruned and the
skill left the target, contrary to the documented "old managed entry is
preserved". Copy mode now migrates such links like managed copies.
- PATCH /api/targets validated the mode/naming pair against the current
skills state, so disabling skills while changing mode was rejected. It now
checks the state the request leaves the target in.
* docs(target): drop stray space in the Japanese mode+naming sentence
* fix(diff): save paired target settings once and report kept legacy entries
- `target X --mode M --target-naming N` ran the two setters, each saving
the config, so a failed second save left half the change behind (Codex
on #504). Both fields are now set and saved once, after the final pair
is checked.
- When a local folder holds the name a skill's naming now gives it, sync
keeps the skill under its old entry and leaves the folder alone, even
with --force. diff still called the folder a "local copy" and suggested
`sync --force`, which does nothing for it. CLI and Web API diff, copy
and merge mode, now report the folder and the entry the skill stays at.
* fix(sync): migrate only links the manifest records as merge-made
Copy mode treated any link to the skill's source at an old naming's name as
the entry merge mode left behind, so a user's own link was renamed and
replaced with a copy (Codex on #504). A link now migrates only when the
manifest records it as "symlink", which merge mode writes for links it makes;
other links stay as the user left them. The value is now a named constant.
* fix(diff): mark kept legacy entries as unaffected by force
Two problems Codex found on #504:
- The Web API diff sent a local folder on a skill's new name as a "skip",
which the dashboard shows as an edited entry that Force replaces. Sync
keeps that folder and the legacy entry even with force, so the preview
promised a change that never happens. It is now its own "kept" action,
shown with its reason and not counted.
- `target X --mode M --target-naming N` printed the target's own naming as
the old value, so a target inheriting standard or prefixed showed
"flat -> ...". It now prints the naming the target had in effect.
* fix(diff): keep kept-name conflicts out of the sync count
Two problems Codex found on #504:
- A local folder on a skill's new name counted toward "N to sync" and
fell through to the plain `skillshare sync` hint, though sync changes
nothing there until the folder is renamed or removed. Such rows now
carry a kept flag, count as neither sync nor local, and print their own
hint; a target whose only row is kept still shows that row.
- The dashboard grouped targets by row name and icon only, so two targets
keeping the same skill at different old entries merged and showed one
target's old location for both. The row detail is now part of the key.
* fix(diff): do not list a kept local folder's files as deletions
A kept row (a local folder on a skill's new name) still pointed at that
folder, so `diff --stat` and `--patch` listed each of its files as removed,
though sync never touches the folder (Codex on #504). Kept rows no longer
point at a target directory, so no file-level diff is built for them in the
CLI or the TUI.
* fix(diff): report kept skills consistently in every diff view
An exhaustive review of the kept-row change (prompted by two Codex findings
on #504) found the same gap in several places:
- A target whose only rows were kept was summarized as "in sync", and mixed
summaries left it out of every count. Such targets now count as "N kept
under old name" with a warning mark, and the scan progress counts them.
- Plain output and the TUI hid where the skill stays; rows now read
"name (stays at old-name)". The TUI also lacked the kept Next hint and
called kept-only targets "differs"; it now matches the plain output.
- `diff --json` emitted kept rows as "remove", indistinguishable from
local-only folders; it now emits "kept", as the Web API does. The diff
docs' JSON example also showed actions the CLI never emits.
- Renamed rows whose old entry is a merge-made link showed a bogus file
stat, because the link was walked as a file; a link now stands for the
folder it points to.
- A dry-run migration printed "Would copy" to the old path; it now names
the new one.
* fix(sync): stop reporting kept folders and skipped skills as pending work (#509)
Three reports told users to do something sync cannot do, or hid what it
did:
- Copy and merge sync kept a folder the user made on a skill's name but
counted it as "up to date" with no hint. Sync now counts it as local and
adds one capped line per target naming the folders and saying that
`sync --force` replaces them. The line is added in SyncSkillTarget, so
the dashboard gets it too.
- status and doctor counted skills that sync skips on purpose (invalid
names under standard or prefixed naming, name collisions) as "not
synced — run skillshare sync". Running sync can never add them, so the
advice looped. They now compare against the skills sync places.
- diff marked a target whose only items were local-only folders as "to
sync" and `synced: false`. Those items are still listed, but they no
longer make the target pending.
* fix(target): apply every setting flag, require flag values, report no-ops as unchanged (#507)
* fix(target): apply every setting flag, require flag values, report no-ops as unchanged
`skillshare target <name>` dispatched --mode, --agent-mode and
--target-naming through an if-chain that returned after the first match,
so `--agent-mode copy --target-naming prefixed` applied one setting and
silently dropped the other. Filters, --skills and --dry-run had the same
early-return problem.
- Check --mode, --agent-mode and --target-naming as a whole and save
once, in global and project mode (one targetSettingsUpdate replaces six
per-flag functions).
- Reject --mode/--agent-mode/--target-naming combined with filters or
--skills, and --dry-run without --skills, instead of dropping them.
- A value flag followed by another flag (or an empty string) now reports
"<flag> requires a value"; `--target-naming -p` used to report an
invalid naming '-p'.
- A value the target already has is reported as unchanged and the config
is not rewritten.
* fix(target): leave the skills pair alone on agents-only changes
A target with skills off may keep target_naming prefixed with a merge
mode it cannot sync; validateGlobalTarget and validateProjectTarget only
check that pair for enabled skills. The combined settings update ran the
pair check for every setting, so `target claude --agent-mode copy` was
refused on such a target although the old agent-mode handler never looked
at skills settings. Check the pair only when --mode or --target-naming is
given.
* docs(target): show combined settings in --help and the built-in skill
The combined --mode/--agent-mode/--target-naming form is now the way to
move a target to copy + prefixed in one step, but neither the help
examples nor the built-in skill's target reference showed it.
Sync re-copies a managed copy whose recorded naming differs from the
current one, for example after a migration stopped between the rename
and the re-copy. Diff skipped it on the mtime fast path and reported the
target in sync while its SKILL.md kept the old name. Check the recorded
naming first in both the CLI and the dashboard diff.
Skills-off targets may now keep prefixed naming under a merge mode, but
target --skills=true and the dashboard's skills toggle flipped them on
without checking, so the next sync skipped the target and its agents.
Refuse to turn skills on while the effective naming needs copy mode.
A target with skills disabled syncs no skill but still syncs agents,
yet prefixed naming with a merge mode marked it invalid, so sync and
the dashboard dropped it before agent sync. Check naming against mode
only when skills are enabled, for targets, projects and the mode PATCH.
Top-level prefixed naming with a merge global mode is valid while every
target overrides copy, but target add (CLI, dashboard, and Agent config
directories) wrote new targets without a mode, so they inherited the
invalid pair and failed at sync. Share one rule for global and project
additions: write copy mode when the inherited naming needs it.
A project target defaults to merge mode and target add has no mode
option, so adding one to a project whose top-level target_naming is
prefixed reported success and then failed validation at sync. Give the
new target copy mode in both the CLI and the dashboard API.
A project whose folder is missing expands into no target, so the
dashboard's mode PATCH never saw its skills settings and could move the
global mode off copy under a project inheriting prefixed naming. Run
the project naming check against the requested mode as well.
After target_naming changes, sync renames the managed entry in place,
but diff looked only under the new name, so the CLI and the dashboard
showed the skill as new while hiding the old entry. Resolve the legacy
entry and report it as a rename instead.
Code review of the target-page warning found the new targets API field
only had a unit test on the config helper. The handler is what the UI
reads, so check that it names targets writing the same skills folder and
leaves out one that writes elsewhere.
Release-As: 0.25.4
The target page needs to know which other targets write to the same
skills folder to warn when an unsaved mode or naming change would make
their syncs undo each other. Re-implementing the server's folder
normalisation (home expansion, path cleaning) in TypeScript would drift
from config.SkillsFolderConflicts, so the targets API now returns
skillsSharedWith, built from the same skillsFolder helper.
Targets that set prefixed naming but inherit the skills mode depend on the
global mode staying copy. Changing it from the dashboard left those targets
invalid until the next sync reported them; the global mode setter now runs
the same copy-only check the per-target setters do.
The new naming has to be choosable wherever naming already is: target
--target-naming, the target list TUI, the dashboard target page, shell
completions and the config schemas. Each setter checks the copy-only rule
before saving, for a naming change and for a mode change on a prefixed
target, so an invalid pair never reaches the config file and only surfaces
later as a failed sync.
Two tracked repos that ship a skill with the same name cannot both reach a
tool today: standard drops both, flat keeps both folders but tools list
skills by name:. Prefixed gives a skill inside a tracked repo the folder and
name: <repo>-<name> in the copy, so both stay usable and the name shows
where the skill came from. It is copy-only because a merge symlink points
at the source, where name: must not change; config validation rejects it
elsewhere, per target, like extension does.
Switching naming used to know only the flat name as the old one, so
standard <-> prefixed would orphan entries. The migration now checks the
skill's name under every naming, and the copy manifest records the naming
that produced each entry: a switch finds the exact old entry, and a renamed
copy is re-copied so its name: matches even when the source is unchanged.
Manifests without the record fall back to flat, standard, prefixed in turn.
A rename is written to the manifest at once, so a later failure cannot
leave the renamed folder looking user-owned.
Two targets writing one skills folder with different target_naming or
mode undo each other on every sync (flat links vs standard names, merge
vs copy), but only include/exclude were compared, so sync and doctor
fell back to the generic shared-path hint.
Compare the effective mode and target naming too, so an unset value
equals the default it resolves to. The global default mode is not
carried on the target, so SkillsFolderConflicts takes it from its three
callers. The warning now says "different settings" instead of "different
filters".
Fixes#498
Many integration and handler tests re-checked rules that internal/
packages already test, duplicated each other, or ran no product code at
all (a few re-implemented the logic inline, two could never fail). They
slowed the suite without catching anything new.
Delete those, keeping tests for CLI wiring, JSON output, exit codes,
project/global mode and cmd-only logic. Move the agents/extras overlap
check into sync.AgentTargetPaths so the CLI and the server share one
implementation and it is covered by unit tests instead of seven
integration tests.
The CLI's `--remove-target --prune` removed a symlink-mode target no matter
where it pointed, while the dashboard removed it only when it still linked
to the extra's source folder. A user who repointed that link at their own
folder could lose it from the CLI. Both now go through one shared
sync.ClearExtraTarget, so the safer rule applies everywhere; the CLI warns
and leaves anything that is not a link to the source instead of failing.
Refs #491
The extras diff, list, status and remove-target commands and the
server's list and diff handlers each discovered an extra's source and
then filtered it with ExtraTargetFiles. A new view that forgot the
filter step would silently show the wrong file count or status.
DiscoverExtraTargetFiles now discovers and filters in one call and
returns the unmatched-include warnings that sync reports. Every caller,
including sync itself, uses it, and ExtraTargetFiles is gone. No
behavior change.
Refs #487
cmdExtrasMode only ran ValidateExtraConfig behind a growing list of
conditions, so each new restriction needed another clause. For a plain
folder extra the full check adds only the mode-name and flatten+symlink
rules, which sync already rejects, so validating unconditionally cannot
refuse a config that syncs today.
The agents and memory extra names were string literals in sync, the
server handlers, the memory store, and the CLI. They now live in
internal/config, and the rename guard moves to ValidateExtraRename so a
future CLI rename reuses it instead of copying the check.
Refs #489
The rules "an extension forces copy mode" and "symlink mode drops
include/exclude" were re-implemented in the create, edit-target, and
quick mode handlers. ExtraTargetConfig.EffectiveMode and Normalize now
hold them in one place, and the handlers call those instead. API
behavior is unchanged: edit-target still clears filters on symlink,
quick mode still rejects symlink when the target has filters, and an
extension still forces copy.
Refs #488
- Pointing a symlink-mode extra at a new source after its old folder was
moved or deleted left the target broken: the old link no longer resolved,
so it was not recognised as ours, and the next sync skipped it as pointing
elsewhere. The link text is now compared with the old source as well.
- A negated include such as "!draft.md" only narrows earlier rules, so on
its own it never matches and was always reported as matching no file.
Negations are no longer checked for matches.
Refs #435
- Sync validation skipped directory extras, so a malformed include such as
"[" written in the config matched nothing and merge sync pruned every
link. Extras with include/exclude now go through ValidateExtraConfig.
- The dashboard's quick Mode menu could switch a filtered target to symlink
and save filters that every later sync rejects. That change is now
validated with the target's filters and refused.
- Changing an extra's source removed the links into the old folder before
saving the config, so a failed save left working targets broken. The
config is saved first.
Refs #435
A directory extra used to sync every file to every target, so a tool that
only wanted a few docs got the whole folder. Each target can now set
gitignore-style include/exclude patterns, matched on the path inside the
source. Merge targets prune links to files that stop matching; copy targets
keep earlier copies, since nothing records which copied files are ours.
Filters are rejected for symlink mode and single-file extras, and sync warns
when an include matches nothing.
The dashboard previously forced users to delete and re-add a target or an
extra to change it. Edit target now changes the folder, file name, mode,
flatten and filters with a live preview; Edit extra renames an extra or
points it at another source folder. A moved target or source drops the
links left at the old place and syncs right away.
CLI: --include/--exclude on extras init, and --add-include, --add-exclude,
--remove-include, --remove-exclude on extras <name>.
Refs #435
The pull response copied only the sync's warnings, so with unmatched
include filters moved to their own field, the Git Sync page stopped saying
that a filter selected nothing after its automatic sync. The pull response
now carries them and the page shows the same notice as the Sync page.
Two global targets with the same unmatched filter were merged into one
notice whose Edit filter link opened only the first target, leaving the
other unfixed. Only a project's targets share a filter, so other targets
now keep their own notice and link.
A target whose includes were an unmatched pattern plus a blank entry was
not marked as getting no skills, because the check counted the raw list
while filtering drops blanks. It now counts the effective patterns.
The dashboard showed the CLI's raw line, "api-server@claude: include pattern
"*review*" matches no skill in the source", once per target. It named a
config field, did not say the target ends up with no skills, and gave no way
to fix it. Sync now returns these as structured entries; the Sync page
groups a project's targets into one localized notice that says what happens
and links to where the filter is edited. The CLI line also says the filter
adds nothing to the target.
The dashboard's install-from-config context read the global skills source
from s.cfg, which stays global in project mode. Missing entries were checked
against the global folder and installed there instead of the project's
.skillshare/skills. Use the project-aware skillsSource and reload the
metadata store from that same folder before reconciling.
Bare `skillshare install` already restores everything .metadata.json records
but the disk lacks, yet the dashboard could only re-clone missing tracked
repos through a separate rehydrate path. Expose the CLI's install-from-config
flow instead (GET /api/install/missing, POST /api/install/from-config) so both
surfaces share one detection and one installer, and drop the old
missingTrackedRepos plumbing from update responses.
The install summary now counts tracked repos and their skills apart from
standalone skills, since "Installed 1 skill" hid a whole repo. New tracked
repos are named `_<owner>-<repo>` so two `skills` repos no longer collide;
existing installs keep their names. `check` passes the stale status through
so the dashboard can offer to prune skills deleted upstream.
Codex review of #481 round two: POST /api/update looked up an exact skill
with the raw name before resolving a repo. The shared helper now accepts
`org/team/`, so with a skill at org/team beside org/_team the raw lookup
missed the skill and the shorthand updated the repo. Clean the name once
at the top of updateSingleByKind so the skill lookup and repo resolution
see the same name.
Codex review of #481 found three problems with the shorthand change:
- `update org/team -p` and the dashboard stream updated the org/_team
repo even when a skill exists at org/team, which used to win because
the shorthand was not rewritten there. FindTrackedCheckoutUnlessSkill
skips the nested shorthand when a directory exists at the typed path;
plain names keep their repo-first behavior.
- Global `update team/` cleaned the name for repo matching but not for
skill matching, so it silently updated `_team` instead of reporting the
skill/repo collision that `update team` reports. resolveByBasename now
cleans the name once for both.
- The update.md example sits in the Project Mode section but lacked -p
(also in the four translations).
A repo installed with `--track --into org` lives at `org/_team`. Only
POST /api/update accepted `org/team`; the dashboard stream and
`update -p` prefixed the whole name (`_org/team`), and global `update`
compared the full name with the basename, so each reported not found.
Move the candidate rule (the name as typed, then `_` added to the last
segment, never leaving the source root) into install.FindTrackedCheckout
and the basename match into install.MatchTrackedRepos, and use them from
the single update, the stream, project and global CLI update. A shorthand
resolves to its own `org/_team`, never to a top-level `_team`; plain names
and full paths keep their behavior.
#474 made install.IsTrackedCheckout (a _-prefixed git repo) the rule for what
a tracked repo is, but several paths still treated any git checkout as one, so
the same directory was classified differently depending on the entry point. An
unprefixed checkout, including a submodule or worktree whose .git is a file,
could be pulled as a tracked repo from the dashboard batch stream, the CLI
--group and project-mode name resolution, and the dashboard single update's
direct-path lookup, and reconcile wrote tracked: true for it.
All of them now use IsTrackedCheckout, so an unprefixed checkout updates as a
regular skill or is skipped, while _-prefixed repos, including --into repos
such as org/_team, still update as tracked repos.
Reconcile no longer registers an unprefixed checkout as tracked or creates an
entry for it from the git remote. An existing entry that an older reconcile
flagged tracked on such a checkout is kept with its source and branch; only the
flag is cleared on the next reconcile, so no user data is removed.
Fixes#476
With --into repos from #472, org/_team and a top-level _team can share a
basename. When org/_team had no entry of its own, the root-skill hash
refresh found _team's entry through GetByPath's basename-only fallback and
overwrote its hashes, which later broke _team's integrity and up-to-date
checks. The refresh now only touches the repo's own entry (exact key, or a
legacy basename key with the matching group).
resolveTrackedRepo built the prefixed --into candidate with filepath.Join,
so on Windows the dashboard result came back as org\_team while #472 made
every other repo name slash-form, and the UI could not match the row.
Resolve the conflict in getTrackedReposImpl by keeping both sides: the
IsTrackedCheckout rule from this branch and the slash-form paths #472
returns for --into repos (org/_repo). Add a GetUpdatableSkills test for a
rewritten --into checkout next to a top-level one.
Simplify and code-review passes over #474 found the fix spread over
several definitions of "tracked repo" and three holes in the repair.
One install.IsTrackedCheckout (a _-prefixed git checkout) now backs
GetTrackedRepos, GetUpdatableSkills, the dashboard routing and the repair.
GetUpdatableSkills skipping such entries replaces the two CLI resolver
filters, so `skillshare check` and the dashboard Updates tab no longer list
a rewritten repo a second time as a regular skill. The repair checks that
one path instead of walking the whole source tree.
- Reconcile sets tracked on a checkout again without dropping type or
repo_url, so a rewritten entry that went through it was never cleaned.
The repair now also runs when those regular-install fields remain.
- The repair used GetByPath, whose basename fallback can return another
top-level item's entry; it now uses the repo's own key.
- A tracked entry whose checkout is gone fell through to the basename
fallback of resolveTrackedRepo and pulled a different repo with the same
basename. It now reports the repo as missing on disk.
The old dashboard update rewrote a tracked repo's metadata entry as a
regular install: tracked was dropped and type, repo_url and version were
added. Those repos stayed broken after the routing fix, because
`skillshare update <repo>` found the name twice (as a repo and as a
regular skill) and refused it, and nothing restored the entry.
The shared tracked-repo update now restores such an entry to what
install --track records (source, branch, group, tracked) when its path is
a checkout GetTrackedRepos lists, so regular skills are never touched.
CLI name and glob resolution skip a regular-skill match whose path is
already a tracked repo, so the update can reach that repair.
Codex review: the routing fix sent every git checkout with metadata to
the tracked-repo update, including standalone skills installed as a full
checkout, whose regular update records the new version and commit.
Their version stayed stale and update checks kept reporting an update.
Only tracked entries and _-prefixed checkouts now skip the regular path.
A tracked repo's own metadata entry carries a Source, so updateSingleByKind
sent it to updateRegularSkill. The reinstall reported isRepo false and
rewrote the entry without tracked: true, after which `skillshare update
<repo>` found the name twice (as a repo and as a regular skill) and refused
to update it. Route tracked entries and git checkouts to the tracked-repo
update before the regular-skill branch.
Closes#473
Batch uninstall treated any name whose last segment starts with "_" and
is a git checkout as a tracked repo. A submodule such as
_team/vendor/_lib inside a tracked repo matched, so the dashboard could
move it out of the repo's checkout, leaving the repo dirty for update.
The fallback for "_"-prefixed names had the same hole before --into
support. --into folders cannot start with "_" (validate.IntoPath), so a
repo name may have "_" only in its last segment; both checks now use
that rule.
Also, the list TUI gave the root skill of an --into repo (RelPath equal
to RepoName, e.g. org/_team) the group "org"; it now has no group, like
a top-level repo's root skill.
Codex review of #472 found three views still deriving a skill's repo
from the first path segment:
- Skill counts in `list`, human-readable `status` and the dashboard
overview matched `<repo>/` prefixes, so an `org/_team` repo whose only
skill is its root SKILL.md counted zero, and `status` disagreed with
`status --json`. They now compare RepoRelPath with the repo name.
- The list TUI took the group as the second path segment, so a skill at
org/_team/skills/vue got group `_team` instead of `skills` and the
`g:` filter missed it. The group is now the first segment below
RepoName. Test fixtures that used a RepoName unrelated to RelPath now
use the repo path, as real entries do.
- The dashboard tree treated only top-level `_` folders as repo roots,
and merged `org / _team / skills` into one row, so an --into repo had
no update or uninstall actions in Tree view. buildTree now marks repo
roots from each skill's repo path, and a merged chain stops at one.
GetTrackedRepos returned OS-native paths, so every caller that compared
them with slash paths (RepoRelPath, dashboard repoPath, metadata keys)
had to convert first. Two callers in install_queries already did, and
this branch added four more. It now returns slash paths on every OS,
matching GetMissingTrackedRepos; filepath.Join and filepath.Base accept
them on Windows, and `update org/_repo` now also matches by full path
there. The per-call-site conversions are gone.
Smaller cleanups in the same code:
- repoOf takes the slash relPath and looks up prefixes by substring, so
the walk no longer splits and joins per directory;
- repo .skillignore matchers are keyed by the same slash rel path, so
isSkillIgnored no longer needs walkRoot;
- batch uninstall uses utils.IsTrackedRepoDir instead of a literal "_";
- the dashboard uses repoOf where it spelled out isInRepo && folderOf;
- the new tests reuse postBatchUninstall and share one --into sandbox.
Batch uninstall now accepts nested repo names such as org/_team. If org
is a link that the follow policy does not follow, the name resolves to a
repo outside the source. uninstall's sourcefs move-out check already
refuses it; this test pins that boundary so a later change to name
resolution cannot remove a repo outside the source.
`install --track --into org` clones to org/_repo, but skill discovery
only marked a skill as in-repo when the first path segment started with
"_". Everything downstream also assumed the repo name was that first
segment. Skills of such a repo were therefore treated as loose skills:
no source in the dashboard, not grouped under the repo, a skill count of
0 in `status`, and an install hint that pointed at the wrong name.
Discovery now records each skill's tracked repo root (RepoRelPath). A
first-segment "_" folder still counts as before; a deeper one counts
only when the walk saw it as a git clone, so a plain org/_drafts folder
stays a folder. The repo's .skillignore is looked up by the same root.
Consumers move from "first segment" to that root:
- the API exposes it as repoPath, and the dashboard groups, updates and
uninstalls repos by it;
- `list` and `status` use it for repo names and counts;
- batch uninstall accepts a nested repo name, so the dashboard can still
remove an --into repo now that its skills are in-repo;
- repo names sent to the dashboard by check and update-all use slash
paths, so they match repoPath on Windows too;
- the install hint suggests `skillshare update org/_repo`.
Fixes#470