@gpc-cli/plugin-ci 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GPC Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,22 @@
1
+ import * as _gpc_cli_plugin_sdk from '@gpc-cli/plugin-sdk';
2
+
3
+ declare const PLUGIN_CI_VERSION = "0.8.0";
4
+ interface CIEnvironment {
5
+ /** Whether we're running in a CI environment */
6
+ isCI: boolean;
7
+ /** CI provider name (if detected) */
8
+ provider?: string;
9
+ /** Build number or run ID */
10
+ buildId?: string;
11
+ /** Branch name */
12
+ branch?: string;
13
+ /** Commit SHA */
14
+ commitSha?: string;
15
+ /** Whether GitHub Actions step summary is available */
16
+ hasStepSummary: boolean;
17
+ }
18
+ declare function detectCIEnvironment(): CIEnvironment;
19
+ declare function writeStepSummary(markdown: string): Promise<void>;
20
+ declare const ciPlugin: _gpc_cli_plugin_sdk.GpcPlugin;
21
+
22
+ export { type CIEnvironment, PLUGIN_CI_VERSION, ciPlugin, detectCIEnvironment, writeStepSummary };
package/dist/index.js ADDED
@@ -0,0 +1,120 @@
1
+ // src/index.ts
2
+ import { definePlugin } from "@gpc-cli/plugin-sdk";
3
+ import { appendFile } from "fs/promises";
4
+ var PLUGIN_CI_VERSION = "0.8.0";
5
+ function detectCIEnvironment() {
6
+ const env = process.env;
7
+ if (env["GITHUB_ACTIONS"] === "true") {
8
+ return {
9
+ isCI: true,
10
+ provider: "github-actions",
11
+ buildId: env["GITHUB_RUN_ID"],
12
+ branch: env["GITHUB_REF_NAME"],
13
+ commitSha: env["GITHUB_SHA"],
14
+ hasStepSummary: !!env["GITHUB_STEP_SUMMARY"]
15
+ };
16
+ }
17
+ if (env["GITLAB_CI"] === "true") {
18
+ return {
19
+ isCI: true,
20
+ provider: "gitlab-ci",
21
+ buildId: env["CI_JOB_ID"],
22
+ branch: env["CI_COMMIT_BRANCH"],
23
+ commitSha: env["CI_COMMIT_SHA"],
24
+ hasStepSummary: false
25
+ };
26
+ }
27
+ if (env["JENKINS_URL"]) {
28
+ return {
29
+ isCI: true,
30
+ provider: "jenkins",
31
+ buildId: env["BUILD_NUMBER"],
32
+ branch: env["BRANCH_NAME"],
33
+ commitSha: env["GIT_COMMIT"],
34
+ hasStepSummary: false
35
+ };
36
+ }
37
+ if (env["CIRCLECI"] === "true") {
38
+ return {
39
+ isCI: true,
40
+ provider: "circleci",
41
+ buildId: env["CIRCLE_BUILD_NUM"],
42
+ branch: env["CIRCLE_BRANCH"],
43
+ commitSha: env["CIRCLE_SHA1"],
44
+ hasStepSummary: false
45
+ };
46
+ }
47
+ if (env["BITRISE_IO"] === "true") {
48
+ return {
49
+ isCI: true,
50
+ provider: "bitrise",
51
+ buildId: env["BITRISE_BUILD_NUMBER"],
52
+ branch: env["BITRISE_GIT_BRANCH"],
53
+ commitSha: env["BITRISE_GIT_COMMIT"],
54
+ hasStepSummary: false
55
+ };
56
+ }
57
+ if (env["CI"] === "true" || env["CI"] === "1") {
58
+ return {
59
+ isCI: true,
60
+ provider: "unknown",
61
+ hasStepSummary: false
62
+ };
63
+ }
64
+ return { isCI: false, hasStepSummary: false };
65
+ }
66
+ async function writeStepSummary(markdown) {
67
+ const summaryPath = process.env["GITHUB_STEP_SUMMARY"];
68
+ if (!summaryPath) return;
69
+ await appendFile(summaryPath, markdown + "\n");
70
+ }
71
+ function formatCommandSummary(event, result) {
72
+ const status = result.success ? "\u2705" : "\u274C";
73
+ const lines = [
74
+ `### ${status} \`gpc ${event.command}\``,
75
+ "",
76
+ `| Field | Value |`,
77
+ `|-------|-------|`,
78
+ `| App | \`${event.app ?? "N/A"}\` |`,
79
+ `| Duration | ${result.durationMs}ms |`,
80
+ `| Exit Code | ${result.exitCode} |`
81
+ ];
82
+ return lines.join("\n");
83
+ }
84
+ function formatErrorSummary(event, error) {
85
+ const lines = [
86
+ `### \u274C \`gpc ${event.command}\` failed`,
87
+ "",
88
+ `| Field | Value |`,
89
+ `|-------|-------|`,
90
+ `| App | \`${event.app ?? "N/A"}\` |`,
91
+ `| Error Code | \`${error.code}\` |`,
92
+ `| Message | ${error.message} |`
93
+ ];
94
+ return lines.join("\n");
95
+ }
96
+ var ciPlugin = definePlugin({
97
+ name: "@gpc-cli/plugin-ci",
98
+ version: PLUGIN_CI_VERSION,
99
+ register(hooks) {
100
+ const ci = detectCIEnvironment();
101
+ if (!ci.isCI) return;
102
+ hooks.afterCommand(async (event, result) => {
103
+ if (ci.hasStepSummary) {
104
+ await writeStepSummary(formatCommandSummary(event, result));
105
+ }
106
+ });
107
+ hooks.onError(async (event, error) => {
108
+ if (ci.hasStepSummary) {
109
+ await writeStepSummary(formatErrorSummary(event, error));
110
+ }
111
+ });
112
+ }
113
+ });
114
+ export {
115
+ PLUGIN_CI_VERSION,
116
+ ciPlugin,
117
+ detectCIEnvironment,
118
+ writeStepSummary
119
+ };
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { definePlugin } from \"@gpc-cli/plugin-sdk\";\nimport type { CommandEvent, CommandResult, PluginError } from \"@gpc-cli/plugin-sdk\";\n\nexport const PLUGIN_CI_VERSION = \"0.8.0\";\n\n// ---------------------------------------------------------------------------\n// CI environment detection\n// ---------------------------------------------------------------------------\n\nexport interface CIEnvironment {\n /** Whether we're running in a CI environment */\n isCI: boolean;\n\n /** CI provider name (if detected) */\n provider?: string;\n\n /** Build number or run ID */\n buildId?: string;\n\n /** Branch name */\n branch?: string;\n\n /** Commit SHA */\n commitSha?: string;\n\n /** Whether GitHub Actions step summary is available */\n hasStepSummary: boolean;\n}\n\nexport function detectCIEnvironment(): CIEnvironment {\n const env = process.env;\n\n // GitHub Actions\n if (env[\"GITHUB_ACTIONS\"] === \"true\") {\n return {\n isCI: true,\n provider: \"github-actions\",\n buildId: env[\"GITHUB_RUN_ID\"],\n branch: env[\"GITHUB_REF_NAME\"],\n commitSha: env[\"GITHUB_SHA\"],\n hasStepSummary: !!env[\"GITHUB_STEP_SUMMARY\"],\n };\n }\n\n // GitLab CI\n if (env[\"GITLAB_CI\"] === \"true\") {\n return {\n isCI: true,\n provider: \"gitlab-ci\",\n buildId: env[\"CI_JOB_ID\"],\n branch: env[\"CI_COMMIT_BRANCH\"],\n commitSha: env[\"CI_COMMIT_SHA\"],\n hasStepSummary: false,\n };\n }\n\n // Jenkins\n if (env[\"JENKINS_URL\"]) {\n return {\n isCI: true,\n provider: \"jenkins\",\n buildId: env[\"BUILD_NUMBER\"],\n branch: env[\"BRANCH_NAME\"],\n commitSha: env[\"GIT_COMMIT\"],\n hasStepSummary: false,\n };\n }\n\n // CircleCI\n if (env[\"CIRCLECI\"] === \"true\") {\n return {\n isCI: true,\n provider: \"circleci\",\n buildId: env[\"CIRCLE_BUILD_NUM\"],\n branch: env[\"CIRCLE_BRANCH\"],\n commitSha: env[\"CIRCLE_SHA1\"],\n hasStepSummary: false,\n };\n }\n\n // Bitrise\n if (env[\"BITRISE_IO\"] === \"true\") {\n return {\n isCI: true,\n provider: \"bitrise\",\n buildId: env[\"BITRISE_BUILD_NUMBER\"],\n branch: env[\"BITRISE_GIT_BRANCH\"],\n commitSha: env[\"BITRISE_GIT_COMMIT\"],\n hasStepSummary: false,\n };\n }\n\n // Generic CI detection\n if (env[\"CI\"] === \"true\" || env[\"CI\"] === \"1\") {\n return {\n isCI: true,\n provider: \"unknown\",\n hasStepSummary: false,\n };\n }\n\n return { isCI: false, hasStepSummary: false };\n}\n\n// ---------------------------------------------------------------------------\n// GitHub Actions step summary\n// ---------------------------------------------------------------------------\n\nimport { appendFile } from \"node:fs/promises\";\n\nexport async function writeStepSummary(markdown: string): Promise<void> {\n const summaryPath = process.env[\"GITHUB_STEP_SUMMARY\"];\n if (!summaryPath) return;\n await appendFile(summaryPath, markdown + \"\\n\");\n}\n\nfunction formatCommandSummary(event: CommandEvent, result: CommandResult): string {\n const status = result.success ? \"✅\" : \"❌\";\n const lines = [\n `### ${status} \\`gpc ${event.command}\\``,\n \"\",\n `| Field | Value |`,\n `|-------|-------|`,\n `| App | \\`${event.app ?? \"N/A\"}\\` |`,\n `| Duration | ${result.durationMs}ms |`,\n `| Exit Code | ${result.exitCode} |`,\n ];\n return lines.join(\"\\n\");\n}\n\nfunction formatErrorSummary(event: CommandEvent, error: PluginError): string {\n const lines = [\n `### ❌ \\`gpc ${event.command}\\` failed`,\n \"\",\n `| Field | Value |`,\n `|-------|-------|`,\n `| App | \\`${event.app ?? \"N/A\"}\\` |`,\n `| Error Code | \\`${error.code}\\` |`,\n `| Message | ${error.message} |`,\n ];\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Plugin definition\n// ---------------------------------------------------------------------------\n\nexport const ciPlugin = definePlugin({\n name: \"@gpc-cli/plugin-ci\",\n version: PLUGIN_CI_VERSION,\n\n register(hooks) {\n const ci = detectCIEnvironment();\n\n // Only activate hooks when running in CI\n if (!ci.isCI) return;\n\n hooks.afterCommand(async (event: CommandEvent, result: CommandResult) => {\n if (ci.hasStepSummary) {\n await writeStepSummary(formatCommandSummary(event, result));\n }\n });\n\n hooks.onError(async (event: CommandEvent, error: PluginError) => {\n if (ci.hasStepSummary) {\n await writeStepSummary(formatErrorSummary(event, error));\n }\n });\n },\n});\n"],"mappings":";AAAA,SAAS,oBAAoB;AA4G7B,SAAS,kBAAkB;AAzGpB,IAAM,oBAAoB;AA0B1B,SAAS,sBAAqC;AACnD,QAAM,MAAM,QAAQ;AAGpB,MAAI,IAAI,gBAAgB,MAAM,QAAQ;AACpC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,IAAI,eAAe;AAAA,MAC5B,QAAQ,IAAI,iBAAiB;AAAA,MAC7B,WAAW,IAAI,YAAY;AAAA,MAC3B,gBAAgB,CAAC,CAAC,IAAI,qBAAqB;AAAA,IAC7C;AAAA,EACF;AAGA,MAAI,IAAI,WAAW,MAAM,QAAQ;AAC/B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,IAAI,WAAW;AAAA,MACxB,QAAQ,IAAI,kBAAkB;AAAA,MAC9B,WAAW,IAAI,eAAe;AAAA,MAC9B,gBAAgB;AAAA,IAClB;AAAA,EACF;AAGA,MAAI,IAAI,aAAa,GAAG;AACtB,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,IAAI,cAAc;AAAA,MAC3B,QAAQ,IAAI,aAAa;AAAA,MACzB,WAAW,IAAI,YAAY;AAAA,MAC3B,gBAAgB;AAAA,IAClB;AAAA,EACF;AAGA,MAAI,IAAI,UAAU,MAAM,QAAQ;AAC9B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,IAAI,kBAAkB;AAAA,MAC/B,QAAQ,IAAI,eAAe;A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WAAW,aAAa;AAAA,EACnC,MAAM;AAAA,EACN,SAAS;AAAA,EAET,SAAS,OAAO;AACd,UAAM,KAAK,oBAAoB;AAG/B,QAAI,CAAC,GAAG,KAAM;AAEd,UAAM,aAAa,OAAO,OAAqB,WAA0B;AACvE,UAAI,GAAG,gBAAgB;AACrB,cAAM,iBAAiB,qBAAqB,OAAO,MAAM,CAAC;AAAA,MAC5D;AAAA,IACF,CAAC;AAED,UAAM,QAAQ,OAAO,OAAqB,UAAuB;AAC/D,UAAI,GAAG,gBAAgB;AACrB,cAAM,iBAAiB,mBAAmB,OAAO,KAAK,CAAC;AAAA,MACzD;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@gpc-cli/plugin-ci",
3
+ "version": "0.1.0",
4
+ "description": "CI/CD helpers for GPC",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "@gpc-cli/plugin-sdk": "0.1.0"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^25.3.5"
22
+ },
23
+ "keywords": [
24
+ "google-play",
25
+ "ci",
26
+ "plugin"
27
+ ],
28
+ "license": "MIT",
29
+ "scripts": {
30
+ "build": "tsup",
31
+ "dev": "tsup --watch",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "lint": "eslint src/",
35
+ "typecheck": "tsc --noEmit",
36
+ "clean": "rm -rf dist"
37
+ }
38
+ }