Commit Graph
8 Commits
Author SHA1 Message Date
Willie 9d3fafff6b test(windows): add Developer Mode symlink round for followed source links
Covers directory symlinks instead of junctions and project mode, where the
per-skill target links are relative symlinks that must keep the logical
<source>/_dev-skills/<name> tail rather than the checkout path. Verified
on a Windows 11 ARM64 guest with Developer Mode on.
2026-10-05 15:34:23 +08:00
Willie e3c9763e1a fix(sourcewalk): resolve junction targets with Readlink on Windows
filepath.EvalSymlinks leaves a Windows junction unresolved since Go 1.23
reports mount points as irregular rather than symlinks, so the follow
policy walked the junction entry itself and discovered no skills behind
it, while doctor and tracked-repo detection (which only Stat the entry)
reported it as followed. Resolve the link text first, then canonicalize
the target.

Add the Windows E2E script that found this: a junction under the skills
source pointing at a checkout, with the drive-away, write-through, and
trash round-trip steps.

Refs #274
2026-10-05 15:14:10 +08:00
Willie d1371db7ea fix(audit): keep the skills source when auditing agents only (#412)
* fix(audit): keep the skills source when auditing agents only

`skillshare audit --agents` replaced sourcePath with the agents source
before building auditTUIContext, so the TUI's Skills tab discovered
skills inside the agents directory. The agents-only branches now read
agentsSourcePath themselves and the skills source is left alone.

Also from the #390 review, independent of .skillfollow:

- /api/skillignore reads the source through skillsSource() like the
  other routes (equal in project mode today; consistency only).
- scripts/windows/e2e-file-links.ps1 checked doctor output for a
  "Config:" line that no longer exists and could not match the ~-shortened
  path, so the run always aborted. It now checks status --json
  source.path, as e2e-skillfollow.ps1 does.
- windows-test runs internal/sourcewalk; GOOS=windows vet passes and the
  job on this PR is the first real run.

Refs #404, #407.

* fix(audit): relativize agent names against the agents source

With discovery moved to the agents source, auditInstalled and
auditFiltered still printed the header and computed SkillName against
the skills source, so `audit agents --json` reported names such as
`../agents/helper.md` when the two sources are siblings (Codex review on
#412). auditScanRoot now picks the root per kind for discovery, header,
and relativization; the skills source is kept only for TUI tab switching.

Also drops internal/sourcewalk from windows-test again: the first run on
windows-latest fails TestWalkParity, TestWalkDirParity and
TestSymlinkRoot (callback paths come from the canonical root, so
filepath.Rel against the test's root yields `..\..` chains). Logged on
#344.
2026-10-05 11:29:39 +08:00
Willie 539f1d0f03 fix(pi): recover Windows stale locks and protect private registrations (#361)
* test(pi): reproduce Windows private registration access failures

Use NTFS DACL assertions instead of POSIX mode bits and verify that broadly accessible existing records cannot be read or silently reused. Keep the Unix mode assertion unchanged.

* fix(pi): reclaim Windows locks and protect private registration state

Anchor stale directories with delete sharing and delete the verified empty Windows directory by handle, keeping inode, lease and racing-owner guards. Create new registration directories with protected owner/SYSTEM DACLs and validate existing owner/access rules without changing their ACLs. Leave Unix permissions and directory-only removal unchanged.

* test(pi): capture Windows lock identity before path replacement

Windows Lstat lazily fetches file IDs by pathname. Snapshot the stale fixture through its anchored handle and add a matching-mtime replacement regression before first verification or release.

* fix(pi): snapshot Windows lock IDs and accept privileged default owners

Capture acquired lock identity through a handle before Windows can lazily resolve a replaced pathname. Elevated tokens can default file ownership to Administrators; permit privileged owners only alongside a verified current-user-only DACL. Refuse unsafe existing registration directories without modifying their ACLs or writing records.

* docs(pi): record Windows acceptance and isolated regression workflow

Document private Windows ACL requirements and refusal without permission rewrites. Add pinned devcontainer kit packaging, token-isolated full/basic acceptance, preserved UTF-8 logs and a reproducible UTM runbook. Preserve the original Unix permission assertion.

* test(backup): isolate explicit agent backup from sync snapshots

Sync automatically backs up target-local agents. Creating the fixture before sync makes the exact-one-backup assertion depend on both commands sharing a timestamp second. Create it after successful sync so the explicit backup is the only operation that snapshots it, without weakening the assertion.
2026-10-03 23:19:34 +08:00
Willie 7043ca3ad2 fix(windows): stop foreground children when skillshare is terminated (#343)
Windows does not stop the processes a terminated process started, so killing
skillshare mid-pull left git, its ssh command and hooks running. This covers
plain runs and the hidden-console relaunch from #341.

skillshare now puts itself in a kill-on-close job at startup. Processes that
must outlive it (the `ui start` server, the restart helper, browser, file
manager, editor) start through childproc.StartDetached, which allows breakaway
only for that one start. The job otherwise forbids breakaway, because the MSYS
runtime behind Git for Windows' sh.exe breaks every child away from a job that
allows it. The relaunched copy shares the job and ends it if the launcher is
terminated.

Inside a job that forbids breakaway (Task Scheduler) skillshare does not bind
its children, since detached processes could not leave; the task's own job
stops them when the task ends. The e2e script gains -Cancel/-SkipWindows
checks, and the runbook records the expected results for both contexts.
2026-10-03 01:25:44 +08:00
Willie 84bbd40785 fix(windows): run in a hidden console when started without one (#341)
* chore(scripts): install UI deps from the store in utm.sh build

pnpm 12 refuses a symlinked node_modules ("workspace hoist directory is
not a real directory"), so the pinned UTM build stopped at the UI step.
An offline, frozen install from the shared store keeps the build pinned
to the archived lockfile and takes a few seconds.

* fix(windows): run in a hidden console when started without one

Started without a console (a scheduled task wrapper, pythonw), every
console program skillshare spawns gets its own console, so a single
`pull` flashed about ten Windows Terminal windows. skillshare now reruns
itself once with CREATE_NO_WINDOW in that case; all children inherit the
windowless console. Doing it at the entry point covers the 130+ exec
sites instead of patching each one. Runs with a console never relaunch,
and stdio and the exit code pass through.

The UTM runbook and probe script record descendants and new windows for
each console state, so the behavior can be rechecked on a real guest.

Closes #339

* chore(scripts): ask pnpm for the UI store and derive the guest profile

utm.sh build hard-coded /workspace/.pnpm-store, which only matches
pnpm's per-filesystem default by coincidence; it now asks pnpm which
store the workspace UI uses. The console e2e script checked a fixed
user's AppData, so another GUEST_USER could pass while its own profile
changed; it now records the real APPDATA before isolating.

* docs(tests): make the console runbook build step runnable as written

The push step read $OUT, which only exists inside utm.sh, so a fresh
shell pushed /ss.exe; the example also hard-coded arm64 next to a note
about x64 guests. Export utm.sh's default OUT and take the arch from the
probe instead.

* fix(windows): stop the relaunched run when its launcher is killed

A caller that terminates the PID it started (a wrapper timing out) only
killed the waiting wrapper; the relaunched skillshare kept running and
could keep mutating state. The relaunched process now sits in a
kill-on-close job. Its own children break away silently, so git, the
background UI server, browsers and editors behave as they did without
the relaunch. A wait failure after a successful start now exits 1
instead of running the command a second time in the wrapper.

The console e2e script gains a cancel check and a `ui start` survival
check; on the UTM guest the baseline left the inner process serving
after the kill, the fix stops it, and the background server still
outlives its launcher.
2026-10-03 00:14:28 +08:00
Willie 8063a6f424 chore(windows): add UTM verification helper and skill
Windows acceptance on the local UTM guest was a pile of one-off
commands: finding utmctl, polling async exec, running as the desktop
user with a basic token, pinning builds, and pre-seeding the UI cache.
utm.sh wraps those steps, manual-setup.ps1 gives a one-line hands-on
setup in an isolated home, and the skill records the workflow and the
pitfalls hit along the way (S4U tokens, ARM64 emulation, zsh echo).

Refs #299
2026-09-28 16:05:16 +08:00
Willie c7eb59a78f fix(sync): stop linking single files with junctions on Windows
createLink always tried `mklink /J` first. mklink does not check the
source type, so agents, single-file extras such as a shared AGENTS.md, and
per-file extras links became directory junctions that point at a file:
Explorer shows a folder and tools cannot read it. Sync then compared only
the link destination and kept the broken junction forever.

Files now get real symlinks only. When the OS cannot create them (Windows
without Developer Mode, non-elevated), file-based link modes fall back to
copies at the mode level, so status, doctor, the API and later syncs all
see an effective `copy` mode. Fallback copies are tracked by hash so they
keep updating and pruning without touching the user's own files, and turn
back into links once links work. Single-file extras remember what they last
wrote, so an unedited copy is replaced silently instead of producing a
drift backup on every source edit, and switching a target back to import
restores the user's attach-time content plus the import block.

Includes a Windows runbook and script, verified on a Windows 11 ARM64 VM
with and without symlink rights.

Refs #299
2026-09-28 13:54:52 +08:00