Skip to content

v0.16.0 - #100

Merged
ynqa merged 6 commits into
mainfrom
v0.16.0/dev
Sep 7, 2026
Merged

ynqa merged 6 commits into
mainfrom
v0.16.0/dev

Conversation

@ynqa

@ynqa ynqa commented Aug 28, 2026 •

Copy link
Copy Markdown
Owner

Add path-based navigation to JSON and YAML documents so applications can resolve paths, jump to values, and retrieve the currently selected path.

  • Add selected_path(), row_index_for_path(), and move_to_path(), with zero-based document indexes for JSON Lines and multi-document YAML.
  • Expand folded ancestors when navigating to a value while preserving unrelated folding state.
  • Index parent relationships so retrieving the selected path avoids scanning preceding rows.
  • Share path formatting across navigation and path enumeration, including escaping for quoted keys.

Path output changes include root array paths from .[0] to [0] and reserved string keys from .null to ["null"]. Consumers that compare or persist generated paths should account for these changes.

Update workspace dependencies and release versions:

  • promkit-core: 0.6.0 → 0.6.1
  • promkit-widgets: 0.8.0 → 0.9.0
  • promkit: 0.15.0 → 0.16.0

Validation on macOS: workspace tests, example builds, formatting, and Clippy passed. Downstream vy tests also passed. After the version updates, all-target checks passed for both repositories.

@ynqa
ynqa marked this pull request as ready for review September 7, 2026 09:51
Copilot AI lite review requested due to automatic review settings September 7, 2026 09:51
@ynqa
ynqa merged commit e0c74c0 into main Sep 7, 2026
2 checks passed
@ynqa
ynqa deleted the v0.16.0/dev branch September 7, 2026 09:53

Copilot AI 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.

🔵 Needs a closer look

It introduces substantial new indexing and navigation logic across both JSON and YAML document models, which warrants final human validation despite no obvious functional defects found.

Pull request overview

This PR adds jq-style path generation and path-based navigation to the structured JSON/YAML document widgets, enabling consumers to resolve paths to rows, move selection to a path, and read back the currently-selected path efficiently (including for JSON Lines and multi-document YAML).

Changes:

  • Introduces a shared path-formatting utility (append_string_key, append_bracket) and updates JSON/YAML path iteration to use it (including escaping/quoting behavior changes like ["null"] and root arrays using [0]).
  • Adds per-row path indexing (PathIndex) and YAML mapping-key kind tracking (PathKeyKind) to support selected_path(), row_index_for_path(), and move_to_path().
  • Extends benchmarks and tests to cover path formatting and path navigation semantics.
File summaries
File Description
promkit-widgets/tests/jsonz/get_all_paths.rs Updates expected JSON path output for reserved string keys (["null"]).
promkit-widgets/src/structured/yaml/yamlz.rs Adds key-kind tracking and shared path formatting to YAML row/path iteration.
promkit-widgets/src/structured/yaml/document.rs Implements YAML selected_path, row_index_for_path, and move_to_path backed by path indices and key-kind data.
promkit-widgets/src/structured/yaml/deserializer.rs Propagates YAML mapping-key kinds through deserialization and returns indexed rows.
promkit-widgets/src/structured/path.rs New shared jq-style path formatting/escaping helpers (dot vs bracket notation).
promkit-widgets/src/structured/mod.rs Adds PathIndex + create_path_indices infrastructure used by JSON/YAML documents.
promkit-widgets/src/structured/json/jsonz.rs Switches JSON path iteration to shared path formatting; minor pretty-render refactor.
promkit-widgets/src/structured/json/document.rs Implements JSON selected_path, row_index_for_path, and move_to_path using path indices.
promkit-widgets/benches/structured/yaml.rs Adds benchmark coverage for selected_path() near the tail.
promkit-widgets/benches/structured/json.rs Adds benchmark coverage for selected_path() near the tail.
Cargo.toml Updates workspace dependency versions.
Review details

Suppressed comments (1)

promkit-widgets/src/structured/mod.rs:172

  • PathIndex::document_index() currently just forwards to parent(), which means calling it on a non-root row returns a parent row index, not a document index. That behavior is surprising given the name; please document that this is only meaningful for root rows (depth == 0) so it isn’t accidentally used elsewhere.
    pub(crate) fn document_index(self) -> Option<usize> {
        self.parent()
    }
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +166 to +168
pub(crate) fn parent(self) -> Option<usize> {
(self.parent_or_document != NO_PATH_INDEX).then_some(self.parent_or_document as usize)
}
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