@shell-shock/plugin-skills 0.0.13 → 0.0.14
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/dist/components/index.cjs +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/components/skills-command.cjs +2 -161
- package/dist/components/skills-command.d.cts +1 -3
- package/dist/components/skills-command.d.cts.map +1 -1
- package/dist/components/skills-command.d.mts +1 -3
- package/dist/components/skills-command.mjs +2 -162
- package/dist/generator.cjs +33 -0
- package/dist/generator.d.cts +13 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +13 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +32 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +3 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +8 -7
- package/dist/skills-command-D0Vw8Cqu.cjs +223 -0
- package/dist/skills-command-DhY1RjBq.mjs +219 -0
- package/dist/skills-command-DhY1RjBq.mjs.map +1 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/plugin.d.cts +0 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +0 -1
- package/package.json +28 -12
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/components/skills-command.mjs.map +0 -1
- package/dist/helpers/constants.cjs +0 -60
- package/dist/helpers/constants.mjs +0 -59
- package/dist/helpers/constants.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_skills_command = require('../skills-command-D0Vw8Cqu.cjs');
|
|
3
3
|
|
|
4
|
-
exports.SkillsCommand =
|
|
4
|
+
exports.SkillsCommand = require_skills_command.SkillsCommand;
|
|
@@ -1,163 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
-
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
5
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
6
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
11
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
2
|
+
const require_skills_command = require('../skills-command-D0Vw8Cqu.cjs');
|
|
12
3
|
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The Skills command's handler wrapper for the Shell Shock project.
|
|
16
|
-
*/
|
|
17
|
-
function SkillsCommand({ skills }) {
|
|
18
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
20
|
-
get path() {
|
|
21
|
-
return (0, _stryke_path_join.joinPaths)(context.entryPath, "skills", "command.ts");
|
|
22
|
-
},
|
|
23
|
-
imports: {
|
|
24
|
-
"node:fs/promises": ["mkdir", "writeFile"],
|
|
25
|
-
"node:path": [
|
|
26
|
-
"dirname",
|
|
27
|
-
"join",
|
|
28
|
-
"resolve"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
builtinImports: {
|
|
32
|
-
console: [
|
|
33
|
-
"bold",
|
|
34
|
-
"writeLine",
|
|
35
|
-
"body",
|
|
36
|
-
"warn"
|
|
37
|
-
],
|
|
38
|
-
prompts: ["multiselect", "isCancel"]
|
|
39
|
-
},
|
|
40
|
-
get children() {
|
|
41
|
-
return [
|
|
42
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`const AGENT_SKILL_DIR: Record<string, string> = ${JSON.stringify(require_constants.AGENT_SKILL_DIRS, null, 2)};`),
|
|
43
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
44
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
45
|
-
get heading() {
|
|
46
|
-
return `This command adds agent skills for the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} commands to the current repository.`;
|
|
47
|
-
},
|
|
48
|
-
get children() {
|
|
49
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
50
|
-
name: "agents",
|
|
51
|
-
children: "An array of agent names to add skills for. If not provided, the user will be prompted to select one or more agents."
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
56
|
-
"export": true,
|
|
57
|
-
"default": true,
|
|
58
|
-
async: true,
|
|
59
|
-
name: "handler",
|
|
60
|
-
get parameters() {
|
|
61
|
-
return [{
|
|
62
|
-
name: "agents",
|
|
63
|
-
type: `(${Object.values(require_constants.AGENT_SKILL_NAMES).map((name) => JSON.stringify(name)).join(" | ")})[]`,
|
|
64
|
-
default: "[]"
|
|
65
|
-
}];
|
|
66
|
-
},
|
|
67
|
-
get children() {
|
|
68
|
-
return [
|
|
69
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(bold(body("Adding ${Object.keys(skills).length} ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} skills to the repository...")));
|
|
70
|
-
|
|
71
|
-
const validAgents = [ ${Object.values(require_constants.AGENT_SKILL_NAMES).map((name) => JSON.stringify(name)).join(", ")} ];
|
|
72
|
-
let targetAgents: string[];
|
|
73
|
-
|
|
74
|
-
if (agents.includes("*")) {
|
|
75
|
-
targetAgents = validAgents;
|
|
76
|
-
} else if (agents.length > 0) {
|
|
77
|
-
const invalidAgents = agents.filter(agent => !validAgents.includes(agent));
|
|
78
|
-
if (invalidAgents.length > 0) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
\`\${invalidAgents.length} invalid agent\${invalidAgents.length > 1 ? "s" : ""} \${invalidAgents.length > 1 ? "were" : "was"} provided: \${invalidAgents.join(", ")}. Please only provide agent types from the following list: \${validAgents.join(", ")}.\`
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
targetAgents = agents;
|
|
85
|
-
} else {
|
|
86
|
-
const selectedAgents = await multiselect({
|
|
87
|
-
message: "Select agents to install skills for",
|
|
88
|
-
required: true,
|
|
89
|
-
options: [
|
|
90
|
-
${Object.entries(require_constants.AGENT_SKILL_NAMES).map(([agentKey, agentName]) => _alloy_js_core.code`{
|
|
91
|
-
value: ${JSON.stringify(agentKey)},
|
|
92
|
-
label: ${JSON.stringify(agentName)},
|
|
93
|
-
description: ${JSON.stringify(require_constants.AGENT_SKILL_DIRS[agentKey] || ".agents/skills")}
|
|
94
|
-
}`)}
|
|
95
|
-
]
|
|
96
|
-
});
|
|
97
|
-
if (isCancel(selectedAgents)) {
|
|
98
|
-
writeLine(body("Skills installation was cancelled."));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (selectedAgents.length === 0) {
|
|
103
|
-
warn("No agents were selected, so there is nothing to install.");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const invalidAgents = selectedAgents.filter(agent => !validAgents.includes(agent));
|
|
108
|
-
if (invalidAgents.length > 0) {
|
|
109
|
-
throw new Error(
|
|
110
|
-
\`\${invalidAgents.length} invalid agent\${invalidAgents.length > 1 ? "s" : ""} \${invalidAgents.length > 1 ? "were" : "was"} provided: \${invalidAgents.join(", ")}. Please only provide agent types from the following list: \${validAgents.join(", ")}.\`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
targetAgents = selectedAgents;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const isPathSafe = (basePath: string, targetPath: string): boolean => {
|
|
118
|
-
const resolvedBase = resolve(basePath);
|
|
119
|
-
const resolvedTarget = resolve(targetPath);
|
|
120
|
-
return (
|
|
121
|
-
resolvedTarget === resolvedBase ||
|
|
122
|
-
resolvedTarget.startsWith(resolvedBase + "/")
|
|
123
|
-
);
|
|
124
|
-
};`),
|
|
125
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
126
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
127
|
-
get each() {
|
|
128
|
-
return Object.entries(skills);
|
|
129
|
-
},
|
|
130
|
-
doubleHardline: true,
|
|
131
|
-
children: ([skillName, skillContent]) => _alloy_js_core.code`for (const targetBase of Array.from(new Set(targetAgents.map(agent => join(process.cwd(), AGENT_SKILL_DIRS[agent] || ".agents/skills"))))) {
|
|
132
|
-
const skillDir = join(targetBase, "${skillName.toLowerCase().replace(/\s+/g, "-").replace(/[/\\:\0]/g, "").replace(/^-+|-+$/g, "")}");
|
|
133
|
-
const skillPath = join(skillDir, "SKILL.md");
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
"${skillName.toLowerCase().replace(/\s+/g, "-").replace(/[/\\:\0]/g, "").replace(/^-+|-+$/g, "")}".length > 0 &&
|
|
137
|
-
isPathSafe(targetBase, skillDir) &&
|
|
138
|
-
isPathSafe(skillDir, skillPath)
|
|
139
|
-
) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await mkdir(dirname(skillPath), { recursive: true });
|
|
143
|
-
await writeFile(skillPath, ${JSON.stringify(skillContent)}, "utf8");
|
|
144
|
-
|
|
145
|
-
writeLine(body(\`Added ${skillName} skills to \${skillPath}\`));
|
|
146
|
-
} else {
|
|
147
|
-
warn(\`Skipped adding the "${skillName}" skill due to an invalid skill name. Invalid skill names could lead to an unsafe file path. Skill names must not be empty and cannot contain characters that are not allowed in file paths, such as / \\ : \\0. The skill name will be sanitized by replacing spaces with dashes, removing leading and trailing dashes, and removing any invalid characters. If the resulting skill name is empty or if the resolved skill path is outside of the target base directory, the skill will be skipped for that agent.\`
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
} `
|
|
151
|
-
}),
|
|
152
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
153
|
-
_alloy_js_core.code`writeLine(bold(body("Done!")));`
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
//#endregion
|
|
163
|
-
exports.SkillsCommand = SkillsCommand;
|
|
4
|
+
exports.SkillsCommand = require_skills_command.SkillsCommand;
|
|
@@ -5,9 +5,7 @@ interface SkillsCommandProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* The Skills command's handler wrapper for the Shell Shock project.
|
|
7
7
|
*/
|
|
8
|
-
declare function SkillsCommand({
|
|
9
|
-
skills
|
|
10
|
-
}: SkillsCommandProps): import("@alloy-js/core").Children;
|
|
8
|
+
declare function SkillsCommand({ skills }: SkillsCommandProps): import("@alloy-js/core").Children;
|
|
11
9
|
//#endregion
|
|
12
10
|
export { SkillsCommand, SkillsCommandProps };
|
|
13
11
|
//# sourceMappingURL=skills-command.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-command.d.cts","names":[],"sources":["../../src/components/skills-command.tsx"],"mappings":";UAgCiB
|
|
1
|
+
{"version":3,"file":"skills-command.d.cts","names":[],"sources":["../../src/components/skills-command.tsx"],"mappings":";UAgCiB;EACf,QAAQ;;;;;iBAMM,gBAAgB,UAAU,8CAAkB"}
|
|
@@ -5,9 +5,7 @@ interface SkillsCommandProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* The Skills command's handler wrapper for the Shell Shock project.
|
|
7
7
|
*/
|
|
8
|
-
declare function SkillsCommand({
|
|
9
|
-
skills
|
|
10
|
-
}: SkillsCommandProps): import("@alloy-js/core").Children;
|
|
8
|
+
declare function SkillsCommand({ skills }: SkillsCommandProps): import("@alloy-js/core").Children;
|
|
11
9
|
//#endregion
|
|
12
10
|
export { SkillsCommand, SkillsCommandProps };
|
|
13
11
|
//# sourceMappingURL=skills-command.d.mts.map
|
|
@@ -1,163 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
4
|
-
import { joinPaths } from "@stryke/path/join";
|
|
5
|
-
import { For, code } from "@alloy-js/core";
|
|
6
|
-
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
7
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
9
|
-
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
10
|
-
import { TSDoc, TSDocParam } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
1
|
+
import { t as SkillsCommand } from "../skills-command-DhY1RjBq.mjs";
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The Skills command's handler wrapper for the Shell Shock project.
|
|
15
|
-
*/
|
|
16
|
-
function SkillsCommand({ skills }) {
|
|
17
|
-
const context = usePowerlines();
|
|
18
|
-
return createComponent(TypescriptFile, {
|
|
19
|
-
get path() {
|
|
20
|
-
return joinPaths(context.entryPath, "skills", "command.ts");
|
|
21
|
-
},
|
|
22
|
-
imports: {
|
|
23
|
-
"node:fs/promises": ["mkdir", "writeFile"],
|
|
24
|
-
"node:path": [
|
|
25
|
-
"dirname",
|
|
26
|
-
"join",
|
|
27
|
-
"resolve"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
builtinImports: {
|
|
31
|
-
console: [
|
|
32
|
-
"bold",
|
|
33
|
-
"writeLine",
|
|
34
|
-
"body",
|
|
35
|
-
"warn"
|
|
36
|
-
],
|
|
37
|
-
prompts: ["multiselect", "isCancel"]
|
|
38
|
-
},
|
|
39
|
-
get children() {
|
|
40
|
-
return [
|
|
41
|
-
memo(() => code`const AGENT_SKILL_DIR: Record<string, string> = ${JSON.stringify(AGENT_SKILL_DIRS, null, 2)};`),
|
|
42
|
-
createComponent(Spacing, {}),
|
|
43
|
-
createComponent(TSDoc, {
|
|
44
|
-
get heading() {
|
|
45
|
-
return `This command adds agent skills for the ${getAppTitle(context)} commands to the current repository.`;
|
|
46
|
-
},
|
|
47
|
-
get children() {
|
|
48
|
-
return createComponent(TSDocParam, {
|
|
49
|
-
name: "agents",
|
|
50
|
-
children: "An array of agent names to add skills for. If not provided, the user will be prompted to select one or more agents."
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
createComponent(FunctionDeclaration, {
|
|
55
|
-
"export": true,
|
|
56
|
-
"default": true,
|
|
57
|
-
async: true,
|
|
58
|
-
name: "handler",
|
|
59
|
-
get parameters() {
|
|
60
|
-
return [{
|
|
61
|
-
name: "agents",
|
|
62
|
-
type: `(${Object.values(AGENT_SKILL_NAMES).map((name) => JSON.stringify(name)).join(" | ")})[]`,
|
|
63
|
-
default: "[]"
|
|
64
|
-
}];
|
|
65
|
-
},
|
|
66
|
-
get children() {
|
|
67
|
-
return [
|
|
68
|
-
memo(() => code`writeLine(bold(body("Adding ${Object.keys(skills).length} ${getAppTitle(context)} skills to the repository...")));
|
|
69
|
-
|
|
70
|
-
const validAgents = [ ${Object.values(AGENT_SKILL_NAMES).map((name) => JSON.stringify(name)).join(", ")} ];
|
|
71
|
-
let targetAgents: string[];
|
|
72
|
-
|
|
73
|
-
if (agents.includes("*")) {
|
|
74
|
-
targetAgents = validAgents;
|
|
75
|
-
} else if (agents.length > 0) {
|
|
76
|
-
const invalidAgents = agents.filter(agent => !validAgents.includes(agent));
|
|
77
|
-
if (invalidAgents.length > 0) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
\`\${invalidAgents.length} invalid agent\${invalidAgents.length > 1 ? "s" : ""} \${invalidAgents.length > 1 ? "were" : "was"} provided: \${invalidAgents.join(", ")}. Please only provide agent types from the following list: \${validAgents.join(", ")}.\`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
targetAgents = agents;
|
|
84
|
-
} else {
|
|
85
|
-
const selectedAgents = await multiselect({
|
|
86
|
-
message: "Select agents to install skills for",
|
|
87
|
-
required: true,
|
|
88
|
-
options: [
|
|
89
|
-
${Object.entries(AGENT_SKILL_NAMES).map(([agentKey, agentName]) => code`{
|
|
90
|
-
value: ${JSON.stringify(agentKey)},
|
|
91
|
-
label: ${JSON.stringify(agentName)},
|
|
92
|
-
description: ${JSON.stringify(AGENT_SKILL_DIRS[agentKey] || ".agents/skills")}
|
|
93
|
-
}`)}
|
|
94
|
-
]
|
|
95
|
-
});
|
|
96
|
-
if (isCancel(selectedAgents)) {
|
|
97
|
-
writeLine(body("Skills installation was cancelled."));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (selectedAgents.length === 0) {
|
|
102
|
-
warn("No agents were selected, so there is nothing to install.");
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const invalidAgents = selectedAgents.filter(agent => !validAgents.includes(agent));
|
|
107
|
-
if (invalidAgents.length > 0) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
\`\${invalidAgents.length} invalid agent\${invalidAgents.length > 1 ? "s" : ""} \${invalidAgents.length > 1 ? "were" : "was"} provided: \${invalidAgents.join(", ")}. Please only provide agent types from the following list: \${validAgents.join(", ")}.\`
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
targetAgents = selectedAgents;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const isPathSafe = (basePath: string, targetPath: string): boolean => {
|
|
117
|
-
const resolvedBase = resolve(basePath);
|
|
118
|
-
const resolvedTarget = resolve(targetPath);
|
|
119
|
-
return (
|
|
120
|
-
resolvedTarget === resolvedBase ||
|
|
121
|
-
resolvedTarget.startsWith(resolvedBase + "/")
|
|
122
|
-
);
|
|
123
|
-
};`),
|
|
124
|
-
createComponent(Spacing, {}),
|
|
125
|
-
createComponent(For, {
|
|
126
|
-
get each() {
|
|
127
|
-
return Object.entries(skills);
|
|
128
|
-
},
|
|
129
|
-
doubleHardline: true,
|
|
130
|
-
children: ([skillName, skillContent]) => code`for (const targetBase of Array.from(new Set(targetAgents.map(agent => join(process.cwd(), AGENT_SKILL_DIRS[agent] || ".agents/skills"))))) {
|
|
131
|
-
const skillDir = join(targetBase, "${skillName.toLowerCase().replace(/\s+/g, "-").replace(/[/\\:\0]/g, "").replace(/^-+|-+$/g, "")}");
|
|
132
|
-
const skillPath = join(skillDir, "SKILL.md");
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
"${skillName.toLowerCase().replace(/\s+/g, "-").replace(/[/\\:\0]/g, "").replace(/^-+|-+$/g, "")}".length > 0 &&
|
|
136
|
-
isPathSafe(targetBase, skillDir) &&
|
|
137
|
-
isPathSafe(skillDir, skillPath)
|
|
138
|
-
) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await mkdir(dirname(skillPath), { recursive: true });
|
|
142
|
-
await writeFile(skillPath, ${JSON.stringify(skillContent)}, "utf8");
|
|
143
|
-
|
|
144
|
-
writeLine(body(\`Added ${skillName} skills to \${skillPath}\`));
|
|
145
|
-
} else {
|
|
146
|
-
warn(\`Skipped adding the "${skillName}" skill due to an invalid skill name. Invalid skill names could lead to an unsafe file path. Skill names must not be empty and cannot contain characters that are not allowed in file paths, such as / \\ : \\0. The skill name will be sanitized by replacing spaces with dashes, removing leading and trailing dashes, and removing any invalid characters. If the resulting skill name is empty or if the resolved skill path is outside of the target base directory, the skill will be skipped for that agent.\`
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
} `
|
|
150
|
-
}),
|
|
151
|
-
createComponent(Spacing, {}),
|
|
152
|
-
code`writeLine(bold(body("Done!")));`
|
|
153
|
-
];
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
//#endregion
|
|
162
|
-
export { SkillsCommand };
|
|
163
|
-
//# sourceMappingURL=skills-command.mjs.map
|
|
3
|
+
export { SkillsCommand };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
|
|
3
|
+
|
|
4
|
+
//#region src/generator.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Power Plant generator for Shell Shock skills commands.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Skills content is prepared by the plugin; invoke with a `template` override.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
12
|
+
*/
|
|
13
|
+
const skillsGenerator = (0, _shell_shock_core_helpers_power_plant.defineCommandGenerator)({
|
|
14
|
+
meta: {
|
|
15
|
+
name: "shell-shock-skills",
|
|
16
|
+
title: "Shell Shock Skills Generator",
|
|
17
|
+
description: "Generates the skills command module from the Shell Shock command tree specification.",
|
|
18
|
+
version: "1.0",
|
|
19
|
+
tags: [
|
|
20
|
+
"shell-shock",
|
|
21
|
+
"skills",
|
|
22
|
+
"alloy-js"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
generator: async (_commands, options) => {
|
|
26
|
+
if (!options.template) return;
|
|
27
|
+
await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)(options, options.template);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.default = skillsGenerator;
|
|
33
|
+
exports.skillsGenerator = skillsGenerator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock skills commands.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Skills content is prepared by the plugin; invoke with a `template` override.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
9
|
+
*/
|
|
10
|
+
declare const skillsGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { skillsGenerator as default, skillsGenerator };
|
|
13
|
+
//# sourceMappingURL=generator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.tsx"],"mappings":";;;;;;;;;cA+Ba,6CAAe,sBAAA,6CAAA,wEAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock skills commands.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Skills content is prepared by the plugin; invoke with a `template` override.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
9
|
+
*/
|
|
10
|
+
declare const skillsGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { skillsGenerator as default, skillsGenerator };
|
|
13
|
+
//# sourceMappingURL=generator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.mts","names":[],"sources":["../src/generator.tsx"],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineCommandGenerator, renderCommandTemplate } from "@shell-shock/core/helpers/power-plant";
|
|
2
|
+
|
|
3
|
+
//#region src/generator.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Power Plant generator for Shell Shock skills commands.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Skills content is prepared by the plugin; invoke with a `template` override.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
11
|
+
*/
|
|
12
|
+
const skillsGenerator = defineCommandGenerator({
|
|
13
|
+
meta: {
|
|
14
|
+
name: "shell-shock-skills",
|
|
15
|
+
title: "Shell Shock Skills Generator",
|
|
16
|
+
description: "Generates the skills command module from the Shell Shock command tree specification.",
|
|
17
|
+
version: "1.0",
|
|
18
|
+
tags: [
|
|
19
|
+
"shell-shock",
|
|
20
|
+
"skills",
|
|
21
|
+
"alloy-js"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
generator: async (_commands, options) => {
|
|
25
|
+
if (!options.template) return;
|
|
26
|
+
await renderCommandTemplate(options, options.template);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { skillsGenerator as default, skillsGenerator };
|
|
32
|
+
//# sourceMappingURL=generator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
3
|
-
const require_components_skills_command = require('./components/skills-command.cjs');
|
|
2
|
+
const require_skills_command = require('./skills-command-D0Vw8Cqu.cjs');
|
|
4
3
|
require('./components/index.cjs');
|
|
4
|
+
const require_generator = require('./generator.cjs');
|
|
5
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
-
let
|
|
6
|
+
let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
|
|
7
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
8
|
let _stryke_path_join = require("@stryke/path/join");
|
|
9
9
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
10
10
|
let defu = require("defu");
|
|
11
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
12
11
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
13
12
|
|
|
14
13
|
//#region src/index.tsx
|
|
@@ -20,7 +19,7 @@ const plugin = (options = {}) => {
|
|
|
20
19
|
name: "shell-shock/skills",
|
|
21
20
|
config() {
|
|
22
21
|
this.debug("Providing default configuration for the Shell Shock `skills` plugin.");
|
|
23
|
-
return { skills: (0, defu.
|
|
22
|
+
return { skills: (0, defu.defu)({ command: { name: (0, _stryke_type_checks_is_set_string.isSetString)(options.command) ? options.command : "skills" } }, options) };
|
|
24
23
|
},
|
|
25
24
|
async configResolved() {
|
|
26
25
|
this.debug("Adding the CLI skills commands to the application context.");
|
|
@@ -40,7 +39,7 @@ const plugin = (options = {}) => {
|
|
|
40
39
|
segments: [this.config.skills.command.name],
|
|
41
40
|
title: "Skills",
|
|
42
41
|
icon: "🕶",
|
|
43
|
-
tags: ["
|
|
42
|
+
tags: ["AI"],
|
|
44
43
|
description: `Display the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(this)} skills.`,
|
|
45
44
|
entry: {
|
|
46
45
|
file: (0, _stryke_path_join.joinPaths)(this.entryPath, "skills", "index.ts"),
|
|
@@ -49,14 +48,14 @@ const plugin = (options = {}) => {
|
|
|
49
48
|
virtual: false,
|
|
50
49
|
...this.config.skills.command
|
|
51
50
|
});
|
|
52
|
-
this.debug("Rendering skills command module for the Shell Shock `skills` plugin.");
|
|
51
|
+
this.debug("Rendering skills command module via Power Plant for the Shell Shock `skills` plugin.");
|
|
53
52
|
const skills = await Promise.all(skillFiles.map(async (skillFile) => [skillFile, await this.fs.read(skillFile)])).then((files) => {
|
|
54
53
|
return files.reduce((ret, [skillFile, file]) => {
|
|
55
54
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(skillFile) && (0, _stryke_type_checks_is_set_string.isSetString)(file)) ret[skillFile.replace(/\.[^/.]+$/, "")] = file;
|
|
56
55
|
return ret;
|
|
57
56
|
}, {});
|
|
58
57
|
});
|
|
59
|
-
await (0,
|
|
58
|
+
await (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.default, { template: (0, _alloy_js_core_jsx_runtime.createComponent)(require_skills_command.SkillsCommand, { skills }) });
|
|
60
59
|
} else this.warn(`The skills directory at the resolved path: ${this.config.skills.path} could not be read or is empty. The \`${this.config.skills.command.name}\` command will not be added to the application. Please ensure that the skills directory exists at the specified path and contains valid content.`);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
@@ -65,4 +64,5 @@ const plugin = (options = {}) => {
|
|
|
65
64
|
|
|
66
65
|
//#endregion
|
|
67
66
|
exports.default = plugin;
|
|
68
|
-
exports.plugin = plugin;
|
|
67
|
+
exports.plugin = plugin;
|
|
68
|
+
exports.skillsGenerator = require_generator.default;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import skillsGenerator from "./generator.cjs";
|
|
1
2
|
import { SkillsPluginContext, SkillsPluginOptions, SkillsPluginResolvedConfig, SkillsPluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import "./types/index.cjs";
|
|
2
4
|
import { Plugin } from "powerlines";
|
|
3
|
-
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* The Skills - Shell Shock plugin to add version check functionality and skills commands to a Shell Shock application.
|
|
7
8
|
*/
|
|
8
9
|
declare const plugin: <TContext extends SkillsPluginContext = SkillsPluginContext>(options?: SkillsPluginOptions) => Plugin<TContext>;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { type SkillsPluginContext, type SkillsPluginOptions, type SkillsPluginResolvedConfig, type SkillsPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
export { type SkillsPluginContext, type SkillsPluginOptions, type SkillsPluginResolvedConfig, type SkillsPluginUserConfig, plugin as default, plugin, skillsGenerator };
|
|
11
12
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;;cAmCa,SACX,iBAAiB,sBAAsB,qBAEvC,UAAS,wBACR,OAAO"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import skillsGenerator from "./generator.mjs";
|
|
1
2
|
import { SkillsPluginContext, SkillsPluginOptions, SkillsPluginResolvedConfig, SkillsPluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
2
4
|
import { Plugin } from "powerlines";
|
|
3
|
-
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* The Skills - Shell Shock plugin to add version check functionality and skills commands to a Shell Shock application.
|
|
7
8
|
*/
|
|
8
9
|
declare const plugin: <TContext extends SkillsPluginContext = SkillsPluginContext>(options?: SkillsPluginOptions) => Plugin<TContext>;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { type SkillsPluginContext, type SkillsPluginOptions, type SkillsPluginResolvedConfig, type SkillsPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
export { type SkillsPluginContext, type SkillsPluginOptions, type SkillsPluginResolvedConfig, type SkillsPluginUserConfig, plugin as default, plugin, skillsGenerator };
|
|
11
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { SkillsCommand } from "./
|
|
1
|
+
import { t as SkillsCommand } from "./skills-command-DhY1RjBq.mjs";
|
|
2
2
|
import "./components/index.mjs";
|
|
3
|
+
import skillsGenerator from "./generator.mjs";
|
|
3
4
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import {
|
|
5
|
+
import { executeCommandGenerator } from "@shell-shock/core/helpers/power-plant";
|
|
5
6
|
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
6
7
|
import { joinPaths } from "@stryke/path/join";
|
|
7
8
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
8
|
-
import defu from "defu";
|
|
9
|
+
import { defu } from "defu";
|
|
9
10
|
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
10
11
|
|
|
11
12
|
//#region src/index.tsx
|
|
@@ -37,7 +38,7 @@ const plugin = (options = {}) => {
|
|
|
37
38
|
segments: [this.config.skills.command.name],
|
|
38
39
|
title: "Skills",
|
|
39
40
|
icon: "🕶",
|
|
40
|
-
tags: ["
|
|
41
|
+
tags: ["AI"],
|
|
41
42
|
description: `Display the ${getAppTitle(this)} skills.`,
|
|
42
43
|
entry: {
|
|
43
44
|
file: joinPaths(this.entryPath, "skills", "index.ts"),
|
|
@@ -46,14 +47,14 @@ const plugin = (options = {}) => {
|
|
|
46
47
|
virtual: false,
|
|
47
48
|
...this.config.skills.command
|
|
48
49
|
});
|
|
49
|
-
this.debug("Rendering skills command module for the Shell Shock `skills` plugin.");
|
|
50
|
+
this.debug("Rendering skills command module via Power Plant for the Shell Shock `skills` plugin.");
|
|
50
51
|
const skills = await Promise.all(skillFiles.map(async (skillFile) => [skillFile, await this.fs.read(skillFile)])).then((files) => {
|
|
51
52
|
return files.reduce((ret, [skillFile, file]) => {
|
|
52
53
|
if (isSetString(skillFile) && isSetString(file)) ret[skillFile.replace(/\.[^/.]+$/, "")] = file;
|
|
53
54
|
return ret;
|
|
54
55
|
}, {});
|
|
55
56
|
});
|
|
56
|
-
await
|
|
57
|
+
await executeCommandGenerator(this, skillsGenerator, { template: createComponent(SkillsCommand, { skills }) });
|
|
57
58
|
} else this.warn(`The skills directory at the resolved path: ${this.config.skills.path} could not be read or is empty. The \`${this.config.skills.command.name}\` command will not be added to the application. Please ensure that the skills directory exists at the specified path and contains valid content.`);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -61,5 +62,5 @@ const plugin = (options = {}) => {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
//#endregion
|
|
64
|
-
export { plugin as default, plugin };
|
|
65
|
+
export { plugin as default, plugin, skillsGenerator };
|
|
65
66
|
//# sourceMappingURL=index.mjs.map
|