dlw-machine-setup 0.5.12 → 0.5.14

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.
Files changed (2) hide show
  1. package/bin/installer.js +97 -52
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -3780,13 +3780,20 @@ var import_fs3 = require("fs");
3780
3780
  var import_path3 = require("path");
3781
3781
  var import_child_process2 = require("child_process");
3782
3782
  var MIN_FILE_SIZE2 = 1024;
3783
- var FACTORY_ASSET_NAME = "factory.tar.gz";
3783
+ function getFactoryAsset(agent) {
3784
+ switch (agent) {
3785
+ case "github-copilot":
3786
+ return { assetName: "factory-copilot.tar.gz", rootFolder: "factory-copilot" };
3787
+ default:
3788
+ return { assetName: "factory.tar.gz", rootFolder: "factory" };
3789
+ }
3790
+ }
3784
3791
  var fetch_factory_default = defineStep({
3785
3792
  name: "fetch-factory",
3786
3793
  label: "Installing Factory framework",
3787
3794
  when: (ctx) => ctx.config.installFactory && !!ctx.factoryRepo,
3788
3795
  execute: async (ctx) => {
3789
- const result = await fetchFactory(ctx.token, ctx.factoryRepo, ctx.config.projectPath);
3796
+ const result = await fetchFactory(ctx.token, ctx.factoryRepo, ctx.config.projectPath, ctx.config.agent);
3790
3797
  ctx.installed.factoryInstalled = result.success;
3791
3798
  if (!result.success) {
3792
3799
  return { status: "failed", detail: result.failureReason };
@@ -3794,13 +3801,14 @@ var fetch_factory_default = defineStep({
3794
3801
  return { status: "success", message: result.filesInstalled.join(", ") };
3795
3802
  }
3796
3803
  });
3797
- async function fetchFactory(token, repo, targetDir) {
3804
+ async function fetchFactory(token, repo, targetDir, agent) {
3798
3805
  const result = { success: false, filesInstalled: [] };
3799
3806
  const tarCheck = (0, import_child_process2.spawnSync)("tar", ["--version"], { stdio: "ignore" });
3800
3807
  if (tarCheck.status !== 0) {
3801
3808
  result.failureReason = "tar command not found";
3802
3809
  return result;
3803
3810
  }
3811
+ const { assetName, rootFolder } = getFactoryAsset(agent);
3804
3812
  const headers = {
3805
3813
  "Accept": "application/vnd.github+json",
3806
3814
  "Authorization": `Bearer ${token}`
@@ -3814,9 +3822,9 @@ async function fetchFactory(token, repo, targetDir) {
3814
3822
  return result;
3815
3823
  }
3816
3824
  const releaseData = await releaseResponse.json();
3817
- const asset = releaseData.assets?.find((a) => a.name === FACTORY_ASSET_NAME);
3825
+ const asset = releaseData.assets?.find((a) => a.name === assetName);
3818
3826
  if (!asset) {
3819
- result.failureReason = `${FACTORY_ASSET_NAME} not found in release`;
3827
+ result.failureReason = `${assetName} not found in release`;
3820
3828
  return result;
3821
3829
  }
3822
3830
  const tempDir = (0, import_path3.join)(targetDir, ".temp-factory-download");
@@ -3830,7 +3838,7 @@ async function fetchFactory(token, repo, targetDir) {
3830
3838
  result.failureReason = `Download failed (${response.status})`;
3831
3839
  return result;
3832
3840
  }
3833
- const archivePath = (0, import_path3.join)(tempDir, FACTORY_ASSET_NAME);
3841
+ const archivePath = (0, import_path3.join)(tempDir, assetName);
3834
3842
  const arrayBuffer = await response.arrayBuffer();
3835
3843
  (0, import_fs3.writeFileSync)(archivePath, Buffer.from(arrayBuffer));
3836
3844
  const stats = (0, import_fs3.statSync)(archivePath);
@@ -3857,54 +3865,17 @@ async function fetchFactory(token, repo, targetDir) {
3857
3865
  return result;
3858
3866
  }
3859
3867
  const extractedEntries = (0, import_fs3.readdirSync)(tempDir);
3860
- const extractedFolder = extractedEntries.find((e) => e.toLowerCase() === "factory");
3868
+ const extractedFolder = extractedEntries.find((e) => e.toLowerCase() === rootFolder.toLowerCase());
3861
3869
  if (!extractedFolder) {
3862
- result.failureReason = "No factory/ folder in archive";
3870
+ result.failureReason = `No ${rootFolder}/ folder in archive`;
3863
3871
  return result;
3864
3872
  }
3865
3873
  const extractedPath = (0, import_path3.join)(tempDir, extractedFolder);
3866
- const claudeDir = (0, import_path3.join)(targetDir, ".claude");
3867
- const factoryDir = (0, import_path3.join)(targetDir, "factory");
3868
- const agentsSrc = (0, import_path3.join)(extractedPath, "agents");
3869
- if ((0, import_fs3.existsSync)(agentsSrc)) {
3870
- copyDirectory2(agentsSrc, (0, import_path3.join)(claudeDir, "agents"));
3871
- result.filesInstalled.push(".claude/agents/");
3872
- }
3873
- const hooksSrc = (0, import_path3.join)(extractedPath, "hooks");
3874
- if ((0, import_fs3.existsSync)(hooksSrc)) {
3875
- copyDirectory2(hooksSrc, (0, import_path3.join)(claudeDir, "hooks"));
3876
- result.filesInstalled.push(".claude/hooks/");
3877
- }
3878
- const skillsSrc = (0, import_path3.join)(extractedPath, "skills");
3879
- if ((0, import_fs3.existsSync)(skillsSrc)) {
3880
- copyDirectory2(skillsSrc, (0, import_path3.join)(claudeDir, "skills"));
3881
- result.filesInstalled.push(".claude/skills/");
3882
- }
3883
- const workflowSrc = (0, import_path3.join)(extractedPath, "workflow");
3884
- if ((0, import_fs3.existsSync)(workflowSrc)) {
3885
- copyDirectory2(workflowSrc, (0, import_path3.join)(factoryDir, "workflow"));
3886
- result.filesInstalled.push("factory/workflow/");
3887
- }
3888
- const utilsSrc = (0, import_path3.join)(extractedPath, "utils");
3889
- if ((0, import_fs3.existsSync)(utilsSrc)) {
3890
- copyDirectory2(utilsSrc, (0, import_path3.join)(factoryDir, "utils"));
3891
- result.filesInstalled.push("factory/utils/");
3892
- }
3893
- const docsSrc = (0, import_path3.join)(extractedPath, "docs");
3894
- if ((0, import_fs3.existsSync)(docsSrc)) {
3895
- copyDirectory2(docsSrc, (0, import_path3.join)(factoryDir, "docs"));
3896
- result.filesInstalled.push("factory/docs/");
3897
- }
3898
- const rootEntries = (0, import_fs3.readdirSync)(extractedPath, { withFileTypes: true });
3899
- for (const entry of rootEntries) {
3900
- if (entry.isFile()) {
3901
- if (!(0, import_fs3.existsSync)(factoryDir)) (0, import_fs3.mkdirSync)(factoryDir, { recursive: true });
3902
- (0, import_fs3.copyFileSync)((0, import_path3.join)(extractedPath, entry.name), (0, import_path3.join)(factoryDir, entry.name));
3903
- result.filesInstalled.push(`factory/${entry.name}`);
3904
- }
3874
+ if (agent === "github-copilot") {
3875
+ installCopilotFactory(extractedPath, targetDir, result);
3876
+ } else {
3877
+ installClaudeFactory(extractedPath, targetDir, result);
3905
3878
  }
3906
- configureSettings(claudeDir);
3907
- result.filesInstalled.push(".claude/settings.json");
3908
3879
  result.success = true;
3909
3880
  } catch (error) {
3910
3881
  result.failureReason = error instanceof Error ? error.message : String(error);
@@ -3918,6 +3889,62 @@ async function fetchFactory(token, repo, targetDir) {
3918
3889
  }
3919
3890
  return result;
3920
3891
  }
3892
+ function installClaudeFactory(extractedPath, targetDir, result) {
3893
+ const claudeDir = (0, import_path3.join)(targetDir, ".claude");
3894
+ const factoryDir = (0, import_path3.join)(targetDir, "factory");
3895
+ const agentsSrc = (0, import_path3.join)(extractedPath, "agents");
3896
+ if ((0, import_fs3.existsSync)(agentsSrc)) {
3897
+ copyDirectory2(agentsSrc, (0, import_path3.join)(claudeDir, "agents"));
3898
+ result.filesInstalled.push(".claude/agents/");
3899
+ }
3900
+ const hooksSrc = (0, import_path3.join)(extractedPath, "hooks");
3901
+ if ((0, import_fs3.existsSync)(hooksSrc)) {
3902
+ copyDirectory2(hooksSrc, (0, import_path3.join)(claudeDir, "hooks"));
3903
+ result.filesInstalled.push(".claude/hooks/");
3904
+ }
3905
+ const skillsSrc = (0, import_path3.join)(extractedPath, "skills");
3906
+ if ((0, import_fs3.existsSync)(skillsSrc)) {
3907
+ copyDirectory2(skillsSrc, (0, import_path3.join)(claudeDir, "skills"));
3908
+ result.filesInstalled.push(".claude/skills/");
3909
+ }
3910
+ const workflowSrc = (0, import_path3.join)(extractedPath, "workflow");
3911
+ if ((0, import_fs3.existsSync)(workflowSrc)) {
3912
+ copyDirectory2(workflowSrc, (0, import_path3.join)(factoryDir, "workflow"));
3913
+ result.filesInstalled.push("factory/workflow/");
3914
+ }
3915
+ const utilsSrc = (0, import_path3.join)(extractedPath, "utils");
3916
+ if ((0, import_fs3.existsSync)(utilsSrc)) {
3917
+ copyDirectory2(utilsSrc, (0, import_path3.join)(factoryDir, "utils"));
3918
+ result.filesInstalled.push("factory/utils/");
3919
+ }
3920
+ const docsSrc = (0, import_path3.join)(extractedPath, "docs");
3921
+ if ((0, import_fs3.existsSync)(docsSrc)) {
3922
+ copyDirectory2(docsSrc, (0, import_path3.join)(factoryDir, "docs"));
3923
+ result.filesInstalled.push("factory/docs/");
3924
+ }
3925
+ const rootEntries = (0, import_fs3.readdirSync)(extractedPath, { withFileTypes: true });
3926
+ for (const entry of rootEntries) {
3927
+ if (entry.isFile()) {
3928
+ if (!(0, import_fs3.existsSync)(factoryDir)) (0, import_fs3.mkdirSync)(factoryDir, { recursive: true });
3929
+ (0, import_fs3.copyFileSync)((0, import_path3.join)(extractedPath, entry.name), (0, import_path3.join)(factoryDir, entry.name));
3930
+ result.filesInstalled.push(`factory/${entry.name}`);
3931
+ }
3932
+ }
3933
+ configureSettings(claudeDir);
3934
+ result.filesInstalled.push(".claude/settings.json");
3935
+ }
3936
+ function installCopilotFactory(extractedPath, targetDir, result) {
3937
+ const factoryDir = (0, import_path3.join)(targetDir, "factory");
3938
+ copyDirectory2(extractedPath, factoryDir);
3939
+ const entries = (0, import_fs3.readdirSync)(extractedPath, { withFileTypes: true });
3940
+ for (const entry of entries) {
3941
+ if (entry.isDirectory()) {
3942
+ result.filesInstalled.push(`factory/${entry.name}/`);
3943
+ } else {
3944
+ result.filesInstalled.push(`factory/${entry.name}`);
3945
+ }
3946
+ }
3947
+ }
3921
3948
  function configureSettings(claudeDir) {
3922
3949
  const settingsPath = (0, import_path3.join)(claudeDir, "settings.json");
3923
3950
  let settings = {};
@@ -4214,7 +4241,25 @@ function buildMCPSection(mcpConfig) {
4214
4241
  }
4215
4242
  return lines2.join("\n");
4216
4243
  }
4217
- function buildFactorySection() {
4244
+ function buildFactorySection(agent) {
4245
+ if (agent === "github-copilot") {
4246
+ return [
4247
+ `## Factory Dev Workflow`,
4248
+ ``,
4249
+ `Factory is installed. Skills are in \`factory/skills/\`, templates in \`factory/templates/\`.`,
4250
+ ``,
4251
+ `Read \`factory/README.md\` and \`factory/PROTOCOL.md\` for usage instructions.`,
4252
+ ``,
4253
+ `Available skills:`,
4254
+ `- \`factory-advisor\` \u2014 start or resume the workflow (main entry point)`,
4255
+ `- \`factory-init\` \u2014 initialize project state`,
4256
+ `- \`factory-planner\` \u2014 create story plan`,
4257
+ `- \`factory-executor\` \u2014 execute development tasks`,
4258
+ `- \`factory-verifier\` \u2014 code review`,
4259
+ `- \`factory-completer\` \u2014 finalize and complete work`,
4260
+ ``
4261
+ ].join("\n");
4262
+ }
4218
4263
  return [
4219
4264
  `## Factory Dev Workflow`,
4220
4265
  ``,
@@ -4246,7 +4291,7 @@ function buildCombinedInstructions(domains, mcpConfig, agent, projectPath, facto
4246
4291
  const lines2 = [`# AI Development Instructions`, ``, `> Generated by One-Shot Installer`, ``];
4247
4292
  lines2.push(buildContextRefsSection(domains, agent, contextsDir));
4248
4293
  if (Object.keys(mcpConfig).length > 0) lines2.push(buildMCPSection(mcpConfig));
4249
- if (factoryInstalled) lines2.push(buildFactorySection());
4294
+ if (factoryInstalled) lines2.push(buildFactorySection(agent));
4250
4295
  return lines2.join("\n");
4251
4296
  }
4252
4297
 
@@ -4375,7 +4420,7 @@ var update_gitignore_default = defineStep({
4375
4420
  var import_fs7 = require("fs");
4376
4421
  var import_path7 = require("path");
4377
4422
  var import_os2 = require("os");
4378
- var INSTALLER_VERSION = "0.5.12";
4423
+ var INSTALLER_VERSION = "0.5.14";
4379
4424
  var write_state_default = defineStep({
4380
4425
  name: "write-state",
4381
4426
  label: "Saving installation state",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"