@lark-apaas/openclaw-dev-cli 0.1.6 → 0.1.8
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/dist/index.js +53 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4185,7 +4185,14 @@ async function genArtifactUploadCredential(appId, commitID = "latest") {
|
|
|
4185
4185
|
if (!body.data?.accessKeyID || !body.data?.secretAccessKey || !body.data?.sessionToken) {
|
|
4186
4186
|
throw new Error("genArtifactUploadCredential returned incomplete credentials");
|
|
4187
4187
|
}
|
|
4188
|
-
|
|
4188
|
+
if (!body.data.buckets?.deploy || !body.data.buckets?.resource) {
|
|
4189
|
+
throw new Error("genArtifactUploadCredential returned incomplete bucket info");
|
|
4190
|
+
}
|
|
4191
|
+
logResponse("genArtifactUploadCredential", {
|
|
4192
|
+
accessKeyID: body.data.accessKeyID,
|
|
4193
|
+
expiredTime: body.data.expiredTime,
|
|
4194
|
+
buckets: body.data.buckets
|
|
4195
|
+
});
|
|
4189
4196
|
return body.data;
|
|
4190
4197
|
}
|
|
4191
4198
|
async function getDefaultBucketId(appId) {
|
|
@@ -7353,9 +7360,35 @@ Available: ${TEMPLATE_TYPES.join(", ")}`
|
|
|
7353
7360
|
console.log(` Directory: ${projectDir}`);
|
|
7354
7361
|
console.log(` App ID: ${appId}`);
|
|
7355
7362
|
console.log(` Template: ${template}`);
|
|
7363
|
+
printDirectoryTree(projectDir);
|
|
7356
7364
|
});
|
|
7357
7365
|
}
|
|
7358
7366
|
};
|
|
7367
|
+
var TREE_IGNORE = /* @__PURE__ */ new Set(["node_modules", ".git", ".turbo", ".next"]);
|
|
7368
|
+
var TREE_MAX_DEPTH = 2;
|
|
7369
|
+
function printDirectoryTree(projectDir) {
|
|
7370
|
+
console.log("\nProject structure:");
|
|
7371
|
+
console.log(import_node_path12.default.basename(projectDir) || projectDir);
|
|
7372
|
+
walk(projectDir, "", 0);
|
|
7373
|
+
}
|
|
7374
|
+
function walk(current, prefix, depth) {
|
|
7375
|
+
if (depth >= TREE_MAX_DEPTH) return;
|
|
7376
|
+
const entries = import_node_fs9.default.readdirSync(current, { withFileTypes: true }).filter((entry) => !TREE_IGNORE.has(entry.name)).sort((a, b2) => {
|
|
7377
|
+
if (a.isDirectory() !== b2.isDirectory()) {
|
|
7378
|
+
return a.isDirectory() ? -1 : 1;
|
|
7379
|
+
}
|
|
7380
|
+
return a.name.localeCompare(b2.name);
|
|
7381
|
+
});
|
|
7382
|
+
entries.forEach((entry, index) => {
|
|
7383
|
+
const isLast = index === entries.length - 1;
|
|
7384
|
+
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7385
|
+
const nextPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
7386
|
+
console.log(`${prefix}${connector}${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
7387
|
+
if (entry.isDirectory()) {
|
|
7388
|
+
walk(import_node_path12.default.join(current, entry.name), nextPrefix, depth + 1);
|
|
7389
|
+
}
|
|
7390
|
+
});
|
|
7391
|
+
}
|
|
7359
7392
|
|
|
7360
7393
|
// src/commands/link/index.ts
|
|
7361
7394
|
var import_node_path13 = __toESM(require("path"));
|
|
@@ -7451,6 +7484,15 @@ var import_node_os2 = __toESM(require("os"));
|
|
|
7451
7484
|
var import_node_path15 = __toESM(require("path"));
|
|
7452
7485
|
var import_node_child_process3 = require("child_process");
|
|
7453
7486
|
var LOG_PREFIX = "[upload]";
|
|
7487
|
+
function normalizeBucket(bucket) {
|
|
7488
|
+
const withScheme = bucket.startsWith("tos://") ? bucket : `tos://${bucket}`;
|
|
7489
|
+
return withScheme.replace(/\/+$/, "");
|
|
7490
|
+
}
|
|
7491
|
+
function buildDestUrl(bucket, suffix) {
|
|
7492
|
+
const base = normalizeBucket(bucket);
|
|
7493
|
+
const normalizedSuffix = suffix.replace(/^\/+/, "");
|
|
7494
|
+
return `${base}/${normalizedSuffix}`;
|
|
7495
|
+
}
|
|
7454
7496
|
var TOSUTIL_DEFAULTS = {
|
|
7455
7497
|
endpoint: "tos-cn-beijing.volces.com",
|
|
7456
7498
|
region: "cn-beijing"
|
|
@@ -7536,22 +7578,26 @@ function uploadOutput(options) {
|
|
|
7536
7578
|
const { projectDir, appId, version, validated, artifactCredential, preUploadResult } = options;
|
|
7537
7579
|
const distDir = import_node_path15.default.join(projectDir, DIST_DIR);
|
|
7538
7580
|
const tosutilPath = resolveTosutilPath();
|
|
7581
|
+
const deployBucket = artifactCredential.buckets?.deploy;
|
|
7582
|
+
const resourceBucket = artifactCredential.buckets?.resource;
|
|
7583
|
+
if (!deployBucket || !resourceBucket) {
|
|
7584
|
+
throw new Error("Artifact credential missing bucket info");
|
|
7585
|
+
}
|
|
7539
7586
|
if (validated.hasOutput) {
|
|
7540
7587
|
const localPath = import_node_path15.default.join(distDir, OUTPUT_DIR);
|
|
7541
|
-
const destUrl =
|
|
7588
|
+
const destUrl = buildDestUrl(deployBucket, `${appId}/${version}/`);
|
|
7542
7589
|
console.error(`${LOG_PREFIX} Uploading output (artifact credential)...`);
|
|
7543
7590
|
uploadWithCredential(tosutilPath, localPath, destUrl, artifactCredential, "output");
|
|
7544
7591
|
}
|
|
7545
7592
|
if (validated.hasOutputResource) {
|
|
7546
7593
|
const localPath = import_node_path15.default.join(distDir, OUTPUT_RESOURCE_DIR);
|
|
7547
|
-
const destUrl =
|
|
7594
|
+
const destUrl = buildDestUrl(resourceBucket, `${appId}/${version}/client/`);
|
|
7548
7595
|
console.error(`${LOG_PREFIX} Uploading output_resource (artifact credential)...`);
|
|
7549
7596
|
uploadWithCredential(tosutilPath, localPath, destUrl, artifactCredential, "resource");
|
|
7550
7597
|
}
|
|
7551
7598
|
if (validated.hasOutputStatic) {
|
|
7552
7599
|
const localPath = import_node_path15.default.join(distDir, OUTPUT_STATIC_DIR);
|
|
7553
|
-
const
|
|
7554
|
-
const destUrl = `${prefix}${OUTPUT_STATIC_DIR}/`;
|
|
7600
|
+
const destUrl = preUploadResult.uploadPrefix.endsWith("/") ? preUploadResult.uploadPrefix : `${preUploadResult.uploadPrefix}/`;
|
|
7555
7601
|
console.error(`${LOG_PREFIX} Uploading output_static (static credential)...`);
|
|
7556
7602
|
uploadWithCredential(tosutilPath, localPath, destUrl, {
|
|
7557
7603
|
accessKeyID: preUploadResult.uploadCredential.AccessKeyID,
|
|
@@ -7592,7 +7638,7 @@ var deployCommand = {
|
|
|
7592
7638
|
MCLAW_VERSION: String(publishResult.version),
|
|
7593
7639
|
MCLAW_STACK: meta.template,
|
|
7594
7640
|
MCLAW_CDN_DOMAIN: cdnDomain,
|
|
7595
|
-
MCLAW_STATIC_PREFIX: preUploadResult.downloadURLPrefix
|
|
7641
|
+
MCLAW_STATIC_PREFIX: preUploadResult.downloadURLPrefix.replace(/\/+$/, "")
|
|
7596
7642
|
};
|
|
7597
7643
|
console.log("\nBuilding...");
|
|
7598
7644
|
console.log(` MCLAW_APP_ID=${meta.appId}`);
|
|
@@ -7672,7 +7718,7 @@ function loadEnvFile(filePath) {
|
|
|
7672
7718
|
}
|
|
7673
7719
|
}
|
|
7674
7720
|
loadEnvFile(import_node_path17.default.join(process.cwd(), ".env"));
|
|
7675
|
-
var VERSION = "0.1.
|
|
7721
|
+
var VERSION = "0.1.7";
|
|
7676
7722
|
var cli = new OpenClawCLI(VERSION);
|
|
7677
7723
|
cli.useAll(commands);
|
|
7678
7724
|
cli.run();
|