refactor: P0 architecture improvements

- Split browser.ts (700 lines) into src/browser/ module (page, mcp, errors, discover, tabs, index)
- Add unified error handling: CliError base class + logger module
- Enable TypeScript strict mode, fix 12 type errors
- Extract inline build scripts to scripts/clean-yaml.cjs and copy-yaml.cjs
- All 178 unit tests pass, build produces 83 entries across 19 sites
This commit is contained in:
jackwener committed 2026-03-17 17:01:51 +08:00
1 parent 8263a06a85
commit 68840fc85c
27 files changed
+1253 -753

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
/**
* Clean YAML files from dist/clis/ before copying fresh ones.
*/
const { readdirSync, rmSync, existsSync, statSync } = require('fs');
const path = require('path');
function walk(dir) {
if (!existsSync(dir)) return;
for (const f of readdirSync(dir)) {
const fp = path.join(dir, f);
if (statSync(fp).isDirectory()) {
walk(fp);
} else if (/\.ya?ml$/.test(f)) {
rmSync(fp);
}
}
}
walk('dist/clis');
+21
View File
@@ -0,0 +1,21 @@
/**
* Copy YAML files from src/clis/ to dist/clis/.
*/
const { readdirSync, copyFileSync, mkdirSync, existsSync, statSync } = require('fs');
const path = require('path');
function walk(src, dst) {
if (!existsSync(src)) return;
for (const f of readdirSync(src)) {
const sp = path.join(src, f);
const dp = path.join(dst, f);
if (statSync(sp).isDirectory()) {
walk(sp, dp);
} else if (/\.ya?ml$/.test(f)) {
mkdirSync(path.dirname(dp), { recursive: true });
copyFileSync(sp, dp);
}
}
}
walk('src/clis', 'dist/clis');