forgecraft 1.1.0 → 1.3.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/index.js CHANGED
@@ -5,15 +5,19 @@ import {
5
5
  Orchestrator,
6
6
  Pipeline,
7
7
  Worker,
8
+ buildAttachmentPrompt,
9
+ formatAttachmentList,
8
10
  getAdapter,
9
11
  listAdapters,
10
12
  loadAndValidateConfig,
13
+ parseAttachments,
14
+ stageAttachments,
11
15
  stateManager
12
- } from "../chunk-WXVO3XYN.js";
16
+ } from "../chunk-YP5E2NQR.js";
13
17
 
14
18
  // src/cli/index.ts
15
19
  import { Command } from "commander";
16
- import chalk20 from "chalk";
20
+ import chalk21 from "chalk";
17
21
 
18
22
  // src/cli/commands/init.ts
19
23
  import fs from "fs/promises";
@@ -435,11 +439,20 @@ async function fixCommand(description, options) {
435
439
  `));
436
440
  return;
437
441
  }
442
+ const parsed = parseAttachments(description);
443
+ if (parsed.attachments.length > 0) {
444
+ description = parsed.description;
445
+ stageAttachments(parsed.attachments);
446
+ }
438
447
  console.log(chalk8.bold("\n forge fix\n"));
439
448
  console.log(chalk8.dim(` "${description}"`));
440
449
  if (options?.image) {
441
450
  console.log(chalk8.dim(` image: ${options.image}`));
442
451
  }
452
+ if (parsed.attachments.length > 0) {
453
+ console.log(chalk8.dim("\n Attachments:"));
454
+ console.log(chalk8.cyan(formatAttachmentList(parsed.attachments)));
455
+ }
443
456
  console.log("");
444
457
  const orchestrator = new Orchestrator(config);
445
458
  const worker = new Worker(config, {});
@@ -472,6 +485,9 @@ async function fixCommand(description, options) {
472
485
  A screenshot has been saved at: ${options.image}
473
486
  Read this image file to see the visual issue the user is referring to.`;
474
487
  }
488
+ if (parsed.attachments.length > 0) {
489
+ fixPrompt += "\n" + buildAttachmentPrompt(parsed.attachments);
490
+ }
475
491
  const result = await worker.run(mode, fixPrompt, {
476
492
  onProgress: (event) => {
477
493
  if (event.type === "tool_use") {
@@ -646,7 +662,8 @@ import { homedir } from "os";
646
662
  import path3 from "path";
647
663
  function checkClaudeAuth() {
648
664
  try {
649
- execSync("which claude", { stdio: "ignore" });
665
+ const finder = process.platform === "win32" ? "where" : "which";
666
+ execSync(`${finder} claude`, { stdio: "ignore" });
650
667
  } catch {
651
668
  return { ok: false, reason: "Claude Code CLI is not installed." };
652
669
  }
@@ -682,6 +699,7 @@ async function autoCommand(description, options) {
682
699
  const adapter = getAdapter(config.framework);
683
700
  const skipDesign = options.skipDesign || !adapter.designSupport;
684
701
  if (!description) {
702
+ console.log(chalk10.dim(" Tip: drag & drop files here to attach references\n"));
685
703
  const { desc } = await inquirer5.prompt([
686
704
  {
687
705
  type: "input",
@@ -692,6 +710,16 @@ async function autoCommand(description, options) {
692
710
  ]);
693
711
  description = desc;
694
712
  }
713
+ const parsed = parseAttachments(description);
714
+ let attachments = [];
715
+ if (parsed.attachments.length > 0) {
716
+ attachments = parsed.attachments;
717
+ description = parsed.description;
718
+ stageAttachments(attachments);
719
+ console.log(chalk10.dim("\n Attachments:"));
720
+ console.log(chalk10.cyan(formatAttachmentList(attachments)));
721
+ console.log("");
722
+ }
695
723
  const allowedDomains = options.allowNetwork ? options.allowNetwork.split(",").map((d) => d.trim()) : void 0;
696
724
  const pipeline = new AutoPipeline(config, {
697
725
  sandbox: options.sandbox !== false,
@@ -700,7 +728,8 @@ async function autoCommand(description, options) {
700
728
  mute: options.mute ?? false,
701
729
  deploy: options.deploy ?? false,
702
730
  skipDesign,
703
- allowedDomains
731
+ allowedDomains,
732
+ attachments
704
733
  });
705
734
  const result = await pipeline.run(description);
706
735
  if (!result.success) {
@@ -954,7 +983,8 @@ import { homedir as homedir2 } from "os";
954
983
  import path4 from "path";
955
984
  function checkCommand(cmd) {
956
985
  try {
957
- execSync2(`which ${cmd}`, { stdio: "ignore" });
986
+ const finder = process.platform === "win32" ? "where" : "which";
987
+ execSync2(`${finder} ${cmd}`, { stdio: "ignore" });
958
988
  return true;
959
989
  } catch {
960
990
  return false;
@@ -1405,11 +1435,66 @@ async function pushCommand() {
1405
1435
  }
1406
1436
  }
1407
1437
 
1438
+ // src/cli/commands/upgrade.ts
1439
+ import chalk20 from "chalk";
1440
+ import ora5 from "ora";
1441
+ import { execSync as execSync3 } from "child_process";
1442
+ async function upgradeCommand() {
1443
+ const currentVersion = getCurrentVersion();
1444
+ console.log(chalk20.bold("\n forge") + chalk20.dim(" upgrade\n"));
1445
+ const checkSpinner = ora5({ text: "Checking for updates...", indent: 2 }).start();
1446
+ let latestVersion;
1447
+ try {
1448
+ latestVersion = execSync3("npm view forgecraft version", { encoding: "utf-8" }).trim();
1449
+ } catch {
1450
+ checkSpinner.fail("Could not check for updates");
1451
+ console.log(chalk20.dim(" Check your internet connection and try again.\n"));
1452
+ return;
1453
+ }
1454
+ if (currentVersion === latestVersion) {
1455
+ checkSpinner.succeed(`Already on latest version (${currentVersion})`);
1456
+ console.log("");
1457
+ return;
1458
+ }
1459
+ checkSpinner.succeed(`Update available: ${chalk20.dim(currentVersion)} \u2192 ${chalk20.green(latestVersion)}`);
1460
+ const upgradeSpinner = ora5({ text: `Installing forgecraft@${latestVersion}...`, indent: 2 }).start();
1461
+ try {
1462
+ execSync3("npm install -g forgecraft@latest", {
1463
+ stdio: "pipe",
1464
+ encoding: "utf-8"
1465
+ });
1466
+ upgradeSpinner.succeed(`Upgraded to ${chalk20.green(latestVersion)}`);
1467
+ console.log(chalk20.dim(`
1468
+ Run ${chalk20.white("forge --version")} to verify.
1469
+ `));
1470
+ } catch (err) {
1471
+ upgradeSpinner.fail("Upgrade failed");
1472
+ const msg = err instanceof Error ? err.stderr || err.message : String(err);
1473
+ if (msg.includes("EACCES") || msg.includes("permission")) {
1474
+ console.log(chalk20.dim(" Try running with sudo:\n"));
1475
+ console.log(chalk20.white(" sudo npm install -g forgecraft@latest\n"));
1476
+ } else {
1477
+ console.log(chalk20.dim(` ${msg.split("\n")[0]}
1478
+ `));
1479
+ console.log(chalk20.dim(" Manual upgrade:\n"));
1480
+ console.log(chalk20.white(" npm install -g forgecraft@latest\n"));
1481
+ }
1482
+ }
1483
+ }
1484
+ function getCurrentVersion() {
1485
+ try {
1486
+ const output = execSync3("forge --version", { encoding: "utf-8" }).trim();
1487
+ return output;
1488
+ } catch {
1489
+ return "unknown";
1490
+ }
1491
+ }
1492
+
1408
1493
  // src/cli/index.ts
1409
1494
  var program = new Command();
1410
1495
  program.name("forge").description(
1411
- chalk20.bold("Forge") + " \u2014 AI Development Orchestration Framework\n Structured multi-agent pipeline: plan \u2192 design \u2192 build \u2192 review"
1412
- ).version("1.0.0");
1496
+ chalk21.bold("Forge") + " \u2014 AI Development Orchestration Framework\n Structured multi-agent pipeline: plan \u2192 design \u2192 build \u2192 review"
1497
+ ).version("1.3.0");
1413
1498
  program.command("auto [description]").description("Fully autonomous mode \u2014 plan, build, and review in one command").option("--no-sandbox", "Disable sandbox (not recommended)").option("-y, --yes", "Skip all confirmation prompts (auto-approve everything)").option("-q, --quiet", "Hide live agent output, show spinners only").option("--allow-network <domains>", "Comma-separated allowed network domains").option("--mute", "Suppress notification sounds").option("--deploy", "Configure GitHub Pages deployment after build").option("--skip-design", "Skip design phase (faster, no Storybook previews)").action(autoCommand);
1414
1499
  program.command("resume").description("Resume an interrupted sprint from where it left off").option("--no-sandbox", "Disable sandbox").option("-y, --yes", "Skip all confirmation prompts (auto-approve everything)").option("-q, --quiet", "Spinners only").option("--mute", "Suppress sounds").option("--skip-design", "Skip design phase").action(resumeCommand);
1415
1500
  program.command("sprint [description]").description("Run full pipeline with human gates between phases").action(sprintCommand);
@@ -1430,5 +1515,6 @@ program.command("checkout <version>").description("Jump to a specific version or
1430
1515
  program.command("export").description("Export sprint plan as markdown").option("-o, --output <path>", "Output file path", "sprint-plan.md").action(exportCommand);
1431
1516
  program.command("clean").description("Reset sprint state (keeps config)").option("-f, --force", "Skip confirmation prompt").option("--snapshots", "Only clean snapshots").action(cleanCommand);
1432
1517
  program.command("doctor").description("Diagnose setup issues and check system requirements").action(doctorCommand);
1518
+ program.command("upgrade").description("Upgrade Forge to the latest version").action(upgradeCommand);
1433
1519
  program.parse();
1434
1520
  //# sourceMappingURL=index.js.map