Skip to content

Preload Copilot skills in project editor#3080

Open
nighca wants to merge 1 commit intogoplus:devfrom
nighca:issue-3045
Open

Preload Copilot skills in project editor#3080
nighca wants to merge 1 commit intogoplus:devfrom
nighca:issue-3045

Conversation

@nighca
Copy link
Copy Markdown
Collaborator

@nighca nighca commented Apr 27, 2026

Closes #3045, based on #3047.

Summary

  • auto-load xgo-language and spx-project in the SPX editor Copilot context
  • avoid reloading skills that are already available in the current editor context
  • add focused tests for auto-loaded skill context and skill availability wiring

Validation

  • npx vitest --run src/components/copilot/skills/skills.test.ts

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a "Skills" system for the Copilot, enabling it to dynamically load domain-specific knowledge such as SPX project guidelines and XGo language syntax via new tools. It refactors the Copilot architecture by moving editor-specific tools and context providers from the root component into a dedicated useSpxEditorCopilot hook and updates the core Copilot class to support asynchronous context providers and raw string tool results. Feedback focuses on correcting typos and package categorization in the new skill documentation, as well as optimizing the skill registry by caching record lookups to improve performance.

Comment thread spx-gui/src/components/copilot/skills/bundles/spx-project/SKILL.md
Comment thread spx-gui/src/components/copilot/skills/registry.ts
@@ -36,13 +35,3 @@ export function createBuiltInSkillRegistry(): SkillRegistry {
}
return registry
}

/** Register built-in skill support to the given Copilot instance. */
export function registerSkillSupport(copilot: Copilot): Disposer {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skill support 内置到 class Copilot 中了

? 'The signed-in state is still loading'
: signedInState.isSignedIn
? `Now the user is signed in with name "${signedInState.user.username}"`
? `Now the user is signed in as "${signedInState.user.username}", with display name: "${signedInState.user.displayName}"`
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个改动跟这个 PR 关系不大,只是测试时遇到 displayNameusername 不同时,copilot 可能会误判项目是否属于当前用户。因此这里把 displayNameusername 都带上

@nighca nighca marked this pull request as ready for review April 28, 2026 08:39
Copilot AI review requested due to automatic review settings April 28, 2026 08:39
Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good structure overall — the preload wiring is clean, the wrapSkillContent extraction is a genuine improvement, and deduplication via uniq is correct. A few issues worth addressing before merge.

Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/skills/content.ts
Comment thread spx-gui/src/components/copilot/CopilotRoot.vue
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/skills/tools.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR preloads built-in Copilot skills for the SPX project editor so framework/project guidance is available immediately in the editor Copilot context, and adds deduping to avoid reloading already-preloaded skills.

Changes:

  • Preload xgo-language + spx-project skills from the SPX editor Copilot context provider.
  • Move skill catalog + preload-skill context injection into Copilot, and skip load_skill when the skill is already preloaded.
  • Update/add focused tests for skill catalog formatting, preload behavior, and tool deduping.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
spx-gui/src/components/editor/copilot/index.ts Registers a context provider that preloads xgo-language and spx-project in the editor context.
spx-gui/src/components/copilot/skills/tools.ts Adds “already preloaded” short-circuit to load_skill and factors out skill-content wrapping.
spx-gui/src/components/copilot/skills/skills.test.ts Updates tests to exercise skill catalog + preload context via Copilot, and verifies dedupe behavior.
spx-gui/src/components/copilot/skills/context-provider.ts Removes standalone skill catalog provider (now handled in Copilot).
spx-gui/src/components/copilot/skills/content.ts New shared helper to wrap/escape skill content + resource paths.
spx-gui/src/components/copilot/skills/built-in.ts Exposes skill name constants; removes registerSkillSupport helper.
spx-gui/src/components/copilot/copilot.ts Integrates skill catalog + preload context building into core Copilot flow; registers skill tools in ctor.
spx-gui/src/components/copilot/copilot.test.ts Updates constructor usage and expectations due to built-in skill tools always being registered.
spx-gui/src/components/copilot/CopilotRoot.vue Creates built-in registry and passes into Copilot; removes old skill-support registration path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spx-gui/src/components/copilot/CopilotRoot.vue
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/skills/tools.ts
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.

Auto-activate editor Copilot skills by project type

2 participants