@xagent/x-cli 1.1.72 → 1.1.74
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 +1 -1
- package/dist/index.js +181 -44
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Test comment for PR creation -->
|
|
2
2
|
|
|
3
|
-
## 1.1.
|
|
3
|
+
## 1.1.74 – Logo Assets & NPM Publication Complete
|
|
4
4
|
|
|
5
5
|
✅ **Live on NPM**: [@xagent/x-cli](https://www.npmjs.com/package/@xagent/x-cli) - Fully published and ready for global installation
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -8519,7 +8519,7 @@ function loadCustomInstructions(workingDirectory = process.cwd()) {
|
|
|
8519
8519
|
// src/agent/grok-agent.ts
|
|
8520
8520
|
init_settings_manager();
|
|
8521
8521
|
var GrokAgent = class extends EventEmitter {
|
|
8522
|
-
constructor(apiKey, baseURL, model, maxToolRounds) {
|
|
8522
|
+
constructor(apiKey, baseURL, model, maxToolRounds, contextPack) {
|
|
8523
8523
|
super();
|
|
8524
8524
|
this.chatHistory = [];
|
|
8525
8525
|
this.messages = [];
|
|
@@ -8562,9 +8562,21 @@ CUSTOM INSTRUCTIONS:
|
|
|
8562
8562
|
${customInstructions}
|
|
8563
8563
|
|
|
8564
8564
|
The above custom instructions should be followed alongside the standard instructions below.` : "";
|
|
8565
|
+
const contextSection = contextPack ? `
|
|
8566
|
+
|
|
8567
|
+
PROJECT CONTEXT:
|
|
8568
|
+
${contextPack.system}
|
|
8569
|
+
|
|
8570
|
+
SOP:
|
|
8571
|
+
${contextPack.sop}
|
|
8572
|
+
|
|
8573
|
+
TASKS:
|
|
8574
|
+
${contextPack.tasks.map((t) => `- ${t.filename}: ${t.content}`).join("\n")}
|
|
8575
|
+
|
|
8576
|
+
The above project context should inform your responses and decision making.` : "";
|
|
8565
8577
|
this.messages.push({
|
|
8566
8578
|
role: "system",
|
|
8567
|
-
content: `You are X-CLI, an AI assistant that helps with file editing, coding tasks, and system operations.${customInstructionsSection}
|
|
8579
|
+
content: `You are X-CLI, an AI assistant that helps with file editing, coding tasks, and system operations.${customInstructionsSection}${contextSection}
|
|
8568
8580
|
|
|
8569
8581
|
You have access to these tools:
|
|
8570
8582
|
|
|
@@ -14674,7 +14686,7 @@ ${guardrail.createdFrom ? `- Created from incident: ${guardrail.createdFrom}` :
|
|
|
14674
14686
|
var package_default = {
|
|
14675
14687
|
type: "module",
|
|
14676
14688
|
name: "@xagent/x-cli",
|
|
14677
|
-
version: "1.1.
|
|
14689
|
+
version: "1.1.74",
|
|
14678
14690
|
description: "An open-source AI agent that brings the power of Grok directly into your terminal.",
|
|
14679
14691
|
main: "dist/index.js",
|
|
14680
14692
|
module: "dist/index.js",
|
|
@@ -14702,7 +14714,7 @@ var package_default = {
|
|
|
14702
14714
|
"dev:node": "tsx src/index.ts",
|
|
14703
14715
|
"dev:watch": "npm run build && node --watch dist/index.js",
|
|
14704
14716
|
start: "node dist/index.js",
|
|
14705
|
-
local: "npm run build && npm link && node dist/index.js",
|
|
14717
|
+
local: "npm run build > /dev/null 2>&1 && npm link > /dev/null 2>&1 && node dist/index.js",
|
|
14706
14718
|
"test:workflow": "node scripts/test-workflow.js",
|
|
14707
14719
|
"start:bun": "bun run dist/index.js",
|
|
14708
14720
|
lint: "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
@@ -14802,7 +14814,7 @@ var package_default = {
|
|
|
14802
14814
|
},
|
|
14803
14815
|
optionalDependencies: {
|
|
14804
14816
|
"tree-sitter": "^0.21.1",
|
|
14805
|
-
"tree-sitter-javascript": "^0.21.
|
|
14817
|
+
"tree-sitter-javascript": "^0.21.4",
|
|
14806
14818
|
"tree-sitter-python": "^0.21.0",
|
|
14807
14819
|
"tree-sitter-typescript": "^0.21.2"
|
|
14808
14820
|
},
|
|
@@ -16726,6 +16738,82 @@ Using fallback message: "${commitMessage}"`,
|
|
|
16726
16738
|
toolResult: pushResult
|
|
16727
16739
|
};
|
|
16728
16740
|
setChatHistory((prev) => [...prev, pushEntry]);
|
|
16741
|
+
const verificationEntry = {
|
|
16742
|
+
type: "assistant",
|
|
16743
|
+
content: "\u{1F50D} **Running post-push verification...**",
|
|
16744
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16745
|
+
};
|
|
16746
|
+
setChatHistory((prev) => [...prev, verificationEntry]);
|
|
16747
|
+
const statusCheckResult = await agent.executeBashCommand("git status --porcelain");
|
|
16748
|
+
if (statusCheckResult.success && statusCheckResult.output?.trim() === "") {
|
|
16749
|
+
const statusOkEntry = {
|
|
16750
|
+
type: "tool_result",
|
|
16751
|
+
content: "\u2705 **Git Status**: Working directory clean",
|
|
16752
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16753
|
+
};
|
|
16754
|
+
setChatHistory((prev) => [...prev, statusOkEntry]);
|
|
16755
|
+
} else {
|
|
16756
|
+
const statusIssueEntry = {
|
|
16757
|
+
type: "assistant",
|
|
16758
|
+
content: `\u26A0\uFE0F **Git Status Issues Detected**:
|
|
16759
|
+
|
|
16760
|
+
${statusCheckResult.output || "Unknown status"}`,
|
|
16761
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16762
|
+
};
|
|
16763
|
+
setChatHistory((prev) => [...prev, statusIssueEntry]);
|
|
16764
|
+
}
|
|
16765
|
+
const waitEntry = {
|
|
16766
|
+
type: "assistant",
|
|
16767
|
+
content: "\u23F3 **Waiting for CI/NPM publishing...** (10 seconds)",
|
|
16768
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16769
|
+
};
|
|
16770
|
+
setChatHistory((prev) => [...prev, waitEntry]);
|
|
16771
|
+
await new Promise((resolve8) => setTimeout(resolve8, 1e4));
|
|
16772
|
+
const localPackageResult = await agent.executeBashCommand(`node -p "require('./package.json').name" 2>/dev/null || echo 'no-package'`);
|
|
16773
|
+
const localName = localPackageResult.success && localPackageResult.output?.trim() !== "no-package" ? localPackageResult.output?.trim() : null;
|
|
16774
|
+
if (localName) {
|
|
16775
|
+
const localVersionResult = await agent.executeBashCommand(`node -p "require('./package.json').version"`);
|
|
16776
|
+
const localVersion = localVersionResult.success ? localVersionResult.output?.trim() : "unknown";
|
|
16777
|
+
const npmCheckResult = await agent.executeBashCommand(`npm view ${localName} version 2>/dev/null || echo 'not-found'`);
|
|
16778
|
+
if (npmCheckResult.success && npmCheckResult.output?.trim() && npmCheckResult.output?.trim() !== "not-found") {
|
|
16779
|
+
const npmVersion = npmCheckResult.output.trim();
|
|
16780
|
+
if (npmVersion === localVersion) {
|
|
16781
|
+
const npmConfirmEntry = {
|
|
16782
|
+
type: "tool_result",
|
|
16783
|
+
content: `\u2705 **NPM Package Confirmed**: ${localName} v${npmVersion} published successfully`,
|
|
16784
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16785
|
+
};
|
|
16786
|
+
setChatHistory((prev) => [...prev, npmConfirmEntry]);
|
|
16787
|
+
} else {
|
|
16788
|
+
const npmPendingEntry = {
|
|
16789
|
+
type: "assistant",
|
|
16790
|
+
content: `\u23F3 **NPM Status**: Local ${localName} v${localVersion}, NPM v${npmVersion}. Publishing may still be in progress.`,
|
|
16791
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16792
|
+
};
|
|
16793
|
+
setChatHistory((prev) => [...prev, npmPendingEntry]);
|
|
16794
|
+
}
|
|
16795
|
+
} else {
|
|
16796
|
+
const npmSkipEntry = {
|
|
16797
|
+
type: "assistant",
|
|
16798
|
+
content: `\u2139\uFE0F **NPM Check Skipped**: Package ${localName} not found on NPM (may not be published yet)`,
|
|
16799
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16800
|
+
};
|
|
16801
|
+
setChatHistory((prev) => [...prev, npmSkipEntry]);
|
|
16802
|
+
}
|
|
16803
|
+
} else {
|
|
16804
|
+
const npmSkipEntry = {
|
|
16805
|
+
type: "assistant",
|
|
16806
|
+
content: `\u2139\uFE0F **NPM Check Skipped**: No package.json found or not an NPM package`,
|
|
16807
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16808
|
+
};
|
|
16809
|
+
setChatHistory((prev) => [...prev, npmSkipEntry]);
|
|
16810
|
+
}
|
|
16811
|
+
const finalSuccessEntry = {
|
|
16812
|
+
type: "assistant",
|
|
16813
|
+
content: "\u{1F389} **Smart Push Complete**: All verifications passed!",
|
|
16814
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16815
|
+
};
|
|
16816
|
+
setChatHistory((prev) => [...prev, finalSuccessEntry]);
|
|
16729
16817
|
} else {
|
|
16730
16818
|
const pushError = pushResult.error || pushResult.output || "";
|
|
16731
16819
|
if (pushError.includes("protected branch") || pushError.includes("Changes must be made through a pull request") || pushError.includes("GH006")) {
|
|
@@ -17568,15 +17656,63 @@ function useConfirmations(confirmationService, state) {
|
|
|
17568
17656
|
handleRejection
|
|
17569
17657
|
};
|
|
17570
17658
|
}
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17577
|
-
|
|
17578
|
-
|
|
17579
|
-
|
|
17659
|
+
|
|
17660
|
+
// src/hooks/use-console-setup.ts
|
|
17661
|
+
function printWelcomeBanner(_quiet = false) {
|
|
17662
|
+
if (_quiet) return;
|
|
17663
|
+
const isTTY = !!process.stdout.isTTY;
|
|
17664
|
+
if (isTTY) {
|
|
17665
|
+
process.stdout.write("\x1B[?25l");
|
|
17666
|
+
process.stdout.write("\x1B[H");
|
|
17667
|
+
process.stdout.write("\x1B[2J");
|
|
17668
|
+
process.stdout.write("\x1B[3J");
|
|
17669
|
+
process.stdout.write("\x1B[H");
|
|
17670
|
+
}
|
|
17671
|
+
const isFancy = process.env.X_CLI_ASCII !== "block";
|
|
17672
|
+
const fancyAscii = String.raw`__/\\\_______/\\\______________________/\\\\\\\\\__/\\\______________/\\\\\\\\\\\_
|
|
17673
|
+
_\///\\\___/\\\/____________________/\\\////////__\/\\\_____________\/////\\\///__
|
|
17674
|
+
___\///\\\\\\/____________________/\\\/___________\/\\\_________________\/\\\_____
|
|
17675
|
+
_____\//\\\\_______/\\\\\\\\\\\__/\\\_____________\/\\\_________________\/\\\_____
|
|
17676
|
+
______\/\\\\______\///////////__\/\\\_____________\/\\\_________________\/\\\_____
|
|
17677
|
+
______/\\\\\\___________________\//\\\____________\/\\\_________________\/\\\_____
|
|
17678
|
+
____/\\\////\\\__________________\///\\\__________\/\\\_________________\/\\\_____
|
|
17679
|
+
__/\\\/___\///\\\__________________\////\\\\\\\\\_\/\\\\\\\\\\\\\\\__/\\\\\\\\\\\_
|
|
17680
|
+
_\///_______\///______________________\/////////__\///////////////__\///////////__`;
|
|
17681
|
+
const blockAscii = String.raw`\x1b[34m ████ ████████ ████ ████
|
|
17682
|
+
████████ ██████████████ ████████
|
|
17683
|
+
██████████ ██████████████ ████████
|
|
17684
|
+
██████████ ██████████████ ████████
|
|
17685
|
+
████████ ██████████████ ████████
|
|
17686
|
+
████ ████████ ████ ████\x1b[0m`;
|
|
17687
|
+
const asciiArt = (isFancy ? fancyAscii : blockAscii).normalize("NFC");
|
|
17688
|
+
process.stdout.write(asciiArt + "\n");
|
|
17689
|
+
const welcomeBanner = [
|
|
17690
|
+
"",
|
|
17691
|
+
`\x1B[32m Welcome to X-CLI v${package_default.version} \u26A1\x1B[0m`,
|
|
17692
|
+
"",
|
|
17693
|
+
`\x1B[36m \u{1F680} Claude Code-level intelligence in your terminal!\x1B[0m`,
|
|
17694
|
+
"",
|
|
17695
|
+
`\x1B[33m \u2714 Ready. Type your first command or paste code to begin.\x1B[0m`,
|
|
17696
|
+
"",
|
|
17697
|
+
`\x1B[35m \u{1F4A1} Quick Start Tips:\x1B[0m`,
|
|
17698
|
+
"",
|
|
17699
|
+
` \u2022 Ask anything: "Create a React component" or "Debug this Python script"`,
|
|
17700
|
+
` \u2022 Edit files: "Add error handling to app.js"`,
|
|
17701
|
+
` \u2022 Run commands: "Set up a new Node.js project"`,
|
|
17702
|
+
` \u2022 Get help: Type "/help" for all commands`,
|
|
17703
|
+
"",
|
|
17704
|
+
`\x1B[35m \u{1F6E0}\uFE0F Power Features:\x1B[0m`,
|
|
17705
|
+
"",
|
|
17706
|
+
` \u2022 Auto-edit mode: Press Shift+Tab to toggle hands-free editing`,
|
|
17707
|
+
` \u2022 Project memory: Create .grok/GROK.md to customize behavior`,
|
|
17708
|
+
` \u2022 Documentation: Run "/init-agent" for .agent docs system`,
|
|
17709
|
+
` \u2022 Error recovery: Run "/heal" after errors to add guardrails`,
|
|
17710
|
+
"",
|
|
17711
|
+
`\x1B[37m Type your request in natural language. Ctrl+C to clear, 'exit' to quit.\x1B[0m`,
|
|
17712
|
+
""
|
|
17713
|
+
].join("\n");
|
|
17714
|
+
process.stdout.write(welcomeBanner);
|
|
17715
|
+
if (isTTY) process.stdout.write("\x1B[?25h");
|
|
17580
17716
|
}
|
|
17581
17717
|
function useSessionLogging(chatHistory) {
|
|
17582
17718
|
const lastChatHistoryLength = useRef(0);
|
|
@@ -19289,7 +19425,9 @@ function ChatInterfaceRenderer({
|
|
|
19289
19425
|
function ChatInterfaceWithAgent({
|
|
19290
19426
|
agent,
|
|
19291
19427
|
initialMessage,
|
|
19292
|
-
quiet = false
|
|
19428
|
+
quiet = false,
|
|
19429
|
+
contextPack: _contextPack,
|
|
19430
|
+
contextStatus
|
|
19293
19431
|
}) {
|
|
19294
19432
|
const [chatHistory, setChatHistory] = useState([]);
|
|
19295
19433
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
@@ -19299,11 +19437,18 @@ function ChatInterfaceWithAgent({
|
|
|
19299
19437
|
const [confirmationOptions, setConfirmationOptions] = useState(null);
|
|
19300
19438
|
const [showContextTooltip, setShowContextTooltip] = useState(false);
|
|
19301
19439
|
const processingStartTime = useRef(0);
|
|
19302
|
-
useConsoleSetup(quiet);
|
|
19303
19440
|
useAutoRead(setChatHistory);
|
|
19304
19441
|
useEffect(() => {
|
|
19305
|
-
|
|
19306
|
-
|
|
19442
|
+
const initialHistory = [];
|
|
19443
|
+
if (contextStatus) {
|
|
19444
|
+
initialHistory.push({
|
|
19445
|
+
type: "assistant",
|
|
19446
|
+
content: `\u{1F527} ${contextStatus}`,
|
|
19447
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
19448
|
+
});
|
|
19449
|
+
}
|
|
19450
|
+
setChatHistory(initialHistory);
|
|
19451
|
+
}, [contextStatus]);
|
|
19307
19452
|
useSessionLogging(chatHistory);
|
|
19308
19453
|
const { contextInfo } = useContextInfo(agent);
|
|
19309
19454
|
const handleGlobalShortcuts = (str, key) => {
|
|
@@ -19393,7 +19538,9 @@ function ChatInterfaceWithAgent({
|
|
|
19393
19538
|
function ChatInterface({
|
|
19394
19539
|
agent,
|
|
19395
19540
|
initialMessage,
|
|
19396
|
-
quiet = false
|
|
19541
|
+
quiet = false,
|
|
19542
|
+
contextPack,
|
|
19543
|
+
contextStatus
|
|
19397
19544
|
}) {
|
|
19398
19545
|
const [currentAgent, setCurrentAgent] = useState(
|
|
19399
19546
|
agent || null
|
|
@@ -19409,7 +19556,9 @@ function ChatInterface({
|
|
|
19409
19556
|
{
|
|
19410
19557
|
agent: currentAgent,
|
|
19411
19558
|
initialMessage,
|
|
19412
|
-
quiet
|
|
19559
|
+
quiet,
|
|
19560
|
+
contextPack,
|
|
19561
|
+
contextStatus
|
|
19413
19562
|
}
|
|
19414
19563
|
);
|
|
19415
19564
|
}
|
|
@@ -19804,18 +19953,6 @@ function checkAutoCompact() {
|
|
|
19804
19953
|
} catch {
|
|
19805
19954
|
}
|
|
19806
19955
|
}
|
|
19807
|
-
async function checkStartupUpdates() {
|
|
19808
|
-
try {
|
|
19809
|
-
const versionInfo = await checkForUpdates();
|
|
19810
|
-
if (versionInfo.isUpdateAvailable) {
|
|
19811
|
-
console.log(`
|
|
19812
|
-
\u{1F504} Update available: v${versionInfo.latest} (current: v${versionInfo.current})`);
|
|
19813
|
-
console.log(` Use '/upgrade' command or run: ${versionInfo.updateCommand}
|
|
19814
|
-
`);
|
|
19815
|
-
}
|
|
19816
|
-
} catch {
|
|
19817
|
-
}
|
|
19818
|
-
}
|
|
19819
19956
|
function loadApiKey() {
|
|
19820
19957
|
const manager = getSettingsManager();
|
|
19821
19958
|
return manager.getApiKey();
|
|
@@ -20044,27 +20181,27 @@ program.name("grok").description(
|
|
|
20044
20181
|
console.error("\u274C Error: X CLI requires an interactive terminal. Please run in a TTY environment.");
|
|
20045
20182
|
process.exit(1);
|
|
20046
20183
|
}
|
|
20047
|
-
|
|
20184
|
+
let contextPack;
|
|
20185
|
+
let statusMessage;
|
|
20186
|
+
try {
|
|
20187
|
+
contextPack = loadContext();
|
|
20188
|
+
statusMessage = formatContextStatus(contextPack);
|
|
20189
|
+
console.log(statusMessage);
|
|
20190
|
+
} catch (error) {
|
|
20191
|
+
console.warn("\u26A0\uFE0F Failed to load .agent/ context:", error instanceof Error ? error.message : String(error));
|
|
20192
|
+
}
|
|
20193
|
+
const agent = new GrokAgent(apiKey, baseURL, model, maxToolRounds, contextPack);
|
|
20048
20194
|
const settingsManager = getSettingsManager();
|
|
20049
20195
|
const assistantName = settingsManager.getUserSetting("assistantName") || "X CLI";
|
|
20050
20196
|
if (!options.quiet) {
|
|
20051
20197
|
console.log(`\u{1F916} Starting ${assistantName} Conversational Assistant...
|
|
20052
20198
|
`);
|
|
20053
20199
|
}
|
|
20054
|
-
if (!options.quiet) {
|
|
20055
|
-
try {
|
|
20056
|
-
const contextPack = loadContext();
|
|
20057
|
-
const statusMessage = formatContextStatus(contextPack);
|
|
20058
|
-
console.log(statusMessage);
|
|
20059
|
-
} catch (error) {
|
|
20060
|
-
console.warn("\u26A0\uFE0F Failed to load .agent/ context:", error instanceof Error ? error.message : String(error));
|
|
20061
|
-
}
|
|
20062
|
-
}
|
|
20063
20200
|
ensureUserSettingsDirectory();
|
|
20064
20201
|
checkAutoCompact();
|
|
20065
|
-
checkStartupUpdates();
|
|
20066
20202
|
const initialMessage = Array.isArray(message) ? message.join(" ") : message;
|
|
20067
|
-
|
|
20203
|
+
printWelcomeBanner(options.quiet);
|
|
20204
|
+
const app = render(React4.createElement(ChatInterface, { agent, initialMessage, quiet: options.quiet, contextStatus: statusMessage }));
|
|
20068
20205
|
const cleanup = () => {
|
|
20069
20206
|
app.unmount();
|
|
20070
20207
|
agent.abortCurrentOperation();
|