@metatell/bot-cli 0.0.6 → 0.0.7
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 +52 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +19 -13
- package/dist/commands/connect.js +31 -86
- package/dist/commands/inspect.js +51 -108
- package/dist/commands/interactive.js +105 -185
- package/dist/index.js +3 -9
- package/dist/types.js +1 -2
- package/dist/utils/commands.js +216 -359
- package/dist/utils/url.js +13 -17
- package/package.json +9 -9
package/dist/utils/url.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* URL parsing utilities
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
exports.parseUrl = parseUrl;
|
|
7
|
-
var METATELL_DOMAINS = ['metatell.app', 'metatell-stg.app', 'metatell-dev.app'];
|
|
4
|
+
const METATELL_DOMAINS = ['metatell.app', 'metatell-stg.app', 'metatell-dev.app'];
|
|
8
5
|
/**
|
|
9
6
|
* Check if hostname is a Metatell domain
|
|
10
7
|
*/
|
|
11
8
|
function isMetatellDomain(hostname) {
|
|
12
|
-
return METATELL_DOMAINS.some(
|
|
9
|
+
return METATELL_DOMAINS.some((domain) => hostname.endsWith(domain));
|
|
13
10
|
}
|
|
14
11
|
/**
|
|
15
12
|
* Remove tenant subdomain from Metatell URL
|
|
@@ -19,33 +16,32 @@ function removeMetatellTenantSubdomain(hostname) {
|
|
|
19
16
|
return hostname;
|
|
20
17
|
}
|
|
21
18
|
// メタテルドメインの場合、ベースドメインに変換
|
|
22
|
-
for (
|
|
23
|
-
var domain = METATELL_DOMAINS_1[_i];
|
|
19
|
+
for (const domain of METATELL_DOMAINS) {
|
|
24
20
|
if (hostname.endsWith(domain)) {
|
|
25
21
|
return domain;
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
24
|
return hostname;
|
|
29
25
|
}
|
|
30
|
-
function parseUrl(url) {
|
|
26
|
+
export function parseUrl(url) {
|
|
31
27
|
try {
|
|
32
|
-
|
|
28
|
+
const urlObj = new URL(url);
|
|
33
29
|
// メタテルドメインの場合のみテナントサブドメインを除去
|
|
34
|
-
|
|
30
|
+
const hostname = isMetatellDomain(urlObj.hostname)
|
|
35
31
|
? removeMetatellTenantSubdomain(urlObj.hostname)
|
|
36
32
|
: urlObj.hostname;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const protocol = urlObj.protocol === 'https:' || urlObj.protocol === 'wss:' ? 'wss:' : 'ws:';
|
|
34
|
+
const port = urlObj.port ? `:${urlObj.port}` : '';
|
|
35
|
+
const serverUrl = `${protocol}//${hostname}${port}`;
|
|
40
36
|
// Extract room ID from path - it's the first path segment
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const pathParts = urlObj.pathname.split('/').filter(Boolean);
|
|
38
|
+
const roomId = pathParts[0] || 'default';
|
|
43
39
|
if (!roomId || roomId === '/') {
|
|
44
40
|
throw new Error('No room ID found in URL');
|
|
45
41
|
}
|
|
46
|
-
return { serverUrl
|
|
42
|
+
return { serverUrl, roomId };
|
|
47
43
|
}
|
|
48
44
|
catch (error) {
|
|
49
|
-
throw new Error(
|
|
45
|
+
throw new Error(`Invalid URL: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
50
46
|
}
|
|
51
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metatell/bot-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "CLI tool for Metatell bot development and testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"commander": "
|
|
21
|
-
"ink": "
|
|
22
|
-
"react": "
|
|
23
|
-
"@metatell/bot-sdk": "0.0.
|
|
20
|
+
"commander": "12.0.0",
|
|
21
|
+
"ink": "5.0.1",
|
|
22
|
+
"react": "18.3.1",
|
|
23
|
+
"@metatell/bot-sdk": "0.0.7"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "
|
|
27
|
-
"@types/react": "
|
|
28
|
-
"tsx": "
|
|
29
|
-
"typescript": "
|
|
26
|
+
"@types/node": "22.17.2",
|
|
27
|
+
"@types/react": "18.3.12",
|
|
28
|
+
"tsx": "4.20.0",
|
|
29
|
+
"typescript": "5.6.3"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|