@vtriv/cli 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/index.ts +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,6 +123,9 @@ vtriv template set ai-enabled <<< '{"x-db": true, "x-blob": true, "x-ai": true}'
|
|
|
123
123
|
|
|
124
124
|
# Delete a template (cannot delete 'default')
|
|
125
125
|
vtriv template rm ai-enabled
|
|
126
|
+
|
|
127
|
+
# Reset templates to server defaults (useful after server updates)
|
|
128
|
+
vtriv template reset
|
|
126
129
|
```
|
|
127
130
|
|
|
128
131
|
### Database Commands
|
package/index.ts
CHANGED
|
@@ -694,6 +694,37 @@ template
|
|
|
694
694
|
console.log(chalk.green(`Template '${name}' deleted.`));
|
|
695
695
|
});
|
|
696
696
|
|
|
697
|
+
template
|
|
698
|
+
.command("reset")
|
|
699
|
+
.description("Reset templates to server defaults")
|
|
700
|
+
.action(async () => {
|
|
701
|
+
const opts = program.opts<GlobalOptions>();
|
|
702
|
+
const { config, profile, fullProjectName } = getProfile(opts.profile);
|
|
703
|
+
|
|
704
|
+
const res = await fetch(`${config.baseUrl}/auth/${fullProjectName}/templates/_reset`, {
|
|
705
|
+
method: "POST",
|
|
706
|
+
headers: { Authorization: `Bearer ${profile.apiKey}` },
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
if (!res.ok) {
|
|
710
|
+
const data = await res.json();
|
|
711
|
+
error((data as { error?: string }).error || "Failed to reset templates", opts);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const data = (await res.json()) as { templates: Record<string, { claims: Record<string, unknown> }> };
|
|
715
|
+
|
|
716
|
+
if (opts.json) {
|
|
717
|
+
console.log(JSON.stringify(data.templates, null, 2));
|
|
718
|
+
} else {
|
|
719
|
+
console.log(chalk.green("Templates reset to defaults:"));
|
|
720
|
+
const rows = Object.entries(data.templates).map(([name, tmpl]) => ({
|
|
721
|
+
name,
|
|
722
|
+
claims: JSON.stringify(tmpl.claims),
|
|
723
|
+
}));
|
|
724
|
+
printTable(rows);
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
697
728
|
// =============================================================================
|
|
698
729
|
// DB Commands
|
|
699
730
|
// =============================================================================
|