fullcourtdefense-cli 1.26.16 → 1.26.17
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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The installed CLI version.
|
|
3
|
+
*
|
|
4
|
+
* `process.env.npm_package_version` is only populated when npm itself runs the
|
|
5
|
+
* script (`npm run …`). A container entrypoint, an MSI install, or a CI step
|
|
6
|
+
* calling the `fullcourtdefense` binary directly gets `undefined` — which is how
|
|
7
|
+
* enrolled workloads ended up with a blank CLI version in the fleet console.
|
|
8
|
+
* Resolve it from disk instead: the build stamp `dist/version.json` first
|
|
9
|
+
* (same source `--version` prints), then the package manifest.
|
|
10
|
+
*/
|
|
11
|
+
export declare function cliVersion(): string | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.cliVersion = cliVersion;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
/**
|
|
40
|
+
* The installed CLI version.
|
|
41
|
+
*
|
|
42
|
+
* `process.env.npm_package_version` is only populated when npm itself runs the
|
|
43
|
+
* script (`npm run …`). A container entrypoint, an MSI install, or a CI step
|
|
44
|
+
* calling the `fullcourtdefense` binary directly gets `undefined` — which is how
|
|
45
|
+
* enrolled workloads ended up with a blank CLI version in the fleet console.
|
|
46
|
+
* Resolve it from disk instead: the build stamp `dist/version.json` first
|
|
47
|
+
* (same source `--version` prints), then the package manifest.
|
|
48
|
+
*/
|
|
49
|
+
function cliVersion() {
|
|
50
|
+
const candidates = [
|
|
51
|
+
path.join(__dirname, 'version.json'),
|
|
52
|
+
path.resolve(__dirname, '..', 'package.json'),
|
|
53
|
+
];
|
|
54
|
+
for (const file of candidates) {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
57
|
+
if (typeof parsed.version === 'string' && parsed.version)
|
|
58
|
+
return parsed.version;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// try the next location
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.detectCiContext = detectCiContext;
|
|
4
4
|
exports.ciProtectCommand = ciProtectCommand;
|
|
5
5
|
const config_1 = require("../config");
|
|
6
|
+
const cliVersion_1 = require("../cliVersion");
|
|
6
7
|
const ephemeralStack_1 = require("./ephemeralStack");
|
|
7
8
|
/** Detect the pipeline from standard CI env vars (GitHub Actions, GitLab CI). */
|
|
8
9
|
function detectCiContext(env = process.env) {
|
|
@@ -81,7 +82,7 @@ async function ciProtectCommand(args, config) {
|
|
|
81
82
|
workflow,
|
|
82
83
|
runId,
|
|
83
84
|
runUrl,
|
|
84
|
-
cliVersion:
|
|
85
|
+
cliVersion: (0, cliVersion_1.cliVersion)(),
|
|
85
86
|
}),
|
|
86
87
|
});
|
|
87
88
|
const data = (await resp.json().catch(() => ({})));
|
|
@@ -39,6 +39,7 @@ const fs = __importStar(require("fs"));
|
|
|
39
39
|
const os = __importStar(require("os"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const config_1 = require("../config");
|
|
42
|
+
const cliVersion_1 = require("../cliVersion");
|
|
42
43
|
const ephemeralStack_1 = require("./ephemeralStack");
|
|
43
44
|
/** Cloud coding agents that run as unattended workloads (env markers they set). */
|
|
44
45
|
const CLOUD_AGENT_MARKERS = [
|
|
@@ -122,7 +123,9 @@ async function workloadProtectCommand(args, config) {
|
|
|
122
123
|
instanceId,
|
|
123
124
|
image,
|
|
124
125
|
ttlHours,
|
|
125
|
-
|
|
126
|
+
// Read from our own package.json — npm_package_version only exists under
|
|
127
|
+
// `npm run`, never when the binary runs from a container entrypoint.
|
|
128
|
+
cliVersion: (0, cliVersion_1.cliVersion)(),
|
|
126
129
|
}),
|
|
127
130
|
});
|
|
128
131
|
const data = (await resp.json().catch(() => ({})));
|
package/dist/version.json
CHANGED