@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
|
@@ -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;EACnBC,WAAW,EAAE,oBAAoB;EACjCC,SAAS,EAAE;AACb,CAAU;AAEV,OAAO,MAAMC,mBAAmB,GAAG;EACjCL,MAAM,EAAE,eAAe;EACvBC,OAAO,EAAE,gBAAgB;EACzBC,IAAI,EAAE,aAAa;EACnBC,WAAW,EAAE,oBAAoB;EACjCC,SAAS,EAAE;AACb,CAAU;AAEV,OAAO,MAAME,8BAA8B,GAAIC,gBAAwB,IACrEA,gBAAgB,KAAK,MAAM,IAAIA,gBAAgB,KAAK,aAAa,IAAIA,gBAAgB,KAAK,gBAAgB;AAE5G,OAAO,MAAMC,gCAAgC,GAAID,gBAAwB,IAAa;EACpF,IAAIA,gBAAgB,KAAK,QAAQ,EAAE,OAAO,GAAGR,kBAAkB,CAACC,MAAM,aAAa;EACnF,IAAIO,gBAAgB,KAAK,WAAW,EAAE,OAAO,GAAGR,kBAAkB,CAACE,OAAO,aAAa;EACvF,IAAIK,8BAA8B,CAACC,gBAAgB,CAAC,EAAE,OAAO,GAAGR,kBAAkB,CAACG,IAAI,aAAa;EAEpG,OAAO,GAAGK,gBAAgB,CAACE,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,aAAa;AAC3E,CAAC;AAED,OAAO,MAAMC,4BAA4B,GAAGA,CAAC;EAC3CJ,gBAAgB;EAChBK,WAAW;EACXC;AAKF,CAAC,KAAa;EACZ,IAAIP,8BAA8B,CAACC,gBAAgB,CAAC,IAAIM,MAAM,KAAK,gBAAgB,EAAE;IACnF,OAAO,2BAA2Bd,kBAAkB,CAACG,IAAI,UAAU;EACrE;EAEA,IAAII,8BAA8B,CAACC,gBAAgB,CAAC,EAAE;IACpD,OAAO,gCAAgCR,kBAAkB,CAACG,IAAI,aAAa;EAC7E;EAEA,IAAIW,MAAM,KAAK,gBAAgB,EAAE,OAAO,+DAA+D;EACvG,IAAID,WAAW,KAAK,aAAa,EAAE,OAAO,4CAA4C;EACtF,IAAIA,WAAW,KAAK,QAAQ,EAAE,OAAO,gCAAgCb,kBAAkB,CAACC,MAAM,aAAa;EAE3G,OAAO,gCAAgCD,kBAAkB,CAACE,OAAO,aAAa;AAChF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
export { isUserPublishedSkillAssignment } from './published-skills-terminology.js';
|
|
2
|
+
type PublishedSkillFacetLike = {
|
|
3
|
+
slug: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
};
|
|
7
|
+
type PublishedSkillTagLike = {
|
|
8
|
+
slug: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string | null;
|
|
11
|
+
facet?: PublishedSkillFacetLike | null;
|
|
12
|
+
};
|
|
13
|
+
type PublishedSkillInstallPolicy = 'GLOBAL_CONTEXT' | 'PROJECT_INSTALLABLE';
|
|
14
|
+
type PublishedSkillCatalogItemLike = {
|
|
15
|
+
assignmentSource: string;
|
|
16
|
+
assignmentType: string;
|
|
17
|
+
scopePath: string;
|
|
18
|
+
includeChildren?: boolean | null;
|
|
19
|
+
skill: {
|
|
20
|
+
id: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
name: string;
|
|
23
|
+
summary?: string | null;
|
|
24
|
+
whenToUse?: string | null;
|
|
25
|
+
status: string;
|
|
26
|
+
installPolicy: PublishedSkillInstallPolicy;
|
|
27
|
+
tags: PublishedSkillTagLike[];
|
|
28
|
+
};
|
|
29
|
+
skillVersion: {
|
|
30
|
+
id: string;
|
|
31
|
+
version: string;
|
|
32
|
+
title?: string | null;
|
|
33
|
+
summary?: string | null;
|
|
34
|
+
status: string;
|
|
35
|
+
};
|
|
36
|
+
publishedArtifact: {
|
|
37
|
+
id: string;
|
|
38
|
+
frontmatterName: string;
|
|
39
|
+
frontmatterDescription: string;
|
|
40
|
+
checksum: string;
|
|
41
|
+
publishedAt: string;
|
|
42
|
+
fileCount: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
type PublishedSkillArtifactFileLike = {
|
|
46
|
+
id: string;
|
|
47
|
+
relativePath: string;
|
|
48
|
+
contentType: string;
|
|
49
|
+
content: string;
|
|
50
|
+
checksum: string;
|
|
51
|
+
size: number;
|
|
52
|
+
sortOrder: number;
|
|
53
|
+
};
|
|
54
|
+
type PublishedSkillDetailItemLike = PublishedSkillCatalogItemLike & {
|
|
55
|
+
publishedArtifact: PublishedSkillCatalogItemLike['publishedArtifact'] & {
|
|
56
|
+
markdownBody: string;
|
|
57
|
+
renderedContent: string;
|
|
58
|
+
files: PublishedSkillArtifactFileLike[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
type PublishedSkillInstallableCatalogItemLike = Pick<PublishedSkillCatalogItemLike, 'skill' | 'skillVersion' | 'publishedArtifact'>;
|
|
62
|
+
type PublishedSkillCatalogPayloadLike<TItem extends PublishedSkillCatalogItemLike = PublishedSkillCatalogItemLike> = {
|
|
63
|
+
workspace: {
|
|
64
|
+
id: string;
|
|
65
|
+
slug: string;
|
|
66
|
+
name: string;
|
|
67
|
+
repositoryUrl?: string | null;
|
|
68
|
+
defaultBranch?: string | null;
|
|
69
|
+
status: string;
|
|
70
|
+
} | null;
|
|
71
|
+
directoryPath: string;
|
|
72
|
+
skills: TItem[];
|
|
73
|
+
catalogSkills: PublishedSkillInstallableCatalogItemLike[];
|
|
74
|
+
userPreferences: {
|
|
75
|
+
scopeKey: string;
|
|
76
|
+
userKey: string;
|
|
77
|
+
ignoredSkills: PublishedSkillCatalogItemLike[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type PublishedSkillFacetSummary = {
|
|
81
|
+
slug: string;
|
|
82
|
+
label: string;
|
|
83
|
+
description: string | null;
|
|
84
|
+
};
|
|
85
|
+
export type PublishedSkillTagSummary = {
|
|
86
|
+
slug: string;
|
|
87
|
+
label: string;
|
|
88
|
+
description: string | null;
|
|
89
|
+
facet: PublishedSkillFacetSummary | null;
|
|
90
|
+
};
|
|
91
|
+
export type PublishedSkillSummary = {
|
|
92
|
+
skillSlug: string;
|
|
93
|
+
skillName: string;
|
|
94
|
+
artifactName: string;
|
|
95
|
+
artifactDescription: string;
|
|
96
|
+
whenToUse: string | null;
|
|
97
|
+
version: string;
|
|
98
|
+
assignmentSource: string;
|
|
99
|
+
assignmentType: string;
|
|
100
|
+
scopePath: string;
|
|
101
|
+
includeChildren: boolean | null;
|
|
102
|
+
checksum: string;
|
|
103
|
+
publishedAt: string;
|
|
104
|
+
fileCount: number;
|
|
105
|
+
identifiers: string[];
|
|
106
|
+
tags: PublishedSkillTagSummary[];
|
|
107
|
+
contextKind: 'global' | 'project' | 'installable';
|
|
108
|
+
installPolicy: PublishedSkillInstallPolicy;
|
|
109
|
+
assignmentLabel: string;
|
|
110
|
+
policyLabel: string;
|
|
111
|
+
};
|
|
112
|
+
export type PublishedSkillDetail = PublishedSkillSummary & {
|
|
113
|
+
skillId: string;
|
|
114
|
+
skillVersionId: string;
|
|
115
|
+
artifactId: string;
|
|
116
|
+
markdownDocument: string;
|
|
117
|
+
markdownBody: string;
|
|
118
|
+
renderedContent: string;
|
|
119
|
+
files: PublishedSkillArtifactFileLike[];
|
|
120
|
+
resources: PublishedSkillArtifactFileLike[];
|
|
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
|
+
};
|
|
213
|
+
export type PublishedSkillsSuccessState = {
|
|
214
|
+
pluginId: string;
|
|
215
|
+
runtimeMode: 'tool_fetch_only';
|
|
216
|
+
deliveryModel: 'backend_published_installed_effective_skills';
|
|
217
|
+
workspace: PublishedSkillCatalogPayloadLike['workspace'];
|
|
218
|
+
directoryPath: string;
|
|
219
|
+
rootSkillSeedPath: string;
|
|
220
|
+
availableTools: string[];
|
|
221
|
+
publishedSkillCount: number;
|
|
222
|
+
assignmentCounts: {
|
|
223
|
+
global: number;
|
|
224
|
+
project: number;
|
|
225
|
+
user: number;
|
|
226
|
+
other: number;
|
|
227
|
+
};
|
|
228
|
+
facets: PublishedSkillFacetSummary[];
|
|
229
|
+
skills: PublishedSkillSummary[];
|
|
230
|
+
};
|
|
231
|
+
type PublishedSkillCatalogOptions = {
|
|
232
|
+
pluginId: string;
|
|
233
|
+
rootSkillSeedPath: string;
|
|
234
|
+
availableTools: string[];
|
|
235
|
+
};
|
|
236
|
+
export declare const formatSkillLabel: (item: PublishedSkillCatalogItemLike) => string;
|
|
237
|
+
export declare const buildSkillMarkdown: (item: PublishedSkillDetailItemLike) => string;
|
|
238
|
+
export declare const toPublishedSkillSummary: (item: PublishedSkillCatalogItemLike) => PublishedSkillSummary;
|
|
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;
|
|
247
|
+
export declare const toInstallableSkillSummary: (item: PublishedSkillInstallableCatalogItemLike) => PublishedSkillSummary;
|
|
248
|
+
export declare const toPublishedSkillCatalog: (payload: PublishedSkillCatalogPayloadLike, options: PublishedSkillCatalogOptions) => PublishedSkillsSuccessState;
|
|
249
|
+
export declare const parseRequestedSkillArgs: (args: {
|
|
250
|
+
skill?: string;
|
|
251
|
+
skills?: string;
|
|
252
|
+
}) => string[];
|
|
253
|
+
export declare const selectPublishedSkills: <TItem extends PublishedSkillCatalogItemLike>(payload: Omit<PublishedSkillCatalogPayloadLike<TItem>, "skills"> & {
|
|
254
|
+
skills: TItem[];
|
|
255
|
+
}, identifiers: string[]) => {
|
|
256
|
+
selectedItems: TItem[];
|
|
257
|
+
missingIdentifiers: string[];
|
|
258
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { getPublishedSkillAssignmentLabel, getPublishedSkillPolicyLabel, isUserPublishedSkillAssignment } from './published-skills-terminology.js';
|
|
2
|
+
export { isUserPublishedSkillAssignment } from './published-skills-terminology.js';
|
|
3
|
+
const toFrontmatterString = value => JSON.stringify(value);
|
|
4
|
+
export const formatSkillLabel = item => {
|
|
5
|
+
const artifactName = item.publishedArtifact.frontmatterName.trim();
|
|
6
|
+
if (artifactName.length > 0) return artifactName;
|
|
7
|
+
return item.skill.name;
|
|
8
|
+
};
|
|
9
|
+
export const buildSkillMarkdown = item => {
|
|
10
|
+
const artifactBody = item.publishedArtifact.markdownBody.trim();
|
|
11
|
+
const fallbackBody = item.publishedArtifact.renderedContent.trim();
|
|
12
|
+
const body = artifactBody || fallbackBody;
|
|
13
|
+
if (body.startsWith('---')) {
|
|
14
|
+
return body.endsWith('\n') ? body : `${body}\n`;
|
|
15
|
+
}
|
|
16
|
+
const name = formatSkillLabel(item);
|
|
17
|
+
const description = item.publishedArtifact.frontmatterDescription.trim() || item.skill.summary?.trim() || '';
|
|
18
|
+
const frontmatter = ['---', `name: ${toFrontmatterString(name)}`, `description: ${toFrontmatterString(description)}`, '---'].join('\n');
|
|
19
|
+
if (!body) {
|
|
20
|
+
return `${frontmatter}\n`;
|
|
21
|
+
}
|
|
22
|
+
return `${frontmatter}\n\n${body.endsWith('\n') ? body : `${body}\n`}`;
|
|
23
|
+
};
|
|
24
|
+
const getSkillIdentifiers = item => {
|
|
25
|
+
const candidates = [item.skill.slug, item.publishedArtifact.frontmatterName, item.skill.name];
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
return candidates.reduce((all, candidate) => {
|
|
28
|
+
const normalized = candidate.trim();
|
|
29
|
+
if (!normalized) return all;
|
|
30
|
+
const cacheKey = normalized.toLowerCase();
|
|
31
|
+
if (seen.has(cacheKey)) return all;
|
|
32
|
+
seen.add(cacheKey);
|
|
33
|
+
all.push(normalized);
|
|
34
|
+
return all;
|
|
35
|
+
}, []);
|
|
36
|
+
};
|
|
37
|
+
const toPublishedSkillFacetSummary = facet => ({
|
|
38
|
+
slug: facet.slug,
|
|
39
|
+
label: facet.label,
|
|
40
|
+
description: facet.description ?? null
|
|
41
|
+
});
|
|
42
|
+
const toPublishedSkillTagSummary = tag => ({
|
|
43
|
+
slug: tag.slug,
|
|
44
|
+
label: tag.label,
|
|
45
|
+
description: tag.description ?? null,
|
|
46
|
+
facet: tag.facet ? toPublishedSkillFacetSummary(tag.facet) : null
|
|
47
|
+
});
|
|
48
|
+
const getPublishedSkillFacets = items => {
|
|
49
|
+
const facetsBySlug = new Map();
|
|
50
|
+
for (const item of items) {
|
|
51
|
+
for (const tag of item.skill.tags) {
|
|
52
|
+
if (!tag.facet) continue;
|
|
53
|
+
if (facetsBySlug.has(tag.facet.slug)) continue;
|
|
54
|
+
facetsBySlug.set(tag.facet.slug, toPublishedSkillFacetSummary(tag.facet));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return [...facetsBySlug.values()].sort((left, right) => left.slug.localeCompare(right.slug));
|
|
58
|
+
};
|
|
59
|
+
const getPublishedSkillAssignmentCounts = items => items.reduce((counts, item) => {
|
|
60
|
+
if (isUserPublishedSkillAssignment(item.assignmentSource)) {
|
|
61
|
+
return {
|
|
62
|
+
...counts,
|
|
63
|
+
user: counts.user + 1
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (item.assignmentSource === 'GLOBAL') {
|
|
67
|
+
return {
|
|
68
|
+
...counts,
|
|
69
|
+
global: counts.global + 1
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (item.assignmentSource === 'WORKSPACE') {
|
|
73
|
+
return {
|
|
74
|
+
...counts,
|
|
75
|
+
project: counts.project + 1
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
...counts,
|
|
80
|
+
other: counts.other + 1
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
global: 0,
|
|
84
|
+
project: 0,
|
|
85
|
+
user: 0,
|
|
86
|
+
other: 0
|
|
87
|
+
});
|
|
88
|
+
const getSkillContextKind = item => {
|
|
89
|
+
if (item.assignmentSource === 'GLOBAL') return 'global';
|
|
90
|
+
return 'project';
|
|
91
|
+
};
|
|
92
|
+
export const toPublishedSkillSummary = item => {
|
|
93
|
+
const contextKind = getSkillContextKind(item);
|
|
94
|
+
return {
|
|
95
|
+
skillSlug: item.skill.slug,
|
|
96
|
+
skillName: item.skill.name,
|
|
97
|
+
artifactName: item.publishedArtifact.frontmatterName,
|
|
98
|
+
artifactDescription: item.publishedArtifact.frontmatterDescription,
|
|
99
|
+
whenToUse: item.skill.whenToUse ?? null,
|
|
100
|
+
version: item.skillVersion.version,
|
|
101
|
+
assignmentSource: item.assignmentSource,
|
|
102
|
+
assignmentType: item.assignmentType,
|
|
103
|
+
scopePath: item.scopePath,
|
|
104
|
+
includeChildren: item.includeChildren ?? null,
|
|
105
|
+
checksum: item.publishedArtifact.checksum,
|
|
106
|
+
publishedAt: item.publishedArtifact.publishedAt,
|
|
107
|
+
fileCount: item.publishedArtifact.fileCount,
|
|
108
|
+
identifiers: getSkillIdentifiers(item),
|
|
109
|
+
tags: item.skill.tags.map(toPublishedSkillTagSummary),
|
|
110
|
+
contextKind,
|
|
111
|
+
installPolicy: item.skill.installPolicy,
|
|
112
|
+
assignmentLabel: getPublishedSkillAssignmentLabel(item.assignmentSource),
|
|
113
|
+
policyLabel: getPublishedSkillPolicyLabel({
|
|
114
|
+
assignmentSource: item.assignmentSource,
|
|
115
|
+
contextKind,
|
|
116
|
+
policy: item.skill.installPolicy
|
|
117
|
+
})
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export const toPublishedSkillDetail = item => ({
|
|
121
|
+
...toPublishedSkillSummary(item),
|
|
122
|
+
skillId: item.skill.id,
|
|
123
|
+
skillVersionId: item.skillVersion.id,
|
|
124
|
+
artifactId: item.publishedArtifact.id,
|
|
125
|
+
markdownDocument: buildSkillMarkdown(item),
|
|
126
|
+
markdownBody: item.publishedArtifact.markdownBody,
|
|
127
|
+
renderedContent: item.publishedArtifact.renderedContent,
|
|
128
|
+
files: item.publishedArtifact.files,
|
|
129
|
+
resources: item.publishedArtifact.files.filter(file => file.relativePath !== 'SKILL.md')
|
|
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
|
+
});
|
|
210
|
+
export const toInstallableSkillSummary = item => ({
|
|
211
|
+
skillSlug: item.skill.slug,
|
|
212
|
+
skillName: item.skill.name,
|
|
213
|
+
artifactName: item.publishedArtifact.frontmatterName,
|
|
214
|
+
artifactDescription: item.publishedArtifact.frontmatterDescription,
|
|
215
|
+
whenToUse: item.skill.whenToUse ?? null,
|
|
216
|
+
version: item.skillVersion.version,
|
|
217
|
+
assignmentSource: 'CATALOG',
|
|
218
|
+
assignmentType: 'PATH',
|
|
219
|
+
scopePath: '',
|
|
220
|
+
includeChildren: true,
|
|
221
|
+
checksum: item.publishedArtifact.checksum,
|
|
222
|
+
publishedAt: item.publishedArtifact.publishedAt,
|
|
223
|
+
fileCount: item.publishedArtifact.fileCount,
|
|
224
|
+
identifiers: getSkillIdentifiers({
|
|
225
|
+
...item,
|
|
226
|
+
assignmentSource: 'CATALOG',
|
|
227
|
+
assignmentType: 'PATH',
|
|
228
|
+
scopePath: '',
|
|
229
|
+
includeChildren: true
|
|
230
|
+
}),
|
|
231
|
+
tags: item.skill.tags.map(toPublishedSkillTagSummary),
|
|
232
|
+
contextKind: 'installable',
|
|
233
|
+
installPolicy: item.skill.installPolicy,
|
|
234
|
+
assignmentLabel: 'catalog skill',
|
|
235
|
+
policyLabel: getPublishedSkillPolicyLabel({
|
|
236
|
+
assignmentSource: 'CATALOG',
|
|
237
|
+
contextKind: 'installable',
|
|
238
|
+
policy: item.skill.installPolicy
|
|
239
|
+
})
|
|
240
|
+
});
|
|
241
|
+
export const toPublishedSkillCatalog = (payload, options) => ({
|
|
242
|
+
pluginId: options.pluginId,
|
|
243
|
+
runtimeMode: 'tool_fetch_only',
|
|
244
|
+
deliveryModel: 'backend_published_installed_effective_skills',
|
|
245
|
+
workspace: payload.workspace,
|
|
246
|
+
directoryPath: payload.directoryPath,
|
|
247
|
+
rootSkillSeedPath: options.rootSkillSeedPath,
|
|
248
|
+
availableTools: options.availableTools,
|
|
249
|
+
publishedSkillCount: payload.skills.length,
|
|
250
|
+
assignmentCounts: getPublishedSkillAssignmentCounts(payload.skills),
|
|
251
|
+
facets: getPublishedSkillFacets(payload.skills),
|
|
252
|
+
skills: payload.skills.map(toPublishedSkillSummary)
|
|
253
|
+
});
|
|
254
|
+
const normalizeSkillIdentifier = value => value.trim().toLowerCase();
|
|
255
|
+
const parseSkillIdentifiers = value => {
|
|
256
|
+
const seen = new Set();
|
|
257
|
+
return value.split(/[\n,]/).map(item => item.trim()).filter(item => item.length > 0).filter(item => {
|
|
258
|
+
const normalized = normalizeSkillIdentifier(item);
|
|
259
|
+
if (seen.has(normalized)) return false;
|
|
260
|
+
seen.add(normalized);
|
|
261
|
+
return true;
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const mergeSkillIdentifiers = values => {
|
|
265
|
+
const seen = new Set();
|
|
266
|
+
return values.filter(value => {
|
|
267
|
+
const normalized = normalizeSkillIdentifier(value);
|
|
268
|
+
if (!normalized || seen.has(normalized)) return false;
|
|
269
|
+
seen.add(normalized);
|
|
270
|
+
return true;
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
export const parseRequestedSkillArgs = args => {
|
|
274
|
+
const requestedSkills = [];
|
|
275
|
+
if (typeof args.skill === 'string') {
|
|
276
|
+
requestedSkills.push(...parseSkillIdentifiers(args.skill));
|
|
277
|
+
}
|
|
278
|
+
if (typeof args.skills === 'string') {
|
|
279
|
+
requestedSkills.push(...parseSkillIdentifiers(args.skills));
|
|
280
|
+
}
|
|
281
|
+
return mergeSkillIdentifiers(requestedSkills);
|
|
282
|
+
};
|
|
283
|
+
export const selectPublishedSkills = (payload, identifiers) => {
|
|
284
|
+
const itemsByIdentifier = new Map();
|
|
285
|
+
for (const item of payload.skills) {
|
|
286
|
+
for (const identifier of getSkillIdentifiers(item)) {
|
|
287
|
+
itemsByIdentifier.set(normalizeSkillIdentifier(identifier), item);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const selectedItems = [];
|
|
291
|
+
const selectedKeys = new Set();
|
|
292
|
+
const missingIdentifiers = [];
|
|
293
|
+
for (const identifier of identifiers) {
|
|
294
|
+
const matched = itemsByIdentifier.get(normalizeSkillIdentifier(identifier));
|
|
295
|
+
if (!matched) {
|
|
296
|
+
missingIdentifiers.push(identifier);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (selectedKeys.has(matched.publishedArtifact.id)) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
selectedKeys.add(matched.publishedArtifact.id);
|
|
303
|
+
selectedItems.push(matched);
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
selectedItems,
|
|
307
|
+
missingIdentifiers
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
//# sourceMappingURL=published-skills-transform.js.map
|