@kolatts/pncli 4.1.0 → 5.0.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/README.md +2 -3
- package/dist/{chunk-LH7WBP7W.js → chunk-3JICA4FZ.js} +1 -16
- package/dist/chunk-3JICA4FZ.js.map +1 -0
- package/dist/{chunk-7MFRRV5V.js → chunk-EC6VSC6G.js} +1 -40
- package/dist/chunk-EC6VSC6G.js.map +1 -0
- package/dist/cli.js +82 -264
- package/dist/cli.js.map +1 -1
- package/dist/{config-JGBUUXQX.js → config-7FK4MAQC.js} +2 -2
- package/dist/{http-44W5CSDF.js → http-M5GQGXVF.js} +2 -2
- package/package.json +1 -2
- package/skills/pncli/SKILL.md +2 -3
- package/skills/pncli/splitio.md +1 -1
- package/dist/chunk-7MFRRV5V.js.map +0 -1
- package/dist/chunk-LH7WBP7W.js.map +0 -1
- package/skills/pncli/servicenow.md +0 -33
- /package/dist/{config-JGBUUXQX.js.map → config-7FK4MAQC.js.map} +0 -0
- /package/dist/{http-44W5CSDF.js.map → http-M5GQGXVF.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
setRepoConfigValue,
|
|
10
10
|
writeGlobalConfig,
|
|
11
11
|
writeRepoConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3JICA4FZ.js";
|
|
13
13
|
import {
|
|
14
14
|
createHttpClient
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EC6VSC6G.js";
|
|
16
16
|
import {
|
|
17
17
|
ExitCode,
|
|
18
18
|
PncliError,
|
|
@@ -6308,19 +6308,6 @@ async function runCredentialChecks(cfg, http) {
|
|
|
6308
6308
|
results.checkmarx = categorize(err);
|
|
6309
6309
|
}
|
|
6310
6310
|
}
|
|
6311
|
-
const snCreds = cfg.servicenow.username && (cfg.servicenow.password || cfg.servicenow.apiToken);
|
|
6312
|
-
if (!snCreds) {
|
|
6313
|
-
results.servicenow = { status: "blank", message: "not configured" };
|
|
6314
|
-
} else if (!cfg.servicenow.baseUrl) {
|
|
6315
|
-
results.servicenow = { status: "error", message: "baseUrl not configured" };
|
|
6316
|
-
} else {
|
|
6317
|
-
try {
|
|
6318
|
-
await http.servicenow("/api/now/table/change_request", { params: { sysparm_limit: 1 }, timeoutMs: 1e4 });
|
|
6319
|
-
results.servicenow = { status: "valid", message: "ok" };
|
|
6320
|
-
} catch (err) {
|
|
6321
|
-
results.servicenow = categorize(err);
|
|
6322
|
-
}
|
|
6323
|
-
}
|
|
6324
6311
|
if (!cfg.contrast.apiKey || !cfg.contrast.serviceKey || !cfg.contrast.username) {
|
|
6325
6312
|
results.contrast = { status: "blank", message: "not configured" };
|
|
6326
6313
|
} else if (!cfg.contrast.orgUuid) {
|
|
@@ -8168,17 +8155,6 @@ function registerConfigCommands(program2) {
|
|
|
8168
8155
|
} else {
|
|
8169
8156
|
results.checkmarx = { ok: null, message: "not configured" };
|
|
8170
8157
|
}
|
|
8171
|
-
const snConfigured = cfg.servicenow.baseUrl && cfg.servicenow.username && (cfg.servicenow.password || cfg.servicenow.apiToken);
|
|
8172
|
-
if (snConfigured) {
|
|
8173
|
-
try {
|
|
8174
|
-
await http.servicenow("/api/now/table/change_request", { params: { sysparm_limit: 1 } });
|
|
8175
|
-
results.servicenow = { ok: true, message: "connected" };
|
|
8176
|
-
} catch (err) {
|
|
8177
|
-
results.servicenow = { ok: false, message: err instanceof Error ? err.message : String(err) };
|
|
8178
|
-
}
|
|
8179
|
-
} else {
|
|
8180
|
-
results.servicenow = { ok: null, message: "not configured" };
|
|
8181
|
-
}
|
|
8182
8158
|
if (cfg.contrast.apiKey && cfg.contrast.serviceKey && cfg.contrast.username && cfg.contrast.orgUuid) {
|
|
8183
8159
|
try {
|
|
8184
8160
|
await http.contrast(`/Contrast/api/ng/${cfg.contrast.orgUuid}/applications`, { params: { limit: 1 } });
|
|
@@ -8363,7 +8339,6 @@ function registerConfigCommands(program2) {
|
|
|
8363
8339
|
"jenkins",
|
|
8364
8340
|
"artifactory",
|
|
8365
8341
|
"checkmarx",
|
|
8366
|
-
"servicenow",
|
|
8367
8342
|
"contrast",
|
|
8368
8343
|
"sonatypeiq",
|
|
8369
8344
|
"openshift",
|
|
@@ -8708,61 +8683,6 @@ async function initGlobalConfig(start) {
|
|
|
8708
8683
|
}
|
|
8709
8684
|
}
|
|
8710
8685
|
}
|
|
8711
|
-
process.stderr.write("\n\u2500\u2500 ServiceNow \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
|
|
8712
|
-
const useServiceNow = await confirm({
|
|
8713
|
-
message: "Configure ServiceNow for change management?",
|
|
8714
|
-
default: false
|
|
8715
|
-
});
|
|
8716
|
-
let servicenowBaseUrl = "";
|
|
8717
|
-
let servicenowUsername = "";
|
|
8718
|
-
let servicenowPassword = "";
|
|
8719
|
-
let servicenowApiToken = "";
|
|
8720
|
-
if (useServiceNow) {
|
|
8721
|
-
servicenowBaseUrl = await input2({
|
|
8722
|
-
message: "ServiceNow instance URL (e.g. imagile.service-now.com):",
|
|
8723
|
-
default: ""
|
|
8724
|
-
});
|
|
8725
|
-
servicenowUsername = await input2({
|
|
8726
|
-
message: "ServiceNow username:",
|
|
8727
|
-
default: ""
|
|
8728
|
-
});
|
|
8729
|
-
const snUseToken = await confirm({
|
|
8730
|
-
message: "Authenticate with an API token instead of a password?",
|
|
8731
|
-
default: false
|
|
8732
|
-
});
|
|
8733
|
-
if (snUseToken) {
|
|
8734
|
-
servicenowApiToken = await password({
|
|
8735
|
-
message: "ServiceNow API token:",
|
|
8736
|
-
validate: (v) => v.length > 0 || "Token cannot be blank"
|
|
8737
|
-
});
|
|
8738
|
-
} else {
|
|
8739
|
-
servicenowPassword = await password({
|
|
8740
|
-
message: "ServiceNow password:",
|
|
8741
|
-
validate: (v) => v.length > 0 || "Password cannot be blank"
|
|
8742
|
-
});
|
|
8743
|
-
}
|
|
8744
|
-
const snHasCreds = servicenowBaseUrl && servicenowUsername && (servicenowPassword || servicenowApiToken);
|
|
8745
|
-
if (snHasCreds) {
|
|
8746
|
-
process.stderr.write("\n Verifying connection...\n");
|
|
8747
|
-
try {
|
|
8748
|
-
const tempConfig = {
|
|
8749
|
-
...loadConfig(),
|
|
8750
|
-
servicenow: {
|
|
8751
|
-
baseUrl: normalizeBaseUrl(servicenowBaseUrl),
|
|
8752
|
-
username: servicenowUsername,
|
|
8753
|
-
password: servicenowPassword || void 0,
|
|
8754
|
-
apiToken: servicenowApiToken || void 0
|
|
8755
|
-
}
|
|
8756
|
-
};
|
|
8757
|
-
const tempHttp = createHttpClient(tempConfig);
|
|
8758
|
-
await tempHttp.servicenow("/api/now/table/change_request", { params: { sysparm_limit: 1 } });
|
|
8759
|
-
process.stderr.write(" Connected.\n");
|
|
8760
|
-
} catch (err) {
|
|
8761
|
-
warn(`Could not connect to ServiceNow: ${err instanceof Error ? err.message : String(err)}`);
|
|
8762
|
-
warn("Config will be saved anyway. Check your URL and credentials and re-run pncli config init or pncli config test.");
|
|
8763
|
-
}
|
|
8764
|
-
}
|
|
8765
|
-
}
|
|
8766
8686
|
process.stderr.write("\n\u2500\u2500 Sonatype IQ Server \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
|
|
8767
8687
|
const useSonatypeIq = await confirm({
|
|
8768
8688
|
message: "Configure Sonatype IQ Server for dependency vulnerability scanning?",
|
|
@@ -9143,14 +9063,6 @@ async function initGlobalConfig(start) {
|
|
|
9143
9063
|
clientSecret: checkmarxClientSecret || void 0
|
|
9144
9064
|
}
|
|
9145
9065
|
} : {},
|
|
9146
|
-
...useServiceNow && servicenowBaseUrl ? {
|
|
9147
|
-
servicenow: {
|
|
9148
|
-
baseUrl: normalizeBaseUrl(servicenowBaseUrl),
|
|
9149
|
-
username: servicenowUsername || void 0,
|
|
9150
|
-
...servicenowApiToken ? { apiToken: servicenowApiToken } : {},
|
|
9151
|
-
...servicenowPassword ? { password: servicenowPassword } : {}
|
|
9152
|
-
}
|
|
9153
|
-
} : {},
|
|
9154
9066
|
...useContrast && contrastOrgUuid ? {
|
|
9155
9067
|
contrast: {
|
|
9156
9068
|
...contrastBaseUrl ? { baseUrl: normalizeBaseUrl(contrastBaseUrl) } : {},
|
|
@@ -9463,19 +9375,28 @@ var AdoGitClient = class {
|
|
|
9463
9375
|
}
|
|
9464
9376
|
// ── Pull Requests ─────────────────────────────────────────────────
|
|
9465
9377
|
async listPRs(collection, project, repo, opts = {}) {
|
|
9466
|
-
|
|
9378
|
+
const pageSize = 100;
|
|
9379
|
+
const results = [];
|
|
9380
|
+
let skip = 0;
|
|
9381
|
+
while (true) {
|
|
9467
9382
|
const params = {
|
|
9468
9383
|
"api-version": API7,
|
|
9469
9384
|
"searchCriteria.status": opts.status ?? "active",
|
|
9470
9385
|
...opts.creatorAlias ? { "searchCriteria.creatorId": opts.creatorAlias } : {},
|
|
9471
9386
|
...opts.reviewerAlias ? { "searchCriteria.reviewerId": opts.reviewerAlias } : {},
|
|
9472
|
-
|
|
9387
|
+
"$top": pageSize,
|
|
9388
|
+
"$skip": skip
|
|
9473
9389
|
};
|
|
9474
|
-
|
|
9390
|
+
const { data } = await this.http.adoRaw(
|
|
9475
9391
|
`/${encodeURIComponent(collection)}/${encodeURIComponent(project)}/_apis/git/repositories/${encodeURIComponent(repo)}/pullrequests`,
|
|
9476
9392
|
{ params }
|
|
9477
9393
|
);
|
|
9478
|
-
|
|
9394
|
+
const page = data.value ?? [];
|
|
9395
|
+
results.push(...page);
|
|
9396
|
+
if (page.length < pageSize) break;
|
|
9397
|
+
skip += pageSize;
|
|
9398
|
+
}
|
|
9399
|
+
return results;
|
|
9479
9400
|
}
|
|
9480
9401
|
async getPR(collection, project, repo, prId) {
|
|
9481
9402
|
return this.http.ado(
|
|
@@ -10421,11 +10342,11 @@ function registerAdoRepoCommands(ado) {
|
|
|
10421
10342
|
const start = Date.now();
|
|
10422
10343
|
try {
|
|
10423
10344
|
const globalOpts = ado.optsWithGlobals();
|
|
10424
|
-
const { loadConfig: lc } = await import("./config-
|
|
10345
|
+
const { loadConfig: lc } = await import("./config-7FK4MAQC.js");
|
|
10425
10346
|
const config = lc({ configPath: globalOpts.config });
|
|
10426
10347
|
const { collection, project, repo: repo2, gitClient } = getAdoContext(ado, true);
|
|
10427
10348
|
const { AdoCoreClient: AdoCoreClient2 } = await import("./core-SWYVXOQ4.js");
|
|
10428
|
-
const { createHttpClient: createHttpClient2 } = await import("./http-
|
|
10349
|
+
const { createHttpClient: createHttpClient2 } = await import("./http-M5GQGXVF.js");
|
|
10429
10350
|
const http = createHttpClient2(config, Boolean(globalOpts.dryRun));
|
|
10430
10351
|
const coreClient = new AdoCoreClient2(http);
|
|
10431
10352
|
const me = await coreClient.getConnectionData(collection);
|
|
@@ -11181,119 +11102,6 @@ function registerCheckmarxCommands(program2) {
|
|
|
11181
11102
|
});
|
|
11182
11103
|
}
|
|
11183
11104
|
|
|
11184
|
-
// src/services/servicenow/commands.ts
|
|
11185
|
-
function getHttp(program2) {
|
|
11186
|
-
const opts = program2.optsWithGlobals();
|
|
11187
|
-
const config = loadConfig({ configPath: opts.config });
|
|
11188
|
-
if (!config.servicenow.baseUrl) throw new PncliError("ServiceNow not configured. Run: pncli config init");
|
|
11189
|
-
return createHttpClient(config, Boolean(opts.dryRun));
|
|
11190
|
-
}
|
|
11191
|
-
function registerServiceNowCommands(program2) {
|
|
11192
|
-
const sn = program2.command("servicenow").description("ServiceNow operations");
|
|
11193
|
-
const change = sn.command("change").description("Change request operations");
|
|
11194
|
-
change.command("list").description("List change requests").option("--state <state>", "Filter by state (e.g. -1=Pending, 1=Open, 2=Work in Progress, 3=Closed Complete)").option("--assigned-to <user>", "Filter by assigned user sys_id or display name").option("--limit <n>", "Maximum number of results", "25").option("--fields <fields>", "Comma-separated field names to return").action(async (opts) => {
|
|
11195
|
-
const start = Date.now();
|
|
11196
|
-
try {
|
|
11197
|
-
const http = getHttp(program2);
|
|
11198
|
-
const params = {
|
|
11199
|
-
sysparm_limit: opts.limit ? parseInt(opts.limit, 10) : 25,
|
|
11200
|
-
sysparm_display_value: "true"
|
|
11201
|
-
};
|
|
11202
|
-
const sanitize = (v) => v.replace(/\^/g, "");
|
|
11203
|
-
const queries = [];
|
|
11204
|
-
if (opts.state !== void 0) queries.push(`state=${sanitize(opts.state)}`);
|
|
11205
|
-
if (opts.assignedTo) queries.push(`assigned_to=${sanitize(opts.assignedTo)}`);
|
|
11206
|
-
if (queries.length) params["sysparm_query"] = queries.join("^");
|
|
11207
|
-
if (opts.fields) params["sysparm_fields"] = opts.fields;
|
|
11208
|
-
const data = await http.servicenow("/api/now/table/change_request", { params });
|
|
11209
|
-
success(data.result, "servicenow", "change list", start);
|
|
11210
|
-
} catch (err) {
|
|
11211
|
-
fail(err, "servicenow", "change list", start);
|
|
11212
|
-
}
|
|
11213
|
-
});
|
|
11214
|
-
change.command("get").description("Get a change request by sys_id or number").requiredOption("--id <id>", "Change request sys_id or number (e.g. CHG0001234)").action(async (opts) => {
|
|
11215
|
-
const start = Date.now();
|
|
11216
|
-
try {
|
|
11217
|
-
const http = getHttp(program2);
|
|
11218
|
-
if (opts.id.toUpperCase().startsWith("CHG")) {
|
|
11219
|
-
const list = await http.servicenow("/api/now/table/change_request", {
|
|
11220
|
-
params: { sysparm_query: `number=${opts.id}`, sysparm_display_value: "true", sysparm_limit: 1 }
|
|
11221
|
-
});
|
|
11222
|
-
if (!list.result.length) throw new PncliError(`Change request not found: ${opts.id}`, 1);
|
|
11223
|
-
success(list.result[0], "servicenow", "change get", start);
|
|
11224
|
-
return;
|
|
11225
|
-
}
|
|
11226
|
-
const data = await http.servicenow(`/api/now/table/change_request/${opts.id}`, {
|
|
11227
|
-
params: { sysparm_display_value: "true" }
|
|
11228
|
-
});
|
|
11229
|
-
success(data.result, "servicenow", "change get", start);
|
|
11230
|
-
} catch (err) {
|
|
11231
|
-
fail(err, "servicenow", "change get", start);
|
|
11232
|
-
}
|
|
11233
|
-
});
|
|
11234
|
-
change.command("create").description("Create a change request").requiredOption("--short-description <text>", "Short description (title)").option("--description <text>", "Full description").option("--type <type>", "Change type: normal, standard, or emergency", "normal").option("--priority <n>", "Priority: 1=Critical, 2=High, 3=Moderate, 4=Low").option("--assigned-to <user>", "Assigned user sys_id").option("--assignment-group <group>", "Assignment group sys_id").option("--start-date <datetime>", "Planned start date (yyyy-MM-dd HH:mm:ss)").option("--end-date <datetime>", "Planned end date (yyyy-MM-dd HH:mm:ss)").action(async (opts) => {
|
|
11235
|
-
const start = Date.now();
|
|
11236
|
-
try {
|
|
11237
|
-
const http = getHttp(program2);
|
|
11238
|
-
const body = {
|
|
11239
|
-
short_description: opts.shortDescription,
|
|
11240
|
-
type: opts.type ?? "normal"
|
|
11241
|
-
};
|
|
11242
|
-
if (opts.description) body["description"] = opts.description;
|
|
11243
|
-
if (opts.priority) body["priority"] = opts.priority;
|
|
11244
|
-
if (opts.assignedTo) body["assigned_to"] = opts.assignedTo;
|
|
11245
|
-
if (opts.assignmentGroup) body["assignment_group"] = opts.assignmentGroup;
|
|
11246
|
-
if (opts.startDate) body["start_date"] = opts.startDate;
|
|
11247
|
-
if (opts.endDate) body["end_date"] = opts.endDate;
|
|
11248
|
-
const data = await http.servicenow("/api/now/table/change_request", {
|
|
11249
|
-
method: "POST",
|
|
11250
|
-
body
|
|
11251
|
-
});
|
|
11252
|
-
success(data.result, "servicenow", "change create", start);
|
|
11253
|
-
} catch (err) {
|
|
11254
|
-
fail(err, "servicenow", "change create", start);
|
|
11255
|
-
}
|
|
11256
|
-
});
|
|
11257
|
-
change.command("update").description("Update a change request").requiredOption("--id <sys_id>", "Change request sys_id").option("--short-description <text>", "New short description").option("--description <text>", "New description").option("--state <state>", "New state value").option("--priority <n>", "New priority").option("--assigned-to <user>", "New assigned user sys_id").option("--start-date <datetime>", "New planned start date").option("--end-date <datetime>", "New planned end date").action(async (opts) => {
|
|
11258
|
-
const start = Date.now();
|
|
11259
|
-
try {
|
|
11260
|
-
const http = getHttp(program2);
|
|
11261
|
-
const body = {};
|
|
11262
|
-
if (opts.shortDescription) body["short_description"] = opts.shortDescription;
|
|
11263
|
-
if (opts.description) body["description"] = opts.description;
|
|
11264
|
-
if (opts.state !== void 0) body["state"] = opts.state;
|
|
11265
|
-
if (opts.priority) body["priority"] = opts.priority;
|
|
11266
|
-
if (opts.assignedTo) body["assigned_to"] = opts.assignedTo;
|
|
11267
|
-
if (opts.startDate) body["start_date"] = opts.startDate;
|
|
11268
|
-
if (opts.endDate) body["end_date"] = opts.endDate;
|
|
11269
|
-
if (Object.keys(body).length === 0) throw new PncliError("No fields to update. Provide at least one option besides --id.", 1);
|
|
11270
|
-
const data = await http.servicenow(`/api/now/table/change_request/${opts.id}`, {
|
|
11271
|
-
method: "PATCH",
|
|
11272
|
-
body
|
|
11273
|
-
});
|
|
11274
|
-
success(data.result, "servicenow", "change update", start);
|
|
11275
|
-
} catch (err) {
|
|
11276
|
-
fail(err, "servicenow", "change update", start);
|
|
11277
|
-
}
|
|
11278
|
-
});
|
|
11279
|
-
change.command("close").description("Close a change request (state=3)").requiredOption("--id <sys_id>", "Change request sys_id").option("--close-notes <text>", "Closure notes").option("--close-code <code>", "Close code (e.g. successful, unsuccessful)").action(async (opts) => {
|
|
11280
|
-
const start = Date.now();
|
|
11281
|
-
try {
|
|
11282
|
-
const http = getHttp(program2);
|
|
11283
|
-
const body = { state: 3 };
|
|
11284
|
-
if (opts.closeNotes) body["close_notes"] = opts.closeNotes;
|
|
11285
|
-
if (opts.closeCode) body["close_code"] = opts.closeCode;
|
|
11286
|
-
const data = await http.servicenow(`/api/now/table/change_request/${opts.id}`, {
|
|
11287
|
-
method: "PATCH",
|
|
11288
|
-
body
|
|
11289
|
-
});
|
|
11290
|
-
success(data.result, "servicenow", "change close", start);
|
|
11291
|
-
} catch (err) {
|
|
11292
|
-
fail(err, "servicenow", "change close", start);
|
|
11293
|
-
}
|
|
11294
|
-
});
|
|
11295
|
-
}
|
|
11296
|
-
|
|
11297
11105
|
// src/services/contrast/commands.ts
|
|
11298
11106
|
function getHttpAndOrg(program2) {
|
|
11299
11107
|
const opts = program2.optsWithGlobals();
|
|
@@ -11372,14 +11180,27 @@ function registerContrastCommands(program2) {
|
|
|
11372
11180
|
fail(err, "contrast", "libraries list", start);
|
|
11373
11181
|
}
|
|
11374
11182
|
});
|
|
11375
|
-
libraries.command("get").description("Get details for a specific library used by an application").requiredOption("--app <app-id>", "Application ID (UUID)").requiredOption("--hash <library-hash>", "Library hash").action(async (opts) => {
|
|
11183
|
+
libraries.command("get").description("Get details for a specific library used by an application, by hash").requiredOption("--app <app-id>", "Application ID (UUID)").requiredOption("--hash <library-hash>", "Library hash").action(async (opts) => {
|
|
11376
11184
|
const start = Date.now();
|
|
11377
11185
|
try {
|
|
11378
11186
|
const { http, orgUuid } = getHttpAndOrg(program2);
|
|
11379
|
-
const
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11187
|
+
const batchSize = 25;
|
|
11188
|
+
let offset = 0;
|
|
11189
|
+
let match;
|
|
11190
|
+
for (; ; ) {
|
|
11191
|
+
const page = await http.contrast(
|
|
11192
|
+
`/Contrast/api/ng/${orgUuid}/applications/${opts.app}/libraries`,
|
|
11193
|
+
{ params: { limit: batchSize, offset } }
|
|
11194
|
+
);
|
|
11195
|
+
const items = page.libraries ?? [];
|
|
11196
|
+
match = items.find((item) => item["hash"] === opts.hash);
|
|
11197
|
+
if (match || items.length < batchSize) break;
|
|
11198
|
+
offset += batchSize;
|
|
11199
|
+
}
|
|
11200
|
+
if (!match) {
|
|
11201
|
+
throw new PncliError(`Library with hash "${opts.hash}" not found for application ${opts.app}`, 404);
|
|
11202
|
+
}
|
|
11203
|
+
success(match, "contrast", "libraries get", start);
|
|
11383
11204
|
} catch (err) {
|
|
11384
11205
|
fail(err, "contrast", "libraries get", start);
|
|
11385
11206
|
}
|
|
@@ -11527,7 +11348,7 @@ function resolveCluster(config, env, instance) {
|
|
|
11527
11348
|
}
|
|
11528
11349
|
return { baseUrl: config.openshift.baseUrl, token: config.openshift.token };
|
|
11529
11350
|
}
|
|
11530
|
-
function
|
|
11351
|
+
function getHttp(oc) {
|
|
11531
11352
|
const opts = oc.optsWithGlobals();
|
|
11532
11353
|
const config = loadConfig({ configPath: opts.config });
|
|
11533
11354
|
const cluster = resolveCluster(config, opts.env, opts.instance);
|
|
@@ -11603,7 +11424,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11603
11424
|
oc.command("pods").description("List pod health summary for a namespace \u2014 pre-processed for LLM analysis. Use --raw to return the full unmodified Kubernetes pod objects.").requiredOption("--namespace <ns>", "Kubernetes namespace").option("--label-selector <selector>", "Label selector (e.g. app=my-app)").option("--raw", "Return full Kubernetes pod objects without summarization (includes env vars, images, node name, annotations, resources, etc.)", false).action(async (opts) => {
|
|
11604
11425
|
const start = Date.now();
|
|
11605
11426
|
try {
|
|
11606
|
-
const http =
|
|
11427
|
+
const http = getHttp(oc);
|
|
11607
11428
|
const params = {};
|
|
11608
11429
|
if (opts.labelSelector) params["labelSelector"] = opts.labelSelector;
|
|
11609
11430
|
const podList = await http.openshift(
|
|
@@ -11712,7 +11533,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11712
11533
|
oc.command("events").description("List Warning events for a namespace \u2014 pre-filtered for LLM analysis").requiredOption("--namespace <ns>", "Kubernetes namespace").option("--field-selector <selector>", "Additional field selector (e.g. involvedObject.name=my-pod)").option("--all", "Include Normal events in addition to Warning events", false).action(async (opts) => {
|
|
11713
11534
|
const start = Date.now();
|
|
11714
11535
|
try {
|
|
11715
|
-
const http =
|
|
11536
|
+
const http = getHttp(oc);
|
|
11716
11537
|
const params = {};
|
|
11717
11538
|
const selectors = [];
|
|
11718
11539
|
if (!opts.all) selectors.push("type=Warning");
|
|
@@ -11746,7 +11567,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11746
11567
|
oc.command("logs").description("Get recent log lines from a pod container").requiredOption("--namespace <ns>", "Kubernetes namespace").requiredOption("--pod <name>", "Pod name").option("--container <name>", "Container name (defaults to first container)").option("--lines <n>", "Number of most-recent lines to return", "100").option("--previous", "Return logs from the previous container instance", false).action(async (opts) => {
|
|
11747
11568
|
const start = Date.now();
|
|
11748
11569
|
try {
|
|
11749
|
-
const http =
|
|
11570
|
+
const http = getHttp(oc);
|
|
11750
11571
|
const lines = opts.lines ? parseInt(opts.lines, 10) : 100;
|
|
11751
11572
|
const logText = await http.openshiftText(
|
|
11752
11573
|
`/api/v1/namespaces/${encodeURIComponent(opts.namespace)}/pods/${encodeURIComponent(opts.pod)}/log`,
|
|
@@ -11778,7 +11599,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11778
11599
|
oc.command("pod-metrics").description("Get CPU and memory usage for pods in a namespace (requires metrics-server)").requiredOption("--namespace <ns>", "Kubernetes namespace").action(async (opts) => {
|
|
11779
11600
|
const start = Date.now();
|
|
11780
11601
|
try {
|
|
11781
|
-
const http =
|
|
11602
|
+
const http = getHttp(oc);
|
|
11782
11603
|
const metricsList = await http.openshift(
|
|
11783
11604
|
`/apis/metrics.k8s.io/v1beta1/namespaces/${encodeURIComponent(opts.namespace)}/pods`
|
|
11784
11605
|
);
|
|
@@ -11798,7 +11619,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11798
11619
|
oc.command("resource-usage").description("Combined CPU/memory usage, limits, and requests for all pods in a namespace \u2014 all values normalized to millicores (m) and mebibytes (Mi). Requires metrics-server. Use --csv to emit a spreadsheet-friendly CSV.").requiredOption("--namespace <ns>", "Kubernetes namespace").option("--label-selector <selector>", "Label selector (e.g. app=my-app)").option("--csv", "Output as CSV instead of JSON (suitable for Excel)", false).action(async (opts) => {
|
|
11799
11620
|
const start = Date.now();
|
|
11800
11621
|
try {
|
|
11801
|
-
const http =
|
|
11622
|
+
const http = getHttp(oc);
|
|
11802
11623
|
const nsEncoded = encodeURIComponent(opts.namespace);
|
|
11803
11624
|
const podParams = {};
|
|
11804
11625
|
if (opts.labelSelector) podParams["labelSelector"] = opts.labelSelector;
|
|
@@ -11863,7 +11684,7 @@ function registerOpenShiftCommands(program2) {
|
|
|
11863
11684
|
}
|
|
11864
11685
|
|
|
11865
11686
|
// src/services/dynatrace/commands.ts
|
|
11866
|
-
function
|
|
11687
|
+
function getHttp2(program2, envName) {
|
|
11867
11688
|
const opts = program2.optsWithGlobals();
|
|
11868
11689
|
const cfg = loadConfig({ configPath: opts.config });
|
|
11869
11690
|
if (envName) {
|
|
@@ -11987,7 +11808,7 @@ function registerDynatraceCommands(program2) {
|
|
|
11987
11808
|
const start = Date.now();
|
|
11988
11809
|
try {
|
|
11989
11810
|
const envName = dynatrace.opts().env;
|
|
11990
|
-
const data = await listEntities(
|
|
11811
|
+
const data = await listEntities(getHttp2(program2, envName), opts.selector, opts);
|
|
11991
11812
|
success({ totalCount: data.totalCount, entities: data.items }, "dynatrace", "entities list", start);
|
|
11992
11813
|
} catch (err) {
|
|
11993
11814
|
fail(err, "dynatrace", "entities list", start);
|
|
@@ -11997,7 +11818,7 @@ function registerDynatraceCommands(program2) {
|
|
|
11997
11818
|
const start = Date.now();
|
|
11998
11819
|
try {
|
|
11999
11820
|
const envName = dynatrace.opts().env;
|
|
12000
|
-
const data = await
|
|
11821
|
+
const data = await getHttp2(program2, envName).dynatrace(
|
|
12001
11822
|
`/api/v2/entities/${encodeURIComponent(opts.id)}`,
|
|
12002
11823
|
{ params: { from: opts.from, to: opts.to, fields: opts.fields } }
|
|
12003
11824
|
);
|
|
@@ -12010,7 +11831,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12010
11831
|
const start = Date.now();
|
|
12011
11832
|
try {
|
|
12012
11833
|
const envName = dynatrace.opts().env;
|
|
12013
|
-
const data = await listEntities(
|
|
11834
|
+
const data = await listEntities(getHttp2(program2, envName), 'type("SERVICE")', opts);
|
|
12014
11835
|
success({ totalCount: data.totalCount, services: data.items }, "dynatrace", "services", start);
|
|
12015
11836
|
} catch (err) {
|
|
12016
11837
|
fail(err, "dynatrace", "services", start);
|
|
@@ -12021,7 +11842,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12021
11842
|
try {
|
|
12022
11843
|
const envName = dynatrace.opts().env;
|
|
12023
11844
|
const selector = 'type("CLOUD_APPLICATION")';
|
|
12024
|
-
const data = await listEntities(
|
|
11845
|
+
const data = await listEntities(getHttp2(program2, envName), selector, opts);
|
|
12025
11846
|
success({ totalCount: data.totalCount, workloads: data.items }, "dynatrace", "workloads", start);
|
|
12026
11847
|
} catch (err) {
|
|
12027
11848
|
fail(err, "dynatrace", "workloads", start);
|
|
@@ -12033,7 +11854,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12033
11854
|
try {
|
|
12034
11855
|
const envName = dynatrace.opts().env;
|
|
12035
11856
|
const data = await allPages(async (nextPageKey) => {
|
|
12036
|
-
const page = await
|
|
11857
|
+
const page = await getHttp2(program2, envName).dynatrace("/api/v2/problems", {
|
|
12037
11858
|
params: nextPageKey ? { nextPageKey } : {
|
|
12038
11859
|
from: opts.from ?? "now-2h",
|
|
12039
11860
|
to: opts.to ?? "now",
|
|
@@ -12053,7 +11874,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12053
11874
|
const start = Date.now();
|
|
12054
11875
|
try {
|
|
12055
11876
|
const envName = dynatrace.opts().env;
|
|
12056
|
-
const data = await
|
|
11877
|
+
const data = await getHttp2(program2, envName).dynatrace(
|
|
12057
11878
|
`/api/v2/problems/${encodeURIComponent(opts.id)}`,
|
|
12058
11879
|
{ params: { fields: opts.fields } }
|
|
12059
11880
|
);
|
|
@@ -12066,7 +11887,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12066
11887
|
const start = Date.now();
|
|
12067
11888
|
try {
|
|
12068
11889
|
const envName = dynatrace.opts().env;
|
|
12069
|
-
const result = await runTraceQuery(
|
|
11890
|
+
const result = await runTraceQuery(getHttp2(program2, envName), opts.id);
|
|
12070
11891
|
success(result, "dynatrace", "trace", start);
|
|
12071
11892
|
} catch (err) {
|
|
12072
11893
|
fail(err, "dynatrace", "trace", start);
|
|
@@ -12075,7 +11896,7 @@ function registerDynatraceCommands(program2) {
|
|
|
12075
11896
|
}
|
|
12076
11897
|
|
|
12077
11898
|
// src/services/logscale/commands.ts
|
|
12078
|
-
function
|
|
11899
|
+
function getHttp3(program2) {
|
|
12079
11900
|
const opts = program2.optsWithGlobals();
|
|
12080
11901
|
return createHttpClient(
|
|
12081
11902
|
loadConfig({ configPath: opts.config }),
|
|
@@ -12088,7 +11909,7 @@ function registerLogscaleCommands(program2) {
|
|
|
12088
11909
|
repositories.command("list").description("List available repositories").action(async () => {
|
|
12089
11910
|
const start = Date.now();
|
|
12090
11911
|
try {
|
|
12091
|
-
const data = await
|
|
11912
|
+
const data = await getHttp3(program2).logscale("/api/v1/repositories");
|
|
12092
11913
|
success({ count: data.length, repositories: data }, "logscale", "repositories list", start);
|
|
12093
11914
|
} catch (err) {
|
|
12094
11915
|
fail(err, "logscale", "repositories list", start);
|
|
@@ -12105,7 +11926,7 @@ function registerLogscaleCommands(program2) {
|
|
|
12105
11926
|
showQueryEventDistribution: false,
|
|
12106
11927
|
isLive: false
|
|
12107
11928
|
};
|
|
12108
|
-
const data = await
|
|
11929
|
+
const data = await getHttp3(program2).logscale(
|
|
12109
11930
|
`/api/v1/repositories/${encodeURIComponent(opts.repository)}/query`,
|
|
12110
11931
|
{
|
|
12111
11932
|
method: "POST",
|
|
@@ -12136,7 +11957,7 @@ function registerLogscaleCommands(program2) {
|
|
|
12136
11957
|
// src/services/splitio/commands.ts
|
|
12137
11958
|
import fs6 from "fs";
|
|
12138
11959
|
import confirm2 from "@inquirer/confirm";
|
|
12139
|
-
function
|
|
11960
|
+
function getHttp4(program2) {
|
|
12140
11961
|
const opts = program2.optsWithGlobals();
|
|
12141
11962
|
return createHttpClient(
|
|
12142
11963
|
loadConfig({ configPath: opts.config }),
|
|
@@ -12181,7 +12002,7 @@ function registerSplitioCommands(program2) {
|
|
|
12181
12002
|
workspaces.command("list").description("List all Split.IO workspaces").action(async () => {
|
|
12182
12003
|
const start = Date.now();
|
|
12183
12004
|
try {
|
|
12184
|
-
const http =
|
|
12005
|
+
const http = getHttp4(program2);
|
|
12185
12006
|
const data = await http.splitio("/internal/api/v2/workspaces");
|
|
12186
12007
|
success(
|
|
12187
12008
|
{ count: data.objects.length, workspaces: data.objects },
|
|
@@ -12197,7 +12018,7 @@ function registerSplitioCommands(program2) {
|
|
|
12197
12018
|
environments.command("list").description("List environments in a workspace").requiredOption("--workspace <id>", "Workspace ID").action(async (opts) => {
|
|
12198
12019
|
const start = Date.now();
|
|
12199
12020
|
try {
|
|
12200
|
-
const http =
|
|
12021
|
+
const http = getHttp4(program2);
|
|
12201
12022
|
const data = await http.splitio(
|
|
12202
12023
|
`/internal/api/v2/workspaces/${encodeURIComponent(opts.workspace)}/environments`
|
|
12203
12024
|
);
|
|
@@ -12215,7 +12036,7 @@ function registerSplitioCommands(program2) {
|
|
|
12215
12036
|
flags.command("list").description("List feature flags in a workspace").requiredOption("--workspace <id>", "Workspace ID").option("--limit <n>", "Maximum number of flags to return", "50").option("--offset <n>", "Pagination offset", "0").option("--flag-set <name>", "Filter by flag set name").action(async (opts) => {
|
|
12216
12037
|
const start = Date.now();
|
|
12217
12038
|
try {
|
|
12218
|
-
const http =
|
|
12039
|
+
const http = getHttp4(program2);
|
|
12219
12040
|
const params = {
|
|
12220
12041
|
wsId: opts.workspace,
|
|
12221
12042
|
limit: parseInt(opts.limit, 10),
|
|
@@ -12236,7 +12057,7 @@ function registerSplitioCommands(program2) {
|
|
|
12236
12057
|
flags.command("get").description("Get a flag definition").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").option("--environment <id>", "Environment ID \u2014 include targeting rules for this environment").action(async (opts) => {
|
|
12237
12058
|
const start = Date.now();
|
|
12238
12059
|
try {
|
|
12239
|
-
const http =
|
|
12060
|
+
const http = getHttp4(program2);
|
|
12240
12061
|
if (opts.environment) {
|
|
12241
12062
|
const data = await http.splitio(
|
|
12242
12063
|
`/internal/api/v2/splits/${encodeURIComponent(opts.flag)}/environments/${encodeURIComponent(opts.environment)}`,
|
|
@@ -12254,13 +12075,13 @@ function registerSplitioCommands(program2) {
|
|
|
12254
12075
|
fail(err, "splitio", "flags get", start);
|
|
12255
12076
|
}
|
|
12256
12077
|
});
|
|
12257
|
-
flags.command("update").description("Submit a Change Request to replace a flag's full definition in an environment").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12078
|
+
flags.command("update").description("Submit a Change Request to replace a flag's full definition in an environment").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--input-file <path>", "JSON file with the complete flag definition body (use - for stdin)").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12258
12079
|
const start = Date.now();
|
|
12259
12080
|
try {
|
|
12260
12081
|
if (!opts.inputFile) throw new PncliError("--input-file is required for flags update");
|
|
12261
12082
|
const definition = loadInputFile(opts.inputFile);
|
|
12262
12083
|
await confirmWrite(opts, `UPDATE ${opts.flag} in ${opts.environment}`);
|
|
12263
|
-
const http =
|
|
12084
|
+
const http = getHttp4(program2);
|
|
12264
12085
|
const body = {
|
|
12265
12086
|
...buildCrBase(opts),
|
|
12266
12087
|
operationType: "UPDATE_SPLIT_DEFINITION",
|
|
@@ -12280,13 +12101,13 @@ function registerSplitioCommands(program2) {
|
|
|
12280
12101
|
fail(err, "splitio", "flags update", start);
|
|
12281
12102
|
}
|
|
12282
12103
|
});
|
|
12283
|
-
flags.command("set-rule").description("Change one targeting rule without altering the rest of the flag definition").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--rule-index <n>", "Zero-based index of the targeting rule to update").option("--treatment <name>", "Treatment to assign to the entire rule bucket").option("--weights <json>", "JSON array of {treatment, size} objects for weighted distribution").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12104
|
+
flags.command("set-rule").description("Change one targeting rule without altering the rest of the flag definition").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--rule-index <n>", "Zero-based index of the targeting rule to update").option("--treatment <name>", "Treatment to assign to the entire rule bucket").option("--weights <json>", "JSON array of {treatment, size} objects for weighted distribution").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12284
12105
|
const start = Date.now();
|
|
12285
12106
|
try {
|
|
12286
12107
|
if (!opts.treatment && !opts.weights) {
|
|
12287
12108
|
throw new PncliError("Either --treatment or --weights must be specified");
|
|
12288
12109
|
}
|
|
12289
|
-
const http =
|
|
12110
|
+
const http = getHttp4(program2);
|
|
12290
12111
|
const current = await http.splitio(
|
|
12291
12112
|
`/internal/api/v2/splits/${encodeURIComponent(opts.flag)}/environments/${encodeURIComponent(opts.environment)}`,
|
|
12292
12113
|
{ params: { wsId: opts.workspace } }
|
|
@@ -12322,10 +12143,10 @@ function registerSplitioCommands(program2) {
|
|
|
12322
12143
|
fail(err, "splitio", "flags set-rule", start);
|
|
12323
12144
|
}
|
|
12324
12145
|
});
|
|
12325
|
-
flags.command("set-default").description("Update the fallback default rule for traffic matching no targeting rule").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--treatment <name>", "Treatment to assign as the default").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12146
|
+
flags.command("set-default").description("Update the fallback default rule for traffic matching no targeting rule").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--treatment <name>", "Treatment to assign as the default").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12326
12147
|
const start = Date.now();
|
|
12327
12148
|
try {
|
|
12328
|
-
const http =
|
|
12149
|
+
const http = getHttp4(program2);
|
|
12329
12150
|
const current = await http.splitio(
|
|
12330
12151
|
`/internal/api/v2/splits/${encodeURIComponent(opts.flag)}/environments/${encodeURIComponent(opts.environment)}`,
|
|
12331
12152
|
{ params: { wsId: opts.workspace } }
|
|
@@ -12353,13 +12174,13 @@ function registerSplitioCommands(program2) {
|
|
|
12353
12174
|
fail(err, "splitio", "flags set-default", start);
|
|
12354
12175
|
}
|
|
12355
12176
|
});
|
|
12356
|
-
flags.command("toggle").description("Enable or disable a single flag via a Change Request").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--enabled <bool>", "true to restore / false to kill the flag").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12177
|
+
flags.command("toggle").description("Enable or disable a single flag via a Change Request").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--enabled <bool>", "true to restore / false to kill the flag").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12357
12178
|
const start = Date.now();
|
|
12358
12179
|
try {
|
|
12359
12180
|
const enable = opts.enabled.toLowerCase() !== "false" && opts.enabled !== "0";
|
|
12360
12181
|
const opType = enable ? "RESTORE_SPLIT" : "KILL_SPLIT";
|
|
12361
12182
|
await confirmWrite(opts, `${opType} ${opts.flag} in ${opts.environment}`);
|
|
12362
|
-
const http =
|
|
12183
|
+
const http = getHttp4(program2);
|
|
12363
12184
|
const body = {
|
|
12364
12185
|
...buildCrBase(opts),
|
|
12365
12186
|
operationType: opType,
|
|
@@ -12375,14 +12196,14 @@ function registerSplitioCommands(program2) {
|
|
|
12375
12196
|
fail(err, "splitio", "flags toggle", start);
|
|
12376
12197
|
}
|
|
12377
12198
|
});
|
|
12378
|
-
flags.command("batch-toggle").description("Enable or disable multiple flags from a JSON file (each creates its own Change Request)").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title prefix (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12199
|
+
flags.command("batch-toggle").description("Enable or disable multiple flags from a JSON file (each creates its own Change Request)").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title prefix (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve each CR").option("--input-file <path>", "JSON file: array of {flag, enabled} objects (use - for stdin)").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12379
12200
|
const start = Date.now();
|
|
12380
12201
|
try {
|
|
12381
12202
|
if (!opts.inputFile) throw new PncliError("--input-file is required for batch-toggle");
|
|
12382
12203
|
const entries = loadInputFile(opts.inputFile);
|
|
12383
12204
|
if (!Array.isArray(entries)) throw new PncliError("Input file must be a JSON array of {flag, enabled} objects");
|
|
12384
12205
|
await confirmWrite(opts, `BATCH_TOGGLE ${entries.length} flags in ${opts.environment}`);
|
|
12385
|
-
const http =
|
|
12206
|
+
const http = getHttp4(program2);
|
|
12386
12207
|
const results = [];
|
|
12387
12208
|
for (const entry of entries) {
|
|
12388
12209
|
try {
|
|
@@ -12412,11 +12233,11 @@ function registerSplitioCommands(program2) {
|
|
|
12412
12233
|
fail(err, "splitio", "flags batch-toggle", start);
|
|
12413
12234
|
}
|
|
12414
12235
|
});
|
|
12415
|
-
flags.command("kill").description("Submit a Change Request to kill (disable) a flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12236
|
+
flags.command("kill").description("Submit a Change Request to kill (disable) a flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12416
12237
|
const start = Date.now();
|
|
12417
12238
|
try {
|
|
12418
12239
|
await confirmWrite(opts, `KILL ${opts.flag} in ${opts.environment}`);
|
|
12419
|
-
const http =
|
|
12240
|
+
const http = getHttp4(program2);
|
|
12420
12241
|
const body = {
|
|
12421
12242
|
...buildCrBase(opts),
|
|
12422
12243
|
operationType: "KILL_SPLIT",
|
|
@@ -12432,11 +12253,11 @@ function registerSplitioCommands(program2) {
|
|
|
12432
12253
|
fail(err, "splitio", "flags kill", start);
|
|
12433
12254
|
}
|
|
12434
12255
|
});
|
|
12435
|
-
flags.command("restore").description("Submit a Change Request to restore a killed flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12256
|
+
flags.command("restore").description("Submit a Change Request to restore a killed flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--environment <id>", "Environment ID").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--approvers <ids>", "Comma-separated Split user IDs required to approve this CR").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12436
12257
|
const start = Date.now();
|
|
12437
12258
|
try {
|
|
12438
12259
|
await confirmWrite(opts, `RESTORE ${opts.flag} in ${opts.environment}`);
|
|
12439
|
-
const http =
|
|
12260
|
+
const http = getHttp4(program2);
|
|
12440
12261
|
const body = {
|
|
12441
12262
|
...buildCrBase(opts),
|
|
12442
12263
|
operationType: "RESTORE_SPLIT",
|
|
@@ -12452,11 +12273,11 @@ function registerSplitioCommands(program2) {
|
|
|
12452
12273
|
fail(err, "splitio", "flags restore", start);
|
|
12453
12274
|
}
|
|
12454
12275
|
});
|
|
12455
|
-
flags.command("archive").description("Submit a Change Request to archive (delete definition of) a flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "
|
|
12276
|
+
flags.command("archive").description("Submit a Change Request to archive (delete definition of) a flag").requiredOption("--workspace <id>", "Workspace ID").requiredOption("--flag <name>", "Feature flag name").requiredOption("--mnemonic <text>", "Short Change Request title (mnemonic)").requiredOption("--description <text>", "Change Request description").requiredOption("--change-number <CHG>", "Change request number (e.g. CHG0001234)").option("--yes", "Skip interactive confirmation prompt").action(async (opts) => {
|
|
12456
12277
|
const start = Date.now();
|
|
12457
12278
|
try {
|
|
12458
12279
|
await confirmWrite(opts, `ARCHIVE ${opts.flag}`);
|
|
12459
|
-
const http =
|
|
12280
|
+
const http = getHttp4(program2);
|
|
12460
12281
|
const body = {
|
|
12461
12282
|
...buildCrBase(opts),
|
|
12462
12283
|
operationType: "ARCHIVE_SPLIT",
|
|
@@ -12476,7 +12297,7 @@ function registerSplitioCommands(program2) {
|
|
|
12476
12297
|
changeRequests.command("list").description("List Change Requests for a workspace").requiredOption("--workspace <id>", "Workspace ID").option("--environment <id>", "Filter by environment ID").option("--status <status>", "Filter by status (REQUESTED, APPROVED, REJECTED, PUBLISHED)").option("--limit <n>", "Maximum number of results", "25").option("--offset <n>", "Pagination offset", "0").action(async (opts) => {
|
|
12477
12298
|
const start = Date.now();
|
|
12478
12299
|
try {
|
|
12479
|
-
const http =
|
|
12300
|
+
const http = getHttp4(program2);
|
|
12480
12301
|
const params = {
|
|
12481
12302
|
wsId: opts.workspace,
|
|
12482
12303
|
limit: parseInt(opts.limit, 10),
|
|
@@ -12501,7 +12322,7 @@ function registerSplitioCommands(program2) {
|
|
|
12501
12322
|
changeRequests.command("get").description("Get a Change Request by ID").requiredOption("--id <id>", "Change Request ID").action(async (opts) => {
|
|
12502
12323
|
const start = Date.now();
|
|
12503
12324
|
try {
|
|
12504
|
-
const http =
|
|
12325
|
+
const http = getHttp4(program2);
|
|
12505
12326
|
const data = await http.splitio(
|
|
12506
12327
|
`/internal/api/v2/changeRequests/${encodeURIComponent(opts.id)}`
|
|
12507
12328
|
);
|
|
@@ -12524,7 +12345,7 @@ Expected format: https://www.figma.com/design/<file-key>/...`);
|
|
|
12524
12345
|
}
|
|
12525
12346
|
return input3;
|
|
12526
12347
|
}
|
|
12527
|
-
function
|
|
12348
|
+
function getHttp5(program2) {
|
|
12528
12349
|
const opts = program2.optsWithGlobals();
|
|
12529
12350
|
return createHttpClient(
|
|
12530
12351
|
loadConfig({ configPath: opts.config }),
|
|
@@ -12540,10 +12361,9 @@ function registerFigmaCommands(program2) {
|
|
|
12540
12361
|
const fileKey = parseFileKey(fileKeyOrUrl);
|
|
12541
12362
|
const params = {};
|
|
12542
12363
|
if (!opts.document) {
|
|
12543
|
-
params["
|
|
12544
|
-
params["depth"] = 0;
|
|
12364
|
+
params["depth"] = 1;
|
|
12545
12365
|
}
|
|
12546
|
-
const data = await
|
|
12366
|
+
const data = await getHttp5(program2).figma(`/v1/files/${encodeURIComponent(fileKey)}`, { params });
|
|
12547
12367
|
success2(
|
|
12548
12368
|
{
|
|
12549
12369
|
fileKey,
|
|
@@ -12573,7 +12393,7 @@ function registerFigmaCommands(program2) {
|
|
|
12573
12393
|
const fileKey = parseFileKey(fileKeyOrUrl);
|
|
12574
12394
|
const params = {};
|
|
12575
12395
|
if (opts.asOf) params["as_of"] = opts.asOf;
|
|
12576
|
-
const data = await
|
|
12396
|
+
const data = await getHttp5(program2).figma(`/v1/files/${encodeURIComponent(fileKey)}/comments`, { params });
|
|
12577
12397
|
success2(
|
|
12578
12398
|
{ fileKey, count: data.comments.length, comments: data.comments },
|
|
12579
12399
|
"figma",
|
|
@@ -12589,7 +12409,7 @@ function registerFigmaCommands(program2) {
|
|
|
12589
12409
|
const { success: success2, fail: fail2 } = await import("./output-XT3WT5L5.js");
|
|
12590
12410
|
try {
|
|
12591
12411
|
const fileKey = parseFileKey(fileKeyOrUrl);
|
|
12592
|
-
const data = await
|
|
12412
|
+
const data = await getHttp5(program2).figma(`/v1/files/${encodeURIComponent(fileKey)}/versions`);
|
|
12593
12413
|
success2(
|
|
12594
12414
|
{ fileKey, count: data.versions.length, versions: data.versions },
|
|
12595
12415
|
"figma",
|
|
@@ -12604,7 +12424,7 @@ function registerFigmaCommands(program2) {
|
|
|
12604
12424
|
const start = Date.now();
|
|
12605
12425
|
const { success: success2, fail: fail2 } = await import("./output-XT3WT5L5.js");
|
|
12606
12426
|
try {
|
|
12607
|
-
const data = await
|
|
12427
|
+
const data = await getHttp5(program2).figma(`/v1/projects/${encodeURIComponent(projectId)}/files`);
|
|
12608
12428
|
success2(
|
|
12609
12429
|
{ projectId, count: data.files.length, files: data.files },
|
|
12610
12430
|
"figma",
|
|
@@ -12619,7 +12439,7 @@ function registerFigmaCommands(program2) {
|
|
|
12619
12439
|
const start = Date.now();
|
|
12620
12440
|
const { success: success2, fail: fail2 } = await import("./output-XT3WT5L5.js");
|
|
12621
12441
|
try {
|
|
12622
|
-
const data = await
|
|
12442
|
+
const data = await getHttp5(program2).figma("/v1/me");
|
|
12623
12443
|
success2(data, "figma", "me", start);
|
|
12624
12444
|
} catch (err) {
|
|
12625
12445
|
fail2(err, "figma", "me", start);
|
|
@@ -12663,7 +12483,6 @@ registerAdoCommands(program);
|
|
|
12663
12483
|
registerJenkinsCommands(program);
|
|
12664
12484
|
registerArtifactoryCommands(program);
|
|
12665
12485
|
registerCheckmarxCommands(program);
|
|
12666
|
-
registerServiceNowCommands(program);
|
|
12667
12486
|
registerContrastCommands(program);
|
|
12668
12487
|
registerSonatypeIqCommands(program);
|
|
12669
12488
|
registerSkillsCommands(program);
|
|
@@ -12687,7 +12506,6 @@ Services:
|
|
|
12687
12506
|
jenkins Jenkins (jobs, builds, logs, named instances)
|
|
12688
12507
|
artifactory Artifactory (repos, artifact search, build info, properties)
|
|
12689
12508
|
checkmarx Checkmarx One (projects, scans, scan statistics)
|
|
12690
|
-
servicenow ServiceNow (change requests)
|
|
12691
12509
|
contrast Contrast IAST (applications, vulnerability findings, libraries)
|
|
12692
12510
|
sonatypeiq Sonatype IQ Server (applications, organizations, policies)
|
|
12693
12511
|
openshift OpenShift / Kubernetes (pods, events, logs, metrics)
|