dlw-machine-setup 0.2.4 → 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.
Files changed (2) hide show
  1. package/bin/installer.js +32 -11
  2. 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, "contexts");
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(), "contexts");
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 \`contexts/\` folder:`,
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(`- \`contexts/${domainUpper}/core/instructions.md\` \u2014 core development guidelines`);
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(`- \`contexts/${domainUpper}/core/instructions/\` \u2014 detailed topic-specific guidelines`);
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(`- \`contexts/${domainUpper}/reference/\` \u2014 cheat sheets and reference material`);
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
- (0, import_fs4.writeFileSync)((0, import_path4.join)(process.cwd(), "CLAUDE.md"), content, "utf-8");
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
- (0, import_fs4.writeFileSync)((0, import_path4.join)(instructionsDir, `instructions.instructions.md`), withFrontmatter, "utf-8");
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
- (0, import_fs4.writeFileSync)((0, import_path4.join)(cursorDir, `instructions.mdc`), body, "utf-8");
3886
+ upsertBlock((0, import_path4.join)(cursorDir, `instructions.mdc`), body);
3866
3887
  break;
3867
3888
  }
3868
3889
  default:
@@ -4087,7 +4108,7 @@ async function execute(config) {
4087
4108
  files: {
4088
4109
  instructions: instructionFilePath,
4089
4110
  mcpConfig: mcpConfigPath,
4090
- contexts: "contexts/"
4111
+ contexts: "_ai-context/"
4091
4112
  }
4092
4113
  };
4093
4114
  try {
@@ -4101,7 +4122,7 @@ function printSummary(result) {
4101
4122
  console.log("\u2500".repeat(48));
4102
4123
  console.log(hasErrors ? " Done (with errors).\n" : " Done.\n");
4103
4124
  if (result.domainsInstalled.length > 0) {
4104
- console.log(` contexts/ ${result.domainsInstalled.join(", ")}`);
4125
+ console.log(` _ai-context/ ${result.domainsInstalled.join(", ")}`);
4105
4126
  }
4106
4127
  if (result.instructionsCreated) {
4107
4128
  console.log(` ${result.instructionFilePath} written`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"