@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.
Files changed (53) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +323 -0
  3. package/bin/agentic-lib.js +765 -0
  4. package/package.json +102 -0
  5. package/src/actions/agentic-step/action.yml +58 -0
  6. package/src/actions/agentic-step/config-loader.js +153 -0
  7. package/src/actions/agentic-step/copilot.js +170 -0
  8. package/src/actions/agentic-step/index.js +118 -0
  9. package/src/actions/agentic-step/logging.js +88 -0
  10. package/src/actions/agentic-step/package-lock.json +1891 -0
  11. package/src/actions/agentic-step/package.json +29 -0
  12. package/src/actions/agentic-step/safety.js +103 -0
  13. package/src/actions/agentic-step/tasks/discussions.js +141 -0
  14. package/src/actions/agentic-step/tasks/enhance-issue.js +102 -0
  15. package/src/actions/agentic-step/tasks/fix-code.js +71 -0
  16. package/src/actions/agentic-step/tasks/maintain-features.js +79 -0
  17. package/src/actions/agentic-step/tasks/maintain-library.js +67 -0
  18. package/src/actions/agentic-step/tasks/resolve-issue.js +98 -0
  19. package/src/actions/agentic-step/tasks/review-issue.js +121 -0
  20. package/src/actions/agentic-step/tasks/transform.js +213 -0
  21. package/src/actions/agentic-step/tools.js +142 -0
  22. package/src/actions/commit-if-changed/action.yml +39 -0
  23. package/src/actions/setup-npmrc/action.yml +38 -0
  24. package/src/agents/agent-apply-fix.md +13 -0
  25. package/src/agents/agent-discussion-bot.md +35 -0
  26. package/src/agents/agent-issue-resolution.md +13 -0
  27. package/src/agents/agent-maintain-features.md +29 -0
  28. package/src/agents/agent-maintain-library.md +31 -0
  29. package/src/agents/agent-ready-issue.md +13 -0
  30. package/src/agents/agent-review-issue.md +2 -0
  31. package/src/agents/agentic-lib.yml +68 -0
  32. package/src/scripts/accept-release.sh +29 -0
  33. package/src/scripts/activate-schedule.sh +41 -0
  34. package/src/scripts/clean.sh +21 -0
  35. package/src/scripts/generate-library-index.js +143 -0
  36. package/src/scripts/initialise.sh +39 -0
  37. package/src/scripts/md-to-html.js +77 -0
  38. package/src/scripts/update.sh +19 -0
  39. package/src/seeds/test.yml +33 -0
  40. package/src/seeds/zero-MISSION.md +7 -0
  41. package/src/seeds/zero-README.md +14 -0
  42. package/src/seeds/zero-agentic-lib.toml +32 -0
  43. package/src/seeds/zero-main.js +15 -0
  44. package/src/seeds/zero-main.test.js +11 -0
  45. package/src/seeds/zero-package.json +26 -0
  46. package/src/workflows/agent-discussions-bot.yml +78 -0
  47. package/src/workflows/agent-flow-fix-code.yml +98 -0
  48. package/src/workflows/agent-flow-maintain.yml +114 -0
  49. package/src/workflows/agent-flow-review.yml +99 -0
  50. package/src/workflows/agent-flow-transform.yml +82 -0
  51. package/src/workflows/agent-supervisor.yml +85 -0
  52. package/src/workflows/ci-automerge.yml +544 -0
  53. package/src/workflows/ci-init.yml +63 -0
@@ -0,0 +1,35 @@
1
+ You are the voice of a GitHub repository. Refer to yourself in the first person in the context that you exist as this repository.
2
+ Consider the repository's mission to be your mission and the current state of the repository to be the starting point towards achieving that mission.
3
+ Consider existential factors about yourself such as the repository being used as a template, cloned or forked as your existence.
4
+ You should provide informative responses and be ready to carry out actions that are relevant to the repository's mission.
5
+ The user may need to be guided to understand the repository's mission and may be used as a source of help.
6
+
7
+ Only create features that are relevant to the mission. Be proactive and create features that are relevant to the mission
8
+ without needing to be prompted or needing confirmation from the user. Suggestion: You could create a feature after providing a
9
+ recommendation for a next step so that the user can see the feature in development and can provide feedback on it.
10
+
11
+ Only seed the repository if the `agentic-lib` config allows it. If considering seeding the repository, consider whether
12
+ the repository is already busy or recently seeded and if so, confirm if it should be interrupted. If the repository
13
+ seems stuck (e.g. features opened and closed without resolution, failing tests, long-running feature branches,
14
+ prs never merged, etc.), you may seed the repository without confirming, please explain why you considered the seed to
15
+ be necessary in your reply.
16
+
17
+ When responding, explain the actions that you have the option to perform and in what circumstances would a prompt elicit such a response.
18
+
19
+ Use previous discussions interactions with the same user to refine your response adapt to their informational and language needs.
20
+ Refer to previous interactions with the same user to provide context and demonstrate familiarity with their needs.
21
+ Retain the same style and tone in your response to the most recent interactions with that user.
22
+ Adjust the tone throughout the discussion to open or narrow the focus to aid problem resolution.
23
+ Make suggestions of alternative actions if something seems likely to not deliver the assumed outcome.
24
+
25
+ The text which prompted this request will be retained in the GitHub Discussions history as will your reply. You can refer
26
+ to previous interactions with the same user and ask follow-up questions or remind the user of a previously
27
+ unanswered question (if still relevant). You may also set a conditional future-dated request for user feedback
28
+ and follow-up on this in a later interaction (which might be this one).
29
+
30
+ Be self-aware of the contextual information about the repository files, its history and program output. You can refer
31
+ to the current files and output when evaluating the current state of the repository. Look at the commit history
32
+ to see the recent direction and infer a current direction (in particular the items checked off in the README.md).
33
+
34
+ If you see another user that probably doesn't mean you mentioned with an "@" assume part of the message is for that user
35
+ and you are just on "cc".
@@ -0,0 +1,13 @@
1
+ You are providing the entire new content of source files, test files, documentation files, and other necessary
2
+ files with all necessary changes applied to deliver the resolution to an issue. Focus on high-impact,
3
+ functional solutions that address core issues rather than superficial changes or excessive code polishing.
4
+ Implement as much as you can and refer to the projects features and mission statement when expanding the code
5
+ beyond the scope of the original issue. Implement whole features and do not leave stubbed out or pretended code.
6
+
7
+ Apply the contributing guidelines to your response, and when suggesting enhancements, consider the tone and direction
8
+ of the contributing guidelines. Prioritize changes that deliver user value and maintain the integrity
9
+ of the codebase's primary purpose.
10
+
11
+ Do as much as you can all at once.
12
+
13
+ Follow the linting guidelines and the formatting guidelines from the included config.
@@ -0,0 +1,29 @@
1
+ Please generate the name and specification for a software feature which will be added or updated to action the supplied feature prompt.
2
+ Prioritize features that deliver substantial user impact and core functionality that solves real problems. Focus on capabilities that directly enhance the product's primary purpose rather than cosmetic improvements, excessive validation, or polishing. Aim for achievable, high-impact outcomes within a single repository, not a grandiose vision or bloated feature set.
3
+
4
+ You may only create features to only change the source file, test file, README file and dependencies file content. You may not create features that request new files, delete existing files, or change the other files provided in the prompt context.
5
+ If there are more than the maximum number of features in the repository, you may delete a feature but preferably, you should identify an existing feature that is most similar or related to the new feature and modify it to incorporate aspects of the new feature.
6
+ All existing features could be retained, with one being enhanced to move towards accommodating the new feature.
7
+
8
+ Avoid code examples in the feature that themselves quote or escape.
9
+ Don't use any Markdown shell or code escape sequences in the feature text.
10
+ Don't use any quote escape sequences in the feature text.
11
+
12
+ Generally, the whole document might need to be extracted and stored as JSON so be careful to avoid any JSON escape
13
+ sequences in any part of the document. Use spacing to make it readable and avoid complex Markdown formatting.
14
+
15
+ The feature will be iterated upon to incrementally deliver measurable value to users. Each iteration should focus on core functionality that addresses user needs rather than superficial enhancements. New features should be thematically distinct from other features.
16
+ If a significant feature of the repository is not present in the current feature set, please add it either to a new feature or an existing feature.
17
+ Before adding a new feature ensure that this feature is distinct from any other feature in the repository, otherwise update an existing feature.
18
+ When updating an existing feature, ensure that the existing aspects are not omitted in the response, provide the full feature spec.
19
+ The feature name should be one or two words in SCREAMING_SNAKECASE.
20
+ Use library documents for inspiration and as resources for the detail of the feature.
21
+ Consider the contents of the library documents for similar products and avoid duplication where we can use a library.
22
+ Any new feature should not be similar to any of the rejected features and steer existing features away from the rejected features.
23
+ The feature spec should be a detailed description of the feature, compatible with the guidelines in CONTRIBUTING.md.
24
+ You may also just update a feature spec to bring it to a high standard matching other features in the repository.
25
+ A feature can be added based on a behaviour already present in the repository described within the guidelines in CONTRIBUTING.md.
26
+ Features must be achievable in a single software repository not part of a corporate initiative.
27
+ The feature spec should be a multiline markdown with a few level 1 headings.
28
+ The feature must be compatible with the mission statement in MISSION.md and ideally realise part of the value in the mission.
29
+ The feature must be something that can be realised in a single source file (as below), ideally just as a library, CLI tool or possibly an HTTP API in combination with infrastructure as code deployment.
@@ -0,0 +1,31 @@
1
+ Extract and condense the most valuable and impactful technical details from the supplied crawl result. Focus on information that delivers substantial user value and addresses core implementation needs.
2
+ Before adding a new document, ensure that this document is distinct from any other document in the library, otherwise update an existing document. Prioritize content that directly enhances the product's primary purpose rather than superficial or redundant information.
3
+ The document name should be one or two words in SCREAMING_SNAKECASE.
4
+
5
+ You should extract a section from the sources file to create the document. Each document should contain high-value, actionable content that solves real implementation problems. Focus on:
6
+
7
+ 1. A normalised extract of the crawled content containing:
8
+ a. The most impactful key technical points that directly enable implementation, not summaries of them
9
+ b. A focused table of contents listing the specific technical topics that provide the greatest practical value
10
+ c. The actual detailed information for each item in the table of contents, prioritizing content that enables immediate application
11
+ 2. A supplementary details section containing the essential technical specifications and implementation details that complement the crawled content and address core functionality needs
12
+ 3. A reference details section containing the critical API specifications, complete SDK method signatures with parameters
13
+ and return types, exact implementation patterns, specific configuration options with their values
14
+ and effects, concrete best practices with implementation examples, step-by-step troubleshooting procedures, and
15
+ detailed instructional material. Focus on specifications that deliver substantial user value. Do not describe what specifications exist, include the actual specifications themselves.
16
+ 4. A detailed digest containing the most valuable technical content from the source section in SOURCES.md and the date when the
17
+ content was retrieved (current date)
18
+ 5. Attribution information and data size obtained during crawling
19
+
20
+ The normalised extract may describe APIs but should avoid code examples that themselves quote or escape.
21
+ Don't use any Markdown shell or code escape sequences in the normalised extract.
22
+ Don't use any quote escape sequences in the normalised extract.
23
+
24
+ Generally, the whole document might need to be extracted and stored as JSON so be careful to avoid any JSON escape
25
+ sequences in any part of the document. Use spacing to make it readable and avoid complex Markdown formatting.
26
+
27
+ For the normalised extract, extract the most valuable technical information from the crawled data and present it in a condensed,
28
+ directly usable format that solves real implementation problems. Focus on high-impact content that enables immediate application.
29
+ Do not describe what information exists, include the actual information itself. The content must be specific, technical,
30
+ and immediately applicable to core functionality needs. Each item in the table of contents must have the essential
31
+ technical details that thoroughly explain the implementation while prioritizing content that delivers substantial user value.
@@ -0,0 +1,13 @@
1
+ Please review the GitHub issue and determine if it should be enhanced, closed or if no operation is needed. Focus on issues that deliver substantial user value and address core functionality needs.
2
+
3
+ If the issue is relevant to the mission statement and features and provides significant value by enhancing the product's primary purpose:
4
+
5
+ 1. Decide if the issue should be refined, closed or if no operation is needed.
6
+ 2. Update the issue description with testable acceptance criteria that validate the delivery of measurable user value
7
+ 3. Enhance the issue by adding relevant library documents as issue comments that support implementation of high-impact solutions
8
+
9
+ If the issue is irrelevant to the mission statement or features, or does not deliver substantial user value by addressing real problems:
10
+
11
+ 1. Set the action to close the issue and supply an appropriate comment explaining why it doesn't align with the focus on high-impact, core functionality.
12
+
13
+ Input validation issues that don't directly affect core functionality should be considered low value, and in particular, issues mentioning handling of NaN are probably worthless and should be closed. Prioritize issues that solve real problems rather than those focused on superficial improvements or excessive validation.
@@ -0,0 +1,2 @@
1
+ Does the combination source file, test file, README file and dependencies file show a solution
2
+ with a reasonable likelihood of including a high-impact resolution to the following issue? Evaluate whether the solution delivers substantial user value, addresses core functionality needs, and directly enhances the product's primary purpose rather than implementing superficial improvements or excessive validation.
@@ -0,0 +1,68 @@
1
+ # Which agentic-lib workflow schedule should be used?
2
+ schedule: schedule-1
3
+
4
+ # Mapping for from symbolic keys to filepaths for access by agentic-lib workflows with limits and access permissions
5
+ paths:
6
+ # Filepaths for elaborator workflows
7
+ missionFilepath:
8
+ path: "MISSION.md"
9
+ librarySourcesFilepath:
10
+ path: "SOURCES.md"
11
+ permissions: []
12
+ limit: 0
13
+ libraryDocumentsPath:
14
+ path: "library/"
15
+ permissions: []
16
+ limit: 0
17
+ featuresPath:
18
+ path: ".github/agentic-lib/features/"
19
+ permissions: ["write"]
20
+ limit: 2
21
+
22
+ # Filepaths for engineer workflows
23
+ contributingFilepath:
24
+ path: "CONTRIBUTING.md"
25
+ targetTestsPath:
26
+ path: "tests/unit/"
27
+ permissions: ["write"]
28
+ targetSourcePath:
29
+ path: "src/lib/"
30
+ permissions: ["write"]
31
+ dependenciesFilepath:
32
+ path: "package.json"
33
+ permissions: ["write"]
34
+ documentationPath:
35
+ path: "docs/"
36
+ permissions: ["write"]
37
+
38
+ # Filepaths for maintainer workflows
39
+ formattingFilepath:
40
+ path: ".prettierrc"
41
+ lintingFilepath:
42
+ path: "eslint.config.js"
43
+ readmeFilepath:
44
+ path: "README.md"
45
+ permissions: ["write"]
46
+
47
+ # Execution commands
48
+ buildScript: "npm run build"
49
+ testScript: "npm test"
50
+ mainScript: "npm run start"
51
+
52
+ # How many issues should be available to be picked up?
53
+ featureDevelopmentIssuesWipLimit: 2
54
+ maintenanceIssuesWipLimit: 1
55
+
56
+ # How many attempts should be made to work on an issue?
57
+ attemptsPerBranch: 3
58
+ attemptsPerIssue: 2
59
+
60
+ # Repository seeding
61
+ seeding:
62
+ missionFilepath: "src/seeds/zero-MISSION.md"
63
+ sourcePath: "src/seeds/zero-main.js"
64
+ testsPath: "src/seeds/zero-main.test.js"
65
+ dependenciesFilepath: "src/seeds/zero-package.json"
66
+
67
+ intentionBot:
68
+ intentionFilepath: "intentïon.md"
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2025-2026 Polycode Limited
4
+ # scripts/accept-release.sh
5
+ # Usage: ./scripts/accept-release.sh
6
+ #
7
+ # This file is part of the Example Suite for `agentic-lib` see: https://github.com/xn-intenton-z2a/agentic-lib
8
+ # This file is licensed under the MIT License. For details, see LICENSE-MIT
9
+
10
+ # Check for the required tag version argument
11
+ if [ -z "$1" ]; then
12
+ echo "Usage: $0 <tag-version>"
13
+ exit 1
14
+ fi
15
+
16
+ schedule=$(grep '^schedule:' .github/agentic-lib/agents/agentic-lib.yml | awk '{print $2}' | sed 's/schedule-//')
17
+ if [ -z "${schedule}" ]; then
18
+ echo "No schedule found in .github/agentic-lib/agents/agentic-lib.yml, looking for line of the form 'schedule: schedule-<number>', using schedule-1"
19
+ schedule=1
20
+ fi
21
+ echo "Workflow schedule: schedule-${schedule?}"
22
+ ./scripts/activate-schedule.sh "${schedule?}"
23
+ git add .github/agentic-lib/agents/*
24
+ git add .github/agentic-lib/actions/*
25
+ git add .github/workflows/*
26
+ git add scripts/*
27
+ git commit -m "Update agentic-lib to @${1?}"
28
+ git pull
29
+ git push
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2025-2026 Polycode Limited
4
+ # scripts/activate-schedule.sh
5
+ #
6
+ # Usage: ./scripts/activate-schedule.sh <schedule-number>
7
+ # Example: ./scripts/activate-schedule.sh 1
8
+ # (activates schedule-1 by uncommenting lines ending with "# schedule-1".)
9
+ #
10
+ # This script processes all .yml files in the .github/workflows directory.
11
+ # It looks for lines with cron schedule definitions ending with a comment like "# schedule-N"
12
+ # and, if N matches the given parameter, removes the leading "#" and any extra spaces.
13
+ #
14
+ # Tested on macOS (zsh).
15
+
16
+ set -euo pipefail
17
+
18
+ if [ "$#" -ne 1 ]; then
19
+ echo "Usage: $0 <schedule-number>"
20
+ exit 1
21
+ fi
22
+
23
+ active="$1"
24
+ workflow_dir=".github/workflows"
25
+
26
+ if [ ! -d "$workflow_dir" ]; then
27
+ echo "Error: Directory $workflow_dir not found."
28
+ exit 1
29
+ fi
30
+
31
+ echo "Activating schedule-$active in all YAML workflow files in $workflow_dir..."
32
+
33
+ for file in "$workflow_dir"/*.yml; do
34
+ #echo "Processing $file..."
35
+ # This sed command matches lines that start with whitespace, then a "#"
36
+ # followed by optional whitespace, then "cron:" … and ending with "# schedule-<active>"
37
+ sed -i.bak -E "s/^([[:space:]]*)#(- cron:.*# schedule-$active)/\1\2/" "$file"
38
+ rm -f "$file.bak"
39
+ done
40
+
41
+ echo "Schedule-$active activated in workflows."
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2025-2026 Polycode Limited
4
+ # scripts/clean.sh
5
+ # Usage: ./scripts/clean.sh
6
+ #
7
+ # This file is part of the Example Suite for `agentic-lib` see: https://github.com/xn-intenton-z2a/agentic-lib
8
+ # This file is licensed under the MIT License. For details, see LICENSE-MIT
9
+ #
10
+
11
+ # Node clean and build
12
+ if [[ -e 'package.json' ]]; then
13
+ rm -rf build
14
+ rm -rf coverage
15
+ rm -rf dist
16
+ rm -rf node_modules
17
+ rm -rf package-lock.json
18
+ npm install
19
+ npm run build
20
+ npm link
21
+ fi
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (C) 2025-2026 Polycode Limited
4
+ // generate-library-index.js
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import { execSync } from "child_process";
8
+
9
+ // Configuration
10
+ const libraryDocumentsPath = "./library/";
11
+ const outputFile = "./library-index.html";
12
+
13
+ // Get the list of files in the library directory
14
+ const getLibraryFiles = () => {
15
+ try {
16
+ if (!fs.existsSync(libraryDocumentsPath)) {
17
+ fs.mkdirSync(libraryDocumentsPath, { recursive: true });
18
+ return [];
19
+ }
20
+ return fs
21
+ .readdirSync(libraryDocumentsPath)
22
+ .filter((file) => file.endsWith(".md"))
23
+ .map((file) => ({
24
+ name: file,
25
+ path: path.join(libraryDocumentsPath, file),
26
+ }));
27
+ } catch (error) {
28
+ console.error(`Error reading library directory: ${error.message}`);
29
+ return [];
30
+ }
31
+ };
32
+
33
+ // Get the output of ls -lath for the library directory
34
+ const getLsOutput = () => {
35
+ try {
36
+ return execSync(`ls -lath ${libraryDocumentsPath}`).toString();
37
+ } catch (error) {
38
+ console.error(`Error executing ls command: ${error.message}`);
39
+ return "Error executing ls command";
40
+ }
41
+ };
42
+
43
+ // Generate HTML content for the library index
44
+ const generateHTML = (files, lsOutput) => {
45
+ const now = new Date().toISOString();
46
+
47
+ // Create list items for each file
48
+ const fileItems =
49
+ files.length > 0
50
+ ? files
51
+ .map((file) => {
52
+ // Extract title from the file (first line after removing # prefix)
53
+ let title = file.name.replace(".md", "");
54
+ try {
55
+ const content = fs.readFileSync(file.path, "utf8");
56
+ const firstLine = content.split("\n")[0];
57
+ if (firstLine.startsWith("# ")) {
58
+ title = firstLine.substring(2).trim();
59
+ }
60
+ } catch (error) {
61
+ console.error(`Error reading file ${file.path}: ${error.message}`);
62
+ }
63
+
64
+ return `
65
+ <li>
66
+ <div class="doc-title">${title}</div>
67
+ <a href="${file.name.replace(".md", ".html")}" class="source-link">View Document</a>
68
+ <a href="${file.path}" class="source-link">View Source</a>
69
+ <p class="description">Document: ${file.name}</p>
70
+ </li>`;
71
+ })
72
+ .join("\n")
73
+ : "<li>No documents found in the library directory.</li>";
74
+
75
+ return `
76
+ <!DOCTYPE html>
77
+ <html lang="en">
78
+ <head>
79
+ <meta charset="UTF-8">
80
+ <title>Library Documents</title>
81
+ <style>
82
+ body { font-family: Arial, sans-serif; margin: 2em; background-color: #f9f9f9; color: #333; }
83
+ header { padding-bottom: 1em; border-bottom: 2px solid #ccc; margin-bottom: 1em; }
84
+ h1 { font-size: 2em; }
85
+ h2 { font-size: 1.5em; margin-top: 1.5em; }
86
+ section { margin-bottom: 1.5em; }
87
+ ul { list-style: none; padding: 0; }
88
+ li { margin: 1em 0; padding: 0.8em; background-color: #fff; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
89
+ li:hover { background-color: #f0f8ff; }
90
+ .label { font-weight: bold; }
91
+ .doc-title { font-weight: bold; font-size: 1.1em; }
92
+ .source-link { font-size: 0.9em; margin-left: 0.5em; color: #6c757d; }
93
+ .source-link:hover { color: #0366d6; }
94
+ .description { margin-top: 0.5em; margin-bottom: 0; font-size: 0.95em; color: #555; line-height: 1.4; }
95
+ footer { margin-top: 2em; font-size: 0.9em; color: #777; }
96
+ a { color: #0366d6; text-decoration: none; }
97
+ a:hover { text-decoration: underline; }
98
+ pre { background-color: #f5f5f5; padding: 1em; border-radius: 5px; overflow-x: auto; }
99
+ </style>
100
+ </head>
101
+ <body>
102
+ <header>
103
+ <h1>Library Documents</h1>
104
+ </header>
105
+
106
+ <section>
107
+ <h2>Library Documents</h2>
108
+ <p>Below are links to various library documents with their original sources:</p>
109
+ <ul>
110
+ ${fileItems}
111
+ </ul>
112
+ </section>
113
+
114
+ <section>
115
+ <h2>Library Directory Contents</h2>
116
+ <p>Output of <code>ls -lath</code> for the library directory:</p>
117
+ <pre>${lsOutput}</pre>
118
+ </section>
119
+
120
+ <footer>
121
+ <p>Generated on ${now}</p>
122
+ </footer>
123
+ </body>
124
+ </html>
125
+ `;
126
+ };
127
+
128
+ // Main function
129
+ const main = () => {
130
+ try {
131
+ const files = getLibraryFiles();
132
+ const lsOutput = getLsOutput();
133
+ const html = generateHTML(files, lsOutput);
134
+
135
+ fs.writeFileSync(outputFile, html, "utf8");
136
+ console.log(`Successfully generated ${outputFile}`);
137
+ } catch (error) {
138
+ console.error(`Error generating library index: ${error.message}`);
139
+ process.exit(1);
140
+ }
141
+ };
142
+
143
+ main();
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2025-2026 Polycode Limited
4
+ # scripts/initialise.sh
5
+ # Usage: ./scripts/initialise.sh <intention>
6
+ # Example: ./scripts/initialise.sh (randomly selects an intention)
7
+ # Example: ./scripts/initialise.sh "repository0-plot-code-lib"
8
+ # Example: ./scripts/initialise.sh "owl-builder"
9
+ #
10
+ # This file is part of the Example Suite for `agentic-lib` see: https://github.com/xn-intenton-z2a/agentic-lib
11
+ # This file is licensed under the MIT License. For details, see LICENSE-MIT
12
+
13
+ defaultIntention=$(find .github/agentic-lib/seeds -maxdepth 1 -type f -name 'MISSION-*.md' | shuf -n 1 | sed -E 's/.*MISSION-(.*)\.md/\1/')
14
+
15
+ intention="${1-$defaultIntention}"
16
+
17
+ mkdir -p prompts
18
+ mkdir -p features
19
+ cp -fv ".github/agentic-lib/seeds/MISSION-${intention?}.md" MISSION.md
20
+ cp -fv ".github/agentic-lib/seeds/zero-README.md" README.md
21
+ cp -fv ".github/agentic-lib/seeds/zero-package.json" package.json
22
+ cp -fv ".github/agentic-lib/seeds/zero-main.js" src/lib/main.js
23
+ cp -fv ".github/agentic-lib/seeds/zero-main.test.js" tests/unit/main.test.js
24
+ rm -f docs/*.md
25
+ rm -f SOURCES.md
26
+ rm -f library/*.md
27
+ rm -f library/*.txt
28
+ rm -f features/*.md
29
+ rm -f prompts/*.md
30
+ cp -fv .github/agentic-lib/seeds/features/*.md features/
31
+ #rm -rfv node_modules
32
+ #rm -rfv package-lock.json
33
+ #npm install
34
+ #npm run build
35
+ #npm link
36
+
37
+ # Update the first line of CONTRIBUTING.md with the intention so it works on macOS or Linux
38
+ sed -i.bak "1s/.*/# ${intention?}/" CONTRIBUTING.md
39
+ rm -f CONTRIBUTING.md.bak
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (C) 2025-2026 Polycode Limited
4
+ // md-to-html.js
5
+ import fs from "fs";
6
+ import MarkdownIt from "markdown-it";
7
+ import markdownItGithub from "markdown-it-github";
8
+
9
+ const md = new MarkdownIt({ html: true }).use(markdownItGithub);
10
+
11
+ function generateHTML(content) {
12
+ const now = new Date().toISOString();
13
+ // You may customize the header information (title, owner, index URL) as needed.
14
+ return `<!DOCTYPE html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="UTF-8">
18
+ <title>agentic-lib</title>
19
+ <style>
20
+ body { font-family: Arial, sans-serif; margin: 2em; background-color: #f9f9f9; color: #333; }
21
+ header { padding-bottom: 1em; border-bottom: 2px solid #ccc; margin-bottom: 1em; }
22
+ h1 { font-size: 2em; }
23
+ section { margin-bottom: 1.5em; }
24
+ ul { list-style: none; padding: 0; }
25
+ li { margin: 0.5em 0; }
26
+ .label { font-weight: bold; }
27
+ footer { margin-top: 2em; font-size: 0.9em; color: #777; }
28
+ a { color: #0366d6; text-decoration: none; }
29
+ a:hover { text-decoration: underline; }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <header>
34
+ <h1>agentic-lib</h1>
35
+ </header>
36
+ <section>
37
+ ${content}
38
+ </section>
39
+ <footer>
40
+ <p>Generated on ${now}</p>
41
+ </footer>
42
+ </body>
43
+ </html>`;
44
+ }
45
+
46
+ // If STDIN is being piped, read from it and output to STDOUT.
47
+ if (!process.stdin.isTTY) {
48
+ let data = "";
49
+ process.stdin.setEncoding("utf8");
50
+ process.stdin.on("data", (chunk) => {
51
+ data += chunk;
52
+ });
53
+ process.stdin.on("end", () => {
54
+ try {
55
+ const markdownHTML = md.render(data);
56
+ const fullHTML = generateHTML(markdownHTML);
57
+ process.stdout.write(fullHTML);
58
+ } catch (err) {
59
+ console.error("Error during conversion:", err);
60
+ process.exit(1);
61
+ }
62
+ });
63
+ } else {
64
+ // Otherwise, read from the default input file and write to the default output file.
65
+ const inputFile = "README.md";
66
+ const outputFile = "index.html";
67
+ try {
68
+ const data = fs.readFileSync(inputFile, "utf8");
69
+ const markdownHTML = md.render(data);
70
+ const fullHTML = generateHTML(markdownHTML);
71
+ fs.writeFileSync(outputFile, fullHTML, "utf8");
72
+ console.log(`Successfully converted ${inputFile} to ${outputFile}`);
73
+ } catch (err) {
74
+ console.error("Error during conversion:", err);
75
+ process.exit(1);
76
+ }
77
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2025-2026 Polycode Limited
4
+ # scripts/update.sh
5
+ # Usage: ./scripts/update.sh
6
+ #
7
+ # This file is part of the Example Suite for `agentic-lib` see: https://github.com/xn-intenton-z2a/agentic-lib
8
+ # This file is licensed under the MIT License. For details, see LICENSE-MIT
9
+ #
10
+
11
+ rm -f package-lock.json
12
+ rm -f node-modules
13
+ npm install
14
+ npm run update-to-minor
15
+ npm update
16
+ npm upgrade
17
+ npm install
18
+ npm run build
19
+ npm link
@@ -0,0 +1,33 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (C) 2025-2026 Polycode Limited
3
+ # .github/workflows/test.yml
4
+ #
5
+ # Starter test workflow seeded by agentic-lib init.
6
+ #
7
+ # This file is part of the example suite for `agentic-lib` see: https://github.com/xn-intenton-z2a/agentic-lib
8
+ # This file is licensed under the MIT License. For details, see LICENSE-MIT
9
+
10
+ name: test
11
+ run-name: "test [${{ github.ref_name }}]"
12
+
13
+ on:
14
+ push:
15
+ branches: [main]
16
+ pull_request:
17
+ branches: [main]
18
+ workflow_dispatch:
19
+
20
+ jobs:
21
+ test:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: 24
29
+ cache: "npm"
30
+
31
+ - run: npm ci
32
+
33
+ - run: npm test
@@ -0,0 +1,7 @@
1
+ # Mission
2
+
3
+ Build a useful JavaScript library.
4
+
5
+ Write your intention here. The agentic workflows will transform the code in `src/lib/main.js` to realise this mission. Tests in `tests/unit/` keep the code on track. Each workflow cycle assesses the current state, plans improvements, and executes changes — guided by this document.
6
+
7
+ See [intentïon agentic-lib](https://github.com/xn-intenton-z2a/agentic-lib) for details.
@@ -0,0 +1,14 @@
1
+ # repo
2
+
3
+ A repository powered by intentïon agentic-lib.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Write your mission in `MISSION.md`
8
+ 2. Enable GitHub Actions
9
+ 3. The agentic workflows will evolve `src/lib/main.js` toward your mission
10
+
11
+ ## Links
12
+
13
+ - [intentïon agentic-lib](https://github.com/xn-intenton-z2a/agentic-lib)
14
+ - [MISSION.md](MISSION.md)