Skip to content

Collect missing command variables#24

Merged
merefield merged 3 commits into
mainfrom
variable_wizard
Mar 12, 2026
Merged

Collect missing command variables#24
merefield merged 3 commits into
mainfrom
variable_wizard

Conversation

@merefield

Copy link
Copy Markdown
Owner

Summary

  • add a structured variables field to the command/answer schema so the model can mark missing user-provided values
  • collect missing values before showing the final command for confirmation, then substitute them into the command and explanation
  • persist the resolved command in history instead of the placeholder form
  • update the README and add regression coverage for schema shape, variable collection, and fully specified commands

Verification

  • make check

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a variables field to the structured command/answer schema, enabling CLAI to identify missing user-provided values via {{variable_name}} placeholders, prompt users for those values before execution, shell-escape them, and persist the resolved command in history.

Changes:

  • Extended the JSON schema, system prompts, template messages, and default queries to include the variables array field alongside existing cmd, info, and risk fields.
  • Added three new functions (normalize_variables, contains_unresolved_placeholders, resolve_command_variables) to validate, collect, and substitute missing variable values, with rejection of commands containing unresolved placeholders.
  • Added four new test cases covering variable prompting, skip on fully-specified commands, shell-escaping of collected values, and rejection of unresolved placeholders, plus schema assertions for all three providers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
clai.sh Adds variables to schema, prompts, templates; adds normalize/resolve/check functions; integrates variable collection into main loop
test/smoke.bats Adds schema assertions for variables field across providers; adds four new test cases for variable collection behavior
README.md Documents the new variables field and variable collection flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread clai.sh Outdated
@merefield merefield merged commit 38155b0 into main Mar 12, 2026
2 checks passed
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.

2 participants