@ductape/cli 0.5.3 → 0.5.6
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/dist/commands/apps.d.ts +4 -0
- package/dist/commands/apps.js +4 -1
- package/dist/index.js +7 -1
- package/dist/lib/forms/enums.d.ts +1 -1
- package/dist/lib/forms/enums.js +1 -1
- package/dist/lib/forms/prompt.js +27 -1
- package/dist/lib/platform-api.d.ts +1 -0
- package/dist/lib/platform-api.js +3 -0
- package/package.json +1 -1
package/dist/commands/apps.d.ts
CHANGED
package/dist/commands/apps.js
CHANGED
|
@@ -2,10 +2,13 @@ import { schemaKeyForEntity } from '../lib/forms/index.js';
|
|
|
2
2
|
import { isInteractive, promptTag } from '../lib/forms/prompt.js';
|
|
3
3
|
import { toInteractiveOpts } from '../lib/interactive-opts.js';
|
|
4
4
|
import { bodyRequiredHint, resolveBody } from '../lib/read-body.js';
|
|
5
|
-
import { createApp, deleteApp, getApp, listApps, updateApp, updateAppViaProxy, } from '../lib/platform-api.js';
|
|
5
|
+
import { createApp, deleteApp, getApp, getAppVersions, listApps, updateApp, updateAppViaProxy, } from '../lib/platform-api.js';
|
|
6
6
|
import { printJson } from '../lib/output.js';
|
|
7
7
|
import { requireWorkspaceContext } from '../lib/workspace-context.js';
|
|
8
8
|
const VERBS = ['list', 'get', 'create', 'update', 'delete'];
|
|
9
|
+
export async function runAppVersions(opts) {
|
|
10
|
+
printJson(await getAppVersions(requireWorkspaceContext({ profile: opts.profile }), opts.id), true);
|
|
11
|
+
}
|
|
9
12
|
export async function runAppVersionRename(opts) {
|
|
10
13
|
if (!opts.from || !opts.to || opts.from === opts.to ||
|
|
11
14
|
opts.from.trim() !== opts.from || opts.to.trim() !== opts.to) {
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import { runWorkspacesCurrent, runWorkspacesList, runWorkspacesRefresh, runWorks
|
|
|
33
33
|
import { runGeneratePayload, runGenerateSnippet } from './commands/generate.js';
|
|
34
34
|
import { runCompletion } from './commands/completion.js';
|
|
35
35
|
import { runProducts, runProductApps, runProductAppActions, runProductComponents, runProductEnvironments } from './commands/products.js';
|
|
36
|
-
import { runApps, runAppVersionRename } from './commands/apps.js';
|
|
36
|
+
import { runApps, runAppVersionRename, runAppVersions } from './commands/apps.js';
|
|
37
37
|
import { runAppsImport } from './commands/apps-import.js';
|
|
38
38
|
import { runAppActions } from './commands/app-actions.js';
|
|
39
39
|
import { registerAppWebhooks } from './commands/app-webhooks.js';
|
|
@@ -773,6 +773,12 @@ const apps = program
|
|
|
773
773
|
throw new Error('Specify a verb: list | get | create | update | delete');
|
|
774
774
|
return runApps(verb, opts, []);
|
|
775
775
|
}));
|
|
776
|
+
apps.command('versions')
|
|
777
|
+
.description('Fetch lightweight version metadata without actions, webhooks or credentials')
|
|
778
|
+
.requiredOption('--id <id>', 'App ID')
|
|
779
|
+
.option('--profile <name>')
|
|
780
|
+
.option('--json', 'JSON output')
|
|
781
|
+
.action(wrap((opts) => runAppVersions(opts)));
|
|
776
782
|
apps.command('rename-version')
|
|
777
783
|
.description('Rename a version label atomically without changing its contents')
|
|
778
784
|
.requiredOption('--id <id>', 'App ID')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Enum values aligned with @ductape/sdk — used for CLI dropdowns */
|
|
2
2
|
export declare const STORAGE_PROVIDERS: readonly ["aws", "gcp", "azure"];
|
|
3
|
-
export declare const DATABASE_TYPES: readonly ["postgresql", "mongodb", "mysql"];
|
|
3
|
+
export declare const DATABASE_TYPES: readonly ["postgresql", "mongodb", "mysql", "redis"];
|
|
4
4
|
export declare const GRAPH_TYPES: readonly ["neo4j", "neptune", "arangodb", "memgraph"];
|
|
5
5
|
export declare const VECTOR_DB_TYPES: readonly ["pinecone", "qdrant", "weaviate", "chroma", "milvus", "pgvector", "memory"];
|
|
6
6
|
export declare const VECTOR_DISTANCE_METRICS: readonly ["cosine", "euclidean", "dotproduct"];
|
package/dist/lib/forms/enums.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Enum values aligned with @ductape/sdk — used for CLI dropdowns */
|
|
2
2
|
export const STORAGE_PROVIDERS = ['aws', 'gcp', 'azure'];
|
|
3
|
-
export const DATABASE_TYPES = ['postgresql', 'mongodb', 'mysql'];
|
|
3
|
+
export const DATABASE_TYPES = ['postgresql', 'mongodb', 'mysql', 'redis'];
|
|
4
4
|
export const GRAPH_TYPES = ['neo4j', 'neptune', 'arangodb', 'memgraph'];
|
|
5
5
|
export const VECTOR_DB_TYPES = [
|
|
6
6
|
'pinecone',
|
package/dist/lib/forms/prompt.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import password from '@inquirer/password';
|
|
1
2
|
import input from '@inquirer/input';
|
|
2
3
|
import select from '@inquirer/select';
|
|
3
4
|
import { MESSAGE_BROKER_TYPES, STORAGE_PROVIDERS } from './enums.js';
|
|
@@ -66,7 +67,26 @@ async function promptEnvs(variant, context) {
|
|
|
66
67
|
message: `Environment slug #${envs.length + 1} (3 letters)`,
|
|
67
68
|
validate: (v) => (v.length >= 1 && v.length <= 3 ? true : 'Use 1–3 characters'),
|
|
68
69
|
});
|
|
69
|
-
if (variant === 'database'
|
|
70
|
+
if (variant === 'database' && context?.databaseType === 'redis') {
|
|
71
|
+
const mode = await select({ message: 'Redis connection', choices: [
|
|
72
|
+
{ name: 'Redis URL', value: 'url' }, { name: 'Import cloud instance', value: 'import' }, { name: 'Provision cloud instance', value: 'provision' },
|
|
73
|
+
] });
|
|
74
|
+
if (mode === 'url')
|
|
75
|
+
envs.push({ slug, connection_url: await password({ message: 'Redis URL (redis:// or rediss://)' }) });
|
|
76
|
+
else {
|
|
77
|
+
const row = { slug, cloud: await input({ message: 'Cloud connection tag' }),
|
|
78
|
+
instance: await input({ message: 'Redis instance name or resource ID' }), region: await input({ message: 'Cloud region' }), importExisting: mode === 'import' };
|
|
79
|
+
if (mode === 'import') {
|
|
80
|
+
const token = await password({ message: 'AWS Redis AUTH token (leave empty for GCP/Azure or stored credentials)' });
|
|
81
|
+
if (token)
|
|
82
|
+
row.masterPassword = token;
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
row.redis = await promptJsonObject('Redis provider settings (GCP: authorizedNetwork, memorySizeGb; AWS: cacheSubnetGroupName, securityGroupIds, nodeType; Azure: resourceGroup, sku)');
|
|
86
|
+
envs.push(row);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (variant === 'database' || variant === 'graph') {
|
|
70
90
|
const connection_url = await input({
|
|
71
91
|
message: 'Connection URL',
|
|
72
92
|
});
|
|
@@ -159,6 +179,7 @@ export async function promptForm(schema, opts) {
|
|
|
159
179
|
const patch = Boolean(opts?.patch);
|
|
160
180
|
const body = {};
|
|
161
181
|
let vectorType;
|
|
182
|
+
let databaseType;
|
|
162
183
|
for (const field of schema.fields) {
|
|
163
184
|
if (patch && !field.required) {
|
|
164
185
|
const set = await askYesNo(`Set ${field.label}?`, false);
|
|
@@ -170,9 +191,14 @@ export async function promptForm(schema, opts) {
|
|
|
170
191
|
if (value !== undefined) {
|
|
171
192
|
body.type = value;
|
|
172
193
|
vectorType = String(value);
|
|
194
|
+
databaseType = String(value);
|
|
173
195
|
}
|
|
174
196
|
continue;
|
|
175
197
|
}
|
|
198
|
+
if (field.kind === 'envs' && field.envsVariant === 'database' && databaseType === 'redis') {
|
|
199
|
+
body[field.key] = await promptEnvs('database', { databaseType });
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
176
202
|
if (field.kind === 'envs' && field.envsVariant === 'vector') {
|
|
177
203
|
const envs = await promptEnvs('vector', { vectorType });
|
|
178
204
|
if (envs.length)
|
|
@@ -24,6 +24,7 @@ export declare function getApp(ctx: WorkspaceContext, opts: {
|
|
|
24
24
|
tag?: string;
|
|
25
25
|
}): Promise<unknown>;
|
|
26
26
|
export declare function createApp(ctx: WorkspaceContext, body: Record<string, unknown>): Promise<unknown>;
|
|
27
|
+
export declare function getAppVersions(ctx: WorkspaceContext, appId: string): Promise<unknown>;
|
|
27
28
|
export declare function updateApp(ctx: WorkspaceContext, appId: string, body: Record<string, unknown>): Promise<unknown>;
|
|
28
29
|
export declare function updateAppViaProxy(ctx: WorkspaceContext, tag: string, body: Record<string, unknown>): Promise<unknown>;
|
|
29
30
|
export declare function deleteApp(ctx: WorkspaceContext, appId: string): Promise<unknown>;
|
package/dist/lib/platform-api.js
CHANGED
|
@@ -428,6 +428,9 @@ export async function createApp(ctx, body) {
|
|
|
428
428
|
const result = await client(ctx).post('/apps/v1/create', payload);
|
|
429
429
|
return unwrapOne(result);
|
|
430
430
|
}
|
|
431
|
+
export async function getAppVersions(ctx, appId) {
|
|
432
|
+
return unwrapOne(await client(ctx).getPath(`/apps/v1/${appId}/versions/metadata`, workspaceAuthQuery(ctx)));
|
|
433
|
+
}
|
|
431
434
|
export async function updateApp(ctx, appId, body) {
|
|
432
435
|
const q = workspaceAuthQuery(ctx);
|
|
433
436
|
const result = await client(ctx).put(`/apps/v1/${appId}?${new URLSearchParams(q).toString()}`, { component: 'app', ...body });
|
package/package.json
CHANGED