sessioncast-cli 1.1.0 → 1.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/config.d.ts +3 -0
- package/dist/config.js +9 -0
- package/dist/index.js +104 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ interface ConfigSchema {
|
|
|
9
9
|
tokenExpiresAt?: number;
|
|
10
10
|
agentToken?: string;
|
|
11
11
|
machineId?: string;
|
|
12
|
+
hasSeenWelcome?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const config: Conf<ConfigSchema>;
|
|
14
15
|
export declare function getApiKey(): string | undefined;
|
|
@@ -30,4 +31,6 @@ export declare function getMachineId(): string | undefined;
|
|
|
30
31
|
export declare function setMachineId(id: string): void;
|
|
31
32
|
export declare function clearAuth(): void;
|
|
32
33
|
export declare function isLoggedIn(): boolean;
|
|
34
|
+
export declare function hasSeenWelcome(): boolean;
|
|
35
|
+
export declare function setSeenWelcome(): void;
|
|
33
36
|
export default config;
|
package/dist/config.js
CHANGED
|
@@ -22,6 +22,8 @@ exports.getMachineId = getMachineId;
|
|
|
22
22
|
exports.setMachineId = setMachineId;
|
|
23
23
|
exports.clearAuth = clearAuth;
|
|
24
24
|
exports.isLoggedIn = isLoggedIn;
|
|
25
|
+
exports.hasSeenWelcome = hasSeenWelcome;
|
|
26
|
+
exports.setSeenWelcome = setSeenWelcome;
|
|
25
27
|
const conf_1 = __importDefault(require("conf"));
|
|
26
28
|
const config = new conf_1.default({
|
|
27
29
|
projectName: 'sessioncast',
|
|
@@ -101,4 +103,11 @@ function clearAuth() {
|
|
|
101
103
|
function isLoggedIn() {
|
|
102
104
|
return !!(getApiKey() || getAccessToken() || getAgentToken());
|
|
103
105
|
}
|
|
106
|
+
// First run detection
|
|
107
|
+
function hasSeenWelcome() {
|
|
108
|
+
return config.get('hasSeenWelcome') === true;
|
|
109
|
+
}
|
|
110
|
+
function setSeenWelcome() {
|
|
111
|
+
config.set('hasSeenWelcome', true);
|
|
112
|
+
}
|
|
104
113
|
exports.default = config;
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,119 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
38
|
};
|
|
6
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
40
|
const commander_1 = require("commander");
|
|
8
41
|
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const child_process_1 = require("child_process");
|
|
43
|
+
const os = __importStar(require("os"));
|
|
9
44
|
const login_1 = require("./commands/login");
|
|
10
45
|
const agents_1 = require("./commands/agents");
|
|
11
46
|
const sessions_1 = require("./commands/sessions");
|
|
12
47
|
const sendkeys_1 = require("./commands/sendkeys");
|
|
13
48
|
const agent_1 = require("./commands/agent");
|
|
49
|
+
const config_1 = require("./config");
|
|
50
|
+
// Check if tmux/itmux is available
|
|
51
|
+
function checkTmux() {
|
|
52
|
+
const isWindows = os.platform() === 'win32';
|
|
53
|
+
if (isWindows) {
|
|
54
|
+
// Check for itmux on Windows
|
|
55
|
+
const paths = [
|
|
56
|
+
process.env.ITMUX_HOME,
|
|
57
|
+
`${os.homedir()}/itmux`,
|
|
58
|
+
'C:\\itmux',
|
|
59
|
+
`${os.homedir()}\\itmux`,
|
|
60
|
+
'C:\\Program Files\\itmux',
|
|
61
|
+
].filter(Boolean);
|
|
62
|
+
for (const p of paths) {
|
|
63
|
+
try {
|
|
64
|
+
require('fs').accessSync(p);
|
|
65
|
+
return { available: true, isWindows: true };
|
|
66
|
+
}
|
|
67
|
+
catch { }
|
|
68
|
+
}
|
|
69
|
+
return { available: false, isWindows: true };
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Check for tmux on Unix
|
|
73
|
+
try {
|
|
74
|
+
(0, child_process_1.execSync)('which tmux', { stdio: 'pipe' });
|
|
75
|
+
return { available: true, isWindows: false };
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return { available: false, isWindows: false };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Show welcome message on first run
|
|
83
|
+
function showWelcome() {
|
|
84
|
+
if ((0, config_1.hasSeenWelcome)())
|
|
85
|
+
return;
|
|
86
|
+
const { available, isWindows } = checkTmux();
|
|
87
|
+
console.log('');
|
|
88
|
+
console.log(chalk_1.default.green.bold('✓ SessionCast CLI installed'));
|
|
89
|
+
console.log('');
|
|
90
|
+
if (!available) {
|
|
91
|
+
console.log(chalk_1.default.yellow('⚠ tmux not found'));
|
|
92
|
+
if (isWindows) {
|
|
93
|
+
console.log(chalk_1.default.gray(' Install itmux: https://github.com/phayte/itmux'));
|
|
94
|
+
console.log(chalk_1.default.gray(' Or: choco install itmux'));
|
|
95
|
+
}
|
|
96
|
+
else if (os.platform() === 'darwin') {
|
|
97
|
+
console.log(chalk_1.default.gray(' Install: brew install tmux'));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
console.log(chalk_1.default.gray(' Install: sudo apt install tmux'));
|
|
101
|
+
}
|
|
102
|
+
console.log('');
|
|
103
|
+
}
|
|
104
|
+
console.log(chalk_1.default.bold('Quick Start:'));
|
|
105
|
+
console.log(` ${chalk_1.default.cyan('sessioncast login')} ${chalk_1.default.gray('# Login via browser')}`);
|
|
106
|
+
console.log(` ${chalk_1.default.cyan('sessioncast agent')} ${chalk_1.default.gray('# Start streaming')}`);
|
|
107
|
+
console.log('');
|
|
108
|
+
console.log(chalk_1.default.gray('Web Console: https://app.sessioncast.io'));
|
|
109
|
+
console.log('');
|
|
110
|
+
(0, config_1.setSeenWelcome)();
|
|
111
|
+
}
|
|
14
112
|
const program = new commander_1.Command();
|
|
15
113
|
program
|
|
16
114
|
.name('sessioncast')
|
|
17
115
|
.description('SessionCast CLI - Control your agents from anywhere')
|
|
18
|
-
.version('
|
|
116
|
+
.version('1.1.2');
|
|
19
117
|
// Login command
|
|
20
118
|
program
|
|
21
119
|
.command('login [api-key]')
|
|
@@ -78,6 +176,11 @@ program.on('--help', () => {
|
|
|
78
176
|
});
|
|
79
177
|
// Default action (no command)
|
|
80
178
|
program.action(() => {
|
|
179
|
+
// Show welcome message on first run
|
|
180
|
+
if (!(0, config_1.hasSeenWelcome)()) {
|
|
181
|
+
showWelcome();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
81
184
|
console.log(chalk_1.default.bold('\n SessionCast CLI\n'));
|
|
82
185
|
console.log(' Control your agents from anywhere.\n');
|
|
83
186
|
console.log(chalk_1.default.gray(' Run `sessioncast --help` for usage.\n'));
|