grok-cli-hurry-mode 1.0.33 → 1.0.35
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 +9 -0
- package/dist/index.js +34 -131
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 1.0.34 – Stability Release
|
|
2
|
+
|
|
3
|
+
This release restores the proven 1.0.31 baseline.
|
|
4
|
+
- Fixes all Read/Update tool reliability issues
|
|
5
|
+
- Ensures consistent FS imports (`node:` namespace)
|
|
6
|
+
- Adds proper Node shebang for global installs
|
|
7
|
+
- Temporarily removes experimental features (e.g. compress)
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
# Grok CLI
|
|
2
11
|
|
|
3
12
|
[](https://www.npmjs.com/package/grok-cli-hurry-mode)
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
4
|
import * as path7 from 'path';
|
|
5
5
|
import path7__default from 'path';
|
|
6
6
|
import * as os from 'os';
|
|
@@ -7027,10 +7027,10 @@ var DependencyAnalyzerTool = class {
|
|
|
7027
7027
|
const circularDeps = [];
|
|
7028
7028
|
const visited = /* @__PURE__ */ new Set();
|
|
7029
7029
|
const visiting = /* @__PURE__ */ new Set();
|
|
7030
|
-
const dfs = (filePath,
|
|
7030
|
+
const dfs = (filePath, path24) => {
|
|
7031
7031
|
if (visiting.has(filePath)) {
|
|
7032
|
-
const cycleStart =
|
|
7033
|
-
const cycle =
|
|
7032
|
+
const cycleStart = path24.indexOf(filePath);
|
|
7033
|
+
const cycle = path24.slice(cycleStart).concat([filePath]);
|
|
7034
7034
|
circularDeps.push({
|
|
7035
7035
|
cycle: cycle.map((fp) => graph.nodes.get(fp)?.filePath || fp),
|
|
7036
7036
|
severity: cycle.length <= 2 ? "error" : "warning",
|
|
@@ -7046,7 +7046,7 @@ var DependencyAnalyzerTool = class {
|
|
|
7046
7046
|
if (node) {
|
|
7047
7047
|
for (const dependency of node.dependencies) {
|
|
7048
7048
|
if (graph.nodes.has(dependency)) {
|
|
7049
|
-
dfs(dependency, [...
|
|
7049
|
+
dfs(dependency, [...path24, filePath]);
|
|
7050
7050
|
}
|
|
7051
7051
|
}
|
|
7052
7052
|
}
|
|
@@ -9012,10 +9012,10 @@ Current working directory: ${process.cwd()}`
|
|
|
9012
9012
|
return await this.textEditor.view(args.path, range);
|
|
9013
9013
|
} catch (error) {
|
|
9014
9014
|
console.warn(`view_file tool failed, falling back to bash: ${error.message}`);
|
|
9015
|
-
const
|
|
9016
|
-
let command = `cat "${
|
|
9015
|
+
const path24 = args.path;
|
|
9016
|
+
let command = `cat "${path24}"`;
|
|
9017
9017
|
if (args.start_line && args.end_line) {
|
|
9018
|
-
command = `sed -n '${args.start_line},${args.end_line}p' "${
|
|
9018
|
+
command = `sed -n '${args.start_line},${args.end_line}p' "${path24}"`;
|
|
9019
9019
|
}
|
|
9020
9020
|
return await this.bash.execute(command);
|
|
9021
9021
|
}
|
|
@@ -9240,6 +9240,10 @@ EOF`;
|
|
|
9240
9240
|
}
|
|
9241
9241
|
};
|
|
9242
9242
|
|
|
9243
|
+
// package.json
|
|
9244
|
+
var package_default = {
|
|
9245
|
+
version: "1.0.35"};
|
|
9246
|
+
|
|
9243
9247
|
// src/utils/text-utils.ts
|
|
9244
9248
|
function isWordBoundary(char) {
|
|
9245
9249
|
if (!char) return true;
|
|
@@ -10644,13 +10648,13 @@ var ReadmeGenerator = class {
|
|
|
10644
10648
|
}
|
|
10645
10649
|
}
|
|
10646
10650
|
generateReadmeContent(analysis) {
|
|
10647
|
-
const
|
|
10648
|
-
const projectName = this.config.projectName ||
|
|
10651
|
+
const pkg = analysis.packageJson;
|
|
10652
|
+
const projectName = this.config.projectName || pkg?.name || "Project";
|
|
10649
10653
|
let content = `# ${projectName}
|
|
10650
10654
|
|
|
10651
10655
|
`;
|
|
10652
|
-
if (
|
|
10653
|
-
content += `${
|
|
10656
|
+
if (pkg?.description) {
|
|
10657
|
+
content += `${pkg.description}
|
|
10654
10658
|
|
|
10655
10659
|
`;
|
|
10656
10660
|
} else {
|
|
@@ -10658,7 +10662,7 @@ var ReadmeGenerator = class {
|
|
|
10658
10662
|
|
|
10659
10663
|
`;
|
|
10660
10664
|
}
|
|
10661
|
-
if (
|
|
10665
|
+
if (pkg) {
|
|
10662
10666
|
content += this.generateBadges(analysis);
|
|
10663
10667
|
}
|
|
10664
10668
|
content += `## \u{1F4CB} Table of Contents
|
|
@@ -10672,7 +10676,7 @@ var ReadmeGenerator = class {
|
|
|
10672
10676
|
`;
|
|
10673
10677
|
if (analysis.hasTests) content += `- [Testing](#testing)
|
|
10674
10678
|
`;
|
|
10675
|
-
if (
|
|
10679
|
+
if (pkg?.scripts?.build) content += `- [Building](#building)
|
|
10676
10680
|
`;
|
|
10677
10681
|
content += `- [Configuration](#configuration)
|
|
10678
10682
|
`;
|
|
@@ -10684,10 +10688,10 @@ var ReadmeGenerator = class {
|
|
|
10684
10688
|
content += `## \u{1F680} Installation
|
|
10685
10689
|
|
|
10686
10690
|
`;
|
|
10687
|
-
if (
|
|
10691
|
+
if (pkg?.bin) {
|
|
10688
10692
|
content += `### Global Installation
|
|
10689
10693
|
\`\`\`bash
|
|
10690
|
-
npm install -g ${
|
|
10694
|
+
npm install -g ${pkg.name}
|
|
10691
10695
|
\`\`\`
|
|
10692
10696
|
|
|
10693
10697
|
`;
|
|
@@ -10698,7 +10702,7 @@ npm install -g ${pkg2.name}
|
|
|
10698
10702
|
content += `# Clone the repository
|
|
10699
10703
|
git clone <repository-url>
|
|
10700
10704
|
`;
|
|
10701
|
-
content += `cd ${
|
|
10705
|
+
content += `cd ${pkg?.name || projectName.toLowerCase()}
|
|
10702
10706
|
|
|
10703
10707
|
`;
|
|
10704
10708
|
content += `# Install dependencies
|
|
@@ -10709,8 +10713,8 @@ npm install
|
|
|
10709
10713
|
content += `## \u{1F4BB} Usage
|
|
10710
10714
|
|
|
10711
10715
|
`;
|
|
10712
|
-
if (
|
|
10713
|
-
const binName = Object.keys(
|
|
10716
|
+
if (pkg?.bin) {
|
|
10717
|
+
const binName = Object.keys(pkg.bin)[0];
|
|
10714
10718
|
content += `### Command Line
|
|
10715
10719
|
\`\`\`bash
|
|
10716
10720
|
${binName} [options]
|
|
@@ -10769,7 +10773,7 @@ npm run test:watch
|
|
|
10769
10773
|
`;
|
|
10770
10774
|
}
|
|
10771
10775
|
}
|
|
10772
|
-
if (
|
|
10776
|
+
if (pkg?.scripts?.build) {
|
|
10773
10777
|
content += `## \u{1F4E6} Building
|
|
10774
10778
|
|
|
10775
10779
|
`;
|
|
@@ -10820,7 +10824,7 @@ TypeScript is configured via \`tsconfig.json\`.
|
|
|
10820
10824
|
|
|
10821
10825
|
`;
|
|
10822
10826
|
}
|
|
10823
|
-
if (analysis.framework === "Express.js" ||
|
|
10827
|
+
if (analysis.framework === "Express.js" || pkg?.main?.includes("api")) {
|
|
10824
10828
|
content += `## \u{1F4D6} API Documentation
|
|
10825
10829
|
|
|
10826
10830
|
`;
|
|
@@ -10845,8 +10849,8 @@ TypeScript is configured via \`tsconfig.json\`.
|
|
|
10845
10849
|
content += `## \u{1F4C4} License
|
|
10846
10850
|
|
|
10847
10851
|
`;
|
|
10848
|
-
if (
|
|
10849
|
-
content += `This project is licensed under the ${
|
|
10852
|
+
if (pkg?.license) {
|
|
10853
|
+
content += `This project is licensed under the ${pkg.license} License.
|
|
10850
10854
|
|
|
10851
10855
|
`;
|
|
10852
10856
|
} else {
|
|
@@ -12897,63 +12901,6 @@ function useInputHandler({
|
|
|
12897
12901
|
process.exit(0);
|
|
12898
12902
|
return;
|
|
12899
12903
|
}
|
|
12900
|
-
const AUTO_COMPRESS_THRESHOLD = 20;
|
|
12901
|
-
const MIN_HISTORY_SIZE = 10;
|
|
12902
|
-
const PRESERVE_RECENT = 5;
|
|
12903
|
-
if (chatHistory.length > AUTO_COMPRESS_THRESHOLD) {
|
|
12904
|
-
const currentHistoryLength = chatHistory.length;
|
|
12905
|
-
const canCompress = currentHistoryLength >= MIN_HISTORY_SIZE;
|
|
12906
|
-
if (canCompress) {
|
|
12907
|
-
try {
|
|
12908
|
-
setIsProcessing(true);
|
|
12909
|
-
const autoCompressEntry = {
|
|
12910
|
-
type: "assistant",
|
|
12911
|
-
content: `\u{1F916} **Automatic Compression Triggered**
|
|
12912
|
-
|
|
12913
|
-
History has ${currentHistoryLength} entries (threshold: ${AUTO_COMPRESS_THRESHOLD}). Compressing to maintain performance...`,
|
|
12914
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
12915
|
-
};
|
|
12916
|
-
setChatHistory((prev) => [...prev, autoCompressEntry]);
|
|
12917
|
-
const olderEntries = chatHistory.slice(0, -PRESERVE_RECENT);
|
|
12918
|
-
const contentToCompress = olderEntries.map((entry) => entry.content).join("\n");
|
|
12919
|
-
const subagentFramework = new SubagentFramework();
|
|
12920
|
-
const taskId = await subagentFramework.spawnSubagent({
|
|
12921
|
-
type: "summarizer",
|
|
12922
|
-
input: {
|
|
12923
|
-
content: contentToCompress,
|
|
12924
|
-
compressionTarget: 0.3
|
|
12925
|
-
},
|
|
12926
|
-
priority: "medium"
|
|
12927
|
-
});
|
|
12928
|
-
const result = await subagentFramework.waitForResult(taskId, 1e4);
|
|
12929
|
-
if (result.success) {
|
|
12930
|
-
const compressedEntry = {
|
|
12931
|
-
type: "assistant",
|
|
12932
|
-
content: `\u{1F4DD} **Auto-Compressed History Summary**
|
|
12933
|
-
|
|
12934
|
-
${result.summary}
|
|
12935
|
-
|
|
12936
|
-
*Auto-compressed ${currentHistoryLength - PRESERVE_RECENT} entries at ${(/* @__PURE__ */ new Date()).toLocaleString()}*`,
|
|
12937
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
12938
|
-
};
|
|
12939
|
-
const recentEntries = chatHistory.slice(-PRESERVE_RECENT);
|
|
12940
|
-
const newHistory = [compressedEntry, ...recentEntries];
|
|
12941
|
-
setChatHistory(newHistory);
|
|
12942
|
-
const successEntry = {
|
|
12943
|
-
type: "assistant",
|
|
12944
|
-
content: `\u2705 **Auto-Compression Complete**
|
|
12945
|
-
|
|
12946
|
-
Reduced from ${currentHistoryLength} to ${PRESERVE_RECENT + 1} entries.`,
|
|
12947
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
12948
|
-
};
|
|
12949
|
-
setChatHistory((prev) => [...prev, successEntry]);
|
|
12950
|
-
}
|
|
12951
|
-
setIsProcessing(false);
|
|
12952
|
-
} catch (error) {
|
|
12953
|
-
setIsProcessing(false);
|
|
12954
|
-
}
|
|
12955
|
-
}
|
|
12956
|
-
}
|
|
12957
12904
|
if (userInput.trim()) {
|
|
12958
12905
|
const directCommandResult = await handleDirectCommand(userInput);
|
|
12959
12906
|
if (!directCommandResult) {
|
|
@@ -13664,16 +13611,11 @@ ${result.suggestions.map((s) => `- ${s}`).join("\n")}
|
|
|
13664
13611
|
const args = trimmedInput.split(" ").slice(1);
|
|
13665
13612
|
const force = args.includes("--force");
|
|
13666
13613
|
const dryRun = args.includes("--dry-run");
|
|
13667
|
-
const MIN_HISTORY_SIZE = 10;
|
|
13668
|
-
const PRESERVE_RECENT = 5;
|
|
13669
|
-
const currentHistoryLength = chatHistory.length;
|
|
13670
|
-
const olderEntries = chatHistory.slice(0, -PRESERVE_RECENT);
|
|
13671
|
-
const contentToCompress = olderEntries.map((entry) => entry.content).join("\n");
|
|
13672
13614
|
const subagentFramework = new SubagentFramework();
|
|
13673
13615
|
const taskId = await subagentFramework.spawnSubagent({
|
|
13674
13616
|
type: "summarizer",
|
|
13675
13617
|
input: {
|
|
13676
|
-
content:
|
|
13618
|
+
content: chatHistory.map((entry) => entry.content).join("\n"),
|
|
13677
13619
|
compressionTarget: 0.3
|
|
13678
13620
|
// 70% reduction
|
|
13679
13621
|
},
|
|
@@ -13682,62 +13624,31 @@ ${result.suggestions.map((s) => `- ${s}`).join("\n")}
|
|
|
13682
13624
|
const result = await subagentFramework.waitForResult(taskId, 1e4);
|
|
13683
13625
|
if (result.success) {
|
|
13684
13626
|
const metrics = subagentFramework.getPerformanceMetrics();
|
|
13685
|
-
const canCompress = currentHistoryLength >= MIN_HISTORY_SIZE || force;
|
|
13686
|
-
const wouldCompressCount = Math.max(0, currentHistoryLength - PRESERVE_RECENT);
|
|
13687
13627
|
const resultEntry = {
|
|
13688
13628
|
type: "assistant",
|
|
13689
13629
|
content: dryRun ? `\u{1F4CA} **Compression Preview (Dry Run)**
|
|
13690
13630
|
|
|
13691
|
-
**Current history:** ${currentHistoryLength} entries
|
|
13692
|
-
**Would compress:** ${wouldCompressCount} older entries into 1 summary
|
|
13693
|
-
**Would preserve:** Last ${PRESERVE_RECENT} recent entries
|
|
13694
|
-
**Estimated reduction:** ~70%
|
|
13695
|
-
|
|
13696
|
-
**Compressed summary:**
|
|
13697
13631
|
${result.summary}
|
|
13698
13632
|
|
|
13699
|
-
\u{1F4A1} Use \`/compact\` to apply compression
|
|
13633
|
+
\u{1F4A1} Use \`/compact\` to apply compression` : `\u{1F9F9} **Context Compressed Successfully**
|
|
13700
13634
|
|
|
13701
13635
|
${result.summary}
|
|
13702
13636
|
|
|
13703
13637
|
\u{1F4C8} **Performance:**
|
|
13704
|
-
- Original entries: ${currentHistoryLength}
|
|
13705
|
-
- Compressed to: ${PRESERVE_RECENT + 1} entries
|
|
13706
13638
|
- Tokens saved: ~${result.output.compressionRatio * 100}%
|
|
13707
13639
|
- Processing time: ${result.executionTime}ms
|
|
13708
|
-
- Subagent tokens used: ${result.tokensUsed}
|
|
13709
|
-
|
|
13710
|
-
History too small for compression (${currentHistoryLength} < ${MIN_HISTORY_SIZE} entries).
|
|
13711
|
-
|
|
13712
|
-
**Preview:**
|
|
13713
|
-
${result.summary}
|
|
13714
|
-
|
|
13715
|
-
\u{1F4A1} Use \`/compact --force\` to compress anyway`,
|
|
13640
|
+
- Subagent tokens used: ${result.tokensUsed}`,
|
|
13716
13641
|
timestamp: /* @__PURE__ */ new Date()
|
|
13717
13642
|
};
|
|
13718
|
-
if (!dryRun && canCompress) {
|
|
13719
|
-
const compressedEntry = {
|
|
13720
|
-
type: "assistant",
|
|
13721
|
-
content: `\u{1F4DD} **Compressed History Summary**
|
|
13722
|
-
|
|
13723
|
-
${result.summary}
|
|
13724
|
-
|
|
13725
|
-
*Compressed ${wouldCompressCount} entries at ${(/* @__PURE__ */ new Date()).toLocaleString()}*`,
|
|
13726
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
13727
|
-
};
|
|
13728
|
-
const recentEntries = chatHistory.slice(-PRESERVE_RECENT);
|
|
13729
|
-
const newHistory = [compressedEntry, ...recentEntries];
|
|
13730
|
-
setChatHistory(newHistory);
|
|
13731
|
-
}
|
|
13732
13643
|
setChatHistory((prev) => [...prev, resultEntry]);
|
|
13733
|
-
if (!dryRun &&
|
|
13644
|
+
if (!dryRun && result.success) {
|
|
13734
13645
|
const tipsEntry = {
|
|
13735
13646
|
type: "assistant",
|
|
13736
13647
|
content: `\u2728 **Context Optimization Complete**
|
|
13737
13648
|
|
|
13738
13649
|
**What happened:**
|
|
13739
|
-
-
|
|
13740
|
-
-
|
|
13650
|
+
- Older conversations summarized
|
|
13651
|
+
- Recent context preserved
|
|
13741
13652
|
- Key decisions and TODOs maintained
|
|
13742
13653
|
|
|
13743
13654
|
**Options:**
|
|
@@ -14695,10 +14606,6 @@ function ApiKeyInput({ onApiKeySet }) {
|
|
|
14695
14606
|
}
|
|
14696
14607
|
|
|
14697
14608
|
// src/ui/components/chat-interface.tsx
|
|
14698
|
-
var pkgPath = path7__default.resolve(process.cwd(), "package.json");
|
|
14699
|
-
console.log("Reading package.json from:", pkgPath);
|
|
14700
|
-
var pkg = JSON.parse(fs__default.readFileSync(pkgPath, "utf8"));
|
|
14701
|
-
console.log("Version:", pkg.version);
|
|
14702
14609
|
function ChatInterfaceWithAgent({
|
|
14703
14610
|
agent,
|
|
14704
14611
|
initialMessage
|
|
@@ -14745,7 +14652,7 @@ function ChatInterfaceWithAgent({
|
|
|
14745
14652
|
const grokLogo = {
|
|
14746
14653
|
string: "\x1B[33m ##### ##### ##### # #\n# # # # # # #\n# ### # # # # # #\n# # ##### # # # #\n# ### # # # # # #\n# # # # # # #\n ##### # # ##### # #\x1B[0m"
|
|
14747
14654
|
};
|
|
14748
|
-
const logoOutput = (typeof grokLogo === "object" && "string" in grokLogo ? grokLogo.string : String(grokLogo)) + "\nHURRY MODE\n" +
|
|
14655
|
+
const logoOutput = (typeof grokLogo === "object" && "string" in grokLogo ? grokLogo.string : String(grokLogo)) + "\nHURRY MODE\n" + package_default.version;
|
|
14749
14656
|
const logoLines = logoOutput.split("\n");
|
|
14750
14657
|
logoLines.forEach((line) => {
|
|
14751
14658
|
if (line.trim()) {
|
|
@@ -15172,10 +15079,6 @@ function createMCPCommand() {
|
|
|
15172
15079
|
return mcpCommand;
|
|
15173
15080
|
}
|
|
15174
15081
|
|
|
15175
|
-
// package.json
|
|
15176
|
-
var package_default = {
|
|
15177
|
-
version: "1.0.33"};
|
|
15178
|
-
|
|
15179
15082
|
// src/index.ts
|
|
15180
15083
|
dotenv.config();
|
|
15181
15084
|
process.on("SIGTERM", () => {
|