Skip to content

refactor(scripts): migrate JavaScript tools to TypeScript - #121005

Merged
steipete merged 11 commits into
mainfrom
steipete/typescript-script-declaration-cleanup-b5e899
Aug 9, 2026
Merged

steipete merged 11 commits into
mainfrom
steipete/typescript-script-declaration-cleanup-b5e899

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw's repository scripts were maintained as JavaScript implementations plus 255 handwritten scripts/**/*.d.mts declaration sidecars. Every script API change therefore carried a duplicate declaration tax: the runtime source and a parallel type contract could drift, and a dedicated checker, test, package command, CI gate, and changed-lane wiring were needed only to keep those copies aligned.

Why This Change Was Made

This migration makes the typed implementation the owner of each eligible script contract. Eligible scripts/*.mjs, scripts/lib/*.mjs, and necessary source-checkout subdirectory scripts now live as .mts or .ts; all 255 declaration sidecars and the 697-line declaration checker are removed together with its test and CI/check/lane wiring.

Stable documented executable paths remain thin .mjs shims that load their typed implementations. Scripts that must run directly under plain Node during install, packaging, zero-install, Docker pruning, or loader closure remain JavaScript, including the package-manager warning, bundled-plugin postinstall, Git-hook preparation, postpack, startup-memory check, production-store package inventory, changelog/docs packaging helpers, and docs listing entrypoint. The resulting diff changes 938 files with 48,082 insertions and 50,039 deletions, net -1,957 lines.

User Impact

There is no intended end-user behavior change. Contributors get one typed source of truth for script behavior and contracts, while existing documented commands and lifecycle entrypoints keep their stable executable paths.

Evidence

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 9, 2026 08:48
@steipete
steipete requested review from a team as code owners August 9, 2026 08:48
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord app: android App: android app: ios App: ios app: macos App: macos scripts Repository scripts docker Docker and sandbox tooling extensions: qa-lab extensions: diffs app: linux size: XL maintainer Maintainer-authored PR labels Aug 9, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: ec94e15eed9482717f451f83455757871c5c9193
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@steipete
steipete force-pushed the steipete/typescript-script-declaration-cleanup-b5e899 branch 3 times, most recently from beaf13b to 3842cd9 Compare August 9, 2026 12:14
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
…21005)

* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Aug 23, 2026
Upstream openclaw#121005 deleted scripts/lib/failed-trailer.mjs (migrated to .mts),
but fork-owned check-upstream-merge-delta.mjs still imported the .mjs path,
crashing the stage-init delta scan and the finish-land gate (line 926).
Inline the 15-line helper; a plain .mjs cannot import the migrated .mts.
steipete added a commit that referenced this pull request Oct 12, 2026
## What Problem This Solves

The script tree retains dormant one-off tools and CI inventory rows that its current selector already discards.

## User Impact

No user-facing OpenClaw feature or active test selection changes. The maintained `.mts` entrypoints, runtime security checks, and existing CI filter remain in place.

## Why This Change Was Made

Delete the 642-line private acceptance probe and 214-line dormant connect installer with their dedicated tests and obsolete test inventory/timing entries. The full reference graph separates package/workflow/docs/skill/config callers from test-only references. The probe has only its dedicated test/timing reference and was last changed September 13 in #146807. The connect wrapper describes itself as dormant and unactivated, has only its dedicated test/Bash inventory references, and was last changed September 27 in #159199. Neither was active this week.

Delete 265 literal rows from `ci-proof-test-inventory.mts` that the existing `isOwnerSelectedUiE2eTest` filter already excludes. This is not a change to selection policy: the filter is unchanged and its ordered effective inventory remains 4,098 entries, byte-for-byte identical. The relevant selection policy was established in `cfa5dbf12434053460c60a25ee88fc771c666921` on October 1.

Two obsolete five-line `.mjs` aliases are also removed: `check-memory-fd-repro` and `resolve-openclaw-package-candidate`. All current package, workflow, and test callers already use the maintained `.mts` entrypoints; these aliases had no inbound references and no changes since August 9 (#121005).

The same reference audit deliberately retained active orphan-looking tools and the iOS sidebar fixture consumed through `OPENCLAW_IOS_ATTENTION_FIXTURE_URL`. No protected PR-tooling closure file changed.

Net production reduction: **1,131 lines**, excluding tests and timing data.

## Best-effort tradeoffs accepted

None in live behavior. This removes entire uncalled, dormant tools, not their security checks from a maintained path; the CI change removes only rows already filtered out.

## Evidence

- Fresh-main reference graph covered 54,316 tracked files, 1,783 scripts and 25,095 edges, including package scripts, workflows/actions, docs, skills, test/runner configs and dynamic resource roots. Independent audit found no live caller or current-week activity for the four deleted tools; all five script targets are outside the 261-file executable PR-tooling closure.
- Before/after evaluation of the actual applied commit: all 265 removed rows match the unchanged filter. Ordered effective array SHA-256 stays `048bb0503adb374dbe431844df8c0acc65e0cb42cd44b24c2badea55c3b89ba9`; all three predicates match on 10,279 inputs. Ordered exports and live exempt enumeration also match.
- Focused proof: 253 tests passed, including both inventory cases, 140 macOS script cases, 33 maintained memory-FD cases, 61 maintained package-candidate/security cases, lint suppressions and the protected wrapper inventory. Three additional wrapper-extraction cases failed because the existing local install has `mdast-util-from-markdown` 2.0.3 while current main requires 2.1.0. The dependency manifest, lockfile, materializer and failing test are unchanged by this PR. Total wrapper wall time: 443.45 seconds; Vitest reported 397.90 seconds. No timeout, assertion, retry or skip was changed.
- Runtime and static cycle checks passed with zero cycles. Independent P0/P1 autoreview was scoped-clean; the applied commit has the identical stable patch ID to that reviewed cut.
- Changed-file verification passed all preceding guards, formatting, script types and all four root-test type shards. Script Knip passed with zero entries. The production/full-tree Knip scans both hit their unchanged 600-second deadlines, so the overall command is incomplete at that stage, not green. Its default remote backend did not authenticate or run checks; these are local-fallback results. Full script lint and changed-test lint passed separately. Exact-head hosted CI remains the landing gate.
- Hosted CI [run 38204018042](https://github.com/openclaw/openclaw/actions/runs/38204018042) passed at `392e950df000e7dbd095fe9447392d11af7a041c`. Final exact-head census: 177 terminal checks, 79 successful, 97 intentionally skipped, one neutral, no failures or cancellations; dependency/security review and combined CI statuses are successful. No CI reruns or green-only pushes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…#169606)

## What Problem This Solves

The script tree retains dormant one-off tools and CI inventory rows that its current selector already discards.

## User Impact

No user-facing OpenClaw feature or active test selection changes. The maintained `.mts` entrypoints, runtime security checks, and existing CI filter remain in place.

## Why This Change Was Made

Delete the 642-line private acceptance probe and 214-line dormant connect installer with their dedicated tests and obsolete test inventory/timing entries. The full reference graph separates package/workflow/docs/skill/config callers from test-only references. The probe has only its dedicated test/timing reference and was last changed September 13 in openclaw#146807. The connect wrapper describes itself as dormant and unactivated, has only its dedicated test/Bash inventory references, and was last changed September 27 in openclaw#159199. Neither was active this week.

Delete 265 literal rows from `ci-proof-test-inventory.mts` that the existing `isOwnerSelectedUiE2eTest` filter already excludes. This is not a change to selection policy: the filter is unchanged and its ordered effective inventory remains 4,098 entries, byte-for-byte identical. The relevant selection policy was established in `4544bdc0121b1d8fdc917d456015078338775fac` on October 1.

Two obsolete five-line `.mjs` aliases are also removed: `check-memory-fd-repro` and `resolve-openclaw-package-candidate`. All current package, workflow, and test callers already use the maintained `.mts` entrypoints; these aliases had no inbound references and no changes since August 9 (openclaw#121005).

The same reference audit deliberately retained active orphan-looking tools and the iOS sidebar fixture consumed through `OPENCLAW_IOS_ATTENTION_FIXTURE_URL`. No protected PR-tooling closure file changed.

Net production reduction: **1,131 lines**, excluding tests and timing data.

## Best-effort tradeoffs accepted

None in live behavior. This removes entire uncalled, dormant tools, not their security checks from a maintained path; the CI change removes only rows already filtered out.

## Evidence

- Fresh-main reference graph covered 54,316 tracked files, 1,783 scripts and 25,095 edges, including package scripts, workflows/actions, docs, skills, test/runner configs and dynamic resource roots. Independent audit found no live caller or current-week activity for the four deleted tools; all five script targets are outside the 261-file executable PR-tooling closure.
- Before/after evaluation of the actual applied commit: all 265 removed rows match the unchanged filter. Ordered effective array SHA-256 stays `048bb0503adb374dbe431844df8c0acc65e0cb42cd44b24c2badea55c3b89ba9`; all three predicates match on 10,279 inputs. Ordered exports and live exempt enumeration also match.
- Focused proof: 253 tests passed, including both inventory cases, 140 macOS script cases, 33 maintained memory-FD cases, 61 maintained package-candidate/security cases, lint suppressions and the protected wrapper inventory. Three additional wrapper-extraction cases failed because the existing local install has `mdast-util-from-markdown` 2.0.3 while current main requires 2.1.0. The dependency manifest, lockfile, materializer and failing test are unchanged by this PR. Total wrapper wall time: 443.45 seconds; Vitest reported 397.90 seconds. No timeout, assertion, retry or skip was changed.
- Runtime and static cycle checks passed with zero cycles. Independent P0/P1 autoreview was scoped-clean; the applied commit has the identical stable patch ID to that reviewed cut.
- Changed-file verification passed all preceding guards, formatting, script types and all four root-test type shards. Script Knip passed with zero entries. The production/full-tree Knip scans both hit their unchanged 600-second deadlines, so the overall command is incomplete at that stage, not green. Its default remote backend did not authenticate or run checks; these are local-fallback results. Full script lint and changed-test lint passed separately. Exact-head hosted CI remains the landing gate.
- Hosted CI [run 38204018042](https://github.com/openclaw/openclaw/actions/runs/38204018042) passed at `392e950df000e7dbd095fe9447392d11af7a041c`. Final exact-head census: 177 terminal checks, 79 successful, 97 intentionally skipped, one neutral, no failures or cancellations; dependency/security review and combined CI statuses are successful. No CI reruns or green-only pushes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: linux app: macos App: macos channel: discord Channel integration: discord dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: diffs extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant