@tonk/cli 0.3.2 → 0.4.0
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 +15 -200
- package/bin/tonk.js +36 -1
- package/package.json +24 -86
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -184
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/create.d.ts +0 -3
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -55
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/delete.d.ts +0 -3
- package/dist/commands/delete.d.ts.map +0 -1
- package/dist/commands/delete.js +0 -67
- package/dist/commands/delete.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -3
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -336
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/hello/index.d.ts +0 -3
- package/dist/commands/hello/index.d.ts.map +0 -1
- package/dist/commands/hello/index.js +0 -296
- package/dist/commands/hello/index.js.map +0 -1
- package/dist/commands/hello.d.ts +0 -3
- package/dist/commands/hello.d.ts.map +0 -1
- package/dist/commands/hello.js +0 -83
- package/dist/commands/hello.js.map +0 -1
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -137
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/kill.d.ts +0 -3
- package/dist/commands/kill.d.ts.map +0 -1
- package/dist/commands/kill.js +0 -66
- package/dist/commands/kill.js.map +0 -1
- package/dist/commands/ls.d.ts +0 -3
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -52
- package/dist/commands/ls.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -3
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -86
- package/dist/commands/proxy.js.map +0 -1
- package/dist/commands/ps.d.ts +0 -3
- package/dist/commands/ps.d.ts.map +0 -1
- package/dist/commands/ps.js +0 -56
- package/dist/commands/ps.js.map +0 -1
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -238
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/server.d.ts +0 -3
- package/dist/commands/server.d.ts.map +0 -1
- package/dist/commands/server.js +0 -619
- package/dist/commands/server.js.map +0 -1
- package/dist/commands/start.d.ts +0 -3
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/start.js +0 -82
- package/dist/commands/start.js.map +0 -1
- package/dist/commands/worker/commands.d.ts +0 -42
- package/dist/commands/worker/commands.d.ts.map +0 -1
- package/dist/commands/worker/commands.js +0 -968
- package/dist/commands/worker/commands.js.map +0 -1
- package/dist/commands/worker/index.d.ts +0 -7
- package/dist/commands/worker/index.d.ts.map +0 -1
- package/dist/commands/worker/index.js +0 -30
- package/dist/commands/worker/index.js.map +0 -1
- package/dist/commands/worker/utils/config.d.ts +0 -26
- package/dist/commands/worker/utils/config.d.ts.map +0 -1
- package/dist/commands/worker/utils/config.js +0 -197
- package/dist/commands/worker/utils/config.js.map +0 -1
- package/dist/commands/worker/utils/display.d.ts +0 -6
- package/dist/commands/worker/utils/display.d.ts.map +0 -1
- package/dist/commands/worker/utils/display.js +0 -32
- package/dist/commands/worker/utils/display.js.map +0 -1
- package/dist/commands/worker/utils/finder.d.ts +0 -12
- package/dist/commands/worker/utils/finder.d.ts.map +0 -1
- package/dist/commands/worker/utils/finder.js +0 -60
- package/dist/commands/worker/utils/finder.js.map +0 -1
- package/dist/config/environment.d.ts +0 -52
- package/dist/config/environment.d.ts.map +0 -1
- package/dist/config/environment.js +0 -83
- package/dist/config/environment.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/lib/tonkAuth.d.ts +0 -21
- package/dist/lib/tonkAuth.d.ts.map +0 -1
- package/dist/lib/tonkAuth.js +0 -140
- package/dist/lib/tonkAuth.js.map +0 -1
- package/dist/lib/workerManager.d.ts +0 -60
- package/dist/lib/workerManager.d.ts.map +0 -1
- package/dist/lib/workerManager.js +0 -417
- package/dist/lib/workerManager.js.map +0 -1
- package/dist/scripts/aws/create-key.sh +0 -20
- package/dist/scripts/aws/ec2-dns.sh +0 -20
- package/dist/scripts/aws/provision.sh +0 -93
- package/dist/tonk.d.ts +0 -2
- package/dist/tonk.d.ts.map +0 -1
- package/dist/tonk.js +0 -106
- package/dist/tonk.js.map +0 -1
- package/dist/types/worker.d.ts +0 -161
- package/dist/types/worker.d.ts.map +0 -1
- package/dist/types/worker.js +0 -7
- package/dist/types/worker.js.map +0 -1
- package/dist/types/workerConfig.d.ts +0 -164
- package/dist/types/workerConfig.d.ts.map +0 -1
- package/dist/types/workerConfig.js +0 -80
- package/dist/types/workerConfig.js.map +0 -1
- package/dist/utils/analytics.d.ts +0 -26
- package/dist/utils/analytics.d.ts.map +0 -1
- package/dist/utils/analytics.js +0 -218
- package/dist/utils/analytics.js.map +0 -1
- package/dist/utils/messages.d.ts +0 -6
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js +0 -18
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/serverUtils.d.ts +0 -5
- package/dist/utils/serverUtils.d.ts.map +0 -1
- package/dist/utils/serverUtils.js +0 -34
- package/dist/utils/serverUtils.js.map +0 -1
- package/dist/utils/version.d.ts +0 -2
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js +0 -3
- package/dist/utils/version.js.map +0 -1
- package/scripts/aws/create-key.sh +0 -20
- package/scripts/aws/ec2-dns.sh +0 -20
- package/scripts/aws/provision.sh +0 -93
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worker YAML Configuration Schema
|
|
3
|
-
*
|
|
4
|
-
* This file defines the standard format for worker configuration YAML files in Tonk.
|
|
5
|
-
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* Zod schema for worker health check configuration
|
|
9
|
-
*/
|
|
10
|
-
export const WorkerHealthCheckSchema = z.object({
|
|
11
|
-
endpoint: z.string().optional(),
|
|
12
|
-
method: z.string().default('GET'),
|
|
13
|
-
interval: z.number().default(30000),
|
|
14
|
-
timeout: z.number().default(5000),
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* Zod schema for worker configuration
|
|
18
|
-
*/
|
|
19
|
-
export const WorkerConfigSchema = z.object({
|
|
20
|
-
// Basic worker information
|
|
21
|
-
name: z.string(),
|
|
22
|
-
description: z.string().optional(),
|
|
23
|
-
version: z.string().optional(),
|
|
24
|
-
// Connection details
|
|
25
|
-
endpoint: z.string(),
|
|
26
|
-
protocol: z.string().default('http'),
|
|
27
|
-
// Health check configuration
|
|
28
|
-
healthCheck: WorkerHealthCheckSchema.optional(),
|
|
29
|
-
// Process management
|
|
30
|
-
process: z.object({
|
|
31
|
-
script: z.string(),
|
|
32
|
-
cwd: z.string().optional(),
|
|
33
|
-
instances: z.number().default(1),
|
|
34
|
-
autorestart: z.boolean().default(true),
|
|
35
|
-
watch: z.boolean().default(false),
|
|
36
|
-
max_memory_restart: z.string().optional(),
|
|
37
|
-
env: z.record(z.string()).optional(),
|
|
38
|
-
}),
|
|
39
|
-
// Additional custom configuration
|
|
40
|
-
config: z.record(z.any()).optional(),
|
|
41
|
-
});
|
|
42
|
-
/**
|
|
43
|
-
* Example YAML configuration:
|
|
44
|
-
*
|
|
45
|
-
* ```yaml
|
|
46
|
-
* # Worker Information
|
|
47
|
-
* name: obsidian-worker
|
|
48
|
-
* description: Tonk worker for Obsidian integration
|
|
49
|
-
* version: 1.0.0
|
|
50
|
-
*
|
|
51
|
-
* # Connection Details
|
|
52
|
-
* endpoint: http://localhost:5555/tonk
|
|
53
|
-
* protocol: http
|
|
54
|
-
*
|
|
55
|
-
* # Health Check Configuration
|
|
56
|
-
* healthCheck:
|
|
57
|
-
* endpoint: http://localhost:5555/health
|
|
58
|
-
* method: GET
|
|
59
|
-
* interval: 30000
|
|
60
|
-
* timeout: 5000
|
|
61
|
-
*
|
|
62
|
-
* # Process Management
|
|
63
|
-
* process:
|
|
64
|
-
* script: ./dist/index.js
|
|
65
|
-
* cwd: ./
|
|
66
|
-
* instances: 1
|
|
67
|
-
* autorestart: true
|
|
68
|
-
* watch: false
|
|
69
|
-
* max_memory_restart: 500M
|
|
70
|
-
* env:
|
|
71
|
-
* NODE_ENV: production
|
|
72
|
-
* CHROMA_URL: http://localhost:8888
|
|
73
|
-
*
|
|
74
|
-
* # Additional Configuration
|
|
75
|
-
* config:
|
|
76
|
-
* syncDirectory: notes
|
|
77
|
-
* embedModel: all-MiniLM-L6-v2
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
//# sourceMappingURL=workerConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workerConfig.js","sourceRoot":"","sources":["../../src/types/workerConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,2BAA2B;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE9B,qBAAqB;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAEpC,6BAA6B;IAC7B,WAAW,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAE/C,qBAAqB;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAChC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACjC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACzC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACrC,CAAC;IAEF,kCAAkC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PostHog } from 'posthog-node';
|
|
2
|
-
/**
|
|
3
|
-
* Initialize PostHog analytics
|
|
4
|
-
*/
|
|
5
|
-
export declare function initAnalytics(): PostHog | null;
|
|
6
|
-
/**
|
|
7
|
-
* Track a command execution
|
|
8
|
-
*/
|
|
9
|
-
export declare function trackCommand(commandName: string, options?: Record<string, any>, additionalProps?: Record<string, any>): void;
|
|
10
|
-
/**
|
|
11
|
-
* Track command success
|
|
12
|
-
*/
|
|
13
|
-
export declare function trackCommandSuccess(commandName: string, duration?: number, additionalProps?: Record<string, any>): void;
|
|
14
|
-
/**
|
|
15
|
-
* Track command error
|
|
16
|
-
*/
|
|
17
|
-
export declare function trackCommandError(commandName: string, error: Error | string, duration?: number, additionalProps?: Record<string, any>): void;
|
|
18
|
-
/**
|
|
19
|
-
* Shutdown analytics and flush any pending events
|
|
20
|
-
*/
|
|
21
|
-
export declare function shutdownAnalytics(): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Wrapper function to track command execution with timing
|
|
24
|
-
*/
|
|
25
|
-
export declare function withAnalytics<T extends any[], R>(commandName: string, fn: (...args: T) => R | Promise<R>, optionsExtractor?: (...args: T) => Record<string, any>): (...args: T) => Promise<R>;
|
|
26
|
-
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/utils/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AA4ErC;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,GAAG,IAAI,CAe9C;AAgBD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACxC,IAAI,CAuBN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACxC,IAAI,CAsBN;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,EACjB,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACxC,IAAI,CAyBN;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAC9C,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAClC,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACrD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAiB5B"}
|
package/dist/utils/analytics.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { PostHog } from 'posthog-node';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { CLI_VERSION } from '../utils/version.js';
|
|
6
|
-
import { getAnalyticsConfig } from '../config/environment.js';
|
|
7
|
-
// Fallback machine ID generation if node-machine-id is not available
|
|
8
|
-
function generateFallbackMachineId() {
|
|
9
|
-
const hostname = os.hostname();
|
|
10
|
-
const platform = os.platform();
|
|
11
|
-
const arch = os.arch();
|
|
12
|
-
const userInfo = os.userInfo();
|
|
13
|
-
// Create a simple hash from system info
|
|
14
|
-
const info = `${hostname}-${platform}-${arch}-${userInfo.username}`;
|
|
15
|
-
let hash = 0;
|
|
16
|
-
for (let i = 0; i < info.length; i++) {
|
|
17
|
-
const char = info.charCodeAt(i);
|
|
18
|
-
hash = (hash << 5) - hash + char;
|
|
19
|
-
hash = hash & hash; // Convert to 32-bit integer
|
|
20
|
-
}
|
|
21
|
-
return Math.abs(hash).toString(16);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get CLI version from shared version constant
|
|
25
|
-
*/
|
|
26
|
-
function getCliVersion() {
|
|
27
|
-
return CLI_VERSION || 'unknown';
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Detect workspace type (pnpm, npm, yarn)
|
|
31
|
-
*/
|
|
32
|
-
function detectWorkspaceType() {
|
|
33
|
-
try {
|
|
34
|
-
const cwd = process.cwd();
|
|
35
|
-
if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml')))
|
|
36
|
-
return 'pnpm';
|
|
37
|
-
if (fs.existsSync(path.join(cwd, 'yarn.lock')))
|
|
38
|
-
return 'yarn';
|
|
39
|
-
if (fs.existsSync(path.join(cwd, 'package-lock.json')))
|
|
40
|
-
return 'npm';
|
|
41
|
-
return 'unknown';
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
return 'unknown';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Check if tonk.config.json exists in current directory
|
|
49
|
-
*/
|
|
50
|
-
function hasTonkConfig() {
|
|
51
|
-
try {
|
|
52
|
-
return fs.existsSync(path.join(process.cwd(), 'tonk.config.json'));
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get enhanced system context for analytics
|
|
60
|
-
*/
|
|
61
|
-
function getSystemContext() {
|
|
62
|
-
return {
|
|
63
|
-
platform: os.platform(),
|
|
64
|
-
arch: os.arch(),
|
|
65
|
-
nodeVersion: process.version,
|
|
66
|
-
cliVersion: getCliVersion(),
|
|
67
|
-
workspaceType: detectWorkspaceType(),
|
|
68
|
-
hasTonkConfig: hasTonkConfig(),
|
|
69
|
-
timestamp: new Date().toISOString(),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
// Singleton PostHog instance
|
|
73
|
-
let posthog = null;
|
|
74
|
-
/**
|
|
75
|
-
* Initialize PostHog analytics
|
|
76
|
-
*/
|
|
77
|
-
export function initAnalytics() {
|
|
78
|
-
if (!posthog) {
|
|
79
|
-
const analyticsConfig = getAnalyticsConfig();
|
|
80
|
-
// Only initialize if analytics is enabled and API key is provided
|
|
81
|
-
if (!analyticsConfig.enabled || !analyticsConfig.apiKey) {
|
|
82
|
-
console.debug('Analytics disabled or no API key provided');
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
posthog = new PostHog(analyticsConfig.apiKey, {
|
|
86
|
-
host: analyticsConfig.host,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return posthog;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Get a unique machine identifier for analytics
|
|
93
|
-
*/
|
|
94
|
-
function getMachineId() {
|
|
95
|
-
try {
|
|
96
|
-
// Try to use node-machine-id if available
|
|
97
|
-
const { machineIdSync } = require('node-machine-id');
|
|
98
|
-
return machineIdSync();
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
// Fallback to system-based ID
|
|
102
|
-
return generateFallbackMachineId();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Track a command execution
|
|
107
|
-
*/
|
|
108
|
-
export function trackCommand(commandName, options = {}, additionalProps = {}) {
|
|
109
|
-
try {
|
|
110
|
-
const analytics = initAnalytics();
|
|
111
|
-
if (!analytics) {
|
|
112
|
-
return; // Analytics disabled
|
|
113
|
-
}
|
|
114
|
-
const machineId = getMachineId();
|
|
115
|
-
analytics.capture({
|
|
116
|
-
distinctId: machineId,
|
|
117
|
-
event: 'command_executed',
|
|
118
|
-
properties: {
|
|
119
|
-
command: commandName,
|
|
120
|
-
options,
|
|
121
|
-
...getSystemContext(),
|
|
122
|
-
...additionalProps,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
// Silently fail analytics to not interrupt CLI functionality
|
|
128
|
-
console.debug('Analytics tracking failed:', error);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Track command success
|
|
133
|
-
*/
|
|
134
|
-
export function trackCommandSuccess(commandName, duration, additionalProps = {}) {
|
|
135
|
-
try {
|
|
136
|
-
const analytics = initAnalytics();
|
|
137
|
-
if (!analytics) {
|
|
138
|
-
return; // Analytics disabled
|
|
139
|
-
}
|
|
140
|
-
const machineId = getMachineId();
|
|
141
|
-
analytics.capture({
|
|
142
|
-
distinctId: machineId,
|
|
143
|
-
event: 'command_success',
|
|
144
|
-
properties: {
|
|
145
|
-
command: commandName,
|
|
146
|
-
duration_ms: duration,
|
|
147
|
-
...getSystemContext(),
|
|
148
|
-
...additionalProps,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
console.debug('Analytics tracking failed:', error);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Track command error
|
|
158
|
-
*/
|
|
159
|
-
export function trackCommandError(commandName, error, duration, additionalProps = {}) {
|
|
160
|
-
try {
|
|
161
|
-
const analytics = initAnalytics();
|
|
162
|
-
if (!analytics) {
|
|
163
|
-
return; // Analytics disabled
|
|
164
|
-
}
|
|
165
|
-
const machineId = getMachineId();
|
|
166
|
-
analytics.capture({
|
|
167
|
-
distinctId: machineId,
|
|
168
|
-
event: 'command_error',
|
|
169
|
-
properties: {
|
|
170
|
-
command: commandName,
|
|
171
|
-
error: error instanceof Error ? error.message : error,
|
|
172
|
-
error_type: error instanceof Error ? error.constructor.name : 'string',
|
|
173
|
-
error_stack: error instanceof Error ? error.stack : undefined,
|
|
174
|
-
duration_ms: duration,
|
|
175
|
-
...getSystemContext(),
|
|
176
|
-
...additionalProps,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
catch (analyticsError) {
|
|
181
|
-
console.debug('Analytics tracking failed:', analyticsError);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Shutdown analytics and flush any pending events
|
|
186
|
-
*/
|
|
187
|
-
export async function shutdownAnalytics() {
|
|
188
|
-
if (posthog) {
|
|
189
|
-
try {
|
|
190
|
-
await posthog.shutdown();
|
|
191
|
-
}
|
|
192
|
-
catch (error) {
|
|
193
|
-
console.debug('Analytics shutdown failed:', error);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Wrapper function to track command execution with timing
|
|
199
|
-
*/
|
|
200
|
-
export function withAnalytics(commandName, fn, optionsExtractor) {
|
|
201
|
-
return async (...args) => {
|
|
202
|
-
const startTime = Date.now();
|
|
203
|
-
const options = optionsExtractor ? optionsExtractor(...args) : {};
|
|
204
|
-
try {
|
|
205
|
-
trackCommand(commandName, options);
|
|
206
|
-
const result = await fn(...args);
|
|
207
|
-
const duration = Date.now() - startTime;
|
|
208
|
-
trackCommandSuccess(commandName, duration);
|
|
209
|
-
return result;
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
const duration = Date.now() - startTime;
|
|
213
|
-
trackCommandError(commandName, error, duration);
|
|
214
|
-
throw error;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/utils/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,kBAAkB,EAAC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":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,SAAS;;;CAGd,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/utils/messages.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
const randomColor = () => {
|
|
3
|
-
return [
|
|
4
|
-
chalk.redBright,
|
|
5
|
-
chalk.cyanBright,
|
|
6
|
-
chalk.yellowBright,
|
|
7
|
-
chalk.blueBright,
|
|
8
|
-
chalk.magentaBright,
|
|
9
|
-
chalk.greenBright,
|
|
10
|
-
].sort(() => 0.5 - Math.random())[0];
|
|
11
|
-
};
|
|
12
|
-
const rainbowTonk = () => chalk.italic(`${randomColor()("T")}${randomColor()("o")}${randomColor()("n")}${randomColor()("k")}`);
|
|
13
|
-
const RESPONSES = {
|
|
14
|
-
rainbowTonk,
|
|
15
|
-
needSubscription: `💬 Hey bestie, you need an active subscription to deploy to ${rainbowTonk()}!`,
|
|
16
|
-
};
|
|
17
|
-
export { RESPONSES };
|
|
18
|
-
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,OAAO;QACL,KAAK,CAAC,SAAS;QACf,KAAK,CAAC,UAAU;QAChB,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,UAAU;QAChB,KAAK,CAAC,aAAa;QACnB,KAAK,CAAC,WAAW;KAClB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC,CAAA;AAED,MAAM,WAAW,GAAI,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEhI,MAAM,SAAS,GAAG;IAChB,WAAW;IACX,gBAAgB,EAAE,+DAA+D,WAAW,EAAE,GAAG;CAClG,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverUtils.d.ts","sourceRoot":"","sources":["../../src/utils/serverUtils.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CA0B1D"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { getDeploymentServiceUrl } from '../config/environment.js';
|
|
2
|
-
// Lazy-load tonkAuth to get auth token
|
|
3
|
-
async function getTonkAuth() {
|
|
4
|
-
const { tonkAuth } = await import('../lib/tonkAuth.js');
|
|
5
|
-
return tonkAuth;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Fetches the list of servers owned by the authenticated user
|
|
9
|
-
*/
|
|
10
|
-
export async function fetchUserServers() {
|
|
11
|
-
try {
|
|
12
|
-
const tonkAuth = await getTonkAuth();
|
|
13
|
-
const authToken = await tonkAuth.getAuthToken();
|
|
14
|
-
if (!authToken) {
|
|
15
|
-
throw new Error('Failed to get authentication token');
|
|
16
|
-
}
|
|
17
|
-
const deploymentServiceUrl = getDeploymentServiceUrl();
|
|
18
|
-
const response = await fetch(`${deploymentServiceUrl}/list-user-servers`, {
|
|
19
|
-
method: 'GET',
|
|
20
|
-
headers: {
|
|
21
|
-
'Authorization': `Bearer ${authToken}`,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
const result = await response.json();
|
|
25
|
-
if (!response.ok || !result.success) {
|
|
26
|
-
throw new Error(result.error || 'Failed to fetch user servers');
|
|
27
|
-
}
|
|
28
|
-
return result.servers || [];
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
throw new Error(`Failed to fetch servers: ${error instanceof Error ? error.message : String(error)}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=serverUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverUtils.js","sourceRoot":"","sources":["../../src/utils/serverUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AAEjE,uCAAuC;AACvC,KAAK,UAAU,WAAW;IACxB,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;QACrC,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,CAAC;QAChD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,oBAAoB,oBAAoB,EAAE;YACxE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,SAAS,EAAE;aACvC;SACF,CAAC,CAAC;QAEH,MAAM,MAAM,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE1C,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,8BAA8B,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxG,CAAC;AACH,CAAC"}
|
package/dist/utils/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAc,CAAC"}
|
package/dist/utils/version.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,oBAAoB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# This script creates an AWS EC2 key pair and saves it to a file
|
|
4
|
-
|
|
5
|
-
if [ $# -lt 1 ]; then
|
|
6
|
-
echo "Usage: $0 <key-name> [aws-profile-option] [aws-region-option]"
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
KEY_NAME=$1
|
|
11
|
-
PROFILE_OPTION=$2
|
|
12
|
-
REGION_OPTION=$3
|
|
13
|
-
|
|
14
|
-
# Create the key pair and save it to a file
|
|
15
|
-
aws ec2 create-key-pair ${PROFILE_OPTION} ${REGION_OPTION} --key-name ${KEY_NAME} --query 'KeyMaterial' --output text > ${KEY_NAME}.pem
|
|
16
|
-
|
|
17
|
-
# Set appropriate permissions for the key file
|
|
18
|
-
chmod 400 ${KEY_NAME}.pem
|
|
19
|
-
|
|
20
|
-
echo "Key pair ${KEY_NAME} created and saved."
|
package/scripts/aws/ec2-dns.sh
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# This script retrieves the public DNS name of an EC2 instance
|
|
4
|
-
|
|
5
|
-
if [ $# -lt 1 ]; then
|
|
6
|
-
echo "Usage: $0 <instance-id> [aws-profile-option] [aws-region-option]"
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
INSTANCE_ID=$1
|
|
11
|
-
PROFILE_OPTION=$2
|
|
12
|
-
REGION_OPTION=$3
|
|
13
|
-
|
|
14
|
-
# Get the public DNS name of the instance
|
|
15
|
-
PUBLIC_DNS=$(aws ec2 describe-instances ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
16
|
-
--instance-ids ${INSTANCE_ID} \
|
|
17
|
-
--query 'Reservations[0].Instances[0].PublicDnsName' \
|
|
18
|
-
--output text)
|
|
19
|
-
|
|
20
|
-
echo ${PUBLIC_DNS}
|
package/scripts/aws/provision.sh
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# This script provisions an EC2 instance using a key pair
|
|
4
|
-
|
|
5
|
-
if [ $# -lt 1 ]; then
|
|
6
|
-
echo "Usage: $0 <key-name> [aws-profile-option] [aws-region-option]"
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
KEY_NAME=$1
|
|
11
|
-
PROFILE_OPTION=$2
|
|
12
|
-
REGION_OPTION=$3
|
|
13
|
-
|
|
14
|
-
# Extract region from the region option (simpler method)
|
|
15
|
-
REGION=$(echo ${REGION_OPTION} | sed -n 's/.*--region \([a-z0-9-]*\).*/\1/p')
|
|
16
|
-
|
|
17
|
-
# If region is not found in the option, use default
|
|
18
|
-
if [ -z "$REGION" ]; then
|
|
19
|
-
# Try to get the default region
|
|
20
|
-
REGION=$(aws configure get region ${PROFILE_OPTION})
|
|
21
|
-
|
|
22
|
-
# If still no region, use us-east-1 as fallback
|
|
23
|
-
if [ -z "$REGION" ]; then
|
|
24
|
-
REGION="us-east-1"
|
|
25
|
-
fi
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
echo "Using AWS region: ${REGION}"
|
|
29
|
-
|
|
30
|
-
# Query for the latest Amazon Linux 2023 AMI for the current region
|
|
31
|
-
echo "Querying for latest Amazon Linux 2023 AMI in region ${REGION}..."
|
|
32
|
-
AMI_ID=$(aws ec2 describe-images ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
33
|
-
--owners amazon \
|
|
34
|
-
--filters "Name=name,Values=al2023-ami-2023.*-x86_64" "Name=state,Values=available" \
|
|
35
|
-
--query "sort_by(Images, &CreationDate)[-1].ImageId" \
|
|
36
|
-
--output text)
|
|
37
|
-
|
|
38
|
-
# If we couldn't get an AMI ID, exit with error
|
|
39
|
-
if [ -z "$AMI_ID" ] || [ "$AMI_ID" == "None" ]; then
|
|
40
|
-
echo "ERROR: Unable to find a valid Amazon Linux 2023 AMI for region ${REGION}"
|
|
41
|
-
exit 1
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
echo "Using AMI ID: ${AMI_ID}"
|
|
45
|
-
|
|
46
|
-
# For eu-north-1 region, use t3.micro as t2.micro is not supported
|
|
47
|
-
INSTANCE_TYPE="t2.micro"
|
|
48
|
-
if [ "$REGION" = "eu-north-1" ]; then
|
|
49
|
-
INSTANCE_TYPE="t3.micro"
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
echo "Using instance type: ${INSTANCE_TYPE}"
|
|
53
|
-
|
|
54
|
-
# Create a custom security group
|
|
55
|
-
SECURITY_GROUP_NAME="tonk-security-group-$(date +%s)"
|
|
56
|
-
echo "Creating security group: ${SECURITY_GROUP_NAME}"
|
|
57
|
-
|
|
58
|
-
SECURITY_GROUP_ID=$(aws ec2 create-security-group ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
59
|
-
--group-name ${SECURITY_GROUP_NAME} \
|
|
60
|
-
--description "Security group for Tonk" \
|
|
61
|
-
--query 'GroupId' \
|
|
62
|
-
--output text)
|
|
63
|
-
|
|
64
|
-
echo "Security group created with ID: ${SECURITY_GROUP_ID}"
|
|
65
|
-
|
|
66
|
-
# Add SSH access rule to the security group
|
|
67
|
-
aws ec2 authorize-security-group-ingress ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
68
|
-
--group-id ${SECURITY_GROUP_ID} \
|
|
69
|
-
--protocol tcp \
|
|
70
|
-
--port 22 \
|
|
71
|
-
--cidr 0.0.0.0/0
|
|
72
|
-
|
|
73
|
-
echo "Added SSH access rule to security group"
|
|
74
|
-
|
|
75
|
-
# Add HTTPS access rule to the security group
|
|
76
|
-
aws ec2 authorize-security-group-ingress ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
77
|
-
--group-id ${SECURITY_GROUP_ID} \
|
|
78
|
-
--protocol tcp \
|
|
79
|
-
--port 443 \
|
|
80
|
-
--cidr 0.0.0.0/0
|
|
81
|
-
|
|
82
|
-
echo "Added HTTPS access rule to security group"
|
|
83
|
-
|
|
84
|
-
# Launch an EC2 instance with Amazon Linux 2023 AMI and the new security group
|
|
85
|
-
INSTANCE_ID=$(aws ec2 run-instances ${PROFILE_OPTION} ${REGION_OPTION} \
|
|
86
|
-
--image-id ${AMI_ID} \
|
|
87
|
-
--instance-type ${INSTANCE_TYPE} \
|
|
88
|
-
--key-name ${KEY_NAME} \
|
|
89
|
-
--security-group-ids ${SECURITY_GROUP_ID} \
|
|
90
|
-
--query 'Instances[0].InstanceId' \
|
|
91
|
-
--output text)
|
|
92
|
-
|
|
93
|
-
echo "Instance launched with ID: ${INSTANCE_ID}"
|