@xagent/x-cli 1.1.44 → 1.1.45

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 CHANGED
@@ -1,4 +1,4 @@
1
- ## 1.1.44 – Logo Assets & NPM Publication Complete
1
+ ## 1.1.45 – Logo Assets & NPM Publication Complete
2
2
 
3
3
  ✅ **Live on NPM**: [@xagent/x-cli](https://www.npmjs.com/package/@xagent/x-cli) - Fully published and ready for global installation
4
4
 
@@ -218,14 +218,14 @@ which xcli # Should show installation path
218
218
  **Try without installing:**
219
219
 
220
220
  ```bash
221
- GROK_API_KEY=your_api_key_here npx -y @xagent/x-cli@latest --help
221
+ X_API_KEY=your_api_key_here npx -y @xagent/x-cli@latest --help
222
222
  ```
223
223
 
224
224
  **Or install globally:**
225
225
 
226
226
  ```bash
227
227
  npm install -g @xagent/x-cli@latest && \
228
- echo 'export GROK_API_KEY=your_api_key_here' >> ~/.zshrc && \
228
+ echo 'export X_API_KEY=your_api_key_here' >> ~/.zshrc && \
229
229
  source ~/.zshrc && \
230
230
  xcli --help
231
231
  ```
@@ -249,7 +249,7 @@ npm link
249
249
  **Method 1: Environment Variable**
250
250
 
251
251
  ```bash
252
- export GROK_API_KEY=your_api_key_here
252
+ export X_API_KEY=your_api_key_here
253
253
  ```
254
254
 
255
255
  **Method 2: .env File**
@@ -381,7 +381,7 @@ This means you can have different models for different projects while maintainin
381
381
 
382
382
  ### Using Other API Providers
383
383
 
384
- **Important**: Grok CLI uses **OpenAI-compatible APIs**. You can use any provider that implements the OpenAI chat completions standard.
384
+ **Important**: X-CLI uses **OpenAI-compatible APIs**. You can use any provider that implements the OpenAI chat completions standard.
385
385
 
386
386
  **Popular Providers**:
387
387
 
@@ -449,7 +449,7 @@ This mode is particularly useful for:
449
449
 
450
450
  ### Tool Execution Control
451
451
 
452
- By default, Grok CLI allows up to 400 tool execution rounds to handle complex multi-step tasks. You can control this behavior:
452
+ By default, X-CLI allows up to 400 tool execution rounds to handle complex multi-step tasks. You can control this behavior:
453
453
 
454
454
  ```bash
455
455
  # Limit tool rounds for faster execution on simple tasks
@@ -514,7 +514,7 @@ xcli [options]
514
514
  Options:
515
515
  -V, --version output the version number
516
516
  -d, --directory <dir> set working directory
517
- -k, --api-key <key> Grok API key (or set GROK_API_KEY env var)
517
+ -k, --api-key <key> Grok API key (or set X_API_KEY env var)
518
518
  -u, --base-url <url> Grok API base URL (or set GROK_BASE_URL env var)
519
519
  -m, --model <model> AI model to use (e.g., grok-code-fast-1, grok-4-latest) (or set GROK_MODEL env var)
520
520
  -p, --prompt <prompt> process a single prompt and exit (headless mode)
@@ -546,7 +546,7 @@ Grok will automatically load and follow these instructions when working in your
546
546
 
547
547
  ## Morph Fast Apply (Optional)
548
548
 
549
- Grok CLI supports Morph's Fast Apply model for high-speed code editing at **4,500+ tokens/sec with 98% accuracy**. This is an optional feature that provides lightning-fast file editing capabilities.
549
+ X-CLI supports Morph's Fast Apply model for high-speed code editing at **4,500+ tokens/sec with 98% accuracy**. This is an optional feature that provides lightning-fast file editing capabilities.
550
550
 
551
551
  **Setup**: Configure your Morph API key following the [setup instructions](#setup) above.
552
552
 
@@ -577,7 +577,7 @@ The AI will automatically choose between `edit_file` (Morph) for complex changes
577
577
 
578
578
  ## MCP Tools
579
579
 
580
- Grok CLI supports MCP (Model Context Protocol) servers, allowing you to extend the AI assistant with additional tools and capabilities.
580
+ X-CLI supports MCP (Model Context Protocol) servers, allowing you to extend the AI assistant with additional tools and capabilities.
581
581
 
582
582
  ### Adding MCP Tools
583
583
 
@@ -856,14 +856,14 @@ This issue is being tracked and the fallbacks ensure the CLI remains functional.
856
856
 
857
857
  ```bash
858
858
  # Set your API key (replace with your actual key)
859
- export GROK_API_KEY=your_actual_api_key_here
859
+ export X_API_KEY=your_actual_api_key_here
860
860
 
861
861
  # Or add to your shell profile permanently
862
- echo 'export GROK_API_KEY=your_actual_api_key_here' >> ~/.zshrc
862
+ echo 'export X_API_KEY=your_actual_api_key_here' >> ~/.zshrc
863
863
  source ~/.zshrc
864
864
 
865
865
  # Verify it's set
866
- echo $GROK_API_KEY
866
+ echo $X_API_KEY
867
867
  ```
868
868
 
869
869
  **🚨 Network/connectivity issues**
@@ -885,7 +885,7 @@ curl -I https://api.x.ai/v1/models
885
885
 
886
886
  ## 🙏 Credits
887
887
 
888
- This project is built upon the excellent foundation of the original [Grok CLI](https://github.com/superagent-ai/xcli-cli) created by [Ismail Pelaseyed](https://github.com/homanp) at [Superagent.ai](https://github.com/superagent-ai).
888
+ This project is built upon the excellent foundation of the original [X-CLI](https://github.com/superagent-ai/xcli-cli) created by [Ismail Pelaseyed](https://github.com/homanp) at [Superagent.ai](https://github.com/superagent-ai).
889
889
 
890
890
  **Original Project**: [superagent-ai/xcli-cli](https://github.com/superagent-ai/xcli-cli)
891
891
  **Founder**: [Ismail Pelaseyed](https://github.com/homanp)
@@ -909,7 +909,7 @@ To add yourself as a contributor:
909
909
  ### Core Contributors
910
910
 
911
911
  - **[@hinetapora](https://github.com/hinetapora)** — Fork maintainer, advanced tool systems, UX enhancements, auto-upgrade system
912
- - **[@homanp](https://github.com/homanp)** — Original Grok CLI creator and foundation
912
+ - **[@homanp](https://github.com/homanp)** — Original X-CLI creator and foundation
913
913
 
914
914
  ### Community Contributors
915
915
 
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import * as path7 from 'path';
5
5
  import path7__default from 'path';
6
6
  import * as os from 'os';
7
7
  import os__default from 'os';
8
- import React3, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
8
+ import React2, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
9
9
  import { Box, Text, render, useApp, useInput } from 'ink';
10
10
  import { program, Command } from 'commander';
11
11
  import * as dotenv from 'dotenv';
@@ -65,16 +65,20 @@ var init_settings_manager = __esm({
65
65
  };
66
66
  SettingsManager = class _SettingsManager {
67
67
  constructor() {
68
- this.userSettingsPath = path7.join(
69
- os.homedir(),
70
- ".grok",
71
- "user-settings.json"
72
- );
73
- this.projectSettingsPath = path7.join(
74
- process.cwd(),
75
- ".grok",
76
- "settings.json"
77
- );
68
+ const newUserDir = path7.join(os.homedir(), ".x");
69
+ const oldUserDir = path7.join(os.homedir(), ".grok");
70
+ if (fs.existsSync(newUserDir) || !fs.existsSync(oldUserDir)) {
71
+ this.userSettingsPath = path7.join(newUserDir, "user-settings.json");
72
+ } else {
73
+ this.userSettingsPath = path7.join(oldUserDir, "user-settings.json");
74
+ }
75
+ const newProjectDir = path7.join(process.cwd(), ".x");
76
+ const oldProjectDir = path7.join(process.cwd(), ".grok");
77
+ if (fs.existsSync(newProjectDir) || !fs.existsSync(oldProjectDir)) {
78
+ this.projectSettingsPath = path7.join(newProjectDir, "settings.json");
79
+ } else {
80
+ this.projectSettingsPath = path7.join(oldProjectDir, "settings.json");
81
+ }
78
82
  }
79
83
  /**
80
84
  * Get singleton instance
@@ -95,7 +99,7 @@ var init_settings_manager = __esm({
95
99
  }
96
100
  }
97
101
  /**
98
- * Load user settings from ~/.grok/user-settings.json
102
+ * Load user settings from ~/.x/user-settings.json
99
103
  */
100
104
  loadUserSettings() {
101
105
  try {
@@ -115,7 +119,7 @@ var init_settings_manager = __esm({
115
119
  }
116
120
  }
117
121
  /**
118
- * Save user settings to ~/.grok/user-settings.json
122
+ * Save user settings to ~/.x/user-settings.json
119
123
  */
120
124
  saveUserSettings(settings) {
121
125
  try {
@@ -160,7 +164,7 @@ var init_settings_manager = __esm({
160
164
  return settings[key];
161
165
  }
162
166
  /**
163
- * Load project settings from .grok/settings.json
167
+ * Load project settings from .x/settings.json
164
168
  */
165
169
  loadProjectSettings() {
166
170
  try {
@@ -180,7 +184,7 @@ var init_settings_manager = __esm({
180
184
  }
181
185
  }
182
186
  /**
183
- * Save project settings to .grok/settings.json
187
+ * Save project settings to .x/settings.json
184
188
  */
185
189
  saveProjectSettings(settings) {
186
190
  try {
@@ -256,7 +260,7 @@ var init_settings_manager = __esm({
256
260
  * Get API key from user settings or environment
257
261
  */
258
262
  getApiKey() {
259
- const envApiKey = process.env.GROK_API_KEY;
263
+ const envApiKey = process.env.X_API_KEY || process.env.GROK_API_KEY;
260
264
  if (envApiKey) {
261
265
  return envApiKey;
262
266
  }
@@ -8557,7 +8561,7 @@ ${customInstructions}
8557
8561
  The above custom instructions should be followed alongside the standard instructions below.` : "";
8558
8562
  this.messages.push({
8559
8563
  role: "system",
8560
- content: `You are Grok CLI, an AI assistant that helps with file editing, coding tasks, and system operations.${customInstructionsSection}
8564
+ content: `You are X-CLI, an AI assistant that helps with file editing, coding tasks, and system operations.${customInstructionsSection}
8561
8565
 
8562
8566
  You have access to these tools:
8563
8567
 
@@ -9287,7 +9291,7 @@ EOF`;
9287
9291
  var package_default = {
9288
9292
  type: "module",
9289
9293
  name: "@xagent/x-cli",
9290
- version: "1.1.44",
9294
+ version: "1.1.45",
9291
9295
  description: "An open-source AI agent that brings the power of Grok directly into your terminal.",
9292
9296
  main: "dist/index.js",
9293
9297
  module: "dist/index.js",
@@ -11744,7 +11748,7 @@ ${documentationSection}`;
11744
11748
  - Reference existing documentation rather than recreating context
11745
11749
 
11746
11750
  ---
11747
- *This section was added by the Grok CLI documentation system*`;
11751
+ *This section was added by the X-CLI documentation system*`;
11748
11752
  }
11749
11753
  };
11750
11754
  var claudeMdParser = new ClaudeMdParserImpl();
@@ -11875,7 +11879,7 @@ Documentation for documentation system commands:
11875
11879
  - Build instructions: ../package.json
11876
11880
 
11877
11881
  ---
11878
- *Generated by Grok CLI Documentation System*
11882
+ *Generated by X-CLI Documentation System*
11879
11883
  *Last updated: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}*
11880
11884
  `;
11881
11885
  }
@@ -11894,7 +11898,7 @@ Documentation for documentation system commands:
11894
11898
  return files;
11895
11899
  }
11896
11900
  generateGrokArchitecture() {
11897
- return `# \u{1F3D7}\uFE0F Grok CLI Architecture
11901
+ return `# \u{1F3D7}\uFE0F X-CLI Architecture
11898
11902
 
11899
11903
  ## Project Type
11900
11904
  **CLI Application** - Conversational AI tool with terminal interface
@@ -11968,7 +11972,7 @@ Documentation for documentation system commands:
11968
11972
  return `# \u{1F3D7}\uFE0F Project Architecture
11969
11973
 
11970
11974
  ## Project Overview
11971
- External project documented using Grok CLI's .agent system.
11975
+ External project documented using X-CLI's .agent system.
11972
11976
 
11973
11977
  ## Technology Stack
11974
11978
  *To be analyzed and documented*
@@ -12021,7 +12025,7 @@ External project documented using Grok CLI's .agent system.
12021
12025
  - **Extension Pattern**: Add to handleDirectCommand function
12022
12026
 
12023
12027
  ## Authentication & Storage
12024
- - **Auth**: Environment variable GROK_API_KEY or user settings
12028
+ - **Auth**: Environment variable X_API_KEY or user settings
12025
12029
  - **Storage**: Local file system only
12026
12030
  - **Database**: None (settings via JSON files)
12027
12031
  - **MCP**: Optional server integration
@@ -12093,7 +12097,7 @@ Updated By: Agent System Generator during /init-agent
12093
12097
  {
12094
12098
  baseURL: "https://api.x.ai/v1",
12095
12099
  defaultModel: "grok-code-fast-1",
12096
- apiKey: process.env.GROK_API_KEY
12100
+ apiKey: process.env.X_API_KEY
12097
12101
  }
12098
12102
  \`\`\`
12099
12103
 
@@ -12338,10 +12342,10 @@ Create tool in \`src/tools/\`, then reference in command handler.
12338
12342
  return `# \u{1F4CB} Example PRD: Documentation System Enhancement
12339
12343
 
12340
12344
  ## Objective
12341
- Add comprehensive documentation generation capabilities to Grok CLI.
12345
+ Add comprehensive documentation generation capabilities to X-CLI.
12342
12346
 
12343
12347
  ## Background
12344
- Grok CLI needs better documentation tools to help users document both the CLI itself and their projects efficiently.
12348
+ X-CLI needs better documentation tools to help users document both the CLI itself and their projects efficiently.
12345
12349
 
12346
12350
  ## Requirements
12347
12351
 
@@ -12490,8 +12494,8 @@ Creates \`.agent/\` folder structure:
12490
12494
 
12491
12495
  ## Project Types
12492
12496
 
12493
- ### Grok CLI (Internal)
12494
- - Documents Grok CLI's own architecture
12497
+ ### X-CLI (Internal)
12498
+ - Documents X-CLI's own architecture
12495
12499
  - Includes command system patterns
12496
12500
  - References existing tool structure
12497
12501
 
@@ -12883,7 +12887,7 @@ TypeScript is configured via \`tsconfig.json\`.
12883
12887
  `;
12884
12888
  }
12885
12889
  content += `---
12886
- *Generated by Grok CLI Documentation System*
12890
+ *Generated by X-CLI Documentation System*
12887
12891
  `;
12888
12892
  content += `*Last updated: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}*`;
12889
12893
  return content;
@@ -13485,7 +13489,7 @@ type ${type.name} = ${type.definition}
13485
13489
  });
13486
13490
  }
13487
13491
  content += `---
13488
- *Generated by Grok CLI Documentation System*`;
13492
+ *Generated by X-CLI Documentation System*`;
13489
13493
  return content;
13490
13494
  }
13491
13495
  generateHtml(documentation) {
@@ -14564,7 +14568,7 @@ ${incident.guardrailCreated ? `Guardrail created: ${incident.guardrailCreated}`
14564
14568
  - [System Critical State](../system/critical-state.md)
14565
14569
 
14566
14570
  ---
14567
- *Generated by Grok CLI Self-Healing System*
14571
+ *Generated by X-CLI Self-Healing System*
14568
14572
  *Incident ID: ${incident.id}*
14569
14573
  `;
14570
14574
  }
@@ -14646,7 +14650,7 @@ ${guardrail.createdFrom ? `- Created from incident: ${guardrail.createdFrom}` :
14646
14650
  - Category: ${guardrail.category}
14647
14651
 
14648
14652
  ---
14649
- *Generated by Grok CLI Self-Healing System*
14653
+ *Generated by X-CLI Self-Healing System*
14650
14654
  `;
14651
14655
  }
14652
14656
  async checkGuardrails(operation, context) {
@@ -14824,7 +14828,7 @@ function isNewerVersion(version1, version2) {
14824
14828
  }
14825
14829
  async function autoUpgrade() {
14826
14830
  try {
14827
- console.log("\u{1F504} Upgrading Grok CLI...");
14831
+ console.log("\u{1F504} Upgrading X-CLI...");
14828
14832
  await execAsync3(`npm update -g ${package_default.name}@latest`, {
14829
14833
  timeout: 3e4
14830
14834
  });
@@ -15119,7 +15123,7 @@ function useInputHandler({
15119
15123
  if (trimmedInput === "/help") {
15120
15124
  const helpEntry = {
15121
15125
  type: "assistant",
15122
- content: `Grok CLI Help:
15126
+ content: `X-CLI Help:
15123
15127
 
15124
15128
  Built-in Commands:
15125
15129
  /clear - Clear chat history
@@ -15220,7 +15224,7 @@ Available models: ${modelNames.join(", ")}`,
15220
15224
  const versionInfo = await checkForUpdates();
15221
15225
  const versionEntry = {
15222
15226
  type: "assistant",
15223
- content: `\u{1F4E6} **Grok CLI Version Information**
15227
+ content: `\u{1F4E6} **X-CLI Version Information**
15224
15228
 
15225
15229
  Current Version: **${versionInfo.current}**
15226
15230
  Latest Version: **${versionInfo.latest}**
@@ -15280,7 +15284,7 @@ Upgrading now... This may take a moment.`,
15280
15284
 
15281
15285
  Successfully upgraded to version **${versionInfo.latest}**.
15282
15286
 
15283
- **Please restart Grok CLI** to use the new version:
15287
+ **Please restart X-CLI** to use the new version:
15284
15288
  - Exit with \`/exit\` or Ctrl+C
15285
15289
  - Run \`grok\` again` : `\u274C **Upgrade Failed**
15286
15290
 
@@ -15341,7 +15345,7 @@ This may take a moment.`,
15341
15345
 
15342
15346
  Successfully installed version **${versionArg}**.
15343
15347
 
15344
- **Please restart Grok CLI** to use the new version:
15348
+ **Please restart X-CLI** to use the new version:
15345
15349
  - Exit with \`/exit\` or Ctrl+C
15346
15350
  - Run \`grok\` again`,
15347
15351
  timestamp: /* @__PURE__ */ new Date()
@@ -16516,23 +16520,10 @@ function LoadingSpinner({
16516
16520
  message,
16517
16521
  progress
16518
16522
  }) {
16519
- const [spinnerIndex, setSpinnerIndex] = useState(0);
16520
- const [messageIndex, setMessageIndex] = useState(0);
16521
- useEffect(() => {
16522
- if (!isActive) return;
16523
- const interval = setInterval(() => {
16524
- setSpinnerIndex((prev) => (prev + 1) % 10);
16525
- if (Date.now() % 3e3 < 200) {
16526
- const config3 = operationConfig[operation];
16527
- setMessageIndex((prev) => (prev + 1) % config3.messages.length);
16528
- }
16529
- }, 120);
16530
- return () => clearInterval(interval);
16531
- }, [isActive, operation]);
16532
16523
  if (!isActive) return null;
16533
16524
  const config2 = operationConfig[operation];
16534
- const spinnerChar = config2.spinner[spinnerIndex];
16535
- const operationMessage = message || config2.messages[messageIndex];
16525
+ const spinnerChar = config2.spinner[0];
16526
+ const operationMessage = message || config2.messages[0];
16536
16527
  const color = getSpinnerColor(operation);
16537
16528
  const renderProgressBar = () => {
16538
16529
  if (progress === void 0) return null;
@@ -16813,7 +16804,7 @@ var handleLongContent = (content, maxLength = 5e3) => {
16813
16804
  isTruncated: true
16814
16805
  };
16815
16806
  };
16816
- var MemoizedChatEntry = React3.memo(
16807
+ var MemoizedChatEntry = React2.memo(
16817
16808
  ({ entry, index }) => {
16818
16809
  const renderDiff = (diffContent, filename) => {
16819
16810
  return /* @__PURE__ */ jsx(
@@ -18180,7 +18171,7 @@ function ChatInterfaceWithAgent({
18180
18171
  let lastUpdateTime = Date.now();
18181
18172
  const flushUpdates = () => {
18182
18173
  const now = Date.now();
18183
- if (now - lastUpdateTime < 500) return;
18174
+ if (now - lastUpdateTime < 150) return;
18184
18175
  setChatHistory((prev) => {
18185
18176
  let newHistory = [...prev];
18186
18177
  if (lastTokenCount !== 0) {
@@ -18970,7 +18961,7 @@ async function processPromptHeadless(prompt, apiKey, baseURL, model, maxToolRoun
18970
18961
  }
18971
18962
  program.name("grok").description(
18972
18963
  "A conversational AI CLI tool powered by Grok with text editor capabilities"
18973
- ).version(package_default.version).argument("[message...]", "Initial message to send to Grok").option("-d, --directory <dir>", "set working directory", process.cwd()).option("-k, --api-key <key>", "Grok API key (or set GROK_API_KEY env var)").option(
18964
+ ).version(package_default.version).argument("[message...]", "Initial message to send to Grok").option("-d, --directory <dir>", "set working directory", process.cwd()).option("-k, --api-key <key>", "X API key (or set X_API_KEY env var)").option(
18974
18965
  "-u, --base-url <url>",
18975
18966
  "Grok API base URL (or set GROK_BASE_URL env var)"
18976
18967
  ).option(
@@ -19002,7 +18993,7 @@ program.name("grok").description(
19002
18993
  const maxToolRounds = parseInt(options.maxToolRounds) || 400;
19003
18994
  if (!apiKey) {
19004
18995
  console.error(
19005
- "\u274C Error: API key required. Set GROK_API_KEY environment variable, use --api-key flag, or save to ~/.grok/user-settings.json"
18996
+ "\u274C Error: API key required. Set X_API_KEY environment variable, use --api-key flag, or save to ~/.x/user-settings.json"
19006
18997
  );
19007
18998
  process.exit(1);
19008
18999
  }
@@ -19029,7 +19020,7 @@ program.name("grok").description(
19029
19020
  checkAutoCompact();
19030
19021
  checkStartupUpdates();
19031
19022
  const initialMessage = Array.isArray(message) ? message.join(" ") : message;
19032
- const app = render(React3.createElement(ChatInterface, { agent, initialMessage }));
19023
+ const app = render(React2.createElement(ChatInterface, { agent, initialMessage }));
19033
19024
  const cleanup = () => {
19034
19025
  app.unmount();
19035
19026
  agent.abortCurrentOperation();
@@ -19050,7 +19041,7 @@ program.name("grok").description(
19050
19041
  }
19051
19042
  });
19052
19043
  var gitCommand = program.command("git").description("Git operations with AI assistance");
19053
- gitCommand.command("commit-and-push").description("Generate AI commit message and push to remote").option("-d, --directory <dir>", "set working directory", process.cwd()).option("-k, --api-key <key>", "Grok API key (or set GROK_API_KEY env var)").option(
19044
+ gitCommand.command("commit-and-push").description("Generate AI commit message and push to remote").option("-d, --directory <dir>", "set working directory", process.cwd()).option("-k, --api-key <key>", "X API key (or set X_API_KEY env var)").option(
19054
19045
  "-u, --base-url <url>",
19055
19046
  "Grok API base URL (or set GROK_BASE_URL env var)"
19056
19047
  ).option(
@@ -19079,7 +19070,7 @@ gitCommand.command("commit-and-push").description("Generate AI commit message an
19079
19070
  const maxToolRounds = parseInt(options.maxToolRounds) || 400;
19080
19071
  if (!apiKey) {
19081
19072
  console.error(
19082
- "\u274C Error: API key required. Set GROK_API_KEY environment variable, use --api-key flag, or save to ~/.grok/user-settings.json"
19073
+ "\u274C Error: API key required. Set X_API_KEY environment variable, use --api-key flag, or save to ~/.x/user-settings.json"
19083
19074
  );
19084
19075
  process.exit(1);
19085
19076
  }