Skip to content

Installed skills ignore the manifest entry list on Windows, so internal helpers appear as commands #802

Closed

Description

What happens

src/skill/skill.ts reads the entries list out of each installed namespace's openscience-skills.json, then applies it to the skills it just scanned:

// SKILL_GLOB matches <installedDir>/<ns>/skills/<name>/SKILL.md.
const rel = match.slice(installedDir.length + 1)
const segments = rel.split("/")
const ns = segments[0]
const skillName = segments[2]
const entrySet = entriesByNs.get(ns)
if (entrySet) {
  const skill = Object.values(skills).find((s) => s.location === match)
  if (skill) skill.entry = entrySet.has(skillName) || entrySet.has(skill.name)
}

Bun.Glob.scan returns native separators. Measured on this machine:

Bun.Glob("**/SKILL.md").scan({ cwd: "<installedDir>", absolute: true, onlyFiles: true })
  -> ["C:\...\installed-skills\myns\skills\myname\SKILL.md"]

rel      = "myns\skills\myname\SKILL.md"
rel.split("/")  ->  ["myns\skills\myname\SKILL.md"]     // one element
segments[0]     =  the whole relative path               // never matches a namespace
segments[2]     =  undefined

entriesByNs.get(ns) misses, the if (entrySet) body never runs, and skill.entry stays undefined.

Why it is wrong

Info.entry is documented as "Defaults to true. Driven by openscience-skills.json entries[] for URL-installed skills", and the consumer is frontend/workspace/src/atlas/skill-permissions.ts:67:

if (skill.entry === false || names.has(skill.name)) return false

undefined is not false, so on Windows every skill from a URL install is treated as an entry and surfaced in / autocomplete and the Skills library — precisely the internal helpers the manifest marked as not-entries. On POSIX hosts the same install behaves correctly.

The same file's own bundle-format.ts:46 already normalises with path.relative(...).replaceAll("\\", "/"), so this is an internal inconsistency, not a platform impossibility.

Reproduction

Install a namespace whose manifest lists one skill and omits another, then read the flag:

expect((await Skill.get("entry-skill"))?.entry).toBe(true)    // undefined on Windows
expect((await Skill.get("helper-skill"))?.entry).toBe(false)  // undefined on Windows

Verified against the real code path on this Windows machine: before the fix both are undefined.

Suggested fix

Split on the platform separator:

const segments = path.relative(installedDir, match).split(path.sep)

Added as test/skill/installed-entry-flag.test.ts, which writes a real namespace under Global.Path.data/installed-skills and asserts both halves of the contract (listed -> true, omitted -> false). It fails on the original code and passes with the fix, on this machine.

Note on pre-existing failures

test/skill/ has substantial pre-existing failures in this Windows checkout: 38 pass / 25 fail on main, and 41 pass / 22 fail with this change. The delta is in the pre-existing discovers skills from .openscience/... and discover/discovery cases, not in the new test, which is green in both configurations of the fix. The counts differ run to run because several of those tests are order- and timing-sensitive; nothing in this change touches the paths they exercise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions