@pitcher/cli-scripts 2.7.1 → 2.9.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/README.md +59 -0
- package/dist/index.js +4 -0
- package/dist/src/commands/dsr.d.ts +36 -0
- package/dist/src/commands/dsr.js +229 -0
- package/dist/src/commands/mcp.d.ts +2 -0
- package/dist/src/commands/mcp.js +18 -0
- package/dist/src/commands/scaffolds.d.ts +1 -0
- package/dist/src/commands/scaffolds.js +24 -0
- package/dist/src/mcp/env.d.ts +7 -0
- package/dist/src/mcp/env.js +13 -0
- package/dist/src/mcp/registry.d.ts +2 -0
- package/dist/src/mcp/registry.js +46 -0
- package/dist/src/mcp/result.d.ts +13 -0
- package/dist/src/mcp/result.js +20 -0
- package/dist/src/mcp/serve.d.ts +1 -0
- package/dist/src/mcp/serve.js +13 -0
- package/dist/src/mcp/server.d.ts +3 -0
- package/dist/src/mcp/server.js +41 -0
- package/dist/src/mcp/tools/analytics.d.ts +2 -0
- package/dist/src/mcp/tools/analytics.js +20 -0
- package/dist/src/mcp/tools/announcements.d.ts +2 -0
- package/dist/src/mcp/tools/announcements.js +32 -0
- package/dist/src/mcp/tools/canvases.d.ts +2 -0
- package/dist/src/mcp/tools/canvases.js +30 -0
- package/dist/src/mcp/tools/devSync.d.ts +2 -0
- package/dist/src/mcp/tools/devSync.js +53 -0
- package/dist/src/mcp/tools/dsr.d.ts +2 -0
- package/dist/src/mcp/tools/dsr.js +47 -0
- package/dist/src/mcp/tools/dsrLanding.d.ts +2 -0
- package/dist/src/mcp/tools/dsrLanding.js +45 -0
- package/dist/src/mcp/tools/emailTemplate.d.ts +2 -0
- package/dist/src/mcp/tools/emailTemplate.js +47 -0
- package/dist/src/mcp/tools/files.d.ts +2 -0
- package/dist/src/mcp/tools/files.js +65 -0
- package/dist/src/mcp/tools/folders.d.ts +2 -0
- package/dist/src/mcp/tools/folders.js +56 -0
- package/dist/src/mcp/tools/groups.d.ts +2 -0
- package/dist/src/mcp/tools/groups.js +60 -0
- package/dist/src/mcp/tools/instances.d.ts +2 -0
- package/dist/src/mcp/tools/instances.js +28 -0
- package/dist/src/mcp/tools/invitations.d.ts +2 -0
- package/dist/src/mcp/tools/invitations.js +23 -0
- package/dist/src/mcp/tools/memberships.d.ts +2 -0
- package/dist/src/mcp/tools/memberships.js +47 -0
- package/dist/src/mcp/tools/metadataTemplate.d.ts +2 -0
- package/dist/src/mcp/tools/metadataTemplate.js +42 -0
- package/dist/src/mcp/tools/org.d.ts +2 -0
- package/dist/src/mcp/tools/org.js +12 -0
- package/dist/src/mcp/tools/publishApp.d.ts +2 -0
- package/dist/src/mcp/tools/publishApp.js +39 -0
- package/dist/src/mcp/tools/roles.d.ts +2 -0
- package/dist/src/mcp/tools/roles.js +15 -0
- package/dist/src/mcp/tools/search.d.ts +2 -0
- package/dist/src/mcp/tools/search.js +16 -0
- package/dist/src/mcp/tools/sharedLinks.d.ts +2 -0
- package/dist/src/mcp/tools/sharedLinks.js +27 -0
- package/dist/src/mcp/tools/tags.d.ts +2 -0
- package/dist/src/mcp/tools/tags.js +20 -0
- package/dist/src/mcp/tools/themes.d.ts +2 -0
- package/dist/src/mcp/tools/themes.js +28 -0
- package/dist/src/mcp/tools/types.d.ts +15 -0
- package/dist/src/mcp/tools/types.js +1 -0
- package/dist/src/mcp/tools/users.d.ts +2 -0
- package/dist/src/mcp/tools/users.js +31 -0
- package/package.json +4 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { runOrgGet } from '../../commands/org.js';
|
|
2
|
+
export const orgTools = [
|
|
3
|
+
{
|
|
4
|
+
name: 'pitcher_org_get',
|
|
5
|
+
title: 'Get the organization',
|
|
6
|
+
description: 'Retrieve the organization the API key belongs to. Response may include raw settings/metadata ' +
|
|
7
|
+
'(potentially integration credentials) — treat output as sensitive.',
|
|
8
|
+
inputShape: {},
|
|
9
|
+
run: runOrgGet,
|
|
10
|
+
readOnly: true,
|
|
11
|
+
},
|
|
12
|
+
];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runPublishApp } from '../../commands/publishApp.js';
|
|
3
|
+
// Narrow individual injected/validated values (the MCP zod schema already guarantees the runtime
|
|
4
|
+
// type) instead of casting the whole opts blob — same approach as the devSync wrappers.
|
|
5
|
+
const asString = (v) => (typeof v === 'string' ? v : undefined);
|
|
6
|
+
const asBool = (v) => (typeof v === 'boolean' ? v : undefined);
|
|
7
|
+
export const publishAppTools = [
|
|
8
|
+
{
|
|
9
|
+
name: 'pitcher_publish_app',
|
|
10
|
+
title: 'Publish an app release',
|
|
11
|
+
description: 'Zip a local app folder (on the MCP server host) and publish it as a new app release to the org, ' +
|
|
12
|
+
'optionally installing it to specific instances or all instances of an environment afterward. ' +
|
|
13
|
+
'Consequential: this creates a live, org-visible app release — use dryRun to preview first. ' +
|
|
14
|
+
'Re-publishing an already-existing version is a no-op (returns ok with a warning), not a failure. ' +
|
|
15
|
+
'Publish targets the org resolved from NG_ORG; the injected NG_URL is not used as the publish endpoint.',
|
|
16
|
+
inputShape: {
|
|
17
|
+
folder: z.string().optional().describe('Local folder to zip and publish (defaults to the MCP server cwd)'),
|
|
18
|
+
incrementVersion: z.boolean().optional().describe('Bump the version in app.json before publishing'),
|
|
19
|
+
dryRun: z.boolean().optional().describe('Preview the publish (version, target) without publishing anything'),
|
|
20
|
+
installTo: z.string().optional().describe('Comma-separated instance IDs to install the app to after publishing'),
|
|
21
|
+
installToEnvName: z.string().optional().describe('Environment name (e.g. "test") to install the app to after publishing'),
|
|
22
|
+
},
|
|
23
|
+
// runPublishApp overloads `url` as BOTH origin and publish endpoint; the server injects NG_URL into
|
|
24
|
+
// every tool, so forward only apiKey + org (never url) plus this tool's own inputs.
|
|
25
|
+
run: (opts) => runPublishApp({
|
|
26
|
+
folder: asString(opts.folder),
|
|
27
|
+
incrementVersion: asBool(opts.incrementVersion),
|
|
28
|
+
dryRun: asBool(opts.dryRun),
|
|
29
|
+
installTo: asString(opts.installTo),
|
|
30
|
+
installToEnvName: asString(opts.installToEnvName),
|
|
31
|
+
apiKey: opts.apiKey,
|
|
32
|
+
org: opts.org,
|
|
33
|
+
}),
|
|
34
|
+
wraps: runPublishApp,
|
|
35
|
+
readOnly: false,
|
|
36
|
+
write: true,
|
|
37
|
+
alwaysDestructive: true,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runRolesList } from '../../commands/roles.js';
|
|
3
|
+
export const rolesTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_roles_list',
|
|
6
|
+
title: 'List roles',
|
|
7
|
+
description: 'List the org role set (system + custom roles) — use to discover valid short role names ' +
|
|
8
|
+
'before setting a membership role. Needs an org-admin key.',
|
|
9
|
+
inputShape: {
|
|
10
|
+
scope: z.enum(['instance', 'organization']).optional().describe('Filter by scope'),
|
|
11
|
+
},
|
|
12
|
+
run: runRolesList,
|
|
13
|
+
readOnly: true,
|
|
14
|
+
},
|
|
15
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runSearch } from '../../commands/search.js';
|
|
3
|
+
export const searchTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_search',
|
|
6
|
+
title: 'Search content',
|
|
7
|
+
description: 'Cross-type ranked search across an instance (files, canvases, users, apps). Use to find content by keyword when the ID is unknown.',
|
|
8
|
+
inputShape: {
|
|
9
|
+
instanceId: z.string().describe('Instance ID (required)'),
|
|
10
|
+
query: z.string().describe('Search query (required)'),
|
|
11
|
+
includeExpired: z.boolean().optional().describe('Include expired content'),
|
|
12
|
+
},
|
|
13
|
+
run: runSearch,
|
|
14
|
+
readOnly: true,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runSharedLinksCreate, runSharedLinksGet } from '../../commands/sharedLinks.js';
|
|
3
|
+
export const sharedLinksTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_shared_links_create',
|
|
6
|
+
title: 'Create a shared link',
|
|
7
|
+
description: 'Create a share link (short_url) for a canvas or a file. Pass exactly one of canvasId or fileId. Additive.',
|
|
8
|
+
inputShape: {
|
|
9
|
+
canvasId: z.string().optional().describe('Canvas to share (exactly one of canvasId/fileId is required)'),
|
|
10
|
+
fileId: z.string().optional().describe('File to share (exactly one of canvasId/fileId is required)'),
|
|
11
|
+
},
|
|
12
|
+
run: runSharedLinksCreate,
|
|
13
|
+
readOnly: false,
|
|
14
|
+
write: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'pitcher_shared_links_get',
|
|
18
|
+
title: 'Get a shared link',
|
|
19
|
+
description: 'Retrieve the existing share link for a canvas or a file. Pass exactly one of canvasId or fileId.',
|
|
20
|
+
inputShape: {
|
|
21
|
+
canvasId: z.string().optional().describe('Canvas whose link to fetch (exactly one of canvasId/fileId is required)'),
|
|
22
|
+
fileId: z.string().optional().describe('File whose link to fetch (exactly one of canvasId/fileId is required)'),
|
|
23
|
+
},
|
|
24
|
+
run: runSharedLinksGet,
|
|
25
|
+
readOnly: true,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runTagsList } from '../../commands/tags.js';
|
|
3
|
+
export const tagsTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_tags_list',
|
|
6
|
+
title: 'List tags',
|
|
7
|
+
description: 'List tags in an instance matching a search term (at least 3 characters). Use to discover tag values before filtering files/canvases.',
|
|
8
|
+
inputShape: {
|
|
9
|
+
instanceId: z.string().describe('Instance ID (required)'),
|
|
10
|
+
search: z.string().min(3).describe('Search term (required, at least 3 characters)'),
|
|
11
|
+
type: z.enum(['files', 'canvases']).optional(),
|
|
12
|
+
canvasType: z.string().optional().describe('Canvas type filter'),
|
|
13
|
+
includeHidden: z.boolean().optional().describe('Include hidden tags'),
|
|
14
|
+
page: z.number().int().optional(),
|
|
15
|
+
pageSize: z.number().int().optional().describe('Page size (max 500)'),
|
|
16
|
+
},
|
|
17
|
+
run: runTagsList,
|
|
18
|
+
readOnly: true,
|
|
19
|
+
},
|
|
20
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runThemesList, runThemesGet } from '../../commands/themes.js';
|
|
3
|
+
export const themesTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_themes_list',
|
|
6
|
+
title: 'List themes',
|
|
7
|
+
description: 'List canvas/branding themes (colors, fonts, assets) in the org. Omit instanceId to see all ' +
|
|
8
|
+
'org-level and instance themes; set it to narrow to themes bound to that instance.',
|
|
9
|
+
inputShape: {
|
|
10
|
+
instanceId: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Filter to themes bound to this instance (excludes org-level themes)'),
|
|
14
|
+
withUsage: z.boolean().optional().describe('Include a per-theme count of canvases using it'),
|
|
15
|
+
withCanvasIds: z.boolean().optional().describe('Include the canvas ids using each theme'),
|
|
16
|
+
},
|
|
17
|
+
run: runThemesList,
|
|
18
|
+
readOnly: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'pitcher_themes_get',
|
|
22
|
+
title: 'Get a theme',
|
|
23
|
+
description: 'Retrieve a single theme by its ID.',
|
|
24
|
+
inputShape: { id: z.string().describe('Theme ID') },
|
|
25
|
+
run: runThemesGet,
|
|
26
|
+
readOnly: true,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { Envelope } from '../../core/envelope.js';
|
|
3
|
+
import type { CommonOpts } from '../../core/http.js';
|
|
4
|
+
export type InjectedAuth = Pick<CommonOpts, 'apiKey' | 'org' | 'url'>;
|
|
5
|
+
export interface ToolDescriptor {
|
|
6
|
+
name: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputShape: z.ZodRawShape;
|
|
10
|
+
run: (opts: Record<string, unknown> & InjectedAuth, deps?: any) => Promise<Envelope<unknown>>;
|
|
11
|
+
wraps?: (...a: any[]) => unknown;
|
|
12
|
+
readOnly: boolean;
|
|
13
|
+
write?: boolean;
|
|
14
|
+
alwaysDestructive?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runUsersList, runUsersGet } from '../../commands/users.js';
|
|
3
|
+
export const usersTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'pitcher_users_list',
|
|
6
|
+
title: 'List users',
|
|
7
|
+
description: 'List users in the org. Use filters to narrow by instance membership, role, or active status.',
|
|
8
|
+
inputShape: {
|
|
9
|
+
instanceId: z.string().optional().describe('Filter to users with a membership in this instance'),
|
|
10
|
+
instanceRole: z.string().optional().describe('Filter by instance role (requires instanceId server-side)'),
|
|
11
|
+
role: z.string().optional().describe('Filter by org role'),
|
|
12
|
+
isActive: z
|
|
13
|
+
.literal(true)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Filter to active users only (only true is meaningful; false is a no-op)'),
|
|
16
|
+
cdg: z.string().optional().describe('Filter to members of this content-distribution group'),
|
|
17
|
+
page: z.number().int().optional().describe('Page number'),
|
|
18
|
+
pageSize: z.number().int().optional().describe('Page size (max 500)'),
|
|
19
|
+
},
|
|
20
|
+
run: runUsersList,
|
|
21
|
+
readOnly: true,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'pitcher_users_get',
|
|
25
|
+
title: 'Get a user',
|
|
26
|
+
description: 'Retrieve a single user by ID.',
|
|
27
|
+
inputShape: { id: z.string().describe('User ID (integer)') },
|
|
28
|
+
run: runUsersGet,
|
|
29
|
+
readOnly: true,
|
|
30
|
+
},
|
|
31
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pitcher/cli-scripts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "The Pitcher CLI for various tasks in its ecosystem.",
|
|
5
5
|
"author": "Pitcher AG",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
"vitest": "^4.1.9"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1",
|
|
34
35
|
"archiver": "^7.0.1",
|
|
35
36
|
"axios": "^1.18.1",
|
|
36
37
|
"chokidar": "^5.0.0",
|
|
37
38
|
"commander": "^14.0.3",
|
|
38
|
-
"form-data": "^4.0.6"
|
|
39
|
+
"form-data": "^4.0.6",
|
|
40
|
+
"zod": "^3"
|
|
39
41
|
}
|
|
40
42
|
}
|