diff --git a/.gitignore b/.gitignore index 0d77166e..6d49a74a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,7 @@ !CHANGELOG.md !CONTRIBUTING.md !CODE_OF_CONDUCT.md + +# Build artifacts +site/ +.cache/ diff --git a/docs/home/quickstart.md b/docs/home/quickstart.md index 9793c6ec..704266a0 100644 --- a/docs/home/quickstart.md +++ b/docs/home/quickstart.md @@ -13,130 +13,167 @@ description: Install socx-cli, verify the setup, and run your first commands. To start using SoCX CLI, follow these steps to install, verify, and run your first commands. -## Installing SoCX CLI +## Prerequisites -???+ warning "Requirements" +Before installing SoCX CLI, ensure you have the following: - In order to be able to use SoCX, the following requirements must be met: +- **Python 3.12 or newer** - SoCX requires modern Python features +- **Package manager** - Either [`uv`](https://github.com/astral-sh/uv) (recommended) or `pip`/`pipx` +- **(Optional) Git workspace** - Access to your SoC workspace enables Git manifest and regression features with real project data +- **(Optional) Shell access** - Script plugins require executable permissions and shell access - - [ ] Python 3.12 or newer - - [ ] `pip` or [`uv`](https://github.com/astral-sh/uv) for managing environments - - [ ] (optional) access to your SoC workspace so Git manifests and regressions have - real data to operate on +## Installation -??? info "Verifying Your Installation" +Choose your preferred installation method: - Run the below commands to verify `socx` was properly installed. +===! "uv (recommended)" ```bash title="" - socx --help - socx version + uv tool install socx-cli ``` - If you see the top-level help and the current version, the CLI is ready to use. + This installs `socx` in an isolated environment managed by `uv`. -??? info "Upgrading to the Latest Version" +=== "pipx" - === "uv" + ```bash title="" + pipx install socx-cli + ``` - ```bash title="" - uv tool update socx-cli - ``` + Similar to `uv`, `pipx` installs `socx` in an isolated environment. - === "pip" +=== "pip" - ```bash title="" - pip install --upgrade socx-cli - ``` + ```bash title="" + pip install socx-cli + ``` -===! "uv" + !!! warning + Installing with `pip` may affect your global Python environment. Consider using `uv` or `pipx` instead. - ```bash title="" - uv tool install socx-cli +## Verify Installation + +Run the following commands to verify that `socx` was installed correctly: + +```bash +socx --help +socx version +``` + +If you see the top-level help menu and the current version number, the CLI is ready to use. + +## Upgrade to Latest Version + +Keep your installation up to date: + +=== "uv" + + ```bash + uv tool upgrade socx-cli + ``` + +=== "pipx" + + ```bash + pipx upgrade socx-cli ``` === "pip" - ```bash title="" - pip install socx-cli + ```bash + pip install --upgrade socx-cli ``` -## Using the CLI +## Basic Commands -=== "Git" +SoCX provides several built-in commands to help you get started. Here are the most commonly used commands: - Manage multiple git repositories at once using `socx git` +### Git Management - ```bash title="" - # Display a manifest table of all repositories under the current path - socx git mfest +Manage multiple Git repositories at once using `socx git`: - # Alternatively, display it in a one-liner format of 'ref - message, date' - socx git mfest -f ref +```bash +# Display a manifest table of all repositories under the current path +socx git mfest - # Or in json format - socx git mfest -f json +# Display in a one-liner format showing 'ref - message, date' +socx git mfest -f ref - # You can also pass a path as argument to run it from a different path - socx git mfest /project/users/foo/workspace +# Output in JSON format for scripting +socx git mfest -f json - # Relative paths are also supported - socx git mfest ../../bar/bazz - ``` +# Scan a specific directory +socx git mfest /project/users/foo/workspace -=== "Config" +# Relative paths are also supported +socx git mfest ../../bar/bazz +``` - Print, edit, debug or inspect python API of configurations +### Configuration Management - ```bash title="" - # Dump all configurations - socx config list +View, edit, and debug configuration settings: - # Dump all configurations in a pretty tree format - socx config tree +```bash +# List all configuration values +socx config list - # Dump a tree/value of a specific configuration - socx config get git.manifest.columns +# Display configurations in a pretty tree format +socx config tree - # Modify existing configurations interactively - socx config edit # will run a friendly interactive prompt +# Get a specific configuration value +socx config get git.manifest.columns - # Debug configuration values or check the loading order - socx config debug +# Edit configurations interactively in your editor +socx config edit - # Inspect settings methods and members (when using it as a python library) - socx config inspect - ``` +# Debug configuration loading and see override order +socx config debug -=== "Regression" +# Inspect settings API (when using socx as a Python library) +socx config inspect +``` - Parse and execute commands in parallel (e.g. a file of test 'run' - commands) +### Regression Testing - ```bash title="" - socx rgr run -i ./sim/regressions/doa_commands.list # file can have any or no - # extension - ``` +Run test commands in parallel: -=== "Plugins" +```bash +# Run regression tests from a command list file +socx rgr run -i ./sim/regressions/commands.list - Add any python script as a subcommand of `socx` through the power of - plugins +# Specify custom output directory +socx rgr run -i failed.log -o ./results - ```bash title="" - # add a function from a script as a subcommand (a.k.a plugin): - socx plugin add ./scripts/dv/generate_rals.py:main +# Launch the interactive terminal UI +socx rgr tui +``` - # you can also specify only a path to run the file itself (run as __main__) - socx plugin add ./scripts/dv/generate_rals.py +### Plugin Management - # or specify a module path if it is installed on your system or on your active - # virtual environment - socx plugin add my.custom.package:run_test +View plugin examples and documentation: - # show an example for using 'socx' as a library to create new scripts/plugins - socx plugin example - ``` +```bash +# Display plugin quickstart guide +socx plugin example +``` + +!!! tip + To add custom plugins, edit your configuration file. See the [Plugin Development](../user-guide/plugins.md) guide for details. + +### Global Options + +All commands support these global options: + +```bash +# Enable debug logging +socx --debug config list + +# Set logging verbosity (DEBUG, INFO, WARNING, ERROR) +socx --verbosity DEBUG rgr run + +# Run without loading user/repo configuration +socx --no-config config list +``` ## Next Steps diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md new file mode 100644 index 00000000..82651989 --- /dev/null +++ b/docs/reference/configuration.md @@ -0,0 +1,532 @@ +--- +title: Configuration Reference +description: Complete reference for all SoCX configuration options organized by category. +--- + +# Configuration Reference + +This page documents all available configuration options in SoCX, organized by category. All settings can be overridden via user config (`~/.config/socx/socx.yaml`), repository config (`.socx.yaml`), or environment variables. + +## CLI Configuration + +Controls command-line interface behavior and global options. + +```yaml +cli: + # Enable debug logging (also: SOCX_CLI__DEBUG=1) + debug: false + + # Load user/repository configuration files + configure: true + + # Logging verbosity level + # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL + verbosity: INFO + + # Context settings for Click commands + context_settings: + help_option_names: + - -h + - --help + + # Option panel configuration for help display + option-panels: + - name: Options + options: + - --help + - --configure/--no-configure + - --debug + - --verbosity +``` + +### Environment Variables + +- `SOCX_CLI__DEBUG=1` - Enable debug mode +- `SOCX_CLI__VERBOSITY=DEBUG` - Set log level +- `SOCX_CLI__CONFIGURE=false` - Disable config loading + +## Git Configuration + +Settings for Git repository management and manifest generation. + +```yaml +git: + manifest: + # Root directory to start scanning for repositories + root: ~ + + # Paths to include (glob patterns supported) + includes: [] + + # Paths to exclude (glob patterns supported) + excludes: [] + + # Reference mapping for specific repositories + references: {} + + log: + # Git log command flags + flags: + - --graph + - --branches + - --abbrev-commit + - --date=relative + - --decorate=full + - --max-count=12 + - "--pretty=format: %C(red)%h%C(reset) %<(72,trunc)%s %C(bold blue)[%an]%C(reset) %C(yellow)%d%C(reset)%n" + + pull: + # Git pull command flags + flags: + - --tags + - --no-edit + - --autostash + + diff: + # Git diff command flags + flags: + - -M + - -C + - -B + - --ignore-blank-lines + - --default-prefix + + status: + # Git status command flags + flags: + - --short + - --branch + - --renames + - --ahead-behind + + summary: + # Output format: table, json, ref + format: table + + # Table styling + style: + headers: ~ + + table: + # Box style for table borders + box: ROUNDED + title: ~ + caption: ~ + expand: true + highlight: true + show_lines: true + show_header: true + show_footer: false + + # Columns to display in manifest table + columns: + - name: Repository + func: socx_plugins.git.utils:get_repo_name + style: bright_blue + + - name: "[green]Ahead[/] [red]Behind[/]" + func: socx_plugins.git.utils:get_ahead_behind + style: ~ + + - name: Branch / Tag + func: socx_plugins.git.utils:get_ref_name + style: yellow + + - name: Commit Hash + func: socx_plugins.git.utils:get_commit_hash + style: red + + - name: Commit Message + func: socx_plugins.git.utils:get_commit_message + style: white + + - name: Author Name + func: socx_plugins.git.utils:get_author_name + style: cyan + + - name: Author Date + func: socx_plugins.git.utils:get_author_date + style: cyan +``` + +### Environment Variables + +- `SOCX_GIT__MANIFEST__ROOT=~/workspace` - Set manifest root +- `SOCX_GIT__SUMMARY__FORMAT=json` - Set output format + +## Regression Configuration + +Settings for parallel test execution and regression automation. + +```yaml +regression: + # Working directory for regression operations + path: ~ + + # Custom test wrapper class (advanced) + # Must inherit from socx.regression.test:Test + test_cls: "socx.regression.test:Test" + + # Maximum number of tests to run concurrently + # Default: 10 + max_runs_in_parallel: 10 + + run: + input: + # Default input filename + filename: small + + # Directory containing test command files + # Supports @path and @format directives + directory: "@path @format ./assets/rgr/inputs" + + output: + # Directory for result logs (timestamped subdirs created automatically) + # Supports @path directive + directory: "@path workrun/regression" +``` + +### Environment Variables + +- `SOCX_REGRESSION__MAX_RUNS_IN_PARALLEL=20` - Set parallelism +- `SOCX_REGRESSION__RUN__INPUT__FILENAME=failed.log` - Set input file +- `SOCX_REGRESSION__RUN__OUTPUT__DIRECTORY=/tmp/results` - Set output directory + +### Parallel Execution Tuning + +| Scenario | Recommended Value | +|----------|-------------------| +| CPU-bound tests | Number of CPU cores (4-8) | +| I/O-bound tests | 2-3x CPU cores (16-24) | +| Memory-intensive tests | Conservative (5-10) | +| Quick unit tests | Aggressive (30-50) | +| CI/CD environment | Moderate (10-20) | + +## Plugin Configuration + +Plugin metadata and registration settings. + +```yaml +plugins: + # Built-in git plugin + - name: git + panel: Commands + help: Various common git command utilities to manage your environment. + command: "socx_plugins.git:cli" + enabled: true + aliases: [] + + # Built-in regression plugin + - name: rgr + panel: Commands + help: Perform various regression related actions. + command: "socx_plugins.rgr:cli" + enabled: true + aliases: [] + + # Built-in plugin management + - name: plugin + help: Add, create, inspect, and manage extension plugins. + panel: Commands + command: "socx_plugins.plugin:cli" + enabled: true + aliases: [] + + # Built-in config management + - name: config + help: Get, set, list, or modify settings configuration values. + panel: Commands + command: "socx_plugins.config:cli" + enabled: true + aliases: [] + + # Built-in convert plugin + - name: convert + help: Perform a conversion based on current configurations. + panel: Commands + command: "socx_plugins.convert:cli" + enabled: true + aliases: [] + + # Built-in version plugin + - name: version + help: Print version information and exit. + panel: Commands + command: "socx_plugins.version:version" + enabled: true + aliases: [] +``` + +### Plugin Field Reference + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | string | Yes | Command name (what users type) | +| `command` | string | No* | Python import path (e.g., `module:function`) | +| `script` | string | No* | Executable script path | +| `help` | string | No | Short description for help output | +| `panel` | string | No | Group name in help display (default: "Commands") | +| `enabled` | boolean | No | Enable/disable plugin (default: true) | +| `aliases` | list | No | Alternative command names | + +\* Either `command` or `script` must be provided, but not both. + +### Adding Custom Plugins + +#### Python Plugin Example + +```yaml +plugins: + - name: my-tool + command: "my_package.tools:cli" + help: "Custom development tool" + panel: "Custom Tools" + enabled: true +``` + +#### Script Plugin Example + +```yaml +plugins: + - name: build + script: "./scripts/build.sh" + help: "Build the project" + enabled: true +``` + +## Convert Configuration + +Settings for file conversion operations (e.g., LST to SystemVerilog). + +```yaml +convert: + lst: + # Converter class (advanced) + # Supports @symbol directive for dynamic imports + cls: "@symbol socx_plugins.convert.converter:LstConverter" + + # Source directory for input files + # Supports @path and @jinja directives + source: "@path @jinja