dlw-machine-setup 0.5.11 → 0.5.13

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 +48 -25
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -3786,7 +3786,7 @@ var fetch_factory_default = defineStep({
3786
3786
  label: "Installing Factory framework",
3787
3787
  when: (ctx) => ctx.config.installFactory && !!ctx.factoryRepo,
3788
3788
  execute: async (ctx) => {
3789
- const result = await fetchFactory(ctx.token, ctx.factoryRepo, ctx.config.projectPath);
3789
+ const result = await fetchFactory(ctx.token, ctx.factoryRepo, ctx.config.projectPath, ctx.config.agent);
3790
3790
  ctx.installed.factoryInstalled = result.success;
3791
3791
  if (!result.success) {
3792
3792
  return { status: "failed", detail: result.failureReason };
@@ -3794,7 +3794,38 @@ var fetch_factory_default = defineStep({
3794
3794
  return { status: "success", message: result.filesInstalled.join(", ") };
3795
3795
  }
3796
3796
  });
3797
- async function fetchFactory(token, repo, targetDir) {
3797
+ function getAgentPaths(agent, targetDir) {
3798
+ const claudeDir = (0, import_path3.join)(targetDir, ".claude");
3799
+ const githubDir = (0, import_path3.join)(targetDir, ".github");
3800
+ switch (agent) {
3801
+ case "github-copilot":
3802
+ return {
3803
+ agentsDir: (0, import_path3.join)(githubDir, "agents"),
3804
+ hooksDir: (0, import_path3.join)(claudeDir, "hooks"),
3805
+ // Copilot reads .claude/hooks/ natively
3806
+ skillsDir: (0, import_path3.join)(githubDir, "prompts"),
3807
+ // Copilot uses .github/prompts/ for slash commands
3808
+ settingsDir: claudeDir,
3809
+ // Copilot reads .claude/settings.json natively
3810
+ agentsLabel: ".github/agents/",
3811
+ hooksLabel: ".claude/hooks/",
3812
+ skillsLabel: ".github/prompts/",
3813
+ settingsLabel: ".claude/settings.json"
3814
+ };
3815
+ default:
3816
+ return {
3817
+ agentsDir: (0, import_path3.join)(claudeDir, "agents"),
3818
+ hooksDir: (0, import_path3.join)(claudeDir, "hooks"),
3819
+ skillsDir: (0, import_path3.join)(claudeDir, "skills"),
3820
+ settingsDir: claudeDir,
3821
+ agentsLabel: ".claude/agents/",
3822
+ hooksLabel: ".claude/hooks/",
3823
+ skillsLabel: ".claude/skills/",
3824
+ settingsLabel: ".claude/settings.json"
3825
+ };
3826
+ }
3827
+ }
3828
+ async function fetchFactory(token, repo, targetDir, agent) {
3798
3829
  const result = { success: false, filesInstalled: [] };
3799
3830
  const tarCheck = (0, import_child_process2.spawnSync)("tar", ["--version"], { stdio: "ignore" });
3800
3831
  if (tarCheck.status !== 0) {
@@ -3863,29 +3894,33 @@ async function fetchFactory(token, repo, targetDir) {
3863
3894
  return result;
3864
3895
  }
3865
3896
  const extractedPath = (0, import_path3.join)(tempDir, extractedFolder);
3866
- const claudeDir = (0, import_path3.join)(targetDir, ".claude");
3897
+ const paths = getAgentPaths(agent, targetDir);
3867
3898
  const factoryDir = (0, import_path3.join)(targetDir, "factory");
3868
3899
  const agentsSrc = (0, import_path3.join)(extractedPath, "agents");
3869
3900
  if ((0, import_fs3.existsSync)(agentsSrc)) {
3870
- copyDirectory2(agentsSrc, (0, import_path3.join)(factoryDir, "agents"));
3871
- copyAgentStubs(agentsSrc, (0, import_path3.join)(claudeDir, "agents"));
3872
- result.filesInstalled.push(".claude/agents/", "factory/agents/");
3901
+ copyDirectory2(agentsSrc, paths.agentsDir);
3902
+ result.filesInstalled.push(paths.agentsLabel);
3873
3903
  }
3874
3904
  const hooksSrc = (0, import_path3.join)(extractedPath, "hooks");
3875
3905
  if ((0, import_fs3.existsSync)(hooksSrc)) {
3876
- copyDirectory2(hooksSrc, (0, import_path3.join)(claudeDir, "hooks"));
3877
- result.filesInstalled.push(".claude/hooks/");
3906
+ copyDirectory2(hooksSrc, paths.hooksDir);
3907
+ result.filesInstalled.push(paths.hooksLabel);
3878
3908
  }
3879
3909
  const skillsSrc = (0, import_path3.join)(extractedPath, "skills");
3880
3910
  if ((0, import_fs3.existsSync)(skillsSrc)) {
3881
- copyDirectory2(skillsSrc, (0, import_path3.join)(claudeDir, "skills"));
3882
- result.filesInstalled.push(".claude/skills/");
3911
+ copyDirectory2(skillsSrc, paths.skillsDir);
3912
+ result.filesInstalled.push(paths.skillsLabel);
3883
3913
  }
3884
3914
  const workflowSrc = (0, import_path3.join)(extractedPath, "workflow");
3885
3915
  if ((0, import_fs3.existsSync)(workflowSrc)) {
3886
3916
  copyDirectory2(workflowSrc, (0, import_path3.join)(factoryDir, "workflow"));
3887
3917
  result.filesInstalled.push("factory/workflow/");
3888
3918
  }
3919
+ const utilsSrc = (0, import_path3.join)(extractedPath, "utils");
3920
+ if ((0, import_fs3.existsSync)(utilsSrc)) {
3921
+ copyDirectory2(utilsSrc, (0, import_path3.join)(factoryDir, "utils"));
3922
+ result.filesInstalled.push("factory/utils/");
3923
+ }
3889
3924
  const docsSrc = (0, import_path3.join)(extractedPath, "docs");
3890
3925
  if ((0, import_fs3.existsSync)(docsSrc)) {
3891
3926
  copyDirectory2(docsSrc, (0, import_path3.join)(factoryDir, "docs"));
@@ -3899,8 +3934,8 @@ async function fetchFactory(token, repo, targetDir) {
3899
3934
  result.filesInstalled.push(`factory/${entry.name}`);
3900
3935
  }
3901
3936
  }
3902
- configureSettings(claudeDir);
3903
- result.filesInstalled.push(".claude/settings.json");
3937
+ configureSettings(paths.settingsDir);
3938
+ result.filesInstalled.push(paths.settingsLabel);
3904
3939
  result.success = true;
3905
3940
  } catch (error) {
3906
3941
  result.failureReason = error instanceof Error ? error.message : String(error);
@@ -3973,18 +4008,6 @@ function configureSettings(claudeDir) {
3973
4008
  if (!(0, import_fs3.existsSync)(claudeDir)) (0, import_fs3.mkdirSync)(claudeDir, { recursive: true });
3974
4009
  (0, import_fs3.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2) + "\n");
3975
4010
  }
3976
- function copyAgentStubs(source, target) {
3977
- if (!(0, import_fs3.existsSync)(target)) (0, import_fs3.mkdirSync)(target, { recursive: true });
3978
- const entries = (0, import_fs3.readdirSync)(source, { withFileTypes: true });
3979
- for (const entry of entries) {
3980
- if (entry.isDirectory() || !entry.name.endsWith(".md")) continue;
3981
- const content = (0, import_fs3.readFileSync)((0, import_path3.join)(source, entry.name), "utf8");
3982
- const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?\r?\n)---/);
3983
- if (frontmatterMatch) {
3984
- (0, import_fs3.writeFileSync)((0, import_path3.join)(target, entry.name), frontmatterMatch[0] + "\n");
3985
- }
3986
- }
3987
- }
3988
4011
  function copyDirectory2(source, target) {
3989
4012
  if (!(0, import_fs3.existsSync)(target)) (0, import_fs3.mkdirSync)(target, { recursive: true });
3990
4013
  const entries = (0, import_fs3.readdirSync)(source, { withFileTypes: true });
@@ -4383,7 +4406,7 @@ var update_gitignore_default = defineStep({
4383
4406
  var import_fs7 = require("fs");
4384
4407
  var import_path7 = require("path");
4385
4408
  var import_os2 = require("os");
4386
- var INSTALLER_VERSION = "0.5.11";
4409
+ var INSTALLER_VERSION = "0.5.13";
4387
4410
  var write_state_default = defineStep({
4388
4411
  name: "write-state",
4389
4412
  label: "Saving installation state",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"