dlw-machine-setup 0.9.8 → 0.10.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/bin/installer.js +77 -35
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -3295,9 +3295,9 @@ ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursor
|
|
|
3295
3295
|
});
|
|
3296
3296
|
|
|
3297
3297
|
// src/index.ts
|
|
3298
|
-
var
|
|
3298
|
+
var import_fs18 = require("fs");
|
|
3299
3299
|
var import_readline2 = require("readline");
|
|
3300
|
-
var
|
|
3300
|
+
var import_path18 = require("path");
|
|
3301
3301
|
|
|
3302
3302
|
// src/utils/fetch.ts
|
|
3303
3303
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -3956,6 +3956,7 @@ __export(steps_exports, {
|
|
|
3956
3956
|
fetchFactory: () => fetch_factory_default,
|
|
3957
3957
|
runMcpInstallCommands: () => run_mcp_install_commands_default,
|
|
3958
3958
|
setupCodeIndex: () => build_code_index_default,
|
|
3959
|
+
setupProjectInput: () => create_project_input_default,
|
|
3959
3960
|
updateGitignore: () => update_gitignore_default,
|
|
3960
3961
|
writeInstructions: () => write_instructions_default,
|
|
3961
3962
|
writeMcpConfig: () => write_mcp_config_default,
|
|
@@ -5571,9 +5572,47 @@ function isNodeAvailable() {
|
|
|
5571
5572
|
return probeResult.status === 0;
|
|
5572
5573
|
}
|
|
5573
5574
|
|
|
5574
|
-
// src/steps/setup/
|
|
5575
|
+
// src/steps/setup/create-project-input.ts
|
|
5575
5576
|
var import_fs14 = require("fs");
|
|
5576
5577
|
var import_path14 = require("path");
|
|
5578
|
+
var INPUT_DIR = ".project/input";
|
|
5579
|
+
var KEEP_FILE = `${INPUT_DIR}/.gitkeep`;
|
|
5580
|
+
var create_project_input_default = defineStep({
|
|
5581
|
+
name: "create-project-input",
|
|
5582
|
+
label: "Creating .project/input folder",
|
|
5583
|
+
execute: async (ctx) => {
|
|
5584
|
+
const dirAbs = (0, import_path14.join)(ctx.config.projectPath, INPUT_DIR);
|
|
5585
|
+
const keepAbs = (0, import_path14.join)(ctx.config.projectPath, KEEP_FILE);
|
|
5586
|
+
const dirExistedBefore = (0, import_fs14.existsSync)(dirAbs);
|
|
5587
|
+
if (!dirExistedBefore) (0, import_fs14.mkdirSync)(dirAbs, { recursive: true });
|
|
5588
|
+
const keepFileCreated = !(0, import_fs14.existsSync)(keepAbs);
|
|
5589
|
+
if (keepFileCreated) (0, import_fs14.writeFileSync)(keepAbs, "", "utf-8");
|
|
5590
|
+
const record = {
|
|
5591
|
+
keepFile: KEEP_FILE,
|
|
5592
|
+
dirExistedBefore,
|
|
5593
|
+
keepFileCreated
|
|
5594
|
+
};
|
|
5595
|
+
return { status: "success", message: INPUT_DIR, record };
|
|
5596
|
+
},
|
|
5597
|
+
inverse: {
|
|
5598
|
+
label: "Removing .project/input folder",
|
|
5599
|
+
execute: async (raw, ctx) => {
|
|
5600
|
+
const rec = raw ?? {};
|
|
5601
|
+
if (rec.keepFileCreated && rec.keepFile) {
|
|
5602
|
+
const keepAbs = resolveProjectPath(rec.keepFile, ctx.config.projectPath);
|
|
5603
|
+
deleteFileIfExists(keepAbs);
|
|
5604
|
+
}
|
|
5605
|
+
if (!rec.dirExistedBefore && rec.keepFile) {
|
|
5606
|
+
pruneEmptyAncestors([rec.keepFile], ctx.config.projectPath);
|
|
5607
|
+
}
|
|
5608
|
+
return { status: "success", message: INPUT_DIR };
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
});
|
|
5612
|
+
|
|
5613
|
+
// src/steps/setup/update-gitignore.ts
|
|
5614
|
+
var import_fs15 = require("fs");
|
|
5615
|
+
var import_path15 = require("path");
|
|
5577
5616
|
var MARKER_START2 = "# one-shot-installer:start";
|
|
5578
5617
|
var MARKER_END2 = "# one-shot-installer:end";
|
|
5579
5618
|
var CORE_GITIGNORE_ENTRIES = [
|
|
@@ -5594,8 +5633,8 @@ var update_gitignore_default = defineStep({
|
|
|
5594
5633
|
name: "update-gitignore",
|
|
5595
5634
|
label: "Updating .gitignore",
|
|
5596
5635
|
execute: async (ctx) => {
|
|
5597
|
-
const gitignorePath = (0,
|
|
5598
|
-
const fileExistedBefore = (0,
|
|
5636
|
+
const gitignorePath = (0, import_path15.join)(ctx.config.projectPath, ".gitignore");
|
|
5637
|
+
const fileExistedBefore = (0, import_fs15.existsSync)(gitignorePath);
|
|
5599
5638
|
upsertMarkerBlock(gitignorePath, MARKER_START2, MARKER_END2, CORE_GITIGNORE_ENTRIES.join("\n"));
|
|
5600
5639
|
const record = {
|
|
5601
5640
|
filePath: ".gitignore",
|
|
@@ -5623,8 +5662,8 @@ var update_gitignore_default = defineStep({
|
|
|
5623
5662
|
});
|
|
5624
5663
|
|
|
5625
5664
|
// src/steps/setup/write-state.ts
|
|
5626
|
-
var
|
|
5627
|
-
var
|
|
5665
|
+
var import_fs16 = require("fs");
|
|
5666
|
+
var import_path16 = require("path");
|
|
5628
5667
|
var import_os2 = require("os");
|
|
5629
5668
|
|
|
5630
5669
|
// package.json
|
|
@@ -5658,7 +5697,7 @@ var write_state_default = defineStep({
|
|
|
5658
5697
|
name: "write-state",
|
|
5659
5698
|
label: "Saving installation state",
|
|
5660
5699
|
execute: async (ctx) => {
|
|
5661
|
-
const statePath = (0,
|
|
5700
|
+
const statePath = (0, import_path16.join)(ctx.config.projectPath, ".one-shot-state.json");
|
|
5662
5701
|
const mcpServersAdded = ctx.installed.mcpServersAdded ?? [];
|
|
5663
5702
|
const filteredMcpConfig = Object.fromEntries(
|
|
5664
5703
|
Object.entries(ctx.config.mcpConfig).filter(([name]) => mcpServersAdded.includes(name))
|
|
@@ -5689,13 +5728,13 @@ var write_state_default = defineStep({
|
|
|
5689
5728
|
* mislead the uninstall preview which reads this field. */
|
|
5690
5729
|
factory: ctx.installed.factoryInstalled ? ".claude/" : null,
|
|
5691
5730
|
abapHooks: ctx.installed.abapHooksInstalled ? ".claude/hooks/" : null,
|
|
5692
|
-
globalConfig: (0,
|
|
5731
|
+
globalConfig: (0, import_path16.join)((0, import_os2.homedir)(), ".one-shot-installer")
|
|
5693
5732
|
}
|
|
5694
5733
|
};
|
|
5695
5734
|
if (ctx.journal) {
|
|
5696
5735
|
ctx.journal.setSummary(state);
|
|
5697
5736
|
} else {
|
|
5698
|
-
(0,
|
|
5737
|
+
(0, import_fs16.writeFileSync)(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
5699
5738
|
}
|
|
5700
5739
|
return { status: "success" };
|
|
5701
5740
|
},
|
|
@@ -5710,9 +5749,9 @@ var write_state_default = defineStep({
|
|
|
5710
5749
|
});
|
|
5711
5750
|
|
|
5712
5751
|
// src/uninstall.ts
|
|
5713
|
-
var
|
|
5752
|
+
var import_fs17 = require("fs");
|
|
5714
5753
|
var import_readline = require("readline");
|
|
5715
|
-
var
|
|
5754
|
+
var import_path17 = require("path");
|
|
5716
5755
|
var dim = (text) => `\x1B[2m${text}\x1B[0m`;
|
|
5717
5756
|
var yellow = (text) => `\x1B[33m${text}\x1B[0m`;
|
|
5718
5757
|
var red3 = (text) => `\x1B[31m${text}\x1B[0m`;
|
|
@@ -5732,11 +5771,11 @@ async function uninstall() {
|
|
|
5732
5771
|
try {
|
|
5733
5772
|
const projectInput = await esm_default4({
|
|
5734
5773
|
message: "Project directory to uninstall from:",
|
|
5735
|
-
default: (0,
|
|
5774
|
+
default: (0, import_path17.resolve)(process.cwd())
|
|
5736
5775
|
});
|
|
5737
|
-
const projectPath = (0,
|
|
5738
|
-
const statePath = (0,
|
|
5739
|
-
if (!(0,
|
|
5776
|
+
const projectPath = (0, import_path17.resolve)(projectInput);
|
|
5777
|
+
const statePath = (0, import_path17.join)(projectPath, ".one-shot-state.json");
|
|
5778
|
+
if (!(0, import_fs17.existsSync)(statePath)) {
|
|
5740
5779
|
console.log("");
|
|
5741
5780
|
console.log(red3(" No .one-shot-state.json found at:"));
|
|
5742
5781
|
console.log(` ${statePath}`);
|
|
@@ -5761,7 +5800,7 @@ async function uninstall() {
|
|
|
5761
5800
|
default: false
|
|
5762
5801
|
});
|
|
5763
5802
|
if (proceed2) {
|
|
5764
|
-
(0,
|
|
5803
|
+
(0, import_fs17.unlinkSync)(statePath);
|
|
5765
5804
|
console.log(" Removed .one-shot-state.json");
|
|
5766
5805
|
}
|
|
5767
5806
|
await waitForEnter();
|
|
@@ -5802,7 +5841,7 @@ async function uninstall() {
|
|
|
5802
5841
|
console.log("");
|
|
5803
5842
|
const result = await runRollback(stepList, ctx);
|
|
5804
5843
|
try {
|
|
5805
|
-
if ((0,
|
|
5844
|
+
if ((0, import_fs17.existsSync)(statePath)) (0, import_fs17.unlinkSync)(statePath);
|
|
5806
5845
|
} catch {
|
|
5807
5846
|
}
|
|
5808
5847
|
printSummary(result);
|
|
@@ -5814,7 +5853,7 @@ async function uninstall() {
|
|
|
5814
5853
|
}
|
|
5815
5854
|
function readSummary(statePath) {
|
|
5816
5855
|
try {
|
|
5817
|
-
const raw = JSON.parse((0,
|
|
5856
|
+
const raw = JSON.parse((0, import_fs17.readFileSync)(statePath, "utf-8"));
|
|
5818
5857
|
return raw;
|
|
5819
5858
|
} catch {
|
|
5820
5859
|
return {};
|
|
@@ -5895,19 +5934,19 @@ var dim2 = (text) => `\x1B[2m${text}\x1B[0m`;
|
|
|
5895
5934
|
var yellow2 = (text) => `\x1B[33m${text}\x1B[0m`;
|
|
5896
5935
|
var green2 = (text) => `\x1B[32m${text}\x1B[0m`;
|
|
5897
5936
|
function detectMarkerFileMode(filePath, markerStart) {
|
|
5898
|
-
if (!(0,
|
|
5899
|
-
const content = (0,
|
|
5937
|
+
if (!(0, import_fs18.existsSync)(filePath)) return green2("create");
|
|
5938
|
+
const content = (0, import_fs18.readFileSync)(filePath, "utf-8");
|
|
5900
5939
|
if (content.includes(markerStart)) return yellow2("update");
|
|
5901
5940
|
return yellow2("append");
|
|
5902
5941
|
}
|
|
5903
5942
|
function detectMCPFileMode(filePath) {
|
|
5904
|
-
if (!(0,
|
|
5943
|
+
if (!(0, import_fs18.existsSync)(filePath)) return green2("create");
|
|
5905
5944
|
return yellow2("merge");
|
|
5906
5945
|
}
|
|
5907
5946
|
function detectContextMode(projectPath, domain) {
|
|
5908
|
-
const contextDir = (0,
|
|
5909
|
-
const contextDirLower = (0,
|
|
5910
|
-
if ((0,
|
|
5947
|
+
const contextDir = (0, import_path18.join)(projectPath, "_ai-context", domain.toUpperCase());
|
|
5948
|
+
const contextDirLower = (0, import_path18.join)(projectPath, "_ai-context", domain);
|
|
5949
|
+
if ((0, import_fs18.existsSync)(contextDir) || (0, import_fs18.existsSync)(contextDirLower)) return yellow2("overwrite");
|
|
5911
5950
|
return green2("create");
|
|
5912
5951
|
}
|
|
5913
5952
|
function waitForEnter2() {
|
|
@@ -5953,7 +5992,7 @@ async function main() {
|
|
|
5953
5992
|
await waitForEnter2();
|
|
5954
5993
|
return;
|
|
5955
5994
|
}
|
|
5956
|
-
const statePath = (0,
|
|
5995
|
+
const statePath = (0, import_path18.join)(config.projectPath, ".one-shot-state.json");
|
|
5957
5996
|
const journal = new Journal(statePath);
|
|
5958
5997
|
journal.startFresh();
|
|
5959
5998
|
const ctx = {
|
|
@@ -6037,7 +6076,7 @@ async function collectInputs(options, releaseVersion, factoryAvailable = false,
|
|
|
6037
6076
|
}
|
|
6038
6077
|
const projectInput = await esm_default4({
|
|
6039
6078
|
message: "Project directory:",
|
|
6040
|
-
default: (0,
|
|
6079
|
+
default: (0, import_path18.resolve)(process.cwd())
|
|
6041
6080
|
});
|
|
6042
6081
|
const isAbapSelected = selectedTechnologies.some((t) => t.domains.includes("ABAP"));
|
|
6043
6082
|
const installAbapHooks = abapHooksAvailable && agent === "claude-code" && isAbapSelected;
|
|
@@ -6045,7 +6084,7 @@ async function collectInputs(options, releaseVersion, factoryAvailable = false,
|
|
|
6045
6084
|
technologies: selectedTechnologies,
|
|
6046
6085
|
agent,
|
|
6047
6086
|
azureDevOpsOrg,
|
|
6048
|
-
projectPath: (0,
|
|
6087
|
+
projectPath: (0, import_path18.resolve)(projectInput),
|
|
6049
6088
|
baseMcpServers: options.baseMcpServers,
|
|
6050
6089
|
mcpConfig,
|
|
6051
6090
|
releaseVersion,
|
|
@@ -6060,9 +6099,9 @@ async function previewAndConfirm(config, options) {
|
|
|
6060
6099
|
const instructionFile = target.instructions;
|
|
6061
6100
|
const mcpConfigFile = target.mcpConfig;
|
|
6062
6101
|
const serverEntries = Object.entries(config.mcpConfig);
|
|
6063
|
-
const instructionFilePath = (0,
|
|
6064
|
-
const mcpConfigFilePath = (0,
|
|
6065
|
-
const gitignorePath = (0,
|
|
6102
|
+
const instructionFilePath = (0, import_path18.join)(config.projectPath, instructionFile);
|
|
6103
|
+
const mcpConfigFilePath = (0, import_path18.join)(config.projectPath, mcpConfigFile);
|
|
6104
|
+
const gitignorePath = (0, import_path18.join)(config.projectPath, ".gitignore");
|
|
6066
6105
|
const instructionMode = detectMarkerFileMode(instructionFilePath, "<!-- one-shot-installer:start -->");
|
|
6067
6106
|
const mcpMode = detectMCPFileMode(mcpConfigFilePath);
|
|
6068
6107
|
const gitignoreMode = detectMarkerFileMode(gitignorePath, "# one-shot-installer:start");
|
|
@@ -6088,12 +6127,15 @@ async function previewAndConfirm(config, options) {
|
|
|
6088
6127
|
console.log(` ${instructionFile.padEnd(domainColWidth + 14)}${instructionMode}`);
|
|
6089
6128
|
console.log(` ${mcpConfigFile.padEnd(domainColWidth + 14)}${mcpMode}`);
|
|
6090
6129
|
console.log(` ${".gitignore".padEnd(domainColWidth + 14)}${gitignoreMode}`);
|
|
6130
|
+
const projectInputDir = (0, import_path18.join)(config.projectPath, ".project", "input");
|
|
6131
|
+
const projectInputMode = (0, import_fs18.existsSync)(projectInputDir) ? yellow2("exists") : green2("create");
|
|
6132
|
+
console.log(` ${".project/input/".padEnd(domainColWidth + 14)}${projectInputMode}`);
|
|
6091
6133
|
if (config.installFactory || config.installAbapHooks) {
|
|
6092
|
-
const claudeDir = (0,
|
|
6093
|
-
const claudeMode = (0,
|
|
6134
|
+
const claudeDir = (0, import_path18.join)(config.projectPath, ".claude");
|
|
6135
|
+
const claudeMode = (0, import_fs18.existsSync)(claudeDir) ? yellow2("merge") : green2("create");
|
|
6094
6136
|
console.log(` ${".claude/".padEnd(domainColWidth + 14)}${claudeMode}`);
|
|
6095
|
-
const settingsPath = (0,
|
|
6096
|
-
const settingsMode = (0,
|
|
6137
|
+
const settingsPath = (0, import_path18.join)(config.projectPath, ".claude", "settings.json");
|
|
6138
|
+
const settingsMode = (0, import_fs18.existsSync)(settingsPath) ? yellow2("merge") : green2("create");
|
|
6097
6139
|
console.log(` ${".claude/settings.json".padEnd(domainColWidth + 14)}${settingsMode}`);
|
|
6098
6140
|
}
|
|
6099
6141
|
if (serverEntries.length > 0) {
|