@whatcode-ai/whatcode 1.9.0 → 1.11.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 +1 -1
- package/dist/cli.js +18 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/qrcode.d.ts +2 -0
- package/dist/qrcode.d.ts.map +1 -0
- package/dist/qrcode.js +10 -0
- package/dist/qrcode.js.map +1 -0
- package/package.json +15 -5
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npx @whatcode-ai/whatcode --tailscale
|
|
|
22
22
|
| `--hostname` | `-H` | `0.0.0.0` | Hostname to bind the opencode server to |
|
|
23
23
|
| `--port` | `-p` | `8192` | Port for the Whatcode server |
|
|
24
24
|
| `--opencode-port` | | `4096` | Port for the opencode server |
|
|
25
|
-
| `--
|
|
25
|
+
| `--log-level` | | `info` | Log verbosity: `none` \| `info` \| `debug` |
|
|
26
26
|
| `--help` | | | Show help |
|
|
27
27
|
|
|
28
28
|
## Programmatic usage
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createWhatcodeServer, resetWhatcodeServer } from '@whatcode-ai/sdk';
|
|
3
|
+
import { logger, logLevelSchema } from '@whatcode-ai/sdk/logger';
|
|
4
|
+
import { printQrCode } from "./qrcode.js";
|
|
3
5
|
import yargs from 'yargs';
|
|
4
6
|
import { hideBin } from 'yargs/helpers';
|
|
5
7
|
import updateNotifier from 'update-notifier';
|
|
6
8
|
import pkg from '../package.json' with { type: 'json' };
|
|
7
9
|
updateNotifier({ pkg }).notify();
|
|
8
|
-
const { tailscale, reset, port, opencodePort,
|
|
10
|
+
const { tailscale, reset, port, opencodePort, logLevel, password } = await yargs(hideBin(process.argv))
|
|
9
11
|
.scriptName('whatcode')
|
|
10
12
|
.help()
|
|
11
13
|
.strict()
|
|
@@ -15,17 +17,29 @@ const { tailscale, reset, port, opencodePort, debug, password } = await yargs(hi
|
|
|
15
17
|
.option('tailscale', { type: 'boolean', description: 'Expose opencode via Tailscale serve (HTTPS on your tailnet)' })
|
|
16
18
|
.option('port', { type: 'number', description: 'Port for the Whatcode server (default: 8192)' })
|
|
17
19
|
.option('opencode-port', { type: 'number', description: 'Port for the opencode server (default: 4096)' })
|
|
18
|
-
.option('
|
|
20
|
+
.option('log-level', {
|
|
21
|
+
type: 'string',
|
|
22
|
+
choices: ['none', 'info', 'debug'],
|
|
23
|
+
default: 'info',
|
|
24
|
+
description: 'Log level: none | info | debug (default: info)',
|
|
25
|
+
})
|
|
19
26
|
.option('password', { type: 'string', description: 'Password to protect the Whatcode and opencode servers (HTTP Basic Auth)' })
|
|
20
27
|
.parseAsync();
|
|
21
28
|
if (reset) {
|
|
22
29
|
await resetWhatcodeServer();
|
|
23
30
|
}
|
|
24
|
-
await createWhatcodeServer({
|
|
31
|
+
const { url } = await createWhatcodeServer({
|
|
25
32
|
tailscale,
|
|
26
33
|
...(port !== undefined && { port }),
|
|
27
34
|
...(opencodePort !== undefined && { opencodePort }),
|
|
28
|
-
|
|
35
|
+
logLevel: await logLevelSchema.parseAsync(logLevel),
|
|
29
36
|
...(password !== undefined && { password }),
|
|
30
37
|
});
|
|
38
|
+
if (url) {
|
|
39
|
+
logger.info('whatcode', `use this URL in the app: ${url}`);
|
|
40
|
+
printQrCode(url, password);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
logger.info('whatcode', 'could not determine local IP — find your machine IP in your network settings and connect manually');
|
|
44
|
+
}
|
|
31
45
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAA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mG,CAAC,CAAC;AAC/H,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,6BAA6B,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,0BAA0B,CAAC"}
|
package/dist/qrcode.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qrcode.d.ts","sourceRoot":"","sources":["../src/qrcode.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,WAAW,MAAM,KAAG,IAK5D,CAAC"}
|
package/dist/qrcode.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import qrcode from 'qrcode-terminal';
|
|
2
|
+
import { CLIENT_URL } from "./config.js";
|
|
3
|
+
export const printQrCode = (url, password) => {
|
|
4
|
+
const params = new URLSearchParams({ url });
|
|
5
|
+
if (password)
|
|
6
|
+
params.set('password', password);
|
|
7
|
+
const deepLink = `${CLIENT_URL}/connect?${params.toString()}`;
|
|
8
|
+
qrcode.generate(deepLink, { small: true });
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=qrcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qrcode.js","sourceRoot":"","sources":["../src/qrcode.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,QAAiB,EAAQ,EAAE;IAClE,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,IAAI,QAAQ;QAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,GAAG,UAAU,YAAY,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9D,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatcode-ai/whatcode",
|
|
3
3
|
"description": "SDK and CLI to start opencode and optionally expose it over HTTPS via Tailscale.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
7
7
|
"tailscale",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
".": {
|
|
33
33
|
"types": "./dist/index.d.ts",
|
|
34
34
|
"import": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./logger": {
|
|
37
|
+
"types": "./dist/logger.d.ts",
|
|
38
|
+
"import": "./dist/logger.js"
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
"publishConfig": {
|
|
@@ -43,6 +47,10 @@
|
|
|
43
47
|
".": {
|
|
44
48
|
"types": "./dist/index.d.ts",
|
|
45
49
|
"import": "./dist/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./logger": {
|
|
52
|
+
"types": "./dist/logger.d.ts",
|
|
53
|
+
"import": "./dist/logger.js"
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
},
|
|
@@ -62,18 +70,20 @@
|
|
|
62
70
|
"README.md"
|
|
63
71
|
],
|
|
64
72
|
"dependencies": {
|
|
65
|
-
"@whatcode-ai/sdk": "1.
|
|
73
|
+
"@whatcode-ai/sdk": "1.11.0",
|
|
74
|
+
"qrcode-terminal": "^0.12.0",
|
|
66
75
|
"update-notifier": "^7.3.1",
|
|
67
76
|
"yargs": "^18.0.0"
|
|
68
77
|
},
|
|
69
78
|
"devDependencies": {
|
|
70
|
-
"@goatjs/node-monorepo-eslint": "^2.
|
|
71
|
-
"@goatjs/rimraf": "^2.
|
|
79
|
+
"@goatjs/node-monorepo-eslint": "^2.16.0",
|
|
80
|
+
"@goatjs/rimraf": "^2.4.0",
|
|
72
81
|
"@goatjs/typescript-config": "^2.1.0",
|
|
73
82
|
"@types/node": "^25.6.0",
|
|
83
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
74
84
|
"@types/update-notifier": "^6.0.8",
|
|
75
85
|
"@types/yargs": "^17.0.35",
|
|
76
|
-
"eslint": "^10.
|
|
86
|
+
"eslint": "^10.3.0",
|
|
77
87
|
"typescript": "^6.0.3"
|
|
78
88
|
}
|
|
79
89
|
}
|