@xn-intenton-z2a/agentic-lib 7.2.11 → 7.2.12

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.
@@ -2,15 +2,12 @@
2
2
  # Copyright (C) 2025-2026 Polycode Limited
3
3
  # .github/workflows/agentic-lib-init.yml
4
4
  #
5
- # Self-contained init: update agentic-lib, purge, push to main [skip ci].
6
- # Does NOT create a PR. Does NOT trigger any other workflow.
7
- # Closes hanging init PRs before running.
8
- #
9
- # In agentic-lib: schedule trigger is commented out.
10
- # During init: #@dist restores the schedule.
5
+ # Init: delegates to agentic-lib-update.yml for the update step, then
6
+ # optionally reseeds or purges user content and configures schedule/model.
7
+ # Commits and pushes to main [skip ci].
11
8
 
12
9
  name: agentic-lib-init
13
- run-name: "agentic-lib-init [${{ github.ref_name }}]"
10
+ run-name: "agentic-lib-init ${{ inputs.mode || 'update' }} [${{ github.ref_name }}]"
14
11
 
15
12
  on:
16
13
  workflow_call:
@@ -120,49 +117,27 @@ on:
120
117
  permissions: write-all
121
118
 
122
119
  jobs:
123
- params:
124
- runs-on: ubuntu-latest
125
- steps:
126
- - name: Normalise params
127
- id: normalise
128
- shell: bash
129
- run: |
130
- MODE='${{ inputs.mode }}'
131
- echo "mode=${MODE:-update}" >> $GITHUB_OUTPUT
132
- DRY_RUN='${{ inputs.dry-run }}'
133
- echo "dry-run=${DRY_RUN:-false}" >> $GITHUB_OUTPUT
134
- MISSION_SEED='${{ inputs.mission-seed }}'
135
- echo "mission-seed=${MISSION_SEED:-hamming-distance}" >> $GITHUB_OUTPUT
136
- MISSION_TEXT='${{ inputs.mission-text }}'
137
- echo "mission-text=${MISSION_TEXT}" >> $GITHUB_OUTPUT
138
- SCHEDULE='${{ inputs.schedule }}'
139
- echo "schedule=${SCHEDULE}" >> $GITHUB_OUTPUT
140
- MODEL='${{ inputs.model }}'
141
- echo "model=${MODEL:-gpt-5-mini}" >> $GITHUB_OUTPUT
142
- PROFILE='${{ inputs.profile }}'
143
- echo "profile=${PROFILE}" >> $GITHUB_OUTPUT
144
- outputs:
145
- mode: ${{ steps.normalise.outputs.mode }}
146
- dry-run: ${{ steps.normalise.outputs.dry-run }}
147
- mission-seed: ${{ steps.normalise.outputs.mission-seed }}
148
- mission-text: ${{ steps.normalise.outputs.mission-text }}
149
- schedule: ${{ steps.normalise.outputs.schedule }}
150
- model: ${{ steps.normalise.outputs.model }}
151
- profile: ${{ steps.normalise.outputs.profile }}
120
+ # Step 1: Update agentic-lib and infrastructure (commits to main)
121
+ update:
122
+ uses: ./.github/workflows/agentic-lib-update.yml
123
+ with:
124
+ dry-run: ${{ inputs.dry-run || 'false' }}
125
+ secrets: inherit
152
126
 
127
+ # Step 2: Reseed/purge and configure (only if mode != update)
153
128
  init:
154
- needs: params
129
+ needs: update
130
+ if: inputs.mode == 'reseed' || inputs.mode == 'purge'
155
131
  runs-on: ubuntu-latest
156
132
  env:
157
- INIT_MODE: ${{ needs.params.outputs.mode }}
158
- INIT_DRY_RUN: ${{ needs.params.outputs.dry-run }}
159
- INIT_MISSION_SEED: ${{ needs.params.outputs.mission-seed }}
160
- INIT_MISSION_TEXT: ${{ needs.params.outputs.mission-text }}
133
+ INIT_MODE: ${{ inputs.mode }}
134
+ INIT_MISSION_SEED: ${{ inputs.mission-seed || 'hamming-distance' }}
135
+ INIT_MISSION_TEXT: ${{ inputs.mission-text }}
161
136
  steps:
162
137
  - uses: actions/checkout@v6
163
- if: needs.params.outputs.dry-run == 'true'
138
+ if: inputs.dry-run == 'true' || inputs.dry-run == true
164
139
  - uses: actions/checkout@v6
165
- if: needs.params.outputs.dry-run != 'true'
140
+ if: inputs.dry-run != 'true' && inputs.dry-run != true
166
141
  with:
167
142
  ref: main
168
143
  token: ${{ secrets.WORKFLOW_TOKEN }}
@@ -172,11 +147,10 @@ jobs:
172
147
  node-version: "24"
173
148
 
174
149
  - name: Close hanging init PRs
175
- if: github.repository != 'xn-intenton-z2a/agentic-lib' && env.INIT_MODE == 'purge' && needs.params.outputs.dry-run != 'true'
150
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && env.INIT_MODE == 'purge' && inputs.dry-run != 'true' && inputs.dry-run != true
176
151
  env:
177
152
  GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
178
153
  run: |
179
- # Close any open PRs from previous init runs
180
154
  gh pr list --state open --json number,headRefName \
181
155
  --jq '.[] | select(.headRefName | startswith("agentic-lib-init-")) | .number' \
182
156
  | while read -r pr_num; do
@@ -184,18 +158,15 @@ jobs:
184
158
  gh pr close "$pr_num" --delete-branch || true
185
159
  done
186
160
 
187
- - name: Update agentic-lib to latest
188
- run: npm update @xn-intenton-z2a/agentic-lib
189
-
190
- - name: Run init
161
+ - name: Run init (reseed/purge)
191
162
  env:
192
163
  GH_TOKEN: ${{ github.token }}
193
164
  run: |
194
165
  FLAGS="init"
195
166
  if [ "$INIT_MODE" = "reseed" ]; then FLAGS="$FLAGS --reseed"; fi
196
167
  if [ "$INIT_MODE" = "purge" ]; then FLAGS="$FLAGS --purge --mission $INIT_MISSION_SEED"; fi
197
- if [ "$INIT_DRY_RUN" = "true" ]; then FLAGS="$FLAGS --dry-run"; fi
198
- # Use local CLI if available (agentic-lib dev), otherwise npx
168
+ DRY_RUN='${{ inputs.dry-run }}'
169
+ if [ "$DRY_RUN" = "true" ]; then FLAGS="$FLAGS --dry-run"; fi
199
170
  if [ -f "bin/agentic-lib.js" ]; then
200
171
  node bin/agentic-lib.js $FLAGS
201
172
  else
@@ -203,7 +174,7 @@ jobs:
203
174
  fi
204
175
 
205
176
  - name: Write mission text (if provided, overrides seed)
206
- if: env.INIT_MISSION_TEXT != '' && needs.params.outputs.dry-run != 'true'
177
+ if: env.INIT_MISSION_TEXT != '' && inputs.dry-run != 'true' && inputs.dry-run != true
207
178
  run: |
208
179
  printf '# Mission\n\n%s\n' "$INIT_MISSION_TEXT" > MISSION.md
209
180
  echo "Wrote custom mission text to MISSION.md"
@@ -221,18 +192,16 @@ jobs:
221
192
  - run: npm test
222
193
 
223
194
  - name: Update model and profile (if requested)
224
- if: github.repository != 'xn-intenton-z2a/agentic-lib' && needs.params.outputs.dry-run != 'true' && (needs.params.outputs.model != '' || needs.params.outputs.profile != '')
195
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && inputs.dry-run != 'true' && inputs.dry-run != true && (inputs.model != '' || inputs.profile != '')
225
196
  uses: actions/github-script@v8
226
197
  with:
227
198
  script: |
228
199
  const fs = require('fs');
229
- const model = '${{ needs.params.outputs.model }}';
230
- const profile = '${{ needs.params.outputs.profile }}';
200
+ const model = '${{ inputs.model }}';
201
+ const profile = '${{ inputs.profile }}';
231
202
  const tomlPath = 'agentic-lib.toml';
232
203
  if (!fs.existsSync(tomlPath)) return;
233
204
  let toml = fs.readFileSync(tomlPath, 'utf8');
234
- // Extract the [tuning] section, then replace within it.
235
- // Previous regex [^\[]*? failed when comments contained '[' characters.
236
205
  const tuningSectionRegex = /(\[tuning\])([\s\S]*?)(?=\n\[|$)/;
237
206
  const tuningMatch = toml.match(tuningSectionRegex);
238
207
  if (tuningMatch) {
@@ -256,13 +225,13 @@ jobs:
256
225
  fs.writeFileSync(tomlPath, toml);
257
226
 
258
227
  - name: Update schedule (if requested)
259
- if: github.repository != 'xn-intenton-z2a/agentic-lib' && needs.params.outputs.schedule != '' && needs.params.outputs.dry-run != 'true'
228
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && inputs.schedule != '' && inputs.dry-run != 'true' && inputs.dry-run != true
260
229
  uses: actions/github-script@v8
261
230
  with:
262
231
  script: |
263
232
  const fs = require('fs');
264
- const frequency = '${{ needs.params.outputs.schedule }}';
265
- const model = '${{ needs.params.outputs.model || 'gpt-5-mini' }}';
233
+ const frequency = '${{ inputs.schedule }}';
234
+ const model = '${{ inputs.model || 'gpt-5-mini' }}';
266
235
  const workflowPath = '.github/workflows/agentic-lib-workflow.yml';
267
236
  const tomlPath = 'agentic-lib.toml';
268
237
 
@@ -308,7 +277,7 @@ jobs:
308
277
  }
309
278
 
310
279
  - name: Commit and push to main [skip ci]
311
- if: github.repository != 'xn-intenton-z2a/agentic-lib' && needs.params.outputs.dry-run != 'true'
280
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && inputs.dry-run != 'true' && inputs.dry-run != true
312
281
  env:
313
282
  GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
314
283
  run: |
@@ -334,9 +303,8 @@ jobs:
334
303
  fi
335
304
  done
336
305
 
337
- # W8: Create initial seed issues after purge so the pipeline has work to do
338
306
  - name: Create initial seed issues
339
- if: github.repository != 'xn-intenton-z2a/agentic-lib' && env.INIT_MODE == 'purge' && needs.params.outputs.dry-run != 'true'
307
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && env.INIT_MODE == 'purge' && inputs.dry-run != 'true' && inputs.dry-run != true
340
308
  uses: actions/github-script@v8
341
309
  with:
342
310
  script: |
@@ -345,7 +313,6 @@ jobs:
345
313
  ? fs.readFileSync('MISSION.md', 'utf8')
346
314
  : '(no MISSION.md found)';
347
315
 
348
- // Ensure labels exist
349
316
  for (const label of ['automated', 'ready']) {
350
317
  try {
351
318
  await github.rest.issues.createLabel({
@@ -356,7 +323,6 @@ jobs:
356
323
  } catch (e) { /* label already exists */ }
357
324
  }
358
325
 
359
- // W8a: Initial unit tests issue
360
326
  const unitTestBody = [
361
327
  'Create a unit test file for each of the major features in the mission ',
362
328
  'and put a TODO in a trivial empty passing test in each.',
@@ -373,7 +339,6 @@ jobs:
373
339
  });
374
340
  core.info(`Created issue #${issue1.number}: Initial unit tests`);
375
341
 
376
- // W8b: Initial web layout issue
377
342
  const webLayoutBody = [
378
343
  'Create the home page layout to showcase each of the major features in the mission ',
379
344
  'and put a TODO in a trivial empty passing test in each.',
@@ -0,0 +1,100 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (C) 2025-2026 Polycode Limited
3
+ # .github/workflows/agentic-lib-update.yml
4
+ #
5
+ # Update agentic-lib to latest, extract workflows/actions/scripts, run tests,
6
+ # commit and push to main [skip ci]. Does NOT reseed or purge user content.
7
+ #
8
+ # In agentic-lib: schedule trigger is commented out.
9
+ # During init: #@dist restores the schedule.
10
+
11
+ name: agentic-lib-update
12
+ run-name: "agentic-lib-update [${{ github.ref_name }}]"
13
+
14
+ on:
15
+ workflow_call:
16
+ inputs:
17
+ dry-run:
18
+ type: string
19
+ required: false
20
+ default: "false"
21
+ #@dist schedule:
22
+ #@dist - cron: "15 6 * * *"
23
+ workflow_dispatch:
24
+ inputs:
25
+ dry-run:
26
+ description: "Preview changes without committing"
27
+ type: boolean
28
+ required: false
29
+ default: false
30
+
31
+ permissions: write-all
32
+
33
+ jobs:
34
+ update:
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - uses: actions/checkout@v6
38
+ if: inputs.dry-run == 'true' || inputs.dry-run == true
39
+ - uses: actions/checkout@v6
40
+ if: inputs.dry-run != 'true' && inputs.dry-run != true
41
+ with:
42
+ ref: main
43
+ token: ${{ secrets.WORKFLOW_TOKEN }}
44
+
45
+ - uses: actions/setup-node@v6
46
+ with:
47
+ node-version: "24"
48
+
49
+ - name: Update agentic-lib to latest
50
+ run: npm update @xn-intenton-z2a/agentic-lib
51
+
52
+ - name: Run init (update mode)
53
+ env:
54
+ GH_TOKEN: ${{ github.token }}
55
+ run: |
56
+ # Use local CLI if available (agentic-lib dev), otherwise npx
57
+ if [ -f "bin/agentic-lib.js" ]; then
58
+ node bin/agentic-lib.js init
59
+ else
60
+ npx @xn-intenton-z2a/agentic-lib init
61
+ fi
62
+
63
+ - run: npm install
64
+
65
+ - name: Install agentic-step deps
66
+ if: hashFiles('.github/agentic-lib/actions/agentic-step/package.json') != ''
67
+ run: cd .github/agentic-lib/actions/agentic-step && npm ci
68
+
69
+ - name: Install sub-project dependencies (agentic-lib dev only)
70
+ if: hashFiles('src/actions/agentic-step/package.json') != ''
71
+ run: cd src/actions/agentic-step && npm ci
72
+
73
+ - run: npm test
74
+
75
+ - name: Commit and push to main [skip ci]
76
+ if: github.repository != 'xn-intenton-z2a/agentic-lib' && inputs.dry-run != 'true' && inputs.dry-run != true
77
+ env:
78
+ GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
79
+ run: |
80
+ TOKEN_USER=$(gh api /user --jq '.login')
81
+ TOKEN_ID=$(gh api /user --jq '.id')
82
+ git config user.name "${TOKEN_USER}"
83
+ git config user.email "${TOKEN_ID}+${TOKEN_USER}@users.noreply.github.com"
84
+ git add -A
85
+ git diff --cached --quiet && echo "No changes" && exit 0
86
+ VERSION=$(npx @xn-intenton-z2a/agentic-lib version 2>/dev/null || echo "latest")
87
+ git commit -m "update agentic-lib@${VERSION} [skip ci]"
88
+ for attempt in 1 2 3; do
89
+ git push origin main && break
90
+ echo "Push failed (attempt $attempt) — pulling and retrying"
91
+ git pull --rebase origin main || {
92
+ echo "Rebase conflict — aborting rebase and retrying"
93
+ git rebase --abort 2>/dev/null || true
94
+ }
95
+ sleep $((attempt * 2))
96
+ if [ "$attempt" -eq 3 ]; then
97
+ echo "::error::Failed to push after 3 attempts"
98
+ exit 1
99
+ fi
100
+ done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xn-intenton-z2a/agentic-lib",
3
- "version": "7.2.11",
3
+ "version": "7.2.12",
4
4
  "description": "Agentic-lib Agentic Coding Systems SDK powering automated GitHub workflows.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  "author": "",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@xn-intenton-z2a/agentic-lib": "^7.2.11"
20
+ "@xn-intenton-z2a/agentic-lib": "^7.2.12"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@playwright/test": "^1.58.0",