@xagent/x-cli 1.1.73 → 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 +134 -62
- 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
|
},
|
|
@@ -16757,33 +16769,44 @@ ${statusCheckResult.output || "Unknown status"}`,
|
|
|
16757
16769
|
};
|
|
16758
16770
|
setChatHistory((prev) => [...prev, waitEntry]);
|
|
16759
16771
|
await new Promise((resolve8) => setTimeout(resolve8, 1e4));
|
|
16760
|
-
const
|
|
16761
|
-
const
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
const
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
|
|
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
|
+
}
|
|
16772
16795
|
} else {
|
|
16773
|
-
const
|
|
16796
|
+
const npmSkipEntry = {
|
|
16774
16797
|
type: "assistant",
|
|
16775
|
-
content: `\
|
|
16798
|
+
content: `\u2139\uFE0F **NPM Check Skipped**: Package ${localName} not found on NPM (may not be published yet)`,
|
|
16776
16799
|
timestamp: /* @__PURE__ */ new Date()
|
|
16777
16800
|
};
|
|
16778
|
-
setChatHistory((prev) => [...prev,
|
|
16801
|
+
setChatHistory((prev) => [...prev, npmSkipEntry]);
|
|
16779
16802
|
}
|
|
16780
16803
|
} else {
|
|
16781
|
-
const
|
|
16804
|
+
const npmSkipEntry = {
|
|
16782
16805
|
type: "assistant",
|
|
16783
|
-
content: `\
|
|
16806
|
+
content: `\u2139\uFE0F **NPM Check Skipped**: No package.json found or not an NPM package`,
|
|
16784
16807
|
timestamp: /* @__PURE__ */ new Date()
|
|
16785
16808
|
};
|
|
16786
|
-
setChatHistory((prev) => [...prev,
|
|
16809
|
+
setChatHistory((prev) => [...prev, npmSkipEntry]);
|
|
16787
16810
|
}
|
|
16788
16811
|
const finalSuccessEntry = {
|
|
16789
16812
|
type: "assistant",
|
|
@@ -17633,15 +17656,63 @@ function useConfirmations(confirmationService, state) {
|
|
|
17633
17656
|
handleRejection
|
|
17634
17657
|
};
|
|
17635
17658
|
}
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
|
|
17643
|
-
|
|
17644
|
-
|
|
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");
|
|
17645
17716
|
}
|
|
17646
17717
|
function useSessionLogging(chatHistory) {
|
|
17647
17718
|
const lastChatHistoryLength = useRef(0);
|
|
@@ -19354,7 +19425,9 @@ function ChatInterfaceRenderer({
|
|
|
19354
19425
|
function ChatInterfaceWithAgent({
|
|
19355
19426
|
agent,
|
|
19356
19427
|
initialMessage,
|
|
19357
|
-
quiet = false
|
|
19428
|
+
quiet = false,
|
|
19429
|
+
contextPack: _contextPack,
|
|
19430
|
+
contextStatus
|
|
19358
19431
|
}) {
|
|
19359
19432
|
const [chatHistory, setChatHistory] = useState([]);
|
|
19360
19433
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
@@ -19364,11 +19437,18 @@ function ChatInterfaceWithAgent({
|
|
|
19364
19437
|
const [confirmationOptions, setConfirmationOptions] = useState(null);
|
|
19365
19438
|
const [showContextTooltip, setShowContextTooltip] = useState(false);
|
|
19366
19439
|
const processingStartTime = useRef(0);
|
|
19367
|
-
useConsoleSetup(quiet);
|
|
19368
19440
|
useAutoRead(setChatHistory);
|
|
19369
19441
|
useEffect(() => {
|
|
19370
|
-
|
|
19371
|
-
|
|
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]);
|
|
19372
19452
|
useSessionLogging(chatHistory);
|
|
19373
19453
|
const { contextInfo } = useContextInfo(agent);
|
|
19374
19454
|
const handleGlobalShortcuts = (str, key) => {
|
|
@@ -19458,7 +19538,9 @@ function ChatInterfaceWithAgent({
|
|
|
19458
19538
|
function ChatInterface({
|
|
19459
19539
|
agent,
|
|
19460
19540
|
initialMessage,
|
|
19461
|
-
quiet = false
|
|
19541
|
+
quiet = false,
|
|
19542
|
+
contextPack,
|
|
19543
|
+
contextStatus
|
|
19462
19544
|
}) {
|
|
19463
19545
|
const [currentAgent, setCurrentAgent] = useState(
|
|
19464
19546
|
agent || null
|
|
@@ -19474,7 +19556,9 @@ function ChatInterface({
|
|
|
19474
19556
|
{
|
|
19475
19557
|
agent: currentAgent,
|
|
19476
19558
|
initialMessage,
|
|
19477
|
-
quiet
|
|
19559
|
+
quiet,
|
|
19560
|
+
contextPack,
|
|
19561
|
+
contextStatus
|
|
19478
19562
|
}
|
|
19479
19563
|
);
|
|
19480
19564
|
}
|
|
@@ -19869,18 +19953,6 @@ function checkAutoCompact() {
|
|
|
19869
19953
|
} catch {
|
|
19870
19954
|
}
|
|
19871
19955
|
}
|
|
19872
|
-
async function checkStartupUpdates() {
|
|
19873
|
-
try {
|
|
19874
|
-
const versionInfo = await checkForUpdates();
|
|
19875
|
-
if (versionInfo.isUpdateAvailable) {
|
|
19876
|
-
console.log(`
|
|
19877
|
-
\u{1F504} Update available: v${versionInfo.latest} (current: v${versionInfo.current})`);
|
|
19878
|
-
console.log(` Use '/upgrade' command or run: ${versionInfo.updateCommand}
|
|
19879
|
-
`);
|
|
19880
|
-
}
|
|
19881
|
-
} catch {
|
|
19882
|
-
}
|
|
19883
|
-
}
|
|
19884
19956
|
function loadApiKey() {
|
|
19885
19957
|
const manager = getSettingsManager();
|
|
19886
19958
|
return manager.getApiKey();
|
|
@@ -20109,27 +20181,27 @@ program.name("grok").description(
|
|
|
20109
20181
|
console.error("\u274C Error: X CLI requires an interactive terminal. Please run in a TTY environment.");
|
|
20110
20182
|
process.exit(1);
|
|
20111
20183
|
}
|
|
20112
|
-
|
|
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);
|
|
20113
20194
|
const settingsManager = getSettingsManager();
|
|
20114
20195
|
const assistantName = settingsManager.getUserSetting("assistantName") || "X CLI";
|
|
20115
20196
|
if (!options.quiet) {
|
|
20116
20197
|
console.log(`\u{1F916} Starting ${assistantName} Conversational Assistant...
|
|
20117
20198
|
`);
|
|
20118
20199
|
}
|
|
20119
|
-
if (!options.quiet) {
|
|
20120
|
-
try {
|
|
20121
|
-
const contextPack = loadContext();
|
|
20122
|
-
const statusMessage = formatContextStatus(contextPack);
|
|
20123
|
-
console.log(statusMessage);
|
|
20124
|
-
} catch (error) {
|
|
20125
|
-
console.warn("\u26A0\uFE0F Failed to load .agent/ context:", error instanceof Error ? error.message : String(error));
|
|
20126
|
-
}
|
|
20127
|
-
}
|
|
20128
20200
|
ensureUserSettingsDirectory();
|
|
20129
20201
|
checkAutoCompact();
|
|
20130
|
-
checkStartupUpdates();
|
|
20131
20202
|
const initialMessage = Array.isArray(message) ? message.join(" ") : message;
|
|
20132
|
-
|
|
20203
|
+
printWelcomeBanner(options.quiet);
|
|
20204
|
+
const app = render(React4.createElement(ChatInterface, { agent, initialMessage, quiet: options.quiet, contextStatus: statusMessage }));
|
|
20133
20205
|
const cleanup = () => {
|
|
20134
20206
|
app.unmount();
|
|
20135
20207
|
agent.abortCurrentOperation();
|