module:
oneshot
=======

This codebase is a module that is part of a larger project. It is undergoing a refactor to align with the spec and architecture.

Please read the following documents. Then critically review the current code and assess the current test status.

Then think through the following:

1. Assess: Does this codebase align with the spec and architecture plans? In what ways does it not align?
2. Assess: Are there any glaring issues with the codebase separate from the test failures?
3. Assess: What are the root causes of the current test failures?

Finally, your deliverable should be:

1. A detailed summary of the findings of your assessment.
2. Identification of the root cause of test failures.
3. An actionable plan for remediation of the inadequacies and test failureswith as much detail as possible, including specific atomic code changes required.

\---- ARCHITECTURE DOCS ----

Processing   Output content compatibility:
✔ ChatGPT  ✔ Claude  ✔ o1 API  ✔ Sonnet API  ✔ 4o API

\---- SPEC INTERFACES AND TYPES ----

Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Processing  &#x20;Processing.  Output content compatibility:
✔ ChatGPT  ✔ Claude  ✔ o1 API  ✔ Sonnet API  ✔ 4o API &#x20;
Processing..

\---- PLAN ----

This is the current plan for the project attempting to ensure complete alignment with the spec and architecture

Error: Error processing import directive: File not found

\---- CODE ----

Processing  &#x20;Processing. &#x20;Processing..&#x20;Processing...Output content compatibility:
✔ ChatGPT  ✔ Claude  ✔ o1 API  ✔ Sonnet API  ✔ 4o API &#x20;
Processing

\---- TEST STATUS ----

\> @meldscience/oneshot@0.1.0 test
\> vitest --run

&#x20;RUN  v1.6.0 /Users/adam/dev/oneshot

&#x20;✓ tests/markdownImporter.test.ts  (8 tests) 7ms
stdout | tests/extractPlaceholders.test.ts > extractPlaceholders > extracts @import placeholders for markdown headings
importSpec: ../docs/setup.md # Installation
filePath: ../docs/setup.md
specifier: Installation
asSpec: ###
asMatch: \[
&#x20; '###',
&#x20; '###',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '###',
&#x20; groups: \[Object: null prototype] { level: '###', text: undefined }
]
asMatch.groups: \[Object: null prototype] { level: '###', text: undefined }
importSpec: ../docs/api.md # Endpoints
filePath: ../docs/api.md
specifier: Endpoints
asSpec: ### Quick Start
asMatch: \[
&#x20; '### Quick Start',
&#x20; '###',
&#x20; 'Quick Start',
&#x20; index: 0,
&#x20; input: '### Quick Start',
&#x20; groups: \[Object: null prototype] { level: '###', text: 'Quick Start' }
]
asMatch.groups: \[Object: null prototype] { level: '###', text: 'Quick Start' }
importSpec: ../docs/guide.md # Setup
filePath: ../docs/guide.md
specifier: Setup

stdout | tests/extractPlaceholders.test.ts > extractPlaceholders > extracts @import placeholders for code symbols
importSpec: src/meld.ts # myFunction
filePath: src/meld.ts
specifier: myFunction
specifier: myFunction
symbolMatch: null
importSpec: src/meld.ts # {interface}
filePath: src/meld.ts
specifier: {interface}
specifier: {interface}
symbolMatch: null
importSpec: src/meld.ts # \[myFunction, otherFunction
filePath: src/meld.ts
specifier: \[myFunction, otherFunction
specifier: \[myFunction, otherFunction
symbolMatch: \[
&#x20; '\[myFunction, otherFunction',
&#x20; 'myFunction, otherFunction',
&#x20; index: 0,
&#x20; input: '\[myFunction, otherFunction',
&#x20; groups: undefined
]
symbols: \[ 'myFunction', 'otherFunction' ]

stdout | tests/extractPlaceholders.test.ts > extractPlaceholders > handles multiple placeholders on the same line
importSpec: file.md # Title
filePath: file.md
specifier: Title

&#x20;✓ tests/codeImporter.test.ts  (9 tests) 9ms
&#x20;✓ tests/extractPlaceholders.test.ts  (5 tests) 6ms
stdout | tests/config.test.ts > Config > should load config from environment variables
Environment variables before loadConfig:
ANTHROPIC\_API\_KEY: test-anthropic-key
OPENAI\_API\_KEY: test-openai-key
DEFAULT\_MODEL: test-model
Loaded config:
config.anthropicApiKey: test-anthropic-key
config.openaiApiKey: test-openai-key
config.defaultModel: test-model

&#x20;✓ tests/config.test.ts  (6 tests) 10ms
&#x20;✓ tests/cli/meld-config.test.ts  (6 tests) 13ms
&#x20;✓ tests/cli/oneshotcat.test.ts  (7 tests) 23ms
&#x20;✓ tests/cli/oneshot.test.ts  (15 tests) 139ms
&#x20;✓ tests/oneshot.test.ts  (7 tests) 71ms
stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @cmd directives
Node value: Here is a command: @cmd\[echo "hello"]
Full match: @cmd\[echo "hello"]
Type: cmd
Content: echo "hello"

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @import directives with heading
Node value: Import section: @import\[test.md # Section]
Full match: @import\[test.md # Section]
Type: import
Content: test.md # Section
Raw input: @import\[test.md # Section]
Import match: \[
&#x20; '@import\[test.md # Section]',
&#x20; 'test.md # Section',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section]',
&#x20; groups: undefined
]
Inside: test.md # Section
Heading level override: undefined
Heading text override: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @import directives with heading level override
Node value: Import section: @import\[test.md # Section] as ###
Full match: @import\[test.md # Section] as ###
Type: import
Content: test.md # Section
Raw input: @import\[test.md # Section] as ###
Import match: \[
&#x20; '@import\[test.md # Section] as ###',
&#x20; 'test.md # Section',
&#x20; '###',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section] as ###',
&#x20; groups: undefined
]
Inside: test.md # Section
Heading level override: ###
Heading text override: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @import directives with heading text override
Node value: Import section: @import\[test.md # Section] as ### "New Title"
Full match: @import\[test.md # Section] as ### "New Title"
Type: import
Content: test.md # Section
Raw input: @import\[test.md # Section] as ### "New Title"
Import match: \[
&#x20; '@import\[test.md # Section] as ### "New Title"',
&#x20; 'test.md # Section',
&#x20; '###',
&#x20; 'New Title',
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section] as ### "New Title"',
&#x20; groups: undefined
]
Inside: test.md # Section
Heading level override: ###
Heading text override: New Title

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @import directives with code symbols
Node value: Import symbols: @import\[code.ts # \[func1, func2]]
Full match: @import\[code.ts # \[func1, func2]]
Type: import
Content: code.ts # \[func1, func2]
Raw input: @import\[code.ts # \[func1, func2]]
Import match: \[
&#x20; '@import\[code.ts # \[func1, func2]]',
&#x20; 'code.ts # \[func1, func2]',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[code.ts # \[func1, func2]]',
&#x20; groups: undefined
]
Inside: code.ts # \[func1, func2]
Heading level override: undefined
Heading text override: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse @import directives with type/interface imports
Node value: Import type: @import\[code.ts # {type}]
Full match: @import\[code.ts # {type}]
Type: import
Content: code.ts # {type}
Raw input: @import\[code.ts # {type}]
Import match: \[
&#x20; '@import\[code.ts # {type}]',
&#x20; 'code.ts # {type}',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[code.ts # {type}]',
&#x20; groups: undefined
]
Inside: code.ts # {type}
Heading level override: undefined
Heading text override: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should parse single-brace symbol imports
Node value: Import interface: @import\[test.ts # {interface}]
Full match: @import\[test.ts # {interface}]
Type: import
Content: test.ts # {interface}
Raw input: @import\[test.ts # {interface}]
Import match: \[
&#x20; '@import\[test.ts # {interface}]',
&#x20; 'test.ts # {interface}',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # {interface}]',
&#x20; groups: undefined
]
Inside: test.ts # {interface}
Heading level override: undefined
Heading text override: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should handle empty directives gracefully
Node value: Here is an empty import: @import\[]
Here is an empty command: @cmd\[]
Full match: @import\[]
Type: import
Content:&#x20;
Full match: @cmd\[]
Type: cmd
Content:&#x20;

stdout | tests/remarkMeldDirectives.test.ts > remarkMeldDirectives > should handle malformed directives gracefully
Node value: Here is a malformed import: @import\[test.md#]
Here is another malformed import: @import\[#Section]
Here is a malformed command: @cmd\[echo "test
Full match: @import\[test.md#]
Type: import
Content: test.md#
Raw input: @import\[test.md#]
Import match: \[
&#x20; '@import\[test.md#]',
&#x20; 'test.md#',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md#]',
&#x20; groups: undefined
]
Inside: test.md#
Heading level override: undefined
Heading text override: undefined
Full match: @import\[#Section]
Type: import
Content: #Section
Raw input: @import\[#Section]
Import match: \[
&#x20; '@import\[#Section]',
&#x20; '#Section',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[#Section]',
&#x20; groups: undefined
]
Inside: #Section
Heading level override: undefined
Heading text override: undefined
Full match: @cmd
Type: cmd
Content: undefined

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should process @cmd directives
Node value: Output: @cmd\[echo "test"]
Full match: @cmd\[echo "test"]
Type: cmd
Content: echo "test"
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing command: echo "test"
Command output: test
Replacing node at index 1
Node replaced, new node: { type: 'text', value: 'test' }

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle command errors gracefully
Node value: Output: @cmd\[nonexistentcommand]
Full match: @cmd\[nonexistentcommand]
Type: cmd
Content: nonexistentcommand
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing command: nonexistentcommand

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import markdown sections
Node value: Here is section one: @import\[test.md # Section One]
Full match: @import\[test.md # Section One]
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One]
Import match: \[
&#x20; '@import\[test.md # Section One]',
&#x20; 'test.md # Section One',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One]',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import markdown sections with heading level override
Node value: Here is section: @import\[test.md # Section Two] as ###
Full match: @import\[test.md # Section Two] as ###
Type: import
Content: test.md # Section Two
Raw input: @import\[test.md # Section Two] as ###
Import match: \[
&#x20; '@import\[test.md # Section Two] as ###',
&#x20; 'test.md # Section Two',
&#x20; '###',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section Two] as ###',
&#x20; groups: undefined
]
Inside: test.md # Section Two
Heading level override: ###
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Section Two
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section Two\n' +
&#x20;   '\n' +
&#x20;   'This is section two content.\n' +
&#x20;   '\n' +
&#x20;   '### Subsection\n' +
&#x20;   '\n' +
&#x20;   'This is a subsection.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import markdown sections with heading text override
Node value: Here is section: @import\[test.md # Section Three] as ### "Custom Title"
Full match: @import\[test.md # Section Three] as ### "Custom Title"
Type: import
Content: test.md # Section Three
Raw input: @import\[test.md # Section Three] as ### "Custom Title"
Import match: \[
&#x20; '@import\[test.md # Section Three] as ### "Custom Title"',
&#x20; 'test.md # Section Three',
&#x20; '###',
&#x20; 'Custom Title',
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section Three] as ### "Custom Title"',
&#x20; groups: undefined
]
Inside: test.md # Section Three
Heading level override: ###
Heading text override: Custom Title
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Section Three
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section Three\n\nThis is section three content. ',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle missing markdown sections
Node value: Here is section: @import\[test.md # Nonexistent Section]
Full match: @import\[test.md # Nonexistent Section]
Type: import
Content: test.md # Nonexistent Section
Raw input: @import\[test.md # Nonexistent Section]
Import match: \[
&#x20; '@import\[test.md # Nonexistent Section]',
&#x20; 'test.md # Nonexistent Section',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Nonexistent Section]',
&#x20; groups: undefined
]
Inside: test.md # Nonexistent Section
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Nonexistent Section
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: { content: '', headingFound: false, duplicateHeadings: false }

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import code symbols
Node value: Here are functions: @import\[test.ts # \[testFunction1, testFunction2]]
Full match: @import\[test.ts # \[testFunction1, testFunction2]]
Type: import
Content: test.ts # \[testFunction1, testFunction2]
Raw input: @import\[test.ts # \[testFunction1, testFunction2]]
Import match: \[
&#x20; '@import\[test.ts # \[testFunction1, testFunction2]]',
&#x20; 'test.ts # \[testFunction1, testFunction2]',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # \[testFunction1, testFunction2]]',
&#x20; groups: undefined
]
Inside: test.ts # \[testFunction1, testFunction2]
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import interface definitions
Node value: Here is interface: @import\[test.ts # {interface}]
Full match: @import\[test.ts # {interface}]
Type: import
Content: test.ts # {interface}
Raw input: @import\[test.ts # {interface}]
Import match: \[
&#x20; '@import\[test.ts # {interface}]',
&#x20; 'test.ts # {interface}',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # {interface}]',
&#x20; groups: undefined
]
Inside: test.ts # {interface}
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should import type definitions
Node value: Here is type: @import\[test.ts # {type}]
Full match: @import\[test.ts # {type}]
Type: import
Content: test.ts # {type}
Raw input: @import\[test.ts # {type}]
Import match: \[
&#x20; '@import\[test.ts # {type}]',
&#x20; 'test.ts # {type}',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # {type}]',
&#x20; groups: undefined
]
Inside: test.ts # {type}
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle missing code symbols
Node value: Here is function: @import\[test.ts # nonexistentFunction]
Full match: @import\[test.ts # nonexistentFunction]
Type: import
Content: test.ts # nonexistentFunction
Raw input: @import\[test.ts # nonexistentFunction]
Import match: \[
&#x20; '@import\[test.ts # nonexistentFunction]',
&#x20; 'test.ts # nonexistentFunction',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # nonexistentFunction]',
&#x20; groups: undefined
]
Inside: test.ts # nonexistentFunction
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle multiple directives in one file
Node value: Here is a command: @cmd\[echo "test"]
Here is a section: @import\[test.md # Section One]
Here is a function: @import\[test.ts # testFunction1]
Full match: @cmd\[echo "test"]
Type: cmd
Content: echo "test"
Full match: @import\[test.md # Section One]
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One]
Import match: \[
&#x20; '@import\[test.md # Section One]',
&#x20; 'test.md # Section One',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One]',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: undefined
Heading text override: undefined
Full match: @import\[test.ts # testFunction1]
Type: import
Content: test.ts # testFunction1
Raw input: @import\[test.ts # testFunction1]
Import match: \[
&#x20; '@import\[test.ts # testFunction1]',
&#x20; 'test.ts # testFunction1',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # testFunction1]',
&#x20; groups: undefined
]
Inside: test.ts # testFunction1
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 6
}
Processing command: echo "test"
Command output: test
Replacing node at index 1
Node replaced, new node: { type: 'text', value: 'test' }
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 3,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 6
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 6,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 7
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should not process directives inside code blocks
Node value: Here is some text.
Node value: More text.

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle precise heading level overrides
Node value: Here is a level 2 heading: @import\[test.md # Section One] as ##
Here is a level 4 heading: @import\[test.md # Section Two] as ####
Full match: @import\[test.md # Section One] as ##
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One] as ##
Import match: \[
&#x20; '@import\[test.md # Section One] as ##',
&#x20; 'test.md # Section One',
&#x20; '##',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One] as ##',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: ##
Heading text override: undefined
Full match: @import\[test.md # Section Two] as ####
Type: import
Content: test.md # Section Two
Raw input: @import\[test.md # Section Two] as ####
Import match: \[
&#x20; '@import\[test.md # Section Two] as ####',
&#x20; 'test.md # Section Two',
&#x20; '####',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section Two] as ####',
&#x20; groups: undefined
]
Inside: test.md # Section Two
Heading level override: ####
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 4
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 4,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 5
}
Processing import: test.md heading: Section Two
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section Two\n' +
&#x20;   '\n' +
&#x20;   'This is section two content.\n' +
&#x20;   '\n' +
&#x20;   '### Subsection\n' +
&#x20;   '\n' +
&#x20;   'This is a subsection.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle overlapping imports correctly
Node value: Here is a symbol imported twice:
@import\[test.ts # \[testFunction1]]
@import\[test.ts # testFunction1]
Full match: @import\[test.ts # \[testFunction1]]
Type: import
Content: test.ts # \[testFunction1]
Raw input: @import\[test.ts # \[testFunction1]]
Import match: \[
&#x20; '@import\[test.ts # \[testFunction1]]',
&#x20; 'test.ts # \[testFunction1]',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # \[testFunction1]]',
&#x20; groups: undefined
]
Inside: test.ts # \[testFunction1]
Heading level override: undefined
Heading text override: undefined
Full match: @import\[test.ts # testFunction1]
Type: import
Content: test.ts # testFunction1
Raw input: @import\[test.ts # testFunction1]
Import match: \[
&#x20; '@import\[test.ts # testFunction1]',
&#x20; 'test.ts # testFunction1',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # testFunction1]',
&#x20; groups: undefined
]
Inside: test.ts # testFunction1
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 4
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 3,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 4
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle very deep heading overrides correctly
Node value: Deep heading: @import\[test.md # Section One] as ######
Full match: @import\[test.md # Section One] as ######
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One] as ######
Import match: \[
&#x20; '@import\[test.md # Section One] as ######',
&#x20; 'test.md # Section One',
&#x20; '######',
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One] as ######',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: ######
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle heading text override with special characters correctly
Node value: Special heading: @import\[test.md # Section One] as ### "Title with: \* & # special chars!"
Full match: @import\[test.md # Section One] as ### "Title with: \* & # special chars!"
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One] as ### "Title with: \* & # special chars!"
Import match: \[
&#x20; '@import\[test.md # Section One] as ### "Title with: \* & # special chars!"',
&#x20; 'test.md # Section One',
&#x20; '###',
&#x20; 'Title with: \* & # special chars!',
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One] as ### "Title with: \* & # special chars!"',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: ###
Heading text override: Title with: \* & # special chars!
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 2
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle malformed directives gracefully in processing
Node value: Here is a malformed import: @import\[#]
Here is another malformed import: @import\[]
Here is a malformed command: @cmd\[]
Full match: @import\[#]
Type: import
Content: #
Raw input: @import\[#]
Import match: \[
&#x20; '@import\[#]',
&#x20; '#',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[#]',
&#x20; groups: undefined
]
Inside: #
Heading level override: undefined
Heading text override: undefined
Full match: @import\[]
Type: import
Content:&#x20;
Full match: @cmd\[]
Type: cmd
Content:&#x20;

stdout | tests/remarkMeldDirectives.test.ts > remarkProcessMeldNodes > should handle malformed symbol imports gracefully in processing
Node value: Here is a malformed symbol list: @import\[test.ts # \[func1, ]
Here is another malformed symbol: @import\[test.ts # {]
Full match: @import
Type: import
Content: undefined
Full match: @import\[test.ts # {]
Type: import
Content: test.ts # {
Raw input: @import\[test.ts # {]
Import match: \[
&#x20; '@import\[test.ts # {]',
&#x20; 'test.ts # {',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # {]',
&#x20; groups: undefined
]
Inside: test.ts # {
Heading level override: undefined
Heading text override: undefined
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 4,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 5
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts

&#x20;✓ tests/remarkMeldDirectives.test.ts  (28 tests) 460ms
&#x20;✓ tests/cli/meld.test.ts  (4 tests) 115ms
stdout | tests/oneshotcat.test.ts > Oneshotcat > processes prompt script and sends to AI
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 3,
&#x20;             "offset": 2
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 7,
&#x20;             "offset": 6
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@cmd\[echo \\"test output\\"]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 1,
&#x20;             "offset": 7
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 25,
&#x20;             "offset": 31
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 25,
&#x20;         "offset": 31
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 25,
&#x20;     "offset": 31
&#x20;   }
&#x20; }
}
Node value: Test
Node value: @cmd\[echo "test output"]
Full match: @cmd\[echo "test output"]
Type: cmd
Content: echo "test output"
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "cmd",
&#x20;         "raw": "@cmd\[echo \\"test output\\"]",
&#x20;         "data": {
&#x20;           "command": "echo \\"test output\\""
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 25,
&#x20;         "offset": 31
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 25,
&#x20;     "offset": 31
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing command: echo "test output"
Command output: test output
Replacing node at index 0
Node replaced, new node: { type: 'text', value: 'test output' }
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "test output"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 25,
&#x20;         "offset": 31
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 25,
&#x20;     "offset": 31
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "test output"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 25,
&#x20;         "offset": 31
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 25,
&#x20;     "offset": 31
&#x20;   }
&#x20; }
}

stdout | tests/oneshotcat.test.ts > Oneshotcat > handles command execution errors gracefully
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 3,
&#x20;             "offset": 2
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 7,
&#x20;             "offset": 6
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@cmd\[invalid-command]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 1,
&#x20;             "offset": 7
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 22,
&#x20;             "offset": 28
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 22,
&#x20;         "offset": 28
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 22,
&#x20;     "offset": 28
&#x20;   }
&#x20; }
}
Node value: Test
Node value: @cmd\[invalid-command]
Full match: @cmd\[invalid-command]
Type: cmd
Content: invalid-command
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "cmd",
&#x20;         "raw": "@cmd\[invalid-command]",
&#x20;         "data": {
&#x20;           "command": "invalid-command"
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 22,
&#x20;         "offset": 28
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 22,
&#x20;     "offset": 28
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing command: invalid-command
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Error: Error processing cmd directive: command not found\n\nCommand produced error output (included below):\n\ncommand not found error"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 22,
&#x20;         "offset": 28
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 22,
&#x20;     "offset": 28
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 1,
&#x20;         "column": 1,
&#x20;         "offset": 0
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 1,
&#x20;         "column": 7,
&#x20;         "offset": 6
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Error: Error processing cmd directive: command not found\n\nCommand produced error output (included below):\n\ncommand not found error"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 7
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 22,
&#x20;         "offset": 28
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 2,
&#x20;     "column": 22,
&#x20;     "offset": 28
&#x20;   }
&#x20; }
}

&#x20;✓ tests/oneshotcat.test.ts  (3 tests) 41ms
stdout | tests/meld.test.ts > meld > processes markdown imports correctly
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@import\[test.md # Section One]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 31,
&#x20;             "offset": 48
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 31,
&#x20;         "offset": 48
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 53
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: @import\[test.md # Section One]
Full match: @import\[test.md # Section One]
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One]
Import match: \[
&#x20; '@import\[test.md # Section One]',
&#x20; 'test.md # Section One',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One]',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: undefined
Heading text override: undefined
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[test.md # Section One]",
&#x20;         "data": {
&#x20;           "importPath": "test.md",
&#x20;           "heading": "Section One",
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 31,
&#x20;         "offset": 48
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 53
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 2,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Section One",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 4,
&#x20;                 "offset": 3
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 15,
&#x20;                 "offset": 14
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 15,
&#x20;             "offset": 14
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 16
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 44
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 16
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 44
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 31,
&#x20;         "offset": 48
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 53
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 2,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Section One",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 4,
&#x20;                 "offset": 3
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 15,
&#x20;                 "offset": 14
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 15,
&#x20;             "offset": 14
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 16
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 44
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 16
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 44
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 31,
&#x20;         "offset": 48
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 53
&#x20;   }
&#x20; }
}

stdout | tests/meld.test.ts > meld > processes code imports correctly
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@import\[test.ts # testFunction1]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 33,
&#x20;             "offset": 50
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 33,
&#x20;         "offset": 50
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 55
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: @import\[test.ts # testFunction1]
Full match: @import\[test.ts # testFunction1]
Type: import
Content: test.ts # testFunction1
Raw input: @import\[test.ts # testFunction1]
Import match: \[
&#x20; '@import\[test.ts # testFunction1]',
&#x20; 'test.ts # testFunction1',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # testFunction1]',
&#x20; groups: undefined
]
Inside: test.ts # testFunction1
Heading level override: undefined
Heading text override: undefined
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[test.ts # testFunction1]",
&#x20;         "data": {
&#x20;           "importPath": "test.ts",
&#x20;           "importSymbolList": \[
&#x20;             "testFunction1"
&#x20;           ],
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 33,
&#x20;         "offset": 50
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 55
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "# Code Symbols\n\n\`\`\`typescript\nexport function testFunction1() {\n  return 'test1';\n}\n\`\`\`"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 33,
&#x20;         "offset": 50
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 55
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "# Code Symbols\n\n\`\`\`typescript\nexport function testFunction1() {\n  return 'test1';\n}\n\`\`\`"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 33,
&#x20;         "offset": 50
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 55
&#x20;   }
&#x20; }
}

stdout | tests/meld.test.ts > meld > processes imports with heading level and text overrides
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@import\[test.md # Section One] as ### \\"Custom Title\\"",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 53,
&#x20;             "offset": 70
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 53,
&#x20;         "offset": 70
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 75
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: @import\[test.md # Section One] as ### "Custom Title"
Full match: @import\[test.md # Section One] as ### "Custom Title"
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One] as ### "Custom Title"
Import match: \[
&#x20; '@import\[test.md # Section One] as ### "Custom Title"',
&#x20; 'test.md # Section One',
&#x20; '###',
&#x20; 'Custom Title',
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One] as ### "Custom Title"',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: ###
Heading text override: Custom Title
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[test.md # Section One] as ### \\"Custom Title\\"",
&#x20;         "data": {
&#x20;           "importPath": "test.md",
&#x20;           "heading": "Section One",
&#x20;           "headingLevelOverride": "###",
&#x20;           "headingTextOverride": "Custom Title",
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 53,
&#x20;         "offset": 70
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 75
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 3,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Custom Title",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 5,
&#x20;                 "offset": 4
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 17,
&#x20;                 "offset": 16
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 17,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 18
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 46
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 46
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 53,
&#x20;         "offset": 70
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 75
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 3,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Custom Title",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 5,
&#x20;                 "offset": 4
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 17,
&#x20;                 "offset": 16
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 17,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 18
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 46
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 46
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 53,
&#x20;         "offset": 70
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 75
&#x20;   }
&#x20; }
}

stdout | tests/meld.test.ts > meld > handles multiple imports on the same line
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Here are two imports: @import\[test.md # Section One] and @import\[test.ts # testFunction1]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 90,
&#x20;             "offset": 107
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 90,
&#x20;         "offset": 107
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 112
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: Here are two imports: @import\[test.md # Section One] and @import\[test.ts # testFunction1]
Full match: @import\[test.md # Section One]
Type: import
Content: test.md # Section One
Raw input: @import\[test.md # Section One]
Import match: \[
&#x20; '@import\[test.md # Section One]',
&#x20; 'test.md # Section One',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.md # Section One]',
&#x20; groups: undefined
]
Inside: test.md # Section One
Heading level override: undefined
Heading text override: undefined
Full match: @import\[test.ts # testFunction1]
Type: import
Content: test.ts # testFunction1
Raw input: @import\[test.ts # testFunction1]
Import match: \[
&#x20; '@import\[test.ts # testFunction1]',
&#x20; 'test.ts # testFunction1',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[test.ts # testFunction1]',
&#x20; groups: undefined
]
Inside: test.ts # testFunction1
Heading level override: undefined
Heading text override: undefined
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Here are two imports: "
&#x20;       },
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[test.md # Section One]",
&#x20;         "data": {
&#x20;           "importPath": "test.md",
&#x20;           "heading": "Section One",
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": " and "
&#x20;       },
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[test.ts # testFunction1]",
&#x20;         "data": {
&#x20;           "importPath": "test.ts",
&#x20;           "importSymbolList": \[
&#x20;             "testFunction1"
&#x20;           ],
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 90,
&#x20;         "offset": 107
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 112
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 1,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 4
}
Processing import: test.md heading: Section One
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.md
Import result: {
&#x20; content: '## Section One\n\nThis is section one content.\n',
&#x20; headingFound: true,
&#x20; duplicateHeadings: false
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 4,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 5
}
Processing import: test.ts heading: undefined
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/test.ts
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Here are two imports: "
&#x20;       },
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 2,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Section One",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 4,
&#x20;                 "offset": 3
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 15,
&#x20;                 "offset": 14
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 15,
&#x20;             "offset": 14
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 16
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 44
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 16
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 44
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": " and "
&#x20;       },
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "# Code Symbols\n\n\`\`\`typescript\nexport function testFunction1() {\n  return 'test1';\n}\n\`\`\`"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 90,
&#x20;         "offset": 107
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 112
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Here are two imports: "
&#x20;       },
&#x20;       {
&#x20;         "type": "heading",
&#x20;         "depth": 2,
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "Section One",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 1,
&#x20;                 "column": 4,
&#x20;                 "offset": 3
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 1,
&#x20;                 "column": 15,
&#x20;                 "offset": 14
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 1,
&#x20;             "column": 1,
&#x20;             "offset": 0
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 1,
&#x20;             "column": 15,
&#x20;             "offset": 14
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "paragraph",
&#x20;         "children": \[
&#x20;           {
&#x20;             "type": "text",
&#x20;             "value": "This is section one content.",
&#x20;             "position": {
&#x20;               "start": {
&#x20;                 "line": 3,
&#x20;                 "column": 1,
&#x20;                 "offset": 16
&#x20;               },
&#x20;               "end": {
&#x20;                 "line": 3,
&#x20;                 "column": 29,
&#x20;                 "offset": 44
&#x20;               }
&#x20;             }
&#x20;           }
&#x20;         ],
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 3,
&#x20;             "column": 1,
&#x20;             "offset": 16
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 3,
&#x20;             "column": 29,
&#x20;             "offset": 44
&#x20;           }
&#x20;         }
&#x20;       },
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": " and "
&#x20;       },
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "# Code Symbols\n\n\`\`\`typescript\nexport function testFunction1() {\n  return 'test1';\n}\n\`\`\`"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 90,
&#x20;         "offset": 107
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 112
&#x20;   }
&#x20; }
}

stdout | tests/meld.test.ts > meld > handles errors gracefully
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@import\[nonexistent.md # Section]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 34,
&#x20;             "offset": 51
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 34,
&#x20;         "offset": 51
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 56
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: @import\[nonexistent.md # Section]
Full match: @import\[nonexistent.md # Section]
Type: import
Content: nonexistent.md # Section
Raw input: @import\[nonexistent.md # Section]
Import match: \[
&#x20; '@import\[nonexistent.md # Section]',
&#x20; 'nonexistent.md # Section',
&#x20; undefined,
&#x20; undefined,
&#x20; index: 0,
&#x20; input: '@import\[nonexistent.md # Section]',
&#x20; groups: undefined
]
Inside: nonexistent.md # Section
Heading level override: undefined
Heading text override: undefined
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "import",
&#x20;         "raw": "@import\[nonexistent.md # Section]",
&#x20;         "data": {
&#x20;           "importPath": "nonexistent.md",
&#x20;           "heading": "Section",
&#x20;           "importWholeFile": false
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 34,
&#x20;         "offset": 51
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 56
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'import',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing import: nonexistent.md heading: Section
Resolved path: /Users/adam/dev/oneshot/tests/fixtures/nonexistent.md
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Error: Error processing import directive: File not found\n\n"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 34,
&#x20;         "offset": 51
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 56
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Error: Error processing import directive: File not found\n\n"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 34,
&#x20;         "offset": 51
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 56
&#x20;   }
&#x20; }
}

stdout | tests/meld.test.ts > meld > processes command placeholders
After parse: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 2,
&#x20;             "column": 3,
&#x20;             "offset": 3
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 2,
&#x20;             "column": 16,
&#x20;             "offset": 16
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "@cmd\[echo \\"hello world\\"]",
&#x20;         "position": {
&#x20;           "start": {
&#x20;             "line": 4,
&#x20;             "column": 1,
&#x20;             "offset": 18
&#x20;           },
&#x20;           "end": {
&#x20;             "line": 4,
&#x20;             "column": 25,
&#x20;             "offset": 42
&#x20;           }
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 25,
&#x20;         "offset": 42
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 47
&#x20;   }
&#x20; }
}
Node value: Test Document
Node value: @cmd\[echo "hello world"]
Full match: @cmd\[echo "hello world"]
Type: cmd
Content: echo "hello world"
After meldDirectives: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "meldDirective",
&#x20;         "meldType": "cmd",
&#x20;         "raw": "@cmd\[echo \\"hello world\\"]",
&#x20;         "data": {
&#x20;           "command": "echo \\"hello world\\""
&#x20;         }
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 25,
&#x20;         "offset": 42
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 47
&#x20;   }
&#x20; }
}
Visiting node: {
&#x20; type: 'meldDirective',
&#x20; meldType: 'cmd',
&#x20; index: 0,
&#x20; parentType: 'paragraph',
&#x20; parentChildren: 1
}
Processing command: echo "hello world"
Command output: hello world
Replacing node at index 0
Node replaced, new node: { type: 'text', value: 'hello world' }
After processMeldNodes: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "hello world"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 25,
&#x20;         "offset": 42
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 47
&#x20;   }
&#x20; }
}
After meldDirectiveHandler: {
&#x20; "type": "root",
&#x20; "children": \[
&#x20;   {
&#x20;     "type": "heading",
&#x20;     "depth": 1,
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "Test Document"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 2,
&#x20;         "column": 1,
&#x20;         "offset": 1
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 2,
&#x20;         "column": 16,
&#x20;         "offset": 16
&#x20;       }
&#x20;     }
&#x20;   },
&#x20;   {
&#x20;     "type": "paragraph",
&#x20;     "children": \[
&#x20;       {
&#x20;         "type": "text",
&#x20;         "value": "hello world"
&#x20;       }
&#x20;     ],
&#x20;     "position": {
&#x20;       "start": {
&#x20;         "line": 4,
&#x20;         "column": 1,
&#x20;         "offset": 18
&#x20;       },
&#x20;       "end": {
&#x20;         "line": 4,
&#x20;         "column": 25,
&#x20;         "offset": 42
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
&#x20; "position": {
&#x20;   "start": {
&#x20;     "line": 1,
&#x20;     "column": 1,
&#x20;     "offset": 0
&#x20;   },
&#x20;   "end": {
&#x20;     "line": 5,
&#x20;     "column": 5,
&#x20;     "offset": 47
&#x20;   }
&#x20; }
}

&#x20;✓ tests/meld.test.ts  (6 tests) 597ms

&#x20;Test Files  12 passed (12)
&#x20;     Tests  104 passed (104)
&#x20;  Start at  17:35:24
&#x20;  Duration  4.94s (transform 1.07s, setup 0ms, collect 6.52s, tests 1.49s, environment 1ms, prepare 4.27s)
