@ascendkit/cli 0.1.11 → 0.2.0
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/cli.js +38 -2
- package/dist/commands/platform.d.ts +9 -1
- package/dist/commands/platform.js +17 -0
- package/dist/mcp.js +0 -0
- package/dist/tools/platform.js +39 -1
- package/package.json +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -29
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ Services:
|
|
|
35
35
|
|
|
36
36
|
Project Management:
|
|
37
37
|
projects List and create projects
|
|
38
|
-
env List, switch, and promote environments
|
|
38
|
+
env List, switch, update, and promote environments
|
|
39
39
|
verify Check all services in the active environment
|
|
40
40
|
|
|
41
41
|
Run "ascendkit help <section>" for detailed command usage.
|
|
@@ -122,6 +122,7 @@ Commands:
|
|
|
122
122
|
Commands:
|
|
123
123
|
env list --project <project-id>
|
|
124
124
|
env use <tier> --project <project-id>
|
|
125
|
+
env update <env-id> --project <project-id> [--name <name>] [--description <desc>]
|
|
125
126
|
env promote <env-id> --target <tier>`,
|
|
126
127
|
projects: `Usage: ascendkit projects <command>
|
|
127
128
|
|
|
@@ -411,9 +412,44 @@ async function runEnv(action, rest) {
|
|
|
411
412
|
}
|
|
412
413
|
break;
|
|
413
414
|
}
|
|
415
|
+
case "update": {
|
|
416
|
+
const envId = rest[0];
|
|
417
|
+
if (!envId || !flags.project) {
|
|
418
|
+
console.error("Usage: ascendkit env update <env-id> --project <project-id> [--name <name>] [--description <desc>]");
|
|
419
|
+
process.exit(1);
|
|
420
|
+
}
|
|
421
|
+
const name = flags.name;
|
|
422
|
+
const description = flags.description;
|
|
423
|
+
if (!name && description === undefined) {
|
|
424
|
+
console.error("Provide at least --name or --description to update.");
|
|
425
|
+
process.exit(1);
|
|
426
|
+
}
|
|
427
|
+
try {
|
|
428
|
+
const result = await platform.updateEnvironment(flags.project, envId, name, description);
|
|
429
|
+
console.log("Environment updated:");
|
|
430
|
+
console.log(JSON.stringify(result, null, 2));
|
|
431
|
+
}
|
|
432
|
+
catch (err) {
|
|
433
|
+
let message = err instanceof Error ? err.message : String(err);
|
|
434
|
+
const jsonMatch = message.match(/\{.*\}/s);
|
|
435
|
+
if (jsonMatch) {
|
|
436
|
+
try {
|
|
437
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
438
|
+
if (parsed.error)
|
|
439
|
+
message = parsed.error;
|
|
440
|
+
else if (parsed.detail)
|
|
441
|
+
message = parsed.detail;
|
|
442
|
+
}
|
|
443
|
+
catch { /* use raw message */ }
|
|
444
|
+
}
|
|
445
|
+
console.error(message);
|
|
446
|
+
process.exit(1);
|
|
447
|
+
}
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
414
450
|
default:
|
|
415
451
|
console.error(`Unknown env command: ${action}`);
|
|
416
|
-
console.error("Usage: ascendkit env list|use|promote");
|
|
452
|
+
console.error("Usage: ascendkit env list|use|update|promote");
|
|
417
453
|
process.exit(1);
|
|
418
454
|
}
|
|
419
455
|
}
|
|
@@ -17,7 +17,7 @@ export interface McpCreateProjectParams {
|
|
|
17
17
|
}
|
|
18
18
|
export interface McpCreateEnvironmentParams {
|
|
19
19
|
projectId: string;
|
|
20
|
-
name
|
|
20
|
+
name?: string;
|
|
21
21
|
description?: string;
|
|
22
22
|
tier: string;
|
|
23
23
|
}
|
|
@@ -34,7 +34,15 @@ export declare function mcpListProjects(client: AscendKitClient): Promise<unknow
|
|
|
34
34
|
export declare function mcpCreateProject(client: AscendKitClient, params: McpCreateProjectParams): Promise<unknown>;
|
|
35
35
|
export declare function mcpListEnvironments(client: AscendKitClient, projectId: string): Promise<unknown>;
|
|
36
36
|
export declare function mcpCreateEnvironment(client: AscendKitClient, params: McpCreateEnvironmentParams): Promise<unknown>;
|
|
37
|
+
export declare function updateEnvironment(projectId: string, envId: string, name?: string, description?: string): Promise<unknown>;
|
|
37
38
|
export declare function promoteEnvironment(environmentId: string, targetTier: string): Promise<unknown>;
|
|
39
|
+
export interface McpUpdateEnvironmentParams {
|
|
40
|
+
projectId: string;
|
|
41
|
+
environmentId: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function mcpUpdateEnvironment(client: AscendKitClient, params: McpUpdateEnvironmentParams): Promise<unknown>;
|
|
38
46
|
export declare function mcpPromoteEnvironment(client: AscendKitClient, params: {
|
|
39
47
|
environmentId: string;
|
|
40
48
|
targetTier: string;
|
|
@@ -535,10 +535,27 @@ export async function mcpListEnvironments(client, projectId) {
|
|
|
535
535
|
export async function mcpCreateEnvironment(client, params) {
|
|
536
536
|
return client.platformRequest("POST", `/api/platform/projects/${params.projectId}/environments`, { name: params.name, description: params.description ?? "", tier: params.tier });
|
|
537
537
|
}
|
|
538
|
+
export async function updateEnvironment(projectId, envId, name, description) {
|
|
539
|
+
const auth = requireAuth();
|
|
540
|
+
const body = {};
|
|
541
|
+
if (name)
|
|
542
|
+
body.name = name;
|
|
543
|
+
if (description !== undefined)
|
|
544
|
+
body.description = description;
|
|
545
|
+
return apiRequest(auth.apiUrl, "PATCH", `/api/platform/projects/${projectId}/environments/${envId}`, body, auth.token);
|
|
546
|
+
}
|
|
538
547
|
export async function promoteEnvironment(environmentId, targetTier) {
|
|
539
548
|
const auth = requireAuth();
|
|
540
549
|
return apiRequest(auth.apiUrl, "POST", `/api/platform/environments/${environmentId}/promote`, { targetTier, dryRun: false }, auth.token);
|
|
541
550
|
}
|
|
551
|
+
export async function mcpUpdateEnvironment(client, params) {
|
|
552
|
+
const body = {};
|
|
553
|
+
if (params.name)
|
|
554
|
+
body.name = params.name;
|
|
555
|
+
if (params.description !== undefined)
|
|
556
|
+
body.description = params.description;
|
|
557
|
+
return client.platformRequest("PATCH", `/api/platform/projects/${params.projectId}/environments/${params.environmentId}`, body);
|
|
558
|
+
}
|
|
542
559
|
export async function mcpPromoteEnvironment(client, params) {
|
|
543
560
|
return client.platformRequest("POST", `/api/platform/environments/${params.environmentId}/promote`, { targetTier: params.targetTier, dryRun: false });
|
|
544
561
|
}
|
package/dist/mcp.js
CHANGED
|
File without changes
|
package/dist/tools/platform.js
CHANGED
|
@@ -66,7 +66,8 @@ export function registerPlatformTools(server, client) {
|
|
|
66
66
|
projectId: z.string().describe("Project ID (prj_ prefixed)"),
|
|
67
67
|
name: z
|
|
68
68
|
.string()
|
|
69
|
-
.
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Environment name. If omitted, derived from project name + tier."),
|
|
70
71
|
description: z
|
|
71
72
|
.string()
|
|
72
73
|
.optional()
|
|
@@ -100,6 +101,43 @@ export function registerPlatformTools(server, client) {
|
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
});
|
|
104
|
+
server.tool("platform_update_environment", "Update an environment's name or description.", {
|
|
105
|
+
projectId: z.string().describe("Project ID (prj_ prefixed)"),
|
|
106
|
+
environmentId: z.string().describe("Environment ID (env_ prefixed)"),
|
|
107
|
+
name: z.string().optional().describe("New environment name"),
|
|
108
|
+
description: z.string().optional().describe("New environment description"),
|
|
109
|
+
}, async (params) => {
|
|
110
|
+
if (!params.name && !params.description) {
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: "text", text: "At least one of name or description is required." }],
|
|
113
|
+
isError: true,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const data = await platform.mcpUpdateEnvironment(client, params);
|
|
118
|
+
return {
|
|
119
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
let message = err instanceof Error ? err.message : String(err);
|
|
124
|
+
const jsonMatch = message.match(/\{.*\}/s);
|
|
125
|
+
if (jsonMatch) {
|
|
126
|
+
try {
|
|
127
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
128
|
+
if (parsed.error)
|
|
129
|
+
message = parsed.error;
|
|
130
|
+
else if (parsed.detail)
|
|
131
|
+
message = parsed.detail;
|
|
132
|
+
}
|
|
133
|
+
catch { /* use raw message */ }
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text: message }],
|
|
137
|
+
isError: true,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|
|
103
141
|
server.tool("platform_promote_environment", "Promote an environment's configuration to a higher tier (dev → beta → prod).", {
|
|
104
142
|
environmentId: z.string().describe("Environment ID to promote"),
|
|
105
143
|
targetTier: z
|
package/package.json
CHANGED
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { AscendKitClient } from "./api/client.js";
|
|
5
|
-
import { registerAuthTools } from "./tools/auth.js";
|
|
6
|
-
import { registerContentTools } from "./tools/content.js";
|
|
7
|
-
import { registerSurveyTools } from "./tools/surveys.js";
|
|
8
|
-
const args = process.argv.slice(2);
|
|
9
|
-
const publicKey = args[0];
|
|
10
|
-
const apiUrl = args[1] ?? process.env.ASCENDKIT_API_URL ?? "http://localhost:8000";
|
|
11
|
-
if (!publicKey) {
|
|
12
|
-
console.error("Usage: ascendkit-mcp <public-key> [api-url]");
|
|
13
|
-
console.error(" public-key Your project's public key (pk_live_...)");
|
|
14
|
-
console.error(" api-url AscendKit API URL (default: http://localhost:8000)");
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
const client = new AscendKitClient({ apiUrl, publicKey });
|
|
18
|
-
const server = new McpServer({
|
|
19
|
-
name: "ascendkit",
|
|
20
|
-
version: "0.1.0",
|
|
21
|
-
});
|
|
22
|
-
registerAuthTools(server, client);
|
|
23
|
-
registerContentTools(server, client);
|
|
24
|
-
registerSurveyTools(server, client);
|
|
25
|
-
async function main() {
|
|
26
|
-
const transport = new StdioServerTransport();
|
|
27
|
-
await server.connect(transport);
|
|
28
|
-
}
|
|
29
|
-
main().catch(console.error);
|