@xn-intenton-z2a/agentic-lib 7.1.33 → 7.1.35
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/bin/agentic-lib.js +23 -2
- package/package.json +1 -1
- package/src/actions/agentic-step/config-loader.js +2 -1
- package/src/actions/agentic-step/index.js +4 -1
- package/src/actions/agentic-step/logging.js +10 -3
- package/src/actions/agentic-step/tasks/transform.js +10 -0
- package/src/agents/agent-maintain-features.md +1 -1
- package/src/seeds/zero-.gitignore +27 -0
- package/src/seeds/zero-agentic-lib.toml +1 -0
- package/src/seeds/zero-package.json +1 -1
package/bin/agentic-lib.js
CHANGED
|
@@ -248,6 +248,7 @@ async function loadTaskConfig() {
|
|
|
248
248
|
featuresPath: toml.paths?.features || "features/",
|
|
249
249
|
libraryPath: toml.paths?.docs || "library/",
|
|
250
250
|
sourcesPath: toml.paths?.["library-sources"] || "SOURCES.md",
|
|
251
|
+
examplesPath: toml.paths?.examples || "examples/",
|
|
251
252
|
readmePath: toml.paths?.readme || "README.md",
|
|
252
253
|
depsPath: toml.paths?.dependencies || "package.json",
|
|
253
254
|
buildScript: toml.execution?.build || "npm run build",
|
|
@@ -264,6 +265,7 @@ function getWritablePathsFromConfig(config) {
|
|
|
264
265
|
config.testsPath,
|
|
265
266
|
config.featuresPath,
|
|
266
267
|
config.libraryPath,
|
|
268
|
+
config.examplesPath,
|
|
267
269
|
config.readmePath,
|
|
268
270
|
config.depsPath,
|
|
269
271
|
].filter(Boolean);
|
|
@@ -363,6 +365,11 @@ function buildTransformPrompt(config, pathsSection) {
|
|
|
363
365
|
`## Current Source Files (${sourceFiles.length})`,
|
|
364
366
|
...sourceFiles.map((f) => `### ${f.name}\n\`\`\`\n${f.content}\n\`\`\``),
|
|
365
367
|
"",
|
|
368
|
+
"## Output Artifacts",
|
|
369
|
+
"If your changes produce output artifacts (plots, visualizations, data files, usage examples),",
|
|
370
|
+
`save them to the \`${config.examplesPath || "examples/"}\` directory.`,
|
|
371
|
+
"This directory is for demonstrating what the code can do.",
|
|
372
|
+
"",
|
|
366
373
|
"## Your Task",
|
|
367
374
|
"Analyze the mission, features, and source code.",
|
|
368
375
|
"Determine the single most impactful next step.",
|
|
@@ -736,6 +743,14 @@ function initConfig(seedsDir) {
|
|
|
736
743
|
} else {
|
|
737
744
|
console.log(" SKIP: seed TOML not found");
|
|
738
745
|
}
|
|
746
|
+
|
|
747
|
+
const giSeed = resolve(seedsDir, "zero-.gitignore");
|
|
748
|
+
const giTarget = resolve(target, ".gitignore");
|
|
749
|
+
if (existsSync(giSeed) && !existsSync(giTarget)) {
|
|
750
|
+
initCopyFile(giSeed, giTarget, ".gitignore (new)");
|
|
751
|
+
} else if (existsSync(giTarget)) {
|
|
752
|
+
console.log(" SKIP: .gitignore already exists");
|
|
753
|
+
}
|
|
739
754
|
}
|
|
740
755
|
|
|
741
756
|
function removeFile(filePath, label) {
|
|
@@ -769,6 +784,7 @@ function initReseed() {
|
|
|
769
784
|
}
|
|
770
785
|
|
|
771
786
|
clearDirContents(resolve(target, "library"), "library");
|
|
787
|
+
clearDirContents(resolve(target, "examples"), "examples");
|
|
772
788
|
|
|
773
789
|
// Remove old getting-started-guide if it exists
|
|
774
790
|
const oldGuideDir = resolve(target, ".github/agentic-lib/getting-started-guide");
|
|
@@ -782,19 +798,22 @@ function initReseed() {
|
|
|
782
798
|
function readTomlPaths() {
|
|
783
799
|
let sourcePath = "src/lib/";
|
|
784
800
|
let testsPath = "tests/unit/";
|
|
801
|
+
let examplesPath = "examples/";
|
|
785
802
|
const tomlTarget = resolve(target, "agentic-lib.toml");
|
|
786
803
|
if (existsSync(tomlTarget)) {
|
|
787
804
|
try {
|
|
788
805
|
const tomlContent = readFileSync(tomlTarget, "utf8");
|
|
789
806
|
const sourceMatch = tomlContent.match(/^source\s*=\s*"([^"]+)"/m);
|
|
790
807
|
const testsMatch = tomlContent.match(/^tests\s*=\s*"([^"]+)"/m);
|
|
808
|
+
const examplesMatch = tomlContent.match(/^examples\s*=\s*"([^"]+)"/m);
|
|
791
809
|
if (sourceMatch) sourcePath = sourceMatch[1];
|
|
792
810
|
if (testsMatch) testsPath = testsMatch[1];
|
|
811
|
+
if (examplesMatch) examplesPath = examplesMatch[1];
|
|
793
812
|
} catch (err) {
|
|
794
813
|
console.log(` WARN: Could not read TOML for paths, using defaults: ${err.message}`);
|
|
795
814
|
}
|
|
796
815
|
}
|
|
797
|
-
return { sourcePath, testsPath };
|
|
816
|
+
return { sourcePath, testsPath, examplesPath };
|
|
798
817
|
}
|
|
799
818
|
|
|
800
819
|
function clearAndRecreateDir(dirPath, label) {
|
|
@@ -810,9 +829,10 @@ function clearAndRecreateDir(dirPath, label) {
|
|
|
810
829
|
function initPurge(seedsDir) {
|
|
811
830
|
console.log("\n--- Purge: Reset Source Files to Seed State ---");
|
|
812
831
|
|
|
813
|
-
const { sourcePath, testsPath } = readTomlPaths();
|
|
832
|
+
const { sourcePath, testsPath, examplesPath } = readTomlPaths();
|
|
814
833
|
clearAndRecreateDir(sourcePath, sourcePath);
|
|
815
834
|
clearAndRecreateDir(testsPath, testsPath);
|
|
835
|
+
clearAndRecreateDir(examplesPath, examplesPath);
|
|
816
836
|
|
|
817
837
|
// Copy seed files (including config TOML)
|
|
818
838
|
const SEED_MAP = {
|
|
@@ -823,6 +843,7 @@ function initPurge(seedsDir) {
|
|
|
823
843
|
"zero-package.json": "package.json",
|
|
824
844
|
"zero-README.md": "README.md",
|
|
825
845
|
"zero-agentic-lib.toml": "agentic-lib.toml",
|
|
846
|
+
"zero-.gitignore": ".gitignore",
|
|
826
847
|
};
|
|
827
848
|
for (const [seedFile, targetRel] of Object.entries(SEED_MAP)) {
|
|
828
849
|
const src = resolve(seedsDir, seedFile);
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ import { parse as parseToml } from "smol-toml";
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
// Keys whose paths are writable by agents
|
|
38
|
-
const WRITABLE_KEYS = ["source", "tests", "features", "dependencies", "docs", "readme"];
|
|
38
|
+
const WRITABLE_KEYS = ["source", "tests", "features", "dependencies", "docs", "readme", "examples"];
|
|
39
39
|
|
|
40
40
|
// Default paths — every key that task handlers might access
|
|
41
41
|
const PATH_DEFAULTS = {
|
|
@@ -44,6 +44,7 @@ const PATH_DEFAULTS = {
|
|
|
44
44
|
tests: "tests/unit/",
|
|
45
45
|
features: "features/",
|
|
46
46
|
docs: "docs/",
|
|
47
|
+
examples: "examples/",
|
|
47
48
|
readme: "README.md",
|
|
48
49
|
dependencies: "package.json",
|
|
49
50
|
library: "library/",
|
|
@@ -85,8 +85,10 @@ async function run() {
|
|
|
85
85
|
github: github.context,
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
// Run the task
|
|
88
|
+
// Run the task (measure wall-clock duration for cost tracking)
|
|
89
|
+
const startTime = Date.now();
|
|
89
90
|
const result = await handler(context);
|
|
91
|
+
const durationMs = Date.now() - startTime;
|
|
90
92
|
|
|
91
93
|
// Set outputs
|
|
92
94
|
core.setOutput("result", result.outcome || "completed");
|
|
@@ -108,6 +110,7 @@ async function run() {
|
|
|
108
110
|
inputTokens: result.inputTokens,
|
|
109
111
|
outputTokens: result.outputTokens,
|
|
110
112
|
cost: result.cost,
|
|
113
|
+
durationMs,
|
|
111
114
|
model: result.model || model,
|
|
112
115
|
details: result.details,
|
|
113
116
|
workflowUrl: `${process.env.GITHUB_SERVER_URL}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}`,
|
|
@@ -22,7 +22,8 @@ import * as core from "@actions/core";
|
|
|
22
22
|
* @param {number} [options.tokensUsed] - Total tokens consumed (input + output)
|
|
23
23
|
* @param {number} [options.inputTokens] - Input tokens consumed
|
|
24
24
|
* @param {number} [options.outputTokens] - Output tokens consumed
|
|
25
|
-
* @param {number} [options.cost] -
|
|
25
|
+
* @param {number} [options.cost] - Model invocations (from Copilot SDK)
|
|
26
|
+
* @param {number} [options.durationMs] - Task wall-clock duration in milliseconds
|
|
26
27
|
* @param {string} [options.model] - Model used
|
|
27
28
|
* @param {string} [options.details] - Additional details
|
|
28
29
|
* @param {string} [options.workflowUrl] - URL to the workflow run
|
|
@@ -38,6 +39,7 @@ export function logActivity({
|
|
|
38
39
|
inputTokens,
|
|
39
40
|
outputTokens,
|
|
40
41
|
cost,
|
|
42
|
+
durationMs,
|
|
41
43
|
model,
|
|
42
44
|
details,
|
|
43
45
|
workflowUrl,
|
|
@@ -54,8 +56,13 @@ export function logActivity({
|
|
|
54
56
|
if (prNumber) parts.push(`**PR:** #${prNumber}`);
|
|
55
57
|
if (commitUrl) parts.push(`**Commit:** [${commitUrl}](${commitUrl})`);
|
|
56
58
|
if (model) parts.push(`**Model:** ${model}`);
|
|
57
|
-
if (tokensUsed) parts.push(`**
|
|
58
|
-
if (cost) parts.push(`**
|
|
59
|
+
if (tokensUsed) parts.push(`**Token Count:** ${tokensUsed} (in: ${inputTokens || 0}, out: ${outputTokens || 0})`);
|
|
60
|
+
if (cost) parts.push(`**Model Invocations:** ${cost}`);
|
|
61
|
+
if (durationMs) {
|
|
62
|
+
const secs = Math.round(durationMs / 1000);
|
|
63
|
+
const mins = (durationMs / 60000).toFixed(1);
|
|
64
|
+
parts.push(`**Duration:** ${secs}s (~${mins} GitHub Actions min)`);
|
|
65
|
+
}
|
|
59
66
|
if (workflowUrl) parts.push(`**Workflow:** [${workflowUrl}](${workflowUrl})`);
|
|
60
67
|
if (details) {
|
|
61
68
|
parts.push("");
|
|
@@ -72,6 +72,11 @@ export async function transform(context) {
|
|
|
72
72
|
`## Open Issues (${openIssues.length})`,
|
|
73
73
|
...openIssues.slice(0, 10).map((i) => `- #${i.number}: ${i.title}`),
|
|
74
74
|
"",
|
|
75
|
+
"## Output Artifacts",
|
|
76
|
+
"If your changes produce output artifacts (plots, visualizations, data files, usage examples),",
|
|
77
|
+
`save them to the \`${config.paths.examples?.path || "examples/"}\` directory.`,
|
|
78
|
+
"This directory is for demonstrating what the code can do.",
|
|
79
|
+
"",
|
|
75
80
|
"## Your Task",
|
|
76
81
|
"Analyze the mission, features, source code, and open issues.",
|
|
77
82
|
"Determine the single most impactful next step to transform this repository.",
|
|
@@ -190,6 +195,11 @@ async function transformTdd({
|
|
|
190
195
|
"",
|
|
191
196
|
formatPathsSection(writablePaths, readOnlyPaths),
|
|
192
197
|
"",
|
|
198
|
+
"## Output Artifacts",
|
|
199
|
+
"If your changes produce output artifacts (plots, visualizations, data files, usage examples),",
|
|
200
|
+
`save them to the \`${_config.paths.examples?.path || "examples/"}\` directory.`,
|
|
201
|
+
"This directory is for demonstrating what the code can do.",
|
|
202
|
+
"",
|
|
193
203
|
"## Constraints",
|
|
194
204
|
"- Write implementation code to make the failing test pass",
|
|
195
205
|
"- Do NOT modify the test file created in Phase 1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Please generate the name and specification for a software feature which will be added or updated to action the supplied feature prompt.
|
|
2
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
3
|
|
|
4
|
-
You may only create features to only change the source file, test file, README file
|
|
4
|
+
You may only create features to only change the source file, test file, README file, dependencies file, and examples directory content. You may not create features that request new files, delete existing files, or change the other files provided in the prompt context.
|
|
5
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
6
|
All existing features could be retained, with one being enhanced to move towards accommodating the new feature.
|
|
7
7
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Node
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Coverage
|
|
5
|
+
coverage/
|
|
6
|
+
|
|
7
|
+
# Environment and secrets
|
|
8
|
+
.env
|
|
9
|
+
secrets.env
|
|
10
|
+
*.kdbx
|
|
11
|
+
.npmrc
|
|
12
|
+
|
|
13
|
+
# OS files
|
|
14
|
+
.DS_Store
|
|
15
|
+
Thumbs.db
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
|
|
23
|
+
# Generated files at repo root (agents should use examples/ instead)
|
|
24
|
+
/*.png
|
|
25
|
+
/*.svg
|
|
26
|
+
/*.pdf
|
|
27
|
+
/*.csv
|