@xn-intenton-z2a/agentic-lib 7.1.6
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 +674 -0
- package/README.md +323 -0
- package/bin/agentic-lib.js +765 -0
- package/package.json +102 -0
- package/src/actions/agentic-step/action.yml +58 -0
- package/src/actions/agentic-step/config-loader.js +153 -0
- package/src/actions/agentic-step/copilot.js +170 -0
- package/src/actions/agentic-step/index.js +118 -0
- package/src/actions/agentic-step/logging.js +88 -0
- package/src/actions/agentic-step/package-lock.json +1891 -0
- package/src/actions/agentic-step/package.json +29 -0
- package/src/actions/agentic-step/safety.js +103 -0
- package/src/actions/agentic-step/tasks/discussions.js +141 -0
- package/src/actions/agentic-step/tasks/enhance-issue.js +102 -0
- package/src/actions/agentic-step/tasks/fix-code.js +71 -0
- package/src/actions/agentic-step/tasks/maintain-features.js +79 -0
- package/src/actions/agentic-step/tasks/maintain-library.js +67 -0
- package/src/actions/agentic-step/tasks/resolve-issue.js +98 -0
- package/src/actions/agentic-step/tasks/review-issue.js +121 -0
- package/src/actions/agentic-step/tasks/transform.js +213 -0
- package/src/actions/agentic-step/tools.js +142 -0
- package/src/actions/commit-if-changed/action.yml +39 -0
- package/src/actions/setup-npmrc/action.yml +38 -0
- package/src/agents/agent-apply-fix.md +13 -0
- package/src/agents/agent-discussion-bot.md +35 -0
- package/src/agents/agent-issue-resolution.md +13 -0
- package/src/agents/agent-maintain-features.md +29 -0
- package/src/agents/agent-maintain-library.md +31 -0
- package/src/agents/agent-ready-issue.md +13 -0
- package/src/agents/agent-review-issue.md +2 -0
- package/src/agents/agentic-lib.yml +68 -0
- package/src/scripts/accept-release.sh +29 -0
- package/src/scripts/activate-schedule.sh +41 -0
- package/src/scripts/clean.sh +21 -0
- package/src/scripts/generate-library-index.js +143 -0
- package/src/scripts/initialise.sh +39 -0
- package/src/scripts/md-to-html.js +77 -0
- package/src/scripts/update.sh +19 -0
- package/src/seeds/test.yml +33 -0
- package/src/seeds/zero-MISSION.md +7 -0
- package/src/seeds/zero-README.md +14 -0
- package/src/seeds/zero-agentic-lib.toml +32 -0
- package/src/seeds/zero-main.js +15 -0
- package/src/seeds/zero-main.test.js +11 -0
- package/src/seeds/zero-package.json +26 -0
- package/src/workflows/agent-discussions-bot.yml +78 -0
- package/src/workflows/agent-flow-fix-code.yml +98 -0
- package/src/workflows/agent-flow-maintain.yml +114 -0
- package/src/workflows/agent-flow-review.yml +99 -0
- package/src/workflows/agent-flow-transform.yml +82 -0
- package/src/workflows/agent-supervisor.yml +85 -0
- package/src/workflows/ci-automerge.yml +544 -0
- package/src/workflows/ci-init.yml +63 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# agentic-lib.toml — Configuration for @xn-intenton-z2a/agentic-lib
|
|
4
|
+
#
|
|
5
|
+
# This file controls how agentic workflows operate on your repository.
|
|
6
|
+
# Place it at the root of your project.
|
|
7
|
+
|
|
8
|
+
[schedule]
|
|
9
|
+
tier = "schedule-1" # schedule-1 through schedule-4
|
|
10
|
+
|
|
11
|
+
[paths]
|
|
12
|
+
mission = "MISSION.md"
|
|
13
|
+
source = "src/lib/"
|
|
14
|
+
tests = "tests/unit/"
|
|
15
|
+
features = ".github/agentic-lib/features/"
|
|
16
|
+
docs = "docs/"
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
dependencies = "package.json"
|
|
19
|
+
|
|
20
|
+
[execution]
|
|
21
|
+
build = "npm run build"
|
|
22
|
+
test = "npm test"
|
|
23
|
+
start = "npm run start"
|
|
24
|
+
|
|
25
|
+
[limits]
|
|
26
|
+
feature-issues = 2
|
|
27
|
+
maintenance-issues = 1
|
|
28
|
+
attempts-per-branch = 3
|
|
29
|
+
attempts-per-issue = 2
|
|
30
|
+
|
|
31
|
+
[bot]
|
|
32
|
+
log-file = "intentïon.md"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (C) 2025-2026 Polycode Limited
|
|
4
|
+
// src/lib/main.js
|
|
5
|
+
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
|
|
8
|
+
export function main(args) {
|
|
9
|
+
console.log(`Run with: ${JSON.stringify(args)}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
main(args);
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
import { describe, test } from "vitest";
|
|
4
|
+
import { main } from "../../src/lib/main.js";
|
|
5
|
+
|
|
6
|
+
describe("Main Output", () => {
|
|
7
|
+
test("should terminate without error", () => {
|
|
8
|
+
process.argv = ["node", "src/lib/main.js"];
|
|
9
|
+
main();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xn-intenton-z2a/repo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/lib/main.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "echo \"Nothing to build\"",
|
|
9
|
+
"test": "vitest --run tests/unit/*.test.js",
|
|
10
|
+
"test:unit": "vitest --run --coverage tests/unit/*.test.js",
|
|
11
|
+
"start": "node src/lib/main.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@xn-intenton-z2a/agentic-lib": "^7.1.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@vitest/coverage-v8": "^4.0.0",
|
|
21
|
+
"vitest": "^4.0.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=24.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-discussions-bot.yml
|
|
4
|
+
#
|
|
5
|
+
# Responds to GitHub Discussions using the Copilot SDK.
|
|
6
|
+
# Creates features, seeds repositories, provides status updates.
|
|
7
|
+
|
|
8
|
+
name: agent-discussions-bot
|
|
9
|
+
run-name: "agent-discussions-bot [${{ github.ref_name }}]"
|
|
10
|
+
concurrency: agentic-lib-bot
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
discussion:
|
|
14
|
+
types:
|
|
15
|
+
- created
|
|
16
|
+
- edited
|
|
17
|
+
- answered
|
|
18
|
+
- unanswered
|
|
19
|
+
discussion_comment:
|
|
20
|
+
types:
|
|
21
|
+
- created
|
|
22
|
+
- edited
|
|
23
|
+
schedule:
|
|
24
|
+
- cron: "7 12 */28 * *" # schedule-1: every 28 days
|
|
25
|
+
workflow_dispatch:
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: write
|
|
29
|
+
issues: write
|
|
30
|
+
discussions: write
|
|
31
|
+
|
|
32
|
+
env:
|
|
33
|
+
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
respond:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
|
|
43
|
+
- uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version: "24"
|
|
46
|
+
|
|
47
|
+
- name: Install agentic-step dependencies
|
|
48
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
49
|
+
run: npm ci
|
|
50
|
+
|
|
51
|
+
- name: Get discussion URL
|
|
52
|
+
id: discussion-url
|
|
53
|
+
uses: actions/github-script@v7
|
|
54
|
+
with:
|
|
55
|
+
script: |
|
|
56
|
+
let url = '';
|
|
57
|
+
if (context.payload.discussion) {
|
|
58
|
+
url = context.payload.discussion.html_url;
|
|
59
|
+
}
|
|
60
|
+
core.setOutput('url', url);
|
|
61
|
+
|
|
62
|
+
- name: Respond to discussion
|
|
63
|
+
if: steps.discussion-url.outputs.url != ''
|
|
64
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
65
|
+
env:
|
|
66
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
67
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
68
|
+
with:
|
|
69
|
+
task: "discussions"
|
|
70
|
+
config: ${{ env.configPath }}
|
|
71
|
+
instructions: ".github/agentic-lib/agents/agent-discussion-bot.md"
|
|
72
|
+
discussion-url: ${{ steps.discussion-url.outputs.url }}
|
|
73
|
+
|
|
74
|
+
- name: Commit activity log changes
|
|
75
|
+
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
76
|
+
with:
|
|
77
|
+
commit-message: "agentic-step: discussions bot response"
|
|
78
|
+
push-ref: ${{ github.ref_name }}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-flow-fix-code.yml
|
|
4
|
+
#
|
|
5
|
+
# Fix failing PRs via agentic-step.
|
|
6
|
+
# Triggered when a check suite fails on an agentic or copilot branch.
|
|
7
|
+
|
|
8
|
+
name: agent-flow-fix-code
|
|
9
|
+
run-name: "agent-flow-fix-code [${{ github.ref_name }}]"
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
check_suite:
|
|
13
|
+
types:
|
|
14
|
+
- completed
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
pr-number:
|
|
18
|
+
description: "PR number to fix"
|
|
19
|
+
required: true
|
|
20
|
+
type: string
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: write
|
|
24
|
+
pull-requests: write
|
|
25
|
+
checks: read
|
|
26
|
+
|
|
27
|
+
env:
|
|
28
|
+
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
find-failing-pr:
|
|
32
|
+
if: >
|
|
33
|
+
github.event_name == 'workflow_dispatch' ||
|
|
34
|
+
(github.event_name == 'check_suite' &&
|
|
35
|
+
github.event.check_suite.conclusion == 'failure' &&
|
|
36
|
+
(startsWith(github.event.check_suite.head_branch, 'agentic-lib-issue-') ||
|
|
37
|
+
startsWith(github.event.check_suite.head_branch, 'copilot/')))
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
outputs:
|
|
40
|
+
prNumber: ${{ steps.find-pr.outputs.prNumber }}
|
|
41
|
+
steps:
|
|
42
|
+
- name: Find PR from check suite or input
|
|
43
|
+
id: find-pr
|
|
44
|
+
uses: actions/github-script@v7
|
|
45
|
+
with:
|
|
46
|
+
script: |
|
|
47
|
+
let prNumber = '${{ inputs.pr-number }}';
|
|
48
|
+
if (!prNumber && context.payload.check_suite) {
|
|
49
|
+
const branch = context.payload.check_suite.head_branch;
|
|
50
|
+
const { data: prs } = await github.rest.pulls.list({
|
|
51
|
+
...context.repo,
|
|
52
|
+
state: 'open',
|
|
53
|
+
head: `${context.repo.owner}:${branch}`,
|
|
54
|
+
per_page: 1,
|
|
55
|
+
});
|
|
56
|
+
prNumber = prs.length > 0 ? String(prs[0].number) : '';
|
|
57
|
+
}
|
|
58
|
+
core.setOutput('prNumber', prNumber);
|
|
59
|
+
|
|
60
|
+
fix:
|
|
61
|
+
needs: find-failing-pr
|
|
62
|
+
if: needs.find-failing-pr.outputs.prNumber != ''
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
with:
|
|
67
|
+
fetch-depth: 0
|
|
68
|
+
|
|
69
|
+
- uses: actions/setup-node@v4
|
|
70
|
+
with:
|
|
71
|
+
node-version: "24"
|
|
72
|
+
|
|
73
|
+
- name: Checkout PR branch
|
|
74
|
+
run: |
|
|
75
|
+
gh pr checkout ${{ needs.find-failing-pr.outputs.prNumber }}
|
|
76
|
+
env:
|
|
77
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
78
|
+
|
|
79
|
+
- name: Install agentic-step dependencies
|
|
80
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
81
|
+
run: npm ci
|
|
82
|
+
|
|
83
|
+
- name: Fix failing code
|
|
84
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
85
|
+
env:
|
|
86
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
87
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
88
|
+
with:
|
|
89
|
+
task: "fix-code"
|
|
90
|
+
config: ${{ env.configPath }}
|
|
91
|
+
instructions: ".github/agentic-lib/agents/agent-apply-fix.md"
|
|
92
|
+
pr-number: ${{ needs.find-failing-pr.outputs.prNumber }}
|
|
93
|
+
test-command: "npm test"
|
|
94
|
+
|
|
95
|
+
- name: Commit and push fixes
|
|
96
|
+
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
97
|
+
with:
|
|
98
|
+
commit-message: "agentic-step: fix failing tests"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-flow-maintain.yml
|
|
4
|
+
#
|
|
5
|
+
# Feature + library + source maintenance.
|
|
6
|
+
# Runs periodically to keep the knowledge base and features up to date.
|
|
7
|
+
|
|
8
|
+
name: agent-flow-maintain
|
|
9
|
+
run-name: "agent-flow-maintain [${{ github.ref_name }}]"
|
|
10
|
+
concurrency: agentic-lib-main
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
schedule:
|
|
14
|
+
- cron: "33 7 * * 1" # Weekly on Monday at 07:33 UTC
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
step:
|
|
18
|
+
description: "Which maintenance step to run"
|
|
19
|
+
required: false
|
|
20
|
+
default: "all"
|
|
21
|
+
type: choice
|
|
22
|
+
options:
|
|
23
|
+
- all
|
|
24
|
+
- features
|
|
25
|
+
- library
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: write
|
|
29
|
+
issues: write
|
|
30
|
+
|
|
31
|
+
env:
|
|
32
|
+
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
maintain-features:
|
|
36
|
+
if: inputs.step == 'all' || inputs.step == 'features' || github.event_name == 'schedule'
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
|
|
43
|
+
- uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version: "24"
|
|
46
|
+
|
|
47
|
+
- name: Install agentic-step dependencies
|
|
48
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
49
|
+
run: npm ci
|
|
50
|
+
|
|
51
|
+
- name: Load config for features
|
|
52
|
+
id: features-config
|
|
53
|
+
run: |
|
|
54
|
+
CONFIG="${{ env.configPath }}"
|
|
55
|
+
FEATURES=$(yq -r '.paths.featuresPath.path // ".github/agentic-lib/features/"' "$CONFIG")
|
|
56
|
+
echo "writablePaths=${FEATURES}" >> $GITHUB_OUTPUT
|
|
57
|
+
|
|
58
|
+
- name: Maintain features
|
|
59
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
60
|
+
env:
|
|
61
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
62
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
63
|
+
with:
|
|
64
|
+
task: "maintain-features"
|
|
65
|
+
config: ${{ env.configPath }}
|
|
66
|
+
instructions: ".github/agentic-lib/agents/agent-maintain-features.md"
|
|
67
|
+
writable-paths: ${{ steps.features-config.outputs.writablePaths }}
|
|
68
|
+
|
|
69
|
+
- name: Commit and push changes
|
|
70
|
+
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
71
|
+
with:
|
|
72
|
+
commit-message: "agentic-step: maintain-features"
|
|
73
|
+
push-ref: ${{ github.ref_name }}
|
|
74
|
+
|
|
75
|
+
maintain-library:
|
|
76
|
+
if: inputs.step == 'all' || inputs.step == 'library' || github.event_name == 'schedule'
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@v4
|
|
80
|
+
with:
|
|
81
|
+
fetch-depth: 0
|
|
82
|
+
|
|
83
|
+
- uses: actions/setup-node@v4
|
|
84
|
+
with:
|
|
85
|
+
node-version: "24"
|
|
86
|
+
|
|
87
|
+
- name: Install agentic-step dependencies
|
|
88
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
89
|
+
run: npm ci
|
|
90
|
+
|
|
91
|
+
- name: Load config for library
|
|
92
|
+
id: library-config
|
|
93
|
+
run: |
|
|
94
|
+
CONFIG="${{ env.configPath }}"
|
|
95
|
+
LIBRARY=$(yq -r '.paths.libraryDocumentsPath.path // "library/"' "$CONFIG")
|
|
96
|
+
SOURCES=$(yq -r '.paths.librarySourcesFilepath.path // "SOURCES.md"' "$CONFIG")
|
|
97
|
+
echo "writablePaths=${LIBRARY};${SOURCES}" >> $GITHUB_OUTPUT
|
|
98
|
+
|
|
99
|
+
- name: Maintain library
|
|
100
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
101
|
+
env:
|
|
102
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
103
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
104
|
+
with:
|
|
105
|
+
task: "maintain-library"
|
|
106
|
+
config: ${{ env.configPath }}
|
|
107
|
+
instructions: ".github/agentic-lib/agents/agent-maintain-library.md"
|
|
108
|
+
writable-paths: ${{ steps.library-config.outputs.writablePaths }}
|
|
109
|
+
|
|
110
|
+
- name: Commit and push changes
|
|
111
|
+
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
112
|
+
with:
|
|
113
|
+
commit-message: "agentic-step: maintain-library"
|
|
114
|
+
push-ref: ${{ github.ref_name }}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-flow-review.yml
|
|
4
|
+
#
|
|
5
|
+
# Close resolved issues, prune features, enhance issues with criteria.
|
|
6
|
+
|
|
7
|
+
name: agent-flow-review
|
|
8
|
+
run-name: "agent-flow-review [${{ github.ref_name }}]"
|
|
9
|
+
concurrency: agentic-lib-main
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
schedule:
|
|
13
|
+
- cron: "47 8 */3 * *" # Every 3 days at 08:47 UTC
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
inputs:
|
|
16
|
+
step:
|
|
17
|
+
description: "Which review step to run"
|
|
18
|
+
required: false
|
|
19
|
+
default: "all"
|
|
20
|
+
type: choice
|
|
21
|
+
options:
|
|
22
|
+
- all
|
|
23
|
+
- review
|
|
24
|
+
- enhance
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
issues: write
|
|
29
|
+
|
|
30
|
+
env:
|
|
31
|
+
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
review-issues:
|
|
35
|
+
if: inputs.step == 'all' || inputs.step == 'review' || github.event_name == 'schedule'
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- uses: actions/setup-node@v4
|
|
41
|
+
with:
|
|
42
|
+
node-version: "24"
|
|
43
|
+
|
|
44
|
+
- name: Install agentic-step dependencies
|
|
45
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
46
|
+
run: npm ci
|
|
47
|
+
|
|
48
|
+
- name: Review issues
|
|
49
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
50
|
+
env:
|
|
51
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
53
|
+
with:
|
|
54
|
+
task: "review-issue"
|
|
55
|
+
config: ${{ env.configPath }}
|
|
56
|
+
instructions: ".github/agentic-lib/agents/agent-review-issue.md"
|
|
57
|
+
|
|
58
|
+
enhance-issues:
|
|
59
|
+
if: inputs.step == 'all' || inputs.step == 'enhance' || github.event_name == 'schedule'
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- uses: actions/setup-node@v4
|
|
65
|
+
with:
|
|
66
|
+
node-version: "24"
|
|
67
|
+
|
|
68
|
+
- name: Find issue to enhance
|
|
69
|
+
id: find-issue
|
|
70
|
+
uses: actions/github-script@v7
|
|
71
|
+
with:
|
|
72
|
+
script: |
|
|
73
|
+
const { data: issues } = await github.rest.issues.listForRepo({
|
|
74
|
+
...context.repo,
|
|
75
|
+
state: 'open',
|
|
76
|
+
labels: 'automated',
|
|
77
|
+
per_page: 1,
|
|
78
|
+
sort: 'created',
|
|
79
|
+
direction: 'asc',
|
|
80
|
+
});
|
|
81
|
+
const unready = issues.filter(i => !i.labels.some(l => l.name === 'ready'));
|
|
82
|
+
core.setOutput('issueNumber', unready.length > 0 ? String(unready[0].number) : '');
|
|
83
|
+
|
|
84
|
+
- name: Install agentic-step dependencies
|
|
85
|
+
if: steps.find-issue.outputs.issueNumber != ''
|
|
86
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
87
|
+
run: npm ci
|
|
88
|
+
|
|
89
|
+
- name: Enhance issue
|
|
90
|
+
if: steps.find-issue.outputs.issueNumber != ''
|
|
91
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
92
|
+
env:
|
|
93
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
94
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
95
|
+
with:
|
|
96
|
+
task: "enhance-issue"
|
|
97
|
+
config: ${{ env.configPath }}
|
|
98
|
+
instructions: ".github/agentic-lib/agents/agent-ready-issue.md"
|
|
99
|
+
issue-number: ${{ steps.find-issue.outputs.issueNumber }}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-flow-transform.yml
|
|
4
|
+
#
|
|
5
|
+
# Autonomous code transformation: Mission → Features → Issues → Code → PR
|
|
6
|
+
# Replaces the 10 transformation workflows with a single agentic-step call.
|
|
7
|
+
|
|
8
|
+
name: agent-flow-transform
|
|
9
|
+
run-name: "agent-flow-transform [${{ github.ref_name }}]"
|
|
10
|
+
concurrency: agentic-lib-main
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
schedule:
|
|
14
|
+
- cron: "17 6,8,10,12 * * *" # daily at 06:17 UTC
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
model:
|
|
18
|
+
description: "Copilot SDK model to use"
|
|
19
|
+
type: choice
|
|
20
|
+
required: false
|
|
21
|
+
default: "claude-sonnet-4"
|
|
22
|
+
options:
|
|
23
|
+
- claude-sonnet-4
|
|
24
|
+
- gpt-5-mini
|
|
25
|
+
- gpt-4.1
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: write
|
|
29
|
+
issues: write
|
|
30
|
+
pull-requests: write
|
|
31
|
+
|
|
32
|
+
env:
|
|
33
|
+
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
transform:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
|
|
43
|
+
- uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version: "24"
|
|
46
|
+
|
|
47
|
+
- name: Install agentic-step dependencies
|
|
48
|
+
working-directory: .github/agentic-lib/actions/agentic-step
|
|
49
|
+
run: npm ci
|
|
50
|
+
|
|
51
|
+
- name: Load config
|
|
52
|
+
id: config
|
|
53
|
+
run: |
|
|
54
|
+
CONFIG="${{ env.configPath }}"
|
|
55
|
+
SOURCE=$(yq -r '.paths.targetSourcePath.path // "src/lib/"' "$CONFIG")
|
|
56
|
+
TESTS=$(yq -r '.paths.targetTestsPath.path // "tests/unit/"' "$CONFIG")
|
|
57
|
+
FEATURES=$(yq -r '.paths.featuresPath.path // ".github/agentic-lib/features/"' "$CONFIG")
|
|
58
|
+
DOCS=$(yq -r '.paths.documentationPath.path // "docs/"' "$CONFIG")
|
|
59
|
+
LIBRARY=$(yq -r '.paths.libraryDocumentsPath.path // "library/"' "$CONFIG")
|
|
60
|
+
SOURCES=$(yq -r '.paths.librarySourcesFilepath.path // "SOURCES.md"' "$CONFIG")
|
|
61
|
+
README=$(yq -r '.paths.readmeFilepath.path // "README.md"' "$CONFIG")
|
|
62
|
+
DEPS=$(yq -r '.paths.dependenciesFilepath.path // "package.json"' "$CONFIG")
|
|
63
|
+
echo "writablePaths=${SOURCE};${TESTS};${FEATURES};${DOCS};${LIBRARY};${SOURCES};${README};${DEPS}" >> $GITHUB_OUTPUT
|
|
64
|
+
|
|
65
|
+
- name: Run transformation step
|
|
66
|
+
uses: ./.github/agentic-lib/actions/agentic-step
|
|
67
|
+
env:
|
|
68
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
69
|
+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
|
70
|
+
with:
|
|
71
|
+
task: "transform"
|
|
72
|
+
config: ${{ env.configPath }}
|
|
73
|
+
instructions: ".github/agentic-lib/agents/agent-issue-resolution.md"
|
|
74
|
+
test-command: "npm test"
|
|
75
|
+
model: ${{ inputs.model || 'claude-sonnet-4' }}
|
|
76
|
+
writable-paths: ${{ steps.config.outputs.writablePaths }}
|
|
77
|
+
|
|
78
|
+
- name: Commit and push changes
|
|
79
|
+
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
80
|
+
with:
|
|
81
|
+
commit-message: "agentic-step: transform"
|
|
82
|
+
push-ref: ${{ github.ref_name }}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
# .github/workflows/agent-supervisor.yml
|
|
4
|
+
#
|
|
5
|
+
# Reactive orchestration — triggers workflows based on telemetry.
|
|
6
|
+
# When a build fails, dispatches fix-code. When issues pile up, dispatches review.
|
|
7
|
+
|
|
8
|
+
name: agent-supervisor
|
|
9
|
+
run-name: "agent-supervisor [${{ github.ref_name }}]"
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
workflow_run:
|
|
13
|
+
workflows:
|
|
14
|
+
- ci
|
|
15
|
+
- agent-flow-transform
|
|
16
|
+
- agent-flow-maintain
|
|
17
|
+
types:
|
|
18
|
+
- completed
|
|
19
|
+
workflow_dispatch:
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
actions: write
|
|
23
|
+
contents: read
|
|
24
|
+
issues: read
|
|
25
|
+
checks: read
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
evaluate:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- name: Check telemetry and dispatch
|
|
32
|
+
uses: actions/github-script@v7
|
|
33
|
+
with:
|
|
34
|
+
script: |
|
|
35
|
+
const workflowRun = context.payload.workflow_run;
|
|
36
|
+
|
|
37
|
+
// If a workflow failed, trigger fix-code
|
|
38
|
+
if (workflowRun && workflowRun.conclusion === 'failure') {
|
|
39
|
+
const branch = workflowRun.head_branch;
|
|
40
|
+
const isAgenticBranch = !['main', 'master'].includes(branch);
|
|
41
|
+
|
|
42
|
+
if (isAgenticBranch) {
|
|
43
|
+
core.info(`Workflow "${workflowRun.name}" failed on branch ${branch}. Dispatching fix-code.`);
|
|
44
|
+
|
|
45
|
+
// Find the PR for this branch
|
|
46
|
+
const { data: prs } = await github.rest.pulls.list({
|
|
47
|
+
...context.repo,
|
|
48
|
+
state: 'open',
|
|
49
|
+
head: `${context.repo.owner}:${branch}`,
|
|
50
|
+
per_page: 1,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (prs.length > 0) {
|
|
54
|
+
await github.rest.actions.createWorkflowDispatch({
|
|
55
|
+
...context.repo,
|
|
56
|
+
workflow_id: 'agent-flow-fix-code.yml',
|
|
57
|
+
ref: context.ref,
|
|
58
|
+
inputs: { 'pr-number': String(prs[0].number) },
|
|
59
|
+
});
|
|
60
|
+
core.info(`Dispatched fix-code for PR #${prs[0].number}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Check for stale issues (open > 14 days with no activity)
|
|
66
|
+
const { data: issues } = await github.rest.issues.listForRepo({
|
|
67
|
+
...context.repo,
|
|
68
|
+
state: 'open',
|
|
69
|
+
labels: 'automated',
|
|
70
|
+
sort: 'updated',
|
|
71
|
+
direction: 'asc',
|
|
72
|
+
per_page: 5,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const fourteenDaysAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000);
|
|
76
|
+
const staleIssues = issues.filter(i => new Date(i.updated_at) < fourteenDaysAgo);
|
|
77
|
+
|
|
78
|
+
if (staleIssues.length > 0) {
|
|
79
|
+
core.info(`Found ${staleIssues.length} stale issue(s). Dispatching review.`);
|
|
80
|
+
await github.rest.actions.createWorkflowDispatch({
|
|
81
|
+
...context.repo,
|
|
82
|
+
workflow_id: 'agent-flow-review.yml',
|
|
83
|
+
ref: context.ref,
|
|
84
|
+
});
|
|
85
|
+
}
|