Skip to content

Remove module includes#1414

Merged
harehare merged 3 commits intomainfrom
remove-module-includes
Mar 10, 2026
Merged

Remove module includes#1414
harehare merged 3 commits intomainfrom
remove-module-includes

Conversation

@harehare
Copy link
Copy Markdown
Owner

No description provided.

Remove all --include-* flags for built-in modules (csv, json, yaml, toml, xml, fuzzy, test) from CLI and associated test cases. Simplifies CLI interface and reduces code complexity.
Copilot AI review requested due to automatic review settings March 10, 2026 12:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the CLI flags that implicitly included built-in modules (csv/json/yaml/toml/xml/fuzzy/test), simplifying mq-run’s argument surface and query construction.

Changes:

  • Removed --json/--csv/--yaml/--toml/--xml/--fuzzy/--test flags and the corresponding query-prefix include logic from mq-run’s CLI.
  • Deleted integration/unit tests that depended on those flags.
  • Tweaked the CLI about text and removed an itertools import.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/mq-run/src/cli.rs Removes include flags + query composition for module includes; updates help/about text; deletes related unit tests.
crates/mq-run/tests/integration_tests.rs Removes integration test cases that validated module parsing via the removed CLI flags.
Comments suppressed due to low confidence (2)

crates/mq-run/tests/integration_tests.rs:128

  • The integration test cases for built-in data modules (csv/json/yaml/xml parse) were removed along with the CLI flags. That drops coverage of these modules entirely. Consider reintroducing equivalent cases by removing the flags and making the query explicitly include/import the module (e.g., include "json" | json_parse() or import "json" | json::json_parse(...)) so the same behaviors remain tested under the new CLI contract.
#[case::test_stream(
    vec!["--unbuffered", "-I", "text", "--stream", ".h"],
    "# title\n",
    None
)]

crates/mq-run/src/cli.rs:1633

  • The unit tests for include_* module flags were removed, but nothing replaces that coverage for module loading/exposure. If the intent is to require explicit include/import in the query now, it would be good to add tests asserting the new behavior (e.g., json_parse() fails without include/import, and succeeds with an explicit include/import) to prevent regressions.

    #[test]
    fn test_fmt_file_not_found() {
        let cli = Cli {
            input: InputArgs::default(),

Comment on lines 30 to 33
#[command(
about = "mq is a markdown processor that can filter markdown nodes by using jq-like syntax.",
about = "mq is a markdown processor that can filter markdown nodes by using jq-like syntax. \nhttps://mqlang.org",
long_about = None
)]
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The about string includes a trailing space before the newline ("...syntax. \nhttps://..."), which will show up in --help output. Consider removing the extra space (or moving the URL to after_help/long_about) to avoid awkward formatting in the help text.

Copilot uses AI. Check for mistakes.
Comment on lines 141 to 144
/// Enable streaming mode for processing large files line by line
#[arg(long, default_value_t = false)]
stream: bool,

/// Include the built-in JSON module
#[arg(long = "json", default_value_t = false)]
include_json: bool,

/// Include the built-in CSV module
#[arg(long = "csv", default_value_t = false)]
include_csv: bool,

/// Include the built-in Fuzzy module
#[arg(long = "fuzzy", default_value_t = false)]
include_fuzzy: bool,

/// Include the built-in YAML module
#[arg(long = "yaml", default_value_t = false)]
include_yaml: bool,

/// Include the built-in TOML module
#[arg(long = "toml", default_value_t = false)]
include_toml: bool,

/// Include the built-in XML module
#[arg(long = "xml", default_value_t = false)]
include_xml: bool,

/// Include the built-in test module
#[arg(long = "test", default_value_t = false)]
include_test: bool,
}
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

This PR removes the --json/--csv/--yaml/--toml/--xml/--fuzzy/--test flags. The CLI reference docs currently still list these options (e.g., README.md and docs/books/src/reference/cli.md), so they’ll be out of date after this merges. Please update the generated CLI help/docs (and add a CHANGELOG entry if this is a breaking user-facing change).

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 6
use clap::{Parser, Subcommand};
use colored::Colorize;
use glob::glob;
use itertools::Itertools;
use miette::IntoDiagnostic;
use miette::miette;
use mq_lang::DefaultEngine;
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

itertools::Itertools was removed from this file and there are no remaining Itertools usages in mq-run sources. mq-run/Cargo.toml still declares an itertools dependency, which is now unused; consider removing it to keep the dependency set minimal.

Copilot uses AI. Check for mistakes.
@harehare harehare merged commit 4ea29c6 into main Mar 10, 2026
4 of 6 checks passed
@harehare harehare deleted the remove-module-includes branch March 10, 2026 14:18
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.

2 participants