sprag-cli 3.129.1 → 3.130.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/docs/TEAM.ko.md +1 -1
- package/docs/TEAM.md +2 -2
- package/package.json +1 -1
- package/src/formatters/statusline.js +11 -4
- package/src/team-standing.js +39 -12
package/docs/TEAM.ko.md
CHANGED
|
@@ -169,7 +169,7 @@ https://sprag.io/team/ 에서 등록된 오너나 어드민이 이메일 코드
|
|
|
169
169
|
|
|
170
170
|
여러 팀을 한 번에 만들려면 "+ 새 팀"을 누르고 "여러 팀 한 번에 만들기"를 펼친 뒤 한 줄에 팀 이름을 하나씩 붙여 넣습니다. 한 번에 50개까지 만들 수 있습니다. 빈 줄과 조직에 이미 있는 이름, 목록에 두 번 나온 이름, 80자를 넘는 이름은 건너뛰고 따로 알려 줍니다. 만들다가 하나가 실패하면 그 이름에서 멈추고 아직 만들지 못한 이름은 다시 실행할 수 있도록 입력란에 남겨 둡니다. 팀 목록과 타운 탭의 "가입 명령어 내보내기"를 누르면 팀마다 한 줄씩 담긴 CSV를 받습니다. 열은 `team`, `team_id`, `invite_token`, `join_command`(`npm i -g sprag-cli@latest && sprag team join <토큰>`), `shell_profile`(`export SPRAG_TEAM_TOKEN=<토큰>`), `managed_settings`(관리형 설정 JSON)입니다. 일괄 생성이 끝나면 방금 만든 팀만 내보내는 버튼도 나옵니다. 이 파일에는 목록에 있는 모든 팀의 초대 토큰이 들어 있으므로 각 줄은 해당 팀에만 전달하고, 파일이 새어 나가면 그 팀의 토큰을 교체하십시오.
|
|
171
171
|
|
|
172
|
-
대시보드 맨 위의 기간 선택(7일, 30일, 90일, 이번 달, 지난 달, 직접 선택)이 멤버 표, 사용량 차트, 프롬프트 사용량 탭의 기간을 정합니다. 기본값은
|
|
172
|
+
대시보드 맨 위의 기간 선택(7일, 30일, 90일, 이번 달, 지난 달, 직접 선택)이 멤버 표, 사용량 차트, 프롬프트 사용량 탭의 기간을 정합니다. 기본값은 이번 달(1일부터 오늘까지)로 멤버 타운, statusline 순위와 같습니다. 내 컴퓨터의 달력 날짜를 쓰며 종료일도 포함합니다. 최대 365일까지 고를 수 있습니다. 고른 기간은 주소(`?from=2026-10-01&to=2026-10-18`)에 남으므로 새로고침하거나 링크를 공유해도 같은 기간이 보입니다. sprag.io/ops/ 슈퍼유저 콘솔에도 같은 선택이 있어 조직 표, 조직 머리말, 조직의 프롬프트 사용량에 적용됩니다.
|
|
173
173
|
|
|
174
174
|
### 좌석 현황
|
|
175
175
|
|
package/docs/TEAM.md
CHANGED
|
@@ -150,7 +150,7 @@ sprag team town --no-open # prints the link only
|
|
|
150
150
|
|
|
151
151
|
The command asks the team server for a link with `town_view_link` (it sends your member key and nothing else) and opens `https://sprag.io/town/#t=<token>`. The token is valid for 12 hours and the command prints the expiry in your local time. Asking for links too often is refused for a while ("too many town links"). The token sits in the part of the address after `#`, so the web server never receives it, and the page removes it from the address bar after reading it. When it expires, or after you leave the team, the page asks you to run the command again. `SPRAG_TOWN_URL` points the link at another page (for local tests).
|
|
152
152
|
|
|
153
|
-
The page opens on this month (Asia/Seoul calendar month start to today). A period picker in the page head switches between this month, last month
|
|
153
|
+
The page opens on this month (Asia/Seoul calendar month start to today). A period picker in the page head switches between this month, last month, the last 7, 30 or 90 days, and custom dates (a start and an end date, at most 365 days). The page sends the range to `town_view(p_token, p_from, p_to)`, which applies the same validation as the dashboard (both dates or neither, from not after to, at most 366 days), and the choice is kept for that tab only.
|
|
154
154
|
|
|
155
155
|
What the town shows:
|
|
156
156
|
|
|
@@ -191,7 +191,7 @@ https://sprag.io/team/ is where a registered owner or admin signs in with an ema
|
|
|
191
191
|
|
|
192
192
|
To create several teams at once, open "+ New team", then "Create several teams at once", and paste one team name per line (up to 50 per run). Blank lines, names already in the organization, names listed twice and names over 80 characters are skipped and listed. If one creation fails, the run stops there and the names not yet created stay in the box for another run. "Export join commands" (under the Teams list and on the Town tab) downloads a CSV with one row per team: `team`, `team_id`, `invite_token`, `join_command` (`npm i -g sprag-cli@latest && sprag team join <token>`), `shell_profile` (`export SPRAG_TEAM_TOKEN=<token>`) and `managed_settings` (the managed settings JSON). After a bulk run, a button exports only the teams it created. The file holds every listed team's invite token, so share each row only with that team, and rotate a team's token if the file leaks.
|
|
193
193
|
|
|
194
|
-
A date range control at the top of the dashboard (7d, 30d, 90d, This month, Last month or Custom) sets the period for the members table, the Usage chart and the prompt usage tab. It defaults to the
|
|
194
|
+
A date range control at the top of the dashboard (7d, 30d, 90d, This month, Last month or Custom) sets the period for the members table, the Usage chart and the prompt usage tab. It defaults to this month (the 1st through today), the same period as the member town and the statusline standing, uses your local calendar days with the end date included, and allows 365 days at most. The choice is kept in the page address (`?from=2026-10-01&to=2026-10-18`), so a reload or a shared link shows the same period. The superuser console at /ops/ has the same control for the organization table, the organization header and its prompt usage.
|
|
195
195
|
|
|
196
196
|
### The seat roster
|
|
197
197
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.130.0",
|
|
4
4
|
"description": "The delegation layer for Claude Code and Codex: each task goes to the model and effort that fits it, down to cheaper models for lookups and up to higher effort when a cheaper run would miss, backed by public replay cases, with a live statusline and team rules for Pro and Enterprise.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@ import { modelFamily } from '../savings-ledger.js';
|
|
|
31
31
|
import { shareLegend } from '../model-share.js';
|
|
32
32
|
import { STAR_URL } from '../star-note.js';
|
|
33
33
|
import { GRADES, speciesLabel } from '../office-species.js';
|
|
34
|
-
import { scorePctOf, nextOf, nextGradeUp, floorPct } from '../team-standing.js';
|
|
34
|
+
import { scorePctOf, nextOf, nextGradeUp, floorPct, rankMonthLabel } from '../team-standing.js';
|
|
35
35
|
import { cellWidth } from '../cell-width.js';
|
|
36
36
|
|
|
37
37
|
// The 8-color ANSI defaults (RED=31, GREEN=32, YELLOW=33…) read as garish
|
|
@@ -403,7 +403,9 @@ const TEAM_STANDING_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
|
403
403
|
/**
|
|
404
404
|
* Team chip: the member id, the organization and, once the server has told us,
|
|
405
405
|
* the overall-score rank and the animal that member is in the team's virtual
|
|
406
|
-
* office (`member-1a2b3c4d acmeco overall score #3 of 12 🦊 Fox
|
|
406
|
+
* office (`member-1a2b3c4d acmeco overall score #3 of 12 🦊 Fox`; when the
|
|
407
|
+
* standing covers one calendar month the month leads the rank: `acmeco Nov
|
|
408
|
+
* overall score #3 of 12 🦊 Fox`, `acmeco 11월 종합 점수 12명 중 3위 🦊 여우`). Renders only
|
|
407
409
|
* for a joined machine. A missing, unknown or day-old standing leaves just the
|
|
408
410
|
* member label (and the organization, when known). The office page calls the
|
|
409
411
|
* ranked figure the overall score (spend rank, delegation rank, prompt rank). Gray like the other identity chips; the emoji brings its own colour.
|
|
@@ -423,7 +425,9 @@ function buildTeamSeg(team, c, mode = 'icon', now = Date.now()) {
|
|
|
423
425
|
const inTeam = ranked && Number.isInteger(st.teamRank) && Number.isInteger(st.teamRanked)
|
|
424
426
|
&& st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked && typeof team.team === 'string' && team.team;
|
|
425
427
|
const teamPlace = inTeam ? (team.lang === 'ko' ? `, ${team.team} 팀 ${st.teamRanked}명 중 ${st.teamRank}위` : `, team ${team.team} #${st.teamRank} of ${st.teamRanked}`) : '';
|
|
426
|
-
const
|
|
428
|
+
const month = ranked ? rankMonthLabel(st, team.lang) : null;
|
|
429
|
+
const monthPre = month ? ` ${month}` : '';
|
|
430
|
+
const place = ranked ? (team.lang === 'ko' ? `${monthPre} 종합 점수 ${st.ranked}명 중 ${st.rank}위${teamPlace}` : `${monthPre} overall score #${st.rank} of ${st.ranked}${teamPlace}`) : '';
|
|
427
431
|
const org = typeof team.org === 'string' && team.org ? ` ${team.org}` : '';
|
|
428
432
|
// The plan leads (`Pro`, `Enterprise`): the chip describes a licensed team, so
|
|
429
433
|
// the license is the first thing it says, and the standing follows.
|
|
@@ -443,6 +447,8 @@ function buildTeamSeg(team, c, mode = 'icon', now = Date.now()) {
|
|
|
443
447
|
* that has not joined; the chip above stands in on the single-line layouts.
|
|
444
448
|
* icon: "👥 Pro · acmeco · DEV-OPS · member-1a2b3c4d | 🦊 여우 ▰▰▰▰▰▰▰▰▰▱▱▱ 75% → 🐆 치타 77% | 종합 3/12위 · 팀 1/4위 · 사용량 2/12위 · 위임률 5/12위"
|
|
445
449
|
* text: "Pro · acmeco · DEV-OPS · member-1a2b3c4d | Fox 75% → Cheetah 77% | overall #3/12 · team #1/4 · spend #2/12 · delegation #5/12"
|
|
450
|
+
* When the standing covers one calendar month, only the overall entry carries
|
|
451
|
+
* the month: "11월 종합 3/12위" / "Nov overall #3/12" (crown 👑 stays in front).
|
|
446
452
|
* Text mode draws no gauge, as the other gauges do not. An older server sends no
|
|
447
453
|
* axis ranks, and the second group then holds the overall rank (and the team's).
|
|
448
454
|
*/
|
|
@@ -497,7 +503,8 @@ function buildTeamLine(team, c, isIcon, g, mode = 'icon', now = Date.now(), colo
|
|
|
497
503
|
&& st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked;
|
|
498
504
|
const has = (v) => Number.isFinite(v);
|
|
499
505
|
const rk = (koName, enName, r, n) => (ko ? `${koName} ${r}/${n}위` : `${enName} #${r}/${n}`);
|
|
500
|
-
const
|
|
506
|
+
const month = rankMonthLabel(st, team.lang);
|
|
507
|
+
const ranks = [`${st.crown && emoji ? '👑 ' : ''}${rk(month ? `${month} 종합` : '종합', month ? `${month} overall` : 'overall', st.rank, st.ranked)}`];
|
|
501
508
|
if (inTeam) ranks.push(rk('팀', 'team', st.teamRank, st.teamRanked));
|
|
502
509
|
if (has(st.spendRank)) ranks.push(rk('사용량', 'spend', st.spendRank, st.ranked));
|
|
503
510
|
if (has(st.dlgRank)) ranks.push(rk('위임률', 'delegation', st.dlgRank, st.ranked));
|
package/src/team-standing.js
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* standing in the organization's virtual office, what moving up takes, and the
|
|
4
4
|
* field guide of species to climb through.
|
|
5
5
|
*
|
|
6
|
-
* The statusline chip says `Pro member-1a2b3c4d acmeco 종합 점수 12명 중
|
|
7
|
-
* 🦊 여우` and no more
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* The statusline chip says `Pro member-1a2b3c4d acmeco 11월 종합 점수 12명 중
|
|
7
|
+
* 3위 🦊 여우` and no more (the standing covers the current calendar month, so
|
|
8
|
+
* the month leads the rank). This answers the questions that chip raises: how
|
|
9
|
+
* many people stand ahead, whether the rank is earned by spending more tokens
|
|
10
|
+
* or by using them better, which species is next and what the whole ladder
|
|
11
|
+
* looks like. The score adds the spend rank and the delegation-share rank (and
|
|
12
|
+
* the prompt-count rank where prompt capture is on), so the spend rank rises
|
|
13
|
+
* with more tokens and the delegation rank rises with the share of savings
|
|
14
|
+
* that delegation brings, counted since the machine joined (saved ÷ (spend +
|
|
15
|
+
* saved)). The species follow the score's percentile
|
|
14
16
|
* (GRADES in office-species.js), and the six species from the wolf up also
|
|
15
17
|
* need the delegation share at or above the company median.
|
|
16
18
|
*
|
|
@@ -95,6 +97,30 @@ export function nextOf(st, sr = scorePctOf(st)) {
|
|
|
95
97
|
return { grade: up.key, pass: Math.max(0, Math.ceil((up.minSr - sr) / span * (st.ranked - 1) - 1e-6)), needDlg: up.needDlg && !dlgOk };
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
const MONTHS_EN = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The month the standing covers when its period is one calendar month so far:
|
|
104
|
+
* `rangeFrom` is the 1st of a month and `rangeTo` a valid date in that same
|
|
105
|
+
* year and month. Korean `11월`, English `Nov` (a fixed table, no locale
|
|
106
|
+
* dependency). Null for any other period (a rolling window such as
|
|
107
|
+
* 2026-10-09..2026-11-07), a missing field or an impossible month.
|
|
108
|
+
* @param {{ rangeFrom?: string|null, rangeTo?: string|null }|null|undefined} st
|
|
109
|
+
* @param {'ko'|'en'} [lang]
|
|
110
|
+
* @returns {string|null}
|
|
111
|
+
*/
|
|
112
|
+
export function rankMonthLabel(st, lang = 'en') {
|
|
113
|
+
if (!st || typeof st !== 'object') return null;
|
|
114
|
+
const from = typeof st.rangeFrom === 'string' ? /^(\d{4})-(\d{2})-01$/.exec(st.rangeFrom) : null;
|
|
115
|
+
const to = typeof st.rangeTo === 'string' ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(st.rangeTo) : null;
|
|
116
|
+
if (!from || !to) return null;
|
|
117
|
+
const month = Number(from[2]);
|
|
118
|
+
if (month < 1 || month > 12 || from[1] !== to[1] || from[2] !== to[2]) return null;
|
|
119
|
+
const day = Number(to[3]);
|
|
120
|
+
if (day < 1 || day > new Date(Date.UTC(Number(to[1]), month, 0)).getUTCDate()) return null;
|
|
121
|
+
return lang === 'ko' ? `${month}월` : MONTHS_EN[month - 1];
|
|
122
|
+
}
|
|
123
|
+
|
|
98
124
|
/**
|
|
99
125
|
* @param {object|null|undefined} st team.json `standing`
|
|
100
126
|
* @param {{ lang?: 'ko'|'en', org?: string|null }} [opts]
|
|
@@ -124,9 +150,10 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
|
|
|
124
150
|
return lines;
|
|
125
151
|
}
|
|
126
152
|
|
|
153
|
+
const month = rankMonthLabel(st, lang);
|
|
127
154
|
lines.push(ko
|
|
128
|
-
? `순위: ${where}종합 점수 ${st.ranked}명 중 ${st.rank}위${teamPlace} · ${animal}${period}`
|
|
129
|
-
: `Standing: ${where}overall score #${st.rank} of ${st.ranked}${teamPlace} · ${animal}${period}`);
|
|
155
|
+
? `순위: ${where}${month ? `${month} ` : ''}종합 점수 ${st.ranked}명 중 ${st.rank}위${teamPlace} · ${animal}${period}`
|
|
156
|
+
: `Standing: ${where}${month ? `${month} ` : ''}overall score #${st.rank} of ${st.ranked}${teamPlace} · ${animal}${period}`);
|
|
130
157
|
|
|
131
158
|
// Where that rank puts you: the people ahead, or the crown.
|
|
132
159
|
if (st.crown) {
|
|
@@ -159,8 +186,8 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
|
|
|
159
186
|
: ' The overall score adds the spend rank (62.5%) and the delegation-share rank (37.5%). An Enterprise organization with prompt capture on uses 50%, 30% and 20%, with the prompt-count rank as the third.');
|
|
160
187
|
}
|
|
161
188
|
lines.push(ko
|
|
162
|
-
? ` 지출 순위는 토큰을 더 써야 오르고 위임 비율 순위는
|
|
163
|
-
: ` The spend rank rises with more tokens; the delegation rank rises
|
|
189
|
+
? ` 지출 순위는 토큰을 더 써야 오르고 위임 비율 순위는 위임이 낸 절감의 몫이 커져야 오릅니다. 이 몫은 설치한 뒤부터 센 절감액 ÷ (지출 + 절감액)입니다. ${speciesLabel('wolf', 'ko', { emoji: false })} 이상 여섯 종은 위임 비율이 회사 중앙값 이상이어야 합니다.`
|
|
190
|
+
: ` The spend rank rises with more tokens; the delegation rank rises with the share of savings that delegation brings, counted since this machine joined (saved ÷ (spend + saved)). The six species from ${speciesLabel('wolf', 'en', { emoji: false })} up also need a delegation share at or above the company median.`);
|
|
164
191
|
|
|
165
192
|
// The caller's own figures, when the server sent them.
|
|
166
193
|
if (has(st.dlg) || has(st.spent) || has(st.scorePct)) {
|