@rayul/kordis 0.1.11 → 0.1.13
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/index.js +23 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1361,8 +1361,10 @@ function parseFrontmatter(source) {
|
|
|
1361
1361
|
try {
|
|
1362
1362
|
parsed = parseYaml(raw);
|
|
1363
1363
|
} catch (err) {
|
|
1364
|
+
const msg = err.message;
|
|
1365
|
+
const hint = msg.includes("Nested mapping") || msg.includes("compact mapping") ? ' Hint: if a field value (e.g. description) contains a colon, wrap the entire value in quotes: description: "Use when... Trigger: X".' : "";
|
|
1364
1366
|
throw new FrontmatterParseError(
|
|
1365
|
-
`YAML frontmatter is malformed: ${
|
|
1367
|
+
`YAML frontmatter is malformed: ${msg}${hint}`,
|
|
1366
1368
|
{ cause: err }
|
|
1367
1369
|
);
|
|
1368
1370
|
}
|
|
@@ -1401,11 +1403,21 @@ function pushCommand() {
|
|
|
1401
1403
|
let assets = [];
|
|
1402
1404
|
if (s.isDirectory()) {
|
|
1403
1405
|
({ content, assets } = await bundleDirectory(abs));
|
|
1406
|
+
content = ensureTypeField(content, "skill");
|
|
1404
1407
|
} else if (abs.endsWith(".skill")) {
|
|
1405
1408
|
({ content, assets } = await bundleSkillZip(abs));
|
|
1409
|
+
content = ensureTypeField(content, "skill");
|
|
1406
1410
|
} else {
|
|
1407
1411
|
content = await readFile3(abs, "utf8");
|
|
1408
1412
|
}
|
|
1413
|
+
let nameFromFm = null;
|
|
1414
|
+
try {
|
|
1415
|
+
const fm = parseFrontmatter(content).frontmatter ?? {};
|
|
1416
|
+
const v = fm["name"];
|
|
1417
|
+
if (typeof v === "string") nameFromFm = v;
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
throw new Error(err.message);
|
|
1420
|
+
}
|
|
1409
1421
|
let targetUser = null;
|
|
1410
1422
|
let targetSlug = null;
|
|
1411
1423
|
if (opts.slug && opts.slug.includes("/")) {
|
|
@@ -1415,13 +1427,6 @@ function pushCommand() {
|
|
|
1415
1427
|
targetSlug = s2;
|
|
1416
1428
|
}
|
|
1417
1429
|
} else {
|
|
1418
|
-
let nameFromFm = null;
|
|
1419
|
-
try {
|
|
1420
|
-
const fm = parseFrontmatter(content).frontmatter ?? {};
|
|
1421
|
-
const v = fm["name"];
|
|
1422
|
-
if (typeof v === "string") nameFromFm = v;
|
|
1423
|
-
} catch {
|
|
1424
|
-
}
|
|
1425
1430
|
if (bundle.username && (opts.slug || nameFromFm)) {
|
|
1426
1431
|
targetUser = bundle.username;
|
|
1427
1432
|
targetSlug = opts.slug ?? nameFromFm;
|
|
@@ -1489,6 +1494,16 @@ function pushCommand() {
|
|
|
1489
1494
|
}
|
|
1490
1495
|
);
|
|
1491
1496
|
}
|
|
1497
|
+
function ensureTypeField(content, defaultType) {
|
|
1498
|
+
const fmMatch = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
|
|
1499
|
+
if (!fmMatch) return content;
|
|
1500
|
+
const fmBlock = fmMatch[1];
|
|
1501
|
+
if (/^type\s*:/m.test(fmBlock)) return content;
|
|
1502
|
+
const injected = fmMatch[0].replace(/^---\r?\n/, `---
|
|
1503
|
+
type: ${defaultType}
|
|
1504
|
+
`);
|
|
1505
|
+
return content.replace(fmMatch[0], injected);
|
|
1506
|
+
}
|
|
1492
1507
|
var EXCLUDE_NAMES = /* @__PURE__ */ new Set([".DS_Store", "Thumbs.db", ".gitkeep"]);
|
|
1493
1508
|
var EXCLUDE_DIRS = /* @__PURE__ */ new Set(["__pycache__", "node_modules", ".git", "evals", "dist", ".turbo"]);
|
|
1494
1509
|
var EXCLUDE_EXTS = /* @__PURE__ */ new Set([".pyc", ".pyo", ".rbc"]);
|