chiefwiggum 1.3.13 → 1.3.15
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.cjs +77 -23
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -297,7 +297,8 @@ var config = {
|
|
|
297
297
|
get templatesDir() {
|
|
298
298
|
return (0, import_node_path.join)(this.chiefwiggumHome, "templates");
|
|
299
299
|
},
|
|
300
|
-
todoFile: process.env.TODO_FILE || "TODO.md",
|
|
300
|
+
todoFile: process.env.TODO_FILE || "docs/chiefwiggum/TODO.md",
|
|
301
|
+
specsDir: "docs/chiefwiggum/specs",
|
|
301
302
|
// Timing
|
|
302
303
|
cooldownSeconds: parseInt(process.env.COOLDOWN_SECONDS || "5", 10),
|
|
303
304
|
iterationTimeoutMinutes: parseInt(process.env.ITERATION_TIMEOUT_MINUTES || "60", 10),
|
|
@@ -625,6 +626,17 @@ async function cmdLoop() {
|
|
|
625
626
|
var __dirname = (0, import_node_path2.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
626
627
|
var LOCAL_TEMPLATES_DIR = ".chiefwiggum/templates";
|
|
627
628
|
var CONFIG_FILE = ".chiefwiggum/CLAUDE.md";
|
|
629
|
+
function getProjectTracker() {
|
|
630
|
+
if (!(0, import_node_fs3.existsSync)(CONFIG_FILE)) {
|
|
631
|
+
return "todo";
|
|
632
|
+
}
|
|
633
|
+
try {
|
|
634
|
+
const config2 = JSON.parse((0, import_node_fs3.readFileSync)(CONFIG_FILE, "utf-8"));
|
|
635
|
+
return config2.projectTracker || "todo";
|
|
636
|
+
} catch {
|
|
637
|
+
return "todo";
|
|
638
|
+
}
|
|
639
|
+
}
|
|
628
640
|
var BUNDLED_TEMPLATES_DIR = (0, import_node_path2.join)(__dirname, "..", "templates");
|
|
629
641
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
630
642
|
"node_modules",
|
|
@@ -737,8 +749,8 @@ async function cmdNew(planFile) {
|
|
|
737
749
|
}
|
|
738
750
|
async function checkExistingFiles() {
|
|
739
751
|
const existingFiles = [];
|
|
740
|
-
if ((0, import_node_fs3.existsSync)(config.todoFile)) existingFiles.push(
|
|
741
|
-
if ((0, import_node_fs3.existsSync)(
|
|
752
|
+
if ((0, import_node_fs3.existsSync)(config.todoFile)) existingFiles.push(config.todoFile);
|
|
753
|
+
if ((0, import_node_fs3.existsSync)(config.specsDir)) existingFiles.push(`${config.specsDir}/`);
|
|
742
754
|
if (existingFiles.length === 0) {
|
|
743
755
|
return true;
|
|
744
756
|
}
|
|
@@ -844,6 +856,10 @@ ${features}
|
|
|
844
856
|
}
|
|
845
857
|
async function generateFromPlan(planFile) {
|
|
846
858
|
const planContent = (0, import_node_fs3.readFileSync)(planFile, "utf-8");
|
|
859
|
+
const specsDir = config.specsDir;
|
|
860
|
+
const todoFile = config.todoFile;
|
|
861
|
+
const prdPath = `${specsDir}/prd.md`;
|
|
862
|
+
const techPath = `${specsDir}/technical.md`;
|
|
847
863
|
console.log();
|
|
848
864
|
console.log(import_picocolors7.default.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
849
865
|
console.log(import_picocolors7.default.green(` Generating specs from: ${planFile}`));
|
|
@@ -854,13 +870,13 @@ async function generateFromPlan(planFile) {
|
|
|
854
870
|
console.log("Run 'chiefwiggum new' to set up templates first.");
|
|
855
871
|
process.exit(1);
|
|
856
872
|
}
|
|
857
|
-
(0, import_node_fs3.mkdirSync)(
|
|
873
|
+
(0, import_node_fs3.mkdirSync)(specsDir, { recursive: true });
|
|
858
874
|
const prdTemplate = (0, import_node_fs3.readFileSync)(`${LOCAL_TEMPLATES_DIR}/prd-template.md`, "utf-8");
|
|
859
875
|
const techTemplate = (0, import_node_fs3.readFileSync)(`${LOCAL_TEMPLATES_DIR}/technical-template.md`, "utf-8");
|
|
860
876
|
const todoTemplate = (0, import_node_fs3.readFileSync)(`${LOCAL_TEMPLATES_DIR}/TODO-template.md`, "utf-8");
|
|
861
877
|
const claudeTemplate = (0, import_node_fs3.readFileSync)(`${LOCAL_TEMPLATES_DIR}/CLAUDE-template.md`, "utf-8");
|
|
862
878
|
console.log();
|
|
863
|
-
console.log(import_picocolors7.default.yellow(
|
|
879
|
+
console.log(import_picocolors7.default.yellow(`[1/4] Generating ${prdPath}...`));
|
|
864
880
|
const prdPrompt = `You are filling in a PRD template based on a project plan.
|
|
865
881
|
|
|
866
882
|
Here is the plan:
|
|
@@ -875,13 +891,13 @@ ${prdTemplate}
|
|
|
875
891
|
|
|
876
892
|
Fill in the template with specific details from the plan.
|
|
877
893
|
Replace all placeholder text in [brackets] with real content.
|
|
878
|
-
Write the completed PRD directly to
|
|
894
|
+
Write the completed PRD directly to ${prdPath}.
|
|
879
895
|
Do NOT ask questions \u2014 infer everything from the plan.`;
|
|
880
896
|
await runClaude({ prompt: prdPrompt });
|
|
881
|
-
console.log(import_picocolors7.default.green(
|
|
897
|
+
console.log(import_picocolors7.default.green(` \u2713 ${prdPath}`));
|
|
882
898
|
console.log();
|
|
883
|
-
console.log(import_picocolors7.default.yellow(
|
|
884
|
-
const prdGenerated = (0, import_node_fs3.existsSync)(
|
|
899
|
+
console.log(import_picocolors7.default.yellow(`[2/4] Generating ${techPath}...`));
|
|
900
|
+
const prdGenerated = (0, import_node_fs3.existsSync)(prdPath) ? (0, import_node_fs3.readFileSync)(prdPath, "utf-8") : "";
|
|
885
901
|
const techPrompt = `You are filling in a Technical Specification template based on a PRD.
|
|
886
902
|
|
|
887
903
|
Here is the PRD:
|
|
@@ -896,16 +912,16 @@ ${techTemplate}
|
|
|
896
912
|
|
|
897
913
|
Fill in the template with specific technical details.
|
|
898
914
|
Replace all placeholder text in [brackets] with real content.
|
|
899
|
-
Write the completed spec directly to
|
|
915
|
+
Write the completed spec directly to ${techPath}.
|
|
900
916
|
Do NOT ask questions \u2014 infer everything from the PRD.`;
|
|
901
917
|
await runClaude({ prompt: techPrompt });
|
|
902
|
-
console.log(import_picocolors7.default.green(
|
|
918
|
+
console.log(import_picocolors7.default.green(` \u2713 ${techPath}`));
|
|
903
919
|
console.log();
|
|
904
920
|
if ((0, import_node_fs3.existsSync)("CLAUDE.md")) {
|
|
905
921
|
console.log(import_picocolors7.default.yellow("[3/4] Skipping CLAUDE.md (already exists)"));
|
|
906
922
|
} else {
|
|
907
923
|
console.log(import_picocolors7.default.yellow("[3/4] Generating CLAUDE.md..."));
|
|
908
|
-
const techGenerated2 = (0, import_node_fs3.existsSync)(
|
|
924
|
+
const techGenerated2 = (0, import_node_fs3.existsSync)(techPath) ? (0, import_node_fs3.readFileSync)(techPath, "utf-8") : "";
|
|
909
925
|
const claudePrompt = `You are filling in a CLAUDE.md template for a project.
|
|
910
926
|
|
|
911
927
|
Here is the PRD:
|
|
@@ -930,10 +946,42 @@ Write directly to CLAUDE.md.`;
|
|
|
930
946
|
await runClaude({ prompt: claudePrompt });
|
|
931
947
|
console.log(import_picocolors7.default.green(" \u2713 CLAUDE.md"));
|
|
932
948
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
949
|
+
const tracker = getProjectTracker();
|
|
950
|
+
const techGenerated = (0, import_node_fs3.existsSync)(techPath) ? (0, import_node_fs3.readFileSync)(techPath, "utf-8") : "";
|
|
951
|
+
if (tracker === "github") {
|
|
952
|
+
console.log();
|
|
953
|
+
console.log(import_picocolors7.default.yellow("[4/4] Creating GitHub Issues..."));
|
|
954
|
+
const issuesPrompt = `You are creating GitHub Issues based on specs.
|
|
955
|
+
|
|
956
|
+
Here is the PRD:
|
|
957
|
+
<prd>
|
|
958
|
+
${prdGenerated}
|
|
959
|
+
</prd>
|
|
960
|
+
|
|
961
|
+
Here is the Technical Specification:
|
|
962
|
+
<technical>
|
|
963
|
+
${techGenerated}
|
|
964
|
+
</technical>
|
|
965
|
+
|
|
966
|
+
Create GitHub Issues for this project using the gh CLI.
|
|
967
|
+
Break down the work into granular issues (1-2 hours each).
|
|
968
|
+
Group related issues with labels like "phase-1", "phase-2", etc.
|
|
969
|
+
|
|
970
|
+
For each issue, run a command like:
|
|
971
|
+
gh issue create --title "Issue title" --body "Description of the task" --label "phase-1"
|
|
972
|
+
|
|
973
|
+
Create 5-15 issues covering the full implementation.
|
|
974
|
+
Do NOT create a TODO.md file - only create GitHub Issues.`;
|
|
975
|
+
await runClaude({ prompt: issuesPrompt });
|
|
976
|
+
console.log(import_picocolors7.default.green(" \u2713 GitHub Issues created"));
|
|
977
|
+
} else {
|
|
978
|
+
console.log();
|
|
979
|
+
console.log(import_picocolors7.default.yellow(`[4/4] Generating ${todoFile}...`));
|
|
980
|
+
const todoDir = (0, import_node_path2.dirname)(todoFile);
|
|
981
|
+
if (todoDir !== ".") {
|
|
982
|
+
(0, import_node_fs3.mkdirSync)(todoDir, { recursive: true });
|
|
983
|
+
}
|
|
984
|
+
const todoPrompt = `You are filling in a TODO template based on specs.
|
|
937
985
|
|
|
938
986
|
Here is the PRD:
|
|
939
987
|
<prd>
|
|
@@ -954,20 +1002,26 @@ Create a phased TODO.md following the template structure.
|
|
|
954
1002
|
Use checkbox format: - [ ] Task description
|
|
955
1003
|
Keep tasks granular (1-2 hours max each).
|
|
956
1004
|
End each phase with: - [ ] Phase N review
|
|
957
|
-
Write directly to
|
|
958
|
-
|
|
959
|
-
|
|
1005
|
+
Write directly to ${todoFile}.`;
|
|
1006
|
+
await runClaude({ prompt: todoPrompt });
|
|
1007
|
+
console.log(import_picocolors7.default.green(` \u2713 ${todoFile}`));
|
|
1008
|
+
}
|
|
960
1009
|
console.log();
|
|
961
1010
|
console.log(import_picocolors7.default.green("Specs generated:"));
|
|
962
|
-
console.log(
|
|
963
|
-
console.log(
|
|
1011
|
+
console.log(` - ${prdPath}`);
|
|
1012
|
+
console.log(` - ${techPath}`);
|
|
964
1013
|
if (!(0, import_node_fs3.existsSync)("CLAUDE.md")) {
|
|
965
1014
|
console.log(" - CLAUDE.md");
|
|
966
1015
|
}
|
|
967
|
-
|
|
1016
|
+
if (tracker === "github") {
|
|
1017
|
+
console.log(" - GitHub Issues");
|
|
1018
|
+
} else {
|
|
1019
|
+
console.log(` - ${todoFile}`);
|
|
1020
|
+
}
|
|
968
1021
|
try {
|
|
969
1022
|
(0, import_node_child_process6.execSync)("git rev-parse --git-dir", { stdio: "pipe" });
|
|
970
|
-
|
|
1023
|
+
const filesToAdd = tracker === "github" ? `${specsDir}/ CLAUDE.md` : `${specsDir}/ ${todoFile} CLAUDE.md`;
|
|
1024
|
+
(0, import_node_child_process6.execSync)(`git add ${filesToAdd} 2>/dev/null || true`, { stdio: "pipe" });
|
|
971
1025
|
(0, import_node_child_process6.execSync)('git commit -m "chore: generate specs from plan" 2>/dev/null || true', {
|
|
972
1026
|
stdio: "pipe"
|
|
973
1027
|
});
|