@oxagen/cli 5.5.1-274 → 5.5.1-278
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/oxagen.mjs +166 -34
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -8546,14 +8546,144 @@ function splitCommandList(command2) {
|
|
|
8546
8546
|
return pieces;
|
|
8547
8547
|
}
|
|
8548
8548
|
function commitsIn(command2) {
|
|
8549
|
-
return
|
|
8550
|
-
(
|
|
8549
|
+
return simpleCommandsOf(command2).some(
|
|
8550
|
+
(stage) => classifySimpleEffect(stage) === "git_commit"
|
|
8551
8551
|
);
|
|
8552
8552
|
}
|
|
8553
|
+
function simpleCommandsOf(command2) {
|
|
8554
|
+
return splitCommandList(command2).flatMap(splitPipeline);
|
|
8555
|
+
}
|
|
8556
|
+
function splitPipeline(piece) {
|
|
8557
|
+
const stages = [];
|
|
8558
|
+
let current = "";
|
|
8559
|
+
let quote;
|
|
8560
|
+
let depth = 0;
|
|
8561
|
+
for (let i2 = 0; i2 < piece.length; i2 += 1) {
|
|
8562
|
+
const char = piece[i2];
|
|
8563
|
+
const next = piece[i2 + 1];
|
|
8564
|
+
if (quote !== void 0) {
|
|
8565
|
+
if (char === quote) quote = void 0;
|
|
8566
|
+
current += char;
|
|
8567
|
+
continue;
|
|
8568
|
+
}
|
|
8569
|
+
if (char === '"' || char === "'") {
|
|
8570
|
+
quote = char;
|
|
8571
|
+
current += char;
|
|
8572
|
+
continue;
|
|
8573
|
+
}
|
|
8574
|
+
if (char === "\\" && next !== void 0) {
|
|
8575
|
+
current += char + next;
|
|
8576
|
+
i2 += 1;
|
|
8577
|
+
continue;
|
|
8578
|
+
}
|
|
8579
|
+
if (char === "(") depth += 1;
|
|
8580
|
+
if (char === ")" && depth > 0) depth -= 1;
|
|
8581
|
+
if (char === "|" && depth === 0 && !current.endsWith(">")) {
|
|
8582
|
+
stages.push(current);
|
|
8583
|
+
current = "";
|
|
8584
|
+
if (next === "&") i2 += 1;
|
|
8585
|
+
continue;
|
|
8586
|
+
}
|
|
8587
|
+
current += char;
|
|
8588
|
+
}
|
|
8589
|
+
stages.push(current);
|
|
8590
|
+
return stages;
|
|
8591
|
+
}
|
|
8592
|
+
function withoutRedirections(command2) {
|
|
8593
|
+
let out = "";
|
|
8594
|
+
let quote;
|
|
8595
|
+
let i2 = 0;
|
|
8596
|
+
while (i2 < command2.length) {
|
|
8597
|
+
const char = command2[i2];
|
|
8598
|
+
if (quote !== void 0) {
|
|
8599
|
+
if (char === quote) quote = void 0;
|
|
8600
|
+
out += char;
|
|
8601
|
+
i2 += 1;
|
|
8602
|
+
continue;
|
|
8603
|
+
}
|
|
8604
|
+
if (char === '"' || char === "'") {
|
|
8605
|
+
quote = char;
|
|
8606
|
+
out += char;
|
|
8607
|
+
i2 += 1;
|
|
8608
|
+
continue;
|
|
8609
|
+
}
|
|
8610
|
+
if (char === "\\" && i2 + 1 < command2.length) {
|
|
8611
|
+
out += char + command2[i2 + 1];
|
|
8612
|
+
i2 += 2;
|
|
8613
|
+
continue;
|
|
8614
|
+
}
|
|
8615
|
+
if (i2 === 0 || /\s/.test(command2[i2 - 1])) {
|
|
8616
|
+
const rest = command2.slice(i2);
|
|
8617
|
+
const fd2 = /^\d*/.exec(rest)?.[0] ?? "";
|
|
8618
|
+
const after = rest.slice(fd2.length);
|
|
8619
|
+
const op = after.startsWith("<<") ? void 0 : REDIRECTION.exec(after)?.[0];
|
|
8620
|
+
if (op !== void 0 && !(fd2 !== "" && op.startsWith("&"))) {
|
|
8621
|
+
i2 += fd2.length + op.length;
|
|
8622
|
+
while (i2 < command2.length && /[ \t]/.test(command2[i2])) i2 += 1;
|
|
8623
|
+
const start = i2;
|
|
8624
|
+
let inner;
|
|
8625
|
+
for (; i2 < command2.length; i2 += 1) {
|
|
8626
|
+
const c = command2[i2];
|
|
8627
|
+
if (inner !== void 0) {
|
|
8628
|
+
if (c === inner) inner = void 0;
|
|
8629
|
+
continue;
|
|
8630
|
+
}
|
|
8631
|
+
if (c === '"' || c === "'") {
|
|
8632
|
+
inner = c;
|
|
8633
|
+
continue;
|
|
8634
|
+
}
|
|
8635
|
+
if (c === "\\") {
|
|
8636
|
+
i2 += 1;
|
|
8637
|
+
continue;
|
|
8638
|
+
}
|
|
8639
|
+
if (c === "$" && command2[i2 + 1] === "(") return void 0;
|
|
8640
|
+
if (TARGET_END.test(c)) break;
|
|
8641
|
+
}
|
|
8642
|
+
if (inner !== void 0 || i2 === start) return void 0;
|
|
8643
|
+
out += " ";
|
|
8644
|
+
continue;
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
out += char;
|
|
8648
|
+
i2 += 1;
|
|
8649
|
+
}
|
|
8650
|
+
return out;
|
|
8651
|
+
}
|
|
8652
|
+
function commandWords(command2) {
|
|
8653
|
+
const bare = withoutRedirections(command2);
|
|
8654
|
+
return bare === void 0 ? void 0 : tokenizeSimpleCommand(bare);
|
|
8655
|
+
}
|
|
8656
|
+
function programWords(words3) {
|
|
8657
|
+
let i2 = 0;
|
|
8658
|
+
for (; ; ) {
|
|
8659
|
+
while (i2 < words3.length && ASSIGNMENT.test(words3[i2])) i2 += 1;
|
|
8660
|
+
const program2 = words3[i2]?.split("/").at(-1);
|
|
8661
|
+
if (program2 === "env") {
|
|
8662
|
+
i2 += 1;
|
|
8663
|
+
while (i2 < words3.length && words3[i2].startsWith("-")) {
|
|
8664
|
+
const word2 = words3[i2];
|
|
8665
|
+
const base2 = word2.split("=", 1)[0];
|
|
8666
|
+
if (ENV_FLAGS.has(word2)) i2 += 1;
|
|
8667
|
+
else if (word2.startsWith("--") && ENV_OPTIONS_WITH_VALUE.has(base2))
|
|
8668
|
+
i2 += word2.includes("=") ? 1 : 2;
|
|
8669
|
+
else if (ENV_OPTIONS_WITH_VALUE.has(word2)) i2 += 2;
|
|
8670
|
+
else if (/^-[uC]./.test(word2)) i2 += 1;
|
|
8671
|
+
else return void 0;
|
|
8672
|
+
}
|
|
8673
|
+
continue;
|
|
8674
|
+
}
|
|
8675
|
+
if (program2 === "command") {
|
|
8676
|
+
if (words3[i2 + 1]?.startsWith("-")) return void 0;
|
|
8677
|
+
i2 += 1;
|
|
8678
|
+
continue;
|
|
8679
|
+
}
|
|
8680
|
+
return words3.slice(i2);
|
|
8681
|
+
}
|
|
8682
|
+
}
|
|
8553
8683
|
function classifyShellEffect(command2) {
|
|
8554
8684
|
let found;
|
|
8555
|
-
for (const
|
|
8556
|
-
const effect = classifySimpleEffect(
|
|
8685
|
+
for (const stage of simpleCommandsOf(command2)) {
|
|
8686
|
+
const effect = classifySimpleEffect(stage);
|
|
8557
8687
|
if (effect !== void 0 && (found === void 0 || EFFECT_REACH.indexOf(effect) < EFFECT_REACH.indexOf(found))) {
|
|
8558
8688
|
found = effect;
|
|
8559
8689
|
}
|
|
@@ -8570,15 +8700,14 @@ function isGh(program2) {
|
|
|
8570
8700
|
return program2?.split("/").at(-1) === "gh";
|
|
8571
8701
|
}
|
|
8572
8702
|
function classifySimpleEffect(command2) {
|
|
8573
|
-
const words3 =
|
|
8703
|
+
const words3 = commandWords(command2);
|
|
8574
8704
|
if (words3 === void 0) {
|
|
8575
8705
|
return void 0;
|
|
8576
8706
|
}
|
|
8577
|
-
const
|
|
8578
|
-
if (
|
|
8707
|
+
const tokens = programWords(words3);
|
|
8708
|
+
if (tokens === void 0 || tokens.length === 0) {
|
|
8579
8709
|
return void 0;
|
|
8580
8710
|
}
|
|
8581
|
-
const tokens = words3.slice(start);
|
|
8582
8711
|
const program2 = tokens[0];
|
|
8583
8712
|
if (isGh(program2)) {
|
|
8584
8713
|
const at2 = ghSubcommandIndex(tokens);
|
|
@@ -8747,16 +8876,18 @@ function shellLineOf(input2) {
|
|
|
8747
8876
|
return command2.join(" ");
|
|
8748
8877
|
}
|
|
8749
8878
|
function pullRequestAttrs(response) {
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8879
|
+
const text6 = responseUrl(response, {
|
|
8880
|
+
fields: ["html_url", "url"],
|
|
8881
|
+
pattern: PULL_REQUEST_URL,
|
|
8882
|
+
plainText: true
|
|
8883
|
+
});
|
|
8884
|
+
const match = text6 === void 0 ? null : PULL_REQUEST_URL.exec(text6);
|
|
8885
|
+
if (match === null) return {};
|
|
8886
|
+
return {
|
|
8887
|
+
"pr.url": match[0],
|
|
8888
|
+
"pr.number": match[3],
|
|
8889
|
+
"pr.repository": `${match[1]}/${match[2]}`
|
|
8890
|
+
};
|
|
8760
8891
|
}
|
|
8761
8892
|
function issueAttrs(toolName4, input2, response) {
|
|
8762
8893
|
const fields = typeof input2 === "object" && input2 !== null ? input2 : {};
|
|
@@ -8839,14 +8970,12 @@ function issueUrlIn(response) {
|
|
|
8839
8970
|
};
|
|
8840
8971
|
}
|
|
8841
8972
|
function createsIssue(command2) {
|
|
8842
|
-
for (const
|
|
8843
|
-
const
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
while (i2 < tokens.length && ASSIGNMENT.test(tokens[i2] ?? "")) i2 += 1;
|
|
8847
|
-
if (!isGh(tokens[i2])) continue;
|
|
8973
|
+
for (const stage of simpleCommandsOf(command2)) {
|
|
8974
|
+
const read2 = commandWords(stage);
|
|
8975
|
+
const tokens = read2 === void 0 ? void 0 : programWords(read2);
|
|
8976
|
+
if (tokens === void 0 || !isGh(tokens[0])) continue;
|
|
8848
8977
|
const words3 = [];
|
|
8849
|
-
for (let j =
|
|
8978
|
+
for (let j = 1; j < tokens.length && words3.length < 2; j += 1) {
|
|
8850
8979
|
const token = tokens[j];
|
|
8851
8980
|
if (token === "-R" || token === "--repo") j += 1;
|
|
8852
8981
|
else if (!token.startsWith("-")) words3.push(token);
|
|
@@ -8871,7 +9000,7 @@ function mcpIssueAction(tool, input2) {
|
|
|
8871
9000
|
if (ends("update_issue") || ends("issue_update")) return bystate("edited");
|
|
8872
9001
|
return void 0;
|
|
8873
9002
|
}
|
|
8874
|
-
var TARGET_MAX, READ_TOOLS, SINGLE_FILE_READS, SKILL_FILE, WRITE_TOOLS, EDIT_TOOLS, NETWORK_TOOLS, READ_VERBS, WRITE_VERBS, READ_ONLY_BUILTINS, COMMAND_SEPARATORS, GIT_GLOBAL_OPTIONS_WITH_VALUE, GIT_GLOBAL_FLAGS, EFFECT_REACH, ASSIGNMENT, FILE_PRINTERS, SED_IN_PLACE, STDOUT_REDIRECT, SKILL_FILE_IN_LINE, ARGV_SHELLS, PULL_REQUEST_URL, ISSUE_URL, WHOLE_ISSUE_URL, REPO_SEGMENT;
|
|
9003
|
+
var TARGET_MAX, READ_TOOLS, SINGLE_FILE_READS, SKILL_FILE, WRITE_TOOLS, EDIT_TOOLS, NETWORK_TOOLS, READ_VERBS, WRITE_VERBS, READ_ONLY_BUILTINS, COMMAND_SEPARATORS, GIT_GLOBAL_OPTIONS_WITH_VALUE, GIT_GLOBAL_FLAGS, REDIRECTION, TARGET_END, ENV_OPTIONS_WITH_VALUE, ENV_FLAGS, EFFECT_REACH, ASSIGNMENT, FILE_PRINTERS, SED_IN_PLACE, STDOUT_REDIRECT, SKILL_FILE_IN_LINE, ARGV_SHELLS, PULL_REQUEST_URL, ISSUE_URL, WHOLE_ISSUE_URL, REPO_SEGMENT;
|
|
8875
9004
|
var init_tools = __esm({
|
|
8876
9005
|
"../../packages/tacho/src/claude-code/tools.ts"() {
|
|
8877
9006
|
"use strict";
|
|
@@ -8967,6 +9096,10 @@ var init_tools = __esm({
|
|
|
8967
9096
|
"--no-optional-locks",
|
|
8968
9097
|
"--no-lazy-fetch"
|
|
8969
9098
|
]);
|
|
9099
|
+
REDIRECTION = /^(?:&>>|&>|>>|>\||>&|>|<&|<>|<)/;
|
|
9100
|
+
TARGET_END = /[\s;&|()<>`]/;
|
|
9101
|
+
ENV_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set(["-u", "--unset", "-C", "--chdir"]);
|
|
9102
|
+
ENV_FLAGS = /* @__PURE__ */ new Set(["-", "-i", "--ignore-environment", "-v", "--debug"]);
|
|
8970
9103
|
EFFECT_REACH = [
|
|
8971
9104
|
"pr_open",
|
|
8972
9105
|
"git_push",
|
|
@@ -9002,15 +9135,14 @@ function ghCommands(command2) {
|
|
|
9002
9135
|
const commands = [];
|
|
9003
9136
|
const pieces = splitCommandList(command2);
|
|
9004
9137
|
pieces.forEach((piece, index) => {
|
|
9005
|
-
const
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
i2 += 1;
|
|
9009
|
-
if (isGh(words3[i2]))
|
|
9138
|
+
for (const stage of splitPipeline(piece)) {
|
|
9139
|
+
const words3 = programWords(leadingWords(stage));
|
|
9140
|
+
if (words3 === void 0 || !isGh(words3[0])) continue;
|
|
9010
9141
|
commands.push({
|
|
9011
|
-
words: words3
|
|
9142
|
+
words: words3,
|
|
9012
9143
|
text: index === pieces.length - 1 ? commandText(command2, piece) : piece
|
|
9013
9144
|
});
|
|
9145
|
+
}
|
|
9014
9146
|
});
|
|
9015
9147
|
return commands;
|
|
9016
9148
|
}
|
|
@@ -34415,7 +34547,7 @@ import { readFileSync as readFileSync13 } from "node:fs";
|
|
|
34415
34547
|
import { dirname as dirname14, resolve as resolve3 } from "node:path";
|
|
34416
34548
|
import { fileURLToPath } from "node:url";
|
|
34417
34549
|
function readVersion() {
|
|
34418
|
-
if (true) return "5.5.1-
|
|
34550
|
+
if (true) return "5.5.1-278";
|
|
34419
34551
|
try {
|
|
34420
34552
|
const here = dirname14(fileURLToPath(import.meta.url));
|
|
34421
34553
|
const pkg = JSON.parse(
|
|
@@ -82130,7 +82262,7 @@ var init_package = __esm({
|
|
|
82130
82262
|
"package.json"() {
|
|
82131
82263
|
package_default = {
|
|
82132
82264
|
name: "@oxagen/cli",
|
|
82133
|
-
version: "5.5.1-
|
|
82265
|
+
version: "5.5.1-278",
|
|
82134
82266
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
82135
82267
|
type: "module",
|
|
82136
82268
|
main: "./dist/index.js",
|
package/package.json
CHANGED