Skip to content

feat: add prompt-loader and tools-merger modules#8

Merged
Gaubee merged 1 commit intomainfrom
feat/prompt-tools-system
Dec 19, 2025
Merged

feat: add prompt-loader and tools-merger modules#8
Gaubee merged 1 commit intomainfrom
feat/prompt-tools-system

Conversation

@Gaubee
Copy link
Copy Markdown
Collaborator

@Gaubee Gaubee commented Dec 19, 2025

Summary

Add core modules for the customization system: prompt loading and tools merging.

New Modules

1. prompt-loader.ts

Flexible prompt loading and rendering system.

Features:

  • Multi-source priority: user > builtin
  • Template syntax with configurable PREFIX/SUFFIX (default: {{KEY}})
  • YAML frontmatter for custom config and ALIAS mapping
  • Built-in variables: DATETIME, CWD
  • Compose mode: prepend + base + append

API:

// Read prompt with priority resolution
const prompt = await readPrompt("coder");

// Render template with variables
const rendered = renderTemplate(template, { USER_RULES: rules });

// Read and render in one call
const final = await readAndRenderPrompt("coder", vars);

2. tools-merger.ts

Tool configuration merging with append mode and removal syntax.

Features:

  • Append mode by default (add to existing list)
  • ! prefix for removal: ["CustomTool", "!Bash"]
  • Separate allow/disallow list merging

API:

// Merge tool lists
const result = mergeTools(base, ["NewTool", "!OldTool"]);

// Merge full config
const { allow, disallow } = mergeToolsConfig(
  baseAllow, 
  baseDisallow,
  { allow: ["Custom"], disallow: ["!WebSearch"] }
);

Tests

  • 8 new test files with 37 test steps
  • 98 total tests passing

prompt-loader.ts:
- Multi-source priority: user > builtin
- Template syntax with configurable PREFIX/SUFFIX
- YAML frontmatter for custom config and ALIAS mapping
- Built-in vars: DATETIME, CWD
- Compose mode: prepend + base + append

tools-merger.ts:
- Append mode for tool configuration
- ! prefix syntax for removal
- mergeToolsConfig for allow/disallow lists

Tests: 8 new tests (98 total)
@Gaubee Gaubee merged commit 5901798 into main Dec 19, 2025
3 checks passed
@Gaubee Gaubee deleted the feat/prompt-tools-system branch December 19, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant