Skip to content

refactor(lib): reduce dependency footprint - #1301

Merged
jdx merged 1 commit into
mainfrom
refactor/lib-reduce-dependencies
Aug 24, 2026
Merged

refactor(lib): reduce dependency footprint#1301
jdx merged 1 commit into
mainfrom
refactor/lib-reduce-dependencies

Conversation

@jdx

@jdx jdx commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace heck casing, shell-words parsing/quoting, and strum derives with focused in-tree implementations
  • update unicode-width from 0.1 to 0.2
  • split Markdown and manpage rendering into independent markdown and manpage features, while retaining docs and roff compatibility aliases
  • preserve the existing public conversion helpers and error variant so the semver gate remains green

Consumers that only generate Markdown can now use default-features = false, features = ["markdown"] without pulling in roff.

Verification

  • mise run ci
  • isolated usage-lib builds with no features, cli-help, markdown, and manpage
  • confirmed the Markdown-only normal dependency tree contains none of heck, roff, shell-words, or strum and uses unicode-width 0.2

This pull request was generated by Codex.


Note

Medium Risk
Touches identifier casing, POSIX word split/quote, and spec enum parsing used by codegen and mounts. Feature split is compatibility-aliased, but markdown-only vs manpage gating can surprise consumers.

Overview
Shrinks the usage-lib dependency tree by replacing heck, shell-words, and strum with small in-tree implementations, and bumps unicode-width to 0.2.

Casing for completions and SDK codegen now lives in case.rs (snake/camel/Pascal, heck word boundaries). Mount parsing and env joining use a POSIX split/join in shell_words.rs. Spec string enums (Framing, UnknownFlags, config scopes, etc.) use a local impl_string_enum! plus EnumParseError; UsageErr::Strum is kept as a compatibility wrapper.

Docs features are split: markdown and manpage are independent, with docs and roff remaining aliases. Markdown-only consumers can skip roff.

Reviewed by Cursor Bugbot for commit 53fb0c8. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features
    • Added robust shell-word parsing and quoting, including support for quotes, escapes, comments, and clear errors for incomplete quotes.
    • Added explicit string conversion and validation for configuration and output values.
  • Improvements
    • Refined documentation feature options, with separate Markdown and manpage support while preserving compatibility.
    • Preserved consistent naming and casing in generated SDKs and shell completions.
  • Documentation
    • Added third-party licensing and attribution notices.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​unicode-width@​0.2.299100100100100

View full report

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b9a5be4-934e-4671-b8de-239b1c06cecd

📥 Commits

Reviewing files that changed from the base of the PR and between 4561fd8 and 53fb0c8.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • NOTICE.md
  • lib/Cargo.toml
  • lib/src/case.rs
  • lib/src/complete/bash.rs
  • lib/src/complete/fish.rs
  • lib/src/complete/nu.rs
  • lib/src/complete/powershell.rs
  • lib/src/complete/zsh.rs
  • lib/src/docs/mod.rs
  • lib/src/docs/models.rs
  • lib/src/enum_value.rs
  • lib/src/error.rs
  • lib/src/go/mod.rs
  • lib/src/lib.rs
  • lib/src/parse.rs
  • lib/src/sdk/mod.rs
  • lib/src/sdk/python/mod.rs
  • lib/src/sdk/typescript/mod.rs
  • lib/src/sdk/typescript/types.rs
  • lib/src/sdk/typescript/wrappers.rs
  • lib/src/shell_words.rs
  • lib/src/spec/arg.rs
  • lib/src/spec/choices.rs
  • lib/src/spec/cmd.rs
  • lib/src/spec/config.rs
  • lib/src/spec/data_types.rs
  • lib/src/spec/effect.rs
  • lib/src/spec/output.rs
  • lib/src/spec/unknown_flags.rs
  • lib/tests/parse.rs

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change removes selected heck, shell-words, and strum usage. It adds local casing, shell-word, and string-enum implementations. Documentation features are split into Markdown and manpage options.

Changes

Local helper replacement

Layer / File(s) Summary
Module, dependency, and feature foundation
lib/Cargo.toml, lib/src/lib.rs, NOTICE.md
The crate removes selected dependencies, registers local helper modules, updates unicode-width, separates documentation features, and adds third-party notices.
Casing and shell-word helpers
lib/src/case.rs, lib/src/shell_words.rs
The crate adds snake, PascalCase, lowerCamelCase, shell-word splitting, shell quoting, joining, and focused tests.
String-enum and parser APIs
lib/src/enum_value.rs, lib/src/error.rs, lib/src/parse.rs, lib/src/spec/*
A shared string-enum macro replaces Strum conversions. ParseValue gains explicit conversion methods.
Call-site and feature-gate integration
lib/src/complete/*, lib/src/docs/*, lib/src/go/*, lib/src/sdk/*, lib/src/spec/cmd.rs, lib/src/spec/choices.rs, lib/tests/parse.rs
Completion, SDK generation, command mounting, parsing, tests, and documentation models use local helpers and renamed feature gates.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 53fb0

The dependency and feature refactor has no actionable merge-blocking risk remaining at the current head after normal checks and review.

Poem

A rabbit hops through parser fields,
With quoted words and casing yields.
Strum departs; local forms grow,
Markdown and manpages now show.
“Hop!” says the hare, “the helpers flow!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: reducing the library's dependency footprint.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 53fb0c8. Configure here.

Comment thread lib/src/spec/effect.rs
@jdx
jdx merged commit 74a0a05 into main Aug 24, 2026
9 of 10 checks passed
@jdx
jdx deleted the refactor/lib-reduce-dependencies branch August 24, 2026 13:26
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