@solidactions/cli 1.26.0 → 1.27.0
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.
|
@@ -56,6 +56,7 @@ async function rolePushWithConfig(dir, options, config) {
|
|
|
56
56
|
let body;
|
|
57
57
|
try {
|
|
58
58
|
({ name, description, properties, body } = (0, skill_push_1.parseSkillFile)(skillMdContent));
|
|
59
|
+
(0, skill_push_1.assertNoReservedFrontmatterKeys)(properties);
|
|
59
60
|
}
|
|
60
61
|
catch (e) {
|
|
61
62
|
process.stderr.write(chalk_1.default.red(`error: ${e.message}\n`));
|
|
@@ -99,14 +100,15 @@ async function rolePushWithConfig(dir, options, config) {
|
|
|
99
100
|
}
|
|
100
101
|
// Upsert: try create first; on name_collision switch to edit.
|
|
101
102
|
// Roles carry NO references — do not send references key.
|
|
103
|
+
// Frontmatter extras are spread FIRST so the fixed protocol keys always win.
|
|
102
104
|
let result;
|
|
103
105
|
try {
|
|
104
106
|
result = await (0, mcp_1.callCrewsTool)(config, 'roles', {
|
|
107
|
+
...properties,
|
|
105
108
|
action: 'create',
|
|
106
109
|
name,
|
|
107
110
|
description,
|
|
108
111
|
body,
|
|
109
|
-
properties,
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
114
|
catch (e) {
|
|
@@ -114,15 +116,15 @@ async function rolePushWithConfig(dir, options, config) {
|
|
|
114
116
|
process.exit(1);
|
|
115
117
|
}
|
|
116
118
|
// On name collision, switch to the edit path.
|
|
117
|
-
// Roles edit uses 'name' (NOT 'identifier')
|
|
119
|
+
// Roles edit uses 'name' (NOT 'identifier').
|
|
118
120
|
if (!result.ok && result.data?.code === 'name_collision') {
|
|
119
121
|
try {
|
|
120
122
|
result = await (0, mcp_1.callCrewsTool)(config, 'roles', {
|
|
123
|
+
...properties,
|
|
121
124
|
action: 'edit',
|
|
122
125
|
name,
|
|
123
126
|
description,
|
|
124
127
|
body,
|
|
125
|
-
properties_patch: properties,
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
catch (e) {
|
|
@@ -13,6 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.RESERVED_PARAM_KEYS = void 0;
|
|
17
|
+
exports.assertNoReservedFrontmatterKeys = assertNoReservedFrontmatterKeys;
|
|
16
18
|
exports.parseSkillFile = parseSkillFile;
|
|
17
19
|
exports.readReferences = readReferences;
|
|
18
20
|
exports.readSkillDir = readSkillDir;
|
|
@@ -26,6 +28,22 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
26
28
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
27
29
|
const api_1 = require("../utils/api");
|
|
28
30
|
const mcp_1 = require("../utils/mcp");
|
|
31
|
+
/**
|
|
32
|
+
* Protocol param names reserved by the skills/roles MCP tool actions. Frontmatter
|
|
33
|
+
* keys that collide with these would silently corrupt the request once spread
|
|
34
|
+
* top-level into the call arguments.
|
|
35
|
+
*/
|
|
36
|
+
exports.RESERVED_PARAM_KEYS = ['action', 'identifier', 'role', 'name', 'description', 'body', 'references', 'base_version_id'];
|
|
37
|
+
/**
|
|
38
|
+
* Throws if any frontmatter-derived property key collides with a reserved
|
|
39
|
+
* protocol param name.
|
|
40
|
+
*/
|
|
41
|
+
function assertNoReservedFrontmatterKeys(properties) {
|
|
42
|
+
const offending = Object.keys(properties).filter((key) => exports.RESERVED_PARAM_KEYS.includes(key));
|
|
43
|
+
if (offending.length > 0) {
|
|
44
|
+
throw new Error(`SKILL.md frontmatter contains reserved key(s) that would collide with protocol params: ${offending.join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
29
47
|
/**
|
|
30
48
|
* Parse a SKILL.md file that begins with a YAML frontmatter block.
|
|
31
49
|
*
|
|
@@ -177,6 +195,7 @@ function parseCommandFile(filename, content) {
|
|
|
177
195
|
*/
|
|
178
196
|
async function pushParsedSkill(payload, options, config) {
|
|
179
197
|
const { name, description, properties, body, references } = payload;
|
|
198
|
+
assertNoReservedFrontmatterKeys(properties);
|
|
180
199
|
const isRole = !!options.role;
|
|
181
200
|
const tool = isRole ? 'roles' : 'skills';
|
|
182
201
|
// --dry-run: pre-flight a read to detect existence; make NO create/edit calls.
|
|
@@ -207,9 +226,10 @@ async function pushParsedSkill(payload, options, config) {
|
|
|
207
226
|
// Read succeeded → skill exists → would update
|
|
208
227
|
return { status: 'would-update', name, data: {} };
|
|
209
228
|
}
|
|
229
|
+
// Spread frontmatter extras FIRST so the fixed protocol keys always win.
|
|
210
230
|
const createArgs = isRole
|
|
211
|
-
? { action: 'create_skill', role: options.role, name, description, body,
|
|
212
|
-
: { action: 'create', name, description, body,
|
|
231
|
+
? { ...properties, action: 'create_skill', role: options.role, name, description, body, references }
|
|
232
|
+
: { ...properties, action: 'create', name, description, body, references };
|
|
213
233
|
let result;
|
|
214
234
|
try {
|
|
215
235
|
result = await (0, mcp_1.callCrewsTool)(config, tool, createArgs);
|
|
@@ -217,11 +237,11 @@ async function pushParsedSkill(payload, options, config) {
|
|
|
217
237
|
catch (e) {
|
|
218
238
|
throw new Error(`${e.message}`);
|
|
219
239
|
}
|
|
220
|
-
// On name collision, switch to the edit path.
|
|
240
|
+
// On name collision, switch to the edit path.
|
|
221
241
|
if (!result.ok && result.data?.code === 'name_collision') {
|
|
222
242
|
const editArgs = isRole
|
|
223
|
-
? { action: 'edit_skill', role: options.role, name, description, body,
|
|
224
|
-
: { action: 'edit', identifier: name, description, body,
|
|
243
|
+
? { ...properties, action: 'edit_skill', role: options.role, name, description, body, references }
|
|
244
|
+
: { ...properties, action: 'edit', identifier: name, description, body, references };
|
|
225
245
|
try {
|
|
226
246
|
result = await (0, mcp_1.callCrewsTool)(config, tool, editArgs);
|
|
227
247
|
}
|