dlw-machine-setup 0.2.3 → 0.2.5
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 +34 -12
- package/package.json +1 -1
package/bin/installer.js
CHANGED
|
@@ -3493,7 +3493,7 @@ async function fetchContexts(options = {}) {
|
|
|
3493
3493
|
);
|
|
3494
3494
|
}
|
|
3495
3495
|
const releaseData = await releaseResponse.json();
|
|
3496
|
-
const contextsDir = (0, import_path2.join)(targetDir, "
|
|
3496
|
+
const contextsDir = (0, import_path2.join)(targetDir, "_ai-context");
|
|
3497
3497
|
const tempDir = (0, import_path2.join)(targetDir, ".temp-download");
|
|
3498
3498
|
try {
|
|
3499
3499
|
if (!(0, import_fs2.existsSync)(contextsDir)) {
|
|
@@ -3772,7 +3772,28 @@ function buildMCPConfiguration(selectedItems, baseMcpServers2) {
|
|
|
3772
3772
|
// src/utils/setup/setup-instructions.ts
|
|
3773
3773
|
var import_fs4 = require("fs");
|
|
3774
3774
|
var import_path4 = require("path");
|
|
3775
|
-
var CONTEXTS_DIR = (0, import_path4.join)(process.cwd(), "
|
|
3775
|
+
var CONTEXTS_DIR = (0, import_path4.join)(process.cwd(), "_ai-context");
|
|
3776
|
+
var MARKER_START = "<!-- one-shot-installer:start -->";
|
|
3777
|
+
var MARKER_END = "<!-- one-shot-installer:end -->";
|
|
3778
|
+
function upsertBlock(filePath, block) {
|
|
3779
|
+
const marked = `${MARKER_START}
|
|
3780
|
+
${block}
|
|
3781
|
+
${MARKER_END}`;
|
|
3782
|
+
if (!(0, import_fs4.existsSync)(filePath)) {
|
|
3783
|
+
(0, import_fs4.writeFileSync)(filePath, marked, "utf-8");
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3786
|
+
const existing = (0, import_fs4.readFileSync)(filePath, "utf-8");
|
|
3787
|
+
const start = existing.indexOf(MARKER_START);
|
|
3788
|
+
const end = existing.indexOf(MARKER_END);
|
|
3789
|
+
if (start !== -1 && end !== -1) {
|
|
3790
|
+
const updated = existing.slice(0, start) + marked + existing.slice(end + MARKER_END.length);
|
|
3791
|
+
(0, import_fs4.writeFileSync)(filePath, updated, "utf-8");
|
|
3792
|
+
} else {
|
|
3793
|
+
const separator = existing.endsWith("\n") ? "\n" : "\n\n";
|
|
3794
|
+
(0, import_fs4.writeFileSync)(filePath, existing + separator + marked, "utf-8");
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3776
3797
|
function buildMCPSection(mcpConfig) {
|
|
3777
3798
|
const entries = Object.entries(mcpConfig);
|
|
3778
3799
|
if (entries.length === 0) return "";
|
|
@@ -3799,7 +3820,7 @@ function buildContextRefsSection(domains) {
|
|
|
3799
3820
|
const lines2 = [
|
|
3800
3821
|
`## Context References`,
|
|
3801
3822
|
``,
|
|
3802
|
-
`Domain-specific guidelines and reference material are available in the \`
|
|
3823
|
+
`Domain-specific guidelines and reference material are available in the \`_ai-context/\` folder:`,
|
|
3803
3824
|
``
|
|
3804
3825
|
];
|
|
3805
3826
|
for (const domain of domains) {
|
|
@@ -3809,15 +3830,15 @@ function buildContextRefsSection(domains) {
|
|
|
3809
3830
|
lines2.push(`### ${domainUpper}`);
|
|
3810
3831
|
const instructionsMd = (0, import_path4.join)(domainPath, "core", "instructions.md");
|
|
3811
3832
|
if ((0, import_fs4.existsSync)(instructionsMd)) {
|
|
3812
|
-
lines2.push(`- \`
|
|
3833
|
+
lines2.push(`- \`_ai-context/${domainUpper}/core/instructions.md\` \u2014 core development guidelines`);
|
|
3813
3834
|
}
|
|
3814
3835
|
const instructionsDir = (0, import_path4.join)(domainPath, "core", "instructions");
|
|
3815
3836
|
if ((0, import_fs4.existsSync)(instructionsDir)) {
|
|
3816
|
-
lines2.push(`- \`
|
|
3837
|
+
lines2.push(`- \`_ai-context/${domainUpper}/core/instructions/\` \u2014 detailed topic-specific guidelines`);
|
|
3817
3838
|
}
|
|
3818
3839
|
const refDir = (0, import_path4.join)(domainPath, "reference");
|
|
3819
3840
|
if ((0, import_fs4.existsSync)(refDir)) {
|
|
3820
|
-
lines2.push(`- \`
|
|
3841
|
+
lines2.push(`- \`_ai-context/${domainUpper}/reference/\` \u2014 cheat sheets and reference material`);
|
|
3821
3842
|
}
|
|
3822
3843
|
lines2.push(``);
|
|
3823
3844
|
}
|
|
@@ -3843,7 +3864,7 @@ async function setupInstructions(config) {
|
|
|
3843
3864
|
switch (agent) {
|
|
3844
3865
|
case "claude-code": {
|
|
3845
3866
|
const content = buildCombinedInstructions(domains, mcpConfig);
|
|
3846
|
-
(
|
|
3867
|
+
upsertBlock((0, import_path4.join)(process.cwd(), "CLAUDE.md"), content);
|
|
3847
3868
|
break;
|
|
3848
3869
|
}
|
|
3849
3870
|
case "github-copilot": {
|
|
@@ -3855,14 +3876,14 @@ applyTo: "**"
|
|
|
3855
3876
|
---
|
|
3856
3877
|
|
|
3857
3878
|
${body}`;
|
|
3858
|
-
(
|
|
3879
|
+
upsertBlock((0, import_path4.join)(instructionsDir, `instructions.instructions.md`), withFrontmatter);
|
|
3859
3880
|
break;
|
|
3860
3881
|
}
|
|
3861
3882
|
case "cursor": {
|
|
3862
3883
|
const cursorDir = (0, import_path4.join)(process.cwd(), ".cursor", "rules");
|
|
3863
3884
|
if (!(0, import_fs4.existsSync)(cursorDir)) (0, import_fs4.mkdirSync)(cursorDir, { recursive: true });
|
|
3864
3885
|
const body = buildCombinedInstructions(domains, mcpConfig);
|
|
3865
|
-
(
|
|
3886
|
+
upsertBlock((0, import_path4.join)(cursorDir, `instructions.mdc`), body);
|
|
3866
3887
|
break;
|
|
3867
3888
|
}
|
|
3868
3889
|
default:
|
|
@@ -3930,10 +3951,11 @@ async function main() {
|
|
|
3930
3951
|
}
|
|
3931
3952
|
const result = await execute(config);
|
|
3932
3953
|
printSummary(result);
|
|
3954
|
+
return;
|
|
3933
3955
|
} catch (error) {
|
|
3934
3956
|
console.error("\n[ERROR]", error instanceof Error ? error.message : String(error));
|
|
3957
|
+
await waitForEnter();
|
|
3935
3958
|
}
|
|
3936
|
-
await waitForEnter();
|
|
3937
3959
|
}
|
|
3938
3960
|
async function collectInputs() {
|
|
3939
3961
|
const selectedIds = await esm_default2({
|
|
@@ -4086,7 +4108,7 @@ async function execute(config) {
|
|
|
4086
4108
|
files: {
|
|
4087
4109
|
instructions: instructionFilePath,
|
|
4088
4110
|
mcpConfig: mcpConfigPath,
|
|
4089
|
-
contexts: "
|
|
4111
|
+
contexts: "_ai-context/"
|
|
4090
4112
|
}
|
|
4091
4113
|
};
|
|
4092
4114
|
try {
|
|
@@ -4100,7 +4122,7 @@ function printSummary(result) {
|
|
|
4100
4122
|
console.log("\u2500".repeat(48));
|
|
4101
4123
|
console.log(hasErrors ? " Done (with errors).\n" : " Done.\n");
|
|
4102
4124
|
if (result.domainsInstalled.length > 0) {
|
|
4103
|
-
console.log(`
|
|
4125
|
+
console.log(` _ai-context/ ${result.domainsInstalled.join(", ")}`);
|
|
4104
4126
|
}
|
|
4105
4127
|
if (result.instructionsCreated) {
|
|
4106
4128
|
console.log(` ${result.instructionFilePath} written`);
|