@slope-dev/cli 0.2.1 → 0.3.0
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/commands/tournament.js +59 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { buildTournamentReview, formatTournamentReview } from '@slope-dev/core';
|
|
4
|
+
import { loadConfig } from '../config.js';
|
|
5
|
+
import { loadScorecards } from '../loader.js';
|
|
6
|
+
function parseArgs(args) {
|
|
7
|
+
const result = {};
|
|
8
|
+
for (const arg of args) {
|
|
9
|
+
const match = arg.match(/^--(\w[\w-]*)=(.+)$/);
|
|
10
|
+
if (match) {
|
|
11
|
+
result[match[1]] = match[2];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
export function tournamentCommand(args) {
|
|
17
|
+
const opts = parseArgs(args);
|
|
18
|
+
const config = loadConfig();
|
|
19
|
+
const allCards = loadScorecards(config);
|
|
20
|
+
if (!opts.id) {
|
|
21
|
+
console.error('\nUsage: slope tournament --id=<id> [--name=<name>] [--sprints=N-M] [--output=path]\n');
|
|
22
|
+
console.error(' --id Tournament identifier (e.g. M-09)');
|
|
23
|
+
console.error(' --name Human-readable name (defaults to id)');
|
|
24
|
+
console.error(' --sprints Sprint range, e.g. 197-202 (defaults to all)');
|
|
25
|
+
console.error(' --output Write JSON+MD to this directory (defaults to scorecardDir)\n');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
let filtered = allCards;
|
|
29
|
+
if (opts.sprints) {
|
|
30
|
+
const rangeMatch = opts.sprints.match(/^(\d+)-(\d+)$/);
|
|
31
|
+
if (rangeMatch) {
|
|
32
|
+
const start = parseInt(rangeMatch[1], 10);
|
|
33
|
+
const end = parseInt(rangeMatch[2], 10);
|
|
34
|
+
filtered = allCards.filter((c) => c.sprint_number >= start && c.sprint_number <= end);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const nums = new Set(opts.sprints.split(',').map((s) => parseInt(s.trim(), 10)));
|
|
38
|
+
filtered = allCards.filter((c) => nums.has(c.sprint_number));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (filtered.length === 0) {
|
|
42
|
+
console.error('\nNo scorecards found for the specified range.\n');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const name = opts.name ?? opts.id;
|
|
46
|
+
const review = buildTournamentReview(opts.id, name, filtered);
|
|
47
|
+
const md = formatTournamentReview(review);
|
|
48
|
+
const outputDir = join(process.cwd(), opts.output ?? config.scorecardDir);
|
|
49
|
+
const jsonPath = join(outputDir, `tournament-${opts.id}.json`);
|
|
50
|
+
const mdPath = join(outputDir, `tournament-${opts.id}.md`);
|
|
51
|
+
writeFileSync(jsonPath, JSON.stringify(review, null, 2) + '\n');
|
|
52
|
+
writeFileSync(mdPath, md + '\n');
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(md);
|
|
55
|
+
console.log('');
|
|
56
|
+
console.log(`Written to:`);
|
|
57
|
+
console.log(` ${jsonPath}`);
|
|
58
|
+
console.log(` ${mdPath}`);
|
|
59
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,7 @@ Usage:
|
|
|
88
88
|
slope release --id=<id> Release a claim by ID
|
|
89
89
|
slope release --target=<t> [--player=<p>] Release a claim by target
|
|
90
90
|
slope status [--sprint=N] Show sprint course status + conflicts
|
|
91
|
+
slope tournament --id=<id> [options] Generate tournament review from scorecards
|
|
91
92
|
|
|
92
93
|
Examples:
|
|
93
94
|
slope init Create .slope/ with config + example scorecard
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slope-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "SLOPE CLI — Sprint Lifecycle & Operational Performance Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"slope": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@slope-dev/core": "0.
|
|
10
|
+
"@slope-dev/core": "0.3.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^25.3.0",
|