Skip to content

feat: PromptResolver — inline vs promptFile (#7)#33

Merged
pyadav merged 1 commit intomainfrom
feat/prompt-resolver
May 3, 2026
Merged

feat: PromptResolver — inline vs promptFile (#7)#33
pyadav merged 1 commit intomainfrom
feat/prompt-resolver

Conversation

@pyadav
Copy link
Copy Markdown
Contributor

@pyadav pyadav commented May 3, 2026

Closes #7.

Summary

  • New resolvePrompt() in @missingstudio/sanddune-core returning a ResolvedPrompt tagged "inline" or "template" — first stage of the prompt pipeline per the project's module map.
  • Inline path returns the string verbatim (no {{KEY}} scan, no shell-expression scan, no built-in argument injection — ADR-0008's "inline = literal").
  • Template path reads the file from disk and returns text + the untouched promptArgs map + the resolved absolute path. Substitution and expansion are out of scope for this slice; they consume the tag in later slices.
  • Runtime guards (defense in depth on the existing compile-time mutual exclusion in PromptOption):
    • prompt + promptFile → throws.
    • prompt + promptArgs → throws (per ADR-0008).
    • missing promptFile → error names the resolved absolute path.
  • promptFile resolves relative paths against process.cwd() (caller's perspective), not RunOptions.cwd — per CONTEXT.md's two-perspectives rule.
  • runProgram now calls the resolver in place of the previous "promptFile is not yet supported" branch and feeds resolved.text into the iteration loop. Downstream still consumes a plain string.
  • README updated to list promptFile as a working option; promptArgs is silently ignored on the template path until substitution lands.

Test plan

  • bun run typecheck
  • bun test — 78 pass, 1 skip, 0 fail
  • New unit tests cover: inline verbatim, template path, default empty promptArgs, both rejected, neither rejected, prompt + promptArgs rejected, missing file names absolute path, relative path resolves against process.cwd(), absolute path used as-is
  • Existing inline integration test in run.integration.test.ts continues to pass
  • Type-level negative tests in packages/sanddune/src/types.test.ts left untouched

🤖 Generated with Claude Code

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>
@pyadav pyadav merged commit 0746a54 into main May 3, 2026
@pyadav pyadav deleted the feat/prompt-resolver branch May 3, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PromptResolver] inline vs promptFile

1 participant