Skip to content

Feat/verda template#33

Merged
hi-lei merged 23 commits intomainfrom
feat/verda-template
Apr 9, 2026
Merged

Feat/verda template#33
hi-lei merged 23 commits intomainfrom
feat/verda-template

Conversation

@hi-lei
Copy link
Copy Markdown
Collaborator

@hi-lei hi-lei commented Apr 9, 2026

Description

Type of Change

  • feat: New feature
  • fix: Bug fix
  • refactor: Code refactoring
  • docs: Documentation
  • test: Tests
  • chore: Maintenance
  • ci: CI/CD changes

Checklist

  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally (make test)
  • Pre-commit checks pass (make pre-commit)
  • My changes generate no new warnings or errors

Related Issues

Additional Context

Note: Use conventional commit messages (e.g. feat:, fix:, chore:).
The CHANGELOG is auto-generated from conventional commit messages at release time.

hi-lei and others added 23 commits April 9, 2026 11:10
Foundation layer with Template, StorageSpec, Entry structs and all I/O
functions: Save, Load, LoadFromPath, Resolve, List, ListAll, Delete,
ValidateName, AutoDescription. Includes comprehensive tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register verda template (alias: tmpl) in the Resource Commands group
with a list subcommand that reads templates from ~/.verda/templates/
and supports --type filtering and structured output (JSON/YAML).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add WizardMode type to buildCreateFlow so the same wizard definition
can drive both VM deployment (full wizard) and template creation
(config steps only, no hostname/description/confirm). Existing
WizardModeDeploy path produces identical behavior to before.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Export TemplateResult type and RunTemplateWizard function so the template
create command can run the wizard in template mode and get structured
results. Also capture human-readable names alongside IDs for SSH keys and
startup scripts during wizard selection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract template types/IO into shared internal/verda-cli/template package
to break the import cycle between cmd/template and cmd/vm. The cmd/template
package re-exports all types and functions via aliases for backward
compatibility.

Add --from flag to vm create that loads a saved template, applies its
values to create options, resolves SSH key and startup script names to
IDs via the API, and prints a summary before running the wizard for any
remaining fields. When invoked with no flags at all, offers a template
picker with "Start from scratch" option.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add timeout context around SSH key and startup script name resolution
  to prevent hanging on unresponsive API (per CLAUDE.md convention)
- Add comment about single-storage-entry limitation in applyTemplate
- Add unit tests for applyTemplate (full, on-demand, partial templates)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Validation errors (spaces, uppercase, duplicates) now display
inline and let the user try again instead of failing the command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
"My Quick Test" → "my-quick-test", "GPU_Training" → "gpu-training".
Lowercases, replaces spaces/underscores with hyphens, strips invalid
chars. Shows the reformatted name before proceeding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Uses Cobra's NoOptDefVal so --from alone triggers the picker,
while --from=gpu-training loads a specific template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
verda vm create (no flags) now goes straight to the wizard.
Template picker only appears with --from or --from=name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--from gpu-training (space-separated) now works like all other flags.
Removed NoOptDefVal picker behavior for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--from alone shows a template picker, --from gpu-training loads
the template directly. Both space-separated and = syntax work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
billing_type=on-demand and location=FIN-01 from templates were not
recognized as "set" by the wizard, causing re-prompts. Added
billingTypeSet and locationSet flags to distinguish template values
from defaults.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When creating a template, "None (skip)" for storage and startup
script is now saved as storage_skip/startup_script_skip in the YAML.
Using --from with such a template correctly skips those wizard steps.

Also fixed startup script name capture: "None (skip)" label was
incorrectly stored as the script name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When --from pre-fills all config steps, the confirm step now fetches
instance type and volume type pricing from the API so the deployment
summary shows accurate costs instead of $0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Templates can now include hostname_pattern (e.g. "gpu-{random}-{location}")
which auto-expands when using --from, skipping the hostname prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 14 new tests covering skip flags, hostname pattern, edge cases
- README.md with full usage guide, YAML format, and examples
- CLAUDE.md with AI context, gotchas, and relationships

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
template create: explain YAML format, auto-reformat, hostname_pattern.
vm create: show --from examples (name, file, picker) prominently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests for NVMe and HDD storage from templates, verifying
StorageSize, StorageType, and storageSkip flag behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hi-lei hi-lei merged commit be03cc3 into main Apr 9, 2026
13 checks passed
@hi-lei hi-lei deleted the feat/verda-template branch April 9, 2026 12:09
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