Skip to content

Parse a single block given to node create as an import would - #4401

Merged
mstomar125 merged 2 commits into
mainfrom
issue-4395-single-line-create
Nov 27, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-4395-single-line-create

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What changed

nodespace node create now runs a single block (no front matter) through the importer's parser, the same one used for a document of several blocks.

  • --type text: the node takes the type, content and properties an import of that block gives it (heading -> header, - [ ] x -> checkbox, and likewise quote, code fence, ordered list item, table, horizontal rule; - item -> text without its marker; a plain line stays text).
  • Other document types (task, issue, project, decision, ...): the type is kept, the line is the title, a leading # marker is dropped (--type task --content '# Title' stores Title); a block that cannot be a title (list item, quote, rule, checklist line, ...) is refused with nothing created, as the first line of a longer document is.
  • Non-document types keep their content as given.
  • The result already carries the created type (type: / JSON type); the CLI also prints a note on stderr when it differs from --type.
  • --content help text, packages/skill/references/cli.md (option text, generated help line, output note, the "by hand" example now uses typed header/checkbox nodes and no heading in a text node) and the agent skill seeds (node-creation-steps, section-create, task-create-whole) are updated.

Not a schema/shape change (shape:check and node-types:check green).

Note: the local agent's create_node tool also calls create_document_node, so it gets the same single-block behaviour (the issue lists the agent tools as a non-goal, assuming they did not go through it). In particular create_node(task|issue, "- x") is now refused (a list item cannot be a title), and create_node(text, "## x") creates a header.

Tests

New in markdown_document_create_test.rs: text single blocks match an import (9 cases); plain line stays text; other document types keep type and strip #; non-title blocks refused for a named record; non-document types stored as given. One CLI unit test for the stderr note, and two tests for a caller property on a single text block (reaches the write; mutation: dropping the merge fails it) and for non-object properties being refused (mutation: dropping the refusal fails it). Replaced the old "single block is stored as given" test, which asserted the previous behaviour.
Mutation checks (each reverted): skip type adoption, drop the refusal, drop heading strip, drop the document-type gate, alter adopted content; each makes the guarding test fail.

Checks: bun run test:changed passed; push check passed.

🤖 Generated with Claude Code

mstomar125 and others added 2 commits November 27, 2026 08:42
A single block with no front matter now goes through the importer's parser:
--type text takes the parsed node type, content and properties (a heading is
a header, a checklist line a checkbox, and likewise quote, code block, ordered
list, table, horizontal rule; a bullet line is text without its marker). Any
other document type keeps its type and takes the line as its title (a leading
# marker dropped); a block that cannot be a title is refused. The CLI notes on
stderr when the created type differs from --type. The --content help, the CLI
reference and the skill guidance describe the new behaviour, and the by-hand
example uses typed header and checkbox nodes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Update the agent create_node comment to the single-block behaviour, add tests
for a caller property on a single text block and for non-object properties,
and put the create-note CLI test above the comment that belongs to the next one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4395-single-line-create branch from 7c42d06 to 1970387 Compare November 27, 2026 07:42
@mstomar125
mstomar125 merged commit 61f9f4f into main Nov 27, 2026
@mstomar125
mstomar125 deleted the issue-4395-single-line-create branch November 27, 2026 07:42
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