Automate TypeScript Refactors with Dosido

jaredly1 pts0 comments

Automate typescript refactors with dosido | Jared Forsyth.com

I'm Jared Forsyth

home<br>posts<br>projects<br>talks

Latest posts

Automate typescript refactors with dosido

2026<br>July<br>13

A Practical Comparison of AI Coding Agents

2025<br>July<br>18

Type inference that sticks

2023<br>February

What's cool about Unison?

2021<br>March

Local-first database: Hypermerge

2020<br>September<br>30

Local-first database: RxDB + PouchDB

2020<br>May<br>12

Local-first database: remoteStorage.js

2020<br>May

More...

🦋 bsky/@jaredforsyth.com<br>twitter/@jaredforsyth

@[email protected]

github/@jaredly

posts rss feed

Automate typescript refactors with dosido

July

13,

2026

typescript,<br>javascript

I don’t know about you, but my personal projects often metastasize. I start going in one direction, and after a while I’ve learned a lot about what I really want so I start a fresh implementation in a new subfolder, and along the way I’m building tools and libraries as I discover I need them. After a while it’s a tangled mess, where the production app uses maybe 30% of the code, and there are at least three reusable libraries waiting to be born, if only I could get my act together to do the cleanup.

So now I’ve finally gathered the will to do some refactoring, but why do the work by hand when I can automate the process?

I was surprised to discover that there wasn’t a ready-made cli tool for ‘move this typescript file from here to here, fixing impacted imports’. So I built that (dosido move), as well as ‘move this definition to a new/another file’ (dosido extract).

So far these are things that can be done by drag & drop in vscode; but vscode UI interactions can’t form the building blocks of other, more complex tools.

dosido decouple folder-a> folder-b> dest> takes any definitions that are used by both folder-a and folder-b (forming dependency cycles between the two folders) and moves them to dest, resolving the cycles.

dosido barrel folder> makes a barrel file for a given folder, rewriting all external imports into the folder to point at the directory path, to prepare the folder for being extracted as its own package (yes I know ‘barrel files considered harmful’ but you do actually want them at the toplevel of a library).

And then dosido workspace extract folder> can take that folder and turn it into a separate package in the monorepo, rewriting imports as necessary.

There are a few dosido diagnostic commands that are especially helpful for planning a large scale refactor, and determining what files or definitions need to be moved around in order to enable a clean reorganization. They are also quite useful to Agents.

Available wherever javascript packages are sold, and on GitHub.

npm install dosido

Comments

courtesy of

github gists

Loading comments...

Add a comment on github

dosido folder typescript automate refactors github

Related Articles