@xn-intenton-z2a/agentic-lib 7.1.28 → 7.1.30

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.
@@ -814,7 +814,7 @@ function initPurge(seedsDir) {
814
814
  clearAndRecreateDir(sourcePath, sourcePath);
815
815
  clearAndRecreateDir(testsPath, testsPath);
816
816
 
817
- // Copy seed files
817
+ // Copy seed files (including config TOML)
818
818
  const SEED_MAP = {
819
819
  "zero-main.js": "src/lib/main.js",
820
820
  "zero-main.test.js": "tests/unit/main.test.js",
@@ -822,6 +822,7 @@ function initPurge(seedsDir) {
822
822
  "zero-SOURCES.md": "SOURCES.md",
823
823
  "zero-package.json": "package.json",
824
824
  "zero-README.md": "README.md",
825
+ "zero-agentic-lib.toml": "agentic-lib.toml",
825
826
  };
826
827
  for (const [seedFile, targetRel] of Object.entries(SEED_MAP)) {
827
828
  const src = resolve(seedsDir, seedFile);
@@ -831,6 +832,114 @@ function initPurge(seedsDir) {
831
832
  }
832
833
  }
833
834
 
835
+ function initPurgeGitHub() {
836
+ console.log("\n--- Purge: Close GitHub Issues + Lock Discussions ---");
837
+
838
+ // Detect the GitHub repo from git remote
839
+ let repoSlug = "";
840
+ try {
841
+ const remoteUrl = execSync("git remote get-url origin", {
842
+ cwd: target,
843
+ encoding: "utf8",
844
+ timeout: 10000,
845
+ }).trim();
846
+ // Parse owner/repo from git@github.com:owner/repo.git or https://github.com/owner/repo.git
847
+ const match = remoteUrl.match(/github\.com[:/]([^/]+\/[^/.]+)/);
848
+ if (match) repoSlug = match[1].replace(/\.git$/, "");
849
+ } catch {
850
+ console.log(" SKIP: Not a git repo or no origin remote — skipping GitHub purge");
851
+ return;
852
+ }
853
+ if (!repoSlug) {
854
+ console.log(" SKIP: Could not detect GitHub repo from remote — skipping GitHub purge");
855
+ return;
856
+ }
857
+
858
+ // Check gh CLI is available
859
+ try {
860
+ execSync("gh --version", { encoding: "utf8", timeout: 5000, stdio: "pipe" });
861
+ } catch {
862
+ console.log(" SKIP: gh CLI not found — skipping GitHub purge");
863
+ return;
864
+ }
865
+
866
+ // Close all open issues
867
+ try {
868
+ const issuesJson = execSync(
869
+ `gh issue list --repo ${repoSlug} --state open --json number,title --limit 100`,
870
+ { cwd: target, encoding: "utf8", timeout: 30000, stdio: ["pipe", "pipe", "pipe"] },
871
+ );
872
+ const issues = JSON.parse(issuesJson || "[]");
873
+ if (issues.length === 0) {
874
+ console.log(" No open issues to close");
875
+ } else {
876
+ for (const issue of issues) {
877
+ console.log(` CLOSE: issue #${issue.number} — ${issue.title}`);
878
+ if (!dryRun) {
879
+ try {
880
+ execSync(
881
+ `gh issue close ${issue.number} --repo ${repoSlug} --comment "Closed by init --purge (mission reset)"`,
882
+ { cwd: target, encoding: "utf8", timeout: 15000, stdio: "pipe" },
883
+ );
884
+ initChanges++;
885
+ } catch (err) {
886
+ console.log(` WARN: Failed to close issue #${issue.number}: ${err.message}`);
887
+ }
888
+ } else {
889
+ initChanges++;
890
+ }
891
+ }
892
+ }
893
+ } catch (err) {
894
+ console.log(` WARN: Could not list issues: ${err.message}`);
895
+ }
896
+
897
+ // Close open discussions
898
+ const [owner, repo] = repoSlug.split("/");
899
+ try {
900
+ const query = JSON.stringify({
901
+ query: `{ repository(owner:"${owner}", name:"${repo}") { discussions(first:50, states:OPEN) { nodes { id number title } } } }`,
902
+ });
903
+ const result = execSync(`gh api graphql --input -`, {
904
+ cwd: target,
905
+ encoding: "utf8",
906
+ timeout: 30000,
907
+ input: query,
908
+ stdio: ["pipe", "pipe", "pipe"],
909
+ });
910
+ const parsed = JSON.parse(result);
911
+ const discussions = parsed?.data?.repository?.discussions?.nodes || [];
912
+ if (discussions.length === 0) {
913
+ console.log(" No open discussions to close");
914
+ } else {
915
+ for (const disc of discussions) {
916
+ console.log(` CLOSE: discussion #${disc.number} — ${disc.title}`);
917
+ if (!dryRun) {
918
+ try {
919
+ const mutation = JSON.stringify({
920
+ query: `mutation { closeDiscussion(input: { discussionId: "${disc.id}" }) { discussion { number } } }`,
921
+ });
922
+ execSync(`gh api graphql --input -`, {
923
+ cwd: target,
924
+ encoding: "utf8",
925
+ timeout: 15000,
926
+ input: mutation,
927
+ stdio: ["pipe", "pipe", "pipe"],
928
+ });
929
+ initChanges++;
930
+ } catch {
931
+ console.log(` SKIP: Could not close discussion #${disc.number} (may need admin permissions)`);
932
+ }
933
+ } else {
934
+ initChanges++;
935
+ }
936
+ }
937
+ }
938
+ } catch {
939
+ console.log(" SKIP: Could not list discussions (feature may not be enabled)");
940
+ }
941
+ }
942
+
834
943
  function runInit() {
835
944
  if (!existsSync(target)) {
836
945
  console.error(`Target directory does not exist: ${target}`);
@@ -862,6 +971,7 @@ function runInit() {
862
971
  initConfig(seedsDir);
863
972
  if (reseed) initReseed();
864
973
  if (purge) initPurge(seedsDir);
974
+ if (purge) initPurgeGitHub();
865
975
 
866
976
  console.log(`\n${initChanges} change(s)${dryRun ? " (dry run)" : ""}`);
867
977
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xn-intenton-z2a/agentic-lib",
3
- "version": "7.1.28",
3
+ "version": "7.1.30",
4
4
  "description": "Agentic-lib Agentic Coding Systems SDK powering automated GitHub workflows.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -81,7 +81,9 @@ export async function reviewIssue(context) {
81
81
  writablePaths: [],
82
82
  });
83
83
 
84
- if (verdict.toUpperCase().startsWith("RESOLVED")) {
84
+ // Strip leading markdown formatting (e.g., **RESOLVED** or *RESOLVED*)
85
+ const normalised = verdict.replace(/^[*_`#>\s-]+/, "").toUpperCase();
86
+ if (normalised.startsWith("RESOLVED")) {
85
87
  await octokit.rest.issues.createComment({
86
88
  ...repo,
87
89
  issue_number: Number(targetIssueNumber),
@@ -31,11 +31,30 @@ runs:
31
31
  else
32
32
  git commit -m "${{ inputs.commit-message }}"
33
33
  REF="${{ inputs.push-ref }}"
34
- if [ -n "$REF" ]; then
35
- git pull --rebase origin "$REF"
36
- git push origin "$REF"
37
- else
38
- git pull --rebase
39
- git push
40
- fi
34
+ MAX_RETRIES=3
35
+ for attempt in $(seq 1 $MAX_RETRIES); do
36
+ if [ -n "$REF" ]; then
37
+ git pull --rebase origin "$REF" || {
38
+ echo "Rebase conflict on attempt $attempt — aborting rebase and retrying"
39
+ git rebase --abort 2>/dev/null || true
40
+ sleep $((attempt * 2))
41
+ continue
42
+ }
43
+ git push origin "$REF" && break
44
+ else
45
+ git pull --rebase || {
46
+ echo "Rebase conflict on attempt $attempt — aborting rebase and retrying"
47
+ git rebase --abort 2>/dev/null || true
48
+ sleep $((attempt * 2))
49
+ continue
50
+ }
51
+ git push && break
52
+ fi
53
+ if [ "$attempt" -eq "$MAX_RETRIES" ]; then
54
+ echo "::error::Failed to push after $MAX_RETRIES attempts"
55
+ exit 1
56
+ fi
57
+ echo "Push failed on attempt $attempt, retrying..."
58
+ sleep $((attempt * 2))
59
+ done
41
60
  fi
@@ -8,16 +8,16 @@ paths:
8
8
  path: "MISSION.md"
9
9
  librarySourcesFilepath:
10
10
  path: "SOURCES.md"
11
- permissions: []
12
- limit: 0
11
+ permissions: ["write"]
12
+ limit: 32
13
13
  libraryDocumentsPath:
14
14
  path: "library/"
15
- permissions: []
16
- limit: 0
15
+ permissions: ["write"]
16
+ limit: 32
17
17
  featuresPath:
18
18
  path: "features/"
19
19
  permissions: ["write"]
20
- limit: 2
20
+ limit: 4
21
21
 
22
22
  # Filepaths for engineer workflows
23
23
  contributingFilepath:
@@ -0,0 +1,3 @@
1
+ # Mission
2
+
3
+ Describe your project's mission here. The agentic workflows will evolve `src/lib/main.js` to fulfil this mission.
@@ -1,3 +1,14 @@
1
1
  # Mission
2
2
 
3
- Describe your project's mission here. The agentic workflows will evolve `src/lib/main.js` to fulfil this mission.
3
+ _"Be a go-to plot library with a CLI, be the jq of formulae visualisations."_
4
+
5
+ **plot-code-lib** is a JavaScript library and CLI tool designed to:
6
+ - Transform and given range and a simple expression syntax for (pick an existing open standard) to time series data.
7
+ - Read and write the time series data in a standard format (pick an existing open standard).
8
+ - Make use of libraries for formula parsing, time series generation, plotting, and persistence in image formats.
9
+ - Generate SVG and PNG plots from the time series data and save these as files.
10
+ - Variations on this example: `node run start -- --expression "y=sin(x)" --range "x=-1:-1,y=-1:-1" --file output.svg` .
11
+ - Showcase all the features of the library via a CLI by dry running tp generate example commands and output in the README.md file.
12
+
13
+ `plot-code-lib` facilitate the creation of plots from mathematical expressions and time series data. It will take a
14
+ mathematical expression and a range of values and generate a plot in SVG or PNG format.
@@ -14,7 +14,7 @@
14
14
  "author": "",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@xn-intenton-z2a/agentic-lib": "^7.1.28"
17
+ "@xn-intenton-z2a/agentic-lib": "^7.1.30"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@vitest/coverage-v8": "^4.0.0",
@@ -7,7 +7,9 @@
7
7
 
8
8
  name: agent-discussions-bot
9
9
  run-name: "agent-discussions-bot [${{ github.ref_name }}]"
10
- concurrency: agentic-lib-bot
10
+ concurrency:
11
+ group: agentic-lib-bot-${{ github.event.discussion.node_id || github.run_id }}
12
+ cancel-in-progress: false
11
13
 
12
14
  on:
13
15
  discussion:
@@ -24,6 +26,11 @@ on:
24
26
  - cron: "7 12 */28 * *" # schedule-1: every 28 days
25
27
  workflow_dispatch:
26
28
  inputs:
29
+ discussion-url:
30
+ description: "Discussion URL to respond to (required for supervisor-dispatched runs)"
31
+ type: string
32
+ required: false
33
+ default: ""
27
34
  model:
28
35
  description: "Copilot SDK model to use"
29
36
  type: choice
@@ -76,8 +83,8 @@ jobs:
76
83
  uses: actions/github-script@v7
77
84
  with:
78
85
  script: |
79
- let url = '';
80
- if (context.payload.discussion) {
86
+ let url = '${{ inputs.discussion-url }}' || '';
87
+ if (!url && context.payload.discussion) {
81
88
  url = context.payload.discussion.html_url;
82
89
  }
83
90
  core.setOutput('url', url);
@@ -7,7 +7,9 @@
7
7
 
8
8
  name: agent-flow-maintain
9
9
  run-name: "agent-flow-maintain [${{ github.ref_name }}]"
10
- concurrency: agentic-lib-main
10
+ concurrency:
11
+ group: agentic-lib-maintain
12
+ cancel-in-progress: true
11
13
 
12
14
  on:
13
15
  schedule:
@@ -6,7 +6,9 @@
6
6
 
7
7
  name: agent-flow-review
8
8
  run-name: "agent-flow-review [${{ github.ref_name }}]"
9
- concurrency: agentic-lib-main
9
+ concurrency:
10
+ group: agentic-lib-review
11
+ cancel-in-progress: true
10
12
 
11
13
  on:
12
14
  schedule:
@@ -7,7 +7,9 @@
7
7
 
8
8
  name: agent-flow-transform
9
9
  run-name: "agent-flow-transform [${{ github.ref_name }}]"
10
- concurrency: agentic-lib-main
10
+ concurrency:
11
+ group: agentic-lib-transform
12
+ cancel-in-progress: true
11
13
 
12
14
  on:
13
15
  schedule: