@alessandroraffa/tangyr 0.18.0 → 0.19.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.
- package/dist/index.js +53 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32303,6 +32303,14 @@ var FRONTMATTER_REQUIRED_FIELDS = {
|
|
|
32303
32303
|
rules: [],
|
|
32304
32304
|
hooks: ["name", "description", "events"]
|
|
32305
32305
|
};
|
|
32306
|
+
var CANONICAL_SKILL_SUBFOLDERS = [
|
|
32307
|
+
"assets",
|
|
32308
|
+
"references",
|
|
32309
|
+
"schemas",
|
|
32310
|
+
"scripts",
|
|
32311
|
+
"tests",
|
|
32312
|
+
"evals"
|
|
32313
|
+
];
|
|
32306
32314
|
function runValidateCommand(options, logger) {
|
|
32307
32315
|
const { kitInfo } = resolveRuntime(options, import.meta.url);
|
|
32308
32316
|
if (!kitInfo) {
|
|
@@ -32315,16 +32323,26 @@ function runValidateCommand(options, logger) {
|
|
|
32315
32323
|
const result = validateKit(kitInfo);
|
|
32316
32324
|
if (options.json) {
|
|
32317
32325
|
logger.info(JSON.stringify(result, null, 2));
|
|
32318
|
-
} else if (result.conformant) {
|
|
32319
|
-
logger.info(
|
|
32320
|
-
`validate: OK (kit '${kitInfo.name}' conforms to kitFormat ${kitInfo.kitFormat})`
|
|
32321
|
-
);
|
|
32322
32326
|
} else {
|
|
32323
|
-
|
|
32324
|
-
|
|
32325
|
-
|
|
32326
|
-
|
|
32327
|
-
|
|
32327
|
+
if (result.conformant) {
|
|
32328
|
+
logger.info(
|
|
32329
|
+
`validate: OK (kit '${kitInfo.name}' conforms to kitFormat ${kitInfo.kitFormat})`
|
|
32330
|
+
);
|
|
32331
|
+
} else {
|
|
32332
|
+
logger.error(
|
|
32333
|
+
`validate: FAILED (${result.violations.length} violation${result.violations.length === 1 ? "" : "s"})`
|
|
32334
|
+
);
|
|
32335
|
+
for (const v2 of result.violations) {
|
|
32336
|
+
logger.error(` [${v2.code}] ${v2.location}: ${v2.message}`);
|
|
32337
|
+
}
|
|
32338
|
+
}
|
|
32339
|
+
if (result.notices.length > 0) {
|
|
32340
|
+
logger.warn(
|
|
32341
|
+
`validate: ${result.notices.length} notice${result.notices.length === 1 ? "" : "s"} (not violations; the verdict above stands)`
|
|
32342
|
+
);
|
|
32343
|
+
for (const n7 of result.notices) {
|
|
32344
|
+
logger.warn(` [${n7.code}] ${n7.location}: ${n7.message}`);
|
|
32345
|
+
}
|
|
32328
32346
|
}
|
|
32329
32347
|
}
|
|
32330
32348
|
if (!result.conformant) {
|
|
@@ -32343,9 +32361,34 @@ function validateKit(kitInfo) {
|
|
|
32343
32361
|
violations.push(...checkHumanOnlyCommandInvocation(kitInfo));
|
|
32344
32362
|
return {
|
|
32345
32363
|
conformant: violations.length === 0,
|
|
32346
|
-
violations
|
|
32364
|
+
violations,
|
|
32365
|
+
notices: checkSkillSubfolderNames(kitInfo)
|
|
32347
32366
|
};
|
|
32348
32367
|
}
|
|
32368
|
+
function checkSkillSubfolderNames(kit) {
|
|
32369
|
+
const notices = [];
|
|
32370
|
+
const canonical = new Set(CANONICAL_SKILL_SUBFOLDERS);
|
|
32371
|
+
for (const name of kit.components.skills.declared) {
|
|
32372
|
+
const skillDir = path43.join(kit.path, "skills", name);
|
|
32373
|
+
let entries;
|
|
32374
|
+
try {
|
|
32375
|
+
entries = fs42.readdirSync(skillDir, { withFileTypes: true });
|
|
32376
|
+
} catch {
|
|
32377
|
+
continue;
|
|
32378
|
+
}
|
|
32379
|
+
for (const entry of entries) {
|
|
32380
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || canonical.has(entry.name)) {
|
|
32381
|
+
continue;
|
|
32382
|
+
}
|
|
32383
|
+
notices.push({
|
|
32384
|
+
code: "skill-subfolder-unrecognized",
|
|
32385
|
+
location: `skills/${name}/${entry.name}/`,
|
|
32386
|
+
message: `skills: '${name}' contains a subfolder '${entry.name}' that the contract does not enumerate. The recognized names are ${CANONICAL_SKILL_SUBFOLDERS.join(", ")}. This is not a violation, and nothing is rejected: the CLI carries the whole skill folder to local targets either way. It is reported so a convention stays visible rather than drifting silently.`
|
|
32387
|
+
});
|
|
32388
|
+
}
|
|
32389
|
+
}
|
|
32390
|
+
return notices;
|
|
32391
|
+
}
|
|
32349
32392
|
function collect(violations, v2) {
|
|
32350
32393
|
if (v2) violations.push(v2);
|
|
32351
32394
|
}
|