From eba141fabf3681419fc319e6d99cfe57949b04a3 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Wed, 8 May 2024 18:49:55 +0200 Subject: [PATCH 01/26] wip --- src/kit-dev-toolkit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit-dev-toolkit.md b/src/kit-dev-toolkit.md index e326fc4b..2032adf3 100644 --- a/src/kit-dev-toolkit.md +++ b/src/kit-dev-toolkit.md @@ -1,6 +1,6 @@ # kit -`kit` is a tool**kit** to make development on Kinode OS ergonomic. +[`kit`](https://github.com/kinode-dao/kit) is a tool**kit** to make development on Kinode OS ergonomic. ## Table of Contents From 6a61a70770adb58f58acdf30b64113daffc472be Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 10:33:01 +0200 Subject: [PATCH 02/26] wip --- .env | 1 + src/kit-dev-toolkit.md | 2 +- src/kit/install.md | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..2adb21aa --- /dev/null +++ b/.env @@ -0,0 +1 @@ +KIT_LOG_PATH=. \ No newline at end of file diff --git a/src/kit-dev-toolkit.md b/src/kit-dev-toolkit.md index 2032adf3..5265f3ba 100644 --- a/src/kit-dev-toolkit.md +++ b/src/kit-dev-toolkit.md @@ -1,6 +1,6 @@ # kit -[`kit`](https://github.com/kinode-dao/kit) is a tool**kit** to make development on Kinode OS ergonomic. +[`kit`](https://github.com/kinode-dao/kit) is a CLI tool**kit** to make development on Kinode OS ergonomic. ## Table of Contents diff --git a/src/kit/install.md b/src/kit/install.md index c71ea4f3..a3d9dca1 100644 --- a/src/kit/install.md +++ b/src/kit/install.md @@ -2,7 +2,7 @@ These documents describe some ways you can use these tools, but do not attempt to be completely exhaustive. -You are encouraged to make use of the `--help` flag, which can be used for the top-level `kit`: +You are encouraged to make use of the `--help` flag, which can be used for top-level `kit` commands: ``` $ kit --help From e6924b6e95339e5be1b49c00f5f7b87e672f8a3e Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 11:31:55 +0200 Subject: [PATCH 03/26] clarifications --- src/kit/boot-fake-node.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/kit/boot-fake-node.md b/src/kit/boot-fake-node.md index bb0021cf..e7ee88b9 100644 --- a/src/kit/boot-fake-node.md +++ b/src/kit/boot-fake-node.md @@ -19,7 +19,7 @@ For example, to start two fake nodes, `fake.os` and `fake2.os`: kit boot-fake-node # In a new terminal -kit boot-fake-node -h /tmp/kinode-fake-node-2 -p 8081 -f fake2.os +kit boot-fake-node --home /tmp/kinode-fake-node-2 -p 8081 --fake-node-name fake2.os # Send a message from fake2.os to fake.os # In the terminal of fake2.os: @@ -34,6 +34,7 @@ Fake nodes make development easier. A fake node is not connected to the network, but otherwise behaves the same as a live node. Fake nodes are connected to each other on your local machine through a network router that passes messages between them. Fake nodes also clean up after themselves, so you don't have to worry about state from a previous iterations messing up the current one. +If you wish to persist a state of a fake node between boots, you can do so with `--persist`. Thus, fake nodes are an excellent testing ground during development for fast iteration. There are some cases where fake nodes are not appropriate. @@ -43,7 +44,7 @@ Though this lack of connectivity makes them easy to spin up and throw away, the ## Arguments ``` -$ kit f --help +$ kit boot-fake-node --help Boot a fake node for development Usage: kit boot-fake-node [OPTIONS] @@ -79,7 +80,9 @@ Options: ### `--runtime-path` -Pass to run a local binary or build a local Kinode core repo and use the resulting binary, e.g. +short: `-r` + +Pass to boot a fake node from a local binary or build a local Kinode core repo and use the resulting binary, e.g. ``` kit boot-fake-node --runtime-path ~/git/kinode @@ -91,19 +94,27 @@ Overrides `--version`. ### `--version` +short: `-v` + Fetch and run a specific version of the binary; defaults to most recent version (here, `0.5.0`). Overridden by `--runtime-path`. ### `--port` +short: `-p` + Run the fake node on this port; defaults to `8080`. ### `--home` +short: `-h` + Path to place fake node home directory at; defaults to `/tmp/kinode-fake-node`. ### `--fake-node-name` +short: `-f` + The name of the fake node; defaults to `fake.os`. ### `--network-router-port` @@ -129,7 +140,7 @@ The password of the fake node; defaults to `secret`. ### `--release` -If `--runtime-path` is given, build the runtime for release; default is debug. +If `--runtime-path` is given, build the runtime for release; default is debug. The tradeoffs between the release and default version are described [here](https://doc.rust-lang.org/book/ch01-03-hello-cargo.html?highlight=release#building-for-release). ### `--verbosity` From 913aa28fa109702d233859f4f438ccad4109c877 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 12:36:33 +0200 Subject: [PATCH 04/26] kit new --- src/kit/boot-fake-node.md | 3 ++- src/kit/new.md | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/kit/boot-fake-node.md b/src/kit/boot-fake-node.md index e7ee88b9..27b70a65 100644 --- a/src/kit/boot-fake-node.md +++ b/src/kit/boot-fake-node.md @@ -140,7 +140,8 @@ The password of the fake node; defaults to `secret`. ### `--release` -If `--runtime-path` is given, build the runtime for release; default is debug. The tradeoffs between the release and default version are described [here](https://doc.rust-lang.org/book/ch01-03-hello-cargo.html?highlight=release#building-for-release). +If `--runtime-path` is given, build the runtime for release; default is debug. +The tradeoffs between the release and default version are described [here](https://doc.rust-lang.org/book/ch01-03-hello-cargo.html?highlight=release#building-for-release). ### `--verbosity` diff --git a/src/kit/new.md b/src/kit/new.md index 5c98476d..3fa3d79a 100644 --- a/src/kit/new.md +++ b/src/kit/new.md @@ -18,20 +18,20 @@ kit new my_rust_chat kit new my_rust_chat_with_ui --ui # Create fibonacci in python -kit new my_py_fib -l python -t fibonacci +kit new my_py_fib --language python --template fibonacci ``` ## Discussion You can create a variety of templates using `kit new`. Currently, three languages are supported: `rust` (the default), `python`, and `javascript`. -Two templates are currently supported: `chat`, a simple chat application, and `fibonacci`, which computes Fibonacci numbers. +Two templates are currently supported: `chat`, a simple chat application; and `fibonacci`, which computes Fibonacci numbers. In addition, some subset of these templates also have a UI-enabled version. -The following table describes the matrix of ["Exists/Has UI-enabled version"](#existshas-ui-enabled-vesion) for each template/language combination: - ### Exists/Has UI-enabled vesion +The following table describes specifies whether a template "Exists/Has UI-enabled version" for each language/template combination: + Language | `chat` | `echo` | `fibonacci` | `file_transfer` ------------ | ------- | ------ | ----------- | --------------- `rust` | yes/yes | yes/no | yes/no | yes/no @@ -41,7 +41,7 @@ Language | `chat` | `echo` | `fibonacci` | `file_transfer` ## Arguments ``` -$ kit n --help +$ kit new --help Create a Kinode template package Usage: kit new [OPTIONS] @@ -60,8 +60,8 @@ Options: ### Positional arg: `DIR` -Where to create the template package. -The package name is set to this by default if not supplied by `--package`. +Directory where to create the template package. +By default the package name is set to the name specified here, if not supplied by `--package`. ### `--package` @@ -76,12 +76,12 @@ Must be URL-safe. ### `--language` Template language; defaults to `rust`. -Currently support `rust`, `python`, and `javascript`. +Currently supports `rust`, `python`, and `javascript`. ### `--template` Which template to create; defaults to `chat`. -Currently have `chat`, a simple chat application, `echo`, an application that prints and responds with the received message, and `fibonacci`, a naive fibonacci-number-computer. +Currently have `chat`, a simple chat application; `echo`, an application that prints and responds with the received message; and `fibonacci`, a naive fibonacci-number-computer. ### `--ui` From 42befa9d3bbc7659fba3480d91d3ebd652cd7e43 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 13:10:29 +0200 Subject: [PATCH 05/26] kit build --- src/kit/build.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/kit/build.md b/src/kit/build.md index 0cbf2e73..4a3bb718 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -23,15 +23,16 @@ Currently, `rs`, `py`, and `js` are supported, corresponding to processes writte Note that a package may have more than one process and those processes need not be written in the same language. After compiling each process, it places the output `.wasm` binaries within the `pkg/` directory at the top-level of the given package directory. -The `pkg/` directory is the one that is zipped and injected into the node by [`kit start-package`](./start-package.md). -Thus, after `build`ing, the package is ready for `start-package`. - -`kit build` also builds the UI if found in `ui/`. -There must exist a `ui/package.json` file with `scripts` defined like: -``` -"build": "tsc && vite build", -"copy": "mkdir -p ../pkg/ui && rm -rf ../pkg/ui/* && cp -r dist/* ../pkg/ui/", -"build:copy": "npm run build && npm run copy", +The `pkg/` directory should then be zipped and injected into the node with [`kit start-package`](./start-package.md). + +`kit build` also builds the UI if it is found in `pkg/ui/`. +There must exist a `ui/package.json` file with a `scripts` object containing the following arguments: +```json +"scripts": { + "build": "tsc && vite build", + "copy": "mkdir -p ../pkg/ui && rm -rf ../pkg/ui/* && cp -r dist/* ../pkg/ui/", + "build:copy": "npm run build && npm run copy", +} ``` Additional UI dev info can be found [here](../apis/frontend_development.md). @@ -40,7 +41,7 @@ To both `build` and `start-package` in one command, use `kit build-start-package ## Arguments ``` -$ kit b --help +$ kit build --help Build a Kinode package Usage: kit build [OPTIONS] [DIR] From 83e631b34a589f1b7428e73982be1190b2003fe2 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 14:34:43 +0200 Subject: [PATCH 06/26] kit build patch --- src/kit/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/build.md b/src/kit/build.md index 4a3bb718..07320dc4 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -12,7 +12,7 @@ or kit build ``` -`kit build` builds each process in the package and places the `.wasm` binaries into the `pkg/` directory for installation. +`kit build` builds each process in the package and places the `.wasm` binaries into the `pkg/` directory for installation with [`kit start-package`](./start-package.md). It automatically detects what language each process is, and builds it appropriately (from amongst the supported `rust`, `python`, and `javascript`). ## Discussion From 0ec3183e75a5b8a6f115bbe2179fa51d7bb3e131 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 14:48:39 +0200 Subject: [PATCH 07/26] kit build add directory tree --- src/kit/build.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/kit/build.md b/src/kit/build.md index 07320dc4..8dc860ba 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -23,7 +23,25 @@ Currently, `rs`, `py`, and `js` are supported, corresponding to processes writte Note that a package may have more than one process and those processes need not be written in the same language. After compiling each process, it places the output `.wasm` binaries within the `pkg/` directory at the top-level of the given package directory. -The `pkg/` directory should then be zipped and injected into the node with [`kit start-package`](./start-package.md). +Here is an example of what a folder structure can look like after using `kit build`: + +``` +rustchat +├── Cargo.lock +├── Cargo.toml +├── metadata.json +├── pkg +│ ├── manifest.json +│ ├── rustchat.wasm +│ ├── scripts.json +│ └── send.wasm +├── rustchat +│ └── ... +└── send + └── ... +``` + +The `pkg/` directory can then be zipped and injected into the node with [`kit start-package`](./start-package.md). `kit build` also builds the UI if it is found in `pkg/ui/`. There must exist a `ui/package.json` file with a `scripts` object containing the following arguments: From da1e57f62ad857766be8451bc1875b1db3feb11b Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 15:00:40 +0200 Subject: [PATCH 08/26] kit start-package --- src/kit/start-package.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kit/start-package.md b/src/kit/start-package.md index 42f0f756..fca5ebc3 100644 --- a/src/kit/start-package.md +++ b/src/kit/start-package.md @@ -1,6 +1,6 @@ # `kit start-package` -`kit start-package` installs and starts the indicated package directory (or current working directory) on the given Kinode, e.g., +`kit start-package` installs and starts the indicated package directory (or current working directory) on a given Kinode (at localhost:8080 by default), e.g., ``` kit start-package foo @@ -16,15 +16,15 @@ kit start-package `kit start-package` injects a built package into the given node and starts it. `start-package` is designed to be used after a package has been built with [`kit build`](./build.md). -Specifically, it first zips and injects the `pkg/` directory within the given package directory, which contains metadata about the package for the node as well as the `.wasm` binaries for each process. -Then it injects a message to the node to start the package. +The `pkg/` directory contains metadata about the package for the node as well as the `.wasm` binaries for each process. +So `kit start-package` first zips the `pkg/` directory (located in the package directory given in the argument), and then it injects a message to the node to start the package. To both `build` and `start-package` in one command, use `kit build-start-package`. ## Arguments ``` -$ kit s --help +$ kit start-package --help Start a built Kinode process Usage: kit start-package [OPTIONS] [DIR] From 7fbca1bc78868933193de2fee8f9329c7b450fde Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 15:15:31 +0200 Subject: [PATCH 09/26] kit remove-package --- src/kit/remove-package.md | 20 ++++++++------------ src/kit/start-package.md | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/kit/remove-package.md b/src/kit/remove-package.md index 14eb4a45..6386d055 100644 --- a/src/kit/remove-package.md +++ b/src/kit/remove-package.md @@ -1,9 +1,6 @@ # `kit remove-package` -`kit remove-package` removes an installed package from the given node. -If passed an optional positional argument `DIR`, the path to a package directory, the `metadata.json` therein is parsed and that package is removed from the node. -If no arguments are provided, the same process happens for the current working directory. -Alternatively, a `--package` and `--publisher` can be provided as arguments, and that package will be removed. +`kit remove-package` removes an installed package from a given node (defaults to `localhost:8080`). For example, ``` @@ -18,15 +15,14 @@ kit remove-package -package foo --publisher template.os ## Discussion -`kit start-package` injects a built package into the given node and starts it. -`start-package` is designed to be used after a package has been built with [`kit build`](./build.md). -Specifically, it first zips and injects the `pkg/` directory within the given package directory, which contains metadata about the package for the node as well as the `.wasm` binaries for each process. -Then it injects a message to the node to start the package. +If passed an optional positional argument `DIR` (the path to a package directory), the `metadata.json` therein is parsed and that package is removed from the node. +If no arguments are provided, the same process happens for the current working directory. +Alternatively, a `--package` and `--publisher` can be provided as arguments, and that package will be removed. ## Arguments ``` -$ kit r --help +$ kit remove-package --help Remove a running package from a node Usage: kit remove-package [OPTIONS] [DIR] @@ -44,15 +40,15 @@ Options: ### Optional positional arg: `DIR` -The package directory to install and start on the node; defaults to current working directory. +The package directory to be removed from the node; defaults to current working directory. ### `--package` -The package name of the package to be removed; default is derived from `DIR`. +The package name of the package to be removed; default is derived from `metadata.json` in `DIR`. ### `--publisher` -The publisher of the package to be removed; default is derived from `DIR`. +The publisher of the package to be removed; default is derived from `metadata.json` in `DIR`. ### `--port` diff --git a/src/kit/start-package.md b/src/kit/start-package.md index fca5ebc3..aab6ed26 100644 --- a/src/kit/start-package.md +++ b/src/kit/start-package.md @@ -1,6 +1,6 @@ # `kit start-package` -`kit start-package` installs and starts the indicated package directory (or current working directory) on a given Kinode (at localhost:8080 by default), e.g., +`kit start-package` installs and starts the indicated package directory (or current working directory) on a given Kinode (at `localhost:8080` by default), e.g., ``` kit start-package foo From 538d057eb447a0d9e529ad3d23764e75a424e921 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 15:18:18 +0200 Subject: [PATCH 10/26] kit remove-package fix --- src/kit/remove-package.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/remove-package.md b/src/kit/remove-package.md index 6386d055..3a4d49e3 100644 --- a/src/kit/remove-package.md +++ b/src/kit/remove-package.md @@ -15,7 +15,7 @@ kit remove-package -package foo --publisher template.os ## Discussion -If passed an optional positional argument `DIR` (the path to a package directory), the `metadata.json` therein is parsed and that package is removed from the node. +If passed an optional positional argument `DIR` (the path to a package directory), the `metadata.json` therein is parsed to get the `packageID` and that package is removed from the node. If no arguments are provided, the same process happens for the current working directory. Alternatively, a `--package` and `--publisher` can be provided as arguments, and that package will be removed. From 4aff05a95fcab1b62b79ed131c46be7edf0e42ed Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 15:22:35 +0200 Subject: [PATCH 11/26] kit dev-ui --- src/kit/dev-ui.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/dev-ui.md b/src/kit/dev-ui.md index 3a7784f5..c47ed631 100644 --- a/src/kit/dev-ui.md +++ b/src/kit/dev-ui.md @@ -15,7 +15,7 @@ kit dev-ui ## Arguments ``` -$ kit d --help +$ kit dev-ui --help Start the web UI development server with hot reloading (same as `cd ui && npm i && npm start`) Usage: kit dev-ui [OPTIONS] [DIR] From eb367d0de24cb763fadb93c00d55e6a0cddc9ca9 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 16:06:47 +0200 Subject: [PATCH 12/26] revert a given node -> the given node --- src/kit/remove-package.md | 2 +- src/kit/start-package.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kit/remove-package.md b/src/kit/remove-package.md index 3a4d49e3..7c4360a5 100644 --- a/src/kit/remove-package.md +++ b/src/kit/remove-package.md @@ -1,6 +1,6 @@ # `kit remove-package` -`kit remove-package` removes an installed package from a given node (defaults to `localhost:8080`). +`kit remove-package` removes an installed package from the given node (defaults to `localhost:8080`). For example, ``` diff --git a/src/kit/start-package.md b/src/kit/start-package.md index aab6ed26..73a01b2e 100644 --- a/src/kit/start-package.md +++ b/src/kit/start-package.md @@ -1,6 +1,6 @@ # `kit start-package` -`kit start-package` installs and starts the indicated package directory (or current working directory) on a given Kinode (at `localhost:8080` by default), e.g., +`kit start-package` installs and starts the indicated package directory (or current working directory) on the given Kinode (at `localhost:8080` by default), e.g., ``` kit start-package foo From 0102e37fb9923baabc6df937eba46a435678b69f Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 16:11:43 +0200 Subject: [PATCH 13/26] kit inject-message --- src/kit/inject-message.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kit/inject-message.md b/src/kit/inject-message.md index 3faf6d50..fc2413ac 100644 --- a/src/kit/inject-message.md +++ b/src/kit/inject-message.md @@ -22,7 +22,7 @@ To instead "fire and forget" a message and exit immediately, use the [`--non-blo ## Arguments ``` -$ kit i --help +$ kit inject-message --help Inject a message to a running Kinode Usage: kit inject-message [OPTIONS] @@ -68,7 +68,8 @@ E.g. kit inject-message foo:foo:template.os '{"Send": {"target": "fake.os", "message": "wow, it works!"}}' --node fake2.os ``` -sent to the port running `fake.os` will forward the message from `fake.os`s HTTP server to `fake2@foo:foo:template.os`. +sent to the port running `fake.os`. +It will forward the message from `fake.os`s HTTP server to `fake2@foo:foo:template.os`. ### `--blob` From 22932cd5240d121d778305a4009f7823d20c322f Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 17:53:21 +0200 Subject: [PATCH 14/26] kit run-tests wip --- src/kit/run-tests.md | 164 +++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 100 deletions(-) diff --git a/src/kit/run-tests.md b/src/kit/run-tests.md index fa80d6c4..9ed73a28 100644 --- a/src/kit/run-tests.md +++ b/src/kit/run-tests.md @@ -21,7 +21,7 @@ Each test is run in a fresh environment of one or more fake nodes. A test can setup one or more packages before running a series of test packages. Each test package is [a single-process package that accepts and responds with certain messages](#test-package-format). -Tests are orchestrated from the outside of the node by `kit run-tests` and run on the inside of the node by the `tester` core package. +Tests are orchestrated from the outside of the node by `kit run-tests` and run on the inside of the node by the [`tester`](https://github.com/kinode-dao/kinode/tree/main/kinode/packages/tester) core package. For a given test, the `tester` package runs the specified test packages in order. Each test package must respond to the `tester` package with a `Pass` or `Fail`. The `tester` package stops on the first `Fail`, or responds with a `Pass` if all tests `Pass`. @@ -30,7 +30,7 @@ If a given test `Pass`es, the next test in the series is run. ## Arguments ``` -$ kit t --help +$ kit run-tests --help Run Kinode tests Usage: kit run-tests [PATH] @@ -49,111 +49,21 @@ Path to [`.toml`](https://toml.io/en/) file specifying tests to run; defaults to ## `tests.toml` The testing protocol is specified by a `.toml` file. -Consider the following example, from [core tests](): +We will be referring to `tests.toml` as an example, from [core tests](). -```toml -runtime = { FetchVersion = "latest" } -runtime_build_release = true - - -[[tests]] -setup_package_paths = ["chat"] -test_packages = [ - { path = "chat_test", "grant_capabilities" = ["chat:chat:template.os"] }, - { path = "key_value_test", grant_capabilities = ["kv:distro:sys"] }, - { path = "sqlite_test", grant_capabilities = ["sqlite:distro:sys"] }, -] -timeout_secs = 5 -# Plan to include defects = Latency, Dropping, ..., All -network_router = { port = 9001, defects = "None" } - -[[tests.nodes]] -port = 8080 -home = "home/first" -fake_node_name = "first.os" -is_testnet = true -runtime_verbosity = 0 - -[[tests.nodes]] -port = 8081 -home = "home/second" -fake_node_name = "second.os" -is_testnet = true -runtime_verbosity = 0 - - -[[tests]] -setup_package_paths = [] -test_packages = [ - { path = "key_value_test", grant_capabilities = ["kv:distro:sys"] } -] -mute_package_build = true -timeout_secs = 5 -network_router = { port = 9001, defects = "None" } - -[[tests.nodes]] -port = 8080 -home = "home/first" -fake_node_name = "first.os" -is_testnet = true -runtime_verbosity = 0 -``` - -which has the directory structure - -```bash -core_tests -├── chat -│   ├── metadata.json -│   ├── chat -│   │   ├── Cargo.toml -│   │   └── src -│   │   └── lib.rs -│   └── pkg -│   └── manifest.json -├── chat_test -│   ├── metadata.json -│   ├── chat_test -│   │   ├── Cargo.toml -│   │   └── src -│   │   ├── lib.rs -│   │   └── tester_types.rs -│   └── pkg -│   └── manifest.json -├── key_value_test -│   ├── metadata.json -│   ├── key_value_test -│   │   ├── Cargo.toml -│   │   └── src -│   │   ├── lib.rs -│   │   └── tester_types.rs -│   └── pkg -│   └── manifest.json -├── sqlite_test -│   ├── metadata.json -│   ├── pkg -│   │   └── manifest.json -│   └── sqlite_test -│   ├── Cargo.toml -│   └── src -│   ├── lib.rs -│   └── tester_types.rs -└── tests.toml -``` - -The top-level consists of three fields: +The top-level of `tests.toml` consists of three fields: Key | Value Type ------------------------------------------------- | ---------- [`runtime`](#runtime) | `{ FetchVersion = "" }` or `{ RepoPath = "~/path/to/repo" }` [`runtime_build_release`](#runtime_build_release) | Boolean -[`tests`](#tests) | Array of Tables +[`tests`](#tests) | [Array of Tables](https://toml.io/en/v1.0.0#array-of-tables) ### `runtime` Specify the runtime to use for the tests. Two option variants are supported. -An option variant is specified with the key of an Table. +An option variant is specified with the key (e.g. `FetchVersion`) of a `toml` [Table](https://toml.io/en/v1.0.0#table) (e.g. `{FetchVersion = "0.7.2"}`). The first, and recommended is `FetchVersion`. The value of the `FetchVersion` Table is the version number to fetch and use (or `"latest"`). @@ -163,9 +73,23 @@ The second is `RepoPath`. The value of the `RepoPath` Table is the path to a local copy of the runtime repo. Given a valid path, that repo will be compiled and used. +For example: + +```toml +runtime = { FetchVersion = "latest" } +``` + + ### `runtime_build_release` -If given `runtime = RepoPath`, whether to build the runtime as `--release` or not. +If given `runtime = RepoPath`, `runtime_build_release` decides whether to build the runtime as `--release` or not. + +For example: + +```toml +runtime_build_release = true +``` + ### `tests` @@ -176,13 +100,34 @@ That test consists of: Key | Value Type | Value Description ----------------------- | --------------- | ----------------- `setup_package_paths` | Array of Paths | Paths to packages to load into all nodes before running test -`test_packages` | Array of Tables | Table containing `path` (to test package) and `grant_capabilities` (which will be granted by test package) +`test_packages` | Array of Tables | Each Table in the Array contains `path` (to test package) and `grant_capabilities` (which will be granted by test package) `timeout_secs` | Integer > 0 | Timeout for this entire series of test packages `network_router` | Table | Table containing `port` (of network router server) and `defects` (to simulate network weather/defects; currently only `"None"` accepted) [`nodes`](#nodes) | Array of Tables | Each Table specifies configuration of one node to spin up for test Each test package is [a single-process package that accepts and responds with certain messages](#test-package-format). +For example: +```toml +[[tests]] +setup_package_paths = ["chat"] +test_packages = [ + { path = "chat_test", grant_capabilities = ["chat:chat:template.os"] }, + { path = "key_value_test", grant_capabilities = ["kv:distro:sys"] }, + { path = "sqlite_test", grant_capabilities = ["sqlite:distro:sys"] }, +] +timeout_secs = 5 +# Plan to include defects = Latency, Dropping, ..., All +network_router = { port = 9001, defects = "None" } + +[[tests.nodes]] +... + +[[tests.nodes]] +... +``` + + #### `nodes` Each test specifies one or more nodes: fake nodes that the tests will be run on. @@ -197,10 +142,29 @@ Key | Value Type | Value Description `fake_node_name` | String | Name of fake node `password` | String or Null | Password of fake node (default: `"secret"`) `rpc` | String or Null | [`wss://` URI of Ethereum RPC](../login.md#starting-the-kinode-node) -`is_testnet` | Boolean | Whether to connect to Sepolia testnet (`false` -> Optimism mainnet) +`is_testnet` | Boolean | Whether to connect to Optimism on Sepolia (`false` -> Optimism mainnet) `runtime_verbosity` | Integer >= 0 | The verbosity level to start the runtime with; higher is more verbose (default: `0`) -## Test package format +For example: + +```toml +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.os" +is_testnet = true +runtime_verbosity = 0 + +[[tests.nodes]] +port = 8081 +home = "home/second" +fake_node_name = "second.os" +is_testnet = true +runtime_verbosity = 0 +``` + + +## Test Package Interface A test package is a single-process package that accepts and responds with certain messages. Those certain messages are: From d2a06a1c8c1f510ab62f7a8023186925d10b9680 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 17:57:35 +0200 Subject: [PATCH 15/26] clarify tester_types.rs --- src/kit/run-tests.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/kit/run-tests.md b/src/kit/run-tests.md index 9ed73a28..cad489e2 100644 --- a/src/kit/run-tests.md +++ b/src/kit/run-tests.md @@ -203,6 +203,5 @@ which should be sent as a Response after the test has completed successfully, an which should be sent as a Response if the test fails. -In the Rust language, there is a helper macro for failutres in `tester_types.rs`. -That file can be found in the core `modules/tester/tester_types.rs`. -The macro is `fail!()`: it automatically sends the Response, filing out the fields, and exits. +In the Rust language, a helper macro for failures can be found in [`tester_types.rs`](https://github.com/kinode-dao/kinode/blob/main/kinode/packages/tester/tester_types.rs). +The macro is `fail!()`: it automatically sends the Response as specified above, filing out the fields, and exits. From 66efb2293bb5cced6fca7bb4dcca91a7ce91d3c0 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Thu, 9 May 2024 18:06:06 +0200 Subject: [PATCH 16/26] kit reset-cache --- src/kit/reset-cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/reset-cache.md b/src/kit/reset-cache.md index 455a8c97..ed87df5a 100644 --- a/src/kit/reset-cache.md +++ b/src/kit/reset-cache.md @@ -1,6 +1,6 @@ # `kit reset-cache` -`kit reset-cache` resets the cache `kit` writes Kinode core binaries, logs, etc. to. +The `kit reset-cache` command clears the cache where `kit` stores Kinode core binaries, logs, etc. ## Discussion From 0712e8eba616a16c0ba01853867f499770053b77 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 09:55:30 +0200 Subject: [PATCH 17/26] 4.1 apply changes --- src/kit/install.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/kit/install.md b/src/kit/install.md index a3d9dca1..7bb5ce7b 100644 --- a/src/kit/install.md +++ b/src/kit/install.md @@ -14,7 +14,7 @@ Commands: boot-fake-node Boot a fake node for development [aliases: f] build Build a Kinode package [aliases: b] build-start-package Build and start a Kinode package [aliases: bs] - dev-ui Start the web UI development server with hot reloading (same as `cd ui && npm i && npm run dev` [aliases: d] + dev-ui Start the web UI development server with hot reloading (same as `cd ui && npm i && npm run dev`) [aliases: d] inject-message Inject a message to a running Kinode [aliases: i] new Create a Kinode template package [aliases: n] remove-package Remove a running package from a node [aliases: r] @@ -56,8 +56,8 @@ You can find the source for `kit` at [https://github.com/kinode-dao/kit](https:/ ## Logging -Logs are printed to the screen and stored, by default, at `/tmp/kinode-kit-cache/logs/log.log`. -The default logging level is `info`. +Logs are printed to the terminal and stored, by default, at `/tmp/kinode-kit-cache/logs/log.log`. +The default logging level is `info`. Other logging levels are: `debug`, `warning` and `error`. These defaults can be changed by setting environment variables: @@ -65,3 +65,9 @@ Environment Variable | Description -------------------- | ----------- `KIT_LOG_PATH` | Set log path (default `/tmp/kinode-kit-cache/logs/log.log`). `RUST_LOG` | Set log level (default `info`). + +For example, in Bash: + +```bash +export RUST_LOG=info +``` From ad81af249a600b9aa2af6939148e88df7d5a38a0 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 10:17:14 +0200 Subject: [PATCH 18/26] 4.2 apply requested changes --- src/kit/boot-fake-node.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/kit/boot-fake-node.md b/src/kit/boot-fake-node.md index 27b70a65..a66a99ba 100644 --- a/src/kit/boot-fake-node.md +++ b/src/kit/boot-fake-node.md @@ -38,8 +38,8 @@ If you wish to persist a state of a fake node between boots, you can do so with Thus, fake nodes are an excellent testing ground during development for fast iteration. There are some cases where fake nodes are not appropriate. -The weakness of fake nodes is also their strength: they are not connected to the live network. -Though this lack of connectivity makes them easy to spin up and throw away, the downside is no access to services on the network, like remote LLMs. +The weakness of fake nodes is also their strength: they are not connected to the live Kinode network. +Though this lack of connectivity makes them easy to spin up and throw away, the downside is no access to services on the network which live Kinodes may provide. ## Arguments @@ -64,8 +64,6 @@ Options: The port to run the network router on (or to connect to) [default: 9001] --rpc Ethereum RPC endpoint (wss://) - --testnet - If set, use Sepolia testnet --persist If set, do not delete node home after exit --password @@ -96,7 +94,7 @@ Overrides `--version`. short: `-v` -Fetch and run a specific version of the binary; defaults to most recent version (here, `0.5.0`). +Fetch and run a specific version of the binary; defaults to most recent version. Overridden by `--runtime-path`. ### `--port` @@ -126,17 +124,25 @@ Additional fake nodes must point to the same port to connect to the fake node ne The Ethereum RPC endpoint to use, if desired. -### `--testnet` - -Connect to the Sepolia testnet rather than the Optimism mainnet. - ### `--persist` Persist the node home directory after exit, rather than cleaning it up. +Example usage: + +``` bash +kit boot-fake-node --persist --home ./my-fake-node +``` + +After shutting down the node, to run it again: + +```bash +kit boot-fake-node --home ./my-fake-node +``` + ### `--password` -The password of the fake node; defaults to `secret`. +The password of the fake node; defaults to "`secret`". ### `--release` @@ -145,4 +151,4 @@ The tradeoffs between the release and default version are described [here](https ### `--verbosity` -Set the verbosity of the node; higher is more verbose; default is `0`. +Set the verbosity of the node; higher is more verbose; default is `0`, max is `3`. From 8e7d3670c432812a5ecfbec58edbd31691d5d984 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 10:30:05 +0200 Subject: [PATCH 19/26] 4.9. add links --- src/kit/run-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/run-tests.md b/src/kit/run-tests.md index cad489e2..b1f96410 100644 --- a/src/kit/run-tests.md +++ b/src/kit/run-tests.md @@ -49,7 +49,7 @@ Path to [`.toml`](https://toml.io/en/) file specifying tests to run; defaults to ## `tests.toml` The testing protocol is specified by a `.toml` file. -We will be referring to `tests.toml` as an example, from [core tests](). +We will be referring to [`tests.toml`](https://github.com/kinode-dao/core_tests/blob/master/tests.toml) as an example, from [core tests](https://github.com/kinode-dao/core_tests). The top-level of `tests.toml` consists of three fields: From 0c05dbedd1fd0794e43651e0207d688afb3c487d Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 10:54:47 +0200 Subject: [PATCH 20/26] fix nits --- src/kit/boot-fake-node.md | 2 +- src/kit/build.md | 2 +- src/kit/inject-message.md | 8 +++----- src/kit/install.md | 2 +- src/kit/new.md | 10 +++++----- src/kit/remove-package.md | 2 +- src/kit/run-tests.md | 5 +---- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/kit/boot-fake-node.md b/src/kit/boot-fake-node.md index a66a99ba..76834a4e 100644 --- a/src/kit/boot-fake-node.md +++ b/src/kit/boot-fake-node.md @@ -34,7 +34,7 @@ Fake nodes make development easier. A fake node is not connected to the network, but otherwise behaves the same as a live node. Fake nodes are connected to each other on your local machine through a network router that passes messages between them. Fake nodes also clean up after themselves, so you don't have to worry about state from a previous iterations messing up the current one. -If you wish to persist a state of a fake node between boots, you can do so with `--persist`. +If you wish to persist the state of a fake node between boots, you can do so with `--persist`. Thus, fake nodes are an excellent testing ground during development for fast iteration. There are some cases where fake nodes are not appropriate. diff --git a/src/kit/build.md b/src/kit/build.md index 8dc860ba..2e98e133 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -23,7 +23,7 @@ Currently, `rs`, `py`, and `js` are supported, corresponding to processes writte Note that a package may have more than one process and those processes need not be written in the same language. After compiling each process, it places the output `.wasm` binaries within the `pkg/` directory at the top-level of the given package directory. -Here is an example of what a folder structure can look like after using `kit build`: +Here is an example of what a package directory will look like after using `kit build`: ``` rustchat diff --git a/src/kit/inject-message.md b/src/kit/inject-message.md index fc2413ac..75261c0a 100644 --- a/src/kit/inject-message.md +++ b/src/kit/inject-message.md @@ -62,15 +62,13 @@ Can be either localhost or remote. ### `--node` Node to target (i.e. the node portion of the address). -E.g. -```bash +E.g., the following, sent to the port running `fake.os`, will be forwarded from `fake.os`'s HTTP server to `fake2@foo:foo:template.os`: + +``` bash kit inject-message foo:foo:template.os '{"Send": {"target": "fake.os", "message": "wow, it works!"}}' --node fake2.os ``` -sent to the port running `fake.os`. -It will forward the message from `fake.os`s HTTP server to `fake2@foo:foo:template.os`. - ### `--blob` Path to file to include as `lazy_load_blob`. diff --git a/src/kit/install.md b/src/kit/install.md index 7bb5ce7b..faae4ef7 100644 --- a/src/kit/install.md +++ b/src/kit/install.md @@ -2,7 +2,7 @@ These documents describe some ways you can use these tools, but do not attempt to be completely exhaustive. -You are encouraged to make use of the `--help` flag, which can be used for top-level `kit` commands: +You are encouraged to make use of the `--help` flag, which can be used for the top-level `kit` command: ``` $ kit --help diff --git a/src/kit/new.md b/src/kit/new.md index 3fa3d79a..ae7b5b53 100644 --- a/src/kit/new.md +++ b/src/kit/new.md @@ -25,12 +25,12 @@ kit new my_py_fib --language python --template fibonacci You can create a variety of templates using `kit new`. Currently, three languages are supported: `rust` (the default), `python`, and `javascript`. -Two templates are currently supported: `chat`, a simple chat application; and `fibonacci`, which computes Fibonacci numbers. +Four templates are currently supported, as described in the [following section](./new.html#existshas-ui-enabled-version). In addition, some subset of these templates also have a UI-enabled version. -### Exists/Has UI-enabled vesion +### Exists/Has UI-enabled version -The following table describes specifies whether a template "Exists/Has UI-enabled version" for each language/template combination: +The following table specifies whether a template "Exists/Has UI-enabled version" for each language/template combination: Language | `chat` | `echo` | `fibonacci` | `file_transfer` ------------ | ------- | ------ | ----------- | --------------- @@ -60,7 +60,7 @@ Options: ### Positional arg: `DIR` -Directory where to create the template package. +Create the template package in this directory. By default the package name is set to the name specified here, if not supplied by `--package`. ### `--package` @@ -81,7 +81,7 @@ Currently supports `rust`, `python`, and `javascript`. ### `--template` Which template to create; defaults to `chat`. -Currently have `chat`, a simple chat application; `echo`, an application that prints and responds with the received message; and `fibonacci`, a naive fibonacci-number-computer. +Options are outlined in [Exists/Has UI-enabled version](./new.html#existshas-ui-enabled-version). ### `--ui` diff --git a/src/kit/remove-package.md b/src/kit/remove-package.md index 7c4360a5..f5cf9a8a 100644 --- a/src/kit/remove-package.md +++ b/src/kit/remove-package.md @@ -15,7 +15,7 @@ kit remove-package -package foo --publisher template.os ## Discussion -If passed an optional positional argument `DIR` (the path to a package directory), the `metadata.json` therein is parsed to get the `packageID` and that package is removed from the node. +If passed an optional positional argument `DIR` (the path to a package directory), the `metadata.json` therein is parsed to get the `package_id` and that package is removed from the node. If no arguments are provided, the same process happens for the current working directory. Alternatively, a `--package` and `--publisher` can be provided as arguments, and that package will be removed. diff --git a/src/kit/run-tests.md b/src/kit/run-tests.md index b1f96410..75105c9b 100644 --- a/src/kit/run-tests.md +++ b/src/kit/run-tests.md @@ -49,7 +49,7 @@ Path to [`.toml`](https://toml.io/en/) file specifying tests to run; defaults to ## `tests.toml` The testing protocol is specified by a `.toml` file. -We will be referring to [`tests.toml`](https://github.com/kinode-dao/core_tests/blob/master/tests.toml) as an example, from [core tests](https://github.com/kinode-dao/core_tests). +[`tests.toml`](https://github.com/kinode-dao/core_tests/blob/master/tests.toml), from [core tests](https://github.com/kinode-dao/core_tests), will be used as an example. The top-level of `tests.toml` consists of three fields: @@ -142,7 +142,6 @@ Key | Value Type | Value Description `fake_node_name` | String | Name of fake node `password` | String or Null | Password of fake node (default: `"secret"`) `rpc` | String or Null | [`wss://` URI of Ethereum RPC](../login.md#starting-the-kinode-node) -`is_testnet` | Boolean | Whether to connect to Optimism on Sepolia (`false` -> Optimism mainnet) `runtime_verbosity` | Integer >= 0 | The verbosity level to start the runtime with; higher is more verbose (default: `0`) For example: @@ -152,14 +151,12 @@ For example: port = 8080 home = "home/first" fake_node_name = "first.os" -is_testnet = true runtime_verbosity = 0 [[tests.nodes]] port = 8081 home = "home/second" fake_node_name = "second.os" -is_testnet = true runtime_verbosity = 0 ``` From 55453e02304620c0773023031b705cb90c88193b Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 11:48:48 +0200 Subject: [PATCH 21/26] add --no-ui option to kit build --- src/kit/build.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kit/build.md b/src/kit/build.md index 2e98e133..14a0756d 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -68,6 +68,7 @@ Arguments: [DIR] The package directory to build [default: /home/nick/git/kit] Options: + --no-ui If set, do NOT build the web UI for the process; no-op if passed with UI_ONLY --ui-only If set, build ONLY the web UI for the process -q, --quiet If set, do not print build stdout/stderr -s, --skip-deps-check If set, do not check for dependencies @@ -78,6 +79,11 @@ Options: The package directory to build; defaults to the current working directory. +### `--no-ui` + +Do not build the web UI for the process. +Does nothing if passed with `--ui-only`. + ### `--ui-only` Build ONLY the UI for a package with a UI. From d3b2e4c3bb37a8fc8c92e5ab5290dd5bb9c23137 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 12:06:38 +0200 Subject: [PATCH 22/26] add shorthand to options in all commands --- src/kit/build.md | 4 ++++ src/kit/dev-ui.md | 6 ++++++ src/kit/inject-message.md | 10 ++++++++++ src/kit/new.md | 8 ++++++++ src/kit/remove-package.md | 6 ++++++ src/kit/start-package.md | 4 ++++ 6 files changed, 38 insertions(+) diff --git a/src/kit/build.md b/src/kit/build.md index 14a0756d..295a005f 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -91,8 +91,12 @@ Otherwise, for a package with a UI, both the package and the UI will be built. ### `--quiet` +short: `-q` + Don't print the build stdout/stderr. ### `--skip-deps-check` +short: `-s` + Don't check for dependencies. diff --git a/src/kit/dev-ui.md b/src/kit/dev-ui.md index c47ed631..09896e45 100644 --- a/src/kit/dev-ui.md +++ b/src/kit/dev-ui.md @@ -36,15 +36,21 @@ The UI-enabled package directory to serve; defaults to current working directory ### `--port` +short: `-p` + For nodes running on localhost, the port of the node; defaults to `8080`. `--port` is overridden by `--url` if both are supplied. ### `--url` +short: `-u` + The URL the node is hosted at. Can be either localhost or remote. `--url` overrides `--port` if both are supplied. ### `--skip-deps-check` +short: `-s` + Don't check for dependencies. diff --git a/src/kit/inject-message.md b/src/kit/inject-message.md index 75261c0a..c1dc3d4b 100644 --- a/src/kit/inject-message.md +++ b/src/kit/inject-message.md @@ -50,17 +50,23 @@ The message body. ### `--port` +short: `-p` + For nodes running on localhost, the port of the node; defaults to `8080`. `--port` is overridden by `--url` if both are supplied. ### `--url` +short: `-u` + The URL the node is hosted at. Can be either localhost or remote. `--url` overrides `--port` if both are supplied. ### `--node` +short: `-n` + Node to target (i.e. the node portion of the address). E.g., the following, sent to the port running `fake.os`, will be forwarded from `fake.os`'s HTTP server to `fake2@foo:foo:template.os`: @@ -71,9 +77,13 @@ kit inject-message foo:foo:template.os '{"Send": {"target": "fake.os", "message" ### `--blob` +short: `-b` + Path to file to include as `lazy_load_blob`. ### `--non-block` +short: `-l` + Don't block waiting for a Response from target process. Instead, inject the message and immediately return. diff --git a/src/kit/new.md b/src/kit/new.md index ae7b5b53..4d1f9630 100644 --- a/src/kit/new.md +++ b/src/kit/new.md @@ -65,21 +65,29 @@ By default the package name is set to the name specified here, if not supplied b ### `--package` +short: `-a` + Name of the package; defaults to `DIR`. Must be URL-safe. ### `--publisher` +short: `-u` + Name of the publisher; defaults to `template.os`. Must be URL-safe. ### `--language` +short: `-l` + Template language; defaults to `rust`. Currently supports `rust`, `python`, and `javascript`. ### `--template` +short: `-t` + Which template to create; defaults to `chat`. Options are outlined in [Exists/Has UI-enabled version](./new.html#existshas-ui-enabled-version). diff --git a/src/kit/remove-package.md b/src/kit/remove-package.md index f5cf9a8a..b00bb2a8 100644 --- a/src/kit/remove-package.md +++ b/src/kit/remove-package.md @@ -44,6 +44,8 @@ The package directory to be removed from the node; defaults to current working d ### `--package` +short: `-a` + The package name of the package to be removed; default is derived from `metadata.json` in `DIR`. ### `--publisher` @@ -52,11 +54,15 @@ The publisher of the package to be removed; default is derived from `metadata.js ### `--port` +short: `-p` + For nodes running on localhost, the port of the node; defaults to `8080`. `--port` is overridden by `--url` if both are supplied. ### `--url` +short: `-u` + The URL the node is hosted at. Can be either localhost or remote. `--url` overrides `--port` if both are supplied. diff --git a/src/kit/start-package.md b/src/kit/start-package.md index 73a01b2e..ef22c1a3 100644 --- a/src/kit/start-package.md +++ b/src/kit/start-package.md @@ -44,11 +44,15 @@ The package directory to install and start on the node; defaults to current work ### `--port` +short: `-p` + For nodes running on localhost, the port of the node; defaults to `8080`. `--port` is overridden by `--url` if both are supplied. ### `--url` +short: `-u` + The URL the node is hosted at. Can be either localhost or remote. `--url` overrides `--port` if both are supplied. From cc3a2295b33e07c92f687a44c8e2af05d1bc674b Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Fri, 10 May 2024 19:00:41 +0200 Subject: [PATCH 23/26] fix nits --- .env | 1 - src/kit/install.md | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 2adb21aa..00000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -KIT_LOG_PATH=. \ No newline at end of file diff --git a/src/kit/install.md b/src/kit/install.md index faae4ef7..e4b77b86 100644 --- a/src/kit/install.md +++ b/src/kit/install.md @@ -57,7 +57,8 @@ You can find the source for `kit` at [https://github.com/kinode-dao/kit](https:/ ## Logging Logs are printed to the terminal and stored, by default, at `/tmp/kinode-kit-cache/logs/log.log`. -The default logging level is `info`. Other logging levels are: `debug`, `warning` and `error`. +The default logging level is `info`. +Other logging levels are: `debug`, `warning` and `error`. These defaults can be changed by setting environment variables: From aba44dbcf06f72cc3c28ea5871748786f15bd94e Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Mon, 13 May 2024 11:16:11 +0200 Subject: [PATCH 24/26] wip features --- src/kit/build.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/kit/build.md b/src/kit/build.md index 295a005f..ed0b7d19 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -70,8 +70,8 @@ Arguments: Options: --no-ui If set, do NOT build the web UI for the process; no-op if passed with UI_ONLY --ui-only If set, build ONLY the web UI for the process - -q, --quiet If set, do not print build stdout/stderr -s, --skip-deps-check If set, do not check for dependencies + --features Pass these comma-delimited feature flags to Rust cargo builds -h, --help Print help ``` @@ -89,14 +89,15 @@ Does nothing if passed with `--ui-only`. Build ONLY the UI for a package with a UI. Otherwise, for a package with a UI, both the package and the UI will be built. -### `--quiet` - -short: `-q` - -Don't print the build stdout/stderr. - ### `--skip-deps-check` short: `-s` Don't check for dependencies. + +### `--features` + +Build the package with the given [cargo features](https://doc.rust-lang.org/cargo/reference/features.html). + +Features can be used like shown [here](https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options). +Currently the only feature supported system-wide is `simulation-mode`. \ No newline at end of file From 4b5e83361ad2c0262be6baff8005cdb855d5e4d8 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Mon, 13 May 2024 11:18:49 +0200 Subject: [PATCH 25/26] add features to kit build --- src/kit/build.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kit/build.md b/src/kit/build.md index ed0b7d19..55d306c3 100644 --- a/src/kit/build.md +++ b/src/kit/build.md @@ -68,11 +68,11 @@ Arguments: [DIR] The package directory to build [default: /home/nick/git/kit] Options: - --no-ui If set, do NOT build the web UI for the process; no-op if passed with UI_ONLY - --ui-only If set, build ONLY the web UI for the process - -s, --skip-deps-check If set, do not check for dependencies + --no-ui If set, do NOT build the web UI for the process; no-op if passed with UI_ONLY + --ui-only If set, build ONLY the web UI for the process + -s, --skip-deps-check If set, do not check for dependencies --features Pass these comma-delimited feature flags to Rust cargo builds - -h, --help Print help + -h, --help Print help ``` ### Optional positional arg: `DIR` From 308ba12f30c2372910139d0ed706ca0a203f4fd5 Mon Sep 17 00:00:00 2001 From: jurij-jukic Date: Mon, 13 May 2024 11:20:52 +0200 Subject: [PATCH 26/26] app descriptors in kit new --- src/kit/new.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kit/new.md b/src/kit/new.md index 4d1f9630..8164c1bd 100644 --- a/src/kit/new.md +++ b/src/kit/new.md @@ -28,7 +28,7 @@ Currently, three languages are supported: `rust` (the default), `python`, and `j Four templates are currently supported, as described in the [following section](./new.html#existshas-ui-enabled-version). In addition, some subset of these templates also have a UI-enabled version. -### Exists/Has UI-enabled version +### Exists/Has UI-enabled Version The following table specifies whether a template "Exists/Has UI-enabled version" for each language/template combination: @@ -38,6 +38,13 @@ Language | `chat` | `echo` | `fibonacci` | `file_transfer` `python` | yes/no | yes/no | yes/no | no/no `javascript` | yes/no | yes/no | yes/no | no/no +Brief description of each template: + +- `chat`: A simple chat app. +- `echo`: Echos back any message it receives. +- `fibonacci`: Computes the n-th Fibonacci number. +- `file_transfer`: Allows for file transfers between nodes. + ## Arguments ```