@bytesbrains/pi-ci-gate 1.1.1 → 1.1.2
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 +7 -7
- package/package.json +1 -1
- package/src/config.ts +4 -3
- package/src/helpers.ts +4 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CI Gate for Pi
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/pi-ci-gate)
|
|
4
|
-
[](./LICENSE)
|
|
3
|
+
[](https://www.npmjs.com/package/@bytesbrains/pi-ci-gate)
|
|
4
|
+
[](./LICENSE)
|
|
5
5
|
|
|
6
6
|
> CI observability gate for AI agents — view workflow runs, job statuses, and logs from Gitea Actions with safety controls. **Agents self-diagnose CI failures instead of asking humans.**
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
pi install npm
|
|
18
|
+
pi install npm:@bytesbrains/pi-ci-gate
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Tools
|
|
@@ -92,10 +92,10 @@ ci_get_run(42) ← verify it passed ✅
|
|
|
92
92
|
Install all four gates for full agent governance:
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
pi install npm
|
|
96
|
-
pi install npm
|
|
97
|
-
pi install npm
|
|
98
|
-
pi install npm
|
|
95
|
+
pi install npm:@bytesbrains/pi-contrib-gate
|
|
96
|
+
pi install npm:@bytesbrains/pi-review-gate
|
|
97
|
+
pi install npm:@bytesbrains/pi-project-gate
|
|
98
|
+
pi install npm:@bytesbrains/pi-ci-gate
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
## License
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -37,8 +37,10 @@ export function loadConfig(cwd: string): CiConfig {
|
|
|
37
37
|
result[m[1]] = val;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
const maxLogLines = parseInt(result["maxLogLines"] as string);
|
|
41
|
+
const defaultLimit = parseInt(result["defaultLimit"] as string);
|
|
40
42
|
return {
|
|
41
|
-
maxLogLines:
|
|
43
|
+
maxLogLines: isNaN(maxLogLines) ? DEFAULT_CONFIG.maxLogLines : maxLogLines,
|
|
42
44
|
allowRerun:
|
|
43
45
|
result["allowRerun"] !== undefined
|
|
44
46
|
? result["allowRerun"] === "true"
|
|
@@ -47,8 +49,7 @@ export function loadConfig(cwd: string): CiConfig {
|
|
|
47
49
|
result["allowCancel"] !== undefined
|
|
48
50
|
? result["allowCancel"] === "true"
|
|
49
51
|
: DEFAULT_CONFIG.allowCancel,
|
|
50
|
-
defaultLimit:
|
|
51
|
-
parseInt(result["defaultLimit"] as string) || DEFAULT_CONFIG.defaultLimit,
|
|
52
|
+
defaultLimit: isNaN(defaultLimit) ? DEFAULT_CONFIG.defaultLimit : defaultLimit,
|
|
52
53
|
};
|
|
53
54
|
} catch {
|
|
54
55
|
return { ...DEFAULT_CONFIG };
|
package/src/helpers.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as cp from "node:child_process";
|
|
2
2
|
|
|
3
|
+
// ⚠️ SYNC-MARKER: exec(), resolveGitea(), giteaApi() are duplicated across packages.
|
|
4
|
+
// If changing behavior here, update all copies in: ci-gate, contrib-gate, review-gate, project-gate
|
|
3
5
|
export function exec(
|
|
4
6
|
cmd: string,
|
|
5
7
|
cwd?: string,
|
|
@@ -37,7 +39,7 @@ export async function giteaApi(
|
|
|
37
39
|
): Promise<{ ok: boolean; data: unknown; error?: string; statusCode?: number }> {
|
|
38
40
|
const base = `http://127.0.0.1:3001/api/v1/repos/${opts.repo}`;
|
|
39
41
|
const url = `${base}${path}`;
|
|
40
|
-
const headers: Record<string, string> = { "Content-Type": "application/json" };
|
|
42
|
+
const headers: Record<string, string> = { "Content-Type": "application/json", "Accept": "application/json" };
|
|
41
43
|
if (opts.token) headers["Authorization"] = `token ${opts.token}`;
|
|
42
44
|
|
|
43
45
|
try {
|
|
@@ -49,7 +51,7 @@ export async function giteaApi(
|
|
|
49
51
|
const text = await res.text();
|
|
50
52
|
const statusCode = res.status;
|
|
51
53
|
if (!res.ok) {
|
|
52
|
-
return { ok: false, data: null, statusCode, error:
|
|
54
|
+
return { ok: false, data: null, statusCode, error: `Gitea API error: HTTP ${statusCode} ${method} ${path}` };
|
|
53
55
|
}
|
|
54
56
|
try {
|
|
55
57
|
return { ok: true, data: JSON.parse(text), statusCode };
|