@salaros/ai-harness 0.3.0 → 0.3.2
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/package.json +1 -1
- package/scripts/update-harness.js +24 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salaros/ai-harness",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Installs and updates the agent harness from its upstream repository: hooks, skills, agents and the documentation chain, merged into an existing repository without touching its own work.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ai-harness": "scripts/update-harness.js"
|
|
@@ -149,17 +149,29 @@ function templateCheckout(ref, options) {
|
|
|
149
149
|
return { dir, temporary: true };
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// The installer's own name and version
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
152
|
+
// The installer's own name and version: which released tool wrote this tree, the one thing the
|
|
153
|
+
// upstream commit cannot answer. package.json holds 0.0.0 on every branch and only the release job
|
|
154
|
+
// writes the real version into it, just before the publish, so its number means something only
|
|
155
|
+
// inside the npm package. A checkout of the upstream reads the release tag on its own HEAD instead.
|
|
156
|
+
// A checkout on no tag is not a release, and the receipt names no package rather than a version
|
|
157
|
+
// that was never published. Omitted, never null, whenever it cannot be read, so the receipt never
|
|
158
|
+
// claims a version it does not know.
|
|
159
|
+
const PLACEHOLDER_VERSION = "0.0.0";
|
|
160
|
+
const RELEASE_TAG = /^\d+\.\d+\.\d+$/;
|
|
161
|
+
function installerStamp({ name, version, tag }) {
|
|
162
|
+
if (!name) return {};
|
|
163
|
+
if (version && version !== PLACEHOLDER_VERSION) return { installer: `${name}@${version}` };
|
|
164
|
+
return tag && RELEASE_TAG.test(tag) ? { installer: `${name}@${tag}` } : {};
|
|
165
|
+
}
|
|
166
|
+
// The reads behind installerStamp. The script sits in the scripts/ folder of either the npm package
|
|
167
|
+
// or a checkout of the upstream, so both files are one folder up; the package has no .git, and there
|
|
168
|
+
// git answers nothing.
|
|
158
169
|
function installer() {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
170
|
+
const home = path.resolve(__dirname, "..");
|
|
171
|
+
let pkg = {};
|
|
172
|
+
try { pkg = JSON.parse(fs.readFileSync(path.join(home, "package.json"), "utf8")); } catch { return {}; }
|
|
173
|
+
const described = at(home, ["describe", "--tags", "--exact-match", "HEAD"]);
|
|
174
|
+
return installerStamp({ name: pkg.name, version: pkg.version, tag: described.status === 0 ? described.output.trim() : null });
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
// Windows stops at 260 characters for a path, and the harness ships skill files nested deep enough
|
|
@@ -755,7 +767,7 @@ function report({ entries, base, head, ref, target, check, options }) {
|
|
|
755
767
|
say("");
|
|
756
768
|
say(options.dryRun ? `dry run against ${ref} at ${head.slice(0, 8)}` : `harness updated to ${ref} at ${head.slice(0, 8)}`);
|
|
757
769
|
if (!base) say("no merge base: this was an install, so nothing that already existed was changed");
|
|
758
|
-
list("
|
|
770
|
+
list("written", notes.written);
|
|
759
771
|
list("merged", notes.merged);
|
|
760
772
|
list("created for the first time", notes.seeded);
|
|
761
773
|
list("left alone, yours", notes.kept.concat(notes.skipped));
|
|
@@ -836,7 +848,7 @@ function main(args) {
|
|
|
836
848
|
// The plan and the decisions under it, so the suite can put a case in and read the answer out rather
|
|
837
849
|
// than building a git checkout to reach one branch. apply() is here for its dry run, which prints and
|
|
838
850
|
// writes nothing; main() writes to somebody's repository and is reached through the command line.
|
|
839
|
-
module.exports = { unknownArgs, mistypedArgs, usage, parseOptions, policyFor, plan, apply, decideText, decideBinary, lineCounts, overlap, NEAREST, skeletonLines };
|
|
851
|
+
module.exports = { installerStamp, unknownArgs, mistypedArgs, usage, parseOptions, policyFor, plan, apply, decideText, decideBinary, lineCounts, overlap, NEAREST, skeletonLines };
|
|
840
852
|
|
|
841
853
|
if (require.main === module) {
|
|
842
854
|
try { process.exitCode = main(process.argv.slice(2)); }
|