clsh-dev 0.1.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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ // clsh CLI — one command to start your terminal server
3
+ // Prevent the agent from auto-running on import
4
+ process.env['CLSH_CLI'] = '1';
5
+ const args = process.argv.slice(2);
6
+ if (args[0] === 'setup') {
7
+ const { runSetup } = await import('./setup.js');
8
+ await runSetup();
9
+ }
10
+ else if (args[0] === '--help' || args[0] === '-h') {
11
+ console.log(`
12
+ clsh — real terminal on your phone
13
+
14
+ Usage:
15
+ npx clsh Start the clsh server
16
+ npx clsh setup Configure ngrok for a permanent URL
17
+ npx clsh --help Show this help message
18
+
19
+ Docs: https://github.com/my-claude-utils/clsh
20
+ `);
21
+ }
22
+ else if (args[0] === '--version' || args[0] === '-v') {
23
+ // Read version from package.json at build time isn't worth the complexity.
24
+ // Just hardcode and bump with releases.
25
+ console.log('clsh 0.1.0');
26
+ }
27
+ else {
28
+ const { main } = await import('@clsh/agent');
29
+ await main();
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,uDAAuD;AAEvD,gDAAgD;AAChD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;AAE9B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;IACxB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,QAAQ,EAAE,CAAC;AACnB,CAAC;KAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC;;;;;;;;;CASb,CAAC,CAAC;AACH,CAAC;KAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IACvD,2EAA2E;IAC3E,wCAAwC;IACxC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC5B,CAAC;KAAM,CAAC;IACN,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,IAAI,EAAE,CAAC;AACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runSetup(): Promise<void>;
2
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAqCA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA2D9C"}
package/dist/setup.js ADDED
@@ -0,0 +1,75 @@
1
+ // clsh setup wizard — configures ngrok for a permanent URL
2
+ import { createInterface } from 'node:readline';
3
+ import { join } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+ import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
6
+ const CONFIG_DIR = join(homedir(), '.clsh');
7
+ const CONFIG_PATH = join(CONFIG_DIR, 'config.json');
8
+ function readConfig() {
9
+ try {
10
+ return JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
11
+ }
12
+ catch {
13
+ return {};
14
+ }
15
+ }
16
+ function writeConfig(config) {
17
+ mkdirSync(CONFIG_DIR, { recursive: true });
18
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 });
19
+ }
20
+ function prompt(rl, question) {
21
+ return new Promise((resolve) => {
22
+ rl.question(question, (answer) => {
23
+ resolve(answer.trim());
24
+ });
25
+ });
26
+ }
27
+ export async function runSetup() {
28
+ const rl = createInterface({
29
+ input: process.stdin,
30
+ output: process.stdout,
31
+ });
32
+ console.log(`
33
+ clsh setup
34
+ ----------
35
+
36
+ clsh works out of the box with a free SSH tunnel (localhost.run).
37
+ For a permanent URL that survives restarts, set up ngrok (free).
38
+ `);
39
+ const wantNgrok = await prompt(rl, ' Do you want to set up ngrok? (y/N) ');
40
+ if (wantNgrok.toLowerCase() !== 'y' && wantNgrok.toLowerCase() !== 'yes') {
41
+ console.log('\n Skipped. Run `npx clsh` to start with the default SSH tunnel.\n');
42
+ rl.close();
43
+ return;
44
+ }
45
+ console.log(`
46
+ 1. Sign up at https://ngrok.com (free)
47
+ 2. Copy your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken
48
+ `);
49
+ const authtoken = await prompt(rl, ' Paste your ngrok authtoken: ');
50
+ if (!authtoken) {
51
+ console.log('\n No authtoken provided. Run `npx clsh setup` again when ready.\n');
52
+ rl.close();
53
+ return;
54
+ }
55
+ const config = readConfig();
56
+ config.ngrokAuthtoken = authtoken;
57
+ writeConfig(config);
58
+ console.log(` Saved to ${CONFIG_PATH}`);
59
+ console.log(`
60
+ 3. Get a free static domain at https://dashboard.ngrok.com/domains
61
+ (one free domain per account)
62
+ `);
63
+ const domain = await prompt(rl, ' Paste your static domain (e.g. your-name.ngrok-free.dev): ');
64
+ if (domain) {
65
+ config.ngrokStaticDomain = domain;
66
+ writeConfig(config);
67
+ console.log(` Saved to ${CONFIG_PATH}`);
68
+ }
69
+ console.log(`
70
+ Done! Run \`npx clsh\` to start with your permanent ngrok URL.
71
+ Guide: https://github.com/my-claude-utils/clsh/blob/main/docs/ngrok-setup.md
72
+ `);
73
+ rl.close();
74
+ }
75
+ //# sourceMappingURL=set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,OAAO,CAAC,GAAG,CAAC;;;CAGb,CAAC,CAAC;IAED,EAAE,CAAC,KAAK,EAAE,CAAC;AACb,CAAC"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "clsh-dev",
3
+ "version": "0.1.0",
4
+ "description": "Your Mac, in your pocket. Real terminal on your phone.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/my-claude-utils/clsh.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://clsh.dev",
12
+ "bugs": {
13
+ "url": "https://github.com/my-claude-utils/clsh/issues"
14
+ },
15
+ "type": "module",
16
+ "files": ["dist"],
17
+ "bin": {
18
+ "clsh": "dist/index.js"
19
+ },
20
+ "main": "dist/index.js",
21
+ "types": "dist/index.d.ts",
22
+ "scripts": {
23
+ "dev": "tsx watch src/index.ts",
24
+ "build": "tsc",
25
+ "lint": "eslint src/",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "echo \"No tests yet\""
28
+ },
29
+ "dependencies": {
30
+ "@clsh/agent": "0.0.1",
31
+ "@clsh/web": "0.0.1"
32
+ },
33
+ "devDependencies": {
34
+ "tsx": "^4.19.0"
35
+ }
36
+ }