@agentify/cli 0.1.0

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.
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const childProcess = require("node:child_process");
5
+ const { buildReleaseManifest } = require("../lib/release");
6
+
7
+ function parseArgs(argv) {
8
+ const args = Array.isArray(argv) ? [...argv] : [];
9
+ const result = {
10
+ help: false,
11
+ skipCargo: false,
12
+ skipNpm: false,
13
+ skipPackage: false,
14
+ allowMissingTargets: false
15
+ };
16
+
17
+ while (args.length > 0) {
18
+ const token = args.shift();
19
+ if (token === "--help" || token === "-h") {
20
+ result.help = true;
21
+ continue;
22
+ }
23
+ if (token === "--skip-cargo") {
24
+ result.skipCargo = true;
25
+ continue;
26
+ }
27
+ if (token === "--skip-npm") {
28
+ result.skipNpm = true;
29
+ continue;
30
+ }
31
+ if (token === "--skip-package") {
32
+ result.skipPackage = true;
33
+ continue;
34
+ }
35
+ if (token === "--allow-missing-targets") {
36
+ result.allowMissingTargets = true;
37
+ continue;
38
+ }
39
+ throw new Error(`Unknown argument: ${token}`);
40
+ }
41
+
42
+ return result;
43
+ }
44
+
45
+ function helpText() {
46
+ return [
47
+ "Run the local @agentify/cli release validation suite.",
48
+ "",
49
+ "Usage:",
50
+ " node ./scripts/release-check.js [--skip-cargo] [--skip-npm] [--skip-package] [--allow-missing-targets]",
51
+ "",
52
+ "Checks:",
53
+ " 1. Version sync between Cargo.toml and package.json",
54
+ " 2. cargo test",
55
+ " 3. npm run test:npm",
56
+ " 4. All supported platform binaries are staged",
57
+ " 5. npm run verify:package",
58
+ "",
59
+ "Notes:",
60
+ " --allow-missing-targets is for local incubation only. npm publish uses the strict default."
61
+ ].join("\n");
62
+ }
63
+
64
+ function runStep(label, command, args) {
65
+ console.log(`==> ${label}`);
66
+ childProcess.execFileSync(command, args, {
67
+ stdio: "inherit"
68
+ });
69
+ }
70
+
71
+ function main() {
72
+ let options;
73
+ try {
74
+ options = parseArgs(process.argv.slice(2));
75
+ } catch (error) {
76
+ console.error(error.message);
77
+ console.error("");
78
+ console.error(helpText());
79
+ process.exit(1);
80
+ }
81
+
82
+ if (options.help) {
83
+ console.log(helpText());
84
+ return;
85
+ }
86
+
87
+ try {
88
+ runStep("Version sync", "node", ["./scripts/check-version-sync.js"]);
89
+ const manifest = buildReleaseManifest({ requireAll: !options.allowMissingTargets });
90
+ if (options.allowMissingTargets && manifest.missingTargets.length > 0) {
91
+ console.warn(
92
+ `release-check warning: missing staged targets allowed for local incubation: ${manifest.missingTargets.join(", ")}`
93
+ );
94
+ }
95
+ if (!options.skipCargo) {
96
+ runStep("Rust tests", "cargo", ["test"]);
97
+ }
98
+ if (!options.skipNpm) {
99
+ runStep("npm wrapper tests", "npm", ["run", "test:npm"]);
100
+ }
101
+ if (!options.skipPackage) {
102
+ runStep("Package verification", "npm", ["run", "verify:package"]);
103
+ }
104
+ console.log("release-check ok");
105
+ } catch (error) {
106
+ const message = error && error.message ? error.message : String(error);
107
+ console.error(`release-check failed: ${message}`);
108
+ process.exit(1);
109
+ }
110
+ }
111
+
112
+ main();
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { helpText, parseStageArgs, stageBinary } = require("../lib/stage");
5
+
6
+ function main() {
7
+ let args;
8
+ try {
9
+ args = parseStageArgs(process.argv.slice(2));
10
+ } catch (error) {
11
+ console.error(error.message);
12
+ console.error("");
13
+ console.error(helpText());
14
+ process.exit(1);
15
+ }
16
+
17
+ if (args.help) {
18
+ console.log(helpText());
19
+ return;
20
+ }
21
+
22
+ try {
23
+ const result = stageBinary({
24
+ source: args.source,
25
+ platform: args.platform,
26
+ arch: args.arch,
27
+ force: args.force
28
+ });
29
+ console.log(
30
+ [
31
+ `Staged ${result.binaryName} for ${result.target}.`,
32
+ `Source: ${result.source}`,
33
+ `Destination: ${result.destination}`,
34
+ result.overwritten ? "Mode: overwrite" : "Mode: create"
35
+ ].join("\n")
36
+ );
37
+ } catch (error) {
38
+ console.error(`Failed to stage agentify binary: ${error.message}`);
39
+ process.exit(1);
40
+ }
41
+ }
42
+
43
+ main();
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { buildReleaseManifest, runPackDryRun, verifyPackContents } = require("../lib/release");
5
+
6
+ function main() {
7
+ try {
8
+ const manifest = buildReleaseManifest();
9
+ const pack = runPackDryRun();
10
+ const result = verifyPackContents(manifest, pack);
11
+ console.log(
12
+ JSON.stringify(
13
+ {
14
+ schemaVersion: "agentify.sh/package-verify-v0.1",
15
+ ok: true,
16
+ package: {
17
+ name: manifest.package.name,
18
+ version: manifest.package.version
19
+ },
20
+ verifiedTargets: result.verifiedTargets,
21
+ packedFileCount: result.packedFileCount
22
+ },
23
+ null,
24
+ 2
25
+ )
26
+ );
27
+ } catch (error) {
28
+ console.error(`Package verification failed: ${error.message}`);
29
+ process.exit(1);
30
+ }
31
+ }
32
+
33
+ main();