@4pm/cli 1.11.0 → 1.12.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 +19 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37623,8 +37623,20 @@ async function writeTemplateMarker(target) {
|
|
|
37623
37623
|
const marker = { templateVersion: PROJECT_TEMPLATE.version, scaffoldedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
37624
37624
|
await writeFile(join6(dir2, ".4pm.json"), JSON.stringify(marker, null, 2) + "\n", "utf8");
|
|
37625
37625
|
}
|
|
37626
|
+
function readSpecField(spec, key) {
|
|
37627
|
+
const fields = spec.fields;
|
|
37628
|
+
if (Array.isArray(fields)) {
|
|
37629
|
+
const f2 = fields.find(
|
|
37630
|
+
(x) => !!x && typeof x.id === "string" && x.id === key
|
|
37631
|
+
);
|
|
37632
|
+
if (f2 && typeof f2.value === "string") return f2.value;
|
|
37633
|
+
}
|
|
37634
|
+
return typeof spec[key] === "string" ? spec[key] : "";
|
|
37635
|
+
}
|
|
37626
37636
|
async function aiInit(target, spec, emit) {
|
|
37627
|
-
|
|
37637
|
+
const guideFile = readSpecField(spec, "ai_guide_file") === "AGENT.md" ? "AGENT.md" : "CLAUDE.md";
|
|
37638
|
+
const guideInstructions = readSpecField(spec, "ai_guide_instructions").trim();
|
|
37639
|
+
emit("ai-init", `AI init: subagents, README, ${guideFile}\u2026`);
|
|
37628
37640
|
const subagents = Array.isArray(spec.subagents) ? spec.subagents : [];
|
|
37629
37641
|
if (subagents.length > 0) {
|
|
37630
37642
|
await mkdir(join6(target, ".claude", "agents"), { recursive: true });
|
|
@@ -37647,14 +37659,12 @@ ${(sa.description || "").trim()}
|
|
|
37647
37659
|
${specJson}`
|
|
37648
37660
|
);
|
|
37649
37661
|
await generateFile(
|
|
37650
|
-
join6(target,
|
|
37651
|
-
`Write a
|
|
37652
|
-
${specJson}`
|
|
37653
|
-
|
|
37654
|
-
|
|
37655
|
-
|
|
37656
|
-
`Write an AGENT.md (Markdown only, no preamble) with guidance/conventions for AI agents working in this project, derived from its spec JSON:
|
|
37657
|
-
${specJson}`
|
|
37662
|
+
join6(target, guideFile),
|
|
37663
|
+
`Write a ${guideFile} (Markdown only, no preamble) with guidance/conventions for AI agents working in this project, derived from its spec JSON:
|
|
37664
|
+
${specJson}` + (guideInstructions ? `
|
|
37665
|
+
Also incorporate these additional instructions/content:
|
|
37666
|
+
${guideInstructions}
|
|
37667
|
+
` : "")
|
|
37658
37668
|
);
|
|
37659
37669
|
}
|
|
37660
37670
|
async function generateFile(path, prompt) {
|