cmx-sdk 0.2.21 → 0.2.22
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/{add-studio-QWLCCO5M.js → add-studio-2COHXK65.js} +6 -3
- package/dist/{chunk-ZBI5OLBT.js → chunk-2WLUAJR2.js} +0 -108
- package/dist/chunk-7TDMLYBI.js +0 -0
- package/dist/chunk-EDXXR5BE.js +0 -0
- package/dist/chunk-IIQLQIDP.js +0 -0
- package/dist/chunk-NZQ6SBFS.js +0 -0
- package/dist/chunk-WJ5REY5E.js +124 -0
- package/dist/chunk-Y3S3K6M3.js +0 -0
- package/dist/{chunk-FPQYL5GE.js → chunk-YYDYSBN7.js} +6 -3
- package/dist/cli.js +18 -27
- package/dist/init-FPFDEEXW.js +0 -0
- package/dist/{interactive-menu-5NJTB5LJ.js → interactive-menu-R3TJZOMK.js} +2 -2
- package/dist/{report-bug-PT7NNFNN.js → report-bug-WSGGML4H.js} +5 -3
- package/dist/studio-HAS6DYLO.js +0 -0
- package/dist/update-sdk-ZXMWQF3I.js +0 -0
- package/dist/{update-studio-TWCYSYIS.js → update-studio-QSBDG7ZI.js} +2 -1
- package/package.json +16 -15
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
getStudioStandaloneDevCommand
|
|
11
11
|
} from "./chunk-EDXXR5BE.js";
|
|
12
12
|
import "./chunk-IIQLQIDP.js";
|
|
13
|
+
import {
|
|
14
|
+
getApiUrl
|
|
15
|
+
} from "./chunk-WJ5REY5E.js";
|
|
13
16
|
|
|
14
17
|
// src/commands/add-studio.ts
|
|
15
18
|
import { existsSync } from "fs";
|
|
@@ -32,13 +35,13 @@ async function addStudio() {
|
|
|
32
35
|
}
|
|
33
36
|
const envFile = existsSync(join(projectRoot, ".env.local")) ? join(projectRoot, ".env.local") : join(projectRoot, ".env");
|
|
34
37
|
config({ path: envFile });
|
|
35
|
-
const apiUrl = process.env.CMX_API_URL;
|
|
36
38
|
const apiKey = process.env.CMX_API_KEY;
|
|
37
|
-
if (!
|
|
38
|
-
console.error(" \u274C
|
|
39
|
+
if (!apiKey) {
|
|
40
|
+
console.error(" \u274C CMX_API_KEY \u304C\u5FC5\u8981\u3067\u3059");
|
|
39
41
|
console.error(" .env.local \u306B\u8A8D\u8A3C\u60C5\u5831\u3092\u8A2D\u5B9A\u3057\u3066\u304B\u3089\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\n");
|
|
40
42
|
process.exit(1);
|
|
41
43
|
}
|
|
44
|
+
const apiUrl = getApiUrl();
|
|
42
45
|
console.log(" \u23F3 Studio \u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u4E2D...");
|
|
43
46
|
try {
|
|
44
47
|
await downloadStudioFiles(studioDir, { apiUrl, apiKey });
|
|
@@ -1,108 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/commands/utils.ts
|
|
4
|
-
import { readFileSync } from "fs";
|
|
5
|
-
function stringifyErrorValue(value) {
|
|
6
|
-
if (typeof value === "string") return value;
|
|
7
|
-
if (value === null || value === void 0) return "";
|
|
8
|
-
if (typeof value === "object") {
|
|
9
|
-
const objectValue = value;
|
|
10
|
-
if (typeof objectValue.message === "string" && objectValue.message.length > 0) {
|
|
11
|
-
return objectValue.message;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
return JSON.stringify(value);
|
|
15
|
-
} catch {
|
|
16
|
-
return String(value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return String(value);
|
|
20
|
-
}
|
|
21
|
-
function formatApiErrorPayload(payload) {
|
|
22
|
-
if (typeof payload === "string") {
|
|
23
|
-
return formatApiErrorMessage(payload);
|
|
24
|
-
}
|
|
25
|
-
const parsed = payload ?? {};
|
|
26
|
-
const main = stringifyErrorValue(parsed.error ?? parsed.message);
|
|
27
|
-
const details = stringifyErrorValue(parsed.details);
|
|
28
|
-
const code = typeof parsed.code === "string" ? parsed.code : void 0;
|
|
29
|
-
const message = [main, details].filter((part, index, parts) => part.length > 0 && parts.indexOf(part) === index).join(" | ");
|
|
30
|
-
if (code && message) return `${code}: ${message}`;
|
|
31
|
-
if (code) return code;
|
|
32
|
-
if (message) return message;
|
|
33
|
-
return "\u4E0D\u660E\u306A\u30A8\u30E9\u30FC";
|
|
34
|
-
}
|
|
35
|
-
function formatApiErrorMessage(errorBody) {
|
|
36
|
-
if (!errorBody) return "\u4E0D\u660E\u306A\u30A8\u30E9\u30FC";
|
|
37
|
-
try {
|
|
38
|
-
return formatApiErrorPayload(JSON.parse(errorBody));
|
|
39
|
-
} catch {
|
|
40
|
-
}
|
|
41
|
-
return errorBody;
|
|
42
|
-
}
|
|
43
|
-
var sdkFetchInterceptorInstalled = false;
|
|
44
|
-
function installSdkFetchInterceptor() {
|
|
45
|
-
if (sdkFetchInterceptorInstalled) return;
|
|
46
|
-
if (typeof globalThis.fetch !== "function") return;
|
|
47
|
-
const originalFetch = globalThis.fetch.bind(globalThis);
|
|
48
|
-
globalThis.fetch = async (input, init) => {
|
|
49
|
-
if (typeof input === "string" || input instanceof URL) {
|
|
50
|
-
const rawUrl = input.toString();
|
|
51
|
-
if (rawUrl.startsWith("/api/v1/sdk")) {
|
|
52
|
-
const apiUrl = process.env.CMX_API_URL;
|
|
53
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
54
|
-
if (!apiUrl || !apiKey) {
|
|
55
|
-
throw new Error("\u74B0\u5883\u5909\u6570 CMX_API_URL \u3068 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
56
|
-
}
|
|
57
|
-
const baseUrl = apiUrl.replace(/\/$/, "");
|
|
58
|
-
const absoluteUrl = `${baseUrl}${rawUrl}`;
|
|
59
|
-
const headers = new Headers(init?.headers);
|
|
60
|
-
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
61
|
-
return originalFetch(absoluteUrl, {
|
|
62
|
-
...init,
|
|
63
|
-
headers
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return originalFetch(input, init);
|
|
68
|
-
};
|
|
69
|
-
sdkFetchInterceptorInstalled = true;
|
|
70
|
-
}
|
|
71
|
-
function assertSdkSuccess(response) {
|
|
72
|
-
if (response.status >= 200 && response.status < 300) {
|
|
73
|
-
return response.data;
|
|
74
|
-
}
|
|
75
|
-
throw new Error(`API \u30A8\u30E9\u30FC (${response.status}): ${formatApiErrorPayload(response.data)}`);
|
|
76
|
-
}
|
|
77
|
-
function readJsonInput(options) {
|
|
78
|
-
if (options.json) {
|
|
79
|
-
try {
|
|
80
|
-
return JSON.parse(options.json);
|
|
81
|
-
} catch {
|
|
82
|
-
console.error("\u30A8\u30E9\u30FC: --json \u306E JSON \u6587\u5B57\u5217\u304C\u4E0D\u6B63\u3067\u3059");
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (options.file) {
|
|
87
|
-
try {
|
|
88
|
-
const content = readFileSync(options.file, "utf-8");
|
|
89
|
-
return JSON.parse(content);
|
|
90
|
-
} catch (err) {
|
|
91
|
-
console.error(`\u30A8\u30E9\u30FC: JSON \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${options.file}`);
|
|
92
|
-
console.error(err instanceof Error ? err.message : err);
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
console.error("\u30A8\u30E9\u30FC: --json \u307E\u305F\u306F --file \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
function ensureApiCredentials() {
|
|
100
|
-
if (!process.env.CMX_API_URL || !process.env.CMX_API_KEY) {
|
|
101
|
-
console.error("\u30A8\u30E9\u30FC: \u74B0\u5883\u5909\u6570 CMX_API_URL \u3068 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
3
|
// src/core/date-reviver.ts
|
|
107
4
|
var isoDateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;
|
|
108
5
|
function dateReviver(_key, value) {
|
|
@@ -798,11 +695,6 @@ var postManageBugReports = async (sdkCreateBugReportBody, options) => {
|
|
|
798
695
|
};
|
|
799
696
|
|
|
800
697
|
export {
|
|
801
|
-
formatApiErrorMessage,
|
|
802
|
-
installSdkFetchInterceptor,
|
|
803
|
-
assertSdkSuccess,
|
|
804
|
-
readJsonInput,
|
|
805
|
-
ensureApiCredentials,
|
|
806
698
|
getManageCollections,
|
|
807
699
|
postManageCollections,
|
|
808
700
|
getManageCollectionsSlug,
|
package/dist/chunk-7TDMLYBI.js
CHANGED
|
File without changes
|
package/dist/chunk-EDXXR5BE.js
CHANGED
|
File without changes
|
package/dist/chunk-IIQLQIDP.js
CHANGED
|
File without changes
|
package/dist/chunk-NZQ6SBFS.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/utils.ts
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
var DEFAULT_API_URL = "https://app.cmx-ai.org";
|
|
6
|
+
function getApiUrl() {
|
|
7
|
+
return (process.env.CMX_API_URL || DEFAULT_API_URL).replace(/\/$/, "");
|
|
8
|
+
}
|
|
9
|
+
function getApiCredentials() {
|
|
10
|
+
const apiKey = process.env.CMX_API_KEY;
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
console.error("\u30A8\u30E9\u30FC: \u74B0\u5883\u5909\u6570 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
return { apiUrl: getApiUrl(), apiKey };
|
|
16
|
+
}
|
|
17
|
+
function stringifyErrorValue(value) {
|
|
18
|
+
if (typeof value === "string") return value;
|
|
19
|
+
if (value === null || value === void 0) return "";
|
|
20
|
+
if (typeof value === "object") {
|
|
21
|
+
const objectValue = value;
|
|
22
|
+
if (typeof objectValue.message === "string" && objectValue.message.length > 0) {
|
|
23
|
+
return objectValue.message;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return JSON.stringify(value);
|
|
27
|
+
} catch {
|
|
28
|
+
return String(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return String(value);
|
|
32
|
+
}
|
|
33
|
+
function formatApiErrorPayload(payload) {
|
|
34
|
+
if (typeof payload === "string") {
|
|
35
|
+
return formatApiErrorMessage(payload);
|
|
36
|
+
}
|
|
37
|
+
const parsed = payload ?? {};
|
|
38
|
+
const main = stringifyErrorValue(parsed.error ?? parsed.message);
|
|
39
|
+
const details = stringifyErrorValue(parsed.details);
|
|
40
|
+
const code = typeof parsed.code === "string" ? parsed.code : void 0;
|
|
41
|
+
const message = [main, details].filter((part, index, parts) => part.length > 0 && parts.indexOf(part) === index).join(" | ");
|
|
42
|
+
if (code && message) return `${code}: ${message}`;
|
|
43
|
+
if (code) return code;
|
|
44
|
+
if (message) return message;
|
|
45
|
+
return "\u4E0D\u660E\u306A\u30A8\u30E9\u30FC";
|
|
46
|
+
}
|
|
47
|
+
function formatApiErrorMessage(errorBody) {
|
|
48
|
+
if (!errorBody) return "\u4E0D\u660E\u306A\u30A8\u30E9\u30FC";
|
|
49
|
+
try {
|
|
50
|
+
return formatApiErrorPayload(JSON.parse(errorBody));
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
return errorBody;
|
|
54
|
+
}
|
|
55
|
+
var sdkFetchInterceptorInstalled = false;
|
|
56
|
+
function installSdkFetchInterceptor() {
|
|
57
|
+
if (sdkFetchInterceptorInstalled) return;
|
|
58
|
+
if (typeof globalThis.fetch !== "function") return;
|
|
59
|
+
const originalFetch = globalThis.fetch.bind(globalThis);
|
|
60
|
+
globalThis.fetch = async (input, init) => {
|
|
61
|
+
if (typeof input === "string" || input instanceof URL) {
|
|
62
|
+
const rawUrl = input.toString();
|
|
63
|
+
if (rawUrl.startsWith("/api/v1/sdk")) {
|
|
64
|
+
const apiKey = process.env.CMX_API_KEY;
|
|
65
|
+
if (!apiKey) {
|
|
66
|
+
throw new Error("\u74B0\u5883\u5909\u6570 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
67
|
+
}
|
|
68
|
+
const absoluteUrl = `${getApiUrl()}${rawUrl}`;
|
|
69
|
+
const headers = new Headers(init?.headers);
|
|
70
|
+
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
71
|
+
return originalFetch(absoluteUrl, {
|
|
72
|
+
...init,
|
|
73
|
+
headers
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return originalFetch(input, init);
|
|
78
|
+
};
|
|
79
|
+
sdkFetchInterceptorInstalled = true;
|
|
80
|
+
}
|
|
81
|
+
function assertSdkSuccess(response) {
|
|
82
|
+
if (response.status >= 200 && response.status < 300) {
|
|
83
|
+
return response.data;
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`API \u30A8\u30E9\u30FC (${response.status}): ${formatApiErrorPayload(response.data)}`);
|
|
86
|
+
}
|
|
87
|
+
function readJsonInput(options) {
|
|
88
|
+
if (options.json) {
|
|
89
|
+
try {
|
|
90
|
+
return JSON.parse(options.json);
|
|
91
|
+
} catch {
|
|
92
|
+
console.error("\u30A8\u30E9\u30FC: --json \u306E JSON \u6587\u5B57\u5217\u304C\u4E0D\u6B63\u3067\u3059");
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (options.file) {
|
|
97
|
+
try {
|
|
98
|
+
const content = readFileSync(options.file, "utf-8");
|
|
99
|
+
return JSON.parse(content);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
console.error(`\u30A8\u30E9\u30FC: JSON \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${options.file}`);
|
|
102
|
+
console.error(err instanceof Error ? err.message : err);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
console.error("\u30A8\u30E9\u30FC: --json \u307E\u305F\u306F --file \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
function ensureApiCredentials() {
|
|
110
|
+
if (!process.env.CMX_API_KEY) {
|
|
111
|
+
console.error("\u30A8\u30E9\u30FC: \u74B0\u5883\u5909\u6570 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
getApiUrl,
|
|
118
|
+
getApiCredentials,
|
|
119
|
+
formatApiErrorMessage,
|
|
120
|
+
installSdkFetchInterceptor,
|
|
121
|
+
assertSdkSuccess,
|
|
122
|
+
readJsonInput,
|
|
123
|
+
ensureApiCredentials
|
|
124
|
+
};
|
package/dist/chunk-Y3S3K6M3.js
CHANGED
|
File without changes
|
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
getInstallCommand,
|
|
10
10
|
getStudioStandaloneDevCommand
|
|
11
11
|
} from "./chunk-EDXXR5BE.js";
|
|
12
|
+
import {
|
|
13
|
+
getApiUrl
|
|
14
|
+
} from "./chunk-WJ5REY5E.js";
|
|
12
15
|
|
|
13
16
|
// src/commands/update-studio.ts
|
|
14
17
|
import { confirm } from "@inquirer/prompts";
|
|
@@ -56,13 +59,13 @@ async function updateStudio(options = {}) {
|
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
config({ path: join(projectRoot, ".env") });
|
|
59
|
-
const apiUrl = process.env.CMX_API_URL;
|
|
60
62
|
const apiKey = process.env.CMX_API_KEY;
|
|
61
|
-
if (!
|
|
62
|
-
console.error(" \u274C
|
|
63
|
+
if (!apiKey) {
|
|
64
|
+
console.error(" \u274C CMX_API_KEY \u304C\u5FC5\u8981\u3067\u3059");
|
|
63
65
|
console.error(" .env \u306B\u8A8D\u8A3C\u60C5\u5831\u3092\u8A2D\u5B9A\u3057\u3066\u304B\u3089\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\n");
|
|
64
66
|
process.exit(1);
|
|
65
67
|
}
|
|
68
|
+
const apiUrl = getApiUrl();
|
|
66
69
|
const timestamp = formatBackupTimestamp();
|
|
67
70
|
const cmxDir = join(projectRoot, ".cmx");
|
|
68
71
|
const backupDir = join(cmxDir, `studio.backup-${timestamp}`);
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-7TDMLYBI.js";
|
|
5
5
|
import {
|
|
6
6
|
updateStudio
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YYDYSBN7.js";
|
|
8
8
|
import {
|
|
9
9
|
updateSdk
|
|
10
10
|
} from "./chunk-Y3S3K6M3.js";
|
|
@@ -12,15 +12,12 @@ import "./chunk-NZQ6SBFS.js";
|
|
|
12
12
|
import "./chunk-EDXXR5BE.js";
|
|
13
13
|
import "./chunk-IIQLQIDP.js";
|
|
14
14
|
import {
|
|
15
|
-
assertSdkSuccess,
|
|
16
15
|
deleteManageCollectionsSlug,
|
|
17
16
|
deleteManageCollectionsSlugDataTypesDtSlug,
|
|
18
17
|
deleteManageContentsId,
|
|
19
18
|
deleteManageDataTypeSlugId,
|
|
20
19
|
deleteManageDataTypesSlug,
|
|
21
20
|
deleteManageFormDefinitionsSlug,
|
|
22
|
-
ensureApiCredentials,
|
|
23
|
-
formatApiErrorMessage,
|
|
24
21
|
getManageCollectionPresets,
|
|
25
22
|
getManageCollections,
|
|
26
23
|
getManageCollectionsSlug,
|
|
@@ -35,7 +32,6 @@ import {
|
|
|
35
32
|
getManageDataTypeSlugIdDeletionImpact,
|
|
36
33
|
getManageDataTypes,
|
|
37
34
|
getManageFormDefinitions,
|
|
38
|
-
installSdkFetchInterceptor,
|
|
39
35
|
patchManageDataTypeSlugId,
|
|
40
36
|
postManageCollections,
|
|
41
37
|
postManageCollectionsSlugDataTypes,
|
|
@@ -52,9 +48,16 @@ import {
|
|
|
52
48
|
putManageContentsIdReferences,
|
|
53
49
|
putManageDataTypesSlug,
|
|
54
50
|
putManageDocsType,
|
|
55
|
-
putManageFormDefinitionsSlug
|
|
51
|
+
putManageFormDefinitionsSlug
|
|
52
|
+
} from "./chunk-2WLUAJR2.js";
|
|
53
|
+
import {
|
|
54
|
+
assertSdkSuccess,
|
|
55
|
+
ensureApiCredentials,
|
|
56
|
+
formatApiErrorMessage,
|
|
57
|
+
getApiCredentials,
|
|
58
|
+
installSdkFetchInterceptor,
|
|
56
59
|
readJsonInput
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-WJ5REY5E.js";
|
|
58
61
|
|
|
59
62
|
// src/cli.ts
|
|
60
63
|
import { Command } from "commander";
|
|
@@ -3940,8 +3943,7 @@ async function uploadAsset(options) {
|
|
|
3940
3943
|
console.error("\u30A8\u30E9\u30FC: --file \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3941
3944
|
process.exit(1);
|
|
3942
3945
|
}
|
|
3943
|
-
const apiUrl =
|
|
3944
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
3946
|
+
const { apiUrl, apiKey } = getApiCredentials();
|
|
3945
3947
|
try {
|
|
3946
3948
|
const fileBuffer = await readFile(options.file);
|
|
3947
3949
|
const mimeType = resolveMimeType(options.file, options.mime);
|
|
@@ -4000,8 +4002,7 @@ function parseJsonSafely2(raw) {
|
|
|
4000
4002
|
}
|
|
4001
4003
|
async function listAssets(options) {
|
|
4002
4004
|
ensureApiCredentials();
|
|
4003
|
-
const apiUrl =
|
|
4004
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
4005
|
+
const { apiUrl, apiKey } = getApiCredentials();
|
|
4005
4006
|
try {
|
|
4006
4007
|
const limit = parseIntegerOption("limit", options.limit);
|
|
4007
4008
|
const offset = parseIntegerOption("offset", options.offset);
|
|
@@ -4087,8 +4088,7 @@ async function updateAsset(options) {
|
|
|
4087
4088
|
console.error("\u30A8\u30E9\u30FC: \u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u5C11\u306A\u304F\u3068\u30821\u3064\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
4088
4089
|
process.exit(1);
|
|
4089
4090
|
}
|
|
4090
|
-
const apiUrl =
|
|
4091
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
4091
|
+
const { apiUrl, apiKey } = getApiCredentials();
|
|
4092
4092
|
try {
|
|
4093
4093
|
console.log(`\u30A2\u30BB\u30C3\u30C8\u3092\u66F4\u65B0\u3057\u3066\u3044\u307E\u3059: ${options.id}...`);
|
|
4094
4094
|
const response = await fetch(`${apiUrl}/api/mcp/assets`, {
|
|
@@ -4141,8 +4141,7 @@ async function deleteAsset(options) {
|
|
|
4141
4141
|
process.exit(0);
|
|
4142
4142
|
}
|
|
4143
4143
|
}
|
|
4144
|
-
const apiUrl =
|
|
4145
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
4144
|
+
const { apiUrl, apiKey } = getApiCredentials();
|
|
4146
4145
|
try {
|
|
4147
4146
|
console.log(`\u30A2\u30BB\u30C3\u30C8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059: ${options.id}...`);
|
|
4148
4147
|
const response = await fetch(`${apiUrl}/api/mcp/assets`, {
|
|
@@ -4173,17 +4172,9 @@ config();
|
|
|
4173
4172
|
installSdkFetchInterceptor();
|
|
4174
4173
|
var program = new Command();
|
|
4175
4174
|
program.name("cmx-sdk").description("CMX \u30B9\u30AD\u30FC\u30DE\u3068\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u64CD\u4F5C\u3059\u308B CLI \u30C4\u30FC\u30EB").version("0.2.11").allowExcessArguments(false);
|
|
4176
|
-
|
|
4177
|
-
const apiUrl = process.env.CMX_API_URL;
|
|
4178
|
-
const apiKey = process.env.CMX_API_KEY;
|
|
4179
|
-
if (!apiUrl || !apiKey) {
|
|
4180
|
-
console.error("\u30A8\u30E9\u30FC: \u74B0\u5883\u5909\u6570 CMX_API_URL \u3068 CMX_API_KEY \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
4181
|
-
process.exit(1);
|
|
4182
|
-
}
|
|
4183
|
-
return { apiUrl, apiKey };
|
|
4184
|
-
}
|
|
4175
|
+
var requireApiCredentials = getApiCredentials;
|
|
4185
4176
|
program.action(async () => {
|
|
4186
|
-
const { interactiveMenu } = await import("./interactive-menu-
|
|
4177
|
+
const { interactiveMenu } = await import("./interactive-menu-R3TJZOMK.js");
|
|
4187
4178
|
await interactiveMenu();
|
|
4188
4179
|
});
|
|
4189
4180
|
program.command("init [project-name]").description("\u65B0\u3057\u3044 CMX \u30B5\u30A4\u30C8\u3092\u4F5C\u6210").option("--no-studio", "CMX Studio \u3092\u30B9\u30AD\u30C3\u30D7").option("--pm <manager>", "\u30D1\u30C3\u30B1\u30FC\u30B8\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC (npm, pnpm, yarn)").option("--key <key>", "CMX API \u30AD\u30FC\uFF08\u5FC5\u9808\u3002\u672A\u6307\u5B9A\u6642\u306F\u30D7\u30ED\u30F3\u30D7\u30C8\u8868\u793A\uFF09").option("--api-url <url>", "CMX API \u30B5\u30FC\u30D0\u30FC\u306E URL").option("--project-name <name>", "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D\uFF08\u4F4D\u7F6E\u5F15\u6570\u306E\u4EE3\u308F\u308A\u306B\u4F7F\u7528\u53EF\u80FD\uFF09").action(async (projectName, options) => {
|
|
@@ -4192,7 +4183,7 @@ program.command("init [project-name]").description("\u65B0\u3057\u3044 CMX \u30B
|
|
|
4192
4183
|
await init(finalProjectName, options);
|
|
4193
4184
|
});
|
|
4194
4185
|
program.command("add-studio").description("\u65E2\u5B58\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B CMX Studio \u3092\u8FFD\u52A0").action(async () => {
|
|
4195
|
-
const { addStudio } = await import("./add-studio-
|
|
4186
|
+
const { addStudio } = await import("./add-studio-2COHXK65.js");
|
|
4196
4187
|
await addStudio();
|
|
4197
4188
|
});
|
|
4198
4189
|
program.command("update-studio").description("\u65E2\u5B58\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E CMX Studio \u3092\u6700\u65B0\u5316").option("--force", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action((options) => updateStudio(options));
|
|
@@ -4316,7 +4307,7 @@ program.command("archive-content").description("\u30B3\u30F3\u30C6\u30F3\u30C4\u
|
|
|
4316
4307
|
program.command("validate-content").description("\u30B3\u30F3\u30C6\u30F3\u30C4\u306E MDX \u53C2\u7167\u6574\u5408\u6027\u3092\u691C\u8A3C\uFF08\u554F\u984C\u3042\u308A\u6642\u306F exit code 1\uFF09").requiredOption("--id <id>", "\u30B3\u30F3\u30C6\u30F3\u30C4 ID").action(validateContent);
|
|
4317
4308
|
program.command("get-data-entry-deletion-impact").description("\u30C7\u30FC\u30BF\u30A8\u30F3\u30C8\u30EA\u30FC\u524A\u9664\u6642\u306E\u5F71\u97FF\u3092\u78BA\u8A8D").requiredOption("--type-slug <slug>", "\u30C7\u30FC\u30BF\u30BF\u30A4\u30D7\u306E\u30B9\u30E9\u30C3\u30B0").requiredOption("--id <id>", "\u30C7\u30FC\u30BF\u30A8\u30F3\u30C8\u30EA\u30FC ID").action(getDataEntryDeletionImpact);
|
|
4318
4309
|
program.command("report-bug").description("CMX \u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u306E\u30D0\u30B0\u3092\u5831\u544A").requiredOption("--title <title>", "\u30D0\u30B0\u306E\u6982\u8981\u30BF\u30A4\u30C8\u30EB").requiredOption("--description <description>", "\u30D0\u30B0\u306E\u8A73\u7D30\u8AAC\u660E").option("--severity <severity>", "\u91CD\u8981\u5EA6 (low, medium, high, critical)", "medium").option("--steps <steps>", "\u518D\u73FE\u624B\u9806").option("--error <message>", "\u30A8\u30E9\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8").option("--command <command>", "\u5B9F\u884C\u3057\u305F CLI \u30B3\u30DE\u30F3\u30C9").action(async (options) => {
|
|
4319
|
-
const { reportBug } = await import("./report-bug-
|
|
4310
|
+
const { reportBug } = await import("./report-bug-WSGGML4H.js");
|
|
4320
4311
|
await reportBug(options);
|
|
4321
4312
|
});
|
|
4322
4313
|
program.parse();
|
package/dist/init-FPFDEEXW.js
CHANGED
|
File without changes
|
|
@@ -23,11 +23,11 @@ async function interactiveMenu() {
|
|
|
23
23
|
return init(void 0, {});
|
|
24
24
|
}
|
|
25
25
|
case "add-studio": {
|
|
26
|
-
const { addStudio } = await import("./add-studio-
|
|
26
|
+
const { addStudio } = await import("./add-studio-2COHXK65.js");
|
|
27
27
|
return addStudio();
|
|
28
28
|
}
|
|
29
29
|
case "update-studio": {
|
|
30
|
-
const { updateStudio } = await import("./update-studio-
|
|
30
|
+
const { updateStudio } = await import("./update-studio-QSBDG7ZI.js");
|
|
31
31
|
return updateStudio({});
|
|
32
32
|
}
|
|
33
33
|
case "update-sdk": {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
assertSdkSuccess,
|
|
4
|
-
ensureApiCredentials,
|
|
5
3
|
postManageBugReports
|
|
6
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2WLUAJR2.js";
|
|
5
|
+
import {
|
|
6
|
+
assertSdkSuccess,
|
|
7
|
+
ensureApiCredentials
|
|
8
|
+
} from "./chunk-WJ5REY5E.js";
|
|
7
9
|
|
|
8
10
|
// src/commands/report-bug.ts
|
|
9
11
|
async function reportBug(options) {
|
package/dist/studio-HAS6DYLO.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
formatBackupTimestamp,
|
|
4
4
|
restoreStudioFromBackup,
|
|
5
5
|
updateStudio
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YYDYSBN7.js";
|
|
7
7
|
import "./chunk-NZQ6SBFS.js";
|
|
8
8
|
import "./chunk-EDXXR5BE.js";
|
|
9
9
|
import "./chunk-IIQLQIDP.js";
|
|
10
|
+
import "./chunk-WJ5REY5E.js";
|
|
10
11
|
export {
|
|
11
12
|
formatBackupTimestamp,
|
|
12
13
|
restoreStudioFromBackup,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmx-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "CMX SDK - Official SDK for building content-driven websites with CMX",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,20 @@
|
|
|
35
35
|
},
|
|
36
36
|
"./styles/cmx-mdx.css": "./dist/styles/cmx-mdx.css"
|
|
37
37
|
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"prebuild": "node scripts/copy-api-client.js",
|
|
40
|
+
"sync:starter-kit-docs": "pnpm --filter @cmx/api-server generate:openapi && node scripts/sync-starter-kit-docs.mjs --write",
|
|
41
|
+
"sync:starter-kit-docs:check": "pnpm --filter @cmx/api-server generate:openapi && node scripts/sync-starter-kit-docs.mjs --check",
|
|
42
|
+
"check:sdk-command-api-usage": "node scripts/check-sdk-command-api-usage.mjs",
|
|
43
|
+
"check:generated-sync": "node scripts/check-generated-sync.mjs",
|
|
44
|
+
"test:contracts": "tsx scripts/check-cli-contracts.ts",
|
|
45
|
+
"verify:release": "pnpm run check:sdk-command-api-usage && pnpm run check:generated-sync && pnpm run test:contracts",
|
|
46
|
+
"build": "tsup",
|
|
47
|
+
"postbuild": "rm -rf dist/styles && cp -r src/mdx/styles dist/styles",
|
|
48
|
+
"dev": "tsup --watch",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"prepublishOnly": "pnpm run verify:release && pnpm run sync:starter-kit-docs:check && pnpm run build"
|
|
51
|
+
},
|
|
38
52
|
"dependencies": {
|
|
39
53
|
"@inquirer/prompts": "^8.2.1",
|
|
40
54
|
"@mdx-js/mdx": "^3.1.1",
|
|
@@ -59,18 +73,5 @@
|
|
|
59
73
|
"tsup": "^8.5.1",
|
|
60
74
|
"tsx": "^4.21.0",
|
|
61
75
|
"typescript": "^5.9.3"
|
|
62
|
-
},
|
|
63
|
-
"scripts": {
|
|
64
|
-
"prebuild": "node scripts/copy-api-client.js",
|
|
65
|
-
"sync:starter-kit-docs": "pnpm --filter @cmx/api-server generate:openapi && node scripts/sync-starter-kit-docs.mjs --write",
|
|
66
|
-
"sync:starter-kit-docs:check": "pnpm --filter @cmx/api-server generate:openapi && node scripts/sync-starter-kit-docs.mjs --check",
|
|
67
|
-
"check:sdk-command-api-usage": "node scripts/check-sdk-command-api-usage.mjs",
|
|
68
|
-
"check:generated-sync": "node scripts/check-generated-sync.mjs",
|
|
69
|
-
"test:contracts": "tsx scripts/check-cli-contracts.ts",
|
|
70
|
-
"verify:release": "pnpm run check:sdk-command-api-usage && pnpm run check:generated-sync && pnpm run test:contracts",
|
|
71
|
-
"build": "tsup",
|
|
72
|
-
"postbuild": "rm -rf dist/styles && cp -r src/mdx/styles dist/styles",
|
|
73
|
-
"dev": "tsup --watch",
|
|
74
|
-
"typecheck": "tsc --noEmit"
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
+
}
|