tom_build_base
The CLI and tooling framework Tom's build tools are built on: declarative tool, command, and option definitions with workspace traversal, pipelines, and configuration loading.
Overview
`tom_build_base` is the foundation under Tom's command-line build tools. Tools declare themselves as immutable `ToolDefinition`, `CommandDefinition`, and `OptionDefinition` data, and the framework handles help generation, project and git traversal, and folder-nature detection. Multi-command tools gain pipelines, runtime macros, and persistent defines automatically, plus declarative wiring of nested external tool binaries. It also reads `buildkit.yaml` configuration, runs external processes, and renders console Markdown. Build tools such as buildkit, testkit, and the code-generation CLIs are thin users of this framework, which keeps their behaviour and help output uniform across the workspace.
What it enables
Enables Declarative CLI tools, Workspace and git traversal, Pipelines and macros, Build configuration loading.
Relationships
Standalone — no declared relationships.
Tom Build Base
Unified CLI framework for workspace traversal, tool definition, pipeline execution, and build configuration.
This package provides the foundation that Tom CLI build tools (like `buildkit`, `testkit`, `d4rtgen`, etc.) use to define commands, discover projects, and traverse directory structures.
Features
- **Declarative tool definition** — `ToolDefinition`, `CommandDefinition`, `OptionDefinition` for structured CLI tools
- **Automatic help generation** — `--help`, `help <command>`, `help <topic>` with consistent formatting
- **Built-in traversal** — Project and git traversal with folder nature detection
- **Pipelines, macros, defines** — Multi-command tools get pipelines, runtime macros, and persistent defines automatically
- **Pipeline print prefix** — `print <message>` emits one resolved message without shell execution noise
- **Nested tool wiring** — Declarative integration of external tool binaries
- **Configuration loading** — `TomBuildConfig` for reading `buildkit.yaml` and `buildkit_master.yaml`
- **YAML utilities** — `yamlToMap()`, `yamlListToList()`, `toStringList()` for converting YAML nodes
- **Cross-platform symlink API** — `MkLinkExecutor` and dcli-backed `createSymLink()` integration for tool commands
Installation
dependencies:
tom_build_base: ^2.6.0
Quick Start
import 'package:tom_build_base/tom_build_base.dart';
const myTool = ToolDefinition(
name: 'mytool',
description: 'My custom build tool',
version: '1.0.0',
mode: ToolMode.multiCommand,
commands: [
CommandDefinition(
name: 'build',
description: 'Build the project',
requiredNatures: {DartProjectFolder},
),
],
);
void main(List<String> args) async {
final runner = ToolRunner(
tool: myTool,
executors: {
'build': CallbackExecutor(
onExecute: (context, args) async {
print('Building ${context.name}');
return ItemResult.success(path: context.path, name: context.name);
},
),
},
);
final result = await runner.run(args);
exit(result.success ? 0 : 1);
}
Configuration Format
Tom build tools use a two-tier configuration pattern:
buildkit_master.yaml (workspace root)
navigation: # shared defaults for all tools
scan: .
recursive: true
exclude: [.git, build]
mytool: # tool-specific workspace defaults
verbose: false
buildkit.yaml (inside a project)
mytool:
verbose: true # overrides workspace default
Pipeline Prefixes
Pipeline commands support these execution prefixes:
- `shell <cmd>` — execute a shell command
- `shell-scan <cmd>` — execute once per traversed project
- `stdin <cmd>` — execute with multiline stdin content
- `print <msg>` — print exactly once after placeholder resolution
- `{TOOL} <cmd>` — delegate to tool command execution
Documentation
- [build_base_user_guide.md](doc/build_base_user_guide.md) — Complete user guide with API reference
- [cli_tools_navigation.md](doc/cli_tools_navigation.md) — CLI navigation options and implementation guide
License
BSD 3-Clause License — see [LICENSE](LICENSE) for details.
Author: Alexis Kyaw ([LinkedIn](https://www.linkedin.com/in/nickmeinhold/))
License
BSD 3-Clause License Copyright (c) 2024-2026, Peter Nicolai Alexis Kyaw Find me on LinkedIn under Alexis Kyaw All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.