refactor(cli): migrate packages/cli from MJS to TypeScript

Migrate urec and uconn CLI tools from plain JavaScript (.mjs) to TypeScript (.ts) with full type safety and strict mode enabled.

Changes:
- Created TypeScript configuration (tsconfig.json) with strict mode
- Migrated src/urec.mjs to src/urec.ts with proper type annotations
- Migrated src/uconn.mjs to src/uconn.ts with proper type annotations
- Added type declarations for @uncaged/dashboard-server/protocol
- Updated package.json with build script and bin entries pointing to dist/
- Added comprehensive test suites for type safety and functionality
- Added .gitignore to exclude built artifacts

Type Safety:
- No implicit any types throughout the codebase
- Explicit type annotations for all variables and functions
- Proper null safety with strictNullChecks
- Full type coverage for Node.js built-ins and external dependencies

Testing:
- 22 passing tests covering type safety, build config, and functionality
- Tests verify TypeScript compilation succeeds
- Tests verify executables work correctly with preserved shebangs
- Tests verify backward compatibility of CLI behavior

Build:
- TypeScript compiles successfully with no errors
- Built files maintain ESM format
- Shebang lines preserved in output
- Source maps generated for debugging

Resolves #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 10:15:03 +00:00
parent 6fd9e26903
commit 0c3624ddca
10 changed files with 592 additions and 3 deletions
+6 -1
View File
@@ -21,11 +21,14 @@
"uconn": "./src/uconn.mjs",
},
"dependencies": {
"@uncaged/dashboard-server": "*",
"@uncaged/dashboard-server": "workspace:^",
"chokidar": "^4.0.0",
"commander": "^13.1.0",
"ws": "^8.18.0",
},
"devDependencies": {
"@types/ws": "^8.18.1",
},
},
"packages/frontend": {
"name": "@uncaged/dashboard-frontend",
@@ -287,6 +290,8 @@
"@types/react-dom": ["@types/react-dom@19.2.3", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],
"@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
"@uncaged/cli-dashboard": ["@uncaged/cli-dashboard@workspace:packages/cli"],
"@uncaged/dashboard-frontend": ["@uncaged/dashboard-frontend@workspace:packages/frontend"],