dlw-machine-setup 0.5.13 → 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.
- package/bin/installer.js +95 -81
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -3780,7 +3780,14 @@ 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
|
-
|
|
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",
|
|
@@ -3794,37 +3801,6 @@ var fetch_factory_default = defineStep({
|
|
|
3794
3801
|
return { status: "success", message: result.filesInstalled.join(", ") };
|
|
3795
3802
|
}
|
|
3796
3803
|
});
|
|
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
3804
|
async function fetchFactory(token, repo, targetDir, agent) {
|
|
3829
3805
|
const result = { success: false, filesInstalled: [] };
|
|
3830
3806
|
const tarCheck = (0, import_child_process2.spawnSync)("tar", ["--version"], { stdio: "ignore" });
|
|
@@ -3832,6 +3808,7 @@ async function fetchFactory(token, repo, targetDir, agent) {
|
|
|
3832
3808
|
result.failureReason = "tar command not found";
|
|
3833
3809
|
return result;
|
|
3834
3810
|
}
|
|
3811
|
+
const { assetName, rootFolder } = getFactoryAsset(agent);
|
|
3835
3812
|
const headers = {
|
|
3836
3813
|
"Accept": "application/vnd.github+json",
|
|
3837
3814
|
"Authorization": `Bearer ${token}`
|
|
@@ -3845,9 +3822,9 @@ async function fetchFactory(token, repo, targetDir, agent) {
|
|
|
3845
3822
|
return result;
|
|
3846
3823
|
}
|
|
3847
3824
|
const releaseData = await releaseResponse.json();
|
|
3848
|
-
const asset = releaseData.assets?.find((a) => a.name ===
|
|
3825
|
+
const asset = releaseData.assets?.find((a) => a.name === assetName);
|
|
3849
3826
|
if (!asset) {
|
|
3850
|
-
result.failureReason = `${
|
|
3827
|
+
result.failureReason = `${assetName} not found in release`;
|
|
3851
3828
|
return result;
|
|
3852
3829
|
}
|
|
3853
3830
|
const tempDir = (0, import_path3.join)(targetDir, ".temp-factory-download");
|
|
@@ -3861,7 +3838,7 @@ async function fetchFactory(token, repo, targetDir, agent) {
|
|
|
3861
3838
|
result.failureReason = `Download failed (${response.status})`;
|
|
3862
3839
|
return result;
|
|
3863
3840
|
}
|
|
3864
|
-
const archivePath = (0, import_path3.join)(tempDir,
|
|
3841
|
+
const archivePath = (0, import_path3.join)(tempDir, assetName);
|
|
3865
3842
|
const arrayBuffer = await response.arrayBuffer();
|
|
3866
3843
|
(0, import_fs3.writeFileSync)(archivePath, Buffer.from(arrayBuffer));
|
|
3867
3844
|
const stats = (0, import_fs3.statSync)(archivePath);
|
|
@@ -3888,54 +3865,17 @@ async function fetchFactory(token, repo, targetDir, agent) {
|
|
|
3888
3865
|
return result;
|
|
3889
3866
|
}
|
|
3890
3867
|
const extractedEntries = (0, import_fs3.readdirSync)(tempDir);
|
|
3891
|
-
const extractedFolder = extractedEntries.find((e) => e.toLowerCase() ===
|
|
3868
|
+
const extractedFolder = extractedEntries.find((e) => e.toLowerCase() === rootFolder.toLowerCase());
|
|
3892
3869
|
if (!extractedFolder) {
|
|
3893
|
-
result.failureReason =
|
|
3870
|
+
result.failureReason = `No ${rootFolder}/ folder in archive`;
|
|
3894
3871
|
return result;
|
|
3895
3872
|
}
|
|
3896
3873
|
const extractedPath = (0, import_path3.join)(tempDir, extractedFolder);
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
copyDirectory2(agentsSrc, paths.agentsDir);
|
|
3902
|
-
result.filesInstalled.push(paths.agentsLabel);
|
|
3903
|
-
}
|
|
3904
|
-
const hooksSrc = (0, import_path3.join)(extractedPath, "hooks");
|
|
3905
|
-
if ((0, import_fs3.existsSync)(hooksSrc)) {
|
|
3906
|
-
copyDirectory2(hooksSrc, paths.hooksDir);
|
|
3907
|
-
result.filesInstalled.push(paths.hooksLabel);
|
|
3908
|
-
}
|
|
3909
|
-
const skillsSrc = (0, import_path3.join)(extractedPath, "skills");
|
|
3910
|
-
if ((0, import_fs3.existsSync)(skillsSrc)) {
|
|
3911
|
-
copyDirectory2(skillsSrc, paths.skillsDir);
|
|
3912
|
-
result.filesInstalled.push(paths.skillsLabel);
|
|
3913
|
-
}
|
|
3914
|
-
const workflowSrc = (0, import_path3.join)(extractedPath, "workflow");
|
|
3915
|
-
if ((0, import_fs3.existsSync)(workflowSrc)) {
|
|
3916
|
-
copyDirectory2(workflowSrc, (0, import_path3.join)(factoryDir, "workflow"));
|
|
3917
|
-
result.filesInstalled.push("factory/workflow/");
|
|
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
|
-
}
|
|
3924
|
-
const docsSrc = (0, import_path3.join)(extractedPath, "docs");
|
|
3925
|
-
if ((0, import_fs3.existsSync)(docsSrc)) {
|
|
3926
|
-
copyDirectory2(docsSrc, (0, import_path3.join)(factoryDir, "docs"));
|
|
3927
|
-
result.filesInstalled.push("factory/docs/");
|
|
3928
|
-
}
|
|
3929
|
-
const rootEntries = (0, import_fs3.readdirSync)(extractedPath, { withFileTypes: true });
|
|
3930
|
-
for (const entry of rootEntries) {
|
|
3931
|
-
if (entry.isFile()) {
|
|
3932
|
-
if (!(0, import_fs3.existsSync)(factoryDir)) (0, import_fs3.mkdirSync)(factoryDir, { recursive: true });
|
|
3933
|
-
(0, import_fs3.copyFileSync)((0, import_path3.join)(extractedPath, entry.name), (0, import_path3.join)(factoryDir, entry.name));
|
|
3934
|
-
result.filesInstalled.push(`factory/${entry.name}`);
|
|
3935
|
-
}
|
|
3874
|
+
if (agent === "github-copilot") {
|
|
3875
|
+
installCopilotFactory(extractedPath, targetDir, result);
|
|
3876
|
+
} else {
|
|
3877
|
+
installClaudeFactory(extractedPath, targetDir, result);
|
|
3936
3878
|
}
|
|
3937
|
-
configureSettings(paths.settingsDir);
|
|
3938
|
-
result.filesInstalled.push(paths.settingsLabel);
|
|
3939
3879
|
result.success = true;
|
|
3940
3880
|
} catch (error) {
|
|
3941
3881
|
result.failureReason = error instanceof Error ? error.message : String(error);
|
|
@@ -3949,6 +3889,62 @@ async function fetchFactory(token, repo, targetDir, agent) {
|
|
|
3949
3889
|
}
|
|
3950
3890
|
return result;
|
|
3951
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
|
+
}
|
|
3952
3948
|
function configureSettings(claudeDir) {
|
|
3953
3949
|
const settingsPath = (0, import_path3.join)(claudeDir, "settings.json");
|
|
3954
3950
|
let settings = {};
|
|
@@ -4245,7 +4241,25 @@ function buildMCPSection(mcpConfig) {
|
|
|
4245
4241
|
}
|
|
4246
4242
|
return lines2.join("\n");
|
|
4247
4243
|
}
|
|
4248
|
-
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
|
+
}
|
|
4249
4263
|
return [
|
|
4250
4264
|
`## Factory Dev Workflow`,
|
|
4251
4265
|
``,
|
|
@@ -4277,7 +4291,7 @@ function buildCombinedInstructions(domains, mcpConfig, agent, projectPath, facto
|
|
|
4277
4291
|
const lines2 = [`# AI Development Instructions`, ``, `> Generated by One-Shot Installer`, ``];
|
|
4278
4292
|
lines2.push(buildContextRefsSection(domains, agent, contextsDir));
|
|
4279
4293
|
if (Object.keys(mcpConfig).length > 0) lines2.push(buildMCPSection(mcpConfig));
|
|
4280
|
-
if (factoryInstalled) lines2.push(buildFactorySection());
|
|
4294
|
+
if (factoryInstalled) lines2.push(buildFactorySection(agent));
|
|
4281
4295
|
return lines2.join("\n");
|
|
4282
4296
|
}
|
|
4283
4297
|
|
|
@@ -4406,7 +4420,7 @@ var update_gitignore_default = defineStep({
|
|
|
4406
4420
|
var import_fs7 = require("fs");
|
|
4407
4421
|
var import_path7 = require("path");
|
|
4408
4422
|
var import_os2 = require("os");
|
|
4409
|
-
var INSTALLER_VERSION = "0.5.
|
|
4423
|
+
var INSTALLER_VERSION = "0.5.14";
|
|
4410
4424
|
var write_state_default = defineStep({
|
|
4411
4425
|
name: "write-state",
|
|
4412
4426
|
label: "Saving installation state",
|