@withgauge/cli 0.13.0 → 0.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withgauge/cli",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Gauge customer CLI — Agent Preference, evals, runs, and organization settings over the Gauge API",
5
5
  "private": false,
6
6
  "author": "Gauge <support@withgauge.com> (https://withgauge.com)",
@@ -14,7 +14,8 @@
14
14
  "gauge": "dist/index.js"
15
15
  },
16
16
  "files": [
17
- "dist"
17
+ "dist",
18
+ "scripts/install-skill.mjs"
18
19
  ],
19
20
  "engines": {
20
21
  "node": ">=22.12.0"
@@ -22,6 +23,7 @@
22
23
  "scripts": {
23
24
  "build": "tsup",
24
25
  "dev": "tsx src/index.ts",
26
+ "postinstall": "node scripts/install-skill.mjs",
25
27
  "prepublishOnly": "node scripts/validate-release.mjs",
26
28
  "release:validate": "node scripts/validate-release.mjs",
27
29
  "test": "tsx --test src/**/*.test.ts scripts/*.test.mjs",
@@ -0,0 +1,64 @@
1
+ // Install only Gauge's CLI skill using the upstream repository's installer.
2
+ // This ships as plain JS so npm can run it without a build or dev dependencies.
3
+ import { spawnSync } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ // 1.5.0 supports Node >=18; newer releases require more than our >=22.12 floor.
7
+ const INSTALL_ARGS = [
8
+ "--yes",
9
+ "skills@1.5.0",
10
+ "add",
11
+ "gauge-sh/gauge-skills",
12
+ "--skill",
13
+ "gauge-agents",
14
+ "--global",
15
+ "--yes",
16
+ ];
17
+ export const INSTALL_COMMAND = `npx ${INSTALL_ARGS.join(" ")}`;
18
+
19
+ export function installSkill({
20
+ env = process.env,
21
+ platform = process.platform,
22
+ run = spawnSync,
23
+ log = (message) => process.stderr.write(`${message}\n`),
24
+ } = {}) {
25
+ if (
26
+ env.GAUGE_SKIP_SKILL_INSTALL === "1" ||
27
+ (env.CI && env.CI !== "false" && env.CI !== "0")
28
+ ) {
29
+ return;
30
+ }
31
+
32
+ log("Gauge: installing the gauge-agents skill globally...");
33
+ try {
34
+ const result = run(platform === "win32" ? "npx.cmd" : "npx", INSTALL_ARGS, {
35
+ // Windows needs a shell to launch .cmd. All arguments are fixed literals.
36
+ shell: platform === "win32",
37
+ stdio: ["ignore", "pipe", "pipe"],
38
+ encoding: "utf8",
39
+ timeout: 30_000,
40
+ env: {
41
+ ...env,
42
+ // npm install -g exports this to lifecycle scripts. npx must install
43
+ // its tool in its local cache; skills' --global controls skill scope.
44
+ npm_config_global: "false",
45
+ NPM_CONFIG_GLOBAL: "false",
46
+ DISABLE_TELEMETRY: "1",
47
+ GIT_TERMINAL_PROMPT: "0",
48
+ },
49
+ });
50
+ if (!result.error && result.status === 0) {
51
+ log("Gauge: installed the gauge-agents skill globally.");
52
+ return;
53
+ }
54
+ } catch {
55
+ // Missing npx, network/permission failures, and timeouts are non-fatal.
56
+ }
57
+ log(
58
+ `Gauge: automatic skill installation failed; the CLI is still installed. Retry with:\n ${INSTALL_COMMAND}`,
59
+ );
60
+ }
61
+
62
+ if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
63
+ installSkill();
64
+ }