@co0ontty/wand 0.2.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 +13 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.js +54 -0
- package/dist/cert.d.ts +8 -0
- package/dist/cert.js +124 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +121 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +120 -0
- package/dist/message-parser.d.ts +2 -0
- package/dist/message-parser.js +189 -0
- package/dist/process-manager.d.ts +59 -0
- package/dist/process-manager.js +1132 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +875 -0
- package/dist/session-logger.d.ts +23 -0
- package/dist/session-logger.js +78 -0
- package/dist/storage.d.ts +32 -0
- package/dist/storage.js +181 -0
- package/dist/types.d.ts +105 -0
- package/dist/types.js +1 -0
- package/dist/web-ui/content/scripts.js +4908 -0
- package/dist/web-ui/content/styles.css +4018 -0
- package/dist/web-ui/index.d.ts +1 -0
- package/dist/web-ui/index.js +42 -0
- package/dist/web-ui/scripts.d.ts +1 -0
- package/dist/web-ui/scripts.js +15 -0
- package/dist/web-ui/styles.d.ts +1 -0
- package/dist/web-ui/styles.js +13 -0
- package/dist/web-ui/utils.d.ts +4 -0
- package/dist/web-ui/utils.js +12 -0
- package/dist/web-ui.d.ts +1 -0
- package/dist/web-ui.js +2 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderApp(configPath: string): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Main entry point for web-ui module
|
|
2
|
+
// Combines CSS and JavaScript into a single HTML document
|
|
3
|
+
import { getCSSStyles } from "./styles.js";
|
|
4
|
+
import { getScriptContent } from "./scripts.js";
|
|
5
|
+
// Use String.fromCharCode to avoid template literal interpretation of </script>
|
|
6
|
+
const scriptClose = String.fromCharCode(60, 47) + "script>";
|
|
7
|
+
const scriptOpen = "<" + "script";
|
|
8
|
+
export function renderApp(configPath) {
|
|
9
|
+
const cssStyles = getCSSStyles();
|
|
10
|
+
const scriptContent = getScriptContent(configPath);
|
|
11
|
+
return `<!doctype html>
|
|
12
|
+
<html lang="zh-CN">
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="utf-8" />
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
16
|
+
<title>Wand Console</title>
|
|
17
|
+
<meta name="description" content="Local CLI Console for Vibe Coding - Manage terminal sessions from your browser" />
|
|
18
|
+
<meta name="theme-color" content="#f6f1e8" media="(prefers-color-scheme: light)" />
|
|
19
|
+
<meta name="theme-color" content="#1f1b17" media="(prefers-color-scheme: dark)" />
|
|
20
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
21
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
22
|
+
<meta name="apple-mobile-web-app-title" content="Wand" />
|
|
23
|
+
<link rel="apple-touch-icon" href="/icon-192.png" />
|
|
24
|
+
<link rel="manifest" href="/manifest.json" />
|
|
25
|
+
<link rel="stylesheet" href="/vendor/xterm/css/xterm.css" />
|
|
26
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
27
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
28
|
+
<link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
|
29
|
+
<style>
|
|
30
|
+
${cssStyles}
|
|
31
|
+
</style>
|
|
32
|
+
</head>
|
|
33
|
+
<body>
|
|
34
|
+
<div id="app"></div>
|
|
35
|
+
${scriptOpen} src="/vendor/xterm/lib/xterm.js">${scriptClose}
|
|
36
|
+
${scriptOpen} src="/vendor/xterm-addon-fit/lib/addon-fit.js">${scriptClose}
|
|
37
|
+
${scriptOpen}>
|
|
38
|
+
${scriptContent}
|
|
39
|
+
${scriptClose}
|
|
40
|
+
</body>
|
|
41
|
+
</html>`;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getScriptContent(configPath: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { escapeHtml } from "./utils.js";
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
// Cache the script content
|
|
7
|
+
let _scriptCache = null;
|
|
8
|
+
export function getScriptContent(configPath) {
|
|
9
|
+
if (!_scriptCache) {
|
|
10
|
+
const scriptPath = path.join(__dirname, "content", "scripts.js");
|
|
11
|
+
_scriptCache = fs.readFileSync(scriptPath, "utf-8");
|
|
12
|
+
}
|
|
13
|
+
// Inject the config path
|
|
14
|
+
return _scriptCache.replace("${escapeHtml(configPath)}", escapeHtml(configPath));
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCSSStyles(): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
// Cache the CSS content
|
|
6
|
+
let _cssCache = null;
|
|
7
|
+
export function getCSSStyles() {
|
|
8
|
+
if (!_cssCache) {
|
|
9
|
+
const cssPath = path.join(__dirname, "content", "styles.css");
|
|
10
|
+
_cssCache = fs.readFileSync(cssPath, "utf-8");
|
|
11
|
+
}
|
|
12
|
+
return _cssCache;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Shared utilities for web-ui module
|
|
2
|
+
/**
|
|
3
|
+
* Escape HTML special characters to prevent XSS
|
|
4
|
+
*/
|
|
5
|
+
export function escapeHtml(value) {
|
|
6
|
+
return String(value)
|
|
7
|
+
.replace(/&/g, "&")
|
|
8
|
+
.replace(/</g, "<")
|
|
9
|
+
.replace(/>/g, ">")
|
|
10
|
+
.replace(/"/g, """)
|
|
11
|
+
.replace(/'/g, "'");
|
|
12
|
+
}
|
package/dist/web-ui.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { renderApp } from "./web-ui/index.js";
|
package/dist/web-ui.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@co0ontty/wand",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Remote web coding controller for local CLI tools.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"wand": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": ""
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"preferGlobal": true,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json && npm run build:copy-content",
|
|
20
|
+
"build:copy-content": "cp -r src/web-ui/content dist/web-ui/",
|
|
21
|
+
"dev": "tsx src/cli.ts web",
|
|
22
|
+
"check": "tsc --noEmit -p tsconfig.json",
|
|
23
|
+
"pre-release-test": "node scripts/pre-release-test.js",
|
|
24
|
+
"test": "npm run pre-release-test",
|
|
25
|
+
"test:e2e": "playwright test",
|
|
26
|
+
"test:e2e:ui": "playwright test --ui",
|
|
27
|
+
"test:e2e:debug": "playwright test --debug",
|
|
28
|
+
"test:e2e:report": "playwright show-report"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"cli",
|
|
32
|
+
"web",
|
|
33
|
+
"automation",
|
|
34
|
+
"developer-tools"
|
|
35
|
+
],
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.5.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@types/cookie": "^0.6.0",
|
|
42
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
43
|
+
"express": "^4.21.2",
|
|
44
|
+
"node-pty": "^1.1.0",
|
|
45
|
+
"ws": "^8.19.0",
|
|
46
|
+
"xterm": "^5.3.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@playwright/test": "^1.58.2",
|
|
50
|
+
"@types/express": "^4.17.21",
|
|
51
|
+
"@types/node": "^22.13.14",
|
|
52
|
+
"@types/ws": "^8.18.1",
|
|
53
|
+
"playwright": "^1.58.2",
|
|
54
|
+
"tsx": "^4.19.3",
|
|
55
|
+
"typescript": "^5.8.2"
|
|
56
|
+
}
|
|
57
|
+
}
|