Use Capitally via CLI

Add a command line tool that can be used to automate tasks outside the user interface.

Some potentially useful function to expose:

  • Importing using presets
  • Exporting
  • Adding individual transactions

Woah, interesting. I think, it would have to be packaged as an Electron app to be able to do that…

But if the commands are small, I think it’s possible to register an URI handler (like the one that opens eg. Zoom from the web) and pass some data inside it. But that would always bring back the webpage/app to the front (and very possibly open a new tab).

For sure, I plan to register such handler to enable quick importing of Capitally exports (by handling an extension if possible).

Do you have any specific scenarios you would like to handle with it?

My first thought was to periodically run a script that tells me how to rebalance my portfolio. I could export the data, copy it to a spreadsheet, etc., but if I had a command-line tool that I could use to extract some view (e.g., a breakdown by asset type), I could automate it pretty easily. Another use case I can think of is automating transaction imports.

Anyway, to work out the interaction should be headless, if you need a browser to make it work, it defeats the purpose.

I don’t know how the software is structured, I can only second-guess, I’m afraid. Let’s say that if I had to design it from scratch, I would take inspiration from BitWarden, the password manager. Despite the completely different domain, they do something similar, which is hosting user-encrypted data that is effectively handled on the user’s devices. They serve the same functionality on web, browser extension, cli, desktop & mobile apps, and there is a common SDK for all of them.

I was thinking about the simplest solution, that doesn’t need building a second client. But it’s structured in a way that would allow to do that. Maybe the only issue is that initializing the project might be pretty time and resource consuming.

But another idea already on the roadmap is to allow extending the app with JavaScript plugins. I can imagine a plugin that exposes the internal API to an external process - be it CLI - via a WebSocket or any other means.

And btw, strategies and rebalancing are definitely on the roadmap as well :slight_smile: