@pitcher/cli-scripts 2.21.0 → 3.0.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 +42 -41
- package/dist/index.js +4 -0
- package/dist/src/commands/analytics.d.ts +3 -3
- package/dist/src/commands/analytics.js +8 -6
- package/dist/src/commands/announcements.js +24 -3
- package/dist/src/commands/devSync.d.ts +3 -1
- package/dist/src/commands/devSync.js +17 -14
- package/dist/src/commands/login.d.ts +83 -0
- package/dist/src/commands/login.js +348 -0
- package/dist/src/commands/mcp.js +4 -3
- package/dist/src/commands/publishApp.d.ts +2 -1
- package/dist/src/commands/publishApp.js +10 -7
- package/dist/src/commands/withAuth.d.ts +5 -1
- package/dist/src/commands/withAuth.js +8 -3
- package/dist/src/core/credential.d.ts +4 -16
- package/dist/src/core/credential.js +1 -25
- package/dist/src/core/http.d.ts +15 -7
- package/dist/src/core/http.js +33 -21
- package/dist/src/core/kpiTypes.d.ts +9 -0
- package/dist/src/core/kpiTypes.js +23 -0
- package/dist/src/core/ld.d.ts +3 -2
- package/dist/src/core/ld.js +45 -24
- package/dist/src/core/pitcherAuth.d.ts +86 -0
- package/dist/src/core/pitcherAuth.js +143 -0
- package/dist/src/core/session.d.ts +90 -0
- package/dist/src/core/session.js +293 -0
- package/dist/src/core/target.d.ts +47 -0
- package/dist/src/core/target.js +114 -0
- package/dist/src/mcp/local.d.ts +6 -0
- package/dist/src/mcp/local.js +8 -0
- package/dist/src/mcp/serve.d.ts +19 -4
- package/dist/src/mcp/serve.js +38 -15
- package/dist/src/mcp/server.d.ts +3 -1
- package/dist/src/mcp/server.js +2 -6
- package/dist/src/mcp/tools/analytics.js +3 -2
- package/dist/src/mcp/tools/publishApp.js +3 -3
- package/package.json +11 -6
- package/dist/src/core/auth.d.ts +0 -3
- package/dist/src/core/auth.js +0 -10
- package/dist/src/mcp/bundled.d.ts +0 -4
- package/dist/src/mcp/bundled.js +0 -25
- package/dist/src/mcp/env.d.ts +0 -7
- package/dist/src/mcp/env.js +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pitcher/cli-scripts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "The Pitcher CLI for various tasks in its ecosystem.",
|
|
5
5
|
"author": "Pitcher AG",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,15 +21,19 @@
|
|
|
21
21
|
"types": "./dist/src/mcp/index.d.ts",
|
|
22
22
|
"import": "./dist/src/mcp/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./auth": {
|
|
25
|
+
"types": "./dist/src/core/pitcherAuth.d.ts",
|
|
26
|
+
"import": "./dist/src/core/pitcherAuth.js"
|
|
27
|
+
},
|
|
24
28
|
"./package.json": "./package.json"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
27
31
|
"build": "tsc",
|
|
28
|
-
"type-check": "tsc --noEmit
|
|
32
|
+
"type-check": "tsc --noEmit",
|
|
29
33
|
"test": "vitest run",
|
|
30
34
|
"test:watch": "vitest",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
35
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
36
|
+
"prepublishOnly": "yarn clean && yarn build"
|
|
33
37
|
},
|
|
34
38
|
"bin": {
|
|
35
39
|
"p": "./dist/index.js"
|
|
@@ -37,11 +41,12 @@
|
|
|
37
41
|
"files": [
|
|
38
42
|
"dist"
|
|
39
43
|
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22.12.0"
|
|
46
|
+
},
|
|
40
47
|
"devDependencies": {
|
|
41
|
-
"@anthropic-ai/mcpb": "^2.1.2",
|
|
42
48
|
"@types/archiver": "^8.0.0",
|
|
43
49
|
"@types/node": "^24.13.5",
|
|
44
|
-
"esbuild": "^0.28.1",
|
|
45
50
|
"typescript": "^6.0.3",
|
|
46
51
|
"vitest": "^5.0.1"
|
|
47
52
|
},
|
package/dist/src/core/auth.d.ts
DELETED
package/dist/src/core/auth.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createCliError } from './errors.js';
|
|
2
|
-
export function resolveApiKey(opts, env = process.env) {
|
|
3
|
-
const flagKey = opts.apiKey?.trim();
|
|
4
|
-
if (flagKey)
|
|
5
|
-
return flagKey;
|
|
6
|
-
const envKey = env.NG_API_KEY?.trim();
|
|
7
|
-
if (envKey)
|
|
8
|
-
return envKey;
|
|
9
|
-
throw createCliError('AUTH', 'API key is required. Provide --api-key or set the NG_API_KEY environment variable.');
|
|
10
|
-
}
|
package/dist/src/mcp/bundled.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { allTools } from './registry.js';
|
|
2
|
-
// Developer-only tools excluded from the consumer .mcpb bundle. `publish_app` is alwaysDestructive
|
|
3
|
-
// (creates a live, org-visible app release); `dev_sync`/`dev_sync_revert` mutate remote S3 dev state.
|
|
4
|
-
// None are relevant to a non-technical adopter installing the extension. The CLI `p mcp` registers every tool.
|
|
5
|
-
export const BUNDLE_EXCLUDED_TOOLS = new Set(['pitcher_publish_app', 'pitcher_dev_sync', 'pitcher_dev_sync_revert']);
|
|
6
|
-
// The tool set the .mcpb bundle registers.
|
|
7
|
-
export const bundledTools = allTools.filter((t) => !BUNDLE_EXCLUDED_TOOLS.has(t.name));
|
|
8
|
-
// resolveBaseUrl interpolates NG_ORG into `https://<org>.my.pitcher.com`, so anything that is
|
|
9
|
-
// already a host (a full URL, or a bare hostname like "acme.my.pitcher.com") must route via NG_URL
|
|
10
|
-
// instead — otherwise it becomes a double-interpolated garbage host. The .mcpb install form accepts
|
|
11
|
-
// a subdomain, hostname, or full URL in one `org` field; this moves host-shaped values to NG_URL
|
|
12
|
-
// before the server reads env. A plain subdomain (no dot) stays in NG_ORG. Mutates env in place.
|
|
13
|
-
export function normalizeOrgUrl(env) {
|
|
14
|
-
const org = env.NG_ORG?.trim();
|
|
15
|
-
if (!org)
|
|
16
|
-
return;
|
|
17
|
-
if (/^https?:\/\//i.test(org)) {
|
|
18
|
-
env.NG_URL = org;
|
|
19
|
-
delete env.NG_ORG;
|
|
20
|
-
}
|
|
21
|
-
else if (org.includes('.')) {
|
|
22
|
-
env.NG_URL = `https://${org}`;
|
|
23
|
-
delete env.NG_ORG;
|
|
24
|
-
}
|
|
25
|
-
}
|
package/dist/src/mcp/env.d.ts
DELETED
package/dist/src/mcp/env.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createCliError } from '../core/errors.js';
|
|
2
|
-
export function resolveMcpEnv(env = process.env) {
|
|
3
|
-
const apiKey = env.NG_API_KEY?.trim();
|
|
4
|
-
if (!apiKey) {
|
|
5
|
-
throw createCliError('AUTH', 'NG_API_KEY is required to run the MCP server (set it in the host config env).');
|
|
6
|
-
}
|
|
7
|
-
const org = env.NG_ORG?.trim() || 'dev';
|
|
8
|
-
const url = env.NG_URL?.trim() || undefined;
|
|
9
|
-
const ngEnv = env.NG_ENV?.trim();
|
|
10
|
-
const isDevHost = url ? /\/\/dev\.my\.pitcher\.com(\/|$)/.test(url) : org === 'dev';
|
|
11
|
-
const prod = ngEnv === 'prod' ? true : ngEnv === 'test' ? false : !isDevHost;
|
|
12
|
-
return { apiKey, org, url, prod };
|
|
13
|
-
}
|