dlw-machine-setup 0.3.1 → 0.3.2
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 +0 -4
- package/bin/installer.js +47 -12
- package/package.json +1 -1
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
|
-
|
|
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/${
|
|
3255
|
+
`https://api.github.com/repos/${repo}/releases/latest`,
|
|
3257
3256
|
{ headers }
|
|
3258
3257
|
);
|
|
3259
3258
|
if (!releaseRes.ok) return null;
|
|
@@ -3274,6 +3273,38 @@ 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 response = await fetch(
|
|
3281
|
+
`https://api.github.com/search/repositories?q=topic:${REPO_TOPIC}+org:${GITHUB_ORG}`,
|
|
3282
|
+
{
|
|
3283
|
+
headers: {
|
|
3284
|
+
"Accept": "application/vnd.github+json",
|
|
3285
|
+
"Authorization": `Bearer ${token}`
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
);
|
|
3289
|
+
if (!response.ok) {
|
|
3290
|
+
throw new Error(
|
|
3291
|
+
`Failed to discover data repository (HTTP ${response.status}). Check your GitHub token and network.`
|
|
3292
|
+
);
|
|
3293
|
+
}
|
|
3294
|
+
const data = await response.json();
|
|
3295
|
+
if (data.total_count === 0) {
|
|
3296
|
+
throw new Error(
|
|
3297
|
+
"No data repository found. Verify your GitHub account has access to the organization."
|
|
3298
|
+
);
|
|
3299
|
+
}
|
|
3300
|
+
if (data.total_count > 1) {
|
|
3301
|
+
throw new Error(
|
|
3302
|
+
"Multiple data repositories found. Contact your administrator."
|
|
3303
|
+
);
|
|
3304
|
+
}
|
|
3305
|
+
return data.items[0].full_name;
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3277
3308
|
// src/utils/data/fetch-contexts.ts
|
|
3278
3309
|
var import_fs2 = require("fs");
|
|
3279
3310
|
var import_path2 = require("path");
|
|
@@ -3435,12 +3466,14 @@ async function getGitHubToken() {
|
|
|
3435
3466
|
}
|
|
3436
3467
|
|
|
3437
3468
|
// src/utils/data/fetch-contexts.ts
|
|
3438
|
-
var GITHUB_REPO2 = "DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client";
|
|
3439
3469
|
var MAX_RETRIES = 3;
|
|
3440
3470
|
var RETRY_DELAY_MS = 2e3;
|
|
3441
3471
|
var MIN_FILE_SIZE = 1024;
|
|
3442
3472
|
async function fetchContexts(options = {}) {
|
|
3443
|
-
const { domains = [], targetDir = process.cwd(), force = false, token } = options;
|
|
3473
|
+
const { domains = [], targetDir = process.cwd(), force = false, token, repo } = options;
|
|
3474
|
+
if (!repo) {
|
|
3475
|
+
throw new Error("Repository not specified. Discovery may have failed.");
|
|
3476
|
+
}
|
|
3444
3477
|
const result = {
|
|
3445
3478
|
successful: [],
|
|
3446
3479
|
failed: [],
|
|
@@ -3453,7 +3486,7 @@ async function fetchContexts(options = {}) {
|
|
|
3453
3486
|
await checkPrerequisites();
|
|
3454
3487
|
const githubToken = token ?? await getGitHubToken();
|
|
3455
3488
|
try {
|
|
3456
|
-
const releaseUrl = `https://api.github.com/repos/${
|
|
3489
|
+
const releaseUrl = `https://api.github.com/repos/${repo}/releases/latest`;
|
|
3457
3490
|
const headers = {
|
|
3458
3491
|
"Accept": "application/vnd.github+json",
|
|
3459
3492
|
"Authorization": `Bearer ${githubToken}`
|
|
@@ -3813,8 +3846,8 @@ ${body}`;
|
|
|
3813
3846
|
}
|
|
3814
3847
|
|
|
3815
3848
|
// src/utils/mod.ts
|
|
3816
|
-
async function loadWizardOptions(token) {
|
|
3817
|
-
const remote = await fetchWizardOptions(token);
|
|
3849
|
+
async function loadWizardOptions(token, repo) {
|
|
3850
|
+
const remote = await fetchWizardOptions(token, repo);
|
|
3818
3851
|
if (!remote) {
|
|
3819
3852
|
throw new Error("Failed to load configuration from GitHub release. Check your network and token.");
|
|
3820
3853
|
}
|
|
@@ -3872,8 +3905,10 @@ async function main() {
|
|
|
3872
3905
|
console.log("One-Shot Setup Installer\n");
|
|
3873
3906
|
try {
|
|
3874
3907
|
const token = await getGitHubToken();
|
|
3908
|
+
console.log(" Locating data repository...");
|
|
3909
|
+
const repo = await discoverRepo(token);
|
|
3875
3910
|
console.log(" Loading configuration...");
|
|
3876
|
-
const options = await loadWizardOptions(token);
|
|
3911
|
+
const options = await loadWizardOptions(token, repo);
|
|
3877
3912
|
const config = await collectInputs(options);
|
|
3878
3913
|
if (!config) {
|
|
3879
3914
|
await waitForEnter();
|
|
@@ -3885,7 +3920,7 @@ async function main() {
|
|
|
3885
3920
|
await waitForEnter();
|
|
3886
3921
|
return;
|
|
3887
3922
|
}
|
|
3888
|
-
const result = await execute(config, token);
|
|
3923
|
+
const result = await execute(config, token, repo);
|
|
3889
3924
|
printSummary(result);
|
|
3890
3925
|
return;
|
|
3891
3926
|
} catch (error) {
|
|
@@ -3965,7 +4000,7 @@ async function previewAndConfirm(config, options) {
|
|
|
3965
4000
|
console.log("\n" + "\u2500".repeat(48));
|
|
3966
4001
|
return esm_default3({ message: "Proceed?", default: true });
|
|
3967
4002
|
}
|
|
3968
|
-
async function execute(config, token) {
|
|
4003
|
+
async function execute(config, token, repo) {
|
|
3969
4004
|
const instructionFilePath = getInstructionFilePath(config.agent);
|
|
3970
4005
|
const mcpConfigPath = getMCPConfigPath(config.agent);
|
|
3971
4006
|
const result = {
|
|
@@ -3984,7 +4019,7 @@ async function execute(config, token) {
|
|
|
3984
4019
|
const domainValues = uniqueDomains.map((d) => d.toLowerCase());
|
|
3985
4020
|
console.log(` Downloading contexts...`);
|
|
3986
4021
|
try {
|
|
3987
|
-
const downloadResult = await fetchContexts({ domains: domainValues, token });
|
|
4022
|
+
const downloadResult = await fetchContexts({ domains: domainValues, token, repo });
|
|
3988
4023
|
result.domainsInstalled = downloadResult.successful;
|
|
3989
4024
|
result.domainsFailed = downloadResult.failed;
|
|
3990
4025
|
result.failureReasons = downloadResult.failureReasons;
|