Skip to content

refactor: move config module from meta_cli to meta_core - #3

Merged
mateodelnorte merged 4 commits into
mainfrom
refactor/move-config-to-meta-core
Feb 14, 2026
Merged

mateodelnorte merged 4 commits into
mainfrom
refactor/move-config-to-meta-core

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Move the config module (JSON/YAML parsing, project structs, meta tree walking) from meta_cli to meta_core
  • This fixes the inverted dependency where meta_git_lib, meta_rust_cli, and meta_mcp depended on meta_cli just for config parsing
  • Replace deprecated serde_yaml with maintained fork serde_yml
  • Normalize path separators in check_orphan_status for Windows compatibility

Merge order

Merge this PR first — all other repos in this coordinated refactor depend on it:

  • harmony-labs/meta_cli — refactor/move-config-to-meta-core
  • harmony-labs/meta_git_lib — refactor/move-config-to-meta-core
  • harmony-labs/meta_git_cli — refactor/move-config-to-meta-core
  • harmony-labs/meta_mcp — refactor/move-config-to-meta-core
  • harmony-labs/meta_rust_cli — refactor/move-config-to-meta-core

Test plan

  • cargo build --workspace passes
  • cargo test --workspace passes
  • bats tests/git.bats — 51/51 pass
  • bats tests/plugin_install.bats — 15/15 pass
  • grep -r "meta_cli::config" --include="*.rs" returns no matches

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Add support for discovering and parsing .meta configuration in JSON and YAML
    • Introduce nested configuration traversal, project mapping, deterministic ordering, and orphan detection
    • Add configurable defaults for meta processing and tree traversal options
  • Chores

    • Update CI and formatting workflows to operate within a workspace context and run tooling per-project

Config (parse JSON/YAML, normalize structs, walk meta trees) is pure
library code that belongs in the shared foundation crate. This fixes
the inverted dependency where meta_git_lib, meta_rust_cli, and meta_mcp
depended on meta_cli just for config parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 13, 2026 •

Copy link
Copy Markdown

Walkthrough

Adds dependency serde_yaml_ng, introduces a new public config module for discovering, parsing, normalizing, and traversing nested .meta configuration files (with orphan detection and cycle prevention), exposes it in the crate root, and updates CI/format workflows to operate inside a meta_core workspace.

Changes

Cohort / File(s) Summary
Dependency Addition
Cargo.toml
Added dependency serde_yaml_ng = "0.10" under [dependencies].
Configuration Module
src/config.rs, src/lib.rs
New public config module (pub mod config;) and a large src/config.rs implementing types and functions for meta config handling: ProjectEntry, ProjectInfo, MetaDefaults, MetaConfig, ConfigFormat, MetaTreeNode, OrphanWarning; discovery/parsing (find_meta_config_in, find_meta_config, parse_meta_config, load_meta_defaults), tree traversal (walk_meta_tree, flatten_meta_tree, build_project_map), parent/orphan checks, cycle handling, normalization, and tests.
CI / Formatting Workflows
.github/workflows/auto-format.yml, .github/workflows/ci.yml
Workflow adjustments to operate on a meta_core subdirectory: checkout into meta_core, create workspace Cargo.toml with meta_core member, run cargo fmt/tests/clippy with working-directory: meta_core, and adapt caching/commit/push steps to that subdirectory.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User as Caller
participant FS as FileSystem
participant Parser as ConfigParser
participant Tree as TreeBuilder
User->>FS: find_meta_config_in / find_meta_config (search for .meta/.meta.yml etc.)
FS-->>User: config path + format
User->>Parser: parse_meta_config(path)
Parser-->>User: Vec, ignore list
User->>Tree: walk_meta_tree(start_dir, max_depth)
Tree-->>User: Vec
User->>Tree: build_project_map(nodes, base_dir, prefix)
Tree-->>User: HashMap<name, (PathBuf, ProjectInfo)>

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I sniffed the roots and read each file,

I mapped the branches, mile by mile,
Avoided loops and found the stray,
I hopped through YAML on my way,
Now meta paths are set to smile.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request: moving the config module from meta_cli to meta_core, which is the primary change reflected in the file summaries.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/move-config-to-meta-core

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Cargo.toml (1)

9-15: ⚠️ Potential issue | 🟠 Major

Consider replacing serde_yaml with an actively maintained alternative.

The crate is deprecated and no longer maintained as of March 2024. While version 0.9.x is not affected by known security advisories (the DoS issue from RUSTSEC-2018-0005 was patched in 0.8.4+), using an unmaintained dependency introduces long-term maintenance risk. Evaluate switching to serde_yml or another maintained YAML serialization library.

🤖 Fix all issues with AI agents
In `@src/config.rs`:
- Around line 361-384: In check_orphan_status, normalize the path produced from
meta_dir.strip_prefix(parent_meta_dir) (the relative_str used for comparison
against flat_paths) to use forward slashes so Windows backslashes won't mismatch
the '/'-separated entries produced by flatten_meta_tree; update the code that
computes relative_str (or derive a new normalized_relative string) to join the
Path components with "/" (or replace '\' with '/') before the
flat_paths.iter().any(...) comparison so tracked repos are detected correctly
and the suggested_key logic remains unchanged.

Comment thread src/config.rs
…paths

Address CodeRabbit review feedback:
- Replace deprecated serde_yaml (unmaintained since March 2024) with
  serde_yml, a maintained fork with compatible API
- Normalize path separators in check_orphan_status to use forward
  slashes, preventing false orphan detection on Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mateodelnorte

Copy link
Copy Markdown
Contributor Author

Fixed the CodeRabbit review feedback in 6b82965:

  • serde_yaml → serde_yml: Replaced deprecated serde_yaml with the maintained fork serde_yml (0.0.12) which has a compatible API
  • Path normalization: check_orphan_status now normalizes path separators using components().join("/") to prevent false orphan detection on Windows

CI was failing because the repo uses workspace-inherited fields
(version.workspace = true) but was checked out in isolation without
a workspace root. Add proper workspace setup (checkout into subdirectory,
create workspace Cargo.toml) and smart branch cloning that tries
the PR branch name first before falling back to main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@Cargo.toml`:
- Line 14: The Cargo.toml dependency serde_yml is unsafe/unmaintained; replace
it with a maintained YAML crate such as serde_yaml_ng or serde_norway by
updating the dependency entry (swap the serde_yml = "0.0.12" line to the chosen
crate and version), run cargo update/cargo build to fetch the new crate, and
adjust any serde YAML usage in the codebase to the new crate's API (most code
using serde_yml should work with serde_yaml_ng, but if you choose serde_norway,
adapt import paths and any minor API differences accordingly).

In `@src/config.rs`:
- Around line 11-105: The public types claim a repo is required but
ProjectEntry::Extended stores repo as Option<String>, ProjectInfo.repo is
Option<String>, and has_no_repo() implies no-repo entries are permitted; update
the API docs and inline comments to reflect that repo is optional and local-only
projects are supported (adjust comments on ProjectEntry, ProjectEntry::Extended,
ProjectInfo, and the doc string above MetaConfig) so downstream users aren’t
misled, or alternatively enforce a required repo by changing
ProjectEntry::Extended.repo and ProjectInfo.repo to String and
removing/adjusting has_no_repo(); pick one approach and make the comments and
types consistent (reference symbols: ProjectEntry::Extended, ProjectInfo,
has_no_repo()).
- Around line 167-222: The ProjectInfo.path values built in parse_meta_config
can contain backslashes from config files and should be normalized to forward
slashes to match filesystem-derived paths; update the mapping inside
parse_meta_config (the closure that builds ProjectInfo in the .map over
config.projects) to normalize resolved_path/name by replacing backslashes with
'/' (e.g., resolved_path.replace('\\','/')) before assigning to ProjectInfo.path
so both the Simple branch and the Extended { path, ... } branch produce
normalized paths.

Comment thread Cargo.toml Outdated
Comment thread src/config.rs
Comment thread src/config.rs
- Replace serde_yml (RUSTSEC-2025-0068: unsound, unmaintained) with
  serde_yaml_ng (maintained drop-in replacement)
- Fix doc comments: clarify repo field is optional for local-only projects
- Normalize project paths (backslash to forward slash) for Windows compat
- Fix CI script injection: move github.head_ref to env: instead of
  inline shell interpolation
- Add clone failure handling and branch logging in CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mateodelnorte
mateodelnorte merged commit dff6614 into main Feb 14, 2026
7 checks passed
@mateodelnorte
mateodelnorte deleted the refactor/move-config-to-meta-core branch February 14, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant