@ariestools/toolchain 8.7.18 → 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.
- package/dist/actions/barrel/checkBarrelImportRestrictions.d.ts +10 -1
- package/dist/actions/barrel/checkBarrelImportRestrictions.d.ts.map +1 -1
- package/dist/actions/clean.d.ts +0 -1
- package/dist/actions/clean.d.ts.map +1 -1
- package/dist/actions/work/index.d.ts +1 -0
- package/dist/actions/work/index.d.ts.map +1 -1
- package/dist/actions/work/render.d.ts +5 -0
- package/dist/actions/work/render.d.ts.map +1 -0
- package/dist/bin/xy.mjs +189 -22
- package/dist/bin/xy.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { BarrelDescriptor } from '../lint-init.ts';
|
|
2
2
|
export type BarrelRestrictionIssueKind = 'incomplete' | 'missing';
|
|
3
|
+
/** One import of a barrel sub-package that should be restricted. */
|
|
4
|
+
export interface BarrelRestrictionImportSite {
|
|
5
|
+
file: string;
|
|
6
|
+
line: number;
|
|
7
|
+
subPackage: string;
|
|
8
|
+
/** Workspace package name that owns `file`, when known. */
|
|
9
|
+
workspacePackage?: string;
|
|
10
|
+
}
|
|
3
11
|
export interface BarrelRestrictionIssue {
|
|
4
12
|
descriptor: BarrelDescriptor;
|
|
13
|
+
importSites: BarrelRestrictionImportSite[];
|
|
5
14
|
kind: BarrelRestrictionIssueKind;
|
|
6
15
|
missingFromConfig: string[];
|
|
7
16
|
usedSubPackages: string[];
|
|
8
17
|
}
|
|
9
18
|
export declare function findBarrelImportRestrictionIssues(rootDir: string): Promise<BarrelRestrictionIssue[]>;
|
|
10
|
-
export declare function reportBarrelImportRestrictionIssues(issues: readonly BarrelRestrictionIssue[]): number;
|
|
19
|
+
export declare function reportBarrelImportRestrictionIssues(issues: readonly BarrelRestrictionIssue[], rootDir?: string): number;
|
|
11
20
|
export declare function checkBarrelImportRestrictions(rootDir: string): Promise<number>;
|
|
12
21
|
//# sourceMappingURL=checkBarrelImportRestrictions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkBarrelImportRestrictions.d.ts","sourceRoot":"","sources":["../../../src/actions/barrel/checkBarrelImportRestrictions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkBarrelImportRestrictions.d.ts","sourceRoot":"","sources":["../../../src/actions/barrel/checkBarrelImportRestrictions.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAWvD,MAAM,MAAM,0BAA0B,GAAG,YAAY,GAAG,SAAS,CAAA;AAEjE,oEAAoE;AACpE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,WAAW,EAAE,2BAA2B,EAAE,CAAA;IAC1C,IAAI,EAAE,0BAA0B,CAAA;IAChC,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AAqJD,wBAAsB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA0B1G;AAmCD,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,SAAS,sBAAsB,EAAE,EACzC,OAAO,SAAgB,GACtB,MAAM,CAyBR;AAED,wBAAsB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGpF"}
|
package/dist/actions/clean.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/actions/clean.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/actions/clean.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,aAAa,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,aAAa,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAiED,eAAO,MAAM,KAAK,GAAU,qDAEzB,WAAW,oBASb,CAAA;AAED,eAAO,MAAM,YAAY,GAAU,mBAA4B,kBAAkB,oBAoBhF,CAAA;AAaD,eAAO,MAAM,QAAQ,GAAU,gDAE5B,WAAW,oBAoCb,CAAA"}
|
|
@@ -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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ly 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
|
@@ -27063,7 +27063,53 @@ function collectDescriptorBarrelInfo(configDir, descriptors) {
|
|
|
27063
27063
|
}
|
|
27064
27064
|
return info;
|
|
27065
27065
|
}
|
|
27066
|
-
function
|
|
27066
|
+
function allReferencesForUsage(usage) {
|
|
27067
|
+
const references = [...usage.defaultReferences, ...usage.namespaceReferences];
|
|
27068
|
+
for (const named of usage.namedReferences.values()) references.push(...named);
|
|
27069
|
+
return references;
|
|
27070
|
+
}
|
|
27071
|
+
function workspacePackageForFile(file, rootDir, workspaces) {
|
|
27072
|
+
const absFile = PATH.resolve(file);
|
|
27073
|
+
let best;
|
|
27074
|
+
for (const workspace of workspaces) {
|
|
27075
|
+
const locationAbs = PATH.resolve(rootDir, workspace.location);
|
|
27076
|
+
if ((absFile === locationAbs || absFile.startsWith(locationAbs + PATH.sep)) && (best === void 0 || locationAbs.length > best.length)) best = {
|
|
27077
|
+
length: locationAbs.length,
|
|
27078
|
+
location: workspace.location,
|
|
27079
|
+
name: workspace.name
|
|
27080
|
+
};
|
|
27081
|
+
}
|
|
27082
|
+
return best?.name;
|
|
27083
|
+
}
|
|
27084
|
+
function pushUniqueImportSites(sites, seen, subPackage, usage, rootDir, workspaces) {
|
|
27085
|
+
for (const reference of allReferencesForUsage(usage)) {
|
|
27086
|
+
const key = `${reference.file}:${reference.line}:${subPackage}`;
|
|
27087
|
+
if (seen.has(key)) continue;
|
|
27088
|
+
seen.add(key);
|
|
27089
|
+
sites.push({
|
|
27090
|
+
file: reference.file,
|
|
27091
|
+
line: reference.line,
|
|
27092
|
+
subPackage,
|
|
27093
|
+
workspacePackage: workspacePackageForFile(reference.file, rootDir, workspaces)
|
|
27094
|
+
});
|
|
27095
|
+
}
|
|
27096
|
+
}
|
|
27097
|
+
function importSitesForSubPackages(subPackages, usage, rootDir, workspaces) {
|
|
27098
|
+
const sites = [];
|
|
27099
|
+
for (const subPackage of subPackages) {
|
|
27100
|
+
const entry = usage.get(subPackage);
|
|
27101
|
+
if (entry === void 0) continue;
|
|
27102
|
+
pushUniqueImportSites(sites, /* @__PURE__ */ new Set(), subPackage, entry, rootDir, workspaces);
|
|
27103
|
+
}
|
|
27104
|
+
return sites.toSorted((left, right) => {
|
|
27105
|
+
const byPkg = left.subPackage.localeCompare(right.subPackage);
|
|
27106
|
+
if (byPkg !== 0) return byPkg;
|
|
27107
|
+
const byFile = left.file.localeCompare(right.file);
|
|
27108
|
+
if (byFile !== 0) return byFile;
|
|
27109
|
+
return left.line - right.line;
|
|
27110
|
+
});
|
|
27111
|
+
}
|
|
27112
|
+
function findRestrictionIssues(barrelInfo, restrictedPaths, isRuleEnabled, usage, source, rootDir, workspaces) {
|
|
27067
27113
|
const issues = [];
|
|
27068
27114
|
for (const { descriptor, subPackages } of barrelInfo) {
|
|
27069
27115
|
const usedSubPackages = subPackages.filter((pkg) => usage.has(pkg));
|
|
@@ -27071,17 +27117,22 @@ function findRestrictionIssues(barrelInfo, restrictedPaths, isRuleEnabled, usage
|
|
|
27071
27117
|
const configured = configuredNamesForDescriptor(restrictedPaths, descriptor, source);
|
|
27072
27118
|
const configuredSet = new Set(configured);
|
|
27073
27119
|
const missingFromConfig = usedSubPackages.filter((pkg) => !configuredSet.has(pkg));
|
|
27120
|
+
const relevantSubPackages = !isRuleEnabled || configured.length === 0 ? usedSubPackages : missingFromConfig;
|
|
27121
|
+
if (relevantSubPackages.length === 0) continue;
|
|
27122
|
+
const importSites = importSitesForSubPackages(relevantSubPackages, usage, rootDir, workspaces);
|
|
27074
27123
|
if (!isRuleEnabled || configured.length === 0) {
|
|
27075
27124
|
issues.push({
|
|
27076
27125
|
descriptor,
|
|
27126
|
+
importSites,
|
|
27077
27127
|
kind: "missing",
|
|
27078
27128
|
missingFromConfig: usedSubPackages,
|
|
27079
27129
|
usedSubPackages
|
|
27080
27130
|
});
|
|
27081
27131
|
continue;
|
|
27082
27132
|
}
|
|
27083
|
-
|
|
27133
|
+
issues.push({
|
|
27084
27134
|
descriptor,
|
|
27135
|
+
importSites,
|
|
27085
27136
|
kind: "incomplete",
|
|
27086
27137
|
missingFromConfig,
|
|
27087
27138
|
usedSubPackages
|
|
@@ -27099,25 +27150,49 @@ async function findBarrelImportRestrictionIssues(rootDir) {
|
|
|
27099
27150
|
const watchSet = new Set(barrelInfo.flatMap((entry) => entry.subPackages));
|
|
27100
27151
|
const usage = collectExternalUsage(workspaces.map((workspace) => PATH.resolve(rootDir, workspace.location)), watchSet);
|
|
27101
27152
|
const source = readFileSync(resolved.eslintConfigPath, "utf8");
|
|
27102
|
-
return findRestrictionIssues(barrelInfo, resolved.restrictedPaths, resolved.ruleEnabled, usage, source);
|
|
27103
|
-
}
|
|
27104
|
-
function
|
|
27153
|
+
return findRestrictionIssues(barrelInfo, resolved.restrictedPaths, resolved.ruleEnabled, usage, source, rootDir, workspaces);
|
|
27154
|
+
}
|
|
27155
|
+
function formatImportSite(site, rootDir) {
|
|
27156
|
+
const relativeFile = PATH.relative(rootDir, site.file);
|
|
27157
|
+
const location = relativeFile.length > 0 ? relativeFile : site.file;
|
|
27158
|
+
const packageLabel = site.workspacePackage === void 0 ? "" : chalk.gray(` (${site.workspacePackage})`);
|
|
27159
|
+
return `${location}:${site.line}${packageLabel}`;
|
|
27160
|
+
}
|
|
27161
|
+
function reportImportSites(sites, rootDir) {
|
|
27162
|
+
if (sites.length === 0) return;
|
|
27163
|
+
const bySubPackage = /* @__PURE__ */ new Map();
|
|
27164
|
+
for (const site of sites) {
|
|
27165
|
+
const group = bySubPackage.get(site.subPackage) ?? [];
|
|
27166
|
+
group.push(site);
|
|
27167
|
+
bySubPackage.set(site.subPackage, group);
|
|
27168
|
+
}
|
|
27169
|
+
const sortedSubPackages = bySubPackage.keys().toArray().toSorted((left, right) => left.localeCompare(right));
|
|
27170
|
+
for (const subPackage of sortedSubPackages) {
|
|
27171
|
+
const group = bySubPackage.get(subPackage);
|
|
27172
|
+
if (group === void 0) continue;
|
|
27173
|
+
console.log(chalk.gray(` ${subPackage} imported by:`));
|
|
27174
|
+
for (const site of group) console.log(chalk.gray(` - ${formatImportSite(site, rootDir)}`));
|
|
27175
|
+
}
|
|
27176
|
+
}
|
|
27177
|
+
function reportBarrelImportRestrictionIssues(issues, rootDir = process.cwd()) {
|
|
27105
27178
|
if (issues.length === 0) return 0;
|
|
27106
27179
|
console.log(chalk.yellow("\nBarrel import restrictions"));
|
|
27107
27180
|
for (const issue of issues) {
|
|
27108
27181
|
if (issue.kind === "missing") {
|
|
27109
27182
|
console.log(chalk.yellow(` ${issue.descriptor.pkg}: sub-packages are imported but no-restricted-imports is not configured for this barrel`));
|
|
27110
27183
|
console.log(chalk.gray(` Run xy lint init to add restrictions for: ${issue.usedSubPackages.join(", ")}`));
|
|
27184
|
+
reportImportSites(issue.importSites, rootDir);
|
|
27111
27185
|
continue;
|
|
27112
27186
|
}
|
|
27113
27187
|
console.log(chalk.yellow(` ${issue.descriptor.pkg}: disallowed-imports list is missing entries for imported sub-packages`));
|
|
27114
27188
|
for (const name of issue.missingFromConfig) console.log(chalk.yellow(` - ${name}`));
|
|
27115
27189
|
console.log(chalk.gray(" Update eslint.config.ts or rerun xy lint init to include the missing entries"));
|
|
27190
|
+
reportImportSites(issue.importSites, rootDir);
|
|
27116
27191
|
}
|
|
27117
27192
|
return issues.length;
|
|
27118
27193
|
}
|
|
27119
27194
|
async function checkBarrelImportRestrictions(rootDir) {
|
|
27120
|
-
return reportBarrelImportRestrictionIssues(await findBarrelImportRestrictionIssues(rootDir));
|
|
27195
|
+
return reportBarrelImportRestrictionIssues(await findBarrelImportRestrictionIssues(rootDir), rootDir);
|
|
27121
27196
|
}
|
|
27122
27197
|
//#endregion
|
|
27123
27198
|
//#region src/actions/incremental.ts
|
|
@@ -49311,26 +49386,26 @@ function sortRules(rules) {
|
|
|
49311
49386
|
return command === 0 ? left.id.localeCompare(right.id) : command;
|
|
49312
49387
|
});
|
|
49313
49388
|
}
|
|
49314
|
-
function maxWidth(header, values, max = Infinity) {
|
|
49389
|
+
function maxWidth$1(header, values, max = Infinity) {
|
|
49315
49390
|
return Math.min(max, Math.max(header.length, ...values.map((value) => value.length)));
|
|
49316
49391
|
}
|
|
49317
|
-
function resolveTableWidth() {
|
|
49392
|
+
function resolveTableWidth$1() {
|
|
49318
49393
|
const columns = process.stdout.isTTY ? process.stdout.columns : void 0;
|
|
49319
49394
|
return Math.max(72, Math.min(columns ?? 120, 160) - 2);
|
|
49320
49395
|
}
|
|
49321
49396
|
function resolveRuleTableWidths(rows, hasWeight) {
|
|
49322
49397
|
const columnCount = hasWeight ? 5 : 4;
|
|
49323
49398
|
const tableChromeWidth = columnCount + 1 + columnCount * 2;
|
|
49324
|
-
const level = maxWidth("Level", rows.map((row) => row.level));
|
|
49325
|
-
const fix = maxWidth("Fix", rows.map((row) => row.fix));
|
|
49326
|
-
const weight = hasWeight ? maxWidth("Weight", rows.map((row) => row.weight), 12) : void 0;
|
|
49327
|
-
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);
|
|
49328
49403
|
const fixedWidth = () => tableChromeWidth + level + fix + id + (weight ?? 0);
|
|
49329
49404
|
const minimumDescription = 28;
|
|
49330
|
-
const tableWidth = resolveTableWidth();
|
|
49405
|
+
const tableWidth = resolveTableWidth$1();
|
|
49331
49406
|
if (tableWidth - fixedWidth() < minimumDescription) id = Math.max(24, id - (minimumDescription - (tableWidth - fixedWidth())));
|
|
49332
49407
|
const availableDescription = Math.max(20, tableWidth - fixedWidth());
|
|
49333
|
-
const naturalDescription = maxWidth("Description", rows.map((row) => row.description), 72);
|
|
49408
|
+
const naturalDescription = maxWidth$1("Description", rows.map((row) => row.description), 72);
|
|
49334
49409
|
return {
|
|
49335
49410
|
description: Math.min(naturalDescription, availableDescription),
|
|
49336
49411
|
fix,
|
|
@@ -50795,6 +50870,100 @@ const priorityFromPartial = (partial) => {
|
|
|
50795
50870
|
};
|
|
50796
50871
|
};
|
|
50797
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
|
|
50798
50967
|
//#region src/actions/work/index.ts
|
|
50799
50968
|
const cleanResult = (data) => {
|
|
50800
50969
|
return {
|
|
@@ -50808,10 +50977,6 @@ const cleanResult = (data) => {
|
|
|
50808
50977
|
};
|
|
50809
50978
|
};
|
|
50810
50979
|
const nowIso = (now = /* @__PURE__ */ new Date()) => now.toISOString();
|
|
50811
|
-
const printItemSummary = (item, score) => {
|
|
50812
|
-
const scoreText = score === void 0 ? "-" : String(score);
|
|
50813
|
-
xyLog(`${item.id}\t${item.status}\t${item.type}\t${scoreText}\t${item.title}`);
|
|
50814
|
-
};
|
|
50815
50980
|
const normalizeTags = (tags) => {
|
|
50816
50981
|
return [...new Set((tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0))].toSorted();
|
|
50817
50982
|
};
|
|
@@ -50897,7 +51062,7 @@ const workList = (options = {}) => {
|
|
|
50897
51062
|
const cwd = options.cwd ?? process.cwd();
|
|
50898
51063
|
const config = readWorkConfig(cwd);
|
|
50899
51064
|
const items = selectWorkItems(listWorkItems(cwd), options, config.priority.formula);
|
|
50900
|
-
|
|
51065
|
+
printWorkItemsTable(items, config.priority.formula);
|
|
50901
51066
|
return cleanResult({ items });
|
|
50902
51067
|
};
|
|
50903
51068
|
const workShow = (options) => {
|
|
@@ -50909,8 +51074,10 @@ const needsTriage = (item) => {
|
|
|
50909
51074
|
return item.status === "open" && (item.priority === void 0 || item.area === void 0 || item.acceptanceCriteria.length === 0 || item.verification.length === 0);
|
|
50910
51075
|
};
|
|
50911
51076
|
const workTriage = (options = {}) => {
|
|
50912
|
-
const
|
|
50913
|
-
|
|
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);
|
|
50914
51081
|
return cleanResult({ items });
|
|
50915
51082
|
};
|
|
50916
51083
|
const workQueue = (options = {}) => {
|
|
@@ -50963,7 +51130,7 @@ const workNext = (options = {}) => {
|
|
|
50963
51130
|
return cleanResult({ item: void 0 });
|
|
50964
51131
|
}
|
|
50965
51132
|
const next = options.claim === true ? claimItem(cwd, item, options.now) : item;
|
|
50966
|
-
|
|
51133
|
+
printWorkItemSummary(next, calculatePriorityScore(next.priority, config.priority.formula));
|
|
50967
51134
|
return cleanResult({ item: next });
|
|
50968
51135
|
};
|
|
50969
51136
|
const claimItem = (cwd, item, now) => {
|