Skip to content

refactor(shared): extract skills from each config's own ref - #1580

Open
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:refactor/566-skill-extractor-config-ref
Open

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:refactor/566-skill-extractor-config-ref

Conversation

@1aifanatic

Copy link
Copy Markdown

Summary

Addresses item 2 of #566.

extractSkillsToWorkspace() took two arrays: refs and skillConfigs. It paired them by index, so refs[i] picked the archive and skillConfigs[i].name picked the install directory. SkillConfig already has a ref field, which makes the second array redundant. It also creates a fragile contract: if the two arrays ever get out of step, a skill's archive is extracted under another skill's name, and nothing errors.

This PR removes the refs option and iterates skillConfigs directly, reading each config's own ref:

  • packages/shared/src/skills/skill-extractor.ts: drop refs from ExtractSkillsOptions; loop over skillConfigs.
  • packages/shared/src/queue/queue-processor.ts: stop passing requestDoc.skillRevisions separately. skillConfigs comes from SkillClient.resolveSkills(), which keeps the refs' order and throws on any missing ref, so what gets extracted doesn't change.

The other items in #566

  • 1 (double extraction) and 4 (comment numbering): both are in apps/workers/coder-vscode-electron-driver-ext, which isn't in this repository, so there's nothing to change here.
  • 3 (audit skill-prompt.test.ts): prependSkillsToMessage already has behavioral tests in packages/shared/src/skills/skill-prompt.test.ts: unchanged message when there are no skills or the list is empty or undefined, the discovery block placed before the message without the full skill content, and the double-newline separator. I found nothing untested, so this PR leaves it alone.

With that, nothing else in #566 seems to apply to this repo. I left the issue open (this PR says "Refs", not "Fixes") so a maintainer can decide whether to close it.

Tests

  • Existing skill-extractor.test.ts cases updated to drop refs:.
  • New test: two skills with different refs. It asserts each archive is downloaded with that skill's own ref, and the files land in the matching directories.

npx vitest run packages/shared/src/skills packages/shared/src/queue: 13 files, 154 tests pass. tsc --noEmit for packages/shared is clean.

Docs

docs/architecture/skills.md (Delivery) now says the extractor takes only SkillConfig[], and that a failed skill is logged and skipped.

🤖 Generated with Claude Code

extractSkillsToWorkspace() took a refs array alongside skillConfigs and
paired them by index. SkillConfig already carries its ref, so the parallel
array was redundant and a mismatch would extract the wrong archive under a
skill's name. Iterate skillConfigs directly and drop the refs option.

Refs microsoft#566

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant