@aexol/opencode-wizard 0.3.4 → 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.
Files changed (38) hide show
  1. package/README.md +9 -7
  2. package/dist/graphql-operations.d.ts +5 -2
  3. package/dist/graphql-operations.js +161 -156
  4. package/dist/graphql-operations.js.map +1 -1
  5. package/dist/plugin-tools.d.ts +26 -0
  6. package/dist/plugin-tools.js +43 -7
  7. package/dist/plugin-tools.js.map +1 -1
  8. package/dist/published-skills-system-note.js +3 -7
  9. package/dist/published-skills-system-note.js.map +1 -1
  10. package/dist/published-skills-terminology.d.ts +21 -0
  11. package/dist/published-skills-terminology.js +38 -0
  12. package/dist/published-skills-terminology.js.map +1 -0
  13. package/dist/published-skills-transform.d.ts +99 -2
  14. package/dist/published-skills-transform.js +91 -19
  15. package/dist/published-skills-transform.js.map +1 -1
  16. package/dist/server/auth-bootstrap.d.ts +7 -0
  17. package/dist/server/auth-bootstrap.js +89 -0
  18. package/dist/server/auth-bootstrap.js.map +1 -0
  19. package/dist/server/client.d.ts +30 -1
  20. package/dist/server/client.js +81 -1
  21. package/dist/server/client.js.map +1 -1
  22. package/dist/server/preferences.d.ts +22 -0
  23. package/dist/server/preferences.js +121 -0
  24. package/dist/server/preferences.js.map +1 -0
  25. package/dist/server/runtime.d.ts +3 -22
  26. package/dist/server/runtime.js +447 -242
  27. package/dist/server/runtime.js.map +1 -1
  28. package/dist/server/types.d.ts +75 -0
  29. package/dist/server/types.js.map +1 -1
  30. package/dist/smoke-published-skills.js +4 -4
  31. package/dist/smoke-published-skills.js.map +1 -1
  32. package/dist/tui/components/skill-catalog-row.js +45 -44
  33. package/dist/tui/components/skill-catalog-row.js.map +1 -1
  34. package/dist/tui/components/wizard-skills-dialog-content.js +73 -63
  35. package/dist/tui/components/wizard-skills-dialog-content.js.map +1 -1
  36. package/dist/tui/skill-helpers.js +7 -6
  37. package/dist/tui/skill-helpers.js.map +1 -1
  38. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["AVAILABLE_PUBLISHED_SKILL_TOOLS","SHARED_PUBLISHED_SKILL_TOOLS","slice","resolveAvailableTools","role","createPublishedSkillToolDefinitions","tool","handlers","sharedTools","opencode_wizard_published_skills_fetch","description","args","skill","schema","string","optional","describe","skills","directory","refresh","boolean","execute","context","fetchPublishedSkills","opencode_wizard_published_skill_preference_set","action","preferenceScope","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 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 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 updatePublishedSkillPreference: (args: PublishedSkillPreferenceArgs, 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_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, 3);\n\nexport const resolveAvailableTools = (role: string | null | undefined): string[] => {\n if (role === 'ADMIN') return [...SHARED_PUBLISHED_SKILL_TOOLS];\n if (role === 'EDITOR') return [...AVAILABLE_PUBLISHED_SKILL_TOOLS];\n return [];\n};\n\nexport const createPublishedSkillToolDefinitions = (\n tool: ToolFactory,\n handlers: PublishedSkillToolHandlers,\n) => ({\n sharedTools: {\n opencode_wizard_published_skills_fetch: tool<PublishedSkillFetchArgs>({\n description:\n '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, and after native errors like `Skill \"...\" not found`; prefer `skills` for multiple identifiers and call with no args to discover the catalog and bootstrap auth when needed',\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 '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',\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 'Report opencode-wizard plugin status, bootstrap auth when missing, and return a safe auth summary 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 },\n});\n"],"mappings":"AAwDA,OAAO,MAAMA,+BAA+B,GAAG,CAC7C,wCAAwC,EACxC,gDAAgD,EAChD,wBAAwB,EACxB,sCAAsC,CACvC;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,OAAO,EAAE,OAAO,CAAC,GAAGH,4BAA4B,CAAC;EAC9D,IAAIG,IAAI,KAAK,QAAQ,EAAE,OAAO,CAAC,GAAGJ,+BAA+B,CAAC;EAClE,OAAO,EAAE;AACX,CAAC;AAED,OAAO,MAAMK,mCAAmC,GAAGA,CACjDC,IAAiB,EACjBC,QAAoC,MAChC;EACJC,WAAW,EAAE;IACXC,sCAAsC,EAAEH,IAAI,CAA0B;MACpEI,WAAW,EACT,mXAAmX;MAC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B,OAAOf,QAAQ,CAACoB,8BAA8B,CAAChB,IAAI,EAAEW,OAAO,CAAC;MAC/D;IACF,CAAC,CAAC;IACFM,sBAAsB,EAAEtB,IAAI,CAAmB;MAC7CI,WAAW,EACT,2HAA2H;MAC7HC,IAAI,EAAE;QACJO,SAAS,EAAEZ,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,kDAAkD;MACxG,CAAC;MACD,MAAMK,OAAOA,CAACV,IAAI,EAAEW,OAAO,EAAE;QAC3B,OAAOf,QAAQ,CAACsB,SAAS,CAAClB,IAAI,EAAEW,OAAO,CAAC;MAC1C;IACF,CAAC;EACH,CAAC;EACDQ,eAAe,EAAE;IACfC,oCAAoC,EAAEzB,IAAI,CAAyB;MACjEI,WAAW,EACT,0JAA0J;MAC5JC,IAAI,EAAE;QACJqB,SAAS,EAAE1B,IAAI,CAACO,MAAM,CACnBC,MAAM,CAAC,CAAC,CACRE,QAAQ,CAAC,yDAAyD,CAAC;QACtEE,SAAS,EAAEZ,IAAI,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,kDAAkD;MACxG,CAAC;MACD,MAAMK,OAAOA,CAACV,IAAI,EAAEW,OAAO,EAAE;QAC3B,OAAOf,QAAQ,CAAC0B,kBAAkB,CAACtB,IAAI,EAAEW,OAAO,CAAC;MACnD;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_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) {\n return handlers.publishEditorSkill(args, context);\n },\n }),\n },\n});\n"],"mapp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AO,CAAC;MACnD;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import { isUserPublishedSkillAssignment } from './published-skills-transform.js';
2
+ import { WIZARD_SCOPE_LABELS } from './published-skills-terminology.js';
2
3
  const SYSTEM_NOTE_SKILL_NAME_LIMIT = 10;
3
4
  const SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT = 140;
4
5
  const truncateText = (value, maxLength) => {
@@ -6,14 +7,9 @@ const truncateText = (value, maxLength) => {
6
7
  if (normalized.length <= maxLength) return normalized;
7
8
  return `${normalized.slice(0, Math.max(maxLength - 1, 0)).trimEnd()}…`;
8
9
  };
9
- const SCOPE_LABELS = {
10
- global: 'GLOBAL SCOPE',
11
- project: 'PROJECT SCOPE',
12
- installable: 'INSTALLABLE'
13
- };
14
10
  const buildSkillCatalogLine = skill => {
15
11
  const description = truncateText(skill.whenToUse || skill.artifactDescription || skill.skillName || skill.skillSlug, SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT);
16
- const scopeLabel = isUserPublishedSkillAssignment(skill.assignmentSource) ? 'USER SCOPE' : SCOPE_LABELS[skill.contextKind] || 'PROJECT SCOPE';
12
+ const scopeLabel = isUserPublishedSkillAssignment(skill.assignmentSource) ? WIZARD_SCOPE_LABELS.user : WIZARD_SCOPE_LABELS[skill.contextKind] || WIZARD_SCOPE_LABELS.project;
17
13
  return `- ${skill.artifactName || skill.skillName} (${skill.skillSlug}, ${scopeLabel}): ${description}`;
18
14
  };
19
15
  export const buildPublishedSkillsSystemNote = ({
@@ -29,6 +25,6 @@ export const buildPublishedSkillsSystemNote = ({
29
25
  const globalSkills = catalog.skills.filter(skill => skill.contextKind === 'global' && !isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 8).map(buildSkillCatalogLine);
30
26
  const projectSkills = catalog.skills.filter(skill => skill.contextKind === 'project' && !isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 5).map(buildSkillCatalogLine);
31
27
  const userSkills = catalog.skills.filter(skill => isUserPublishedSkillAssignment(skill.assignmentSource)).slice(0, 5).map(buildSkillCatalogLine);
32
- return [workspace ? `Workspace: ${workspace.slug}.` : 'Workspace not found; workspace-scoped wizard skills are unavailable.', `Current directory: ${directoryPath}.`, `Active wizard skills: ${renderedSkillNames}${renderedCountSuffix}.`, `Counts: ${catalog.assignmentCounts.global} global, ${catalog.assignmentCounts.project} project, ${catalog.assignmentCounts.user} user, ${catalog.assignmentCounts.other} other.`, 'Wizard-listed skills are backend-published; fetch body via `opencode_wizard_published_skills_fetch` before use (`skills`/`skill` for multiple/single). If native skill loading fails for a wizard name, fetch it. Fetched wizard bodies are authoritative over local seed/native sources.', globalSkills.length > 0 ? `Global skills:\n${globalSkills.join('\n')}` : 'Global skills: none.', projectSkills.length > 0 ? `Project skills:\n${projectSkills.join('\n')}` : 'Project skills: none.', userSkills.length > 0 ? `User skills:\n${userSkills.join('\n')}` : 'User skills: none.'].filter(Boolean).join(' ');
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(' ');
33
29
  };
34
30
  //# sourceMappingURL=published-skills-system-note.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isUserPublishedSkillAssignment","SYSTEM_NOTE_SKILL_NAME_LIMIT","SYSTEM_NOTE_SKILL_DESCRIPTION_LIMIT","truncateText","value","maxLength","normalized","replace","trim","length","slice","Math","max","trimEnd","SCOPE_LABELS","global","project","installable","buildSkillCatalogLine","skill","description","whenToUse","artifactDescription","skillName","skillSlug","scopeLabel","assignmentSource","contextKind","artifactName","buildPublishedSkillsSystemNote","workspace","directoryPath","catalog","details","_details","skillNames","skills","map","renderedSkillNames","join","remainingCount","renderedCountSuffix","globalSkills","filter","projectSkills","userSkills","slug","assignmentCounts","user","other","Boolean"],"sources":["../src/published-skills-system-note.ts"],"sourcesContent":["import {\n isUserPublishedSkillAssignment,\n type PublishedSkillsSuccessState,\n} from './published-skills-transform.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 SCOPE_LABELS: Record<PublishedSkillsSuccessState['skills'][number]['contextKind'], string> = {\n global: 'GLOBAL SCOPE',\n project: 'PROJECT SCOPE',\n installable: 'INSTALLABLE',\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 ? 'USER SCOPE'\n : (SCOPE_LABELS[skill.contextKind] || 'PROJECT SCOPE');\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 `Counts: ${catalog.assignmentCounts.global} global, ${catalog.assignmentCounts.project} project, ${catalog.assignmentCounts.user} user, ${catalog.assignmentCounts.other} other.`,\n 'Wizard-listed skills are backend-published; fetch body via `opencode_wizard_published_skills_fetch` before use (`skills`/`skill` for multiple/single). If native skill loading fails for a wizard name, fetch it. Fetched wizard bodies are authoritative over local seed/native sources.',\n globalSkills.length > 0 ? `Global skills:\\n${globalSkills.join('\\n')}` : 'Global skills: none.',\n projectSkills.length > 0 ? `Project skills:\\n${projectSkills.join('\\n')}` : 'Project skills: none.',\n userSkills.length > 0 ? `User skills:\\n${userSkills.join('\\n')}` : 'User skills: none.',\n ]\n .filter(Boolean)\n .join(' ');\n};\n"],"mappings":"AAAA,SACEA,8BAA8B,QAEzB,iCAAiC;AAExC,MAAMC,4BAA4B,GAAG,EAAE;AACvC,MAAMC,mCAAmC,GAAG,GAAG;AAE/C,MAAMC,YAAY,GAAGA,CAACC,KAAa,EAAEC,SAAiB,KAAa;EACjE,MAAMC,UAAU,GAAGF,KAAK,CAACG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC;EACrD,IAAIF,UAAU,CAACG,MAAM,IAAIJ,SAAS,EAAE,OAAOC,UAAU;EACrD,OAAO,GAAGA,UAAU,CAACI,KAAK,CAAC,CAAC,EAAEC,IAAI,CAACC,GAAG,CAACP,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAACQ,OAAO,CAAC,CAAC,GAAG;AACxE,CAAC;AAED,MAAMC,YAA0F,GAAG;EACjGC,MAAM,EAAE,cAAc;EACtBC,OAAO,EAAE,eAAe;EACxBC,WAAW,EAAE;AACf,CAAC;AAED,MAAMC,qBAAqB,GAAIC,KAAoD,IAAa;EAC9F,MAAMC,WAAW,GAAGjB,YAAY,C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CACfX,IAAI,CAAC,GAAG,CAAC;AACd,CAAC","ignoreList":[]}
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)\n .join(' ');\n};\n"],"mappings":"AAAA,SACEA,8BAA8B,QAEzB,iCAAiC;AACxC,SAASC,mBAAmB,QAAQ,mCAAmC;AAEvE,MAAMC,4BAA4B,GAAG,EAAE;AACvC,MAAMC,mCAAmC,GAAG,GAAG;AAE/C,MAAMC,YAAY,GAAGA,CAACC,KAAa,EAAEC,SAAiB,KAAa;EACjE,MAAMC,UAAU,GAAGF,KAAK,CAACG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC;EACrD,IAAIF,UAAU,CAACG,MAAM,IAAIJ,SAAS,EAAE,OAAOC,UAAU;EACrD,OAAO,GAAGA,UAAU,CAACI,KAAK,CAAC,CAAC,EAAEC,IAAI,CAACC,GAAG,CAACP,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAACQ,OAAO,CAAC,CAAC,GAAG;AACxE,CAAC;AAED,MAAMC,qBAAqB,GAAIC,KAAoD,IAAa;EAC9F,MAAMC,WAAW,GAAGb,YA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AA2BiC,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;
@@ -0,0 +1,38 @@
1
+ export const WIZARD_SCOPE_TERMS = {
2
+ global: 'wizard global',
3
+ project: 'wizard project',
4
+ user: 'wizard user',
5
+ installable: 'wizard installable',
6
+ available: 'wizard available'
7
+ };
8
+ export const WIZARD_SCOPE_LABELS = {
9
+ global: 'WIZARD GLOBAL',
10
+ project: 'WIZARD PROJECT',
11
+ user: 'WIZARD USER',
12
+ installable: 'WIZARD INSTALLABLE',
13
+ available: 'WIZARD AVAILABLE'
14
+ };
15
+ export const isUserPublishedSkillAssignment = assignmentSource => assignmentSource === 'USER' || assignmentSource === 'USER_GLOBAL' || assignmentSource === 'USER_WORKSPACE';
16
+ export const getPublishedSkillAssignmentLabel = assignmentSource => {
17
+ if (assignmentSource === 'GLOBAL') return `${WIZARD_SCOPE_TERMS.global} assignment`;
18
+ if (assignmentSource === 'WORKSPACE') return `${WIZARD_SCOPE_TERMS.project} assignment`;
19
+ if (isUserPublishedSkillAssignment(assignmentSource)) return `${WIZARD_SCOPE_TERMS.user} assignment`;
20
+ return `${assignmentSource.toLowerCase().replace(/_/gu, ' ')} assignment`;
21
+ };
22
+ export const getPublishedSkillPolicyLabel = ({
23
+ assignmentSource,
24
+ contextKind,
25
+ policy
26
+ }) => {
27
+ if (isUserPublishedSkillAssignment(assignmentSource) && policy === 'GLOBAL_CONTEXT') {
28
+ return `GLOBAL_CONTEXT · active ${WIZARD_SCOPE_TERMS.user} context`;
29
+ }
30
+ if (isUserPublishedSkillAssignment(assignmentSource)) {
31
+ return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.user} preference`;
32
+ }
33
+ if (policy === 'GLOBAL_CONTEXT') return 'GLOBAL_CONTEXT · active context only, not project-installable';
34
+ if (contextKind === 'installable') return 'PROJECT_INSTALLABLE · available to install';
35
+ if (contextKind === 'global') return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.global} assignment`;
36
+ return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.project} assignment`;
37
+ };
38
+ //# sourceMappingURL=published-skills-terminology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WIZARD_SCOPE_TERMS","global","project","user","installable","available","WIZARD_SCOPE_LABELS","isUserPublishedSkillAssignment","assignmentSource","getPublishedSkillAssignmentLabel","toLowerCase","replace","getPublishedSkillPolicyLabel","contextKind","policy"],"sources":["../src/published-skills-terminology.ts"],"sourcesContent":["export const WIZARD_SCOPE_TERMS = {\n global: 'wizard global',\n project: 'wizard project',\n user: 'wizard user',\n installable: 'wizard installable',\n available: 'wizard available',\n} as const;\n\nexport const WIZARD_SCOPE_LABELS = {\n global: 'WIZARD GLOBAL',\n project: 'WIZARD PROJECT',\n user: 'WIZARD USER',\n installable: 'WIZARD INSTALLABLE',\n available: 'WIZARD AVAILABLE',\n} as const;\n\nexport const isUserPublishedSkillAssignment = (assignmentSource: string): boolean =>\n assignmentSource === 'USER' || assignmentSource === 'USER_GLOBAL' || assignmentSource === 'USER_WORKSPACE';\n\nexport const getPublishedSkillAssignmentLabel = (assignmentSource: string): string => {\n if (assignmentSource === 'GLOBAL') return `${WIZARD_SCOPE_TERMS.global} assignment`;\n if (assignmentSource === 'WORKSPACE') return `${WIZARD_SCOPE_TERMS.project} assignment`;\n if (isUserPublishedSkillAssignment(assignmentSource)) return `${WIZARD_SCOPE_TERMS.user} assignment`;\n\n return `${assignmentSource.toLowerCase().replace(/_/gu, ' ')} assignment`;\n};\n\nexport const getPublishedSkillPolicyLabel = ({\n assignmentSource,\n contextKind,\n policy,\n}: {\n assignmentSource: string;\n contextKind: 'global' | 'project' | 'installable';\n policy: 'GLOBAL_CONTEXT' | 'PROJECT_INSTALLABLE';\n}): string => {\n if (isUserPublishedSkillAssignment(assignmentSource) && policy === 'GLOBAL_CONTEXT') {\n return `GLOBAL_CONTEXT · active ${WIZARD_SCOPE_TERMS.user} context`;\n }\n\n if (isUserPublishedSkillAssignment(assignmentSource)) {\n return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.user} preference`;\n }\n\n if (policy === 'GLOBAL_CONTEXT') return 'GLOBAL_CONTEXT · active context only, not project-installable';\n if (contextKind === 'installable') return 'PROJECT_INSTALLABLE · available to install';\n if (contextKind === 'global') return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.global} assignment`;\n\n return `PROJECT_INSTALLABLE · active ${WIZARD_SCOPE_TERMS.project} assignment`;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG;EAChCC,MAAM,EAAE,eAAe;EACvBC,OAAO,EAAE,gBAAgB;EACzBC,IAAI,EAAE,aAAa;EACnB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,OAAO,gCAAgCb,kBAAkB,CAACC,MAAM,aAAa;EAE3G,OAAO,gCAAgCD,kBAAkB,CAACE,OAAO,aAAa;AAChF,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ export { isUserPublishedSkillAssignment } from './published-skills-terminology.js';
1
2
  type PublishedSkillFacetLike = {
2
3
  slug: string;
3
4
  label: string;
@@ -118,6 +119,97 @@ export type PublishedSkillDetail = PublishedSkillSummary & {
118
119
  files: PublishedSkillArtifactFileLike[];
119
120
  resources: PublishedSkillArtifactFileLike[];
120
121
  };
122
+ type WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';
123
+ type WizardArtifactCatalogItemLike = {
124
+ assignmentSource: string;
125
+ assignmentType: string;
126
+ scopePath: string;
127
+ includeChildren?: boolean | null;
128
+ artifact: {
129
+ id: string;
130
+ kind: WizardArtifactKind;
131
+ slug: string;
132
+ name: string;
133
+ summary?: string | null;
134
+ whenToUse?: string | null;
135
+ status: string;
136
+ installPolicy: PublishedSkillInstallPolicy;
137
+ };
138
+ artifactVersion: {
139
+ id: string;
140
+ version: string;
141
+ title?: string | null;
142
+ summary?: string | null;
143
+ status: string;
144
+ frontmatterName: string;
145
+ frontmatterDescription: string;
146
+ checksum: string;
147
+ canonicalFilePath: string;
148
+ publishedAt: string;
149
+ fileCount: number;
150
+ };
151
+ };
152
+ type WizardArtifactDetailLike = WizardArtifactCatalogItemLike & {
153
+ artifactVersion: WizardArtifactCatalogItemLike['artifactVersion'] & {
154
+ markdownBody: string;
155
+ renderedContent: string;
156
+ files: PublishedSkillArtifactFileLike[];
157
+ };
158
+ };
159
+ type WizardArtifactCatalogPayloadLike = {
160
+ artifactKind: WizardArtifactKind;
161
+ workspace: PublishedSkillCatalogPayloadLike['workspace'];
162
+ directoryPath: string;
163
+ artifacts: WizardArtifactCatalogItemLike[];
164
+ catalogArtifacts: Pick<WizardArtifactCatalogItemLike, 'artifact' | 'artifactVersion'>[];
165
+ artifactPreferences: {
166
+ scopeKey: string;
167
+ userKey: string;
168
+ ignoredArtifacts: WizardArtifactCatalogItemLike[];
169
+ };
170
+ };
171
+ export type WizardArtifactSummary = {
172
+ artifactKind: WizardArtifactKind;
173
+ artifactSlug: string;
174
+ artifactName: string;
175
+ artifactDescription: string;
176
+ whenToUse: string | null;
177
+ version: string;
178
+ assignmentSource: string;
179
+ assignmentType: string;
180
+ scopePath: string;
181
+ includeChildren: boolean | null;
182
+ checksum: string;
183
+ publishedAt: string;
184
+ fileCount: number;
185
+ canonicalFilePath: string;
186
+ identifiers: string[];
187
+ contextKind: 'global' | 'project' | 'installable';
188
+ installPolicy: PublishedSkillInstallPolicy;
189
+ assignmentLabel: string;
190
+ policyLabel: string;
191
+ };
192
+ export type WizardArtifactDetail = WizardArtifactSummary & {
193
+ artifactId: string;
194
+ artifactVersionId: string;
195
+ markdownDocument: string;
196
+ markdownBody: string;
197
+ renderedContent: string;
198
+ files: PublishedSkillArtifactFileLike[];
199
+ resources: PublishedSkillArtifactFileLike[];
200
+ };
201
+ export type WizardArtifactCatalogState = {
202
+ pluginId: string;
203
+ runtimeMode: 'tool_fetch_only';
204
+ deliveryModel: 'backend_published_generic_artifacts';
205
+ artifactKind: WizardArtifactKind;
206
+ workspace: PublishedSkillCatalogPayloadLike['workspace'];
207
+ directoryPath: string;
208
+ availableTools: string[];
209
+ artifactCount: number;
210
+ artifacts: WizardArtifactSummary[];
211
+ catalogArtifacts: WizardArtifactSummary[];
212
+ };
121
213
  export type PublishedSkillsSuccessState = {
122
214
  pluginId: string;
123
215
  runtimeMode: 'tool_fetch_only';
@@ -143,9 +235,15 @@ type PublishedSkillCatalogOptions = {
143
235
  };
144
236
  export declare const formatSkillLabel: (item: PublishedSkillCatalogItemLike) => string;
145
237
  export declare const buildSkillMarkdown: (item: PublishedSkillDetailItemLike) => string;
146
- export declare const isUserPublishedSkillAssignment: (assignmentSource: string) => boolean;
147
238
  export declare const toPublishedSkillSummary: (item: PublishedSkillCatalogItemLike) => PublishedSkillSummary;
148
239
  export declare const toPublishedSkillDetail: (item: PublishedSkillDetailItemLike) => PublishedSkillDetail;
240
+ export declare const toWizardArtifactSummary: (item: WizardArtifactCatalogItemLike) => WizardArtifactSummary;
241
+ export declare const buildWizardArtifactMarkdown: (item: WizardArtifactDetailLike) => string;
242
+ export declare const toWizardArtifactDetail: (item: WizardArtifactDetailLike) => WizardArtifactDetail;
243
+ export declare const toWizardArtifactCatalog: (payload: WizardArtifactCatalogPayloadLike, options: {
244
+ pluginId: string;
245
+ availableTools: string[];
246
+ }) => WizardArtifactCatalogState;
149
247
  export declare const toInstallableSkillSummary: (item: PublishedSkillInstallableCatalogItemLike) => PublishedSkillSummary;
150
248
  export declare const toPublishedSkillCatalog: (payload: PublishedSkillCatalogPayloadLike, options: PublishedSkillCatalogOptions) => PublishedSkillsSuccessState;
151
249
  export declare const parseRequestedSkillArgs: (args: {
@@ -158,4 +256,3 @@ export declare const selectPublishedSkills: <TItem extends PublishedSkillCatalog
158
256
  selectedItems: TItem[];
159
257
  missingIdentifiers: string[];
160
258
  };
161
- export {};
@@ -1,3 +1,5 @@
1
+ import { getPublishedSkillAssignmentLabel, getPublishedSkillPolicyLabel, isUserPublishedSkillAssignment } from './published-skills-terminology.js';
2
+ export { isUserPublishedSkillAssignment } from './published-skills-terminology.js';
1
3
  const toFrontmatterString = value => JSON.stringify(value);
2
4
  export const formatSkillLabel = item => {
3
5
  const artifactName = item.publishedArtifact.frontmatterName.trim();
@@ -54,13 +56,6 @@ const getPublishedSkillFacets = items => {
54
56
  }
55
57
  return [...facetsBySlug.values()].sort((left, right) => left.slug.localeCompare(right.slug));
56
58
  };
57
- export const isUserPublishedSkillAssignment = assignmentSource => assignmentSource === 'USER' || assignmentSource === 'USER_GLOBAL' || assignmentSource === 'USER_WORKSPACE';
58
- const getPublishedSkillAssignmentLabel = assignmentSource => {
59
- if (assignmentSource === 'GLOBAL') return 'GLOBAL SCOPE assignment';
60
- if (assignmentSource === 'WORKSPACE') return 'PROJECT SCOPE assignment';
61
- if (isUserPublishedSkillAssignment(assignmentSource)) return 'USER SCOPE assignment';
62
- return `${assignmentSource.toUpperCase().replace(/_/gu, ' ')} assignment`;
63
- };
64
59
  const getPublishedSkillAssignmentCounts = items => items.reduce((counts, item) => {
65
60
  if (isUserPublishedSkillAssignment(item.assignmentSource)) {
66
61
  return {
@@ -94,16 +89,6 @@ const getSkillContextKind = item => {
94
89
  if (item.assignmentSource === 'GLOBAL') return 'global';
95
90
  return 'project';
96
91
  };
97
- const getSkillPolicyLabel = (policy, contextKind, assignmentSource) => {
98
- if (isUserPublishedSkillAssignment(assignmentSource) && policy === 'GLOBAL_CONTEXT') {
99
- return 'GLOBAL_CONTEXT · active USER SCOPE context';
100
- }
101
- if (isUserPublishedSkillAssignment(assignmentSource)) return 'PROJECT_INSTALLABLE · active USER SCOPE preference';
102
- if (policy === 'GLOBAL_CONTEXT') return 'GLOBAL_CONTEXT · active context only, not project-installable';
103
- if (contextKind === 'installable') return 'PROJECT_INSTALLABLE · available to install';
104
- if (contextKind === 'global') return 'PROJECT_INSTALLABLE · active GLOBAL SCOPE assignment';
105
- return 'PROJECT_INSTALLABLE · active PROJECT SCOPE assignment';
106
- };
107
92
  export const toPublishedSkillSummary = item => {
108
93
  const contextKind = getSkillContextKind(item);
109
94
  return {
@@ -125,7 +110,11 @@ export const toPublishedSkillSummary = item => {
125
110
  contextKind,
126
111
  installPolicy: item.skill.installPolicy,
127
112
  assignmentLabel: getPublishedSkillAssignmentLabel(item.assignmentSource),
128
- policyLabel: getSkillPolicyLabel(item.skill.installPolicy, contextKind, item.assignmentSource)
113
+ policyLabel: getPublishedSkillPolicyLabel({
114
+ assignmentSource: item.assignmentSource,
115
+ contextKind,
116
+ policy: item.skill.installPolicy
117
+ })
129
118
  };
130
119
  };
131
120
  export const toPublishedSkillDetail = item => ({
@@ -139,6 +128,85 @@ export const toPublishedSkillDetail = item => ({
139
128
  files: item.publishedArtifact.files,
140
129
  resources: item.publishedArtifact.files.filter(file => file.relativePath !== 'SKILL.md')
141
130
  });
131
+ const getWizardArtifactContextKind = item => {
132
+ if (item.assignmentSource === 'GLOBAL') return 'global';
133
+ if (item.assignmentSource === 'CATALOG') return 'installable';
134
+ return 'project';
135
+ };
136
+ const getWizardArtifactIdentifiers = item => {
137
+ const candidates = [item.artifact.slug, item.artifactVersion.frontmatterName, item.artifact.name];
138
+ const seen = new Set();
139
+ return candidates.reduce((all, candidate) => {
140
+ const normalized = candidate.trim();
141
+ if (!normalized) return all;
142
+ const cacheKey = normalized.toLowerCase();
143
+ if (seen.has(cacheKey)) return all;
144
+ seen.add(cacheKey);
145
+ all.push(normalized);
146
+ return all;
147
+ }, []);
148
+ };
149
+ export const toWizardArtifactSummary = item => {
150
+ const contextKind = getWizardArtifactContextKind(item);
151
+ return {
152
+ artifactKind: item.artifact.kind,
153
+ artifactSlug: item.artifact.slug,
154
+ artifactName: item.artifactVersion.frontmatterName || item.artifact.name,
155
+ artifactDescription: item.artifactVersion.frontmatterDescription || item.artifact.summary || '',
156
+ whenToUse: item.artifact.whenToUse ?? null,
157
+ version: item.artifactVersion.version,
158
+ assignmentSource: item.assignmentSource,
159
+ assignmentType: item.assignmentType,
160
+ scopePath: item.scopePath,
161
+ includeChildren: item.includeChildren ?? null,
162
+ checksum: item.artifactVersion.checksum,
163
+ publishedAt: item.artifactVersion.publishedAt,
164
+ fileCount: item.artifactVersion.fileCount,
165
+ canonicalFilePath: item.artifactVersion.canonicalFilePath,
166
+ identifiers: getWizardArtifactIdentifiers(item),
167
+ contextKind,
168
+ installPolicy: item.artifact.installPolicy,
169
+ assignmentLabel: getPublishedSkillAssignmentLabel(item.assignmentSource),
170
+ policyLabel: getPublishedSkillPolicyLabel({
171
+ assignmentSource: item.assignmentSource,
172
+ contextKind,
173
+ policy: item.artifact.installPolicy
174
+ })
175
+ };
176
+ };
177
+ export const buildWizardArtifactMarkdown = item => {
178
+ const body = item.artifactVersion.markdownBody.trim() || item.artifactVersion.renderedContent.trim();
179
+ if (body.endsWith('\n')) return body;
180
+ return `${body}\n`;
181
+ };
182
+ export const toWizardArtifactDetail = item => ({
183
+ ...toWizardArtifactSummary(item),
184
+ artifactId: item.artifact.id,
185
+ artifactVersionId: item.artifactVersion.id,
186
+ markdownDocument: buildWizardArtifactMarkdown(item),
187
+ markdownBody: item.artifactVersion.markdownBody,
188
+ renderedContent: item.artifactVersion.renderedContent,
189
+ files: item.artifactVersion.files,
190
+ resources: item.artifactVersion.files.filter(file => file.relativePath !== item.artifactVersion.canonicalFilePath)
191
+ });
192
+ export const toWizardArtifactCatalog = (payload, options) => ({
193
+ pluginId: options.pluginId,
194
+ runtimeMode: 'tool_fetch_only',
195
+ deliveryModel: 'backend_published_generic_artifacts',
196
+ artifactKind: payload.artifactKind,
197
+ workspace: payload.workspace,
198
+ directoryPath: payload.directoryPath,
199
+ availableTools: options.availableTools,
200
+ artifactCount: payload.artifacts.length,
201
+ artifacts: payload.artifacts.map(toWizardArtifactSummary),
202
+ catalogArtifacts: payload.catalogArtifacts.map(item => toWizardArtifactSummary({
203
+ ...item,
204
+ assignmentSource: 'CATALOG',
205
+ assignmentType: 'PATH',
206
+ scopePath: '',
207
+ includeChildren: true
208
+ }))
209
+ });
142
210
  export const toInstallableSkillSummary = item => ({
143
211
  skillSlug: item.skill.slug,
144
212
  skillName: item.skill.name,
@@ -164,7 +232,11 @@ export const toInstallableSkillSummary = item => ({
164
232
  contextKind: 'installable',
165
233
  installPolicy: item.skill.installPolicy,
166
234
  assignmentLabel: 'catalog skill',
167
- policyLabel: getSkillPolicyLabel(item.skill.installPolicy, 'installable', 'CATALOG')
235
+ policyLabel: getPublishedSkillPolicyLabel({
236
+ assignmentSource: 'CATALOG',
237
+ contextKind: 'installable',
238
+ policy: item.skill.installPolicy
239
+ })
168
240
  });
169
241
  export const toPublishedSkillCatalog = (payload, options) => ({
170
242
  pluginId: options.pluginId,