@use-aistack/cli 0.16.3 → 0.16.4
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/index.js +62 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18891,7 +18891,7 @@ function apiEquivalentCost(modelKey, t, atMs) {
|
|
|
18891
18891
|
}
|
|
18892
18892
|
|
|
18893
18893
|
// src/version.ts
|
|
18894
|
-
var CLI_VERSION = true ? "0.16.
|
|
18894
|
+
var CLI_VERSION = true ? "0.16.4" : "0.0.0-dev";
|
|
18895
18895
|
|
|
18896
18896
|
// src/api.ts
|
|
18897
18897
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
@@ -27738,7 +27738,7 @@ function selectDaysToPublish(input) {
|
|
|
27738
27738
|
import { execFile, execFileSync as execFileSync2 } from "node:child_process";
|
|
27739
27739
|
import path12 from "node:path";
|
|
27740
27740
|
var TEST_FILE_RULE_VERSION = "test-files/v2";
|
|
27741
|
-
var FILE_TYPE_RULE_VERSION = "file-types/
|
|
27741
|
+
var FILE_TYPE_RULE_VERSION = "file-types/v3";
|
|
27742
27742
|
var COMMIT_SET_RULE_VERSION = "commit-set/v1";
|
|
27743
27743
|
var defaultRunner = (cwd, args) => {
|
|
27744
27744
|
try {
|
|
@@ -27877,6 +27877,8 @@ function isUnauthoredPath(file) {
|
|
|
27877
27877
|
return UNAUTHORED_BASENAMES.has(parts.at(-1) ?? "");
|
|
27878
27878
|
}
|
|
27879
27879
|
var COMMIT_MARKER = "aistack-commit";
|
|
27880
|
+
var BIG_FILE_THRESHOLD = "1m";
|
|
27881
|
+
var GIT_CONCURRENCY = 4;
|
|
27880
27882
|
function parseNumstat(field) {
|
|
27881
27883
|
const normalized = field.replace(/^\n+(?=(?:\d+|-)\t)/, "");
|
|
27882
27884
|
const firstTab = normalized.indexOf(" ");
|
|
@@ -27913,35 +27915,79 @@ function isLateNight(hour) {
|
|
|
27913
27915
|
}
|
|
27914
27916
|
function extractGitWorkflow(options) {
|
|
27915
27917
|
const run = options.run ?? defaultRunner;
|
|
27916
|
-
const roots = /* @__PURE__ */ new
|
|
27918
|
+
const roots = /* @__PURE__ */ new Map();
|
|
27917
27919
|
for (const directory of options.workingDirectories) {
|
|
27918
|
-
const root = run(directory,
|
|
27919
|
-
if (root) roots.
|
|
27920
|
+
const root = parseRepositoryRoot(run(directory, gitRevParseArgs()));
|
|
27921
|
+
if (root && !roots.has(root.key)) roots.set(root.key, root.cwd);
|
|
27920
27922
|
}
|
|
27921
27923
|
const histories = [];
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
+
let index = 0;
|
|
27925
|
+
for (const cwd of roots.values()) {
|
|
27926
|
+
const done = repositoryTimer(++index, roots.size);
|
|
27927
|
+
const history = run(cwd, gitLogArgs());
|
|
27928
|
+
done(history);
|
|
27924
27929
|
if (history) histories.push(history);
|
|
27925
27930
|
}
|
|
27926
27931
|
return reduceGitHistories(histories, options);
|
|
27927
27932
|
}
|
|
27928
27933
|
async function extractGitWorkflowAsync(options) {
|
|
27929
27934
|
const run = options.run ?? defaultAsyncRunner;
|
|
27930
|
-
const roots = /* @__PURE__ */ new
|
|
27935
|
+
const roots = /* @__PURE__ */ new Map();
|
|
27931
27936
|
for (const directory of options.workingDirectories) {
|
|
27932
|
-
const root = (await run(directory,
|
|
27933
|
-
if (root) roots.
|
|
27937
|
+
const root = parseRepositoryRoot(await run(directory, gitRevParseArgs()));
|
|
27938
|
+
if (root && !roots.has(root.key)) roots.set(root.key, root.cwd);
|
|
27934
27939
|
}
|
|
27935
|
-
const
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
|
|
27939
|
-
|
|
27940
|
-
|
|
27940
|
+
const queue = [...roots.values()];
|
|
27941
|
+
const total = queue.length;
|
|
27942
|
+
const histories = [];
|
|
27943
|
+
let index = 0;
|
|
27944
|
+
const worker = async () => {
|
|
27945
|
+
for (let cwd = queue.shift(); cwd !== void 0; cwd = queue.shift()) {
|
|
27946
|
+
const done = repositoryTimer(++index, total);
|
|
27947
|
+
const history = await run(cwd, gitLogArgs());
|
|
27948
|
+
done(history);
|
|
27949
|
+
if (history) histories.push(history);
|
|
27950
|
+
}
|
|
27951
|
+
};
|
|
27952
|
+
await Promise.all(
|
|
27953
|
+
Array.from({ length: Math.min(GIT_CONCURRENCY, total) }, worker)
|
|
27941
27954
|
);
|
|
27955
|
+
return reduceGitHistories(histories, options);
|
|
27956
|
+
}
|
|
27957
|
+
function gitRevParseArgs() {
|
|
27958
|
+
return [
|
|
27959
|
+
"rev-parse",
|
|
27960
|
+
"--path-format=absolute",
|
|
27961
|
+
"--git-common-dir",
|
|
27962
|
+
"--show-toplevel"
|
|
27963
|
+
];
|
|
27964
|
+
}
|
|
27965
|
+
function parseRepositoryRoot(output) {
|
|
27966
|
+
if (!output) return null;
|
|
27967
|
+
const [common, top] = output.split("\n").map((line) => line.trim());
|
|
27968
|
+
if (!common) return null;
|
|
27969
|
+
return { key: common, cwd: top || common };
|
|
27970
|
+
}
|
|
27971
|
+
function repositoryTimer(index, total) {
|
|
27972
|
+
const started = performance.now();
|
|
27973
|
+
return (history) => {
|
|
27974
|
+
const ms = Math.round(performance.now() - started);
|
|
27975
|
+
const commits = history === null ? "unreadable" : `${countCommits(history)} commits`;
|
|
27976
|
+
trace(`git repository ${index}/${total} \xB7 ${ms} ms \xB7 ${commits}`);
|
|
27977
|
+
};
|
|
27978
|
+
}
|
|
27979
|
+
function countCommits(history) {
|
|
27980
|
+
let count2 = 0;
|
|
27981
|
+
for (let at = history.indexOf(COMMIT_MARKER); at !== -1; ) {
|
|
27982
|
+
count2++;
|
|
27983
|
+
at = history.indexOf(COMMIT_MARKER, at + COMMIT_MARKER.length);
|
|
27984
|
+
}
|
|
27985
|
+
return count2;
|
|
27942
27986
|
}
|
|
27943
27987
|
function gitLogArgs() {
|
|
27944
27988
|
return [
|
|
27989
|
+
"-c",
|
|
27990
|
+
`core.bigFileThreshold=${BIG_FILE_THRESHOLD}`,
|
|
27945
27991
|
"log",
|
|
27946
27992
|
"--all",
|
|
27947
27993
|
"--no-merges",
|