@lark-apaas/openclaw-dev-cli 0.1.0 → 0.1.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/dist/index.js +7 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4082,7 +4082,7 @@ var RENAME_FILES = {
|
|
|
4082
4082
|
_gitignore: ".gitignore",
|
|
4083
4083
|
"_env.local": ".env.local"
|
|
4084
4084
|
};
|
|
4085
|
-
var TEMPLATE_PACKAGE = "@lark-apaas/coding-
|
|
4085
|
+
var TEMPLATE_PACKAGE = "@lark-apaas/coding-templates";
|
|
4086
4086
|
var SPARK_DIR = ".spark";
|
|
4087
4087
|
var SPARK_META_FILE = "meta.json";
|
|
4088
4088
|
var DIST_DIR = "dist";
|
|
@@ -4109,20 +4109,13 @@ function getHttpClient() {
|
|
|
4109
4109
|
enabled: true
|
|
4110
4110
|
}
|
|
4111
4111
|
});
|
|
4112
|
-
const canaryEnv = process.env.MCLAW_API_CANARY;
|
|
4112
|
+
const canaryEnv = process.env.MCLAW_API_CANARY || "boe_miaoda_claw_code_agent_v4";
|
|
4113
4113
|
if (canaryEnv) {
|
|
4114
4114
|
clientInstance.interceptors.request.use((req) => {
|
|
4115
4115
|
req.headers["x-tt-env"] = canaryEnv;
|
|
4116
4116
|
return req;
|
|
4117
4117
|
});
|
|
4118
4118
|
}
|
|
4119
|
-
if (process.env.MCLAW_DEBUG) {
|
|
4120
|
-
clientInstance.interceptors.request.use((req) => {
|
|
4121
|
-
console.log(`[debug] ${req.method} ${req.url}`);
|
|
4122
|
-
console.log(`[debug] headers:`, JSON.stringify(req.headers, null, 2));
|
|
4123
|
-
return req;
|
|
4124
|
-
});
|
|
4125
|
-
}
|
|
4126
4119
|
}
|
|
4127
4120
|
return clientInstance;
|
|
4128
4121
|
}
|
|
@@ -4140,9 +4133,6 @@ async function parseResponse(response) {
|
|
|
4140
4133
|
}
|
|
4141
4134
|
|
|
4142
4135
|
// src/utils/api.ts
|
|
4143
|
-
function isMockEnabled() {
|
|
4144
|
-
return process.env.MCLAW_MOCK_API === "true";
|
|
4145
|
-
}
|
|
4146
4136
|
function logRequest(name, url, params) {
|
|
4147
4137
|
console.log(`
|
|
4148
4138
|
[api] ${name} \u2192 ${url}`);
|
|
@@ -4156,12 +4146,6 @@ function logResponse(name, data) {
|
|
|
4156
4146
|
async function createSubApp(params) {
|
|
4157
4147
|
const url = "/api/v1/studio/innerapi/openclaw/sub_app/create";
|
|
4158
4148
|
logRequest("createSubApp", url, params);
|
|
4159
|
-
if (isMockEnabled()) {
|
|
4160
|
-
const mockId = `app_mock_${Date.now().toString(36)}`;
|
|
4161
|
-
const result2 = { appID: mockId };
|
|
4162
|
-
logResponse("createSubApp", result2);
|
|
4163
|
-
return result2;
|
|
4164
|
-
}
|
|
4165
4149
|
const client = getHttpClient();
|
|
4166
4150
|
const response = await client.post(url, params);
|
|
4167
4151
|
const result = await parseResponse(response);
|
|
@@ -4171,11 +4155,6 @@ async function createSubApp(params) {
|
|
|
4171
4155
|
async function createPublish(appId) {
|
|
4172
4156
|
const url = `/api/v1/studio/innerapi/openclaw/sub_app/${appId}/publish/create`;
|
|
4173
4157
|
logRequest("createPublish", url);
|
|
4174
|
-
if (isMockEnabled()) {
|
|
4175
|
-
const result2 = { publishID: "pub_mock", version: 1 };
|
|
4176
|
-
logResponse("createPublish", result2);
|
|
4177
|
-
return result2;
|
|
4178
|
-
}
|
|
4179
4158
|
const client = getHttpClient();
|
|
4180
4159
|
const response = await client.post(url);
|
|
4181
4160
|
const result = await parseResponse(response);
|
|
@@ -4185,14 +4164,11 @@ async function createPublish(appId) {
|
|
|
4185
4164
|
async function updatePublish(appId, params) {
|
|
4186
4165
|
const url = `/api/v1/studio/innerapi/openclaw/sub_app/${appId}/publish/update`;
|
|
4187
4166
|
logRequest("updatePublish", url, params);
|
|
4188
|
-
if (isMockEnabled()) {
|
|
4189
|
-
logResponse("updatePublish", "ok");
|
|
4190
|
-
return;
|
|
4191
|
-
}
|
|
4192
4167
|
const client = getHttpClient();
|
|
4193
4168
|
const response = await client.post(url, params);
|
|
4194
|
-
await parseResponse(response);
|
|
4195
|
-
logResponse("updatePublish",
|
|
4169
|
+
const result = await parseResponse(response);
|
|
4170
|
+
logResponse("updatePublish", result);
|
|
4171
|
+
return result;
|
|
4196
4172
|
}
|
|
4197
4173
|
async function genArtifactUploadCredential(appId, commitID = "latest") {
|
|
4198
4174
|
const url = `/v1/app/${appId}/pipeline/gen_artifact_upload_credential`;
|
|
@@ -4203,7 +4179,6 @@ async function genArtifactUploadCredential(appId, commitID = "latest") {
|
|
|
4203
4179
|
throw new Error(`genArtifactUploadCredential failed: ${response.status} ${response.statusText}`);
|
|
4204
4180
|
}
|
|
4205
4181
|
const body = await response.json();
|
|
4206
|
-
console.log(`[api] raw response: status_code=${body.status_code}`);
|
|
4207
4182
|
if (body.status_code !== "0") {
|
|
4208
4183
|
throw new Error(`genArtifactUploadCredential error: status_code=${body.status_code}`);
|
|
4209
4184
|
}
|
|
@@ -4222,7 +4197,6 @@ async function getDefaultBucketId(appId) {
|
|
|
4222
4197
|
throw new Error(`getDefaultBucketId failed: ${response.status} ${response.statusText}`);
|
|
4223
4198
|
}
|
|
4224
4199
|
const body = await response.json();
|
|
4225
|
-
console.log(`[api] raw response: status_code=${body.status_code}`);
|
|
4226
4200
|
if (body.status_code !== "0") {
|
|
4227
4201
|
throw new Error(`getDefaultBucketId error: status_code=${body.status_code}`);
|
|
4228
4202
|
}
|
|
@@ -4241,7 +4215,6 @@ async function preUploadStatic(appId, bucketId) {
|
|
|
4241
4215
|
throw new Error(`preUploadStatic failed: ${response.status} ${response.statusText}`);
|
|
4242
4216
|
}
|
|
4243
4217
|
const body = await response.json();
|
|
4244
|
-
console.log(`[api] raw response: status_code=${body.status_code}`);
|
|
4245
4218
|
if (body.status_code !== "0") {
|
|
4246
4219
|
throw new Error(`preUploadStatic error: status_code=${body.status_code}`);
|
|
4247
4220
|
}
|
|
@@ -4264,7 +4237,6 @@ async function callbackStatic(appId, bucketId, uploadID) {
|
|
|
4264
4237
|
throw new Error(`callbackStatic failed: ${response.status} ${response.statusText}`);
|
|
4265
4238
|
}
|
|
4266
4239
|
const body = await response.json();
|
|
4267
|
-
console.log(`[api] raw response: status_code=${body.status_code}`);
|
|
4268
4240
|
if (body.status_code !== "0") {
|
|
4269
4241
|
throw new Error(`callbackStatic error: status_code=${body.status_code}`);
|
|
4270
4242
|
}
|
|
@@ -7636,11 +7608,11 @@ var deployCommand = {
|
|
|
7636
7608
|
routesConfig = import_node_fs13.default.readFileSync(routesPath, "utf-8");
|
|
7637
7609
|
console.log("Found routes.json, including in publish.");
|
|
7638
7610
|
}
|
|
7639
|
-
await updatePublish(meta.app_id, {
|
|
7611
|
+
const publishUpdateResult = await updatePublish(meta.app_id, {
|
|
7640
7612
|
publishID: publishResult.publishID,
|
|
7641
7613
|
routesConfig
|
|
7642
7614
|
});
|
|
7643
|
-
const appUrl = buildAppUrl(meta.app_id);
|
|
7615
|
+
const appUrl = publishUpdateResult.onlineURL || buildAppUrl(meta.app_id);
|
|
7644
7616
|
writeSparkMeta(projectDir, {
|
|
7645
7617
|
...meta,
|
|
7646
7618
|
app_url: appUrl
|