Skip to content

refactor: migrate codebase from JavaScript to TypeScript - #1

Merged
tomsun28 merged 5 commits into
mainfrom
ts
Sep 6, 2026
Merged

refactor: migrate codebase from JavaScript to TypeScript#1
tomsun28 merged 5 commits into
mainfrom
ts

Conversation

@tomsun28

@tomsun28 tomsun28 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Port all src/, test/, and fixtures/ files to TypeScript with strict mode
enabled. Compiled output now lives in dist/ (tsc); bin/agentcli.js and
test paths point at dist; shared types are centralized in src/types.ts.

Behavior changes bundled with the migration:
- server remove now also deletes the stale tools cache file for that server
- tool help output lists the --no-daemon global flag
- client version reported to MCP servers is the real package version
  (was hardcoded "0.0.1")

Build and publish hardening:
- engines: ">=20" -> ">=20.10" (import attributes require Node 20.10+)
- files narrowed to bin, dist/src, dist/package.json, skills, README.md
  with negations for *.d.ts and *.map: package shrinks from 56 to 18 files
  (184 kB -> 67 kB unpacked); tests and fixtures no longer ship
- tsconfig: noEmitOnError true, so type errors cannot produce a bad dist
- saveConfig writes ~/.agentcli/config.json with 0600 permissions and also
  tightens pre-existing files (config may hold bearer tokens)

Verified: build and 48/48 tests pass; installed from the real packed
tarball and exercised stdio/HTTP MCP calls, daemon mode, help discovery,
and error surfaces end to end.

BREAKING CHANGE: Node.js >= 20.10 is now required (was >= 20).
- CI: build + test on push to main/ts and PRs to main, Node 20/22 matrix
  to cover the >=20.10 engines floor (import attributes)
- Release: publish to npm automatically when a GitHub release is
  published (NPM_TOKEN secret, NODE_AUTH_TOKEN via registry-url)
- Lint PR: validate conventional-commit PR titles
The lock file contained pnpm-style node_modules/.pnpm link entries, so
npm ci on CI resolved commander to a broken local path and tsc failed
with 'Cannot find module commander'. Regenerate the lock with npm and
drop the stale pnpm-lock.yaml; the project is npm-only.
- add packageManager: pnpm@10.28.0 (corepack pins the toolchain)
- regenerate the lockfile as pnpm-lock.yaml, drop package-lock.json
- make scripts self-contained (build inlines the clean step) because
  pnpm does not run pre/post hooks by default; prepublishOnly now runs
  clean + tsc + tests directly
- CI and Release workflows install with pnpm (pnpm/action-setup reads
  the version from packageManager; frozen lockfile; pnpm cache)
- publishing stays on npm publish: the pnpm packer does not honor the
  negation patterns in the files field, so a pnpm publish would ship
  44 files including .d.ts and source maps instead of the intended
  18-file tarball
- README: install and from-source instructions use pnpm; engines note
  updated to >= 20.10

Verified locally: pnpm install/build/test pass (48/48); npm publish
--dry-run runs prepublishOnly end to end and packs the 18-file tarball.
@tomsun28
tomsun28 merged commit 5cdb7c7 into main Sep 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant