@kolatts/pncli 1.22.0 → 1.23.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/dist/{chunk-FXY262BR.js → chunk-KRDKHGYS.js} +11 -1
- package/dist/chunk-KRDKHGYS.js.map +1 -0
- package/dist/{chunk-PZWGOMIQ.js → chunk-XYHZMXJU.js} +33 -1
- package/dist/{chunk-PZWGOMIQ.js.map → chunk-XYHZMXJU.js.map} +1 -1
- package/dist/cli.js +129 -6
- package/dist/cli.js.map +1 -1
- package/dist/{config-CPRXY5SN.js → config-QN5FFAZY.js} +2 -2
- package/dist/{http-52YHD3ZL.js → http-MCIU2IV6.js} +2 -2
- package/package.json +1 -1
- package/skills/pncli/SKILL.md +2 -1
- package/skills/pncli/logscale.md +41 -0
- package/dist/chunk-FXY262BR.js.map +0 -1
- /package/dist/{config-CPRXY5SN.js.map → config-QN5FFAZY.js.map} +0 -0
- /package/dist/{http-52YHD3ZL.js.map → http-MCIU2IV6.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
setRepoConfigValue,
|
|
9
9
|
writeGlobalConfig,
|
|
10
10
|
writeRepoConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KRDKHGYS.js";
|
|
12
12
|
import {
|
|
13
13
|
ExitCode,
|
|
14
14
|
PncliError,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
success,
|
|
21
21
|
warn,
|
|
22
22
|
writeRawOutput
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XYHZMXJU.js";
|
|
24
24
|
import {
|
|
25
25
|
AdoCoreClient
|
|
26
26
|
} from "./chunk-VDL32PSG.js";
|
|
@@ -5804,6 +5804,16 @@ function registerConfigCommands(program2) {
|
|
|
5804
5804
|
} else {
|
|
5805
5805
|
results.dynatrace_platform = { ok: null, message: "not configured" };
|
|
5806
5806
|
}
|
|
5807
|
+
if (cfg.logscale.baseUrl && cfg.logscale.token) {
|
|
5808
|
+
try {
|
|
5809
|
+
await http.logscale("/api/v1/repositories");
|
|
5810
|
+
results.logscale = { ok: true, message: "connected" };
|
|
5811
|
+
} catch (err) {
|
|
5812
|
+
results.logscale = { ok: false, message: err instanceof Error ? err.message : String(err) };
|
|
5813
|
+
}
|
|
5814
|
+
} else {
|
|
5815
|
+
results.logscale = { ok: null, message: "not configured" };
|
|
5816
|
+
}
|
|
5807
5817
|
success(results, "config", "test", start);
|
|
5808
5818
|
} catch (err) {
|
|
5809
5819
|
fail(err, "config", "test", start);
|
|
@@ -6048,11 +6058,23 @@ function registerConfigCommands(program2) {
|
|
|
6048
6058
|
results.dynatrace_platform = categorize2(err);
|
|
6049
6059
|
}
|
|
6050
6060
|
}
|
|
6061
|
+
if (!cfg.logscale.token) {
|
|
6062
|
+
results.logscale = { status: "blank", message: "not configured" };
|
|
6063
|
+
} else if (!cfg.logscale.baseUrl) {
|
|
6064
|
+
results.logscale = { status: "error", message: "baseUrl not configured" };
|
|
6065
|
+
} else {
|
|
6066
|
+
try {
|
|
6067
|
+
await http.logscale("/api/v1/repositories", { timeoutMs: 1e4 });
|
|
6068
|
+
results.logscale = { status: "valid", message: "ok" };
|
|
6069
|
+
} catch (err) {
|
|
6070
|
+
results.logscale = categorize2(err);
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6051
6073
|
const statuses = Object.values(results).map((r) => r.status);
|
|
6052
6074
|
if (statuses.includes("invalid")) process.exitCode = ExitCode.AUTH_ERROR;
|
|
6053
6075
|
else if (statuses.includes("error")) process.exitCode = ExitCode.NETWORK_ERROR;
|
|
6054
6076
|
if (cmdOpts.output === "table") {
|
|
6055
|
-
const services = ["jira", "bitbucket", "github", "confluence", "sonar", "sde", "ado", "jenkins", "udeploy", "artifactory", "checkmarx", "servicenow", "contrast", "sonatypeiq", "openshift", "dynatrace", "dynatrace_platform"];
|
|
6077
|
+
const services = ["jira", "bitbucket", "github", "confluence", "sonar", "sde", "ado", "jenkins", "udeploy", "artifactory", "checkmarx", "servicenow", "contrast", "sonatypeiq", "openshift", "dynatrace", "dynatrace_platform", "logscale"];
|
|
6056
6078
|
const labelWidth = 14;
|
|
6057
6079
|
const statusWidth = 9;
|
|
6058
6080
|
for (const svc of services) {
|
|
@@ -6066,7 +6088,7 @@ function registerConfigCommands(program2) {
|
|
|
6066
6088
|
process.stdout.write("\n");
|
|
6067
6089
|
} else {
|
|
6068
6090
|
if (opts.pretty) {
|
|
6069
|
-
const services = ["jira", "bitbucket", "github", "confluence", "sonar", "sde", "ado", "jenkins", "udeploy", "artifactory", "checkmarx", "servicenow", "contrast", "sonatypeiq", "openshift", "dynatrace", "dynatrace_platform"];
|
|
6091
|
+
const services = ["jira", "bitbucket", "github", "confluence", "sonar", "sde", "ado", "jenkins", "udeploy", "artifactory", "checkmarx", "servicenow", "contrast", "sonatypeiq", "openshift", "dynatrace", "dynatrace_platform", "logscale"];
|
|
6070
6092
|
const labelWidth = 14;
|
|
6071
6093
|
const statusWidth = 9;
|
|
6072
6094
|
for (const svc of services) {
|
|
@@ -6689,6 +6711,40 @@ async function initGlobalConfig(start) {
|
|
|
6689
6711
|
}
|
|
6690
6712
|
}
|
|
6691
6713
|
}
|
|
6714
|
+
process.stderr.write("\n\u2500\u2500 LogScale \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\u2500\u2500\n");
|
|
6715
|
+
const useLogscale = await confirm({
|
|
6716
|
+
message: "Configure LogScale (Falcon LogScale / Humio) for log queries?",
|
|
6717
|
+
default: false
|
|
6718
|
+
});
|
|
6719
|
+
let logscaleBaseUrl = "";
|
|
6720
|
+
let logscaleToken = "";
|
|
6721
|
+
if (useLogscale) {
|
|
6722
|
+
logscaleBaseUrl = await input({
|
|
6723
|
+
message: "LogScale base URL (e.g. https://logscale.imagile.dev):",
|
|
6724
|
+
default: ""
|
|
6725
|
+
});
|
|
6726
|
+
logscaleToken = await password({
|
|
6727
|
+
message: "LogScale personal access token:"
|
|
6728
|
+
});
|
|
6729
|
+
if (logscaleBaseUrl && logscaleToken) {
|
|
6730
|
+
process.stderr.write("\n Verifying connection...\n");
|
|
6731
|
+
try {
|
|
6732
|
+
const tempConfig = {
|
|
6733
|
+
...loadConfig(),
|
|
6734
|
+
logscale: {
|
|
6735
|
+
baseUrl: normalizeBaseUrl(logscaleBaseUrl),
|
|
6736
|
+
token: logscaleToken
|
|
6737
|
+
}
|
|
6738
|
+
};
|
|
6739
|
+
const tempHttp = createHttpClient(tempConfig);
|
|
6740
|
+
await tempHttp.logscale("/api/v1/repositories");
|
|
6741
|
+
process.stderr.write(" Connected.\n");
|
|
6742
|
+
} catch (err) {
|
|
6743
|
+
warn(`Could not connect to LogScale: ${err instanceof Error ? err.message : String(err)}`);
|
|
6744
|
+
warn("Config will be saved anyway. Check your URL and token and re-run pncli config init or pncli config test.");
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6692
6748
|
process.stderr.write("\n\u2500\u2500 Defaults \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\u2500\u2500\n");
|
|
6693
6749
|
const jiraProject = await input({
|
|
6694
6750
|
message: "Default Jira project key (optional):",
|
|
@@ -6828,6 +6884,12 @@ async function initGlobalConfig(start) {
|
|
|
6828
6884
|
platformToken: dynatracePlatformToken || void 0
|
|
6829
6885
|
}
|
|
6830
6886
|
} : {},
|
|
6887
|
+
...useLogscale && logscaleBaseUrl ? {
|
|
6888
|
+
logscale: {
|
|
6889
|
+
baseUrl: normalizeBaseUrl(logscaleBaseUrl),
|
|
6890
|
+
token: logscaleToken || void 0
|
|
6891
|
+
}
|
|
6892
|
+
} : {},
|
|
6831
6893
|
defaults: {
|
|
6832
6894
|
jira: {
|
|
6833
6895
|
project: jiraProject || void 0
|
|
@@ -7917,11 +7979,11 @@ function registerAdoRepoCommands(ado) {
|
|
|
7917
7979
|
const start = Date.now();
|
|
7918
7980
|
try {
|
|
7919
7981
|
const globalOpts = ado.optsWithGlobals();
|
|
7920
|
-
const { loadConfig: lc } = await import("./config-
|
|
7982
|
+
const { loadConfig: lc } = await import("./config-QN5FFAZY.js");
|
|
7921
7983
|
const config = lc({ configPath: globalOpts.config });
|
|
7922
7984
|
const { collection, project, repo: repo2, gitClient } = getAdoContext(ado, true);
|
|
7923
7985
|
const { AdoCoreClient: AdoCoreClient2 } = await import("./core-SWYVXOQ4.js");
|
|
7924
|
-
const { createHttpClient: createHttpClient2 } = await import("./http-
|
|
7986
|
+
const { createHttpClient: createHttpClient2 } = await import("./http-MCIU2IV6.js");
|
|
7925
7987
|
const http = createHttpClient2(config, Boolean(globalOpts.dryRun));
|
|
7926
7988
|
const coreClient = new AdoCoreClient2(http);
|
|
7927
7989
|
const me = await coreClient.getConnectionData(collection);
|
|
@@ -10627,6 +10689,65 @@ function registerDynatraceCommands(program2) {
|
|
|
10627
10689
|
});
|
|
10628
10690
|
}
|
|
10629
10691
|
|
|
10692
|
+
// src/services/logscale/commands.ts
|
|
10693
|
+
function getHttp4(program2) {
|
|
10694
|
+
const opts = program2.optsWithGlobals();
|
|
10695
|
+
return createHttpClient(
|
|
10696
|
+
loadConfig({ configPath: opts.config }),
|
|
10697
|
+
Boolean(opts.dryRun)
|
|
10698
|
+
);
|
|
10699
|
+
}
|
|
10700
|
+
function registerLogscaleCommands(program2) {
|
|
10701
|
+
const logscale = program2.command("logscale").description("LogScale log query operations");
|
|
10702
|
+
const repositories = logscale.command("repositories").description("Repository operations");
|
|
10703
|
+
repositories.command("list").description("List available repositories").action(async () => {
|
|
10704
|
+
const start = Date.now();
|
|
10705
|
+
try {
|
|
10706
|
+
const data = await getHttp4(program2).logscale("/api/v1/repositories");
|
|
10707
|
+
success({ count: data.length, repositories: data }, "logscale", "repositories list", start);
|
|
10708
|
+
} catch (err) {
|
|
10709
|
+
fail(err, "logscale", "repositories list", start);
|
|
10710
|
+
}
|
|
10711
|
+
});
|
|
10712
|
+
logscale.command("query").description("Execute a LogScale Query Language (LQL) search against a repository").requiredOption("--repository <name>", "Repository name to query").requiredOption("--query <lql>", 'LogScale Query Language expression (e.g. "error" or "level=error | count()")').option("--start <time>", "Start time (ISO 8601 or relative such as 1h or 24h)", "1h").option("--end <time>", "End time (ISO 8601 or relative)", "now").option("--limit <n>", "Maximum number of events to return", "200").option("--timeout-ms <ms>", "Client-side HTTP timeout in milliseconds", "30000").action(async (opts) => {
|
|
10713
|
+
const ts = Date.now();
|
|
10714
|
+
try {
|
|
10715
|
+
const body = {
|
|
10716
|
+
queryString: opts.query,
|
|
10717
|
+
start: opts.start,
|
|
10718
|
+
end: opts.end,
|
|
10719
|
+
limit: parseInt(opts.limit, 10),
|
|
10720
|
+
showQueryEventDistribution: false,
|
|
10721
|
+
isLive: false
|
|
10722
|
+
};
|
|
10723
|
+
const data = await getHttp4(program2).logscale(
|
|
10724
|
+
`/api/v1/repositories/${encodeURIComponent(opts.repository)}/query`,
|
|
10725
|
+
{
|
|
10726
|
+
method: "POST",
|
|
10727
|
+
body,
|
|
10728
|
+
timeoutMs: parseInt(opts.timeoutMs, 10)
|
|
10729
|
+
}
|
|
10730
|
+
);
|
|
10731
|
+
success(
|
|
10732
|
+
{
|
|
10733
|
+
repository: opts.repository,
|
|
10734
|
+
done: data.done,
|
|
10735
|
+
cancelled: data.cancelled,
|
|
10736
|
+
eventCount: data.events.length,
|
|
10737
|
+
events: data.events,
|
|
10738
|
+
warnings: data.warnings ?? [],
|
|
10739
|
+
metaData: data.metaData
|
|
10740
|
+
},
|
|
10741
|
+
"logscale",
|
|
10742
|
+
"query",
|
|
10743
|
+
ts
|
|
10744
|
+
);
|
|
10745
|
+
} catch (err) {
|
|
10746
|
+
fail(err, "logscale", "query", ts);
|
|
10747
|
+
}
|
|
10748
|
+
});
|
|
10749
|
+
}
|
|
10750
|
+
|
|
10630
10751
|
// src/cli.ts
|
|
10631
10752
|
if (!process.env.PNCLI_VERIFY_TLS) {
|
|
10632
10753
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
@@ -10671,6 +10792,7 @@ registerSkillsCommands(program);
|
|
|
10671
10792
|
registerJwtCommands(program);
|
|
10672
10793
|
registerOpenShiftCommands(program);
|
|
10673
10794
|
registerDynatraceCommands(program);
|
|
10795
|
+
registerLogscaleCommands(program);
|
|
10674
10796
|
program.addHelpText("after", `
|
|
10675
10797
|
Services:
|
|
10676
10798
|
git Local git operations (status, diff, log, branch)
|
|
@@ -10691,6 +10813,7 @@ Services:
|
|
|
10691
10813
|
sonatypeiq Sonatype IQ Server (applications, organizations, policies)
|
|
10692
10814
|
openshift OpenShift / Kubernetes (pods, events, logs, metrics)
|
|
10693
10815
|
dynatrace Dynatrace (services, entities, problems, traces, Kubernetes workloads)
|
|
10816
|
+
logscale LogScale (log query, repositories)
|
|
10694
10817
|
config Manage pncli configuration
|
|
10695
10818
|
skills Download and manage Claude Code skills
|
|
10696
10819
|
jwt JWT token utilities (decode header and payload)
|