@aexol/opencode-wizard 0.3.8 → 0.3.9
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/server/runtime.js +108 -44
- package/dist/server/runtime.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 +44 -2
- package/dist/tui/components/status-content.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 +6 -0
- package/dist/tui/skill-helpers.js +46 -0
- package/dist/tui/skill-helpers.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 skill-management panel: it shows auth/catalog status, labelled active/available/ignored skills, shared command hints, and EDITOR-only authoring hints 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 auth/catalog state and a compact labelled skill list derived 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
|
|
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 surfaces command/menu hints for those management flows but 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,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,GAA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O,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,CAC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C,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":[]}
|
package/dist/server/runtime.js
CHANGED
|
@@ -1241,6 +1241,99 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1241
1241
|
});
|
|
1242
1242
|
return withWizardArtifactEnvelope(result, artifactKind);
|
|
1243
1243
|
};
|
|
1244
|
+
const executeEditorCreateOrUpdateSkillMarkdown = async ({
|
|
1245
|
+
markdownContent,
|
|
1246
|
+
context,
|
|
1247
|
+
source,
|
|
1248
|
+
requestedSkillSlug
|
|
1249
|
+
}) => {
|
|
1250
|
+
const authState = await resolveStoredAuthState(input.worktree, config);
|
|
1251
|
+
if (!authState || authState.role !== 'EDITOR') {
|
|
1252
|
+
return {
|
|
1253
|
+
output: JSON.stringify({
|
|
1254
|
+
pluginId: PLUGIN_ID,
|
|
1255
|
+
status: 'forbidden',
|
|
1256
|
+
skillSlug: requestedSkillSlug ?? null,
|
|
1257
|
+
source,
|
|
1258
|
+
message: 'This tool requires EDITOR role. Your current session does not have the required editor permission.'
|
|
1259
|
+
}, null, 2),
|
|
1260
|
+
metadata: {
|
|
1261
|
+
status: 'forbidden',
|
|
1262
|
+
role: authState?.role ?? 'none'
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
if (!markdownContent.trim()) {
|
|
1267
|
+
throw new Error('Editor skill create/update requires non-empty markdownContent.');
|
|
1268
|
+
}
|
|
1269
|
+
const requestedDirectory = normalizeDirectoryArg(context.directory, undefined);
|
|
1270
|
+
const directoryPath = normalizeRepositoryPath(workspacePath, requestedDirectory);
|
|
1271
|
+
lastInteractiveDirectoryPath = directoryPath;
|
|
1272
|
+
const response = await fetchPublishedSkillsGraphQl({
|
|
1273
|
+
worktree: input.worktree,
|
|
1274
|
+
config,
|
|
1275
|
+
query: CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION,
|
|
1276
|
+
variables: {
|
|
1277
|
+
markdownContent
|
|
1278
|
+
},
|
|
1279
|
+
signal: context.abort
|
|
1280
|
+
});
|
|
1281
|
+
if (!response.ok) {
|
|
1282
|
+
return {
|
|
1283
|
+
output: JSON.stringify({
|
|
1284
|
+
pluginId: PLUGIN_ID,
|
|
1285
|
+
status: 'request_failed',
|
|
1286
|
+
skillSlug: requestedSkillSlug ?? null,
|
|
1287
|
+
source,
|
|
1288
|
+
message: response.result.message
|
|
1289
|
+
}, null, 2),
|
|
1290
|
+
metadata: {
|
|
1291
|
+
status: 'request_failed',
|
|
1292
|
+
skillSlug: requestedSkillSlug ?? '',
|
|
1293
|
+
directoryPath
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
const payload = response.data.admin.createOrUpdateSkillFromMarkdown;
|
|
1298
|
+
await scheduleInteractivePresenceStart();
|
|
1299
|
+
return {
|
|
1300
|
+
output: JSON.stringify({
|
|
1301
|
+
pluginId: PLUGIN_ID,
|
|
1302
|
+
status: payload.success ? 'created_or_updated' : 'create_or_update_failed',
|
|
1303
|
+
source,
|
|
1304
|
+
skillSlug: payload.skillSlug,
|
|
1305
|
+
skillVersionId: payload.skillVersionId,
|
|
1306
|
+
artifactSlug: payload.artifactSlug,
|
|
1307
|
+
artifactVersionId: payload.artifactVersionId,
|
|
1308
|
+
requestedDirectoryPath: directoryPath,
|
|
1309
|
+
errors: payload.errors,
|
|
1310
|
+
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.'
|
|
1311
|
+
}, null, 2),
|
|
1312
|
+
metadata: {
|
|
1313
|
+
status: payload.success ? 'created_or_updated' : 'create_or_update_failed',
|
|
1314
|
+
skillSlug: payload.skillSlug,
|
|
1315
|
+
skillVersionId: payload.skillVersionId ?? '',
|
|
1316
|
+
source,
|
|
1317
|
+
directoryPath
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
};
|
|
1321
|
+
const executeEditorCreateOrUpdateSkillTool = async ({
|
|
1322
|
+
args,
|
|
1323
|
+
context
|
|
1324
|
+
}) => {
|
|
1325
|
+
const requestedDirectory = normalizeDirectoryArg(context.directory, args.directory);
|
|
1326
|
+
const directoryPath = normalizeRepositoryPath(workspacePath, requestedDirectory);
|
|
1327
|
+
lastInteractiveDirectoryPath = directoryPath;
|
|
1328
|
+
return executeEditorCreateOrUpdateSkillMarkdown({
|
|
1329
|
+
markdownContent: args.markdownContent,
|
|
1330
|
+
context: {
|
|
1331
|
+
...context,
|
|
1332
|
+
directory: requestedDirectory
|
|
1333
|
+
},
|
|
1334
|
+
source: 'direct_markdown'
|
|
1335
|
+
});
|
|
1336
|
+
};
|
|
1244
1337
|
const executeEditorPublishSkillTool = async ({
|
|
1245
1338
|
args,
|
|
1246
1339
|
context
|
|
@@ -1256,6 +1349,7 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1256
1349
|
pluginId: PLUGIN_ID,
|
|
1257
1350
|
status: 'forbidden',
|
|
1258
1351
|
skillSlug: requestedSkillSlug,
|
|
1352
|
+
source: 'seed_file',
|
|
1259
1353
|
message: 'This tool requires EDITOR role. Your current session does not have the required editor permission.'
|
|
1260
1354
|
}, null, 2),
|
|
1261
1355
|
metadata: {
|
|
@@ -1293,47 +1387,15 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1293
1387
|
}
|
|
1294
1388
|
};
|
|
1295
1389
|
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
markdownContent
|
|
1390
|
+
return executeEditorCreateOrUpdateSkillMarkdown({
|
|
1391
|
+
markdownContent,
|
|
1392
|
+
context: {
|
|
1393
|
+
...context,
|
|
1394
|
+
directory: requestedDirectory
|
|
1302
1395
|
},
|
|
1303
|
-
|
|
1396
|
+
source: 'seed_file',
|
|
1397
|
+
requestedSkillSlug
|
|
1304
1398
|
});
|
|
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
1399
|
};
|
|
1338
1400
|
const executeWizardArtifactImportTool = async ({
|
|
1339
1401
|
args,
|
|
@@ -1450,8 +1512,6 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1450
1512
|
}
|
|
1451
1513
|
};
|
|
1452
1514
|
};
|
|
1453
|
-
const role = initialAuthState?.role ?? null;
|
|
1454
|
-
const isEditor = role === 'EDITOR';
|
|
1455
1515
|
const {
|
|
1456
1516
|
sharedTools,
|
|
1457
1517
|
editorOnlyTools
|
|
@@ -1480,6 +1540,10 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1480
1540
|
args,
|
|
1481
1541
|
context
|
|
1482
1542
|
}),
|
|
1543
|
+
createOrUpdateEditorSkill: (args, context) => executeEditorCreateOrUpdateSkillTool({
|
|
1544
|
+
args,
|
|
1545
|
+
context
|
|
1546
|
+
}),
|
|
1483
1547
|
publishEditorSkill: (args, context) => executeEditorPublishSkillTool({
|
|
1484
1548
|
args,
|
|
1485
1549
|
context
|
|
@@ -1490,10 +1554,10 @@ export const OpencodeWizardSkillsPlugin = async input => {
|
|
|
1490
1554
|
})
|
|
1491
1555
|
});
|
|
1492
1556
|
return {
|
|
1493
|
-
tool: {
|
|
1557
|
+
tool: initialAuthState?.role === 'EDITOR' ? {
|
|
1494
1558
|
...sharedTools,
|
|
1495
|
-
...
|
|
1496
|
-
},
|
|
1559
|
+
...editorOnlyTools
|
|
1560
|
+
} : sharedTools,
|
|
1497
1561
|
'experimental.chat.system.transform': async (_hookInput, output) => {
|
|
1498
1562
|
let publishedSkillsResult = await loadPublishedSkillCatalog({
|
|
1499
1563
|
directory: input.directory,
|