Skip to content

feat: unified hybrid parsing — embed sub-nodes in any typed page#19

Merged
mindsocket merged 7 commits into
mainfrom
claude/issue-10-20260226-0439
Feb 27, 2026
Merged

feat: unified hybrid parsing — embed sub-nodes in any typed page#19
mindsocket merged 7 commits into
mainfrom
claude/issue-10-20260226-0439

Conversation

@mindsocket
Copy link
Copy Markdown
Owner

Implements issue #10: Support "embedding" of subitems at any level.

Key changes:

  • New src/parse-embedded.ts with shared body-parsing logic
  • readOstPage supports hybrid files (typed pages with embedded children)
  • readSpace extracts embedded nodes from all typed files; removes includePageFiles option
  • validate.ts handles [[File#Section]] and [[File#^anchor]] parent refs
  • Anchor-implied types (^mission, ^goal1)
  • New fixtures and comprehensive tests for hybrid scenarios

Closes #10

Generated with Claude Code

@mindsocket mindsocket force-pushed the claude/issue-10-20260226-0439 branch from b13a5f5 to 1461b1d Compare February 26, 2026 10:50
github-actions Bot and others added 4 commits February 26, 2026 21:51
Merge the two parsing architectures into a single unified model:

- New `src/parse-embedded.ts` module contains all shared body-parsing
  logic (headings, typed bullets, YAML blocks, anchors) used by both
  `readOstPage` and `readSpace`.

- `read-ost-page.ts` now handles hybrid files (non-ost_on_a_page types):
  the page itself is added as a node, then embedded children are
  extracted from the body.

- `read-space.ts` overhauled: all typed files (including ost_on_a_page)
  have their body parsed for embedded nodes. The `includePageFiles`
  option is removed — ost_on_a_page embedded nodes are always included.
  Embedded nodes get compound labels (`filename#title`) and parent refs
  use `[[filename]]` or `[[filename#title]]` format.

- `validate.ts`: new `labelToKey` utility handles compound labels;
  node index supports `[[File#Section]]` and `[[File#^anchor]]` refs.

- Anchor support: headings may end with ` ^anchorname`; anchors named
  after OST types (e.g. `^mission`, `^goal1`) also imply the node type.

New fixtures and comprehensive tests for all hybrid scenarios.

Co-authored-by: Roger Barnes <mindsocket@users.noreply.github.com>
- Restore readSpace to original: one node per file, ost_on_a_page files
  skipped (includePageFiles option retained). No embedded extraction in
  space mode, so a hybrid file is simply a regular typed node.
- Remove labelPrefix from parse-embedded.ts; embedded nodes always get
  plain titles (e.g. "Our Mission"), not compound "filename#title" labels.
- Update hybrid_solution.md fixture: parent now references the vision
  file directly ([[hybrid_vision]]) instead of a non-existent embedded node.
- Update tests to reflect 7 nodes in valid-ost space (was 9 with embedded),
  rewrite hybrid section to assert no embedded extraction in space mode,
  and remove compound-label test cases from validate tests.

Addresses owner feedback on issue #10.
readSpace now correctly extracts embedded child nodes from hybrid typed
pages (unchanged from original intent), while still skipping ost_on_a_page
files as before. The previous commit incorrectly removed the extraction
entirely.

Embedded nodes get plain resolved titles ("Embedded Mission" not
"hybrid_vision#Embedded Mission"), so parent refs use simple wikilinks:
[[hybrid_vision]] for the file, [[Embedded Mission]] for the embedded node.

Update hybrid_solution.md and tests accordingly.
@mindsocket mindsocket force-pushed the claude/issue-10-20260226-0439 branch from 1461b1d to 4ebd7e0 Compare February 26, 2026 10:51
Copy link
Copy Markdown
Owner Author

@mindsocket mindsocket left a comment

Choose a reason for hiding this comment

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

I think we're on the right track but there are some issues of interpretation of the requirements , especially around handling hierarchy (parent links, in-page anchors and resolved titles).

Comment thread src/parse-embedded.ts
Comment thread src/read-ost-page.ts Outdated
Comment thread src/read-space.ts Outdated
Comment thread src/validate.ts Outdated
Comment thread tests/fixtures/valid-ost/anchor_vision.md
…r resolution

- readOstOnAPage (was readOstPage) now strictly handles ost_on_a_page files;
  throws if given a typed node file. All callers updated.
- OstPageReadResult → OstOnAPageReadResult in types.ts
- includePageFiles → includeOnAPageFiles on readSpace options
- OstNode gains sourceFile?: string; readSpace sets it on embedded nodes so
  validate can resolve [[file#^anchor]] parent refs
- validate.ts indexes by data.title (resolved title) instead of labelToKey(label);
  anchor keys use "sourceFile#^anchor" pattern
- isHybridMode renamed to isOnAPageMode with inverted logic in parse-embedded.ts
- Fixture files renamed: hybrid_vision→vision_page, hybrid_solution→solution_page,
  hybrid-anchor-type→anchor_vision. "hybrid" terminology removed from all
  comments, test describes, and fixture references.
- Tests: read-ost-page.test.ts → read-ost-on-a-page.test.ts (typed-file
  rejection test added). read-space.test.ts covers anchor-type inference and
  sourceFile assignment. validate.test.ts covers cross-file [[file#^anchor]]
  resolution with synthetic nodes.
Copy link
Copy Markdown
Owner Author

@mindsocket mindsocket left a comment

Choose a reason for hiding this comment

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

My feedback is mostly on one particular topic, originating with the comment on tests/fixtures/valid-ost/solution_page.md with supporting thoughts through other files.

Comment thread tests/fixtures/valid-ost/solution_page.md Outdated
Comment thread src/parse-embedded.ts
Comment thread src/parse-embedded.ts
Comment thread src/types.ts Outdated
Comment thread src/validate.ts Outdated
Comment thread tests/validate.test.ts Outdated
@mindsocket mindsocket marked this pull request as ready for review February 27, 2026 03:50
@mindsocket mindsocket merged commit dcfccdc into main Feb 27, 2026
3 checks passed
@mindsocket mindsocket deleted the claude/issue-10-20260226-0439 branch February 27, 2026 03:51
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.

Support "embedding" of subitems at any level

1 participant