@blogic-cz/agent-tools 0.14.47 → 0.14.48
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/package.json +1 -1
- package/src/gh-tool/index.ts +14 -11
- package/src/gh-tool/workflow.ts +60 -1
package/package.json
CHANGED
package/src/gh-tool/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
workflowListCommand,
|
|
62
62
|
workflowLogsCommand,
|
|
63
63
|
workflowRerunCommand,
|
|
64
|
+
workflowRunCommand,
|
|
64
65
|
workflowViewCommand,
|
|
65
66
|
workflowWatchCommand,
|
|
66
67
|
} from "./workflow";
|
|
@@ -123,9 +124,10 @@ const repoCommand = Command.make("repo", {}).pipe(
|
|
|
123
124
|
|
|
124
125
|
const workflowCommand = Command.make("workflow", {}).pipe(
|
|
125
126
|
Command.withDescription(
|
|
126
|
-
"GitHub Actions workflow operations (list
|
|
127
|
+
"GitHub Actions workflow operations (run, list, view, jobs, logs, job-logs, annotations, rerun, cancel, watch)",
|
|
127
128
|
),
|
|
128
129
|
Command.withSubcommands([
|
|
130
|
+
workflowRunCommand,
|
|
129
131
|
workflowListCommand,
|
|
130
132
|
workflowViewCommand,
|
|
131
133
|
workflowJobsCommand,
|
|
@@ -172,16 +174,17 @@ WORKFLOW FOR AI AGENTS:
|
|
|
172
174
|
10. Use 'issue close --issue N --comment "reason"' to close issues
|
|
173
175
|
11. Use 'issue comment --issue N --body "text"' to comment on issues
|
|
174
176
|
12. Use 'repo info' to get repository metadata
|
|
175
|
-
13. Use 'workflow
|
|
176
|
-
14. Use 'workflow
|
|
177
|
-
15. Use 'workflow
|
|
178
|
-
16. Use 'workflow
|
|
179
|
-
17. Use 'workflow
|
|
180
|
-
18. Use 'workflow
|
|
181
|
-
19. Use '
|
|
182
|
-
20. Use 'release
|
|
183
|
-
21. Use 'release
|
|
184
|
-
22. Use '
|
|
177
|
+
13. Use 'workflow run' to dispatch workflow_dispatch workflows
|
|
178
|
+
14. Use 'workflow list' to list recent workflow runs
|
|
179
|
+
15. Use 'workflow view --run N' to inspect a specific run with jobs/steps
|
|
180
|
+
16. Use 'workflow logs --run N' to get logs (failed jobs by default)
|
|
181
|
+
17. Use 'workflow job-logs --run N --job "build-web-app"' to get clean parsed logs for a specific job
|
|
182
|
+
18. Use 'workflow annotations --run N' to list CI annotations (errors, warnings, notices)
|
|
183
|
+
19. Use 'workflow watch --run N' to watch until completion
|
|
184
|
+
20. Use 'release status' to inspect latest release + repository context
|
|
185
|
+
21. Use 'release create --tag vX.Y.Z --generate-notes' to publish a release
|
|
186
|
+
22. Use 'release edit/view/list/delete' to maintain existing releases
|
|
187
|
+
23. Use 'branch rename --old-name X --new-name Y --confirm' to rename a branch`,
|
|
185
188
|
),
|
|
186
189
|
Command.withSubcommands([
|
|
187
190
|
prCommand,
|
package/src/gh-tool/workflow.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, Flag } from "effect/unstable/cli";
|
|
1
|
+
import { Command, Flag, Param } from "effect/unstable/cli";
|
|
2
2
|
import { Console, Effect, Option } from "effect";
|
|
3
3
|
|
|
4
4
|
import { formatOption, logFormatted } from "#shared";
|
|
@@ -213,6 +213,34 @@ const cancelRun = Effect.fn("workflow.cancelRun")(function* (runId: number, repo
|
|
|
213
213
|
};
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
+
export const dispatchWorkflow = Effect.fn("workflow.dispatchWorkflow")(function* (opts: {
|
|
217
|
+
workflow: string;
|
|
218
|
+
ref: string;
|
|
219
|
+
fields: ReadonlyArray<string>;
|
|
220
|
+
repo: string | null;
|
|
221
|
+
}) {
|
|
222
|
+
const gh = yield* GitHubService;
|
|
223
|
+
const args = ["workflow", "run", opts.workflow, "--ref", opts.ref];
|
|
224
|
+
|
|
225
|
+
if (opts.repo !== null) {
|
|
226
|
+
args.push("--repo", opts.repo);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
for (const field of opts.fields) {
|
|
230
|
+
args.push("-f", field);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
yield* gh.runGh(args);
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
dispatched: true as const,
|
|
237
|
+
workflow: opts.workflow,
|
|
238
|
+
ref: opts.ref,
|
|
239
|
+
repo: opts.repo,
|
|
240
|
+
fields: opts.fields,
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
|
|
216
244
|
// `gh run watch` has no native timeout (observed hanging 36 min). Block for the caller's --timeout,
|
|
217
245
|
// then fall back to a one-shot snapshot so a timeout never returns nothing.
|
|
218
246
|
const DEFAULT_WATCH_RUN_TIMEOUT_SECONDS = CI_CHECK_WATCH_TIMEOUT_MS / 1000;
|
|
@@ -649,6 +677,37 @@ export const workflowCancelCommand = Command.make(
|
|
|
649
677
|
}),
|
|
650
678
|
).pipe(Command.withDescription("Cancel an in-progress workflow run"));
|
|
651
679
|
|
|
680
|
+
export const workflowRunCommand = Command.make(
|
|
681
|
+
"run",
|
|
682
|
+
{
|
|
683
|
+
field: Param.variadic(
|
|
684
|
+
Param.string(Param.flagKind, "field").pipe(
|
|
685
|
+
Param.withAlias("f"),
|
|
686
|
+
Param.withDescription("Workflow input as key=value; may be repeated"),
|
|
687
|
+
),
|
|
688
|
+
),
|
|
689
|
+
format: formatOption,
|
|
690
|
+
ref: Flag.string("ref").pipe(
|
|
691
|
+
Flag.withDescription("Git ref to run the workflow on (branch, tag, or SHA)"),
|
|
692
|
+
),
|
|
693
|
+
repo: repoOption,
|
|
694
|
+
workflow: Flag.string("workflow").pipe(
|
|
695
|
+
Flag.withDescription("Workflow file name (e.g., build.yml) or workflow ID"),
|
|
696
|
+
),
|
|
697
|
+
},
|
|
698
|
+
({ field, format, ref, repo, workflow }) =>
|
|
699
|
+
Effect.gen(function* () {
|
|
700
|
+
const resolvedRepo = yield* resolveRepoArg(repo);
|
|
701
|
+
const result = yield* dispatchWorkflow({
|
|
702
|
+
workflow,
|
|
703
|
+
ref,
|
|
704
|
+
fields: field,
|
|
705
|
+
repo: resolvedRepo,
|
|
706
|
+
});
|
|
707
|
+
yield* logFormatted(result, format);
|
|
708
|
+
}),
|
|
709
|
+
).pipe(Command.withDescription("Dispatch a workflow_dispatch workflow run"));
|
|
710
|
+
|
|
652
711
|
export const workflowWatchCommand = Command.make(
|
|
653
712
|
"watch",
|
|
654
713
|
{
|