MCPcopy Index your code
hub / github.com/YodaEmbedding/frece

github.com/YodaEmbedding/frece @v1.0.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.6 ↗ · + Follow
23 symbols 43 edges 4 files 9 documented · 39%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

License: MIT Build Status

Maintain a database sorted by frecency (frequency + recency).

Installation

Simply download the latest release and add the frece executable to PATH.

Arch Linux users may install from the AUR packages frece or frece-git.

Commands

frece provides the following subcommands:

increment    Increases an entry's count and resets its timer
init         Creates a database file from given list of entries
print        Prints list of frecency sorted entries
update       Updates a database file from given list of entries

See frece --help or the Examples section for more information.

Examples

General

Begin by creating a database:

# Create list of entries
$ echo "apple
banana
cherry" > fruits.txt

# Initialize a database using list of items
$ frece init "fruits.db" "fruits.txt"

Access entries and print out a frecency sorted list of entries:

# Access an entry
$ frece increment "fruits.db" "cherry"

# Print out frecency sorted list
$ frece print "fruits.db"

cherry
apple
banana

Furthermore, a database can be updated with new entries:

# Create another list
$ echo "apple
cherry
elderberry
grapefruit" > fruits.txt

# Update database with new list
# Optionally, purge old entries like "banana"
$ frece update "fruits.db" "fruits.txt" --purge-old

# Print out frecency sorted list (verbosely)
$ frece print "fruits.db" --verbose

frecency   count  last access date           item
0.128476       1  2019-05-17T00:49:14+00:00  cherry
0.000000       0  1970-01-01T00:00:00+00:00  apple
0.000000       0  1970-01-01T00:00:00+00:00  elderberry
0.000000       0  1970-01-01T00:00:00+00:00  grapefruit

Rofi

The following examples may be found in the examples directory:

examples/dir        Open a directory
examples/emoji      Copy an emoji to clipboard
examples/file       Open a file

For instance, examples/dir may be used as follows:

  1. Initialize/update a database in $HOME/.frece_dir.db, providing a list of paths to directories to index:

    bash SEARCH_PATHS=("$HOME" "/some/other/path") ./examples/dir_update.sh "${SEARCH_PATHS[@]}"

Tip: run this periodically via a systemd timer or cronjob to refresh the database.

  1. Open with rofi, optionally providing a list of arguments:

    bash ROFI_ARGS=(-p 'folders' -i -levenshtein-sort) ./examples/dir_rofi.sh "${ROFI_ARGS[@]}"

    This will open up a rofi menu with entries sorted by frecency:

Similarly, other examples are offered, including a rofi script to copy emojis to clipboard:

Extension points exported contracts — how you extend this code

FieldSlice (Interface)
(no doc) [1 implementers]
src/field.rs

Core symbols most depended-on inside this repo

read_db
called by 5
src/db.rs
init_db
called by 2
src/db.rs
setfield_db
called by 2
src/db.rs
write_fields
called by 2
src/db.rs
frecency
called by 1
src/field.rs
to_info_str
called by 1
src/field.rs
sort_by_data
called by 1
src/field.rs
sort_by_frecency
called by 1
src/field.rs

Shape

Function 13
Method 8
Class 1
Interface 1

Languages

Rust100%

Modules by API surface

src/field.rs11 symbols
src/db.rs10 symbols
src/main.rs1 symbols
src/args.rs1 symbols

For agents

$ claude mcp add frece \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact