@pmate/cli 0.10.1 → 0.11.1
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 +25 -0
- package/dist/appDir.js +1 -2
- package/dist/appDir.js.map +1 -1
- package/dist/commands/AgentCommandHandler.js +3 -1
- package/dist/commands/AgentCommandHandler.js.map +1 -1
- package/dist/commands/DeployCommandHandler.d.ts +3 -1
- package/dist/commands/DeployCommandHandler.js +15 -3
- package/dist/commands/DeployCommandHandler.js.map +1 -1
- package/dist/commands/InitCommandHandler.d.ts +1 -0
- package/dist/commands/InitCommandHandler.js +9 -2
- package/dist/commands/InitCommandHandler.js.map +1 -1
- package/dist/commands/LogCommandHandler.d.ts +3 -1
- package/dist/commands/LogCommandHandler.js +59 -8
- package/dist/commands/LogCommandHandler.js.map +1 -1
- package/dist/commands/VercelCommandHandler.d.ts +38 -0
- package/dist/commands/VercelCommandHandler.js +126 -0
- package/dist/commands/VercelCommandHandler.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +74 -2
- package/dist/index.js.map +1 -1
- package/dist/tests/VercelCommandHandler.test.d.ts +1 -0
- package/dist/tests/VercelCommandHandler.test.js +84 -0
- package/dist/tests/VercelCommandHandler.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +41 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/tests/pythonAppSupport.test.d.ts +1 -0
- package/dist/tests/pythonAppSupport.test.js +47 -0
- package/dist/tests/pythonAppSupport.test.js.map +1 -0
- package/dist/tests/vercelParser.test.d.ts +1 -0
- package/dist/tests/vercelParser.test.js +39 -0
- package/dist/tests/vercelParser.test.js.map +1 -0
- package/dist/types.d.ts +28 -3
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +11 -12
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const appDir_1 = require("../appDir");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const LogCommandHandler_1 = require("../commands/LogCommandHandler");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
11
|
+
(0, vitest_1.describe)("python app support", () => {
|
|
12
|
+
(0, vitest_1.it)("allows repo root as an app dir", () => {
|
|
13
|
+
const repoRoot = "/tmp/demo-repo";
|
|
14
|
+
(0, vitest_1.expect)((0, appDir_1.resolveLocalAppDir)(repoRoot, "demo", ".")).toBe(repoRoot);
|
|
15
|
+
});
|
|
16
|
+
(0, vitest_1.it)("uses script logs for python apps", async () => {
|
|
17
|
+
const tempDir = (0, node_fs_1.mkdtempSync)(node_path_1.default.join(node_os_1.default.tmpdir(), "pmate-python-log-"));
|
|
18
|
+
const repoDir = node_path_1.default.join(tempDir, "repo");
|
|
19
|
+
(0, node_fs_1.mkdirSync)(repoDir, { recursive: true });
|
|
20
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(repoDir, ".pmate.yaml"), [
|
|
21
|
+
"domain: pmate.chat",
|
|
22
|
+
"apps:",
|
|
23
|
+
" - type: python",
|
|
24
|
+
" app: speech",
|
|
25
|
+
" dir: .",
|
|
26
|
+
" server: 127.0.0.1",
|
|
27
|
+
" repository: parrot-mate/pmate-py",
|
|
28
|
+
" script: scripts/asr",
|
|
29
|
+
].join("\n"));
|
|
30
|
+
const handler = new LogCommandHandler_1.LogCommandHandler();
|
|
31
|
+
const scriptSpy = vitest_1.vi
|
|
32
|
+
.spyOn(handler, "runRemoteScriptLog")
|
|
33
|
+
.mockResolvedValue(undefined);
|
|
34
|
+
try {
|
|
35
|
+
await handler.handle({
|
|
36
|
+
type: types_1.Command.Log,
|
|
37
|
+
logApp: "speech",
|
|
38
|
+
logCwd: repoDir,
|
|
39
|
+
});
|
|
40
|
+
(0, vitest_1.expect)(scriptSpy).toHaveBeenCalledOnce();
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
(0, node_fs_1.rmSync)(tempDir, { recursive: true, force: true });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=pythonAppSupport.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythonAppSupport.test.js","sourceRoot":"","sources":["../../src/tests/pythonAppSupport.test.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AACjD,sCAA8C;AAC9C,oCAAkC;AAClC,qEAAiE;AACjE,qCAAuE;AACvE,8DAAwB;AACxB,kEAA4B;AAE5B,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,WAAE,EAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,QAAQ,GAAG,gBAAgB,CAAA;QACjC,IAAA,eAAM,EAAC,IAAA,2BAAkB,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;IAEF,IAAA,WAAE,EAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAA;QACxE,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1C,IAAA,mBAAS,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACvC,IAAA,uBAAa,EACX,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,EACjC;YACE,oBAAoB;YACpB,OAAO;YACP,kBAAkB;YAClB,iBAAiB;YACjB,YAAY;YACZ,uBAAuB;YACvB,sCAAsC;YACtC,yBAAyB;SAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAA;QAED,MAAM,OAAO,GAAG,IAAI,qCAAiB,EAAS,CAAA;QAC9C,MAAM,SAAS,GAAG,WAAE;aACjB,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC;aACpC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QAE/B,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,eAAO,CAAC,GAAG;gBACjB,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,OAAO;aAChB,CAAC,CAAA;YACF,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,oBAAoB,EAAE,CAAA;QAC1C,CAAC;gBAAS,CAAC;YACT,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACnD,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
(0, vitest_1.describe)("pmate vercel parser", () => {
|
|
7
|
+
(0, vitest_1.it)("parses projects with optional scope", () => {
|
|
8
|
+
(0, vitest_1.expect)((0, index_1.parseCommandArgs)({
|
|
9
|
+
help: false,
|
|
10
|
+
version: false,
|
|
11
|
+
rest: ["vercel", "projects", "--scope", "pancakeswap"],
|
|
12
|
+
})).toEqual({
|
|
13
|
+
type: types_1.Command.Vercel,
|
|
14
|
+
action: "projects",
|
|
15
|
+
scope: "pancakeswap",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
(0, vitest_1.it)("parses deploys with project and last-week", () => {
|
|
19
|
+
(0, vitest_1.expect)((0, index_1.parseCommandArgs)({
|
|
20
|
+
help: false,
|
|
21
|
+
version: false,
|
|
22
|
+
rest: ["vercel", "deploys", "--project", "web", "--last-week"],
|
|
23
|
+
})).toEqual({
|
|
24
|
+
type: types_1.Command.Vercel,
|
|
25
|
+
action: "deploys",
|
|
26
|
+
project: "web",
|
|
27
|
+
scope: undefined,
|
|
28
|
+
lastWeek: true,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.it)("rejects deploys without project", () => {
|
|
32
|
+
(0, vitest_1.expect)(() => (0, index_1.parseCommandArgs)({
|
|
33
|
+
help: false,
|
|
34
|
+
version: false,
|
|
35
|
+
rest: ["vercel", "deploys", "--last-week"],
|
|
36
|
+
})).toThrow(/Missing --project/);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=vercelParser.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelParser.test.js","sourceRoot":"","sources":["../../src/tests/vercelParser.test.ts"],"names":[],"mappings":";;AAAA,mCAA6C;AAC7C,oCAA2C;AAC3C,oCAAkC;AAElC,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,WAAE,EAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,IAAA,eAAM,EACJ,IAAA,wBAAgB,EAAC;YACf,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC;SACvD,CAAC,CACH,CAAC,OAAO,CAAC;YACR,IAAI,EAAE,eAAO,CAAC,MAAM;YACpB,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,aAAa;SACrB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAA,WAAE,EAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,IAAA,eAAM,EACJ,IAAA,wBAAgB,EAAC;YACf,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,CAAC;SAC/D,CAAC,CACH,CAAC,OAAO,CAAC;YACR,IAAI,EAAE,eAAO,CAAC,MAAM;YACpB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAA,WAAE,EAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,IAAA,eAAM,EAAC,GAAG,EAAE,CACV,IAAA,wBAAgB,EAAC;YACf,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC;SAC3C,CAAC,CACH,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -34,7 +34,18 @@ export type RustProjectConfig = {
|
|
|
34
34
|
script: string;
|
|
35
35
|
serviceType?: "rest" | "ws";
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
37
|
+
export type PythonProjectConfig = {
|
|
38
|
+
type: "python";
|
|
39
|
+
app: string;
|
|
40
|
+
dir: string;
|
|
41
|
+
subdomain?: string;
|
|
42
|
+
server: string;
|
|
43
|
+
port?: number;
|
|
44
|
+
repository?: string;
|
|
45
|
+
script: string;
|
|
46
|
+
serviceType?: "rest" | "ws";
|
|
47
|
+
};
|
|
48
|
+
export type ProjectConfig = ViteProjectConfig | NodeProjectConfig | RustProjectConfig | PythonProjectConfig | StaticProjectConfig;
|
|
38
49
|
export interface PmateConfig {
|
|
39
50
|
apps: ProjectConfig[];
|
|
40
51
|
domain: string;
|
|
@@ -60,7 +71,8 @@ export declare enum Command {
|
|
|
60
71
|
Qrcode = "qrcode",
|
|
61
72
|
Random = "random",
|
|
62
73
|
Collect = "collect",
|
|
63
|
-
Agent = "agent"
|
|
74
|
+
Agent = "agent",
|
|
75
|
+
Vercel = "vercel"
|
|
64
76
|
}
|
|
65
77
|
export type NoneCommandArgs = {
|
|
66
78
|
type: Command.None;
|
|
@@ -328,4 +340,17 @@ export type AgentCommandArgs = {
|
|
|
328
340
|
baseUrl?: string;
|
|
329
341
|
json: boolean;
|
|
330
342
|
};
|
|
331
|
-
export type
|
|
343
|
+
export type VercelProjectsCommandArgs = {
|
|
344
|
+
type: Command.Vercel;
|
|
345
|
+
action: "projects";
|
|
346
|
+
scope?: string;
|
|
347
|
+
};
|
|
348
|
+
export type VercelDeploysCommandArgs = {
|
|
349
|
+
type: Command.Vercel;
|
|
350
|
+
action: "deploys";
|
|
351
|
+
project: string;
|
|
352
|
+
scope?: string;
|
|
353
|
+
lastWeek: boolean;
|
|
354
|
+
};
|
|
355
|
+
export type VercelCommandArgs = VercelProjectsCommandArgs | VercelDeploysCommandArgs;
|
|
356
|
+
export type CommandArgs = NoneCommandArgs | ListCommandArgs | LoginCommandArgs | AddDnsCommandArgs | StsCommandArgs | BucketCommandArgs | DeployCommandArgs | LogCommandArgs | InitCommandArgs | DevCommandArgs | EnvCommandArgs | PrCommandArgs | CommitCommandArgs | SummaryCommandArgs | LinearCommandArgs | NotionCommandArgs | OssCommandArgs | QrcodeCommandArgs | RandomCommandArgs | CollectCommandArgs | AgentCommandArgs | VercelCommandArgs;
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAgEA,IAAY,OAuBX;AAvBD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,6BAAkB,CAAA;IAClB,sBAAW,CAAA;IACX,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,sBAAW,CAAA;IACX,sBAAW,CAAA;IACX,oBAAS,CAAA;IACT,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;IACnB,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;IACjB,sBAAW,CAAA;IACX,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;IACnB,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EAvBW,OAAO,uBAAP,OAAO,QAuBlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pmate/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "CLI utilities for the pMate project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "npm run clean && tsc -p tsconfig.json && node scripts/copy-templates.js",
|
|
16
|
-
"clean": "rimraf dist",
|
|
17
|
-
"dev": "ts-node src/index.ts",
|
|
18
|
-
"release": "npm publish",
|
|
19
|
-
"start": "node dist/index.js",
|
|
20
|
-
"test": "vitest run src/tests",
|
|
21
|
-
"typecheck": "tsc --noEmit",
|
|
22
|
-
"prepare": "npm run build"
|
|
23
|
-
},
|
|
24
14
|
"keywords": [
|
|
25
15
|
"cli",
|
|
26
16
|
"typescript",
|
|
@@ -57,5 +47,14 @@
|
|
|
57
47
|
"ts-node": "^10.9.2",
|
|
58
48
|
"typescript": "^5.9.3",
|
|
59
49
|
"vitest": "^4.0.17"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "npm run clean && tsc -p tsconfig.json && node scripts/copy-templates.js",
|
|
53
|
+
"clean": "rimraf dist",
|
|
54
|
+
"dev": "ts-node src/index.ts",
|
|
55
|
+
"release": "npm publish",
|
|
56
|
+
"start": "node dist/index.js",
|
|
57
|
+
"test": "vitest run src/tests",
|
|
58
|
+
"typecheck": "tsc --noEmit"
|
|
60
59
|
}
|
|
61
|
-
}
|
|
60
|
+
}
|