@ariestools/toolchain 8.7.19 → 8.7.20
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.
|
@@ -2,6 +2,7 @@ import { type WorkItem, type WorkQueue, type WorkStatus, type WorkType } from '.
|
|
|
2
2
|
export * from './id.ts';
|
|
3
3
|
export * from './inline.ts';
|
|
4
4
|
export * from './priority.ts';
|
|
5
|
+
export * from './render.ts';
|
|
5
6
|
export * from './schema.ts';
|
|
6
7
|
export * from './store.ts';
|
|
7
8
|
interface WorkActionResult<T> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/work/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/work/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,aAAa,CAAA;AAapB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAE1B,UAAU,gBAAgB,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAA;IACP,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC,CAAA;QACP,UAAU,EAAE,CAAC,CAAA;QACb,YAAY,EAAE,CAAC,CAAA;KAChB,CAAA;IACD,QAAQ,EAAE,CAAC,CAAA;CACZ;AAiCD,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,QAAQ,GAAI,UAAS,eAAoB;;;;;;;EAcrD,CAAA;AAED,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,IAAI,C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AAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,IAAI,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACjC;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,iBAAiB;;EA2BpD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,YAAmB,KAAG,OAErD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WorkItem } from './schema.ts';
|
|
2
|
+
export declare const formatWorkTable: (items: readonly WorkItem[], formula: string) => string;
|
|
3
|
+
export declare const printWorkItemsTable: (items: readonly WorkItem[], formula: string) => void;
|
|
4
|
+
export declare const printWorkItemSummary: (item: WorkItem, score?: number) => void;
|
|
5
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/actions/work/render.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAgF3C,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,QAAQ,EAAE,EAAE,SAAS,MAAM,KAAG,MAsB7E,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,QAAQ,EAAE,EAC1B,SAAS,MAAM,KACd,IAOF,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,MAAM,QAAQ,EAAE,QAAQ,MAAM,KAAG,IAGrE,CAAA"}
|
package/dist/bin/xy.mjs
CHANGED
|
@@ -49386,26 +49386,26 @@ function sortRules(rules) {
|
|
|
49386
49386
|
return command === 0 ? left.id.localeCompare(right.id) : command;
|
|
49387
49387
|
});
|
|
49388
49388
|
}
|
|
49389
|
-
function maxWidth(header, values, max = Infinity) {
|
|
49389
|
+
function maxWidth$1(header, values, max = Infinity) {
|
|
49390
49390
|
return Math.min(max, Math.max(header.length, ...values.map((value) => value.length)));
|
|
49391
49391
|
}
|
|
49392
|
-
function resolveTableWidth() {
|
|
49392
|
+
function resolveTableWidth$1() {
|
|
49393
49393
|
const columns = process.stdout.isTTY ? process.stdout.columns : void 0;
|
|
49394
49394
|
return Math.max(72, Math.min(columns ?? 120, 160) - 2);
|
|
49395
49395
|
}
|
|
49396
49396
|
function resolveRuleTableWidths(rows, hasWeight) {
|
|
49397
49397
|
const columnCount = hasWeight ? 5 : 4;
|
|
49398
49398
|
const tableChromeWidth = columnCount + 1 + columnCount * 2;
|
|
49399
|
-
const level = maxWidth("Level", rows.map((row) => row.level));
|
|
49400
|
-
const fix = maxWidth("Fix", rows.map((row) => row.fix));
|
|
49401
|
-
const weight = hasWeight ? maxWidth("Weight", rows.map((row) => row.weight), 12) : void 0;
|
|
49402
|
-
let id = maxWidth("Rule", rows.map((row) => row.id), 56);
|
|
49399
|
+
const level = maxWidth$1("Level", rows.map((row) => row.level));
|
|
49400
|
+
const fix = maxWidth$1("Fix", rows.map((row) => row.fix));
|
|
49401
|
+
const weight = hasWeight ? maxWidth$1("Weight", rows.map((row) => row.weight), 12) : void 0;
|
|
49402
|
+
let id = maxWidth$1("Rule", rows.map((row) => row.id), 56);
|
|
49403
49403
|
const fixedWidth = () => tableChromeWidth + level + fix + id + (weight ?? 0);
|
|
49404
49404
|
const minimumDescription = 28;
|
|
49405
|
-
const tableWidth = resolveTableWidth();
|
|
49405
|
+
const tableWidth = resolveTableWidth$1();
|
|
49406
49406
|
if (tableWidth - fixedWidth() < minimumDescription) id = Math.max(24, id - (minimumDescription - (tableWidth - fixedWidth())));
|
|
49407
49407
|
const availableDescription = Math.max(20, tableWidth - fixedWidth());
|
|
49408
|
-
const naturalDescription = maxWidth("Description", rows.map((row) => row.description), 72);
|
|
49408
|
+
const naturalDescription = maxWidth$1("Description", rows.map((row) => row.description), 72);
|
|
49409
49409
|
return {
|
|
49410
49410
|
description: Math.min(naturalDescription, availableDescription),
|
|
49411
49411
|
fix,
|
|
@@ -50870,6 +50870,100 @@ const priorityFromPartial = (partial) => {
|
|
|
50870
50870
|
};
|
|
50871
50871
|
};
|
|
50872
50872
|
//#endregion
|
|
50873
|
+
//#region src/actions/work/render.ts
|
|
50874
|
+
const maxWidth = (headerLabel, values, max = Infinity) => {
|
|
50875
|
+
return Math.min(max, Math.max(headerLabel.length, ...values.map((value) => value.length)));
|
|
50876
|
+
};
|
|
50877
|
+
const resolveTableWidth = () => {
|
|
50878
|
+
const columns = process.stdout.isTTY ? process.stdout.columns : void 0;
|
|
50879
|
+
return Math.max(72, Math.min(columns ?? 120, 160) - 2);
|
|
50880
|
+
};
|
|
50881
|
+
const resolveWorkTableWidths = (rows) => {
|
|
50882
|
+
const tableChromeWidth = 19;
|
|
50883
|
+
const id = maxWidth("ID", rows.map((row) => row.id), 28);
|
|
50884
|
+
const status = maxWidth("Status", rows.map((row) => row.status), 12);
|
|
50885
|
+
const type = maxWidth("Type", rows.map((row) => row.type), 12);
|
|
50886
|
+
const score = maxWidth("Score", rows.map((row) => row.score), 8);
|
|
50887
|
+
const area = maxWidth("Area", rows.map((row) => row.area), 20);
|
|
50888
|
+
const fixedWidth = tableChromeWidth + id + status + type + score + area;
|
|
50889
|
+
const availableTitle = Math.max(20, resolveTableWidth() - fixedWidth);
|
|
50890
|
+
const naturalTitle = maxWidth("Title", rows.map((row) => row.title), 72);
|
|
50891
|
+
return {
|
|
50892
|
+
area,
|
|
50893
|
+
id,
|
|
50894
|
+
score,
|
|
50895
|
+
status,
|
|
50896
|
+
title: Math.min(naturalTitle, availableTitle),
|
|
50897
|
+
type
|
|
50898
|
+
};
|
|
50899
|
+
};
|
|
50900
|
+
const workTableConfig = (widths) => ({
|
|
50901
|
+
border: (0, import_src.getBorderCharacters)("norc"),
|
|
50902
|
+
columnDefault: {
|
|
50903
|
+
paddingLeft: 1,
|
|
50904
|
+
paddingRight: 1,
|
|
50905
|
+
wrapWord: true
|
|
50906
|
+
},
|
|
50907
|
+
columns: {
|
|
50908
|
+
0: { width: widths.id },
|
|
50909
|
+
1: { width: widths.status },
|
|
50910
|
+
2: { width: widths.type },
|
|
50911
|
+
3: {
|
|
50912
|
+
alignment: "right",
|
|
50913
|
+
width: widths.score
|
|
50914
|
+
},
|
|
50915
|
+
4: { width: widths.area },
|
|
50916
|
+
5: { width: widths.title }
|
|
50917
|
+
},
|
|
50918
|
+
drawHorizontalLine: (index, size) => [
|
|
50919
|
+
0,
|
|
50920
|
+
1,
|
|
50921
|
+
size
|
|
50922
|
+
].includes(index)
|
|
50923
|
+
});
|
|
50924
|
+
const toRow = (item, formula) => {
|
|
50925
|
+
const score = calculatePriorityScore(item.priority, formula);
|
|
50926
|
+
return {
|
|
50927
|
+
area: item.area ?? "-",
|
|
50928
|
+
id: item.id,
|
|
50929
|
+
score: score === void 0 ? "-" : String(score),
|
|
50930
|
+
status: item.status,
|
|
50931
|
+
title: item.title,
|
|
50932
|
+
type: item.type
|
|
50933
|
+
};
|
|
50934
|
+
};
|
|
50935
|
+
const formatWorkTable = (items, formula) => {
|
|
50936
|
+
const rows = items.map((item) => toRow(item, formula));
|
|
50937
|
+
const widths = resolveWorkTableWidths(rows);
|
|
50938
|
+
return (0, import_src.table)([[
|
|
50939
|
+
chalk.gray.bold("ID"),
|
|
50940
|
+
chalk.gray.bold("Status"),
|
|
50941
|
+
chalk.gray.bold("Type"),
|
|
50942
|
+
chalk.gray.bold("Score"),
|
|
50943
|
+
chalk.gray.bold("Area"),
|
|
50944
|
+
chalk.gray.bold("Title")
|
|
50945
|
+
], ...rows.map((row) => [
|
|
50946
|
+
chalk.cyan(row.id),
|
|
50947
|
+
chalk.white(row.status),
|
|
50948
|
+
chalk.white(row.type),
|
|
50949
|
+
chalk.gray(row.score),
|
|
50950
|
+
chalk.gray(row.area),
|
|
50951
|
+
chalk.white(row.title)
|
|
50952
|
+
])], workTableConfig(widths)).trimEnd();
|
|
50953
|
+
};
|
|
50954
|
+
const printWorkItemsTable = (items, formula) => {
|
|
50955
|
+
if (isJsonMode()) return;
|
|
50956
|
+
if (items.length === 0) {
|
|
50957
|
+
xyLog("No work items");
|
|
50958
|
+
return;
|
|
50959
|
+
}
|
|
50960
|
+
xyLog(formatWorkTable(items, formula));
|
|
50961
|
+
};
|
|
50962
|
+
const printWorkItemSummary = (item, score) => {
|
|
50963
|
+
const scoreText = score === void 0 ? "-" : String(score);
|
|
50964
|
+
xyLog(`${item.id}\t${item.status}\t${item.type}\t${scoreText}\t${item.title}`);
|
|
50965
|
+
};
|
|
50966
|
+
//#endregion
|
|
50873
50967
|
//#region src/actions/work/index.ts
|
|
50874
50968
|
const cleanResult = (data) => {
|
|
50875
50969
|
return {
|
|
@@ -50883,10 +50977,6 @@ const cleanResult = (data) => {
|
|
|
50883
50977
|
};
|
|
50884
50978
|
};
|
|
50885
50979
|
const nowIso = (now = /* @__PURE__ */ new Date()) => now.toISOString();
|
|
50886
|
-
const printItemSummary = (item, score) => {
|
|
50887
|
-
const scoreText = score === void 0 ? "-" : String(score);
|
|
50888
|
-
xyLog(`${item.id}\t${item.status}\t${item.type}\t${scoreText}\t${item.title}`);
|
|
50889
|
-
};
|
|
50890
50980
|
const normalizeTags = (tags) => {
|
|
50891
50981
|
return [...new Set((tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0))].toSorted();
|
|
50892
50982
|
};
|
|
@@ -50972,7 +51062,7 @@ const workList = (options = {}) => {
|
|
|
50972
51062
|
const cwd = options.cwd ?? process.cwd();
|
|
50973
51063
|
const config = readWorkConfig(cwd);
|
|
50974
51064
|
const items = selectWorkItems(listWorkItems(cwd), options, config.priority.formula);
|
|
50975
|
-
|
|
51065
|
+
printWorkItemsTable(items, config.priority.formula);
|
|
50976
51066
|
return cleanResult({ items });
|
|
50977
51067
|
};
|
|
50978
51068
|
const workShow = (options) => {
|
|
@@ -50984,8 +51074,10 @@ const needsTriage = (item) => {
|
|
|
50984
51074
|
return item.status === "open" && (item.priority === void 0 || item.area === void 0 || item.acceptanceCriteria.length === 0 || item.verification.length === 0);
|
|
50985
51075
|
};
|
|
50986
51076
|
const workTriage = (options = {}) => {
|
|
50987
|
-
const
|
|
50988
|
-
|
|
51077
|
+
const cwd = options.cwd ?? process.cwd();
|
|
51078
|
+
const config = readWorkConfig(cwd);
|
|
51079
|
+
const items = listWorkItems(cwd).filter(needsTriage);
|
|
51080
|
+
printWorkItemsTable(items, config.priority.formula);
|
|
50989
51081
|
return cleanResult({ items });
|
|
50990
51082
|
};
|
|
50991
51083
|
const workQueue = (options = {}) => {
|
|
@@ -51038,7 +51130,7 @@ const workNext = (options = {}) => {
|
|
|
51038
51130
|
return cleanResult({ item: void 0 });
|
|
51039
51131
|
}
|
|
51040
51132
|
const next = options.claim === true ? claimItem(cwd, item, options.now) : item;
|
|
51041
|
-
|
|
51133
|
+
printWorkItemSummary(next, calculatePriorityScore(next.priority, config.priority.formula));
|
|
51042
51134
|
return cleanResult({ item: next });
|
|
51043
51135
|
};
|
|
51044
51136
|
const claimItem = (cwd, item, now) => {
|