Skip to content

Add target descriptions and netsuke help targets (#551) - #555

Open
leynos wants to merge 27 commits into
mainfrom
issue-551-add-target-descriptions-and-netsuke-help-targets
Open

Add target descriptions and netsuke help targets (#551)#555
leynos wants to merge 27 commits into
mainfrom
issue-551-add-target-descriptions-and-netsuke-help-targets

Conversation

@leynos

@leynos leynos commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Closes #551

Summary

Add an optional description field to manifest targets (and, by inheritance,
actions) and expose the rendered target and action catalogue through a new
netsuke help targets subcommand.

  • Targets and actions accept an optional description rendered through the
    normal Jinja pipeline, including foreach expansions. A target description
    is discovery metadata; it never replaces a referenced rule description in
    Ninja progress output.
  • netsuke help targets loads, expands, renders, and validates the selected
    manifest without invoking Ninja. It lists actions and targets with their
    descriptions, defaults, and the established colour, accessibility, locale,
    and JSON-output conventions.
  • Parser, validation, rendering, expansion, snapshot, integration, BDD, and
    documentation coverage support the new surface across all locales.

References

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary

  • Add optional description metadata to manifest targets and actions.
  • Render descriptions through Jinja, including conditional and foreach expansions.
  • Preserve validation for duplicate and unknown fields.
  • Keep target descriptions separate from Ninja rule descriptions.
  • Add netsuke help targets with deterministic action and target listings.
  • Support manifest selection, localization, colour, accessibility, text, and versioned JSON output.
  • Avoid recipe execution and build output creation.
  • Preserve existing netsuke help behaviour.
  • Add translations for all locales and update documentation, shell completions, manual pages, and PowerShell help.
  • Add parser, rendering, expansion, snapshot, integration, property-based, and BDD coverage.
  • Refactor shared snapshot, BDD verification, and manifest rendering logic without changing behaviour.
  • Record the completed implementation in the execution plan, and document the related design changes in the user, developer, CLI design, and migration guides.

Walkthrough

This change adds optional target and action descriptions and introduces netsuke help targets. The command validates the selected manifest, renders deterministic text or JSON catalogues, supports localisation and output preferences, and avoids recipe execution.

Changes

Target descriptions and help command

Layer / File(s) Summary
Manifest descriptions and CLI contracts
src/ast.rs, src/cli/*, src/manifest/*, tests/ast_tests/*
Targets and actions now accept optional descriptions. The CLI parses bare and topic-specific help commands. Descriptions survive expansion and render through target variables.
Help dispatch and catalogue rendering
src/main.rs, src/runner/*, src/stdlib/*, locales/*
The runner loads and validates manifests, builds action and target catalogues, and renders localised text or versioned JSON output with default markers and output preferences. Manifest queries disable side-effectful helpers.
Validation, integration coverage, and documentation
tests/bdd/*, tests/features/*, tests/runner_help_targets_tests.rs, tests/documentation_examples_tests.rs, docs/*, dylint.toml, Cargo.toml
Tests cover parsing, manifest selection, text, accessibility, localisation, JSON output, invalid manifests, malformed configuration, and documented examples. Documentation describes the metadata and command. Supporting configuration enables filesystem-based tests.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant HelpRunner
  participant ManifestQuery
  participant Output
  User->>CLI: Run netsuke help targets
  CLI->>HelpRunner: Dispatch help topic
  HelpRunner->>ManifestQuery: Load, expand, and validate manifest
  ManifestQuery-->>HelpRunner: Actions, targets, descriptions, defaults
  HelpRunner->>Output: Render text or JSON catalogue
  Output-->>User: Display catalogue without running recipes
Loading

Poem

Descriptions name each target,
Help lists actions in order.
Locales shape the catalogue,
Text and JSON carry the data.
No recipe runs; the manifest stays intact.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors, 1 warning, 4 inconclusive)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error Help tests cover parsing, rendering, and defaults, but the invalid-manifest test fails before IR validation; removing BuildGraph::from_manifest from help would leave the help tests passing. Add an end-to-end help-targets test with a syntactically valid manifest that has a missing rule or duplicate output, and assert the command rejects it.
Unit Architecture ❌ Error The new manifest-query path calls register_read_only_helpers, which registers now; target descriptions are rendered there, and now calls OffsetDateTime::now_utc() without a clock abstraction. Remove now from the query stdlib, or inject an explicit clock abstraction and define its query semantics; keep query rendering deterministic.
Developer Documentation ⚠️ Warning The COMPLETE execplan is stale: it says 34 locales, but the repository has 35, and four later commits changed query, help, and localisation code without a plan update. Update docs/execplans/fef13161.md to record 35 locales and the post-314f12b changes, then refresh its progress, validation, and outcomes.
Linked Issues check ❓ Inconclusive The main issue objectives are covered, but shell completions, manual pages, and PowerShell help are not evidenced in the review summary. Provide review evidence for the required shell completion, manual-page, and PowerShell help updates, or include the relevant files in the review scope.
Security And Privacy ❓ Inconclusive Investigation is still in progress; no verdict has been submitted for the pull request. Continue reviewing the changed trust boundaries and manifest-query helpers.
Performance And Resource Use ❓ Inconclusive Investigation is still in progress; no verdict has been recorded yet. Inspect the pull request diff and the new catalogue paths before deciding.
Concurrency And State ❓ Inconclusive The repository exposes only a three-file HEAD diff, while the supplied change summary covers many files; the complete pull-request diff is not yet established. Provide the pull-request base revision or a complete diff so shared-state and concurrency changes can be assessed causally.
✅ Passed checks (13 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes target descriptions and the new help command, and links issue #551 as required.
Description check ✅ Passed The description directly summarises the target and action descriptions and the netsuke help targets implementation.
Out of Scope Changes check ✅ Passed The changes support the linked issue through implementation, tests, localisation, documentation, tooling, and an execution plan; no unrelated code changes are evident.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
User-Facing Documentation ✅ Passed Pass: docs/users-guide.md clearly documents descriptions, help targets, safety, selection, output modes, defaults, and locale; the v0.1.0 migration guide signposts the new behaviour.
Module-Level Documentation ✅ Passed All eight new Rust modules start with //! documentation that states their purpose and role, including relationships to the CLI, manifest loader, runner, or test suite.
Testing (Unit And Behavioural) ✅ Passed Added unit, snapshot, property, parser, expansion, rendering and error-path tests, plus assert_cmd and BDD end-to-end coverage for help targets, JSON output, manifest selection and localisation.
Testing (Property / Proof) ✅ Passed Keep this as PASS: the PR adds substantive Proptest coverage for foreach description preservation and catalogue order, alias expansion, metadata, and default marking across generated inputs.
Testing (Compile-Time / Ui) ✅ Passed Accept: the PR adds no new compile-time diagnostic behaviour, and it provides focused text, accessible, localised, and JSON snapshots with semantic assertions for catalogue content.
Domain Architecture ✅ Passed The new domain field is plain Target.description; CLI, filesystem, Jinja, and output concerns remain in runner/help, manifest/query, and stdlib adapters, while IR ignores target descriptions.
Observability ✅ Passed Accept: help targets logs a stable subcommand event, reports manifest/validation/render stages and completion, and routes failures to contextual text or JSON diagnostics; no new service boundary...
Architectural Complexity And Maintainability ✅ Passed Accept this change: the diff adds domain-local help types, extracts shared render/query seams, reuses existing CLI and output APIs, and uses unicode-width only for catalogue alignment.
Rust Compiler Lint Integrity ✅ Passed The PR adds no dead-code or unused-import suppressions; new helpers and re-exports have callers, and added clones are confined to intentional test-fixture ownership.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #551

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-551-add-target-descriptions-and-netsuke-help-targets

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

@sourcery-ai

sourcery-ai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds an optional description field to manifest targets/actions and introduces a localized netsuke help subcommand, including help targets which renders a text/JSON catalogue of actions/targets using existing manifest loading and IR validation pipelines, with full tests and documentation updates.

Sequence diagram for netsuke help targets execution pipeline

sequenceDiagram
    actor User
    participant Cli as Cli_parser
    participant Runner as runner_dispatch
    participant Help as runner_help
    participant Manifest as load_manifest_with_stage_reporting
    participant Graph as BuildGraph
    participant Process as process

    User->>Cli: netsuke help targets
    Cli->>Runner: Commands::Help(HelpArgs { topic: Some(HelpTopic::Targets) })
    Runner->>Help: execute_help(cli, &args, context)
    Help->>Help: handle_help_targets(cli, reporter)
    Help->>Help: resolve_manifest_path(cli)
    Help->>Help: ensure_manifest_exists_or_error(cli, reporter, manifest_path)
    Help->>Help: cli.network_policy()
    Help->>Manifest: load_manifest_with_stage_reporting(manifest_path, policy, reporter)
    Manifest-->>Help: NetsukeManifest
    Help->>Graph: BuildGraph::from_manifest(&manifest)
    Graph-->>Help: validation result
    Help->>Help: build_catalogue(&manifest)
    alt cli.json == true
        Help->>Help: render_json(&entries)
    else cli.json == false
        Help->>Help: render_text(&entries, resolved_prefs(cli))
    end
    Help->>Process: write_text_stdout(rendered)
    Help->>Help: reporter.report_complete(status_key)
    Process-->>User: catalogue output
Loading

File-Level Changes

Change Details Files
Introduce optional discovery descriptions on targets and actions, including render/expand behaviour and AST validation.
  • Add description: Option<String> to Target AST with serde default and docs clarifying it is discovery metadata only.
  • Render target descriptions through the Jinja pipeline in render_target, using target vars for interpolation.
  • Ensure foreach/when expansion preserves or drops description consistently via new manifest expansion test cases.
  • Add AST tests covering presence/absence of description, duplicates, and unknown fields; confirm actions remain phony when they have a description.
src/ast.rs
src/manifest/render.rs
src/manifest/expand_tests.rs
src/manifest/expand_test_cases/description_cases.rs
tests/ast_tests.rs
tests/ast_tests/descriptions.rs
tests/ast_tests/actions.rs
Add netsuke help subcommand with topic-based dispatch, including help targets catalogue rendering and JSON output.
  • Define HelpArgs and HelpTopic enums and add Commands::Help(HelpArgs) in the CLI, disabling clap’s implicit help subcommand.
  • Implement dispatcher branch to route Commands::Help to new helper functions for root help, subcommand help, or targets catalogue.
  • Create runner::help module that loads and validates the manifest, builds an in-memory catalogue of actions/targets/defaults, and renders either localized text sections or a versioned JSON document.
  • Integrate output preferences (emoji/accessibility/theme) and localization keys for headings and default markers into catalogue rendering.
src/cli/help.rs
src/cli/mod.rs
src/cli/parser.rs
src/runner/mod.rs
src/runner/dispatch.rs
src/runner/help.rs
src/localization/keys.rs
src/output_prefs.rs
Extend localization for the new help subcommand and catalogue headings across all locales and status reporting.
  • Add Fluent messages for cli.subcommand.help.* and cli.help.* headings/markers in all locale files.
  • Register new localization keys for help subcommand about/long_about, catalogue headings, default marker, and status tool name.
  • Ensure status pipeline reports help targets activity using a new STATUS_TOOL_HELP_TARGETS key.
  • Update CLI localization helpers to understand the help subcommand and its about/long_about, while suppressing flag help for clean/help.
src/localization/keys.rs
src/cli_l10n.rs
locales/ar/messages.ftl
locales/cs/messages.ftl
locales/cy/messages.ftl
locales/da/messages.ftl
locales/de/messages.ftl
locales/el/messages.ftl
locales/en-GB/messages.ftl
locales/en-US/messages.ftl
locales/es-419/messages.ftl
locales/es-ES/messages.ftl
locales/fa/messages.ftl
locales/fi/messages.ftl
locales/fr/messages.ftl
locales/gd/messages.ftl
locales/he/messages.ftl
locales/hi/messages.ftl
locales/hu/messages.ftl
locales/id/messages.ftl
locales/it/messages.ftl
locales/ja/messages.ftl
locales/ko/messages.ftl
locales/nb/messages.ftl
locales/nl/messages.ftl
locales/pl/messages.ftl
locales/pt-BR/messages.ftl
locales/pt-PT/messages.ftl
locales/ro/messages.ftl
locales/ru/messages.ftl
locales/sv/messages.ftl
locales/th/messages.ftl
locales/tr/messages.ftl
locales/uk/messages.ftl
locales/vi/messages.ftl
locales/zh-Hans/messages.ftl
locales/zh-Hant/messages.ftl
Add tests and BDD coverage for parsing and running netsuke help/help targets, including snapshots and integration tests.
  • Extend CLI parsing tests to include help command, topics, and manifest/working-directory flags; add verification helpers for help topic presence/absence.
  • Add unit snapshot tests for help targets catalogue (text, accessible, localized, JSON) using a fixed manifest fixture.
  • Introduce integration tests for help targets running via the binary and via runner API, covering text/JSON output, -C and --file behaviour, defaults, and error handling for invalid manifests.
  • Add BDD feature and step definitions for full-process help targets scenarios; wire new steps into the BDD module and adjust manifest-command helpers visibility.
  • Update documentation example tests to include the new guide-help-targets example and assert catalogue output sections.
  • Exclude new help-target-related test modules from Dylint linting in dylint.toml and register expected snapshot IDs.
tests/bdd/steps/cli_verify.rs
tests/features/cli.feature
tests/bdd/steps/cli.rs
tests/bdd/steps/help_targets.rs
tests/features/help_targets.feature
tests/documentation_examples_tests.rs
tests/runner_help_targets_tests.rs
src/runner/help_tests.rs
src/snapshots/help_targets/netsuke__runner__help__tests__accessible_catalogue.snap
src/snapshots/help_targets/netsuke__runner__help__tests__json_catalogue.snap
src/snapshots/help_targets/netsuke__runner__help__tests__localized_catalogue_es_es.snap
src/snapshots/help_targets/netsuke__runner__help__tests__text_catalogue.snap
src/snapshots/cli/netsuke__cli__parser__tests__help_en_us.snap
src/snapshots/cli/netsuke__cli__parser__tests__help_es_es.snap
tests/ast_tests/actions.rs
tests/ast_tests/descriptions.rs
tests/ast_tests.rs
tests/manifest_command.rs
tests/bdd/steps/manifest_command_helpers.rs
tests/bdd/steps/mod.rs
dylint.toml
Update user documentation and execution plan to describe target descriptions and the new help targets subcommand.
  • Extend users’ guide to document optional target/action description, its purpose as discovery metadata, and its non-impact on Ninja progress output.
  • Add help [TOPIC] to the command list with explanation of help targets and cross-references to the artefact inspection section.
  • Introduce a new worked example for help targets with a tested-example tag and describe text/JSON behaviour including result.command = help-targets.
  • Add an execution plan document explaining constraints, design decisions, risks, and validation steps for this feature.
docs/users-guide.md
docs/execplans/fef13161.md

Assessment against linked issues

Issue Objective Addressed Explanation
#551 Extend the manifest, AST, rendering, expansion, and parsing so that targets and actions support an optional description field that is preserved through the pipeline without affecting rule descriptions or Ninja progress output.
#551 Implement a netsuke help targets subcommand (and associated help-topic handling) that loads, expands, renders, and validates the selected manifest without running Ninja, then emits a deterministic catalogue of actions and targets with descriptions, supporting text, accessible, localized, and JSON modes and honouring manifest-selection and output preferences.
#551 Update documentation and CLI help to describe the new description field for targets/actions and the netsuke help targets subcommand, including localized help text and related surfaces such as shell completions/man pages/PowerShell help.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

src/runner/help_tests.rs

Comment on lines +105 to +114

fn json_catalogue_snapshot() -> Result<()> {
    let _lock = localizer_lock();
    let _guard = en_localizer();
    let entries = fixture_entries()?;
    let rendered = render_json(&entries)?;
    snapshot_settings("help_targets").bind(|| {
        assert_snapshot!("json_catalogue", rendered);
    });
    Ok(())
}

❌ New issue: Code Duplication
The module contains 4 functions with similar structure: accessible_catalogue_snapshot,json_catalogue_snapshot,localized_catalogue_snapshot,text_catalogue_snapshot

@leynos

leynos commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

tests/bdd/steps/cli_verify.rs

Comment on lines +55 to +66

pub(super) fn verify_help_topic(world: &TestWorld, expected: &HelpTopic) -> Result<()> {
    let command = get_command(world)?;
    let Commands::Help(args) = &command else {
        bail!("expected help command, got {command:?}");
    };
    ensure!(
        args.topic.as_ref() == Some(expected),
        "expected help topic {expected:?}, got {:?}",
        args.topic
    );
    Ok(())
}

❌ New issue: Code Duplication
The module contains 2 functions with similar structure: verify_help_has_no_topic,verify_help_topic

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response.

Overall Code Complexity

src/manifest/render.rs:

What lead to degradation?

This module has a mean cyclomatic complexity of 4.14 across 7 functions. The mean complexity threshold is 4

Why does this problem occur?

Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.
Cyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).

How to fix it?

You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:
Modularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a DECOMPOSE CONDITIONAL refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified./

@coderabbitai

This comment was marked as resolved.

@leynos
leynos marked this pull request as ready for review August 9, 2026 20:29

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai coderabbitai Bot added the Issue label Aug 9, 2026
coderabbitai[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@wafflecat-df12

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@leynos Update the v0.1.0 migration guide. Document target and action description fields, netsuke help targets, compatibility, and basic usage. The warning remains open until that update is present.


✏️ Learnings added
Learnt from: leynos
URL: https://github.com/leynos/netsuke/pull/555

Timestamp: 2026-08-12T02:05:41.723Z
Learning: For `leynos/netsuke`, when the current version is `v0.1.0-beta1`, treat `v0.1.0` as the next pre-1.0.0 migration-guide release for user-facing feature documentation.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: leynos
Repo: leynos/netsuke PR: 0
File: :0-0
Timestamp: 2026-08-12T00:33:17.011Z
Learning: For PR reviews in `leynos/netsuke`, treat warnings as required work. Treat observability, code safety, documentation, and validation coverage as in scope. If required work is out of scope and no existing issue covers it, propose a GitHub follow-up issue.

You are interacting with an AI system.

Use the Polish imperative form and Portuguese post-Acordo Ortográfico
spellings in the localized `help` command descriptions and heading.
codescene-access[bot]

This comment was marked as outdated.

Represent subcommand help topics through `Subcommand` so their names and
localized about keys have one shared mapping. Cover supported and rejected
help-topic names without changing the command surface.
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

leynos added 3 commits August 12, 2026 04:43
Render help catalogues through a restricted manifest-query path so discovery
cannot fetch, execute commands, or write caches. Escape terminal control
characters at text output while retaining raw JSON values.

Add end-to-end, IR, and property coverage for foreach descriptions, rule
progress isolation, catalogue invariants, and the restricted template surface.
codescene-access[bot]

This comment was marked as outdated.

leynos added 2 commits August 12, 2026 05:12
Clarify that target and action descriptions remain discovery metadata and
never replace rule descriptions in Ninja progress. Add the localized
`cli.help.targets_about` synopsis to every shipped locale.
Use a dedicated localized synopsis for the nested `targets` help topic rather
than reusing the catalogue section heading. Keep localized help assertions
aligned with the translated output.
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot removed the Issue label Aug 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/v0-1-0-migration-guide.md`:
- Line 26: Update the table caption near the manifest discovery row to describe
all documented v0.1.0 additions, including the `netsuke help targets` change,
rather than limiting the scope to child-environment API additions.

In `@locales/zh-Hant/messages.ftl`:
- Around line 35-41: Update the help catalogue strings cli.help.actions_heading
and cli.help.targets_about to use 動作 instead of 操作, matching the established
manifest action terminology used by ir.action_serialisation while leaving the
rest of the translation unchanged.

In `@src/runner/help.rs`:
- Around line 219-234: Update terminal_safe to detect Unicode Bidi_Control
ranges in addition to char::is_control(), escape matching characters with
escape_unicode(), and retain the existing named escapes for newline, carriage
return, and tab. Add a regression test covering U+202E to verify it is not
emitted unchanged.

In `@src/stdlib/register.rs`:
- Around line 106-112: Update the documentation for register_read_only_helpers
to remove the claim that manifest queries must not perform I/O. State instead
that query mode prevents side effects such as network access, cache writes, and
command execution, while acknowledging retained filesystem-capable helpers
including file tests, path helpers, and which.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ab29b06d-d462-4bba-8d02-0a18b34aee86

📥 Commits

Reviewing files that changed from the base of the PR and between 6b058b2 and 625e93f.

⛔ Files ignored due to path filters (5)
  • Cargo.lock is excluded by !**/*.lock
  • src/snapshots/cli/netsuke__cli__parser__tests__help_es_es.snap is excluded by !**/*.snap
  • src/snapshots/help_targets/netsuke__runner__help__tests__accessible_catalogue.snap is excluded by !**/*.snap
  • src/snapshots/help_targets/netsuke__runner__help__tests__localized_catalogue_es_es.snap is excluded by !**/*.snap
  • src/snapshots/help_targets/netsuke__runner__help__tests__text_catalogue.snap is excluded by !**/*.snap
📒 Files selected for processing (64)
  • .gitignore
  • Cargo.toml
  • docs/developers-guide.md
  • docs/execplans/fef13161.md
  • docs/netsuke-cli-design-document.md
  • docs/netsuke-design.md
  • docs/roadmap.md
  • docs/users-guide.md
  • docs/v0-1-0-migration-guide.md
  • locales/ar/messages.ftl
  • locales/cs/messages.ftl
  • locales/cy/messages.ftl
  • locales/da/messages.ftl
  • locales/de/messages.ftl
  • locales/el/messages.ftl
  • locales/en-GB/messages.ftl
  • locales/en-US/messages.ftl
  • locales/es-419/messages.ftl
  • locales/es-ES/messages.ftl
  • locales/fa/messages.ftl
  • locales/fi/messages.ftl
  • locales/fr/messages.ftl
  • locales/gd/messages.ftl
  • locales/he/messages.ftl
  • locales/hi/messages.ftl
  • locales/hu/messages.ftl
  • locales/id/messages.ftl
  • locales/it/messages.ftl
  • locales/ja/messages.ftl
  • locales/ko/messages.ftl
  • locales/nb/messages.ftl
  • locales/nl/messages.ftl
  • locales/pl/messages.ftl
  • locales/pt-BR/messages.ftl
  • locales/pt-PT/messages.ftl
  • locales/ro/messages.ftl
  • locales/ru/messages.ftl
  • locales/sv/messages.ftl
  • locales/th/messages.ftl
  • locales/tr/messages.ftl
  • locales/uk/messages.ftl
  • locales/vi/messages.ftl
  • locales/zh-Hans/messages.ftl
  • locales/zh-Hant/messages.ftl
  • src/cli/parser_tests.rs
  • src/cli_l10n.rs
  • src/ir/from_manifest.rs
  • src/localization/keys.rs
  • src/main.rs
  • src/manifest/expand_test_cases/property_cases.rs
  • src/manifest/expand_tests.rs
  • src/manifest/mod.rs
  • src/manifest/query.rs
  • src/manifest/render.rs
  • src/manifest/tests/workspace.rs
  • src/runner/dispatch.rs
  • src/runner/help.rs
  • src/runner/help_tests.rs
  • src/stdlib/mod.rs
  • src/stdlib/register.rs
  • tests/ast_tests/descriptions.rs
  • tests/ir_from_manifest_tests.rs
  • tests/novice_flow_smoke_tests.rs
  • tests/runner_help_targets_tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/rstest-bdd (auto-detected)
  • leynos/ortho-config (auto-detected)
  • leynos/whitaker (auto-detected)
  • leynos/shared-actions (auto-detected)

Comment thread docs/v0-1-0-migration-guide.md
Comment thread locales/zh-Hant/messages.ftl Outdated
Comment thread src/runner/help.rs
Comment on lines +219 to +234
fn terminal_safe(input: &str) -> Cow<'_, str> {
if !input.chars().any(char::is_control) {
return Cow::Borrowed(input);
}

let mut escaped = String::with_capacity(input.len());
for character in input.chars() {
match character {
'\n' => escaped.push_str("\\n"),
'\r' => escaped.push_str("\\r"),
'\t' => escaped.push_str("\\t"),
control if control.is_control() => escaped.extend(control.escape_default()),
printable => escaped.push(printable),
}
}
Cow::Owned(escaped)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
sed -n '190,255p' src/runner/help.rs
rg -n "terminal_safe|bidi|U\\+202E|202E|escape_unicode|escape_default" src tests Cargo.toml
rustc --version 2>/dev/null || true

Repository: leynos/netsuke

Length of output: 3295


🌐 Web query:

Rust standard library char::is_control char::is_bidi_control Bidirectional_Control Unicode documentation

💡 Result:

In Rust, the standard library provides the char::is_control method, but it does not include a built-in char::is_bidi_control method in the core language [1][2][3]. char::is_control The char::is_control method returns true if a character falls under the Unicode general category Cc (Control) [1][4]. These code points are described in the Unicode Standard and specified in the Unicode Character Database (UnicodeData.txt) [1][5]. The implementation in the Rust standard library matches characters in the ranges U+0000..=U+001F and U+007F..=U+009F [3]. Bidi_Control and char::is_bidi_control There is no char::is_bidi_control method in the standard library; however, functions with this name appear in third-party crates (such as unic-ucd-bidi or servo-base) [6][7][8]. The Bidi_Control property is a Unicode standard property defined in the Unicode Character Database [9][10]. Characters with this property are used by the Unicode Bidirectional Algorithm (UBA) to control the display ordering of bidirectional text [9][11]. They are categorized into three groups [9][10]: - Implicit Directional Formatting Characters: LRM, RLM, and ALM [9][10]. - Explicit Directional Embedding and Override Formatting Characters: LRE, RLE, LRO, RLO, and PDF [9][10]. - Explicit Directional Isolate Formatting Characters: LRI, RLI, FSI, and PDI [9][10]. These characters are essential for managing text directionality in environments where left-to-right and right-to-left scripts are mixed [9][12][11].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- dependencies ---'
rg -n "unicode|bidi|icu|unic|unicode-width|terminal_safe" Cargo.toml Cargo.lock src tests
printf '%s\n' '--- help imports and nearby tests ---'
sed -n '1,80p' src/runner/help.rs
rg -n -C 6 "render|help|description|catalogue|terminal" src/runner tests

Repository: leynos/netsuke

Length of output: 50371


🏁 Script executed (no clone):

#!/bin/bash
set -eu
cat >/tmp/check_char.rs <<'RS'
fn main() {
    for character in ['\u{001b}', '\u{007f}', '\u{009f}', '\u{202e}', '\u{202c}', '\u{2066}', '\u{2069}', '\u{200e}', '\u{200f}', '\u{061c}'] {
        println!(
            "U+{:04X} control={} escape_default={:?} escape_unicode={:?}",
            character as u32,
            character.is_control(),
            character.escape_default().collect::<String>(),
            character.escape_unicode().collect::<String>(),
        );
    }
}
RS
rustc /tmp/check_char.rs -o /tmp/check_char
/tmp/check_char

Length of output: 372


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- manifest dependencies ---'
sed -n '/^\[dependencies\]/,/^\[/p' Cargo.toml
printf '%s\n' '--- relevant source and test references ---'
rg -n -C 4 "terminal_safe|help_targets|target.*description|description.*target|U\\+202E|202E|bidi|direction" src/runner tests --glob '*.rs' --glob '*.feature' || true
printf '%s\n' '--- help test files ---'
fd -i 'help|target' tests src/runner --type f

Repository: leynos/netsuke

Length of output: 33873


🏁 Script executed (no clone):

#!/bin/bash
set -eu
python3 - <<'PY'
import unicodedata
points = [0x001b, 0x007f, 0x009f, 0x061c, 0x200e, 0x200f,
          0x202a, 0x202b, 0x202c, 0x202d, 0x202e,
          0x2066, 0x2067, 0x2068, 0x2069]
for point in points:
    character = chr(point)
    print(
        f"U+{point:04X} category={unicodedata.category(character)} "
        f"bidi={unicodedata.bidirectional(character)!r} "
        f"name={unicodedata.name(character, '<unnamed>')}"
    )
PY

Length of output: 939


Escape Unicode bidirectional-control characters.

char::is_control() excludes Bidi_Control characters such as U+202E, so terminal_safe currently emits them unchanged. Use a local predicate for the Bidi_Control ranges and escape matching characters with escape_unicode(). Add a regression test for U+202E.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runner/help.rs` around lines 219 - 234, Update terminal_safe to detect
Unicode Bidi_Control ranges in addition to char::is_control(), escape matching
characters with escape_unicode(), and retain the existing named escapes for
newline, carriage return, and tab. Add a regression test covering U+202E to
verify it is not emitted unchanged.

Comment thread src/stdlib/register.rs Outdated
@leynos

leynos commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

src/cli_l10n.rs (1)

133-155: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Localize nested help topics.
Add localization keys for HelpTopic and localize the nested Clap subcommands. localize_subcommands only visits direct child commands. The new Help mapping therefore localizes help but leaves targets, build, clean, graph, and generate descriptions in English in netsuke help --help. This breaks the localized help-output contract.

🤖 Detailed instructions

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @src/cli_l10n.rs around lines 133 - 155, Add localized HelpTopic keys and
update the Help command localization flow so localize_subcommands also traverses
the nested help topics targets, build, clean, graph, and generate. Ensure
netsuke help --help uses localized descriptions for the Help command and every
nested topic while preserving existing direct subcommand localization.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== Localization module outline =='
ast-grep outline src/cli_l10n.rs --items all --view expanded

printf '%s\n' '== Nested help localization flow =='
rg -n -A35 -B12 \
  'fn (localize_subcommands|localize_help_topics)|enum (Subcommand|HelpTopicName)|fn (subcommand_about_key|help_topic_about_key)|HelpTopicName::from_name|Subcommand::from_name' \
  src/cli_l10n.rs

printf '%s\n' '== CLI help type declarations =='
ast-grep outline src/cli/help.rs src/cli/parser.rs --items all --view expanded
rg -n -A25 -B8 'enum HelpTopic|struct HelpArgs|Commands::Help|Help\(' src/cli/help.rs src/cli/parser.rs

printf '%s\n' '== Localization keys and en-US messages =='
rg -n -A3 -B3 \
  'CLI_(SUBCOMMAND_HELP|HELP_(TARGETS|ACTIONS|DEFAULT))|cli\.(subcommand\.help|help\.)' \
  src/localization/keys.rs locales/en-US/messages.ftl

printf '%s\n' '== Focused tests for nested help localisation =='
rg -n -A30 -B10 \
  'localized_help_topics_include_localized_descriptions|help --help|HelpTopicName|localize_help_topics' \
  src/cli/parser_tests.rs src/cli_l10n.rs tests

Length of output: 32114


@leynos

src/cli_l10n.rslocalize_subcommands, localize_help_topics, HelpTopicName::from_name

Mark this finding resolved.

localize_subcommands now calls localize_help_topics for each direct subcommand. localize_help_topics detects Subcommand::Help and iterates its nested Clap subcommands. It localizes targets, build, clean, graph, and generate.

HelpTopicName::from_name maps the five supported topics. help_topic_about_key maps targets to CLI_HELP_TARGETS_ABOUT and reuses the existing localized subcommand about keys for the other four topics. It rejects help as a nested topic.

src/cli/parser_tests.rs::localized_help_topics_include_localized_descriptions verifies all five nested descriptions for en-US and es-ES. The inspection sandbox cannot execute Rust tests, but the current codegraph and focused test coverage address the reported defect.

You are interacting with an AI system.

leynos added 3 commits August 12, 2026 12:09
Broaden the migration table caption, record the post-314f12b query and help follow-up in the living exec plan, and rename the targets help synopsis key across all shipped locales. Update Traditional Chinese wording to use 動作.
Keep the post-change record aligned with the renamed cli.help.targets.about key.
Keep query rendering deterministic, escape bidi controls, and retain
capability-scoped UTF-8 fixture paths. Propagate render test failures and
prove that help rejects IR-invalid manifests.
codescene-access[bot]

This comment was marked as outdated.

Align the completed ExecPlan filename with the issue branch so its purpose is
discoverable without relying on an opaque identifier.

@codescene-access codescene-access 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.

Gates Failed
Enforce advisory code health rules (1 file with Code Duplication)

Our agent can fix these. Install it.

Gates Passed
5 Quality Gates Passed

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
runner_help_targets_tests.rs 1 advisory rule 9.39 Suppress

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

codescene-access[bot]

This comment was marked as outdated.

@codescene-access codescene-access 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.

No quality gates enabled for this code.

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.

Add target descriptions and netsuke help targets

4 participants