@aexol/opencode-wizard 0.3.3 → 0.3.5
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 +9 -7
- package/dist/graphql-operations.d.ts +7 -0
- package/dist/graphql-operations.js +230 -0
- package/dist/graphql-operations.js.map +1 -0
- package/dist/plugin-tools.d.ts +90 -0
- package/dist/plugin-tools.js +93 -0
- package/dist/plugin-tools.js.map +1 -0
- package/dist/published-skills-system-note.d.ts +9 -0
- package/dist/published-skills-system-note.js +30 -0
- package/dist/published-skills-system-note.js.map +1 -0
- package/dist/published-skills-terminology.d.ts +21 -0
- package/dist/published-skills-terminology.js +38 -0
- package/dist/published-skills-terminology.js.map +1 -0
- package/dist/published-skills-transform.d.ts +258 -0
- package/dist/published-skills-transform.js +310 -0
- package/dist/published-skills-transform.js.map +1 -0
- package/dist/server/auth-bootstrap.d.ts +7 -0
- package/dist/server/auth-bootstrap.js +89 -0
- package/dist/server/auth-bootstrap.js.map +1 -0
- package/dist/server/auth-flow.d.ts +10 -0
- package/dist/server/auth-flow.js +215 -0
- package/dist/server/auth-flow.js.map +1 -0
- package/dist/server/auth-store.d.ts +19 -0
- package/dist/server/auth-store.js +177 -0
- package/dist/server/auth-store.js.map +1 -0
- package/dist/server/client.d.ts +80 -0
- package/dist/server/client.js +324 -0
- package/dist/server/client.js.map +1 -0
- package/dist/server/config.d.ts +2 -0
- package/dist/server/config.js +82 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/constants.d.ts +26 -0
- package/dist/server/constants.js +32 -0
- package/dist/server/constants.js.map +1 -0
- package/dist/server/path-utils.d.ts +2 -0
- package/dist/server/path-utils.js +8 -0
- package/dist/server/path-utils.js.map +1 -0
- package/dist/server/preferences.d.ts +22 -0
- package/dist/server/preferences.js +121 -0
- package/dist/server/preferences.js.map +1 -0
- package/dist/server/presence.d.ts +14 -0
- package/dist/server/presence.js +68 -0
- package/dist/server/presence.js.map +1 -0
- package/dist/server/runtime.d.ts +13 -0
- package/dist/server/runtime.js +1315 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/status.d.ts +27 -0
- package/dist/server/status.js +224 -0
- package/dist/server/status.js.map +1 -0
- package/dist/server/types.d.ts +396 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/workspace.d.ts +15 -0
- package/dist/server/workspace.js +126 -0
- package/dist/server/workspace.js.map +1 -0
- package/dist/server.d.ts +4 -309
- package/dist/server.js +4 -2611
- package/dist/server.js.map +1 -1
- package/dist/smoke-published-skills.js +11 -9
- package/dist/smoke-published-skills.js.map +1 -1
- package/dist/tui/components/common.d.ts +15 -0
- package/dist/tui/components/common.js +81 -0
- package/dist/tui/components/common.js.map +1 -0
- package/dist/tui/components/preference-action-notice-row.d.ts +5 -0
- package/dist/tui/components/preference-action-notice-row.js +17 -0
- package/dist/tui/components/preference-action-notice-row.js.map +1 -0
- package/dist/tui/components/skill-catalog-row.d.ts +8 -0
- package/dist/tui/components/skill-catalog-row.js +125 -0
- package/dist/tui/components/skill-catalog-row.js.map +1 -0
- package/dist/tui/components/status-content.d.ts +14 -0
- package/dist/tui/components/status-content.js +131 -0
- package/dist/tui/components/status-content.js.map +1 -0
- package/dist/tui/components/wizard-skills-dialog-content.d.ts +9 -0
- package/dist/tui/components/wizard-skills-dialog-content.js +229 -0
- package/dist/tui/components/wizard-skills-dialog-content.js.map +1 -0
- package/dist/tui/components/wizard-skills-dialog.d.ts +7 -0
- package/dist/tui/components/wizard-skills-dialog.js +156 -0
- package/dist/tui/components/wizard-skills-dialog.js.map +1 -0
- package/dist/tui/constants.d.ts +8 -0
- package/dist/tui/constants.js +9 -0
- package/dist/tui/constants.js.map +1 -0
- package/dist/tui/formatting.d.ts +8 -0
- package/dist/tui/formatting.js +45 -0
- package/dist/tui/formatting.js.map +1 -0
- package/dist/tui/plugin.d.ts +2 -0
- package/dist/tui/plugin.js +26 -0
- package/dist/tui/plugin.js.map +1 -0
- package/dist/tui/rendering.d.ts +2 -0
- package/dist/tui/rendering.js +8 -0
- package/dist/tui/rendering.js.map +1 -0
- package/dist/tui/skill-helpers.d.ts +13 -0
- package/dist/tui/skill-helpers.js +50 -0
- package/dist/tui/skill-helpers.js.map +1 -0
- package/dist/tui/slots.d.ts +2 -0
- package/dist/tui/slots.js +56 -0
- package/dist/tui/slots.js.map +1 -0
- package/dist/tui/status.d.ts +2 -0
- package/dist/tui/status.js +21 -0
- package/dist/tui/status.js.map +1 -0
- package/dist/tui/types.d.ts +75 -0
- package/dist/tui/types.js +2 -0
- package/dist/tui/types.js.map +1 -0
- package/dist/tui.d.ts +1 -44
- package/dist/tui.js +2 -870
- package/dist/tui.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 shows loaded plugins, current paths, backend/auth status without tokens,
|
|
12
|
+
- the TUI shows loaded plugins, current paths, backend/auth status without tokens, always-exposed shared tools, `skills.urls` guidance, the backend-published wizard global / wizard project / wizard user delivery model, policy labels, and catalog counts/names when passive fetch succeeds
|
|
13
13
|
|
|
14
14
|
## Local development
|
|
15
15
|
|
|
@@ -42,21 +42,23 @@ For repo-local development, continue using the local path-based config already d
|
|
|
42
42
|
|
|
43
43
|
OpenCode's native `skills.urls` support downloads public/static skill registries from base URLs that expose an `index.json` and file paths under that base URL. Current support has no plugin session/header integration, so it must not be pointed at private opencode-wizard skill delivery.
|
|
44
44
|
|
|
45
|
-
Use `skills.urls` only for public registries that are intentionally cacheable by OpenCode. Private workspace-scoped wizard
|
|
45
|
+
Use `skills.urls` only for public registries that are intentionally cacheable by OpenCode. Private workspace-scoped wizard artifacts remain authenticated and directory-scoped through `opencode_wizard_artifact_fetch` or compatibility `opencode_wizard_published_skills_fetch`; same-named native/local seed skill bodies are not authoritative for wizard-listed skills.
|
|
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_published_skills_fetch`, explicit `opencode_wizard_status`, TUI status, and chat/system-context startup may start the browser Entra PKCE flow and exchange the callback for a fresh backend-issued plugin session.
|
|
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`, TUI status, and chat/system-context startup may start the browser Entra PKCE flow and exchange the callback for a fresh backend-issued plugin session.
|
|
50
50
|
|
|
51
|
-
|
|
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` stays 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
|
+
|
|
55
|
+
No-arg discovery returns published skill summaries, assignment counts split into `global`, `project`, `user`, and `other`, policy metadata, and no markdown bodies. Canonical `opencode_wizard_artifact_fetch` with `artifactKind: SKILL` and compatibility `skill`/`skills` calls fetch one or more full skill body/detail payloads by slug, artifact name, or skill name. `DESIGN_DOC` uses generic wizard artifact persistence and returns metadata-only catalogs plus explicit `DESIGN.md` body/files detail fetches for effective assignments. Use the fetched `markdownDocument`/`markdownBody` as the authoritative wizard skill body before applying a wizard-listed skill.
|
|
54
56
|
|
|
55
57
|
Workspace delivery still follows the backend contract: the plugin sends `workspaceSlug` when it has one, otherwise falls back to `repositoryUrl`. The plugin now prefers configured or learned workspace slug mappings over a repo-basename fallback, and learns durable slug-to-repo mappings from successful backend catalog responses so worktrees and nontrivial repo roots stay aligned.
|
|
56
58
|
|
|
57
|
-
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.
|
|
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/*`.
|
|
58
60
|
|
|
59
|
-
Use `opencode_wizard_published_skill_preference_set` for non-TUI preference actions (`install`, `uninstall`, `ignore`, `unignore`) against the same server-backed preference API used by the TUI overlay.
|
|
61
|
+
Use `opencode_wizard_artifact_preference_set` or compatibility `opencode_wizard_published_skill_preference_set` for non-TUI preference actions (`install`, `uninstall`, `ignore`, `unignore`) against the same server-backed preference API used by the TUI overlay.
|
|
60
62
|
|
|
61
63
|
`GLOBAL_CONTEXT` skills are active context skills and are not meant to be installed per project. `PROJECT_INSTALLABLE` skills are gallery/installable skills that may be attached globally or to a workspace/path through assignment records; those assignments remain the source of truth for what is active in a catalog response.
|
|
62
64
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare 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 \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \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\n }\n catalogSkills {\n \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 }\n userPreferences {\n scopeKey\n userKey\n ignoredSkills {\n \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \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\n }\n }\n }\n }\n";
|
|
2
|
+
export declare const SET_PUBLISHED_SKILL_PREFERENCE_MUTATION = "\n mutation SetPublishedSkillPreference($input: SetPublishedSkillPreferenceInput!) {\n setPublishedSkillPreference(input: $input) {\n scopeKey\n userKey\n ignoredSkills {\n \n assignmentSource\n assignmentType\n scopePath\n includeChildren\n \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\n }\n }\n }\n";
|
|
3
|
+
export declare 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";
|
|
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 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 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 canonicalFilePath\n publishedAt\n fileCount\n }\n\n\n }\n }\n unsupportedReason\n message\n }\n }\n";
|
|
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 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
|
+
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 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 success\n skillSlug\n skillVersionId\n errors\n }\n }\n";
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
const PUBLISHED_SKILL_CORE_FIELDS = `
|
|
2
|
+
skill {
|
|
3
|
+
id
|
|
4
|
+
slug
|
|
5
|
+
name
|
|
6
|
+
summary
|
|
7
|
+
whenToUse
|
|
8
|
+
status
|
|
9
|
+
installPolicy
|
|
10
|
+
tags {
|
|
11
|
+
id
|
|
12
|
+
slug
|
|
13
|
+
label
|
|
14
|
+
description
|
|
15
|
+
facet {
|
|
16
|
+
id
|
|
17
|
+
slug
|
|
18
|
+
label
|
|
19
|
+
description
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
skillVersion {
|
|
24
|
+
id
|
|
25
|
+
version
|
|
26
|
+
title
|
|
27
|
+
summary
|
|
28
|
+
status
|
|
29
|
+
}
|
|
30
|
+
publishedArtifact {
|
|
31
|
+
id
|
|
32
|
+
frontmatterName
|
|
33
|
+
frontmatterDescription
|
|
34
|
+
checksum
|
|
35
|
+
publishedAt
|
|
36
|
+
fileCount
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const PUBLISHED_SKILL_ASSIGNMENT_FIELDS = `
|
|
40
|
+
assignmentSource
|
|
41
|
+
assignmentType
|
|
42
|
+
scopePath
|
|
43
|
+
includeChildren
|
|
44
|
+
${PUBLISHED_SKILL_CORE_FIELDS}
|
|
45
|
+
`;
|
|
46
|
+
export const PUBLISHED_SKILLS_CATALOG_QUERY = `
|
|
47
|
+
query PluginPublishedSkills($input: PublishedSkillsDeliveryInput!) {
|
|
48
|
+
pluginPublishedSkills(input: $input) {
|
|
49
|
+
workspace {
|
|
50
|
+
id
|
|
51
|
+
slug
|
|
52
|
+
name
|
|
53
|
+
repositoryUrl
|
|
54
|
+
defaultBranch
|
|
55
|
+
status
|
|
56
|
+
}
|
|
57
|
+
directoryPath
|
|
58
|
+
skills {
|
|
59
|
+
${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}
|
|
60
|
+
}
|
|
61
|
+
catalogSkills {
|
|
62
|
+
${PUBLISHED_SKILL_CORE_FIELDS}
|
|
63
|
+
}
|
|
64
|
+
userPreferences {
|
|
65
|
+
scopeKey
|
|
66
|
+
userKey
|
|
67
|
+
ignoredSkills {
|
|
68
|
+
${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
export const SET_PUBLISHED_SKILL_PREFERENCE_MUTATION = `
|
|
75
|
+
mutation SetPublishedSkillPreference($input: SetPublishedSkillPreferenceInput!) {
|
|
76
|
+
setPublishedSkillPreference(input: $input) {
|
|
77
|
+
scopeKey
|
|
78
|
+
userKey
|
|
79
|
+
ignoredSkills {
|
|
80
|
+
${PUBLISHED_SKILL_ASSIGNMENT_FIELDS}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
export const PUBLISHED_SKILL_DETAIL_QUERY = `
|
|
86
|
+
query PluginPublishedSkillVersionArtifact($input: PublishedSkillArtifactDetailInput!) {
|
|
87
|
+
pluginPublishedSkillVersionArtifact(input: $input) {
|
|
88
|
+
id
|
|
89
|
+
frontmatterName
|
|
90
|
+
frontmatterDescription
|
|
91
|
+
markdownBody
|
|
92
|
+
renderedContent
|
|
93
|
+
checksum
|
|
94
|
+
publishedAt
|
|
95
|
+
fileCount
|
|
96
|
+
files {
|
|
97
|
+
id
|
|
98
|
+
relativePath
|
|
99
|
+
contentType
|
|
100
|
+
content
|
|
101
|
+
checksum
|
|
102
|
+
size
|
|
103
|
+
sortOrder
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
const WIZARD_ARTIFACT_CORE_FIELDS = `
|
|
109
|
+
artifact {
|
|
110
|
+
id
|
|
111
|
+
kind
|
|
112
|
+
slug
|
|
113
|
+
name
|
|
114
|
+
summary
|
|
115
|
+
whenToUse
|
|
116
|
+
status
|
|
117
|
+
installPolicy
|
|
118
|
+
}
|
|
119
|
+
artifactVersion {
|
|
120
|
+
id
|
|
121
|
+
version
|
|
122
|
+
title
|
|
123
|
+
summary
|
|
124
|
+
status
|
|
125
|
+
frontmatterName
|
|
126
|
+
frontmatterDescription
|
|
127
|
+
checksum
|
|
128
|
+
canonicalFilePath
|
|
129
|
+
publishedAt
|
|
130
|
+
fileCount
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
const WIZARD_ARTIFACT_ASSIGNMENT_FIELDS = `
|
|
134
|
+
assignmentSource
|
|
135
|
+
assignmentType
|
|
136
|
+
scopePath
|
|
137
|
+
includeChildren
|
|
138
|
+
${WIZARD_ARTIFACT_CORE_FIELDS}
|
|
139
|
+
`;
|
|
140
|
+
export const WIZARD_ARTIFACTS_CATALOG_QUERY = `
|
|
141
|
+
query PluginWizardArtifacts($input: WizardArtifactsDeliveryInput!) {
|
|
142
|
+
pluginWizardArtifacts(input: $input) {
|
|
143
|
+
artifactKind
|
|
144
|
+
workspace {
|
|
145
|
+
id
|
|
146
|
+
slug
|
|
147
|
+
name
|
|
148
|
+
repositoryUrl
|
|
149
|
+
defaultBranch
|
|
150
|
+
status
|
|
151
|
+
}
|
|
152
|
+
directoryPath
|
|
153
|
+
artifacts {
|
|
154
|
+
${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}
|
|
155
|
+
}
|
|
156
|
+
catalogArtifacts {
|
|
157
|
+
${WIZARD_ARTIFACT_CORE_FIELDS}
|
|
158
|
+
}
|
|
159
|
+
artifactPreferences {
|
|
160
|
+
scopeKey
|
|
161
|
+
userKey
|
|
162
|
+
ignoredArtifacts {
|
|
163
|
+
${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
unsupportedReason
|
|
167
|
+
message
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
export const WIZARD_ARTIFACT_DETAIL_QUERY = `
|
|
172
|
+
query PluginWizardArtifactVersion($input: WizardArtifactDetailInput!) {
|
|
173
|
+
pluginWizardArtifactVersion(input: $input) {
|
|
174
|
+
id
|
|
175
|
+
artifact {
|
|
176
|
+
id
|
|
177
|
+
kind
|
|
178
|
+
slug
|
|
179
|
+
name
|
|
180
|
+
summary
|
|
181
|
+
whenToUse
|
|
182
|
+
status
|
|
183
|
+
installPolicy
|
|
184
|
+
}
|
|
185
|
+
version
|
|
186
|
+
title
|
|
187
|
+
summary
|
|
188
|
+
status
|
|
189
|
+
frontmatterName
|
|
190
|
+
frontmatterDescription
|
|
191
|
+
markdownBody
|
|
192
|
+
renderedContent
|
|
193
|
+
checksum
|
|
194
|
+
canonicalFilePath
|
|
195
|
+
publishedAt
|
|
196
|
+
fileCount
|
|
197
|
+
files {
|
|
198
|
+
id
|
|
199
|
+
relativePath
|
|
200
|
+
contentType
|
|
201
|
+
content
|
|
202
|
+
checksum
|
|
203
|
+
size
|
|
204
|
+
sortOrder
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
209
|
+
export const SET_WIZARD_ARTIFACT_PREFERENCE_MUTATION = `
|
|
210
|
+
mutation SetWizardArtifactPreference($input: SetWizardArtifactPreferenceInput!) {
|
|
211
|
+
setWizardArtifactPreference(input: $input) {
|
|
212
|
+
scopeKey
|
|
213
|
+
userKey
|
|
214
|
+
ignoredArtifacts {
|
|
215
|
+
${WIZARD_ARTIFACT_ASSIGNMENT_FIELDS}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
220
|
+
export const CREATE_OR_UPDATE_SKILL_FROM_MARKDOWN_MUTATION = `
|
|
221
|
+
mutation CreateOrUpdateSkillFromMarkdown($markdownContent: String!) {
|
|
222
|
+
createOrUpdateSkillFromMarkdown(markdownContent: $markdownContent) {
|
|
223
|
+
success
|
|
224
|
+
skillSlug
|
|
225
|
+
skillVersionId
|
|
226
|
+
errors
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`;
|
|
230
|
+
//# sourceMappingURL=graphql-operations.js.map
|
|
@@ -0,0 +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"],"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 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 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 success\n skillSlug\n skillVersionId\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,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,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,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export type PublishedSkillFetchArgs = {
|
|
2
|
+
skill?: string;
|
|
3
|
+
skills?: string;
|
|
4
|
+
directory?: string;
|
|
5
|
+
refresh?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';
|
|
8
|
+
export type WizardArtifactCatalogFetchArgs = {
|
|
9
|
+
artifactKind?: string;
|
|
10
|
+
directory?: string;
|
|
11
|
+
refresh?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type WizardArtifactFetchArgs = {
|
|
14
|
+
artifactKind?: string;
|
|
15
|
+
artifact?: string;
|
|
16
|
+
artifacts?: string;
|
|
17
|
+
directory?: string;
|
|
18
|
+
refresh?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type PluginStatusArgs = {
|
|
21
|
+
directory?: string;
|
|
22
|
+
};
|
|
23
|
+
export type PublishedSkillPreferenceArgs = {
|
|
24
|
+
skill: string;
|
|
25
|
+
action: string;
|
|
26
|
+
preferenceScope?: string;
|
|
27
|
+
directory?: string;
|
|
28
|
+
};
|
|
29
|
+
export type WizardArtifactPreferenceArgs = {
|
|
30
|
+
artifactKind?: string;
|
|
31
|
+
artifact: string;
|
|
32
|
+
action: string;
|
|
33
|
+
preferenceScope?: string;
|
|
34
|
+
directory?: string;
|
|
35
|
+
};
|
|
36
|
+
export type EditorPublishSkillArgs = {
|
|
37
|
+
skillSlug: string;
|
|
38
|
+
directory?: string;
|
|
39
|
+
};
|
|
40
|
+
type ToolSchemaValue<TSelf> = {
|
|
41
|
+
optional: () => TSelf;
|
|
42
|
+
describe: (description: string) => TSelf;
|
|
43
|
+
};
|
|
44
|
+
type ToolSchema = {
|
|
45
|
+
string: () => ToolSchemaValue<ToolSchemaValue<unknown>>;
|
|
46
|
+
boolean: () => ToolSchemaValue<ToolSchemaValue<unknown>>;
|
|
47
|
+
};
|
|
48
|
+
export type ToolExecuteContext = {
|
|
49
|
+
directory: string;
|
|
50
|
+
abort: AbortSignal;
|
|
51
|
+
metadata: (payload: {
|
|
52
|
+
title: string;
|
|
53
|
+
metadata: Record<string, string>;
|
|
54
|
+
}) => void;
|
|
55
|
+
};
|
|
56
|
+
type ToolDefinition<TArgs extends object> = {
|
|
57
|
+
description: string;
|
|
58
|
+
args: {
|
|
59
|
+
[K in keyof TArgs]-?: unknown;
|
|
60
|
+
};
|
|
61
|
+
execute: (args: TArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
62
|
+
};
|
|
63
|
+
export type ToolFactory = (<TArgs extends object>(definition: ToolDefinition<TArgs>) => unknown) & {
|
|
64
|
+
schema: ToolSchema;
|
|
65
|
+
};
|
|
66
|
+
type PublishedSkillToolHandlers = {
|
|
67
|
+
fetchPublishedSkills: (args: PublishedSkillFetchArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
68
|
+
fetchWizardArtifactCatalog: (args: WizardArtifactCatalogFetchArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
69
|
+
fetchWizardArtifacts: (args: WizardArtifactFetchArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
70
|
+
updatePublishedSkillPreference: (args: PublishedSkillPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
71
|
+
updateWizardArtifactPreference: (args: WizardArtifactPreferenceArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
72
|
+
getStatus: (args: PluginStatusArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
73
|
+
publishEditorSkill: (args: EditorPublishSkillArgs, context: ToolExecuteContext) => Promise<unknown>;
|
|
74
|
+
};
|
|
75
|
+
export declare const AVAILABLE_PUBLISHED_SKILL_TOOLS: string[];
|
|
76
|
+
export declare const resolveAvailableTools: (role: string | null | undefined) => string[];
|
|
77
|
+
export declare const createPublishedSkillToolDefinitions: (tool: ToolFactory, handlers: PublishedSkillToolHandlers) => {
|
|
78
|
+
sharedTools: {
|
|
79
|
+
opencode_wizard_catalog_fetch: unknown;
|
|
80
|
+
opencode_wizard_artifact_fetch: unknown;
|
|
81
|
+
opencode_wizard_artifact_preference_set: unknown;
|
|
82
|
+
opencode_wizard_published_skills_fetch: unknown;
|
|
83
|
+
opencode_wizard_published_skill_preference_set: unknown;
|
|
84
|
+
opencode_wizard_status: unknown;
|
|
85
|
+
};
|
|
86
|
+
editorOnlyTools: {
|
|
87
|
+
opencode_wizard_editor_publish_skill: unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
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'];
|
|
2
|
+
const SHARED_PUBLISHED_SKILL_TOOLS = AVAILABLE_PUBLISHED_SKILL_TOOLS.slice(0, 6);
|
|
3
|
+
export const resolveAvailableTools = role => {
|
|
4
|
+
if (role === 'EDITOR') return [...AVAILABLE_PUBLISHED_SKILL_TOOLS];
|
|
5
|
+
return [...SHARED_PUBLISHED_SKILL_TOOLS];
|
|
6
|
+
};
|
|
7
|
+
export const createPublishedSkillToolDefinitions = (tool, handlers) => ({
|
|
8
|
+
sharedTools: {
|
|
9
|
+
opencode_wizard_catalog_fetch: tool({
|
|
10
|
+
description: 'Always-available canonical wizard artifact catalog tool. Supports artifactKind SKILL and DESIGN_DOC; catalogs are metadata-only and bodies/files require explicit artifact fetch.',
|
|
11
|
+
args: {
|
|
12
|
+
artifactKind: tool.schema.string().optional().describe('Wizard artifact kind to catalog: SKILL or DESIGN_DOC; defaults to SKILL'),
|
|
13
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),
|
|
14
|
+
refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request')
|
|
15
|
+
},
|
|
16
|
+
async execute(args, context) {
|
|
17
|
+
return handlers.fetchWizardArtifactCatalog(args, context);
|
|
18
|
+
}
|
|
19
|
+
}),
|
|
20
|
+
opencode_wizard_artifact_fetch: tool({
|
|
21
|
+
description: 'Always-available canonical wizard artifact detail tool. Supports artifactKind SKILL and DESIGN_DOC; fetches explicit backend-authorized bodies/files for effective artifacts.',
|
|
22
|
+
args: {
|
|
23
|
+
artifactKind: tool.schema.string().optional().describe('Wizard artifact kind to fetch: SKILL or DESIGN_DOC; defaults to SKILL'),
|
|
24
|
+
artifact: tool.schema.string().optional().describe('Single artifact identifier; for SKILL this is a skill slug, artifact name, or skill name'),
|
|
25
|
+
artifacts: tool.schema.string().optional().describe('One or more comma-separated or newline-separated artifact identifiers'),
|
|
26
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),
|
|
27
|
+
refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request')
|
|
28
|
+
},
|
|
29
|
+
async execute(args, context) {
|
|
30
|
+
return handlers.fetchWizardArtifacts(args, context);
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
opencode_wizard_artifact_preference_set: tool({
|
|
34
|
+
description: 'Always-available canonical wizard artifact preference tool. Supports SKILL and DESIGN_DOC install/uninstall/ignore/unignore through server-backed artifact preference APIs.',
|
|
35
|
+
args: {
|
|
36
|
+
artifactKind: tool.schema.string().optional().describe('Wizard artifact kind to update: SKILL or DESIGN_DOC; defaults to SKILL'),
|
|
37
|
+
artifact: tool.schema.string().describe('Artifact identifier; for SKILL this is the published skill slug'),
|
|
38
|
+
action: tool.schema.string().describe('Preference action: install, uninstall, ignore, or unignore'),
|
|
39
|
+
preferenceScope: tool.schema.string().optional().describe('Preference scope for the action: project or global; defaults to project'),
|
|
40
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
|
|
41
|
+
},
|
|
42
|
+
async execute(args, context) {
|
|
43
|
+
return handlers.updateWizardArtifactPreference(args, context);
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
opencode_wizard_published_skills_fetch: tool({
|
|
47
|
+
description: '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',
|
|
48
|
+
args: {
|
|
49
|
+
skill: tool.schema.string().optional().describe('Single skill slug, artifact name, or skill name; backward-compatible with comma/newline-delimited lists'),
|
|
50
|
+
skills: tool.schema.string().optional().describe('One or more comma-separated or newline-separated skill slugs, artifact names, or skill names'),
|
|
51
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override'),
|
|
52
|
+
refresh: tool.schema.boolean().optional().describe('Bypass the local plugin cache for this request')
|
|
53
|
+
},
|
|
54
|
+
async execute(args, context) {
|
|
55
|
+
return handlers.fetchPublishedSkills(args, context);
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
opencode_wizard_published_skill_preference_set: tool({
|
|
59
|
+
description: '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',
|
|
60
|
+
args: {
|
|
61
|
+
skill: tool.schema.string().describe('Published skill slug, artifact name, or skill name to update'),
|
|
62
|
+
action: tool.schema.string().describe('Preference action: install, uninstall, ignore, or unignore'),
|
|
63
|
+
preferenceScope: tool.schema.string().optional().describe('Preference scope for the action: project or global; defaults to project'),
|
|
64
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
|
|
65
|
+
},
|
|
66
|
+
async execute(args, context) {
|
|
67
|
+
return handlers.updatePublishedSkillPreference(args, context);
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
opencode_wizard_status: tool({
|
|
71
|
+
description: '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',
|
|
72
|
+
args: {
|
|
73
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
|
|
74
|
+
},
|
|
75
|
+
async execute(args, context) {
|
|
76
|
+
return handlers.getStatus(args, context);
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
editorOnlyTools: {
|
|
81
|
+
opencode_wizard_editor_publish_skill: tool({
|
|
82
|
+
description: 'Read skill markdown files from .opencode/skills/ and publish them to the backend via the createOrUpdateSkillFromMarkdown mutation. Requires EDITOR role.',
|
|
83
|
+
args: {
|
|
84
|
+
skillSlug: tool.schema.string().describe('Skill slug matching a directory under .opencode/skills/'),
|
|
85
|
+
directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
|
|
86
|
+
},
|
|
87
|
+
async execute(args, context) {
|
|
88
|
+
return handlers.publishEditorSkill(args, context);
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=plugin-tools.js.map
|
|
@@ -0,0 +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"],"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\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};\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];\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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Od,QAAQ,CAACmC,kBAAkB,CAAC/B,IAAI,EAAEU,OAAO,CAAC;MACnD;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PublishedSkillsSuccessState } from './published-skills-transform.js';
|
|
2
|
+
export declare const buildPublishedSkillsSystemNote: ({ workspace, directoryPath, catalog, details: _details, }: {
|
|
3
|
+
workspace: {
|
|
4
|
+
slug: string;
|
|
5
|
+
} | null;
|
|
6
|
+
directoryPath: string;
|
|
7
|
+
catalog: PublishedSkillsSuccessState;
|
|
8
|
+
details: unknown[];
|
|
9
|
+
}) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isUserPublishedSkillAssignment } from './published-skills-transform.js';
|
|
2
|
+
import { WIZARD_SCOPE_LABELS } from './published-skills-terminology.js';
|
|
3
|
+
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
|
+
export const buildPublishedSkillsSystemNote = ({
|
|
16
|
+
workspace,
|
|
17
|
+
directoryPath,
|
|
18
|
+
catalog,
|
|
19
|
+
details: _details
|
|
20
|
+
}) => {
|
|
21
|
+
const skillNames = catalog.skills.map(skill => skill.artifactName || skill.skillName || skill.skillSlug);
|
|
22
|
+
const renderedSkillNames = skillNames.length > 0 ? skillNames.slice(0, SYSTEM_NOTE_SKILL_NAME_LIMIT).join(', ') : 'none';
|
|
23
|
+
const remainingCount = Math.max(skillNames.length - SYSTEM_NOTE_SKILL_NAME_LIMIT, 0);
|
|
24
|
+
const renderedCountSuffix = remainingCount > 0 ? ` (+${remainingCount} more)` : '';
|
|
25
|
+
const globalSkills = catalog.skills.filter(skill => skill.contextKind === 'global' && !isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 8).map(buildSkillCatalogLine);
|
|
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(' ');
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=published-skills-system-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isUserPublishedSkillAssignment","WIZARD_SCOPE_LABELS","SYSTEM_NOTE_SKILL_NAME_LIMIT","SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT","truncateText","value","maxLength","normalized","replace","trim","length","slice","Math","max","trimEnd","buildSkillCatalogLine","skill","description","whenToUse","artifactDescription","skillName","skillSlug","scopeLabel","assignmentSource","user","contextKind","project","artifactName","buildPublishedSkillsSystemNote","workspace","directoryPath","catalog","details","_details","skillNames","skills","map","renderedSkillNames","join","remainingCount","renderedCountSuffix","globalSkills","filter","projectSkills","userSkills","slug","runtimeMode","deliveryModel","rootSkillSeedPath","assignmentCounts","global","other","Boolean"],"sources":["../src/published-skills-system-note.ts"],"sourcesContent":["import {\n isUserPublishedSkillAssignment,\n type PublishedSkillsSuccessState,\n} from './published-skills-transform.js';\nimport { WIZARD_SCOPE_LABELS } from './published-skills-terminology.js';\n\nconst SYSTEM_NOTE_SKILL_NAME_LIMIT = 10;\nconst SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT = 140;\n\nconst truncateText = (value: string, maxLength: number): string => {\n const normalized = value.replace(/\\s+/gu, ' ').trim();\n if (normalized.length <= maxLength) return normalized;\n return `${normalized.slice(0, Math.max(maxLength - 1, 0)).trimEnd()}…`;\n};\n\nconst buildSkillCatalogLine = (skill: PublishedSkillsSuccessState['skills'][number]): string => {\n const description = truncateText(\n skill.whenToUse || skill.artifactDescription || skill.skillName || skill.skillSlug,\n SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT,\n );\n const scopeLabel = isUserPublishedSkillAssignment(skill.assignmentSource)\n ? WIZARD_SCOPE_LABELS.user\n : (WIZARD_SCOPE_LABELS[skill.contextKind] || WIZARD_SCOPE_LABELS.project);\n return `- ${skill.artifactName || skill.skillName} (${skill.skillSlug}, ${scopeLabel}): ${description}`;\n};\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 const globalSkills = catalog.skills\n .filter((skill) => skill.contextKind === 'global' && !isUserPublishedSkillAssignment(skill.assignmentSource))\n .slice(0, 8)\n .map(buildSkillCatalogLine);\n const projectSkills = catalog.skills\n .filter((skill) => skill.contextKind === 'project' && !isUserPublishedSkillAssignment(skill.assignmentSource))\n .slice(0, 5)\n .map(buildSkillCatalogLine);\n const userSkills = catalog.skills\n .filter((skill) => isUserPublishedSkillAssignment(skill.assignmentSource))\n .slice(0, 5)\n .map(buildSkillCatalogLine);\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: ${renderedSkillNames}${renderedCountSuffix}.`,\n `Runtime: runtimeMode=${catalog.runtimeMode}; deliveryModel=${catalog.deliveryModel}; rootSkillSeedPath=${catalog.rootSkillSeedPath}.`,\n `Counts: ${catalog.assignmentCounts.global} wizard global, ${catalog.assignmentCounts.project} wizard project, ${catalog.assignmentCounts.user} wizard user, ${catalog.assignmentCounts.other} other.`,\n '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.',\n '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.',\n '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.',\n '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.',\n '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.',\n globalSkills.length > 0 ? `Wizard global skills:\\n${globalSkills.join('\\n')}` : 'Wizard global skills: none.',\n projectSkills.length > 0 ? `Wizard project skills:\\n${projectSkills.join('\\n')}` : 'Wizard project skills: none.',\n userSkills.length > 0 ? `Wizard user skills:\\n${userSkills.join('\\n')}` : 'Wizard user skills: none.',\n ]\n .filter(Boolean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ACgB,IAAI,GAAG,GAAG,sEAAsE,EACpH,sBAAsBf,aAAa,GAAG,EACtC,yBAAyBO,kBAAkB,GAAGG,mBAAmB,GAAG,EACpE,wBAAwBT,OAAO,CAACe,WAAW,mBAAmBf,OAAO,CAACgB,aAAa,uBAAuBhB,OAAO,CAACiB,iBAAiB,GAAG,EACtI,WAAWjB,OAAO,CAACkB,gBAAgB,CAACC,MAAM,mBAAmBnB,OAAO,CAACkB,gBAAgB,CAACvB,OAAO,oBAAoBK,OAAO,CAACkB,gBAAgB,CAACzB,IAAI,iBAAiBO,OAAO,CAACkB,gBAAgB,CAACE,KAAK,SAAS,EACtM,qNAAqN,EACrN,8OAA8O,EAC9O,wVAAwV,EACxV,mSAAmS,EACnS,sMAAsM,EACtMV,YAAY,CAAC/B,MAAM,GAAG,CAAC,GAAG,0BAA0B+B,YAAY,CAACH,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,6BAA6B,EAC7GK,aAAa,CAACjC,MAAM,GAAG,CAAC,GAAG,2BAA2BiC,aAAa,CAACL,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,8BAA8B,EACjHM,UAAU,CAAClC,MAAM,GAAG,CAAC,GAAG,wBAAwBkC,UAAU,CAACN,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,2BAA2B,CACtG,CACEI,MAAM,CAACU,OAAO,CAAC,CACfd,IAAI,CAAC,GAAG,CAAC;AACd,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const WIZARD_SCOPE_TERMS: {
|
|
2
|
+
readonly global: "wizard global";
|
|
3
|
+
readonly project: "wizard project";
|
|
4
|
+
readonly user: "wizard user";
|
|
5
|
+
readonly installable: "wizard installable";
|
|
6
|
+
readonly available: "wizard available";
|
|
7
|
+
};
|
|
8
|
+
export declare const WIZARD_SCOPE_LABELS: {
|
|
9
|
+
readonly global: "WIZARD GLOBAL";
|
|
10
|
+
readonly project: "WIZARD PROJECT";
|
|
11
|
+
readonly user: "WIZARD USER";
|
|
12
|
+
readonly installable: "WIZARD INSTALLABLE";
|
|
13
|
+
readonly available: "WIZARD AVAILABLE";
|
|
14
|
+
};
|
|
15
|
+
export declare const isUserPublishedSkillAssignment: (assignmentSource: string) => boolean;
|
|
16
|
+
export declare const getPublishedSkillAssignmentLabel: (assignmentSource: string) => string;
|
|
17
|
+
export declare const getPublishedSkillPolicyLabel: ({ assignmentSource, contextKind, policy, }: {
|
|
18
|
+
assignmentSource: string;
|
|
19
|
+
contextKind: "global" | "project" | "installable";
|
|
20
|
+
policy: "GLOBAL_CONTEXT" | "PROJECT_INSTALLABLE";
|
|
21
|
+
}) => string;
|