pipeline-worker 0.1.3 → 0.1.4
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 +1 -1
- package/dist/agent/claude.d.ts +7 -0
- package/dist/agent/claude.js +13 -2
- package/dist/agent/claude.js.map +1 -1
- package/dist/agent/copilot.d.ts +12 -4
- package/dist/agent/copilot.js +17 -5
- package/dist/agent/copilot.js.map +1 -1
- package/dist/agent/stdinPrompt.d.ts +13 -0
- package/dist/agent/stdinPrompt.js +17 -0
- package/dist/agent/stdinPrompt.js.map +1 -0
- package/dist/config/loader.d.ts +2 -1
- package/dist/config/loader.js +4 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/git/remote.d.ts +7 -0
- package/dist/git/remote.js +19 -0
- package/dist/git/remote.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ pipeline-worker is configured entirely through real environment variables — se
|
|
|
60
60
|
| `PIPELINE_WORKER_GITLAB_PROJECT_ID` | — | numeric project id |
|
|
61
61
|
| `PIPELINE_WORKER_GITLAB_REPO_BASE` | — | local dir mirroring the GitLab namespace root, for auto-detecting `projectId` |
|
|
62
62
|
| `PIPELINE_WORKER_GITLAB_TOKEN` | — | GitLab API token |
|
|
63
|
-
| `PIPELINE_WORKER_GITHUB_REPO` |
|
|
63
|
+
| `PIPELINE_WORKER_GITHUB_REPO` | auto-detected from `origin` | `owner/name` slug — only needed when `origin` isn't a GitHub remote |
|
|
64
64
|
| `PIPELINE_WORKER_GITHUB_TOKEN` | falls back to `GITHUB_TOKEN` | GitHub token |
|
|
65
65
|
| `PIPELINE_WORKER_POLL_INTERVAL_SECONDS` | `15` | pipeline poll cadence; use `60` for slow pipelines |
|
|
66
66
|
|
package/dist/agent/claude.d.ts
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
* `--json-schema`, `--mcp-config`. There is no `--cwd` flag — working
|
|
5
5
|
* directory is controlled by the spawned process's `cwd` option.
|
|
6
6
|
*
|
|
7
|
+
* The prompt is written to the child's stdin rather than passed as a CLI
|
|
8
|
+
* argument. captureIntent.ts embeds a full git diff in the prompt, and Linux
|
|
9
|
+
* caps a single exec() argument at ~128KB (MAX_ARG_STRLEN); a large diff
|
|
10
|
+
* blows past that and execFile fails with E2BIG before `claude` even starts.
|
|
11
|
+
* Piping via stdin (verified: `echo "..." | claude -p` reads the prompt from
|
|
12
|
+
* stdin when the positional `prompt` argument is omitted) has no such limit.
|
|
13
|
+
*
|
|
7
14
|
* When the spawned CLI exits non-zero, the rejection we throw includes
|
|
8
15
|
* **stdout in addition to stderr**. Under `--output-format json` Claude
|
|
9
16
|
* frequently writes a structured `is_error: true` envelope to stdout, which
|
package/dist/agent/claude.js
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
* `--json-schema`, `--mcp-config`. There is no `--cwd` flag — working
|
|
5
5
|
* directory is controlled by the spawned process's `cwd` option.
|
|
6
6
|
*
|
|
7
|
+
* The prompt is written to the child's stdin rather than passed as a CLI
|
|
8
|
+
* argument. captureIntent.ts embeds a full git diff in the prompt, and Linux
|
|
9
|
+
* caps a single exec() argument at ~128KB (MAX_ARG_STRLEN); a large diff
|
|
10
|
+
* blows past that and execFile fails with E2BIG before `claude` even starts.
|
|
11
|
+
* Piping via stdin (verified: `echo "..." | claude -p` reads the prompt from
|
|
12
|
+
* stdin when the positional `prompt` argument is omitted) has no such limit.
|
|
13
|
+
*
|
|
7
14
|
* When the spawned CLI exits non-zero, the rejection we throw includes
|
|
8
15
|
* **stdout in addition to stderr**. Under `--output-format json` Claude
|
|
9
16
|
* frequently writes a structured `is_error: true` envelope to stdout, which
|
|
@@ -13,6 +20,7 @@
|
|
|
13
20
|
*/
|
|
14
21
|
import { execFile } from 'node:child_process';
|
|
15
22
|
import { promisify } from 'node:util';
|
|
23
|
+
import { writePromptToStdin } from './stdinPrompt.js';
|
|
16
24
|
const execFileAsync = promisify(execFile);
|
|
17
25
|
const INVOKE_TIMEOUT_MS = 300_000;
|
|
18
26
|
/**
|
|
@@ -74,7 +82,7 @@ export function formatProcessError(err) {
|
|
|
74
82
|
export const claudeAdapter = {
|
|
75
83
|
async invoke(opts) {
|
|
76
84
|
const args = [
|
|
77
|
-
'-p',
|
|
85
|
+
'-p',
|
|
78
86
|
'--output-format', 'json',
|
|
79
87
|
'--permission-mode', opts.permissionMode ?? 'acceptEdits',
|
|
80
88
|
];
|
|
@@ -89,11 +97,14 @@ export const claudeAdapter = {
|
|
|
89
97
|
}
|
|
90
98
|
let stdout;
|
|
91
99
|
try {
|
|
92
|
-
const
|
|
100
|
+
const invocation = execFileAsync('claude', args, {
|
|
93
101
|
cwd: opts.cwd,
|
|
94
102
|
timeout: INVOKE_TIMEOUT_MS,
|
|
95
103
|
maxBuffer: 64 * 1024 * 1024,
|
|
96
104
|
});
|
|
105
|
+
// stdin is always a pipe here since stdio isn't overridden in execFileAsync's options.
|
|
106
|
+
writePromptToStdin(invocation.child.stdin, opts.prompt);
|
|
107
|
+
const result = await invocation;
|
|
97
108
|
stdout = result.stdout;
|
|
98
109
|
}
|
|
99
110
|
catch (rawErr) {
|
package/dist/agent/claude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/agent/claude.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/agent/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,sBA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AI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,MAAc,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE;gBAC/C,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,OAAO,EAAE,iBAAiB;gBAC1B,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;aAC5B,CAAC,CAAC;YACH,uFAAuF;YACvF,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,KAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACzB,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,MAAwB,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAwB,CAAC;YACzD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;YACvE,iFAAiF;YACjF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/agent/copilot.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Headless GitHub Copilot CLI adapter. Flags verified against GitHub's
|
|
3
|
-
* "Copilot CLI programmatic reference" docs: `-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* "Copilot CLI programmatic reference" docs: `-s` (suppress stats/decoration,
|
|
4
|
+
* output only the agent's response), `--no-ask-user`, `--allow-all-tools`
|
|
5
|
+
* (required for unattended fix runs). Known gaps vs the Claude adapter,
|
|
6
|
+
* handled here:
|
|
7
7
|
* - no structured-output/JSON-schema flag -> the schema is embedded in the
|
|
8
8
|
* prompt and the JSON object is extracted from the response text;
|
|
9
9
|
* - no per-invocation MCP config flag -> Copilot only reads
|
|
10
10
|
* ~/.copilot/mcp-config.json, so `mcpConfigPath` is ignored with a warning.
|
|
11
|
+
*
|
|
12
|
+
* The prompt is piped over stdin rather than passed via `-p <prompt>`.
|
|
13
|
+
* captureIntent.ts embeds a full git diff in the prompt, and a large diff can
|
|
14
|
+
* exceed the OS's exec() argument size limit (E2BIG). Per GitHub's docs,
|
|
15
|
+
* piped stdin is ignored whenever `-p`/`--prompt` is also given a value, so
|
|
16
|
+
* `-p` is omitted entirely; `copilot` reads the prompt from stdin and runs
|
|
17
|
+
* non-interactively since stdin isn't a TTY (documented as
|
|
18
|
+
* `echo "..." | copilot`).
|
|
11
19
|
*/
|
|
12
20
|
import type { AgentAdapter } from './types.js';
|
|
13
21
|
export declare const copilotAdapter: AgentAdapter;
|
package/dist/agent/copilot.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Headless GitHub Copilot CLI adapter. Flags verified against GitHub's
|
|
3
|
-
* "Copilot CLI programmatic reference" docs: `-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* "Copilot CLI programmatic reference" docs: `-s` (suppress stats/decoration,
|
|
4
|
+
* output only the agent's response), `--no-ask-user`, `--allow-all-tools`
|
|
5
|
+
* (required for unattended fix runs). Known gaps vs the Claude adapter,
|
|
6
|
+
* handled here:
|
|
7
7
|
* - no structured-output/JSON-schema flag -> the schema is embedded in the
|
|
8
8
|
* prompt and the JSON object is extracted from the response text;
|
|
9
9
|
* - no per-invocation MCP config flag -> Copilot only reads
|
|
10
10
|
* ~/.copilot/mcp-config.json, so `mcpConfigPath` is ignored with a warning.
|
|
11
|
+
*
|
|
12
|
+
* The prompt is piped over stdin rather than passed via `-p <prompt>`.
|
|
13
|
+
* captureIntent.ts embeds a full git diff in the prompt, and a large diff can
|
|
14
|
+
* exceed the OS's exec() argument size limit (E2BIG). Per GitHub's docs,
|
|
15
|
+
* piped stdin is ignored whenever `-p`/`--prompt` is also given a value, so
|
|
16
|
+
* `-p` is omitted entirely; `copilot` reads the prompt from stdin and runs
|
|
17
|
+
* non-interactively since stdin isn't a TTY (documented as
|
|
18
|
+
* `echo "..." | copilot`).
|
|
11
19
|
*/
|
|
12
20
|
import { execFile } from 'node:child_process';
|
|
13
21
|
import { promisify } from 'node:util';
|
|
22
|
+
import { writePromptToStdin } from './stdinPrompt.js';
|
|
14
23
|
const execFileAsync = promisify(execFile);
|
|
15
24
|
const INVOKE_TIMEOUT_MS = 300_000;
|
|
16
25
|
/** Pulls the outermost JSON object out of a text answer that may have prose around it. */
|
|
@@ -31,11 +40,14 @@ export const copilotAdapter = {
|
|
|
31
40
|
console.error('pipeline-worker: copilot CLI has no per-invocation MCP config flag; ignoring it. ' +
|
|
32
41
|
'Register the server in ~/.copilot/mcp-config.json to give copilot forge access.');
|
|
33
42
|
}
|
|
34
|
-
const
|
|
43
|
+
const invocation = execFileAsync('copilot', ['-s', '--no-ask-user', '--allow-all-tools'], {
|
|
35
44
|
cwd: opts.cwd,
|
|
36
45
|
timeout: INVOKE_TIMEOUT_MS,
|
|
37
46
|
maxBuffer: 64 * 1024 * 1024,
|
|
38
47
|
});
|
|
48
|
+
// stdin is always a pipe here since stdio isn't overridden in execFileAsync's options.
|
|
49
|
+
writePromptToStdin(invocation.child.stdin, prompt);
|
|
50
|
+
const { stdout } = await invocation;
|
|
39
51
|
return { text: opts.jsonSchema ? extractJsonObject(stdout) : stdout.trim() };
|
|
40
52
|
},
|
|
41
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../src/agent/copilot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../src/agent/copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC,0FAA0F;AAC1F,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM;gBACJ,oGAAoG;oBACpG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CACX,mFAAmF;gBACjF,iFAAiF,CACpF,CAAC;QACJ,CAAC;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,mBAAmB,CAAC,EAAE;YACxF,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;SAC5B,CAAC,CAAC;QACH,uFAAuF;QACvF,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,KAAM,EAAE,MAAM,CAAC,CAAC;QACpD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC;QAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IAC/E,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes a prompt to a spawned child's stdin and closes it. Used instead of
|
|
3
|
+
* passing the prompt as a CLI argument because captureIntent.ts embeds a
|
|
4
|
+
* full git diff in the prompt, and Linux caps a single exec() argument at
|
|
5
|
+
* ~128KB (MAX_ARG_STRLEN) — a large diff trips E2BIG before the CLI starts.
|
|
6
|
+
*
|
|
7
|
+
* If the child exits (or never reads stdin) before this write lands, Node
|
|
8
|
+
* emits EPIPE as an 'error' event on the stdin stream, which is unhandled by
|
|
9
|
+
* default and crashes the process. The real failure already surfaces via the
|
|
10
|
+
* execFile promise rejecting (non-zero exit, timeout, etc.), so that error is
|
|
11
|
+
* swallowed here rather than duplicated.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writePromptToStdin(stdin: NodeJS.WritableStream, prompt: string): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes a prompt to a spawned child's stdin and closes it. Used instead of
|
|
3
|
+
* passing the prompt as a CLI argument because captureIntent.ts embeds a
|
|
4
|
+
* full git diff in the prompt, and Linux caps a single exec() argument at
|
|
5
|
+
* ~128KB (MAX_ARG_STRLEN) — a large diff trips E2BIG before the CLI starts.
|
|
6
|
+
*
|
|
7
|
+
* If the child exits (or never reads stdin) before this write lands, Node
|
|
8
|
+
* emits EPIPE as an 'error' event on the stdin stream, which is unhandled by
|
|
9
|
+
* default and crashes the process. The real failure already surfaces via the
|
|
10
|
+
* execFile promise rejecting (non-zero exit, timeout, etc.), so that error is
|
|
11
|
+
* swallowed here rather than duplicated.
|
|
12
|
+
*/
|
|
13
|
+
export function writePromptToStdin(stdin, prompt) {
|
|
14
|
+
stdin.on('error', () => { });
|
|
15
|
+
stdin.end(prompt);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=stdinPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdinPrompt.js","sourceRoot":"","sources":["../../src/agent/stdinPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA4B,EAAE,MAAc;IAC7E,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC5B,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/config/loader.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* .pipeline-worker.yml loader. Resolution order per value: environment variable ->
|
|
3
3
|
* .env file at repo root (never overrides real env) -> .pipeline-worker.yml ->
|
|
4
4
|
* built-in default (for build/lint/test: commands auto-detected from the repo's
|
|
5
|
-
* toolchain, see detectChecks.ts
|
|
5
|
+
* toolchain, see detectChecks.ts; for github.repo: the repo's own `origin`
|
|
6
|
+
* remote, see git/remote.ts). Config file path: explicit override param ->
|
|
6
7
|
* PIPELINE_WORKER_CONFIG env var -> <repoRoot>/.pipeline-worker.yml. Never throws — a
|
|
7
8
|
* missing or unparseable file falls back to defaults (with a warning),
|
|
8
9
|
* mirroring mcp-sonar-analysis's registry.ts read/never-throw contract.
|
package/dist/config/loader.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* .pipeline-worker.yml loader. Resolution order per value: environment variable ->
|
|
3
3
|
* .env file at repo root (never overrides real env) -> .pipeline-worker.yml ->
|
|
4
4
|
* built-in default (for build/lint/test: commands auto-detected from the repo's
|
|
5
|
-
* toolchain, see detectChecks.ts
|
|
5
|
+
* toolchain, see detectChecks.ts; for github.repo: the repo's own `origin`
|
|
6
|
+
* remote, see git/remote.ts). Config file path: explicit override param ->
|
|
6
7
|
* PIPELINE_WORKER_CONFIG env var -> <repoRoot>/.pipeline-worker.yml. Never throws — a
|
|
7
8
|
* missing or unparseable file falls back to defaults (with a warning),
|
|
8
9
|
* mirroring mcp-sonar-analysis's registry.ts read/never-throw contract.
|
|
@@ -13,6 +14,7 @@ import { parseEnv } from 'node:util';
|
|
|
13
14
|
import { load } from 'js-yaml';
|
|
14
15
|
import { detectChecks } from './detectChecks.js';
|
|
15
16
|
import { deriveProjectPath } from '../git/resolveProjectPath.js';
|
|
17
|
+
import { detectGithubRepo } from '../git/remote.js';
|
|
16
18
|
const CONFIG_FILE_NAME = '.pipeline-worker.yml';
|
|
17
19
|
const AGENT_NAMES = ['claude', 'copilot'];
|
|
18
20
|
const FORGE_NAMES = ['gitlab', 'github'];
|
|
@@ -109,7 +111,7 @@ export function loadConfig(repoRoot, override) {
|
|
|
109
111
|
repoBase,
|
|
110
112
|
},
|
|
111
113
|
github: {
|
|
112
|
-
repo: process.env.PIPELINE_WORKER_GITHUB_REPO || parsed.github?.repo || DEFAULT_CONFIG.github.repo,
|
|
114
|
+
repo: process.env.PIPELINE_WORKER_GITHUB_REPO || parsed.github?.repo || detectGithubRepo(repoRoot) || DEFAULT_CONFIG.github.repo,
|
|
113
115
|
},
|
|
114
116
|
build: parsed.build ?? detected.build,
|
|
115
117
|
lint: parsed.lint ?? detected.lint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config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K,EAAE,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK;QACrC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI;QAClC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI;QAClC,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,cAAc,CAAC,cAAc;QACtE,mBAAmB,EAAE,cAAc,CACjC,OAAO,CAAC,GAAG,CAAC,qCAAqC,EACjD,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAC/E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-detects the GitHub `owner/name` slug from the repo's own `origin`
|
|
3
|
+
* remote, so PIPELINE_WORKER_GITHUB_REPO only needs to be set for repos
|
|
4
|
+
* where that detection doesn't apply (e.g. origin isn't GitHub).
|
|
5
|
+
*/
|
|
6
|
+
/** Returns the `owner/name` slug for repoRoot's `origin` remote, or undefined if it's missing or not a GitHub remote. */
|
|
7
|
+
export declare function detectGithubRepo(repoRoot: string): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-detects the GitHub `owner/name` slug from the repo's own `origin`
|
|
3
|
+
* remote, so PIPELINE_WORKER_GITHUB_REPO only needs to be set for repos
|
|
4
|
+
* where that detection doesn't apply (e.g. origin isn't GitHub).
|
|
5
|
+
*/
|
|
6
|
+
import { execFileSync } from 'node:child_process';
|
|
7
|
+
const GITHUB_REMOTE = /github\.com[:/]([^/]+\/[^/]+?)(\.git)?$/;
|
|
8
|
+
/** Returns the `owner/name` slug for repoRoot's `origin` remote, or undefined if it's missing or not a GitHub remote. */
|
|
9
|
+
export function detectGithubRepo(repoRoot) {
|
|
10
|
+
let url;
|
|
11
|
+
try {
|
|
12
|
+
url = execFileSync('git', ['remote', 'get-url', 'origin'], { cwd: repoRoot, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
return url.match(GITHUB_REMOTE)?.[1];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/git/remote.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,aAAa,GAAG,yCAAyC,CAAC;AAEhE,yHAAyH;AACzH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/I,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pipeline-worker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Automated git-worktree workflow: captures intent from a diff via Claude Code or GitHub Copilot CLI, runs build/lint/test, opens a GitLab MR or GitHub PR, and auto-fixes failing pipelines — with a companion forge MCP server (TOON-encoded responses).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mohan TN <mohan.tn100@gmail.com>",
|