Skip to content

Latest commit

 

History

History
248 lines (187 loc) · 10.8 KB

CONTRIBUTING.md

File metadata and controls

248 lines (187 loc) · 10.8 KB

Contributing to vgv_ai_cli

This guide covers setting up the repository and the commands you need to work on it. For what the repository holds, see the README.

Prerequisites

Requirement Why
Dart SDK ^3.14.0 The code uses Dart 3.13 syntax.
Very Good CLI ^1.5.0 The coverage run needs its pub workspace support.
jq The agent hooks parse their payloads with it.
GitHub CLI, signed in Pushing branches and opening pull requests.
Mason CLI 0.1.4 Regenerating the brick bundles.

The Dart version matters more than it looks: on 3.12 the analyze hook reports errors against this codebase's Dart 3.13 syntax, and those errors read as real ones. Fix the SDK, not the code.

Contributor setup

This repo ships a committed agent configuration in .claude/settings.json, which declares the very-good-claude-code-marketplace and enables two VGV plugins: vgv-wingspan and vgv-ai-flutter-plugin.

1. Trust the folder

Open the repo in Claude Code and accept the trust prompt. The marketplace resolves from the committed settings, so you don't need to run /plugin marketplace add.

One exception: if you already have a marketplace registered under the name very-good-claude-code-marketplace, that registration wins and the committed pin is ignored. Check that /plugin shows the GitHub source. If it shows a local directory instead, remove yours first.

2. Confirm the plugins installed, then restart

Run /plugin and check that both plugins show as enabled. Then restart the session: settings apply immediately, but hooks and MCP servers only bind at session start.

This step isn't optional bookkeeping. Wingspan normally nudges you when a companion plugin is missing, but it decides "already installed" by looking for the plugin name in .claude/settings.json, which this repo commits. If your install silently failed, nothing tells you, and the agent carries on without the hooks or quality gates.

3. Verify

Run this from packages/vgv_ai_cli:

dart pub get && dart analyze --fatal-infos --fatal-warnings lib test

Common commands

Run these from packages/vgv_ai_cli:

# Format code
dart format --set-exit-if-changed .

# Analyze code (warnings and infos are fatal)
dart analyze --fatal-infos --fatal-warnings lib test

# Run a single test file
dart run test test/src/commands/update_command_test.dart

# Run the CLI from source
dart run bin/vgv_ai.dart --help

Two suites are tagged and skipped by default:

# The generated lib/src/version.dart is in sync with pubspec.yaml
dart run test --run-skipped -t version-verify

# The real pinned plugins still resolve, parse and translate
dart run test --run-skipped -t pinned-plugins

From the repo root, after changing anything under bricks/user_config:

tool/generate_bundles.sh

CI runs the full suite with a 100% coverage gate:

very_good dart test -j 4 --coverage --min-coverage 100 --optimization

With the VGV AI Flutter plugin active, a hook blocks that command in the shell, so a coding agent runs it through the very_good_cli MCP test tool instead.

To browse a coverage report after a coverage run, generate it with lcov:

genhtml coverage/lcov.info -o coverage/
open coverage/index.html

Conventions

  • Layers. model/ holds what two or more features share, and document/ sits above it. detect/, resolve/, translate/, reconcile/ and manifest/ are the features, each importing model/ and document/ but never another feature. commands/ orchestrates them. See AGENTS.md.
  • Dart 3.13 syntax. Unnamed constructors use the new keyword — new({required this._logger}). Empty class bodies end in a semicolon.
  • Linting is very_good_analysis with public_member_api_docs off. Public classes still carry /// {@template name} doc comments.
  • No records or bare maps across a boundary. A shape that would be one becomes a class or an extension type; a map appears only at the edge that needs it, through toJson or toMap.
  • Cognitive complexity stays at or below 15 per function. Split the function rather than raising the threshold.
  • Generated files are never edited by hand: lib/src/version.dart comes from build_runner, and lib/src/templates/user_config_bundle.dart from tool/generate_bundles.sh.

Testing

  • New code needs tests: both packages keep 100% test coverage, covering the success, failure, and usage-error paths.
  • Mock with mocktail, and use MemoryFileSystem.test() for anything that touches disk.
  • Exercise a command through VgvAiCliCommandRunner.run([...]) rather than instantiating the Command, so argument parsing and the runner's error handling are covered too.

Pull requests

  • Branch off main; never commit to it directly. Name the branch <type>/<short-kebab-description>, such as feat/antigravity-hooks.
  • Commits and pull request titles follow Conventional Commits. The semantic-pull-request job in ci.yaml checks the title.
  • Fill in the pull request template and nothing more.
  • Leave every CHANGELOG.md and version bump alone. Release automation owns them.

Releases

release-please owns versions and changelogs. Every push to main opens or updates one release pull request per changed package, titled chore(<package>): vX.Y.Z, which bumps that package and writes its CHANGELOG.md. Merge one only when a release is intended; merging it tags the release and publishes the notes. When both are open, merge the vgv_ai_plugins one first.

The vgv_ai_plugins-vX.Y.Z tag starts pub_publish_plugins.yaml, which publishes vgv_ai_plugins to pub.dev. The vX.Y.Z tag starts two workflows. pub_publish.yaml publishes the CLI to pub.dev, and release_binaries.yaml compiles vgv_ai on macOS and Linux, arm64 and x64, and attaches vgv_ai-<version>-<os>-<arch>.tar.gz with a .sha256 beside each to the GitHub release. To attach binaries to a release that lacks them, run release_binaries by hand with its tag input.

Once the binaries are attached, the same workflow runs tool/update_homebrew_formula.sh against the tap and opens a chore(vgv_ai): X.Y.Z pull request there that changes only the formula's version, URLs and checksums. It requests a review from the code owners and merges by itself once approved and green, so approving it is the last step of every release: until then, Homebrew users see the update prompt but brew upgrade finds nothing.

Do not bump a version or edit a CHANGELOG.md by hand.

Breaking changes

vgv_ai writes into config files people already own, and the install manifest is the only record of what it wrote. A change to behavior can therefore strand files on someone's disk rather than just fail a test.

Open an issue or a discussion first, agree the approach there, and link it from the pull request. A breaking change that arrives as a PR with no prior discussion gets sent back.

What counts:

  • Renaming or removing a Harness value. The manifest records the owner by name and silently drops an entry it cannot resolve, so every file that harness wrote is orphaned: uninstall stops removing them and doctor stops seeing them.
  • Moving where a harness writes — its config directory, hooksRoot() or skillsRoot(). The files already written stay behind under the old path.
  • Changing a file's ChangeMode, which decides whether VGV owns a file outright or merges into one the user shares with us.
  • Changing which settings keys are written into a config the user also edits.
  • Changing the manifest format or its version.

Adding a harness is none of these: it only adds an enum value, a brick folder and a translator, and touches no existing harness.

CI

.github/workflows/ci.yaml runs on every pull request against main, and again when its title or description is edited:

Job What it checks
semantic-pull-request The pull request title is a conventional commit.
spell-check cspell over every markdown file but the brick templates, changed or not.

Add a word to words in .github/cspell.json when spell-check rejects one.

Most other jobs live in .github/workflows/vgv_ai_cli.yaml:

Job What it checks
build Format, analyze, 100% coverage, cognitive complexity.
verify-bundle tool/generate_bundles.sh produces no diff.
verify-version lib/src/version.dart matches pubspec.yaml.
verify-pins The pinned plugins still resolve, parse and translate.

That workflow is path-filtered to the two packages' lib/, test/ and pubspec.yaml, plus bricks/ and tool/. A docs-only pull request triggers none of it.

license_check.yaml is separate. It runs when a pubspec.yaml changes, and restricts dependency licenses to MIT, BSD-3-Clause, BSD-2-Clause and Apache-2.0.

Adding a harness

Teaching the CLI a coding agent it does not configure yet touches the Harness enum, the user_config brick, a translator, and four test files — five if it has hooks. See adding a harness.

Adding a plugin

Pinning a new VGV plugin is a few lines in vgvPlugins, but the plugin first has to be audited against what the parser and translators support. The add-plugin skill walks through it, and its audit_plugin.sh prints what the CLI would skip or port wrongly.

The script hard-codes what the parser reads (skills/, agents/, hooks/hooks.json, .mcp.json and .claude-plugin/plugin.json), which files it rewrites rather than copies, and how it resolves ${CLAUDE_PLUGIN_ROOT}. A pull request that changes any of these in ClaudePluginParser or the translators updates the script and the skill in the same change, or the audit starts reporting the wrong gaps.