@use-aistack/cli 0.20.1 → 0.20.3
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/dist/cursor-worker.js +16 -3
- package/dist/cursor-worker.js.map +1 -1
- package/dist/index.js +72 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3267,7 +3267,7 @@ var init_database = __esm({
|
|
|
3267
3267
|
});
|
|
3268
3268
|
|
|
3269
3269
|
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/private-temp.js
|
|
3270
|
-
import { chmodSync, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as readFileSync8, readlinkSync, readdirSync as readdirSync4, realpathSync, rmdirSync, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3270
|
+
import { chmodSync as chmodSync2, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as readFileSync8, readlinkSync, readdirSync as readdirSync4, realpathSync, rmdirSync, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3271
3271
|
import { tmpdir } from "node:os";
|
|
3272
3272
|
import { basename as basename3, isAbsolute, join as join7, relative as relative2, resolve, sep } from "node:path";
|
|
3273
3273
|
import { performance as performance2 } from "node:perf_hooks";
|
|
@@ -3684,7 +3684,7 @@ function createPrivateTempWorkspace(options) {
|
|
|
3684
3684
|
try {
|
|
3685
3685
|
directoryPath = mkdtempSync(join7(parentPath, options.prefix));
|
|
3686
3686
|
if (IS_PERMISSION_AWARE_POSIX)
|
|
3687
|
-
|
|
3687
|
+
chmodSync2(directoryPath, 448);
|
|
3688
3688
|
const marker = createMarker();
|
|
3689
3689
|
const markerPath = join7(directoryPath, PRIVATE_TEMP_MARKER_FILENAME);
|
|
3690
3690
|
createExclusivePrivateFile(markerPath, `${JSON.stringify(marker)}
|
|
@@ -5760,7 +5760,7 @@ var init_session_id = __esm({
|
|
|
5760
5760
|
|
|
5761
5761
|
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup.js
|
|
5762
5762
|
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
5763
|
-
import { chmodSync as
|
|
5763
|
+
import { chmodSync as chmodSync3, closeSync as closeSync3, constants as constants3, existsSync as existsSync7, copyFileSync, fchmodSync as fchmodSync3, fstatSync as fstatSync3, fsyncSync as fsyncSync2, lstatSync as lstatSync5, mkdirSync as mkdirSync2, openSync as openSync3, readFileSync as readFileSync9, readSync, readdirSync as readdirSync5, realpathSync as realpathSync2, statSync as statSync3, unlinkSync as unlinkSync4, writeSync } from "node:fs";
|
|
5764
5764
|
import { homedir as homedir10 } from "node:os";
|
|
5765
5765
|
import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute2, join as join8, relative as relative3, resolve as resolve2, sep as sep2 } from "node:path";
|
|
5766
5766
|
function backupDatabaseReadRequest(sqliteDriver, io, dbPath, logicalSessionId) {
|
|
@@ -6241,7 +6241,7 @@ async function createBackup(config) {
|
|
|
6241
6241
|
copyFileSync(dbFile.absolutePath, tempFilePath);
|
|
6242
6242
|
}
|
|
6243
6243
|
if (process.platform !== "win32")
|
|
6244
|
-
|
|
6244
|
+
chmodSync3(tempFilePath, 384);
|
|
6245
6245
|
if (dbFile.type === "global-db" || dbFile.type === "workspace-db") {
|
|
6246
6246
|
const databaseInventory = inspectComposerDatabase(tempFilePath, readOptions);
|
|
6247
6247
|
sessionCount += databaseInventory.sessionCount;
|
|
@@ -7725,7 +7725,7 @@ var init_content_evidence = __esm({
|
|
|
7725
7725
|
});
|
|
7726
7726
|
|
|
7727
7727
|
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/store-db.js
|
|
7728
|
-
import { chmodSync as
|
|
7728
|
+
import { chmodSync as chmodSync4, statSync as statSync4 } from "node:fs";
|
|
7729
7729
|
function databaseRequest(operation, required, forcedDriver, options, resourceClass = "store-database") {
|
|
7730
7730
|
return {
|
|
7731
7731
|
operation,
|
|
@@ -7781,7 +7781,7 @@ async function parseStoreDb(path16, options = {}) {
|
|
|
7781
7781
|
snapshotComplete = true;
|
|
7782
7782
|
throwIfAborted4(options.signal);
|
|
7783
7783
|
if (process.platform !== "win32")
|
|
7784
|
-
|
|
7784
|
+
chmodSync4(tmpPath, 384);
|
|
7785
7785
|
throwIfAborted4(options.signal);
|
|
7786
7786
|
db = await openDatabase(tmpPath, databaseRequest("read-session", STORE_READ_CAPABILITIES, options.sqliteDriver, options, "sqlite-snapshot"));
|
|
7787
7787
|
throwIfAborted4(options.signal);
|
|
@@ -18542,8 +18542,13 @@ var PROVIDER_VENDOR = {
|
|
|
18542
18542
|
xai: "xai"
|
|
18543
18543
|
};
|
|
18544
18544
|
var PRICING_ALIASES = {
|
|
18545
|
-
"grok-4.6-build": "grok-4.6"
|
|
18545
|
+
"grok-4.6-build": "grok-4.6",
|
|
18546
|
+
"grok-4.7-build": "grok-4.7"
|
|
18546
18547
|
};
|
|
18548
|
+
var MODEL_SETTINGS_SUFFIX = /(?:-thinking)?(?:-(?:low|medium|high|xhigh|max))?(?:-fast)?$/;
|
|
18549
|
+
function withoutModelSettings(slug) {
|
|
18550
|
+
return slug.replace(MODEL_SETTINGS_SUFFIX, "");
|
|
18551
|
+
}
|
|
18547
18552
|
var LOCAL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
18548
18553
|
"ollama",
|
|
18549
18554
|
"lmstudio",
|
|
@@ -18640,8 +18645,16 @@ var Pricer = class {
|
|
|
18640
18645
|
}
|
|
18641
18646
|
lookupSlug(slug, provider) {
|
|
18642
18647
|
if (this.firstLayerWith(slug, provider)) return slug;
|
|
18643
|
-
const
|
|
18644
|
-
|
|
18648
|
+
const base = withoutModelSettings(slug);
|
|
18649
|
+
for (const candidate of [
|
|
18650
|
+
PRICING_ALIASES[slug],
|
|
18651
|
+
base,
|
|
18652
|
+
PRICING_ALIASES[base]
|
|
18653
|
+
]) {
|
|
18654
|
+
if (candidate && this.firstLayerWith(candidate, provider))
|
|
18655
|
+
return candidate;
|
|
18656
|
+
}
|
|
18657
|
+
return null;
|
|
18645
18658
|
}
|
|
18646
18659
|
/**
|
|
18647
18660
|
* Every period that applies to a pricing key, or an empty list when none
|
|
@@ -18906,7 +18919,7 @@ function apiEquivalentCost(modelKey, t, atMs) {
|
|
|
18906
18919
|
}
|
|
18907
18920
|
|
|
18908
18921
|
// src/version.ts
|
|
18909
|
-
var CLI_VERSION = true ? "0.20.
|
|
18922
|
+
var CLI_VERSION = true ? "0.20.3" : "0.0.0-dev";
|
|
18910
18923
|
|
|
18911
18924
|
// src/api.ts
|
|
18912
18925
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
@@ -19182,7 +19195,13 @@ function classify(files) {
|
|
|
19182
19195
|
|
|
19183
19196
|
// src/config.ts
|
|
19184
19197
|
import { randomBytes } from "node:crypto";
|
|
19185
|
-
import {
|
|
19198
|
+
import {
|
|
19199
|
+
chmodSync,
|
|
19200
|
+
existsSync,
|
|
19201
|
+
mkdirSync,
|
|
19202
|
+
readFileSync,
|
|
19203
|
+
writeFileSync
|
|
19204
|
+
} from "node:fs";
|
|
19186
19205
|
import { homedir } from "node:os";
|
|
19187
19206
|
import { dirname as dirname2, join } from "node:path";
|
|
19188
19207
|
var CONFIG_DIR = join(homedir(), ".config", "aistack");
|
|
@@ -19216,8 +19235,9 @@ function readCredentials(file) {
|
|
|
19216
19235
|
}
|
|
19217
19236
|
}
|
|
19218
19237
|
function writeCredentials(file, data) {
|
|
19219
|
-
mkdirSync(dirname2(file), { recursive: true });
|
|
19220
|
-
writeFileSync(file, JSON.stringify(data, null, 2));
|
|
19238
|
+
mkdirSync(dirname2(file), { recursive: true, mode: 448 });
|
|
19239
|
+
writeFileSync(file, JSON.stringify(data, null, 2), { mode: 384 });
|
|
19240
|
+
if (process.platform !== "win32") chmodSync(file, 384);
|
|
19221
19241
|
}
|
|
19222
19242
|
function getToken(serverUrl = BASE_URL, file = CREDENTIALS_FILE) {
|
|
19223
19243
|
const { data, legacy } = readCredentials(file);
|
|
@@ -22723,7 +22743,12 @@ function buildPayload(input) {
|
|
|
22723
22743
|
[...agg.projectDirs].map((directory) => projectWorkspaceId(directory))
|
|
22724
22744
|
)
|
|
22725
22745
|
].sort();
|
|
22726
|
-
if (projectKeys.length > 1e3
|
|
22746
|
+
if (projectKeys.length > 1e3) {
|
|
22747
|
+
throw new Error(
|
|
22748
|
+
"A harness snapshot can contain at most 1,000 project workspace identifiers"
|
|
22749
|
+
);
|
|
22750
|
+
}
|
|
22751
|
+
if (projectKeys.some((key2) => !/^[A-Za-z0-9_-]{22}$/.test(key2))) {
|
|
22727
22752
|
throw new Error(
|
|
22728
22753
|
"Project workspace identifiers must be 22-character base64url strings"
|
|
22729
22754
|
);
|
|
@@ -26817,11 +26842,13 @@ function ingestContribution(agg, row) {
|
|
|
26817
26842
|
agg.distinctResponses++;
|
|
26818
26843
|
agg.sessions.add(row.sessionId);
|
|
26819
26844
|
agg.activeDays.add(new Date(row.tsMs).toISOString().slice(0, 10));
|
|
26820
|
-
agg.projectDirs.add(row.projectDir);
|
|
26821
26845
|
agg.firstTs = agg.firstTs === null ? row.tsMs : Math.min(agg.firstTs, row.tsMs);
|
|
26822
26846
|
agg.lastTs = agg.lastTs === null ? row.tsMs : Math.max(agg.lastTs, row.tsMs);
|
|
26823
26847
|
noteSessionStart(agg, row.sessionId, row.tsMs);
|
|
26824
|
-
|
|
26848
|
+
if (row.projectDir !== void 0) {
|
|
26849
|
+
agg.projectDirs.add(row.projectDir);
|
|
26850
|
+
noteProjectDay(agg, row.projectDir, row.tsMs);
|
|
26851
|
+
}
|
|
26825
26852
|
for (const { model, counts: tokenCounts } of row.models) {
|
|
26826
26853
|
const key2 = normalizeModel(model);
|
|
26827
26854
|
addModelUsage(
|
|
@@ -27011,6 +27038,23 @@ async function stableRead(file, jsonl) {
|
|
|
27011
27038
|
trace("grok evidence incomplete \xB7 retries exhausted", "error");
|
|
27012
27039
|
return { complete: false };
|
|
27013
27040
|
}
|
|
27041
|
+
function absoluteCwd(value) {
|
|
27042
|
+
const cwd = asStr(value);
|
|
27043
|
+
return cwd && path11.isAbsolute(cwd) && !cwd.includes("\0") ? cwd : void 0;
|
|
27044
|
+
}
|
|
27045
|
+
async function workspaceCwd(workspacePath, entries) {
|
|
27046
|
+
try {
|
|
27047
|
+
const cwd = absoluteCwd(decodeURIComponent(path11.basename(workspacePath)));
|
|
27048
|
+
if (cwd !== void 0) return cwd;
|
|
27049
|
+
} catch {
|
|
27050
|
+
}
|
|
27051
|
+
if (entries.some((entry) => entry.name === ".cwd" && entry.isFile())) {
|
|
27052
|
+
const raw = await readFile4(path11.join(workspacePath, ".cwd"), "utf8").catch(
|
|
27053
|
+
() => void 0
|
|
27054
|
+
);
|
|
27055
|
+
return absoluteCwd(raw);
|
|
27056
|
+
}
|
|
27057
|
+
}
|
|
27014
27058
|
async function directories(root) {
|
|
27015
27059
|
try {
|
|
27016
27060
|
const workspaces = await readdir6(root, { withFileTypes: true });
|
|
@@ -27018,14 +27062,19 @@ async function directories(root) {
|
|
|
27018
27062
|
for (const workspace of workspaces) {
|
|
27019
27063
|
if (!workspace.isDirectory() || workspace.isSymbolicLink()) continue;
|
|
27020
27064
|
const workspacePath = path11.join(root, workspace.name);
|
|
27021
|
-
|
|
27065
|
+
const entries = await readdir6(workspacePath, {
|
|
27022
27066
|
withFileTypes: true
|
|
27023
|
-
})
|
|
27067
|
+
});
|
|
27068
|
+
const cwd = await workspaceCwd(workspacePath, entries);
|
|
27069
|
+
for (const session of entries) {
|
|
27024
27070
|
if (session.isDirectory() && !session.isSymbolicLink())
|
|
27025
|
-
out.push(path11.join(workspacePath, session.name));
|
|
27071
|
+
out.push({ dir: path11.join(workspacePath, session.name), cwd });
|
|
27026
27072
|
}
|
|
27027
27073
|
}
|
|
27028
|
-
return out.sort()
|
|
27074
|
+
return out.sort((a, b) => {
|
|
27075
|
+
if (a.dir === b.dir) return 0;
|
|
27076
|
+
return a.dir < b.dir ? -1 : 1;
|
|
27077
|
+
});
|
|
27029
27078
|
} catch (error) {
|
|
27030
27079
|
if (error.code !== "ENOENT")
|
|
27031
27080
|
traceError("grok session discovery", error);
|
|
@@ -27074,7 +27123,7 @@ async function scanWindows2(windows, opts = {}) {
|
|
|
27074
27123
|
complete = false;
|
|
27075
27124
|
continue;
|
|
27076
27125
|
}
|
|
27077
|
-
for (const dir of dirs) {
|
|
27126
|
+
for (const { dir, cwd } of dirs) {
|
|
27078
27127
|
let entries;
|
|
27079
27128
|
try {
|
|
27080
27129
|
entries = await readdir6(dir, { withFileTypes: true });
|
|
@@ -27088,7 +27137,7 @@ async function scanWindows2(windows, opts = {}) {
|
|
|
27088
27137
|
(e) => e.isFile() && (isGrokEvidenceFile(e.name) || e.name === "summary.json")
|
|
27089
27138
|
).map((e) => [e.name, path11.join(dir, e.name)])
|
|
27090
27139
|
);
|
|
27091
|
-
let projectDir =
|
|
27140
|
+
let projectDir = cwd;
|
|
27092
27141
|
let sessionFallback = path11.basename(dir);
|
|
27093
27142
|
let child = false;
|
|
27094
27143
|
let parentSession;
|
|
@@ -27102,7 +27151,7 @@ async function scanWindows2(windows, opts = {}) {
|
|
|
27102
27151
|
}
|
|
27103
27152
|
const value = asObj(read3.json);
|
|
27104
27153
|
const info = value && asObj(value.info);
|
|
27105
|
-
projectDir =
|
|
27154
|
+
projectDir = absoluteCwd(info?.cwd) ?? absoluteCwd(value?.cwd) ?? cwd;
|
|
27106
27155
|
sessionFallback = asStr(value?.sessionId) ?? sessionFallback;
|
|
27107
27156
|
parentSession = asStr(value?.parentSessionId) ?? asStr(value?.parent_session_id) ?? asStr(info?.parentSessionId) ?? asStr(info?.parent_session_id) ?? void 0;
|
|
27108
27157
|
child = parentSession !== void 0;
|