-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: replace string registry with enum and update related logic #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| ## General | ||
|
|
||
| Always prefer `cargo clippy` over cargo check | ||
| Always format the code with `cargo fmt` and run the test suite with `cargo test` before finalizing | ||
| Always prefer `cargo add` over manually editing Cargo.toml | ||
| Always prefer `cargo clippy` over cargo check. | ||
|
|
||
| Always format the code with `cargo fmt` and run the test suite with `cargo test` before finalizing if any rust code was | ||
| touched. | ||
|
|
||
| Always prefer `cargo add` over manually editing `Cargo.toml`. | ||
|
|
||
| Always prefer enums over strings when there's a clear set of valid values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,104 @@ | ||
| # cf-cli | ||
| CyberFabric repositories automation tool | ||
| # CyberFabric CLI | ||
|
|
||
| Command-line interface for development and management of CyberFabric modules. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Rust toolchain with `cargo` | ||
| - A local clone of this repository | ||
|
|
||
| ### Install the CLI | ||
|
|
||
| This workspace exposes two binaries: | ||
|
|
||
| - `cyberfabric` | ||
| - `cargo-cyberfabric` for the `cargo cyberfabric ...` invocation form | ||
|
|
||
| Install both from the repository root: | ||
|
|
||
| ```bash | ||
| cargo install --path crates/cli --bin cyberfabric --bin cargo-cyberfabric | ||
| ``` | ||
|
|
||
| After installation, you can use either form: | ||
|
|
||
| ```bash | ||
| cyberfabric --help | ||
| ``` | ||
|
|
||
| ```bash | ||
| cargo cyberfabric --help | ||
| ``` | ||
|
|
||
| For local development without installing: | ||
|
|
||
| ```bash | ||
| cargo run -p cli -- --help | ||
| ``` | ||
|
|
||
| ## What the CLI can do | ||
|
|
||
| The current CLI surface is centered on CyberFabric workspace setup, configuration, code generation, and execution. | ||
|
|
||
| ### Workspace scaffolding | ||
|
|
||
| - `mod init` initializes a new CyberFabric workspace from a template | ||
| - `mod add` adds module templates such as `background-worker`, `api-db-handler`, and `rest-gateway` | ||
|
|
||
| ### Configuration management | ||
|
|
||
| - `config mod list` inspects available and configured modules | ||
| - `config mod add` and `config mod rm` manage module entries in the YAML config | ||
| - `config mod db add|edit|rm` manages module-level database settings | ||
| - `config db add|edit|rm` manages shared database server definitions | ||
|
|
||
| You need to provide the path to the configuration file with the `-c` flag. `-c config/quickstart.yml` | ||
|
|
||
| ### Build and run generated servers | ||
|
|
||
| - `build` generates a runnable Cargo project under `.cyberfabric/` and builds it based on the `-c` configuration | ||
| provided. | ||
| - `run` generates the same project and runs it. You can provide `-w` to enable watch mode and/or `--otel` to enable | ||
| OpenTelemetry. | ||
|
|
||
| ### Source inspection | ||
|
|
||
| - `docs` resolves Rust source for crates, modules, and items from the workspace, local cache, or `crates.io` | ||
|
|
||
| ### Tool bootstrap | ||
|
|
||
| - `tools` installs or upgrades `rustup`, `rustfmt`, and `clippy` | ||
|
|
||
| ### Current placeholders | ||
|
|
||
| - `lint` is declared but not implemented yet | ||
| - `test` is declared but not implemented yet | ||
|
|
||
| ## Typical usage flow | ||
|
|
||
| Create a workspace, add a module, configure it, and run it: | ||
|
|
||
| ```bash | ||
| cyberfabric mod init /tmp/cf-demo | ||
| cyberfabric mod add background-worker -p /tmp/cf-demo | ||
| cyberfabric config mod add background-worker -p /tmp/cf-demo -c /tmp/cf-demo/config/quickstart.yml | ||
| cyberfabric run -p /tmp/cf-demo -c /tmp/cf-demo/config/quickstart.yml | ||
| ``` | ||
|
|
||
| The `-p` is to specify the path. If you don't provide it, the default will be the current directory. | ||
|
|
||
| ## Command overview | ||
|
|
||
| For the full command surface, arguments, and examples, check [SKILLS.md](SKILLS.md). | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the Apache License, Version 2.0. | ||
|
|
||
| - Full license text: `LICENSE` | ||
| - License URL: <http://www.apache.org/licenses/LICENSE-2.0> | ||
|
|
||
| Unless required by applicable law or agreed to in writing, the software is distributed on an `AS IS` basis, without | ||
| warranties or conditions of any kind. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.