kinode-dao / kit

Development toolkit for Kinode OS
Apache License 2.0
11 stars 3 forks source link

kit

Toolkit for developing on Kinode OS.

Documentation in the Kinode Book; example usage here.

Installing

Install with cargo:

cargo install --git https://github.com/kinode-dao/kit --locked

Updating

To update, re-run

cargo install --git https://github.com/kinode-dao/kit --locked

or use

kit update

Usage

# Create a Rust package template (default no UI):
kit new my_package

# Build the package:
kit build my_package

# Start a fake node, by default, on port 8080:
kit boot-fake-node

# Start the package in a running node (requires a node or fake node running at, default, localhost:8080; can specify port of a localhost node with `--port` or can specify entire URL with `--url`):
kit start-package my_package

# Or build, start a node, and start a package from inside the project...
cd my_package
kit build
kit boot-fake-node
kit start-package

# Bonus: create a Python package template (it `build`s & `start-package`s just like a Rust package!):
kit new my_py_package -l python
cd my_py_package
kit build
kit start-package

# Bonus: create a Rust package template with UI (it `build`s & `start-package`s just like a Rust package!):
kit new my_package_with_ui --ui
cd my_package_with_ui
kit build
kit start-package

# Print usage

kit --help

kit boot-fake-node can also accept a --runtime-path argument that compiles the fake node binary from a local Kinode core repository. Use like (substituting path to Kinode core repo):

kit boot-fake-node --runtime-path ~/git/kinode

kit also contains tools for running tests. For details and examples, please see https://github.com/kinode-dao/core_tests.

UI Development

The simplest way to work on the UI is to use kit dev-ui which develops against a running node. Under the hood, kit dev-ui is just cd ui && npm install && npm run dev.

The UI should open on port 3000 (or next available port) and will proxy all websocket and HTTP requests to http://localhost:8080 by default. You can choose to proxy to any URL using the -u flag:

kit dev-ui my_package -u http://localhost:8081

This is the same as prepending the environment variable:

VITE_NODE_URL=http://localhost:8081 npm run dev

NodeJS (v18 or higher) and NPM are required to build and develop the UI.

The UI is written in React with Vite as the bundler + reloader.

To use npm start instead of npm run dev, use kit dev-ui --release.