@askexenow/exe-os 0.8.0 → 0.8.2
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 +178 -79
- package/package.json +1 -1
- package/dist/bin/backfill-responses.js +0 -1912
- package/dist/bin/backfill-vectors.js +0 -1642
- package/dist/bin/cleanup-stale-review-tasks.js +0 -1339
- package/dist/bin/cli.js +0 -18800
- package/dist/bin/exe-agent.js +0 -1858
- package/dist/bin/exe-assign.js +0 -1957
- package/dist/bin/exe-boot.js +0 -6460
- package/dist/bin/exe-call.js +0 -197
- package/dist/bin/exe-cloud.js +0 -850
- package/dist/bin/exe-dispatch.js +0 -1146
- package/dist/bin/exe-doctor.js +0 -1657
- package/dist/bin/exe-export-behaviors.js +0 -1494
- package/dist/bin/exe-forget.js +0 -1627
- package/dist/bin/exe-gateway.js +0 -7732
- package/dist/bin/exe-healthcheck.js +0 -207
- package/dist/bin/exe-heartbeat.js +0 -1647
- package/dist/bin/exe-kill.js +0 -1479
- package/dist/bin/exe-launch-agent.js +0 -1704
- package/dist/bin/exe-link.js +0 -192
- package/dist/bin/exe-new-employee.js +0 -852
- package/dist/bin/exe-pending-messages.js +0 -1446
- package/dist/bin/exe-pending-notifications.js +0 -1321
- package/dist/bin/exe-pending-reviews.js +0 -1468
- package/dist/bin/exe-repo-drift.js +0 -95
- package/dist/bin/exe-review.js +0 -1590
- package/dist/bin/exe-search.js +0 -2651
- package/dist/bin/exe-session-cleanup.js +0 -3173
- package/dist/bin/exe-settings.js +0 -354
- package/dist/bin/exe-status.js +0 -1532
- package/dist/bin/exe-team.js +0 -1324
- package/dist/bin/git-sweep.js +0 -2185
- package/dist/bin/graph-backfill.js +0 -1968
- package/dist/bin/graph-export.js +0 -1604
- package/dist/bin/install.js +0 -656
- package/dist/bin/list-providers.js +0 -140
- package/dist/bin/scan-tasks.js +0 -1820
- package/dist/bin/setup.js +0 -951
- package/dist/bin/shard-migrate.js +0 -1494
- package/dist/bin/update.js +0 -95
- package/dist/bin/wiki-sync.js +0 -1514
- package/dist/gateway/index.js +0 -8848
- package/dist/hooks/bug-report-worker.js +0 -2743
- package/dist/hooks/commit-complete.js +0 -2108
- package/dist/hooks/error-recall.js +0 -2861
- package/dist/hooks/exe-heartbeat-hook.js +0 -232
- package/dist/hooks/ingest-worker.js +0 -4793
- package/dist/hooks/ingest.js +0 -684
- package/dist/hooks/instructions-loaded.js +0 -1880
- package/dist/hooks/notification.js +0 -1726
- package/dist/hooks/post-compact.js +0 -1751
- package/dist/hooks/pre-compact.js +0 -1746
- package/dist/hooks/pre-tool-use.js +0 -2191
- package/dist/hooks/prompt-ingest-worker.js +0 -2126
- package/dist/hooks/prompt-submit.js +0 -4693
- package/dist/hooks/response-ingest-worker.js +0 -1936
- package/dist/hooks/session-end.js +0 -1752
- package/dist/hooks/session-start.js +0 -2795
- package/dist/hooks/stop.js +0 -1835
- package/dist/hooks/subagent-stop.js +0 -1726
- package/dist/hooks/summary-worker.js +0 -2661
- package/dist/index.js +0 -11834
- package/dist/lib/cloud-sync.js +0 -495
- package/dist/lib/config.js +0 -222
- package/dist/lib/consolidation.js +0 -476
- package/dist/lib/crypto.js +0 -51
- package/dist/lib/database.js +0 -730
- package/dist/lib/device-registry.js +0 -900
- package/dist/lib/embedder.js +0 -632
- package/dist/lib/employee-templates.js +0 -543
- package/dist/lib/employees.js +0 -177
- package/dist/lib/error-detector.js +0 -156
- package/dist/lib/exe-daemon-client.js +0 -451
- package/dist/lib/exe-daemon.js +0 -8285
- package/dist/lib/file-grep.js +0 -199
- package/dist/lib/hybrid-search.js +0 -1819
- package/dist/lib/identity-templates.js +0 -320
- package/dist/lib/identity.js +0 -223
- package/dist/lib/keychain.js +0 -145
- package/dist/lib/license.js +0 -377
- package/dist/lib/messaging.js +0 -1376
- package/dist/lib/reminders.js +0 -63
- package/dist/lib/schedules.js +0 -1396
- package/dist/lib/session-registry.js +0 -52
- package/dist/lib/skill-learning.js +0 -477
- package/dist/lib/status-brief.js +0 -235
- package/dist/lib/store.js +0 -1551
- package/dist/lib/task-router.js +0 -62
- package/dist/lib/tasks.js +0 -2456
- package/dist/lib/tmux-routing.js +0 -2836
- package/dist/lib/tmux-status.js +0 -261
- package/dist/lib/tmux-transport.js +0 -83
- package/dist/lib/transport.js +0 -128
- package/dist/lib/ws-auth.js +0 -19
- package/dist/lib/ws-client.js +0 -160
- package/dist/mcp/server.js +0 -10538
- package/dist/mcp/tools/complete-reminder.js +0 -67
- package/dist/mcp/tools/create-reminder.js +0 -52
- package/dist/mcp/tools/create-task.js +0 -1853
- package/dist/mcp/tools/deactivate-behavior.js +0 -263
- package/dist/mcp/tools/list-reminders.js +0 -62
- package/dist/mcp/tools/list-tasks.js +0 -463
- package/dist/mcp/tools/send-message.js +0 -1382
- package/dist/mcp/tools/update-task.js +0 -1692
- package/dist/runtime/index.js +0 -6809
- package/dist/tui/App.js +0 -17479
package/dist/lib/file-grep.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
// src/lib/file-grep.ts
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import { readFileSync, readdirSync, statSync, existsSync } from "fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import crypto from "crypto";
|
|
6
|
-
var DEFAULT_PATTERNS = [
|
|
7
|
-
".planning/*.md",
|
|
8
|
-
"exe/output/*.md",
|
|
9
|
-
"README.md",
|
|
10
|
-
"src/**/*.ts"
|
|
11
|
-
];
|
|
12
|
-
var EXCLUDE_DIRS = ["node_modules", "dist", ".git", "coverage", ".worktrees"];
|
|
13
|
-
var MAX_FILE_SIZE = 100 * 1024;
|
|
14
|
-
var MAX_FILES = 500;
|
|
15
|
-
async function grepProjectFiles(query, projectRoot, options) {
|
|
16
|
-
const maxResults = options?.maxResults ?? 10;
|
|
17
|
-
const terms = query.toLowerCase().split(/\s+/).filter((t) => t.length >= 3).map((t) => t.replace(/[^a-z0-9_-]/g, "")).filter((t) => t.length >= 3);
|
|
18
|
-
if (terms.length === 0) return [];
|
|
19
|
-
const pattern = terms.join("|");
|
|
20
|
-
let hits;
|
|
21
|
-
try {
|
|
22
|
-
hits = grepWithRipgrep(pattern, projectRoot, options?.patterns);
|
|
23
|
-
} catch {
|
|
24
|
-
hits = grepWithNodeFs(pattern, projectRoot, options?.patterns);
|
|
25
|
-
}
|
|
26
|
-
hits.sort((a, b) => b.density - a.density);
|
|
27
|
-
const topHits = hits.slice(0, maxResults);
|
|
28
|
-
return topHits.map((hit) => {
|
|
29
|
-
const chunkCtx = getChunkContext(hit.filePath, hit.lineNumber);
|
|
30
|
-
const prefix = chunkCtx ? `[file: ${hit.filePath}:${hit.lineNumber} in ${chunkCtx}]` : `[file: ${hit.filePath}:${hit.lineNumber}]`;
|
|
31
|
-
return {
|
|
32
|
-
id: crypto.createHash("sha256").update(`${hit.filePath}:${hit.lineNumber}`).digest("hex").slice(0, 36),
|
|
33
|
-
agent_id: "project",
|
|
34
|
-
agent_role: "file",
|
|
35
|
-
session_id: "file-grep",
|
|
36
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
37
|
-
tool_name: "file_grep",
|
|
38
|
-
project_name: path.basename(projectRoot),
|
|
39
|
-
has_error: false,
|
|
40
|
-
raw_text: `${prefix} ${buildSnippet(hit, projectRoot)}`,
|
|
41
|
-
vector: null,
|
|
42
|
-
task_id: null
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
function getChunkContext(filePath, lineNumber) {
|
|
47
|
-
try {
|
|
48
|
-
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
49
|
-
if (ext !== "ts" && ext !== "tsx" && ext !== "js" && ext !== "jsx") return "";
|
|
50
|
-
const source = readFileSync(filePath, "utf8");
|
|
51
|
-
const lines = source.split("\n");
|
|
52
|
-
for (let i = Math.min(lineNumber - 1, lines.length - 1); i >= 0; i--) {
|
|
53
|
-
const line = lines[i];
|
|
54
|
-
const fnMatch = line.match(/(?:export\s+)?(?:async\s+)?function\s+(\w+)/);
|
|
55
|
-
if (fnMatch) return `function ${fnMatch[1]}`;
|
|
56
|
-
const classMatch = line.match(/(?:export\s+)?class\s+(\w+)/);
|
|
57
|
-
if (classMatch) return `class ${classMatch[1]}`;
|
|
58
|
-
const arrowMatch = line.match(/(?:export\s+)?(?:const|let)\s+(\w+)\s*=\s*(?:async\s+)?\(/);
|
|
59
|
-
if (arrowMatch) return `function ${arrowMatch[1]}`;
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
}
|
|
63
|
-
return "";
|
|
64
|
-
}
|
|
65
|
-
function grepWithRipgrep(pattern, projectRoot, patterns) {
|
|
66
|
-
const globs = (patterns ?? DEFAULT_PATTERNS).map((p) => `--glob '${p}'`).join(" ");
|
|
67
|
-
const excludes = EXCLUDE_DIRS.map((d) => `--glob '!${d}'`).join(" ");
|
|
68
|
-
const cmd = `rg -i -c --hidden '${pattern.replace(/'/g, "\\'")}' . ${globs} ${excludes} --max-filesize ${MAX_FILE_SIZE} 2>/dev/null || true`;
|
|
69
|
-
const output = execSync(cmd, {
|
|
70
|
-
cwd: projectRoot,
|
|
71
|
-
encoding: "utf8",
|
|
72
|
-
timeout: 3e3,
|
|
73
|
-
maxBuffer: 1024 * 1024
|
|
74
|
-
});
|
|
75
|
-
if (!output.trim()) return [];
|
|
76
|
-
const hits = [];
|
|
77
|
-
for (const line of output.trim().split("\n")) {
|
|
78
|
-
const colonIdx = line.lastIndexOf(":");
|
|
79
|
-
if (colonIdx === -1) continue;
|
|
80
|
-
const filePath = line.slice(0, colonIdx);
|
|
81
|
-
const matchCount = parseInt(line.slice(colonIdx + 1));
|
|
82
|
-
if (isNaN(matchCount) || matchCount === 0) continue;
|
|
83
|
-
try {
|
|
84
|
-
const firstMatch = execSync(
|
|
85
|
-
`rg -i -n --hidden '${pattern.replace(/'/g, "\\'")}' '${filePath}' --max-count 1 2>/dev/null | head -1`,
|
|
86
|
-
{ cwd: projectRoot, encoding: "utf8", timeout: 1e3 }
|
|
87
|
-
).trim();
|
|
88
|
-
const lineNum = parseInt(firstMatch.split(":")[0] ?? "1");
|
|
89
|
-
const totalLines = execSync(`wc -l < '${filePath}'`, {
|
|
90
|
-
cwd: projectRoot,
|
|
91
|
-
encoding: "utf8",
|
|
92
|
-
timeout: 1e3
|
|
93
|
-
}).trim();
|
|
94
|
-
hits.push({
|
|
95
|
-
filePath,
|
|
96
|
-
lineNumber: isNaN(lineNum) ? 1 : lineNum,
|
|
97
|
-
matchLine: firstMatch.slice(firstMatch.indexOf(":") + 1).slice(0, 200),
|
|
98
|
-
matchCount,
|
|
99
|
-
totalLines: parseInt(totalLines) || 1,
|
|
100
|
-
density: matchCount / (parseInt(totalLines) || 1)
|
|
101
|
-
});
|
|
102
|
-
} catch {
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return hits;
|
|
106
|
-
}
|
|
107
|
-
function grepWithNodeFs(pattern, projectRoot, patterns) {
|
|
108
|
-
const regex = new RegExp(pattern, "gi");
|
|
109
|
-
const files = collectFiles(projectRoot, patterns ?? DEFAULT_PATTERNS);
|
|
110
|
-
const hits = [];
|
|
111
|
-
for (const filePath of files.slice(0, MAX_FILES)) {
|
|
112
|
-
const absPath = path.join(projectRoot, filePath);
|
|
113
|
-
try {
|
|
114
|
-
const stat = statSync(absPath);
|
|
115
|
-
if (stat.size > MAX_FILE_SIZE) continue;
|
|
116
|
-
const content = readFileSync(absPath, "utf8");
|
|
117
|
-
const lines = content.split("\n");
|
|
118
|
-
const matches = content.match(regex);
|
|
119
|
-
if (!matches || matches.length === 0) continue;
|
|
120
|
-
const firstMatchIdx = lines.findIndex((l) => regex.test(l));
|
|
121
|
-
regex.lastIndex = 0;
|
|
122
|
-
hits.push({
|
|
123
|
-
filePath,
|
|
124
|
-
lineNumber: firstMatchIdx >= 0 ? firstMatchIdx + 1 : 1,
|
|
125
|
-
matchLine: firstMatchIdx >= 0 ? lines[firstMatchIdx].slice(0, 200) : "",
|
|
126
|
-
matchCount: matches.length,
|
|
127
|
-
totalLines: lines.length,
|
|
128
|
-
density: matches.length / lines.length
|
|
129
|
-
});
|
|
130
|
-
} catch {
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return hits;
|
|
134
|
-
}
|
|
135
|
-
function collectFiles(root, patterns) {
|
|
136
|
-
const files = [];
|
|
137
|
-
function walk(dir, relative) {
|
|
138
|
-
if (files.length >= MAX_FILES) return;
|
|
139
|
-
const basename = path.basename(dir);
|
|
140
|
-
if (EXCLUDE_DIRS.includes(basename)) return;
|
|
141
|
-
try {
|
|
142
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
143
|
-
for (const entry of entries) {
|
|
144
|
-
if (files.length >= MAX_FILES) return;
|
|
145
|
-
const rel = path.join(relative, entry.name);
|
|
146
|
-
if (entry.isDirectory()) {
|
|
147
|
-
walk(path.join(dir, entry.name), rel);
|
|
148
|
-
} else if (entry.isFile()) {
|
|
149
|
-
for (const pat of patterns) {
|
|
150
|
-
if (matchGlob(rel, pat)) {
|
|
151
|
-
files.push(rel);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
} catch {
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
walk(root, "");
|
|
161
|
-
return files;
|
|
162
|
-
}
|
|
163
|
-
function matchGlob(filePath, pattern) {
|
|
164
|
-
if (!pattern.includes("*")) return filePath === pattern;
|
|
165
|
-
const doubleStarMatch = pattern.match(/^(.+?)\/\*\*\/\*(\.\w+)$/);
|
|
166
|
-
if (doubleStarMatch) {
|
|
167
|
-
const dir = doubleStarMatch[1];
|
|
168
|
-
const ext2 = doubleStarMatch[2];
|
|
169
|
-
return filePath.startsWith(dir + "/") && filePath.endsWith(ext2);
|
|
170
|
-
}
|
|
171
|
-
if (pattern.startsWith("**/")) {
|
|
172
|
-
const ext2 = pattern.slice(3).replace("*", "");
|
|
173
|
-
return filePath.endsWith(ext2);
|
|
174
|
-
}
|
|
175
|
-
const slashIdx = pattern.lastIndexOf("/");
|
|
176
|
-
if (slashIdx !== -1) {
|
|
177
|
-
const dir = pattern.slice(0, slashIdx);
|
|
178
|
-
const ext2 = pattern.slice(slashIdx + 1).replace("*", "");
|
|
179
|
-
const fileDir = path.dirname(filePath);
|
|
180
|
-
return fileDir === dir && filePath.endsWith(ext2);
|
|
181
|
-
}
|
|
182
|
-
const ext = pattern.replace("*", "");
|
|
183
|
-
return filePath.endsWith(ext) && !filePath.includes("/");
|
|
184
|
-
}
|
|
185
|
-
function buildSnippet(hit, projectRoot) {
|
|
186
|
-
try {
|
|
187
|
-
const absPath = path.join(projectRoot, hit.filePath);
|
|
188
|
-
if (!existsSync(absPath)) return hit.matchLine;
|
|
189
|
-
const lines = readFileSync(absPath, "utf8").split("\n");
|
|
190
|
-
const start = Math.max(0, hit.lineNumber - 3);
|
|
191
|
-
const end = Math.min(lines.length, hit.lineNumber + 2);
|
|
192
|
-
return lines.slice(start, end).join("\n").slice(0, 500);
|
|
193
|
-
} catch {
|
|
194
|
-
return hit.matchLine;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
export {
|
|
198
|
-
grepProjectFiles
|
|
199
|
-
};
|