dlw-machine-setup 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -99,10 +99,6 @@ The installer provides:
99
99
  - **MCP server configuration** for AI assistants (Claude, Copilot, Cursor)
100
100
  - **Setup instructions** for your development environment
101
101
 
102
- ## Repository
103
-
104
- GitHub: [DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client](https://github.com/DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client)
105
-
106
102
  ## License
107
103
 
108
104
  Internal use only - DLW-INT-SAP-DEV organization
package/bin/installer.js CHANGED
@@ -3245,15 +3245,14 @@ var import_readline = require("readline");
3245
3245
  var import_path5 = require("path");
3246
3246
 
3247
3247
  // src/utils/data/fetch-wizard-options.ts
3248
- var GITHUB_REPO = "DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client";
3249
- async function fetchWizardOptions(token) {
3248
+ async function fetchWizardOptions(token, repo) {
3250
3249
  try {
3251
3250
  const headers = {
3252
3251
  "Accept": "application/vnd.github+json",
3253
3252
  "Authorization": `Bearer ${token}`
3254
3253
  };
3255
3254
  const releaseRes = await fetch(
3256
- `https://api.github.com/repos/${GITHUB_REPO}/releases/latest`,
3255
+ `https://api.github.com/repos/${repo}/releases/latest`,
3257
3256
  { headers }
3258
3257
  );
3259
3258
  if (!releaseRes.ok) return null;
@@ -3274,6 +3273,49 @@ async function fetchWizardOptions(token) {
3274
3273
  }
3275
3274
  }
3276
3275
 
3276
+ // src/utils/data/discover-repo.ts
3277
+ var GITHUB_ORG = "DLW-INT-SAP-DEV";
3278
+ var REPO_TOPIC = "one-shot-data";
3279
+ async function discoverRepo(token) {
3280
+ const headers = {
3281
+ "Accept": "application/vnd.github+json",
3282
+ "Authorization": `Bearer ${token}`
3283
+ };
3284
+ const matched = [];
3285
+ let page = 1;
3286
+ while (true) {
3287
+ const response = await fetch(
3288
+ `https://api.github.com/orgs/${GITHUB_ORG}/repos?type=all&per_page=100&page=${page}`,
3289
+ { headers }
3290
+ );
3291
+ if (!response.ok) {
3292
+ throw new Error(
3293
+ `Failed to list organization repositories (HTTP ${response.status}). Check your GitHub token and network.`
3294
+ );
3295
+ }
3296
+ const repos = await response.json();
3297
+ if (repos.length === 0) break;
3298
+ for (const repo of repos) {
3299
+ if (repo.topics?.includes(REPO_TOPIC)) {
3300
+ matched.push(repo.full_name);
3301
+ }
3302
+ }
3303
+ if (repos.length < 100) break;
3304
+ page++;
3305
+ }
3306
+ if (matched.length === 0) {
3307
+ throw new Error(
3308
+ "No data repository found. Verify your GitHub account has access to the organization."
3309
+ );
3310
+ }
3311
+ if (matched.length > 1) {
3312
+ throw new Error(
3313
+ "Multiple data repositories found. Contact your administrator."
3314
+ );
3315
+ }
3316
+ return matched[0];
3317
+ }
3318
+
3277
3319
  // src/utils/data/fetch-contexts.ts
3278
3320
  var import_fs2 = require("fs");
3279
3321
  var import_path2 = require("path");
@@ -3435,12 +3477,14 @@ async function getGitHubToken() {
3435
3477
  }
3436
3478
 
3437
3479
  // src/utils/data/fetch-contexts.ts
3438
- var GITHUB_REPO2 = "DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client";
3439
3480
  var MAX_RETRIES = 3;
3440
3481
  var RETRY_DELAY_MS = 2e3;
3441
3482
  var MIN_FILE_SIZE = 1024;
3442
3483
  async function fetchContexts(options = {}) {
3443
- const { domains = [], targetDir = process.cwd(), force = false, token } = options;
3484
+ const { domains = [], targetDir = process.cwd(), force = false, token, repo } = options;
3485
+ if (!repo) {
3486
+ throw new Error("Repository not specified. Discovery may have failed.");
3487
+ }
3444
3488
  const result = {
3445
3489
  successful: [],
3446
3490
  failed: [],
@@ -3453,7 +3497,7 @@ async function fetchContexts(options = {}) {
3453
3497
  await checkPrerequisites();
3454
3498
  const githubToken = token ?? await getGitHubToken();
3455
3499
  try {
3456
- const releaseUrl = `https://api.github.com/repos/${GITHUB_REPO2}/releases/latest`;
3500
+ const releaseUrl = `https://api.github.com/repos/${repo}/releases/latest`;
3457
3501
  const headers = {
3458
3502
  "Accept": "application/vnd.github+json",
3459
3503
  "Authorization": `Bearer ${githubToken}`
@@ -3813,8 +3857,8 @@ ${body}`;
3813
3857
  }
3814
3858
 
3815
3859
  // src/utils/mod.ts
3816
- async function loadWizardOptions(token) {
3817
- const remote = await fetchWizardOptions(token);
3860
+ async function loadWizardOptions(token, repo) {
3861
+ const remote = await fetchWizardOptions(token, repo);
3818
3862
  if (!remote) {
3819
3863
  throw new Error("Failed to load configuration from GitHub release. Check your network and token.");
3820
3864
  }
@@ -3872,8 +3916,10 @@ async function main() {
3872
3916
  console.log("One-Shot Setup Installer\n");
3873
3917
  try {
3874
3918
  const token = await getGitHubToken();
3919
+ console.log(" Locating data repository...");
3920
+ const repo = await discoverRepo(token);
3875
3921
  console.log(" Loading configuration...");
3876
- const options = await loadWizardOptions(token);
3922
+ const options = await loadWizardOptions(token, repo);
3877
3923
  const config = await collectInputs(options);
3878
3924
  if (!config) {
3879
3925
  await waitForEnter();
@@ -3885,7 +3931,7 @@ async function main() {
3885
3931
  await waitForEnter();
3886
3932
  return;
3887
3933
  }
3888
- const result = await execute(config, token);
3934
+ const result = await execute(config, token, repo);
3889
3935
  printSummary(result);
3890
3936
  return;
3891
3937
  } catch (error) {
@@ -3965,7 +4011,7 @@ async function previewAndConfirm(config, options) {
3965
4011
  console.log("\n" + "\u2500".repeat(48));
3966
4012
  return esm_default3({ message: "Proceed?", default: true });
3967
4013
  }
3968
- async function execute(config, token) {
4014
+ async function execute(config, token, repo) {
3969
4015
  const instructionFilePath = getInstructionFilePath(config.agent);
3970
4016
  const mcpConfigPath = getMCPConfigPath(config.agent);
3971
4017
  const result = {
@@ -3984,7 +4030,7 @@ async function execute(config, token) {
3984
4030
  const domainValues = uniqueDomains.map((d) => d.toLowerCase());
3985
4031
  console.log(` Downloading contexts...`);
3986
4032
  try {
3987
- const downloadResult = await fetchContexts({ domains: domainValues, token });
4033
+ const downloadResult = await fetchContexts({ domains: domainValues, token, repo });
3988
4034
  result.domainsInstalled = downloadResult.successful;
3989
4035
  result.domainsFailed = downloadResult.failed;
3990
4036
  result.failureReasons = downloadResult.failureReasons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"