Skip to content

Commit

Permalink
Write a development guide for contributing to cannoli
Browse files Browse the repository at this point in the history
  • Loading branch information
cephalization committed Oct 3, 2024
1 parent 69b1727 commit 60b35d9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 13 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.17.0
58 changes: 58 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Setting up your environment

## Pre-requisites

- nvm
- Manage node versions
- <https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating>
- obsidian
- Choose a vault you'd like to do development in
- It is recommended to create a new vault for development, that does not already have cannoli installed
- Install hot-reload plugin
- <https://github.com/pjeby/hot-reload?tab=readme-ov-file#installation>
`cd <my_obsidian_vault>/.obsidian/plugins && git clone [email protected]:pjeby/hot-reload.git`
- Make sure to enable it in obsidian once installed
- VSCode (optional)
- Any VSCode (or descendant) editor will pick up common configuration from the cannoli repo
- Code formatting settings and recommended extensions for cannoli development will appear when opening cannoli inside of one of these editors

## Building your dev environment

```bash
# navigate to your obsidian vault's plugin folder
cd <my_obsidian_vault>/.obsidian/plugins
# create a fork of this repo, then clone it
# replace the url here with your own fork's url
git clone [email protected]:DeabLabs/cannoli.git
cd cannoli
# install and use this repo's version of npm
nvm install
nvm use
# install pnpm
npm i -g pnpm
# from here on we will use pnpm exclusively
# it manages cannoli's monorepo
# lets install the dependencies next
pnpm install
# now we have all dependencies for the cannoli monorepo, and the cannoli-core and cannoli-plugin packages
# lets build the plugin so that it can be enabled in obsidian
pnpm build
# you should be able to enable and use your development version of the plugin in obsidian now!
```

## Development workflow

### Making code changes and seeing them live in obsidian

```bash
# open up a terminal inside of the cannoli monorepo root directory
# this can typically be done quickly by opening the repo in your editor and then opening a terminal
# install up to date dependencies, in case any have changed
pnpm install
# now lets kickoff the dev script
pnpm run dev
# this builds cannoli-core, cannoli-plugin, and then emits their files in the root of the monorepo
# once the files appear/update, the hot-reload plugin will immediately refresh the cannoli plugin within obsidian
# finally, any changes that occur to any file in the repo will trigger an automatic rebuild as long as the dev command continues to run
# so you can make a change to a file, save it, and see it appear in obsidian in typically less than one second
```
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@ Cannolis can be run in several ways:

![Icon](/packages/cannoli-plugin/assets/icon.png)

- Click the Cannoli ribbon icon
- Click the Cannoli ribbon icon

- If you're on a canvas file, it will be run as a cannoli
- If you're on a note with a "cannoli" property, the canvas file in that property will be run as a cannoli
- If you're on a canvas file, it will be run as a cannoli
- If you're on a note with a "cannoli" property, the canvas file in that property will be run as a cannoli

- Run the "Start/Stop cannoli" command in the command palette (functions the same as the ribbon icon)
- If a canvas file name ends with ".cno", it will have its own run command in the command palette
- Make an audio recording on a note with a "cannoli" property
- That recording will be (1) transcribed using Whisper, (2) replace the reference, and (3) trigger the cannoli defined in the property.
- Run the "Start/Stop cannoli" command in the command palette (functions the same as the ribbon icon)
- If a canvas file name ends with ".cno", it will have its own run command in the command palette
- Make an audio recording on a note with a "cannoli" property
- That recording will be (1) transcribed using Whisper, (2) replace the reference, and (3) trigger the cannoli defined in the property.

## AI providers

Cannoli currently supports the following LLM providers:
- OpenAI
- Groq
- Anthropic
- Gemini

- OpenAI
- Groq
- Anthropic
- Gemini

You can select a default provider, edit its settings individually, and override that default wherever you like.

Expand All @@ -56,7 +57,11 @@ You can change the default model in the settings, and define the model per-node

## Network use

- Cannoli makes requests to LLM provider APIs based on the setup of the cannoli being run.
- Cannoli can send HTTP requests that you define up front.
- Cannoli makes requests to LLM provider APIs based on the setup of the cannoli being run.
- Cannoli can send HTTP requests that you define up front.

## Development

See [DEVELOPMENT.md](DEVELOPMENT.md) for development instructions.

<a href='https://ko-fi.com/Z8Z1OHPFX' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

0 comments on commit 60b35d9

Please sign in to comment.