oh-skillhub 0.1.3 → 0.1.4
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/package.json +1 -1
- package/src/cli.js +25 -5
- package/src/data/manifest.json +11 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -165,12 +165,12 @@ async function runInteractiveInstaller(input = process.stdin, output = process.s
|
|
|
165
165
|
function buildRepositoryChoices(manifest) {
|
|
166
166
|
const choices = [];
|
|
167
167
|
for (const stage of COMMON_STAGES) {
|
|
168
|
-
const
|
|
169
|
-
choices.push({ scope: "common", stage, path: `common / ${stage}`, count });
|
|
168
|
+
const skills = manifest.skills.filter((skill) => skill.scope === "common" && skill.stage === stage);
|
|
169
|
+
choices.push({ scope: "common", stage, path: `common / ${stage}`, count: skills.length, skills });
|
|
170
170
|
}
|
|
171
171
|
for (const domain of DOMAIN_NAMES) {
|
|
172
|
-
const
|
|
173
|
-
choices.push({ scope: "domain", domain, path: `domain / ${domain}`, count });
|
|
172
|
+
const skills = manifest.skills.filter((skill) => skill.scope === "domain" && skill.domain === domain);
|
|
173
|
+
choices.push({ scope: "domain", domain, path: `domain / ${domain}`, count: skills.length, skills });
|
|
174
174
|
}
|
|
175
175
|
return choices;
|
|
176
176
|
}
|
|
@@ -196,6 +196,9 @@ function renderTuiMenu(choices) {
|
|
|
196
196
|
choices.forEach((choice, index) => {
|
|
197
197
|
const marker = choice.count > 0 ? "[ ]" : "[ ]";
|
|
198
198
|
lines.push(` ${String(index + 1).padStart(2, " ")}. ${marker} ${choice.path.padEnd(28, " ")} ${choice.count} skill(s)`);
|
|
199
|
+
for (const leaf of renderSkillLeaves(choice)) {
|
|
200
|
+
lines.push(` - ${leaf}`);
|
|
201
|
+
}
|
|
199
202
|
});
|
|
200
203
|
lines.push("");
|
|
201
204
|
return `${lines.join("\n")}\n`;
|
|
@@ -285,13 +288,29 @@ function renderRawTuiMenu(choices, cursor, selected) {
|
|
|
285
288
|
];
|
|
286
289
|
choices.forEach((choice, index) => {
|
|
287
290
|
const pointer = index === cursor ? ">" : " ";
|
|
288
|
-
const checkbox = selected.has(index) ? "[
|
|
291
|
+
const checkbox = selected.has(index) ? "[✓]" : "[ ]";
|
|
289
292
|
lines.push(`${pointer} ${checkbox} ${choice.path.padEnd(28, " ")} ${choice.count} skill(s)`);
|
|
293
|
+
for (const leaf of renderSkillLeaves(choice)) {
|
|
294
|
+
lines.push(` - ${leaf}`);
|
|
295
|
+
}
|
|
290
296
|
});
|
|
291
297
|
lines.push("");
|
|
292
298
|
return `${lines.join("\n")}\n`;
|
|
293
299
|
}
|
|
294
300
|
|
|
301
|
+
function renderSkillLeaves(choice) {
|
|
302
|
+
return (choice.skills || []).map((skill) => {
|
|
303
|
+
if (choice.scope === "common") {
|
|
304
|
+
return skill.name;
|
|
305
|
+
}
|
|
306
|
+
const prefix = `skills/domain/${choice.domain}/`;
|
|
307
|
+
if (skill.path.startsWith(prefix)) {
|
|
308
|
+
return skill.path.slice(prefix.length).split("/").join(" / ");
|
|
309
|
+
}
|
|
310
|
+
return skill.name;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
295
314
|
function padRight(value, width) {
|
|
296
315
|
return value.length >= width ? value.slice(0, width) : `${value}${" ".repeat(width - value.length)}`;
|
|
297
316
|
}
|
|
@@ -439,6 +458,7 @@ module.exports = {
|
|
|
439
458
|
renderTelemetry,
|
|
440
459
|
buildRepositoryChoices,
|
|
441
460
|
parseSelection,
|
|
461
|
+
renderRawTuiMenu,
|
|
442
462
|
renderTuiMenu,
|
|
443
463
|
selectSkillsForChoices,
|
|
444
464
|
};
|
package/src/data/manifest.json
CHANGED
|
@@ -144,6 +144,17 @@
|
|
|
144
144
|
"version": "0.1.0",
|
|
145
145
|
"status": "stable",
|
|
146
146
|
"tags": ["arkui", "review"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "ohos-design-graphics-explain-code",
|
|
150
|
+
"scope": "domain",
|
|
151
|
+
"domain": "graphics",
|
|
152
|
+
"stage": "design",
|
|
153
|
+
"path": "skills/domain/graphics/design/ohos-design-graphics-explain-code",
|
|
154
|
+
"description": "Use when explaining OpenHarmony graphics design code.",
|
|
155
|
+
"version": "0.1.0",
|
|
156
|
+
"status": "stable",
|
|
157
|
+
"tags": ["graphics", "design"]
|
|
147
158
|
}
|
|
148
159
|
]
|
|
149
160
|
}
|