@aexol/opencode-wizard 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/graphql-operations.d.ts +1 -1
- package/dist/graphql-operations.js +9 -5
- package/dist/graphql-operations.js.map +1 -1
- package/dist/plugin-tools.d.ts +6 -0
- package/dist/plugin-tools.js +11 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/published-skills-system-note.d.ts +1 -1
- package/dist/published-skills-system-note.js +1 -17
- package/dist/published-skills-system-note.js.map +1 -1
- package/dist/server/runtime.js +116 -55
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/status.d.ts +3 -2
- package/dist/server/status.js +9 -7
- package/dist/server/status.js.map +1 -1
- package/dist/server/types.d.ts +9 -7
- package/dist/server/types.js.map +1 -1
- package/dist/tui/components/status-content.js +31 -2
- package/dist/tui/components/status-content.js.map +1 -1
- package/dist/tui/formatting.js +3 -4
- package/dist/tui/formatting.js.map +1 -1
- package/dist/tui/plugin.js +97 -0
- package/dist/tui/plugin.js.map +1 -1
- package/dist/tui/skill-helpers.d.ts +7 -0
- package/dist/tui/skill-helpers.js +42 -0
- package/dist/tui/skill-helpers.js.map +1 -1
- package/dist/tui/slots.js +2 -12
- package/dist/tui/slots.js.map +1 -1
- package/dist/tui/types.d.ts +22 -0
- package/dist/tui/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- `./tui` → `dist/tui.js`
|
|
10
10
|
- no generated runtime skill directory is published; the plugin stays fetch-only at runtime
|
|
11
11
|
- native OpenCode `skills.urls` is treated as a public/static registry complement, not as the private wizard delivery authority
|
|
12
|
-
- the TUI is a
|
|
12
|
+
- the TUI is a compact status panel: it shows backend URL, signed-in identity, role, and catalog counts while mutations still run through guarded tools
|
|
13
13
|
|
|
14
14
|
## Local development
|
|
15
15
|
|
|
@@ -46,9 +46,9 @@ Use `skills.urls` only for public registries that are intentionally cacheable by
|
|
|
46
46
|
|
|
47
47
|
## Catalog discovery and auth bootstrap
|
|
48
48
|
|
|
49
|
-
Catalog discovery uses the backend-issued plugin session token stored at `~/.config/opencode/opencode-wizard.json` (`auth` field); the plugin does not persist or send Microsoft/Entra tokens to GraphQL. If no valid plugin session exists, no-arg `opencode_wizard_catalog_fetch`, compatibility no-arg `opencode_wizard_published_skills_fetch`, explicit `opencode_wizard_status`, and chat/system-context startup may start the browser Entra PKCE flow and exchange the callback for a fresh backend-issued plugin session. The TUI
|
|
49
|
+
Catalog discovery uses the backend-issued plugin session token stored at `~/.config/opencode/opencode-wizard.json` (`auth` field); the plugin does not persist or send Microsoft/Entra tokens to GraphQL. If no valid plugin session exists, no-arg `opencode_wizard_catalog_fetch`, compatibility no-arg `opencode_wizard_published_skills_fetch`, explicit `opencode_wizard_status`, and chat/system-context startup may start the browser Entra PKCE flow and exchange the callback for a fresh backend-issued plugin session. The TUI panel displays the resulting backend URL, auth identity, role, and catalog counts from that status payload.
|
|
50
50
|
|
|
51
|
-
The shared plugin tools `opencode_wizard_catalog_fetch`, `opencode_wizard_artifact_fetch`, `opencode_wizard_artifact_preference_set`, compatibility published-skill tools, and `opencode_wizard_status` are always exposed by the plugin. Missing auth, forbidden role, backend, or catalog problems are reported by tool output/status metadata instead of hiding these shared tools; only `opencode_wizard_editor_publish_skill
|
|
51
|
+
The shared plugin tools `opencode_wizard_catalog_fetch`, `opencode_wizard_artifact_fetch`, `opencode_wizard_artifact_preference_set`, compatibility published-skill tools, and `opencode_wizard_status` are always exposed by the plugin. Missing auth, forbidden role, backend, or catalog problems are reported by tool output/status metadata instead of hiding these shared tools; only `opencode_wizard_editor_create_or_update_skill`, `opencode_wizard_editor_publish_skill`, and `opencode_wizard_artifact_import` stay editor-only.
|
|
52
52
|
|
|
53
53
|
Call `opencode_wizard_catalog_fetch` with `artifactKind: SKILL` or compatibility `opencode_wizard_published_skills_fetch` without `skill` or `skills` to manually bootstrap plugin login if needed and return catalog-only discovery output for the current directory scope.
|
|
54
54
|
|
|
@@ -58,7 +58,17 @@ Workspace delivery still follows the backend contract: the plugin sends `workspa
|
|
|
58
58
|
|
|
59
59
|
Published skill fetches still support `refresh: true`, but normal cache entries now self-expire after 30 seconds and fetch/status payloads surface `source`, `workspaceSlug`, and `workspaceSlugSource` so stale-vs-refreshed behavior is visible without relying on manual cache deletion. Try `refresh: true` and report the tool-output auth/catalog/source/cache/workspace-resolution state before deleting `~/.cache/opencode/*`.
|
|
60
60
|
|
|
61
|
-
Use `opencode_wizard_artifact_preference_set` or compatibility `opencode_wizard_published_skill_preference_set` for preference actions (`install`, `uninstall`, `ignore`, `unignore`); the TUI panel stays
|
|
61
|
+
Use `opencode_wizard_artifact_preference_set` or compatibility `opencode_wizard_published_skill_preference_set` for preference actions (`install`, `uninstall`, `ignore`, `unignore`); the TUI panel stays read-only and does not run preference mutations directly.
|
|
62
|
+
|
|
63
|
+
## EDITOR skill creation flow
|
|
64
|
+
|
|
65
|
+
For new or updated skills, the canonical plugin path is direct markdown creation:
|
|
66
|
+
|
|
67
|
+
1. Draft the complete `SKILL.md` markdown content in chat or another editor.
|
|
68
|
+
2. Call `opencode_wizard_editor_create_or_update_skill` with `markdownContent` and optional `directory`.
|
|
69
|
+
3. Use `opencode_wizard_artifact_fetch` with `artifactKind: "SKILL"` or compatibility `opencode_wizard_published_skills_fetch` to verify the backend-published body that became runtime authority.
|
|
70
|
+
|
|
71
|
+
Keep `opencode_wizard_editor_publish_skill` for the legacy seed-file flow when `.opencode/skills/<slug>/SKILL.md` already exists locally. Keep `opencode_wizard_artifact_import` for external SKILL/DESIGN_DOC sources such as GitHub skill repos or `npx getdesign@latest add ...` inputs. EDITOR role is checked both when exposing these tools and again at execution time.
|
|
62
72
|
|
|
63
73
|
Editors can import external artifacts without writing project files via `opencode_wizard_artifact_import`: use `source: "npx getdesign@latest add bmw-m"` for a `DESIGN_DOC`, or `source: "https://github.com/vercel-labs/agent-skills --skill react-best-practices"` for a `SKILL`. The plugin import path is a command/raw-source bridge into generic backend artifact persistence: it fetches markdown or a zip-backed `SKILL.md`/`README.md`, sends it to the backend import mutation, records the importing editor in existing created/published actor fields plus source metadata, and the imported backend artifact becomes the runtime authority. The admin Skills Catalog UI can browse Vercel, Skillta, and Design Docs sources and unzip archives in the browser; the plugin keeps generic `artifact` tool naming because the same backend artifact flow supports both `SKILL` and `DESIGN_DOC`.
|
|
64
74
|
|
|
@@ -4,5 +4,5 @@ export declare const PUBLISHED_SKILL_DETAIL_QUERY = "\n query PluginPublishedSk
|
|
|
4
4
|
export declare const WIZARD_ARTIFACTS_CATALOG_QUERY = "\n query PluginWizardArtifacts($input: WizardArtifactsDeliveryInput!) {\n pluginWizardArtifacts(input: $input) {\n artifactKind\n workspace {\n id\n slug\n name\n repositoryUrl\n defaultBranch\n status\n }\n directoryPath\n artifacts {\n \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n\n\n }\n catalogArtifacts {\n \n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n\n }\n artifactPreferences {\n scopeKey\n userKey\n ignoredArtifacts {\n \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n\n\n }\n }\n unsupportedReason\n message\n }\n }\n";
|
|
5
5
|
export declare const WIZARD_ARTIFACT_DETAIL_QUERY = "\n query PluginWizardArtifactVersion($input: WizardArtifactDetailInput!) {\n pluginWizardArtifactVersion(input: $input) {\n id\n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n markdownBody\n renderedContent\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n files {\n id\n relativePath\n contentType\n content\n checksum\n size\n sortOrder\n }\n }\n }\n";
|
|
6
6
|
export declare const SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION = "\n mutation SetWizardArtifactPreference($input: SetWizardArtifactPreferenceInput!) {\n setWizardArtifactPreference(input: $input) {\n scopeKey\n userKey\n ignoredArtifacts {\n \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n\n\n }\n }\n }\n";
|
|
7
|
-
export declare const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = "\n mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {\n createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {\n
|
|
7
|
+
export declare const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = "\n mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {\n admin {\n createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {\n success\n skillSlug\n skillVersionId\n artifactSlug\n artifactVersionId\n errors\n }\n }\n }\n";
|
|
8
8
|
export declare const IMPORT_WIZARD_ARTIFACT_SNAPSHOT_MUTATION = "\n mutation ImportWizardArtifactSnapshot($input: ImportWizardArtifactSnapshotInput!) {\n importWizardArtifactSnapshot(input: $input) {\n success\n skillSlug\n skillVersionId\n artifactSlug\n artifactVersionId\n errors\n }\n }\n";
|
|
@@ -223,11 +223,15 @@ export const SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION = `
|
|
|
223
223
|
`;
|
|
224
224
|
export const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = `
|
|
225
225
|
mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
admin {
|
|
227
|
+
createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {
|
|
228
|
+
success
|
|
229
|
+
skillSlug
|
|
230
|
+
skillVersionId
|
|
231
|
+
artifactSlug
|
|
232
|
+
artifactVersionId
|
|
233
|
+
errors
|
|
234
|
+
}
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PUBLISHED_SKILL_CORE_FIELDS","PUBLISHED_SKILL_ASSIGNMENT_FIELDS","PUBLISHED_SKILLS_CATALOG_QUERY","SET_PUBLISHED_SKILL_PREFERENCE_MUTATION","PUBLISHED_SKILL_DETAIL_QUERY","WIZARD_ARTIFACT_CORE_FIELDS","WIZARD_ARTIFACT_ASSIGNMENT_FIELDS","WIZARD_ARTIFACTS_CATALOG_QUERY","WIZARD_ARTIFACT_DETAIL_QUERY","SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION","CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION","IMPORT_WIZARD_ARTIFACT_SNAPSHOT_MUTATION"],"sources":["../src/graphql-operations.ts"],"sourcesContent":["const PUBLISHED_SKILL_CORE_FIELDS = `\n skill {\n id\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n tags {\n id\n slug\n label\n description\n facet {\n id\n slug\n label\n description\n }\n }\n }\n skillVersion {\n id\n version\n title\n summary\n status\n }\n publishedArtifact {\n id\n frontmatterName\n frontmatterDescription\n checksum\n publishedAt\n fileCount\n }\n`;\n\nconst PUBLISHED_SKILL_ASSIGNMENT_FIELDS = `\n assignmentSource\n assignmentType\n scopePath\n includeChildren\n ${PUBLISHED_SKILL_CORE_FIELDS}\n`;\n\nexport const PUBLISHED_SKILLS_CATALOG_QUERY = `\n query PluginPublishedSkills($input: PublishedSkillsDeliveryInput!) {\n pluginPublishedSkills(input: $input) {\n workspace {\n id\n slug\n name\n repositoryUrl\n defaultBranch\n status\n }\n directoryPath\n skills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n catalogSkills {\n ${PUBLISHED_SKILL_CORE_FIELDS}\n }\n userPreferences {\n scopeKey\n userKey\n ignoredSkills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n }\n }\n }\n`;\n\nexport const SET_PUBLISHED_SKILL_PREFERENCE_MUTATION = `\n mutation SetPublishedSkillPreference($input: SetPublishedSkillPreferenceInput!) {\n setPublishedSkillPreference(input: $input) {\n scopeKey\n userKey\n ignoredSkills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n }\n }\n`;\n\nexport const PUBLISHED_SKILL_DETAIL_QUERY = `\n query PluginPublishedSkillVersionArtifact($input: PublishedSkillArtifactDetailInput!) {\n pluginPublishedSkillVersionArtifact(input: $input) {\n id\n frontmatterName\n frontmatterDescription\n markdownBody\n renderedContent\n checksum\n publishedAt\n fileCount\n files {\n id\n relativePath\n contentType\n content\n checksum\n size\n sortOrder\n }\n }\n }\n`;\n\nconst WIZARD_ARTIFACT_CORE_FIELDS = `\n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n`;\n\nconst WIZARD_ARTIFACT_ASSIGNMENT_FIELDS = `\n assignmentSource\n assignmentType\n scopePath\n includeChildren\n ${WIZARD_ARTIFACT_CORE_FIELDS}\n`;\n\nexport const WIZARD_ARTIFACTS_CATALOG_QUERY = `\n query PluginWizardArtifacts($input: WizardArtifactsDeliveryInput!) {\n pluginWizardArtifacts(input: $input) {\n artifactKind\n workspace {\n id\n slug\n name\n repositoryUrl\n defaultBranch\n status\n }\n directoryPath\n artifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n catalogArtifacts {\n ${WIZARD_ARTIFACT_CORE_FIELDS}\n }\n artifactPreferences {\n scopeKey\n userKey\n ignoredArtifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n }\n unsupportedReason\n message\n }\n }\n`;\n\nexport const WIZARD_ARTIFACT_DETAIL_QUERY = `\n query PluginWizardArtifactVersion($input: WizardArtifactDetailInput!) {\n pluginWizardArtifactVersion(input: $input) {\n id\n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n markdownBody\n renderedContent\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n files {\n id\n relativePath\n contentType\n content\n checksum\n size\n sortOrder\n }\n }\n }\n`;\n\nexport const SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION = `\n mutation SetWizardArtifactPreference($input: SetWizardArtifactPreferenceInput!) {\n setWizardArtifactPreference(input: $input) {\n scopeKey\n userKey\n ignoredArtifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n }\n }\n`;\n\nexport const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = `\n mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {\n createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {\n
|
|
1
|
+
{"version":3,"names":["PUBLISHED_SKILL_CORE_FIELDS","PUBLISHED_SKILL_ASSIGNMENT_FIELDS","PUBLISHED_SKILLS_CATALOG_QUERY","SET_PUBLISHED_SKILL_PREFERENCE_MUTATION","PUBLISHED_SKILL_DETAIL_QUERY","WIZARD_ARTIFACT_CORE_FIELDS","WIZARD_ARTIFACT_ASSIGNMENT_FIELDS","WIZARD_ARTIFACTS_CATALOG_QUERY","WIZARD_ARTIFACT_DETAIL_QUERY","SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION","CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION","IMPORT_WIZARD_ARTIFACT_SNAPSHOT_MUTATION"],"sources":["../src/graphql-operations.ts"],"sourcesContent":["const PUBLISHED_SKILL_CORE_FIELDS = `\n skill {\n id\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n tags {\n id\n slug\n label\n description\n facet {\n id\n slug\n label\n description\n }\n }\n }\n skillVersion {\n id\n version\n title\n summary\n status\n }\n publishedArtifact {\n id\n frontmatterName\n frontmatterDescription\n checksum\n publishedAt\n fileCount\n }\n`;\n\nconst PUBLISHED_SKILL_ASSIGNMENT_FIELDS = `\n assignmentSource\n assignmentType\n scopePath\n includeChildren\n ${PUBLISHED_SKILL_CORE_FIELDS}\n`;\n\nexport const PUBLISHED_SKILLS_CATALOG_QUERY = `\n query PluginPublishedSkills($input: PublishedSkillsDeliveryInput!) {\n pluginPublishedSkills(input: $input) {\n workspace {\n id\n slug\n name\n repositoryUrl\n defaultBranch\n status\n }\n directoryPath\n skills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n catalogSkills {\n ${PUBLISHED_SKILL_CORE_FIELDS}\n }\n userPreferences {\n scopeKey\n userKey\n ignoredSkills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n }\n }\n }\n`;\n\nexport const SET_PUBLISHED_SKILL_PREFERENCE_MUTATION = `\n mutation SetPublishedSkillPreference($input: SetPublishedSkillPreferenceInput!) {\n setPublishedSkillPreference(input: $input) {\n scopeKey\n userKey\n ignoredSkills {\n ${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}\n }\n }\n }\n`;\n\nexport const PUBLISHED_SKILL_DETAIL_QUERY = `\n query PluginPublishedSkillVersionArtifact($input: PublishedSkillArtifactDetailInput!) {\n pluginPublishedSkillVersionArtifact(input: $input) {\n id\n frontmatterName\n frontmatterDescription\n markdownBody\n renderedContent\n checksum\n publishedAt\n fileCount\n files {\n id\n relativePath\n contentType\n content\n checksum\n size\n sortOrder\n }\n }\n }\n`;\n\nconst WIZARD_ARTIFACT_CORE_FIELDS = `\n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n artifactVersion {\n id\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n }\n`;\n\nconst WIZARD_ARTIFACT_ASSIGNMENT_FIELDS = `\n assignmentSource\n assignmentType\n scopePath\n includeChildren\n ${WIZARD_ARTIFACT_CORE_FIELDS}\n`;\n\nexport const WIZARD_ARTIFACTS_CATALOG_QUERY = `\n query PluginWizardArtifacts($input: WizardArtifactsDeliveryInput!) {\n pluginWizardArtifacts(input: $input) {\n artifactKind\n workspace {\n id\n slug\n name\n repositoryUrl\n defaultBranch\n status\n }\n directoryPath\n artifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n catalogArtifacts {\n ${WIZARD_ARTIFACT_CORE_FIELDS}\n }\n artifactPreferences {\n scopeKey\n userKey\n ignoredArtifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n }\n unsupportedReason\n message\n }\n }\n`;\n\nexport const WIZARD_ARTIFACT_DETAIL_QUERY = `\n query PluginWizardArtifactVersion($input: WizardArtifactDetailInput!) {\n pluginWizardArtifactVersion(input: $input) {\n id\n artifact {\n id\n kind\n slug\n name\n summary\n whenToUse\n status\n installPolicy\n }\n version\n title\n summary\n status\n frontmatterName\n frontmatterDescription\n markdownBody\n renderedContent\n checksum\n revision\n updatedAtCursor\n canonicalFilePath\n publishedAt\n fileCount\n files {\n id\n relativePath\n contentType\n content\n checksum\n size\n sortOrder\n }\n }\n }\n`;\n\nexport const SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION = `\n mutation SetWizardArtifactPreference($input: SetWizardArtifactPreferenceInput!) {\n setWizardArtifactPreference(input: $input) {\n scopeKey\n userKey\n ignoredArtifacts {\n ${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}\n }\n }\n }\n`;\n\nexport const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = `\n mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {\n admin {\n createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {\n success\n skillSlug\n skillVersionId\n artifactSlug\n artifactVersionId\n errors\n }\n }\n }\n`;\n\nexport const IMPORT_WIZARD_ARTIFACT_SNAPSHOT_MUTATION = `\n mutation ImportWizardArtifactSnapshot($input: ImportWizardArtifactSnapshotInput!) {\n importWizardArtifactSnapshot(input: $input) {\n success\n skillSlug\n skillVersionId\n artifactSlug\n artifactVersionId\n errors\n }\n }\n`;\n"],"mappings":"AAAA,MAAMA,2BAA2B,GAAG;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,iCAAiC,GAAG;AAC1C;AACA;AACA;AACA;AACA,IAAID,2BAA2B;AAC/B,CAAC;AAED,OAAO,MAAME,8BAA8B,GAAG;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUD,iCAAiC;AAC3C;AACA;AACA,UAAUD,2BAA2B;AACrC;AACA;AACA;AACA;AACA;AACA,YAAYC,iCAAiC;AAC7C;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,uCAAuC,GAAG;AACvD;AACA;AACA;AACA;AACA;AACA,UAAUF,iCAAiC;AAC3C;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,4BAA4B,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,2BAA2B,GAAG;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,iCAAiC,GAAG;AAC1C;AACA;AACA;AACA;AACA,IAAID,2BAA2B;AAC/B,CAAC;AAED,OAAO,MAAME,8BAA8B,GAAG;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUD,iCAAiC;AAC3C;AACA;AACA,UAAUD,2BAA2B;AACrC;AACA;AACA;AACA;AACA;AACA,YAAYC,iCAAiC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,4BAA4B,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,uCAAuC,GAAG;AACvD;AACA;AACA;AACA;AACA;AACA,UAAUH,iCAAiC;AAC3C;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,6CAA6C,GAAG;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,wCAAwC,GAAG;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
package/dist/plugin-tools.d.ts
CHANGED
|
@@ -37,6 +37,10 @@ export type EditorPublishSkillArgs = {
|
|
|
37
37
|
skillSlug: string;
|
|
38
38
|
directory?: string;
|
|
39
39
|
};
|
|
40
|
+
export type EditorCreateOrUpdateSkillArgs = {
|
|
41
|
+
markdownContent: string;
|
|
42
|
+
directory?: string;
|
|
43
|
+
};
|
|
40
44
|
export type WizardArtifactImportArgs = {
|
|
41
45
|
artifactKind?: string;
|
|
42
46
|
source: string;
|
|
@@ -79,6 +83,7 @@ type PublishedSkillToolHandlers = {
|
|
|
79
83
|
updatePublishedSkillPreference: (args: PublishedSkillPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
80
84
|
updateWizardArtifactPreference: (args: WizardArtifactPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
81
85
|
getStatus: (args: PluginStatusArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
86
|
+
createOrUpdateEditorSkill: (args: EditorCreateOrUpdateSkillArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
82
87
|
publishEditorSkill: (args: EditorPublishSkillArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
83
88
|
importWizardArtifact: (args: WizardArtifactImportArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
84
89
|
};
|
|
@@ -94,6 +99,7 @@ export declare const createPublishedSkillToolDefinitions: (tool: ToolFactory, ha
|
|
|
94
99
|
opencode_wizard_status: unknown;
|
|
95
100
|
};
|
|
96
101
|
editorOnlyTools: {
|
|
102
|
+
opencode_wizard_editor_create_or_update_skill: unknown;
|
|
97
103
|
opencode_wizard_editor_publish_skill: unknown;
|
|
98
104
|
opencode_wizard_artifact_import: unknown;
|
|
99
105
|
};
|
package/dist/plugin-tools.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const AVAILABLE_PUBLISHED_SKILL_TOOLS = ['opencode_wizard_catalog_fetch', 'opencode_wizard_artifact_fetch', 'opencode_wizard_artifact_preference_set', 'opencode_wizard_published_skills_fetch', 'opencode_wizard_published_skill_preference_set', 'opencode_wizard_status', 'opencode_wizard_editor_publish_skill', 'opencode_wizard_artifact_import'];
|
|
1
|
+
export const AVAILABLE_PUBLISHED_SKILL_TOOLS = ['opencode_wizard_catalog_fetch', 'opencode_wizard_artifact_fetch', 'opencode_wizard_artifact_preference_set', 'opencode_wizard_published_skills_fetch', 'opencode_wizard_published_skill_preference_set', 'opencode_wizard_status', 'opencode_wizard_editor_create_or_update_skill', 'opencode_wizard_editor_publish_skill', 'opencode_wizard_artifact_import'];
|
|
2
2
|
const SHARED_PUBLISHED_SKILL_TOOLS = AVAILABLE_PUBLISHED_SKILL_TOOLS.slice(0, 6);
|
|
3
3
|
export const resolveAvailableTools = role => {
|
|
4
4
|
if (role === 'EDITOR') return [...AVAILABLE_PUBLISHED_SKILL_TOOLS];
|
|
@@ -78,6 +78,16 @@ export const createPublishedSkillToolDefinitions = (tool, handlers) => ({
|
|
|
78
78
|
})
|
|
79
79
|
},
|
|
80
80
|
editorOnlyTools: {
|
|
81
|
+
opencode_wizard_editor_create_or_update_skill: tool({
|
|
82
|
+
description: 'Canonical EDITOR-only skill creation/update tool. Sends direct SKILL.md markdown content to the backend createOrUpdateSkillFromMarkdown mutation without requiring a local .opencode/skills seed file first.',
|
|
83
|
+
args: {
|
|
84
|
+
markdownContent: tool.schema.string().describe('Complete SKILL.md markdown content, including frontmatter when the backend skill contract requires it'),
|
|
85
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
|
|
86
|
+
},
|
|
87
|
+
async execute(args, context) {
|
|
88
|
+
return handlers.createOrUpdateEditorSkill(args, context);
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
81
91
|
opencode_wizard_editor_publish_skill: tool({
|
|
82
92
|
description: 'Read skill markdown files from .opencode/skills/ and publish them to the backend via the createOrUpdateSkillFromMarkdown mutation. Requires EDITOR role.',
|
|
83
93
|
args: {
|
package/dist/plugin-tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AVAILABLE_PUBLISHED_SKILL_TOOLS","SHARED_PUBLISHED_SKILL_TOOLS","slice","resolveAvailableTools","role","createPublishedSkillToolDefinitions","tool","handlers","sharedTools","opencode_wizard_catalog_fetch","description","args","artifactKind","schema","string","optional","describe","directory","refresh","boolean","execute","context","fetchWizardArtifactCatalog","opencode_wizard_artifact_fetch","artifact","artifacts","fetchWizardArtifacts","opencode_wizard_artifact_preference_set","action","preferenceScope","updateWizardArtifactPreference","opencode_wizard_published_skills_fetch","skill","skills","fetchPublishedSkills","opencode_wizard_published_skill_preference_set","updatePublishedSkillPreference","opencode_wizard_status","getStatus","editorOnlyTools","opencode_wizard_editor_publish_skill","skillSlug","publishEditorSkill","opencode_wizard_artifact_import","source","slug","name","summary","importWizardArtifact"],"sources":["../src/plugin-tools.ts"],"sourcesContent":["export type PublishedSkillFetchArgs = {\n skill?: string;\n skills?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';\n\nexport type WizardArtifactCatalogFetchArgs = {\n artifactKind?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type WizardArtifactFetchArgs = {\n artifactKind?: string;\n artifact?: string;\n artifacts?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type PluginStatusArgs = {\n directory?: string;\n};\n\nexport type PublishedSkillPreferenceArgs = {\n skill: string;\n action: string;\n preferenceScope?: string;\n directory?: string;\n};\n\nexport type WizardArtifactPreferenceArgs = {\n artifactKind?: string;\n artifact: string;\n action: string;\n preferenceScope?: string;\n directory?: string;\n};\n\nexport type EditorPublishSkillArgs = {\n skillSlug: string;\n directory?: string;\n};\n\nexport type WizardArtifactImportArgs = {\n artifactKind?: string;\n source: string;\n slug?: string;\n skill?: string;\n name?: string;\n summary?: string;\n directory?: string;\n};\n\ntype ToolSchemaValue<TSelf> = {\n optional: () => TSelf;\n describe: (description: string) => TSelf;\n};\n\ntype ToolSchema = {\n string: () => ToolSchemaValue<ToolSchemaValue<unknown>>;\n boolean: () => ToolSchemaValue<ToolSchemaValue<unknown>>;\n};\n\nexport type ToolExecuteContext = {\n directory: string;\n abort: AbortSignal;\n metadata: (payload: { title: string; metadata: Record<string, string> }) => void;\n};\n\ntype ToolDefinition<TArgs extends object> = {\n description: string;\n args: { [K in keyof TArgs]-?: unknown };\n execute: (args: TArgs, context: ToolExecuteContext) => Promise<unknown>;\n};\n\nexport type ToolFactory = (<TArgs extends object>(definition: ToolDefinition<TArgs>) => unknown) & {\n schema: ToolSchema;\n};\n\ntype PublishedSkillToolHandlers = {\n fetchPublishedSkills: (args: PublishedSkillFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n fetchWizardArtifactCatalog: (args: WizardArtifactCatalogFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n fetchWizardArtifacts: (args: WizardArtifactFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n updatePublishedSkillPreference: (args: PublishedSkillPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;\n updateWizardArtifactPreference: (args: WizardArtifactPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;\n getStatus: (args: PluginStatusArgs, context: ToolExecuteContext) => Promise<unknown>;\n publishEditorSkill: (args: EditorPublishSkillArgs, context: ToolExecuteContext) => Promise<unknown>;\n importWizardArtifact: (args: WizardArtifactImportArgs, context: ToolExecuteContext) => Promise<unknown>;\n};\n\nexport const AVAILABLE_PUBLISHED_SKILL_TOOLS = [\n 'opencode_wizard_catalog_fetch',\n 'opencode_wizard_artifact_fetch',\n 'opencode_wizard_artifact_preference_set',\n 'opencode_wizard_published_skills_fetch',\n 'opencode_wizard_published_skill_preference_set',\n 'opencode_wizard_status',\n 'opencode_wizard_editor_publish_skill',\n 'opencode_wizard_artifact_import',\n];\n\nconst SHARED_PUBLISHED_SKILL_TOOLS = AVAILABLE_PUBLISHED_SKILL_TOOLS.slice(0, 6);\n\nexport const resolveAvailableTools = (role: string | null | undefined): string[] => {\n if (role === 'EDITOR') return [...AVAILABLE_PUBLISHED_SKILL_TOOLS];\n return [...SHARED_PUBLISHED_SKILL_TOOLS];\n};\n\nexport const createPublishedSkillToolDefinitions = (\n tool: ToolFactory,\n handlers: PublishedSkillToolHandlers,\n) => ({\n sharedTools: {\n opencode_wizard_catalog_fetch: tool<WizardArtifactCatalogFetchArgs>({\n description:\n 'Always-available canonical wizard artifact catalog tool. Supports artifactKind SKILL and DESIGN_DOC; catalogs are metadata-only and bodies/files require explicit artifact fetch.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to catalog: SKILL or DESIGN_DOC; defaults to SKILL'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchWizardArtifactCatalog(args, context);\n },\n }),\n opencode_wizard_artifact_fetch: tool<WizardArtifactFetchArgs>({\n description:\n 'Always-available canonical wizard artifact detail tool. Supports artifactKind SKILL and DESIGN_DOC; fetches explicit backend-authorized bodies/files for effective artifacts.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to fetch: SKILL or DESIGN_DOC; defaults to SKILL'),\n artifact: tool.schema\n .string()\n .optional()\n .describe('Single artifact identifier; for SKILL this is a skill slug, artifact name, or skill name'),\n artifacts: tool.schema\n .string()\n .optional()\n .describe('One or more comma-separated or newline-separated artifact identifiers'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchWizardArtifacts(args, context);\n },\n }),\n opencode_wizard_artifact_preference_set: tool<WizardArtifactPreferenceArgs>({\n description:\n 'Always-available canonical wizard artifact preference tool. Supports SKILL and DESIGN_DOC install/uninstall/ignore/unignore through server-backed artifact preference APIs.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to update: SKILL or DESIGN_DOC; defaults to SKILL'),\n artifact: tool.schema.string().describe('Artifact identifier; for SKILL this is the published skill slug'),\n action: tool.schema\n .string()\n .describe('Preference action: install, uninstall, ignore, or unignore'),\n preferenceScope: tool.schema\n .string()\n .optional()\n .describe('Preference scope for the action: project or global; defaults to project'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.updateWizardArtifactPreference(args, context);\n },\n }),\n opencode_wizard_published_skills_fetch: tool<PublishedSkillFetchArgs>({\n description:\n 'Always-available tool to fetch one or multiple wizard-published skill bodies/details for the current scope. Use this for wizard-listed/private/scoped/backend-published skill slugs instead of the native OpenCode skill tool; auth/catalog failures are returned in tool output. Prefer `skills` for multiple identifiers, call with no args to discover/bootstrap auth, and pass `refresh: true` before clearing plugin/OpenCode caches',\n args: {\n skill: tool.schema\n .string()\n .optional()\n .describe(\n 'Single skill slug, artifact name, or skill name; backward-compatible with comma/newline-delimited lists',\n ),\n skills: tool.schema\n .string()\n .optional()\n .describe('One or more comma-separated or newline-separated skill slugs, artifact names, or skill names'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchPublishedSkills(args, context);\n },\n }),\n opencode_wizard_published_skill_preference_set: tool<PublishedSkillPreferenceArgs>({\n description:\n 'Always-available tool to install, uninstall, ignore, or unignore a backend-published wizard skill for non-TUI workflows using the same shared server-backed preference API as the TUI overlay; auth/catalog failures are returned in tool output',\n args: {\n skill: tool.schema.string().describe('Published skill slug, artifact name, or skill name to update'),\n action: tool.schema\n .string()\n .describe('Preference action: install, uninstall, ignore, or unignore'),\n preferenceScope: tool.schema\n .string()\n .optional()\n .describe('Preference scope for the action: project or global; defaults to project'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.updatePublishedSkillPreference(args, context);\n },\n }),\n opencode_wizard_status: tool<PluginStatusArgs>({\n description:\n 'Always-available tool to report opencode-wizard plugin status, bootstrap auth when missing, and return safe auth/catalog/source/cache/workspace guidance without exposing tokens',\n args: {\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.getStatus(args, context);\n },\n }),\n },\n editorOnlyTools: {\n opencode_wizard_editor_publish_skill: tool<EditorPublishSkillArgs>({\n description:\n 'Read skill markdown files from .opencode/skills/ and publish them to the backend via the createOrUpdateSkillFromMarkdown mutation. Requires EDITOR role.',\n args: {\n skillSlug: tool.schema\n .string()\n .describe('Skill slug matching a directory under .opencode/skills/'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.publishEditorSkill(args, context);\n },\n }),\n opencode_wizard_artifact_import: tool<WizardArtifactImportArgs>({\n description:\n 'Editor-only import tool for external wizard artifacts. Supports SKILL from GitHub/raw SKILL.md sources and DESIGN_DOC from direct URLs or command-like inputs such as `npx getdesign@latest add bmw-m`. Imported backend artifacts become the plugin runtime authority; no project files are written.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to import: SKILL or DESIGN_DOC; inferred from source when omitted'),\n source: tool.schema\n .string()\n .describe('Direct URL or command-like input, e.g. `https://github.com/vercel-labs/skills --skill find-skills` or `npx getdesign@latest add bmw-m`'),\n slug: tool.schema.string().optional().describe('Artifact slug; required for DESIGN_DOC unless inferable'),\n skill: tool.schema.string().optional().describe('Skill directory/name for SKILL repo imports'),\n name: tool.schema.string().optional().describe('Optional display name override'),\n summary: tool.schema.string().optional().describe('Optional summary/description override'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.importWizardArtifact(args, context);\n },\n }),\n },\n});\n"],"mappings":"AA8FA,OAAO,MAAMA,+BAA+B,GAAG,CAC7C,+BAA+B,EAC/B,gCAAgC,EAChC,yCAAyC,EACzC,wCAAwC,EACxC,gDAAgD,EAChD,wBAAwB,EACxB,sCAAsC,EACtC,iCAAiC,CAClC;AAED,MAAM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C,MAAM,CAAC,CAAC,CACRC,QAAQ,CAAC,CAAC,CACVC,QAAQ,CAAC,wFAAwF,CAAC;QACrG4B,MAAM,EAAEtC,IAAI,CAACO,MAAM,CAChBC,MAAM,CAAC,CAAC,CACRE,QAAQ,CAAC,wIAAwI,CAAC;QACrJ6B,IAAI,EAAEvC,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,yDAAyD,CAAC;QACzGgB,KAAK,EAAE1B,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,6CAA6C,CAAC;QAC9F8B,IAAI,EAAExC,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,gCAAgC,CAAC;QAChF+B,OAAO,EAAEzC,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,uCAAuC,CAAC;QAC1FC,SAAS,EAAEX,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,kDAAkD;MACxG,CAAC;MACD,MAAMI,OAAOA,CAACT,IAAI,EAAEU,OAAO,EAAE;QAC3B,OAAOd,QAAQ,CAACyC,oBAAoB,CAACrC,IAAI,EAAEU,OAAO,CAAC;MACrD;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["AVAILABLE_PUBLISHED_SKILL_TOOLS","SHARED_PUBLISHED_SKILL_TOOLS","slice","resolveAvailableTools","role","createPublishedSkillToolDefinitions","tool","handlers","sharedTools","opencode_wizard_catalog_fetch","description","args","artifactKind","schema","string","optional","describe","directory","refresh","boolean","execute","context","fetchWizardArtifactCatalog","opencode_wizard_artifact_fetch","artifact","artifacts","fetchWizardArtifacts","opencode_wizard_artifact_preference_set","action","preferenceScope","updateWizardArtifactPreference","opencode_wizard_published_skills_fetch","skill","skills","fetchPublishedSkills","opencode_wizard_published_skill_preference_set","updatePublishedSkillPreference","opencode_wizard_status","getStatus","editorOnlyTools","opencode_wizard_editor_create_or_update_skill","markdownContent","createOrUpdateEditorSkill","opencode_wizard_editor_publish_skill","skillSlug","publishEditorSkill","opencode_wizard_artifact_import","source","slug","name","summary","importWizardArtifact"],"sources":["../src/plugin-tools.ts"],"sourcesContent":["export type PublishedSkillFetchArgs = {\n skill?: string;\n skills?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';\n\nexport type WizardArtifactCatalogFetchArgs = {\n artifactKind?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type WizardArtifactFetchArgs = {\n artifactKind?: string;\n artifact?: string;\n artifacts?: string;\n directory?: string;\n refresh?: boolean;\n};\n\nexport type PluginStatusArgs = {\n directory?: string;\n};\n\nexport type PublishedSkillPreferenceArgs = {\n skill: string;\n action: string;\n preferenceScope?: string;\n directory?: string;\n};\n\nexport type WizardArtifactPreferenceArgs = {\n artifactKind?: string;\n artifact: string;\n action: string;\n preferenceScope?: string;\n directory?: string;\n};\n\nexport type EditorPublishSkillArgs = {\n skillSlug: string;\n directory?: string;\n};\n\nexport type EditorCreateOrUpdateSkillArgs = {\n markdownContent: string;\n directory?: string;\n};\n\nexport type WizardArtifactImportArgs = {\n artifactKind?: string;\n source: string;\n slug?: string;\n skill?: string;\n name?: string;\n summary?: string;\n directory?: string;\n};\n\ntype ToolSchemaValue<TSelf> = {\n optional: () => TSelf;\n describe: (description: string) => TSelf;\n};\n\ntype ToolSchema = {\n string: () => ToolSchemaValue<ToolSchemaValue<unknown>>;\n boolean: () => ToolSchemaValue<ToolSchemaValue<unknown>>;\n};\n\nexport type ToolExecuteContext = {\n directory: string;\n abort: AbortSignal;\n metadata: (payload: { title: string; metadata: Record<string, string> }) => void;\n};\n\ntype ToolDefinition<TArgs extends object> = {\n description: string;\n args: { [K in keyof TArgs]-?: unknown };\n execute: (args: TArgs, context: ToolExecuteContext) => Promise<unknown>;\n};\n\nexport type ToolFactory = (<TArgs extends object>(definition: ToolDefinition<TArgs>) => unknown) & {\n schema: ToolSchema;\n};\n\ntype PublishedSkillToolHandlers = {\n fetchPublishedSkills: (args: PublishedSkillFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n fetchWizardArtifactCatalog: (args: WizardArtifactCatalogFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n fetchWizardArtifacts: (args: WizardArtifactFetchArgs, context: ToolExecuteContext) => Promise<unknown>;\n updatePublishedSkillPreference: (args: PublishedSkillPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;\n updateWizardArtifactPreference: (args: WizardArtifactPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;\n getStatus: (args: PluginStatusArgs, context: ToolExecuteContext) => Promise<unknown>;\n createOrUpdateEditorSkill: (args: EditorCreateOrUpdateSkillArgs, context: ToolExecuteContext) => Promise<unknown>;\n publishEditorSkill: (args: EditorPublishSkillArgs, context: ToolExecuteContext) => Promise<unknown>;\n importWizardArtifact: (args: WizardArtifactImportArgs, context: ToolExecuteContext) => Promise<unknown>;\n};\n\nexport const AVAILABLE_PUBLISHED_SKILL_TOOLS = [\n 'opencode_wizard_catalog_fetch',\n 'opencode_wizard_artifact_fetch',\n 'opencode_wizard_artifact_preference_set',\n 'opencode_wizard_published_skills_fetch',\n 'opencode_wizard_published_skill_preference_set',\n 'opencode_wizard_status',\n 'opencode_wizard_editor_create_or_update_skill',\n 'opencode_wizard_editor_publish_skill',\n 'opencode_wizard_artifact_import',\n];\n\nconst SHARED_PUBLISHED_SKILL_TOOLS = AVAILABLE_PUBLISHED_SKILL_TOOLS.slice(0, 6);\n\nexport const resolveAvailableTools = (role: string | null | undefined): string[] => {\n if (role === 'EDITOR') return [...AVAILABLE_PUBLISHED_SKILL_TOOLS];\n return [...SHARED_PUBLISHED_SKILL_TOOLS];\n};\n\nexport const createPublishedSkillToolDefinitions = (\n tool: ToolFactory,\n handlers: PublishedSkillToolHandlers,\n) => ({\n sharedTools: {\n opencode_wizard_catalog_fetch: tool<WizardArtifactCatalogFetchArgs>({\n description:\n 'Always-available canonical wizard artifact catalog tool. Supports artifactKind SKILL and DESIGN_DOC; catalogs are metadata-only and bodies/files require explicit artifact fetch.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to catalog: SKILL or DESIGN_DOC; defaults to SKILL'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchWizardArtifactCatalog(args, context);\n },\n }),\n opencode_wizard_artifact_fetch: tool<WizardArtifactFetchArgs>({\n description:\n 'Always-available canonical wizard artifact detail tool. Supports artifactKind SKILL and DESIGN_DOC; fetches explicit backend-authorized bodies/files for effective artifacts.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to fetch: SKILL or DESIGN_DOC; defaults to SKILL'),\n artifact: tool.schema\n .string()\n .optional()\n .describe('Single artifact identifier; for SKILL this is a skill slug, artifact name, or skill name'),\n artifacts: tool.schema\n .string()\n .optional()\n .describe('One or more comma-separated or newline-separated artifact identifiers'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchWizardArtifacts(args, context);\n },\n }),\n opencode_wizard_artifact_preference_set: tool<WizardArtifactPreferenceArgs>({\n description:\n 'Always-available canonical wizard artifact preference tool. Supports SKILL and DESIGN_DOC install/uninstall/ignore/unignore through server-backed artifact preference APIs.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to update: SKILL or DESIGN_DOC; defaults to SKILL'),\n artifact: tool.schema.string().describe('Artifact identifier; for SKILL this is the published skill slug'),\n action: tool.schema\n .string()\n .describe('Preference action: install, uninstall, ignore, or unignore'),\n preferenceScope: tool.schema\n .string()\n .optional()\n .describe('Preference scope for the action: project or global; defaults to project'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.updateWizardArtifactPreference(args, context);\n },\n }),\n opencode_wizard_published_skills_fetch: tool<PublishedSkillFetchArgs>({\n description:\n 'Always-available tool to fetch one or multiple wizard-published skill bodies/details for the current scope. Use this for wizard-listed/private/scoped/backend-published skill slugs instead of the native OpenCode skill tool; auth/catalog failures are returned in tool output. Prefer `skills` for multiple identifiers, call with no args to discover/bootstrap auth, and pass `refresh: true` before clearing plugin/OpenCode caches',\n args: {\n skill: tool.schema\n .string()\n .optional()\n .describe(\n 'Single skill slug, artifact name, or skill name; backward-compatible with comma/newline-delimited lists',\n ),\n skills: tool.schema\n .string()\n .optional()\n .describe('One or more comma-separated or newline-separated skill slugs, artifact names, or skill names'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request'),\n },\n async execute(args, context) {\n return handlers.fetchPublishedSkills(args, context);\n },\n }),\n opencode_wizard_published_skill_preference_set: tool<PublishedSkillPreferenceArgs>({\n description:\n 'Always-available tool to install, uninstall, ignore, or unignore a backend-published wizard skill for non-TUI workflows using the same shared server-backed preference API as the TUI overlay; auth/catalog failures are returned in tool output',\n args: {\n skill: tool.schema.string().describe('Published skill slug, artifact name, or skill name to update'),\n action: tool.schema\n .string()\n .describe('Preference action: install, uninstall, ignore, or unignore'),\n preferenceScope: tool.schema\n .string()\n .optional()\n .describe('Preference scope for the action: project or global; defaults to project'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.updatePublishedSkillPreference(args, context);\n },\n }),\n opencode_wizard_status: tool<PluginStatusArgs>({\n description:\n 'Always-available tool to report opencode-wizard plugin status, bootstrap auth when missing, and return safe auth/catalog/source/cache/workspace guidance without exposing tokens',\n args: {\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.getStatus(args, context);\n },\n }),\n },\n editorOnlyTools: {\n opencode_wizard_editor_create_or_update_skill: tool<EditorCreateOrUpdateSkillArgs>({\n description:\n 'Canonical EDITOR-only skill creation/update tool. Sends direct SKILL.md markdown content to the backend createOrUpdateSkillFromMarkdown mutation without requiring a local .opencode/skills seed file first.',\n args: {\n markdownContent: tool.schema\n .string()\n .describe('Complete SKILL.md markdown content, including frontmatter when the backend skill contract requires it'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.createOrUpdateEditorSkill(args, context);\n },\n }),\n opencode_wizard_editor_publish_skill: tool<EditorPublishSkillArgs>({\n description:\n 'Read skill markdown files from .opencode/skills/ and publish them to the backend via the createOrUpdateSkillFromMarkdown mutation. Requires EDITOR role.',\n args: {\n skillSlug: tool.schema\n .string()\n .describe('Skill slug matching a directory under .opencode/skills/'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.publishEditorSkill(args, context);\n },\n }),\n opencode_wizard_artifact_import: tool<WizardArtifactImportArgs>({\n description:\n 'Editor-only import tool for external wizard artifacts. Supports SKILL from GitHub/raw SKILL.md sources and DESIGN_DOC from direct URLs or command-like inputs such as `npx getdesign@latest add bmw-m`. Imported backend artifacts become the plugin runtime authority; no project files are written.',\n args: {\n artifactKind: tool.schema\n .string()\n .optional()\n .describe('Wizard artifact kind to import: SKILL or DESIGN_DOC; inferred from source when omitted'),\n source: tool.schema\n .string()\n .describe('Direct URL or command-like input, e.g. `https://github.com/vercel-labs/skills --skill find-skills` or `npx getdesign@latest add bmw-m`'),\n slug: tool.schema.string().optional().describe('Artifact slug; required for DESIGN_DOC unless inferable'),\n skill: tool.schema.string().optional().describe('Skill directory/name for SKILL repo imports'),\n name: tool.schema.string().optional().describe('Optional display name override'),\n summary: tool.schema.string().optional().describe('Optional summary/description override'),\n directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),\n },\n async execute(args, context) {\n return handlers.importWizardArtifact(args, context);\n },\n }),\n },\n});\n"],"mappings":"AAoGA,OAAO,MAAMA,+BAA+B,GAAG,CAC7C,+BAA+B,EAC/B,gCAAgC,EAChC,yCAAyC,EACzC,wCAAwC,EACxC,gDAAgD,EAChD,wBAAwB,EACxB,+CAA+C,EAC/C,sCAAsC,EACtC,iCAAiC,CAClC;AAED,MAAMC,4BAA4B,GAAGD,+BAA+B,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAEhF,OAAO,MAAMC,qBAAqB,GAAIC,IAA+B,IAAe;EAClF,IAAIA,IAAI,KAAK,QAAQ,EAAE,OAAO,CAAC,GAAGJ,+BAA+B,CAAC;EAClE,OAAO,CAAC,GAAGC,4BAA4B,CAAC;AAC1C,CAAC;AAED,OAAO,MAAMI,mCAAmC,GAAGA,CACjDC,IAAiB,EACjBC,QAAoC,MAChC;EACJC,WAAW,EAAE;IACXC,6BAA6B,EAAEH,IAAI,CAAiC;MAClEI,WAAW,EACT,mLAAmL;MACrLC,IAAI,EAAE;QACJC,YAAY,EAAEN,IAAI,CAACO,MAAM,CACtBC,MAAM,CAAC,CAAC,CACRC,QAAQ,CAAC,CAAC,CACVC,QAAQ,CAAC,yEAAyE,CAAC;QACtFC,SAAS,EAAEX,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,kDAAkD,CAAC;QACvGE,OAAO,EAAEZ,IAAI,CAACO,MAAM,CAACM,OAAO,CAAC,CAAC,CAACJ,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,gDAAgD;MACrG,CAAC;MACD,MAAMI,OAAOA,CAACT,IAAI,EAAEU,OAAO,EAAE;QAC3B,OAAOd,QAAQ,CAACe,0BAA0B,CA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CAAC;QAC9FiC,IAAI,EAAE3C,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,gCAAgC,CAAC;QAChFkC,OAAO,EAAE5C,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,uCAAuC,CAAC;QAC1FC,SAAS,EAAEX,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,kDAAkD;MACxG,CAAC;MACD,MAAMI,OAAOA,CAACT,IAAI,EAAEU,OAAO,EAAE;QAC3B,OAAOd,QAAQ,CAAC4C,oBAAoB,CAACxC,IAAI,EAAEU,OAAO,CAAC;MACrD;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PublishedSkillsSuccessState } from './published-skills-transform.js';
|
|
2
2
|
export declare const buildPublishedSkillsSystemNote: ({ workspace, directoryPath, catalog, details: _details, }: {
|
|
3
3
|
workspace: {
|
|
4
4
|
slug: string;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import { isUserPublishedSkillAssignment } from './published-skills-transform.js';
|
|
2
|
-
import { WIZARD_SCOPE_LABELS } from './published-skills-terminology.js';
|
|
3
1
|
const SYSTEM_NOTE_SKILL_NAME_LIMIT = 10;
|
|
4
|
-
const SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT = 140;
|
|
5
|
-
const truncateText = (value, maxLength) => {
|
|
6
|
-
const normalized = value.replace(/\s+/gu, ' ').trim();
|
|
7
|
-
if (normalized.length <= maxLength) return normalized;
|
|
8
|
-
return `${normalized.slice(0, Math.max(maxLength - 1, 0)).trimEnd()}…`;
|
|
9
|
-
};
|
|
10
|
-
const buildSkillCatalogLine = skill => {
|
|
11
|
-
const description = truncateText(skill.whenToUse || skill.artifactDescription || skill.skillName || skill.skillSlug, SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT);
|
|
12
|
-
const scopeLabel = isUserPublishedSkillAssignment(skill.assignmentSource) ? WIZARD_SCOPE_LABELS.user : WIZARD_SCOPE_LABELS[skill.contextKind] || WIZARD_SCOPE_LABELS.project;
|
|
13
|
-
return `- ${skill.artifactName || skill.skillName} (${skill.skillSlug}, ${scopeLabel}): ${description}`;
|
|
14
|
-
};
|
|
15
2
|
export const buildPublishedSkillsSystemNote = ({
|
|
16
3
|
workspace,
|
|
17
4
|
directoryPath,
|
|
@@ -22,9 +9,6 @@ export const buildPublishedSkillsSystemNote = ({
|
|
|
22
9
|
const renderedSkillNames = skillNames.length > 0 ? skillNames.slice(0, SYSTEM_NOTE_SKILL_NAME_LIMIT).join(', ') : 'none';
|
|
23
10
|
const remainingCount = Math.max(skillNames.length - SYSTEM_NOTE_SKILL_NAME_LIMIT, 0);
|
|
24
11
|
const renderedCountSuffix = remainingCount > 0 ? ` (+${remainingCount} more)` : '';
|
|
25
|
-
|
|
26
|
-
const projectSkills = catalog.skills.filter(skill => skill.contextKind === 'project' && !isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 5).map(buildSkillCatalogLine);
|
|
27
|
-
const userSkills = catalog.skills.filter(skill => isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 5).map(buildSkillCatalogLine);
|
|
28
|
-
return [workspace ? `Workspace: ${workspace.slug}.` : 'Workspace not found; workspace-scoped wizard skills are unavailable.', `Current directory: ${directoryPath}.`, `Active wizard skills: ${renderedSkillNames}${renderedCountSuffix}.`, `Runtime: runtimeMode=${catalog.runtimeMode}; deliveryModel=${catalog.deliveryModel}; rootSkillSeedPath=${catalog.rootSkillSeedPath}.`, `Counts: ${catalog.assignmentCounts.global} wizard global, ${catalog.assignmentCounts.project} wizard project, ${catalog.assignmentCounts.user} wizard user, ${catalog.assignmentCounts.other} other.`, 'Wizard artifacts support artifact kinds `SKILL` and `DESIGN_DOC`; catalogs stay metadata-only and full bodies/files require explicit authenticated artifact fetch for the effective workspace/directory assignment.', 'Canonical wizard artifact tools are `opencode_wizard_catalog_fetch`, `opencode_wizard_artifact_fetch`, and `opencode_wizard_artifact_preference_set`; catalog output is metadata-only and detail/body/files require explicit artifact fetch.', 'Wizard-listed skills are backend-published and tool-fetch-only; MUST fetch the body via `opencode_wizard_published_skills_fetch` before use (`skills`/`skill` for multiple/single). Same-named native OpenCode skills or local `.opencode/skills` seed bodies are not authoritative for wizard-listed skills; fetched wizard bodies are authoritative.', 'Action recipe: call `opencode_wizard_published_skills_fetch` with no args for auth/catalog bootstrap, use `skill` or `skills` to fetch bodies, try `refresh: true` before deleting caches, and report tool-output auth/catalog/source/cache/workspace-resolution state when unavailable or stale.', 'Source/cache/workspace hints: fetch/status outputs surface `source`, cache TTL/freshness, and workspace-resolution metadata when available; do not infer wizard scope from native/local skill files.', globalSkills.length > 0 ? `Wizard global skills:\n${globalSkills.join('\n')}` : 'Wizard global skills: none.', projectSkills.length > 0 ? `Wizard project skills:\n${projectSkills.join('\n')}` : 'Wizard project skills: none.', userSkills.length > 0 ? `Wizard user skills:\n${userSkills.join('\n')}` : 'Wizard user skills: none.'].filter(Boolean).join(' ');
|
|
12
|
+
return [workspace ? `Workspace: ${workspace.slug}.` : 'Workspace not found; workspace-scoped wizard skills are unavailable.', `Current directory: ${directoryPath}.`, `Active wizard skills (${skillNames.length}): ${renderedSkillNames}${renderedCountSuffix}.`, 'Fetch rule: wizard-listed skill bodies are backend-published and tool-fetch-only; fetch bodies with `opencode_wizard_published_skills_fetch` before use.', 'Status hint: use no-arg fetch/status for auth and catalog state; pass `refresh: true` before cache deletion.'].filter(Boolean).join(' ');
|
|
29
13
|
};
|
|
30
14
|
//# sourceMappingURL=published-skills-system-note.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["SYSTEM_NOTE_SKILL_NAME_LIMIT","buildPublishedSkillsSystemNote","workspace","directoryPath","catalog","details","_details","skillNames","skills","map","skill","artifactName","skillName","skillSlug","renderedSkillNames","length","slice","join","remainingCount","Math","max","renderedCountSuffix","slug","filter","Boolean"],"sources":["../src/published-skills-system-note.ts"],"sourcesContent":["import type { PublishedSkillsSuccessState } from './published-skills-transform.js';\n\nconst SYSTEM_NOTE_SKILL_NAME_LIMIT = 10;\n\nexport const buildPublishedSkillsSystemNote = ({\n workspace,\n directoryPath,\n catalog,\n details: _details,\n}: {\n workspace: { slug: string } | null;\n directoryPath: string;\n catalog: PublishedSkillsSuccessState;\n details: unknown[];\n}): string => {\n const skillNames = catalog.skills.map((skill) => skill.artifactName || skill.skillName || skill.skillSlug);\n const renderedSkillNames =\n skillNames.length > 0 ? skillNames.slice(0, SYSTEM_NOTE_SKILL_NAME_LIMIT).join(', ') : 'none';\n const remainingCount = Math.max(skillNames.length - SYSTEM_NOTE_SKILL_NAME_LIMIT, 0);\n const renderedCountSuffix = remainingCount > 0 ? ` (+${remainingCount} more)` : '';\n\n return [\n workspace ? `Workspace: ${workspace.slug}.` : 'Workspace not found; workspace-scoped wizard skills are unavailable.',\n `Current directory: ${directoryPath}.`,\n `Active wizard skills (${skillNames.length}): ${renderedSkillNames}${renderedCountSuffix}.`,\n 'Fetch rule: wizard-listed skill bodies are backend-published and tool-fetch-only; fetch bodies with `opencode_wizard_published_skills_fetch` before use.',\n 'Status hint: use no-arg fetch/status for auth and catalog state; pass `refresh: true` before cache deletion.',\n ]\n .filter(Boolean)\n .join(' ');\n};\n"],"mappings":"AAEA,MAAMA,4BAA4B,GAAG,EAAE;AAEvC,OAAO,MAAMC,8BAA8B,GAAGA,CAAC;EAC7CC,SAAS;EACTC,aAAa;EACbC,OAAO;EACPC,OAAO,EAAEC;AAMX,CAAC,KAAa;EACZ,MAAMC,UAAU,GAAGH,OAAO,CAACI,MAAM,CAACC,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACC,YAAY,IAAID,KAAK,CAACE,SAAS,IAAIF,KAAK,CAACG,SAAS,CAAC;EAC1G,MAAMC,kBAAkB,GACtBP,UAAU,CAACQ,MAAM,GAAG,CAAC,GAAGR,UAAU,CAACS,KAAK,CAAC,CAAC,EAAEhB,4BAA4B,CAAC,CAACiB,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM;EAC/F,MAAMC,cAAc,GAAGC,IAAI,CAACC,GAAG,CAACb,UAAU,CAACQ,MAAM,GAAGf,4BAA4B,EAAE,CAAC,CAAC;EACpF,MAAMqB,mBAAmB,GAAGH,cAAc,GAAG,CAAC,GAAG,MAAMA,cAAc,QAAQ,GAAG,EAAE;EAElF,OAAO,CACLhB,SAAS,GAAG,cAAcA,SAAS,CAACoB,IAAI,GAAG,GAAG,sEAAsE,EACpH,sBAAsBnB,aAAa,GAAG,EACtC,yBAAyBI,UAAU,CAACQ,MAAM,MAAMD,kBAAkB,GAAGO,mBAAmB,GAAG,EAC3F,0JAA0J,EAC1J,8GAA8G,CAC/G,CACEE,MAAM,CAACC,OAAO,CAAC,CACfP,IAAI,CAAC,GAAG,CAAC;AACd,CAAC","ignoreList":[]}
|
package/dist/server/runtime.js
CHANGED
|
@@ -131,6 +131,7 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
131
131
|
const detailInflight = new Map();
|
|
132
132
|
const wizardArtifactDetailInflight = new Map();
|
|
133
133
|
const initialAuthState = await resolveStoredAuthState(input.worktree, config);
|
|
134
|
+
const registeredTools = resolveAvailableTools(initialAuthState?.role ?? null);
|
|
134
135
|
const loginBootstrap = {
|
|
135
136
|
promise: null,
|
|
136
137
|
snapshot: createIdleLoginBootstrapSnapshot()
|
|
@@ -578,11 +579,7 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
578
579
|
const selection = selectPublishedSkills(filteredPublishedSkillsResult.fetchResult.payload, requestedSkills);
|
|
579
580
|
const isSingleRequest = requestedSkills.length === 1;
|
|
580
581
|
if (requestedSkills.length === 0) {
|
|
581
|
-
const
|
|
582
|
-
const catalog = {
|
|
583
|
-
...toPublishedSkillCatalog(filteredPublishedSkillsResult.fetchResult.payload),
|
|
584
|
-
availableTools: resolveAvailableTools(authState?.role ?? null)
|
|
585
|
-
};
|
|
582
|
+
const catalog = toPublishedSkillCatalog(filteredPublishedSkillsResult.fetchResult.payload, registeredTools);
|
|
586
583
|
context.metadata({
|
|
587
584
|
title: `opencode-wizard published skills catalog: ${catalog.publishedSkillCount} active`,
|
|
588
585
|
metadata: {
|
|
@@ -781,10 +778,9 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
781
778
|
}
|
|
782
779
|
};
|
|
783
780
|
}
|
|
784
|
-
const authState = await resolveStoredAuthState(input.worktree, config);
|
|
785
781
|
const catalog = toWizardArtifactCatalog(fetchResult.payload, {
|
|
786
782
|
pluginId: PLUGIN_ID,
|
|
787
|
-
availableTools:
|
|
783
|
+
availableTools: registeredTools
|
|
788
784
|
});
|
|
789
785
|
const cacheCursor = getWizardArtifactCatalogCursor(fetchResult.payload.artifacts, toWizardArtifactCatalogCursorItems(fetchResult.payload.catalogArtifacts));
|
|
790
786
|
return {
|
|
@@ -865,10 +861,9 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
865
861
|
}
|
|
866
862
|
const selection = selectWizardArtifacts(fetchResult.payload.artifacts, requestedArtifacts);
|
|
867
863
|
if (requestedArtifacts.length === 0) {
|
|
868
|
-
const authState = await resolveStoredAuthState(input.worktree, config);
|
|
869
864
|
const catalog = toWizardArtifactCatalog(fetchResult.payload, {
|
|
870
865
|
pluginId: PLUGIN_ID,
|
|
871
|
-
availableTools:
|
|
866
|
+
availableTools: registeredTools
|
|
872
867
|
});
|
|
873
868
|
const cacheCursor = getWizardArtifactCatalogCursor(fetchResult.payload.artifacts, toWizardArtifactCatalogCursorItems(fetchResult.payload.catalogArtifacts));
|
|
874
869
|
return {
|
|
@@ -992,7 +987,8 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
992
987
|
let snapshot = await resolvePluginStatusSnapshot({
|
|
993
988
|
worktree: input.worktree,
|
|
994
989
|
directory: requestedDirectory,
|
|
995
|
-
signal: context.abort
|
|
990
|
+
signal: context.abort,
|
|
991
|
+
registeredTools
|
|
996
992
|
});
|
|
997
993
|
if (snapshot.status === 'missing_auth') {
|
|
998
994
|
try {
|
|
@@ -1002,7 +998,8 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1002
998
|
snapshot = await resolvePluginStatusSnapshot({
|
|
1003
999
|
worktree: input.worktree,
|
|
1004
1000
|
directory: requestedDirectory,
|
|
1005
|
-
signal: context.abort
|
|
1001
|
+
signal: context.abort,
|
|
1002
|
+
registeredTools
|
|
1006
1003
|
});
|
|
1007
1004
|
} catch {
|
|
1008
1005
|
// Keep returning the safe missing-auth snapshot when interactive login is cancelled or fails.
|
|
@@ -1241,6 +1238,99 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1241
1238
|
});
|
|
1242
1239
|
return withWizardArtifactEnvelope(result, artifactKind);
|
|
1243
1240
|
};
|
|
1241
|
+
const executeEditorCreateOrUpdateSkillMarkdown = async ({
|
|
1242
|
+
markdownContent,
|
|
1243
|
+
context,
|
|
1244
|
+
source,
|
|
1245
|
+
requestedSkillSlug
|
|
1246
|
+
}) => {
|
|
1247
|
+
const authState = await resolveStoredAuthState(input.worktree, config);
|
|
1248
|
+
if (!authState || authState.role !== 'EDITOR') {
|
|
1249
|
+
return {
|
|
1250
|
+
output: JSON.stringify({
|
|
1251
|
+
pluginId: PLUGIN_ID,
|
|
1252
|
+
status: 'forbidden',
|
|
1253
|
+
skillSlug: requestedSkillSlug ?? null,
|
|
1254
|
+
source,
|
|
1255
|
+
message: 'This tool requires EDITOR role. Your current session does not have the required editor permission.'
|
|
1256
|
+
}, null, 2),
|
|
1257
|
+
metadata: {
|
|
1258
|
+
status: 'forbidden',
|
|
1259
|
+
role: authState?.role ?? 'none'
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
if (!markdownContent.trim()) {
|
|
1264
|
+
throw new Error('Editor skill create/update requires non-empty markdownContent.');
|
|
1265
|
+
}
|
|
1266
|
+
const requestedDirectory = normalizeDirectoryArg(context.directory, undefined);
|
|
1267
|
+
const directoryPath = normalizeRepositoryPath(workspacePath, requestedDirectory);
|
|
1268
|
+
lastInteractiveDirectoryPath = directoryPath;
|
|
1269
|
+
const response = await fetchPublishedSkillsGraphQl({
|
|
1270
|
+
worktree: input.worktree,
|
|
1271
|
+
config,
|
|
1272
|
+
query: CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION,
|
|
1273
|
+
variables: {
|
|
1274
|
+
markdownContent
|
|
1275
|
+
},
|
|
1276
|
+
signal: context.abort
|
|
1277
|
+
});
|
|
1278
|
+
if (!response.ok) {
|
|
1279
|
+
return {
|
|
1280
|
+
output: JSON.stringify({
|
|
1281
|
+
pluginId: PLUGIN_ID,
|
|
1282
|
+
status: 'request_failed',
|
|
1283
|
+
skillSlug: requestedSkillSlug ?? null,
|
|
1284
|
+
source,
|
|
1285
|
+
message: response.result.message
|
|
1286
|
+
}, null, 2),
|
|
1287
|
+
metadata: {
|
|
1288
|
+
status: 'request_failed',
|
|
1289
|
+
skillSlug: requestedSkillSlug ?? '',
|
|
1290
|
+
directoryPath
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
const payload = response.data.admin.createOrUpdateSkillFromMarkdown;
|
|
1295
|
+
await scheduleInteractivePresenceStart();
|
|
1296
|
+
return {
|
|
1297
|
+
output: JSON.stringify({
|
|
1298
|
+
pluginId: PLUGIN_ID,
|
|
1299
|
+
status: payload.success ? 'created_or_updated' : 'create_or_update_failed',
|
|
1300
|
+
source,
|
|
1301
|
+
skillSlug: payload.skillSlug,
|
|
1302
|
+
skillVersionId: payload.skillVersionId,
|
|
1303
|
+
artifactSlug: payload.artifactSlug,
|
|
1304
|
+
artifactVersionId: payload.artifactVersionId,
|
|
1305
|
+
requestedDirectoryPath: directoryPath,
|
|
1306
|
+
errors: payload.errors,
|
|
1307
|
+
message: source === 'direct_markdown' ? 'Skill markdown was sent directly to the backend; no local seed file was required.' : 'Local seed SKILL.md was published through the backend skill markdown mutation.'
|
|
1308
|
+
}, null, 2),
|
|
1309
|
+
metadata: {
|
|
1310
|
+
status: payload.success ? 'created_or_updated' : 'create_or_update_failed',
|
|
1311
|
+
skillSlug: payload.skillSlug,
|
|
1312
|
+
skillVersionId: payload.skillVersionId ?? '',
|
|
1313
|
+
source,
|
|
1314
|
+
directoryPath
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
const executeEditorCreateOrUpdateSkillTool = async ({
|
|
1319
|
+
args,
|
|
1320
|
+
context
|
|
1321
|
+
}) => {
|
|
1322
|
+
const requestedDirectory = normalizeDirectoryArg(context.directory, args.directory);
|
|
1323
|
+
const directoryPath = normalizeRepositoryPath(workspacePath, requestedDirectory);
|
|
1324
|
+
lastInteractiveDirectoryPath = directoryPath;
|
|
1325
|
+
return executeEditorCreateOrUpdateSkillMarkdown({
|
|
1326
|
+
markdownContent: args.markdownContent,
|
|
1327
|
+
context: {
|
|
1328
|
+
...context,
|
|
1329
|
+
directory: requestedDirectory
|
|
1330
|
+
},
|
|
1331
|
+
source: 'direct_markdown'
|
|
1332
|
+
});
|
|
1333
|
+
};
|
|
1244
1334
|
const executeEditorPublishSkillTool = async ({
|
|
1245
1335
|
args,
|
|
1246
1336
|
context
|
|
@@ -1256,6 +1346,7 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1256
1346
|
pluginId: PLUGIN_ID,
|
|
1257
1347
|
status: 'forbidden',
|
|
1258
1348
|
skillSlug: requestedSkillSlug,
|
|
1349
|
+
source: 'seed_file',
|
|
1259
1350
|
message: 'This tool requires EDITOR role. Your current session does not have the required editor permission.'
|
|
1260
1351
|
}, null, 2),
|
|
1261
1352
|
metadata: {
|
|
@@ -1293,47 +1384,15 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1293
1384
|
}
|
|
1294
1385
|
};
|
|
1295
1386
|
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
markdownContent
|
|
1387
|
+
return executeEditorCreateOrUpdateSkillMarkdown({
|
|
1388
|
+
markdownContent,
|
|
1389
|
+
context: {
|
|
1390
|
+
...context,
|
|
1391
|
+
directory: requestedDirectory
|
|
1302
1392
|
},
|
|
1303
|
-
|
|
1393
|
+
source: 'seed_file',
|
|
1394
|
+
requestedSkillSlug
|
|
1304
1395
|
});
|
|
1305
|
-
if (!response.ok) {
|
|
1306
|
-
return {
|
|
1307
|
-
output: JSON.stringify({
|
|
1308
|
-
pluginId: PLUGIN_ID,
|
|
1309
|
-
status: 'request_failed',
|
|
1310
|
-
skillSlug: requestedSkillSlug,
|
|
1311
|
-
message: response.result.message
|
|
1312
|
-
}, null, 2),
|
|
1313
|
-
metadata: {
|
|
1314
|
-
status: 'request_failed',
|
|
1315
|
-
skillSlug: requestedSkillSlug,
|
|
1316
|
-
directoryPath
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
const payload = response.data.createOrUpdateSkillFromMarkdown;
|
|
1321
|
-
await scheduleInteractivePresenceStart();
|
|
1322
|
-
return {
|
|
1323
|
-
output: JSON.stringify({
|
|
1324
|
-
pluginId: PLUGIN_ID,
|
|
1325
|
-
status: payload.success ? 'published' : 'publish_failed',
|
|
1326
|
-
skillSlug: payload.skillSlug,
|
|
1327
|
-
skillVersionId: payload.skillVersionId,
|
|
1328
|
-
errors: payload.errors
|
|
1329
|
-
}, null, 2),
|
|
1330
|
-
metadata: {
|
|
1331
|
-
status: payload.success ? 'published' : 'publish_failed',
|
|
1332
|
-
skillSlug: payload.skillSlug,
|
|
1333
|
-
skillVersionId: payload.skillVersionId ?? '',
|
|
1334
|
-
directoryPath
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
1396
|
};
|
|
1338
1397
|
const executeWizardArtifactImportTool = async ({
|
|
1339
1398
|
args,
|
|
@@ -1450,8 +1509,6 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1450
1509
|
}
|
|
1451
1510
|
};
|
|
1452
1511
|
};
|
|
1453
|
-
const role = initialAuthState?.role ?? null;
|
|
1454
|
-
const isEditor = role === 'EDITOR';
|
|
1455
1512
|
const {
|
|
1456
1513
|
sharedTools,
|
|
1457
1514
|
editorOnlyTools
|
|
@@ -1480,6 +1537,10 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1480
1537
|
args,
|
|
1481
1538
|
context
|
|
1482
1539
|
}),
|
|
1540
|
+
createOrUpdateEditorSkill: (args, context) => executeEditorCreateOrUpdateSkillTool({
|
|
1541
|
+
args,
|
|
1542
|
+
context
|
|
1543
|
+
}),
|
|
1483
1544
|
publishEditorSkill: (args, context) => executeEditorPublishSkillTool({
|
|
1484
1545
|
args,
|
|
1485
1546
|
context
|
|
@@ -1490,10 +1551,10 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1490
1551
|
})
|
|
1491
1552
|
});
|
|
1492
1553
|
return {
|
|
1493
|
-
tool: {
|
|
1554
|
+
tool: registeredTools.includes('opencode_wizard_editor_create_or_update_skill') ? {
|
|
1494
1555
|
...sharedTools,
|
|
1495
|
-
...
|
|
1496
|
-
},
|
|
1556
|
+
...editorOnlyTools
|
|
1557
|
+
} : sharedTools,
|
|
1497
1558
|
'experimental.chat.system.transform': async (_hookInput, output) => {
|
|
1498
1559
|
let publishedSkillsResult = await loadPublishedSkillCatalog({
|
|
1499
1560
|
directory: input.directory,
|