feat: PromptResolver — inline vs promptFile (#7)#33
Merged
Conversation
First stage of the prompt pipeline. resolvePrompt() returns a discriminated-union ResolvedPrompt tagged "inline" or "template" so later slices can decide whether to substitute and expand. Wires the resolver into runProgram in place of the old "promptFile is not yet supported" branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7.
Summary
resolvePrompt()in@missingstudio/sanddune-corereturning aResolvedPrompttagged"inline"or"template"— first stage of the prompt pipeline per the project's module map.{{KEY}}scan, no shell-expression scan, no built-in argument injection — ADR-0008's "inline = literal").promptArgsmap + the resolved absolute path. Substitution and expansion are out of scope for this slice; they consume the tag in later slices.PromptOption):prompt + promptFile→ throws.prompt + promptArgs→ throws (per ADR-0008).promptFile→ error names the resolved absolute path.promptFileresolves relative paths againstprocess.cwd()(caller's perspective), notRunOptions.cwd— per CONTEXT.md's two-perspectives rule.runProgramnow calls the resolver in place of the previous"promptFile is not yet supported"branch and feedsresolved.textinto the iteration loop. Downstream still consumes a plain string.promptFileas a working option;promptArgsis silently ignored on the template path until substitution lands.Test plan
bun run typecheckbun test— 78 pass, 1 skip, 0 failpromptArgs, both rejected, neither rejected,prompt + promptArgsrejected, missing file names absolute path, relative path resolves againstprocess.cwd(), absolute path used as-isrun.integration.test.tscontinues to passpackages/sanddune/src/types.test.tsleft untouched🤖 Generated with Claude Code