GithubHelp home page GithubHelp logo

Integrate with Atuin about mcfly HOT 5 OPEN

jankatins avatar jankatins commented on August 12, 2024 2
Integrate with Atuin

from mcfly.

Comments (5)

conradludgate avatar conradludgate commented on August 12, 2024 4

Hi! We'd love to colab with mcfly!

We've actually been working on our new sync engine for our history which is actually agnostic to what it stores. We haven't yet enabled it for our history. Currently it's "just" a key-value store as an MVP but it can be an anything store as it has a version and tag field on the record which makes it custom for your application.

I've been building a demo journal app into it to show off how to use it as a library, but I haven't got it finished just yet.

However, it's currently still an MVP that were beta testing so I wouldn't suggest rushing out anything using it right now

from mcfly.

jankatins avatar jankatins commented on August 12, 2024 2

Building it as a sync script would be quite hacky: it would need both atuin and mcfly run in the background (instead of one) and periodically a script would sync the atuin DB (or at least all entries from hostnames not our own) into the mcfly DB: Keeping the state in sync might be tricky, given that two syncs happen one after another, but should be doable.

I had some snooping around in the source code of both atuin and mcfly and I think the most reliable would be to mirror the sync step with using the mcfly specifc database by using their api client and reimplementing the download and upload steps on the mcfly side (or probably just the way it's saved into/ queried from the DB)...

What would be a bit of a pain is that both sides have unique things and in this case atuin misses two fields completely: old_dir and selected and mcfly needs hostname. I'm unsure how that influence the computation of the best matches (haven't understand the matching code yet :-(). On the other hand, the atuin server only sees most of this as encrypted blob, so one could just dump it all in, you just wouldn't be able to us the atuin client side anymore...

-- mcflys commands table which corresponds to the above History table, with atuins name in the comment
CREATE TABLE commands( 
id INTEGER PRIMARY KEY AUTOINCREMENT, -- different types: int (mcfly) vs string/UUID, so "save" to sync across multiple hosts (atuin)!
cmd TEXT NOT NULL, -- command
cmd_tpl TEXT, -- missing
session_id TEXT NOT NULL, --session
when_run INTEGER NOT NULL, --timestamp
exit_code INTEGER NOT NULL, -- exit
selected INTEGER NOT NULL, --missing in atuin
dir TEXT, -- cwd
old_dir TEXT -- missing in atuin
-- hostname: missing in mcfly
); 

Assuming one would simply use the atuin server as a "sync server" (and drop all of mcflys data into the "data blob") mcfly would need to gain a new hostname field and a new primary key (e.g. a UUID or use compound PK of id+hostname). And integrate the hostname into the matching/scoring process.

No idea how the atuin server (and their maintainer) would take a different client (mis)using the server as "sync server" only.

Maybe the atuin maintainer have some idea how to integrate the two worlds: @ellie @conradludgate

(There is also https://github.com/ddworken/hishtory, written in Go, but that has even less overlap :-/)

from mcfly.

ellie avatar ellie commented on August 12, 2024 2

I'm also totally happy for McFly to use our sync server (api.atuin.sh), so long as there's some attribution!

from mcfly.

cantino avatar cantino commented on August 12, 2024

I'm open to ideas on how this would be done, but it might be best as a separate script that integrates / synchronizes the two.

from mcfly.

ellie avatar ellie commented on August 12, 2024

For some more context, might be worth skimming our latest release notes, checking out the PR introducing the new sync, and perhaps specifically the KV store which is currently the reference usage of it. Happy to discuss further!

from mcfly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.