Skip to content

Create API#205

Merged
zaldih merged 39 commits into
mainfrom
feat/api
Jul 29, 2025
Merged

Create API#205
zaldih merged 39 commits into
mainfrom
feat/api

Conversation

@zaldih

@zaldih zaldih commented Jul 26, 2025

Copy link
Copy Markdown
Member

WIP.

This ambitious refactor aims to decouple the CLI from the core logic of npkill, exposing the core through a simple and clean interface that can be imported and reused in other projects.

How does this affect regular users?

It doesn't. Npkill will continue to work as expected (except for a few internal improvements under the hood).

The situation before

Previously, there was no separation. Npkill was a monolith: both the search engine and the TUI were tightly coupled as a single unit.

The situation now

Internally, the project has been split into two packages: core and cli.

  • The core logic is now fully isolated from the TUI layer and exposed through a basic yet robust API.
  • This enables npkill to be imported into other applications, allowing for custom implementations, such as automated cleanup scripts or tightly controlled periodic tasks.
  • The API is based on RxJS, just like the core itself, allowing real-time control.

The CLI package remains private and internal to npkill, since there's no practical reason to reuse that part outside the main project.

Why?

  • More modular and maintainable code.
  • Greater extensibility and experimentation.
  • And more important, allow to create other things based on this package, like npkill web (in progress).

This API (and a lot of other features) will be released together with the arrival of v1.0.

Gulp was used because it was necessary to compile a go binary a long time ago. Now use tsc which also solves some problems now that npkill is exported. In the future try another transpiler.
@zaldih

zaldih commented Jul 26, 2025

Copy link
Copy Markdown
Member Author

Of course any comments or feedback on how this should be is more than welcome!

@zaldih zaldih marked this pull request as ready for review July 29, 2025 17:11
@zaldih zaldih merged commit 7e50627 into main Jul 29, 2025
18 of 19 checks passed
@zaldih zaldih deleted the feat/api branch July 29, 2025 17:13
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