my-patina 0.4.0 → 0.5.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/cli.js +21 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -242,6 +242,23 @@ function touch(targetDir, relativePath) {
|
|
|
242
242
|
mkdirSync2(dirname3(full), { recursive: true });
|
|
243
243
|
writeFileSync3(full, "", "utf8");
|
|
244
244
|
}
|
|
245
|
+
var MANIFEST_REQUIRED_FIELDS = ["name", "label", "reflect_hook", "description", "installed"];
|
|
246
|
+
function extractFrontmatter(content) {
|
|
247
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
248
|
+
if (!match) return null;
|
|
249
|
+
const parsed = yaml2.load(match[1]);
|
|
250
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
251
|
+
return parsed;
|
|
252
|
+
}
|
|
253
|
+
function validateManifestFrontmatter(moduleName, content) {
|
|
254
|
+
const fm = extractFrontmatter(content);
|
|
255
|
+
if (!fm) throw new Error(`Module "${moduleName}" manifest has missing or unparseable frontmatter`);
|
|
256
|
+
for (const field of MANIFEST_REQUIRED_FIELDS) {
|
|
257
|
+
if (!fm[field]) {
|
|
258
|
+
throw new Error(`Module "${moduleName}" manifest is missing required field "${field}"`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
245
262
|
function profileToVars(profile, liProfileUrl) {
|
|
246
263
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
247
264
|
return {
|
|
@@ -329,6 +346,10 @@ async function scaffold(opts) {
|
|
|
329
346
|
...baseManagedFiles(vars, editor, targetDir),
|
|
330
347
|
...modules.flatMap((m) => moduleManagedFiles(m, vars))
|
|
331
348
|
];
|
|
349
|
+
for (const module of modules) {
|
|
350
|
+
const manifestEntry = managedFiles.find(([p2]) => p2 === `.claude/modules/${module}/manifest.md`);
|
|
351
|
+
if (manifestEntry) validateManifestFrontmatter(module, manifestEntry[1]);
|
|
352
|
+
}
|
|
332
353
|
for (const [relativePath, content] of managedFiles) {
|
|
333
354
|
const { checksum } = writeManagedFile(targetDir, relativePath, content, {});
|
|
334
355
|
checksums[relativePath] = checksum;
|