sprag-cli 3.96.0 → 3.97.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 +1 -1
- package/package.json +1 -1
- package/src/team-rule-stats.js +17 -3
package/docs/TEAM.ko.md
CHANGED
|
@@ -124,7 +124,7 @@ sprag team propose "커밋 전에 lint 실행" --scope ratchet
|
|
|
124
124
|
|
|
125
125
|
Sprag 은 룰을 `~/.claude/ratchet-team.md`(Codex 는 `<CODEX_HOME>/ratchet-team.md`)에 씁니다. 조직 룰이 먼저, 팀 룰이 그다음이고, 모델 룰은 각각의 하위 절로 들어갑니다. 그 파일이 있는 동안 `~/.claude/CLAUDE.md` 의 전역 harness 블록에서 import 합니다. Sprag 이 파일을 통째로 다시 쓰므로 직접 고치지 마십시오. `sprag team rules` 는 받아 둔 룰을 `- [org · model] 내용`, `- [team · ratchet] 내용` 형태로 보여 줍니다. `sprag team leave` 는 멤버 키, 캐시, import 를 지웁니다.
|
|
126
126
|
|
|
127
|
-
**추천 위임 룰.** 구성원이 올린 요약은 대시보드의 규칙 탭에 추천 위임 룰로 모입니다. 카테고리와 티어마다 한 건이며 이 룰을 쓰는 구성원 수, 위임 횟수, 실패율, 절감액이 붙습니다. 오너나 어드민이 그 탭에서 추천을 읽고 팀이나 조직 전체에 적용합니다. 적용된 룰은 문장과 함께 구조화된 기록(카테고리, 티어, 상한)을 달고 내려옵니다. 각 PC는 그 기록으로 모델 룰을 자기 환경에서 다시 그립니다. 에이전트 이름은 그 PC에 있는 것을 쓰고 언어는 자기 설정을 따르므로(Codex 파일은 영어로 남습니다) 한 PC에서 쓴 룰이 다른 PC에 없는 에이전트를 가리키는 일이 없습니다. 다시 그린 문장에는 예시가 없고 상한은 기록에 담긴 값입니다. 기록이 없는 룰은 서버가 보낸 문장 그대로 씁니다. `sprag team rules` 도 다시 그린 문장을 보여 줍니다.
|
|
127
|
+
**추천 위임 룰.** 구성원이 올린 요약은 대시보드의 규칙 탭에 추천 위임 룰로 모입니다. 카테고리와 티어마다 한 건이며 이 룰을 쓰는 구성원 수, 위임 횟수, 실패율, 절감액이 붙습니다. 추천을 펼치면 기여자 표가 나옵니다. 멤버(같은 좌석을 쓰는 PC는 한 명으로 셉니다)마다 팀, 위임 횟수, 실패율, 절감액, 시작일, 출처가 한 줄씩 담깁니다. 게시된 Sprag 프리셋에 이미 들어 있는 룰은 프리셋으로 모든 PC에 전달되므로 추천하지 않습니다. 추천 머리의 배지는 자체 학습한 멤버가 몇 명인지를 알려 줍니다. 오너나 어드민이 그 탭에서 추천을 읽고 팀이나 조직 전체에 적용합니다. 적용된 룰은 문장과 함께 구조화된 기록(카테고리, 티어, 상한)을 달고 내려옵니다. 각 PC는 그 기록으로 모델 룰을 자기 환경에서 다시 그립니다. 에이전트 이름은 그 PC에 있는 것을 쓰고 언어는 자기 설정을 따르므로(Codex 파일은 영어로 남습니다) 한 PC에서 쓴 룰이 다른 PC에 없는 에이전트를 가리키는 일이 없습니다. 다시 그린 문장에는 예시가 없고 상한은 기록에 담긴 값입니다. 기록이 없는 룰은 서버가 보낸 문장 그대로 씁니다. `sprag team rules` 도 다시 그린 문장을 보여 줍니다.
|
|
128
128
|
|
|
129
129
|
## 상태 확인, 전송 내용 확인, 나가기
|
|
130
130
|
|
package/docs/TEAM.md
CHANGED
|
@@ -124,7 +124,7 @@ sprag team propose "Run lint before every commit" --scope ratchet
|
|
|
124
124
|
|
|
125
125
|
Sprag writes the rules to `~/.claude/ratchet-team.md` (Codex: `<CODEX_HOME>/ratchet-team.md`), organization rules first and then team rules, each with its model rules in a sub-section, and imports that file from the global harness block of `~/.claude/CLAUDE.md` for as long as the file exists. Do not edit the file by hand, because Sprag rewrites it. `sprag team rules` lists the cached rules as `- [org · model] text` or `- [team · ratchet] text`. `sprag team leave` removes the member key, the cache and the import.
|
|
126
126
|
|
|
127
|
-
**Recommended delegation rules.** The summaries that members report are collected on the Rules tab of the dashboard as recommended delegation rules, one per category and tier: how many members run it, the delegation count, the failure rate and the savings. An owner or admin reads them there and applies a recommendation to the team or to the whole organization. The applied rule arrives with a structured record (category, tier and cap) next to its text. Each machine redraws a model rule from that record, with the agent names it has itself and in the language of its own settings (Codex files stay English), so a rule written on one machine never names an agent that another machine lacks. The redrawn sentence has no example, and the cap is the one in the record. A rule without a record is written as the server sent it. `sprag team rules` shows the redrawn sentence.
|
|
127
|
+
**Recommended delegation rules.** The summaries that members report are collected on the Rules tab of the dashboard as recommended delegation rules, one per category and tier: how many members run it, the delegation count, the failure rate and the savings. Opening a recommendation lists the contributors: for each member (machines that share a seat count once) the team, the delegation count, the failure rate, the savings, the start date and the origin. A rule that the published Sprag preset bundle already contains is not recommended, because the preset reaches every machine on its own; a badge on the recommendation says how many members learned it from their own route-scan. An owner or admin reads them there and applies a recommendation to the team or to the whole organization. The applied rule arrives with a structured record (category, tier and cap) next to its text. Each machine redraws a model rule from that record, with the agent names it has itself and in the language of its own settings (Codex files stay English), so a rule written on one machine never names an agent that another machine lacks. The redrawn sentence has no example, and the cap is the one in the record. A rule without a record is written as the server sent it. `sprag team rules` shows the redrawn sentence.
|
|
128
128
|
|
|
129
129
|
## Status, payload and leaving
|
|
130
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.97.0",
|
|
4
4
|
"description": "Model-delegation router for Claude Code and Codex: lookups, checks and test runs go to cheaper models, documents go in as compact Markdown, and a live statusline shows spend and savings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/team-rule-stats.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* The registry (model-rules.json) holds project paths, the user's prompt
|
|
6
6
|
* excerpts and rule sentences. None of that may leave the machine, so the
|
|
7
7
|
* summary is built from an allowlist: each output row is a new object whose
|
|
8
|
-
* keys are RULE_STAT_KEYS, filled only from numbers, the
|
|
9
|
-
* (category, tier) and one date. test/team-rule-stats.test.js pins the key set
|
|
8
|
+
* keys are RULE_STAT_KEYS, filled only from numbers, the enumerations
|
|
9
|
+
* (category, tier, status, origin) and one date. test/team-rule-stats.test.js pins the key set
|
|
10
10
|
* and checks that no path or example text survives into the JSON.
|
|
11
11
|
*
|
|
12
12
|
* Rules of one (category, tier) from different projects fold into one row;
|
|
@@ -19,7 +19,7 @@ import { RULE_CATEGORY_IDS, RULE_TIERS, isRuleCategory, isRuleTier } from './rul
|
|
|
19
19
|
export const RULE_STATS_MAX = 24;
|
|
20
20
|
export const RULE_STAT_KEYS = Object.freeze([
|
|
21
21
|
'category', 'tier', 'status', 'episodes', 'delegated', 'delegated_err',
|
|
22
|
-
'saved_usd', 'baseline_err', 'budget_calls', 'budget_out', 'since',
|
|
22
|
+
'saved_usd', 'baseline_err', 'budget_calls', 'budget_out', 'since', 'origin',
|
|
23
23
|
]);
|
|
24
24
|
|
|
25
25
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -40,6 +40,19 @@ function weighted(pairs) {
|
|
|
40
40
|
return weight > 0 ? round(sum / weight, 4) : null;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Where the folded rules came from, as one of three fixed words. A Sprag preset the
|
|
45
|
+
* user accepted is marked `origin: 'preset'` and signed `<tier>|<category>|preset`
|
|
46
|
+
* (src/seed-rules.js); every other rule was promoted from this machine's own
|
|
47
|
+
* route-scan candidates. 'both' means the row folds rules of the two kinds.
|
|
48
|
+
*/
|
|
49
|
+
const isPresetRule = (r) => r.origin === 'preset' || (typeof r.signature === 'string' && r.signature.endsWith('|preset'));
|
|
50
|
+
function ruleOrigin(rules) {
|
|
51
|
+
const presets = rules.filter(isPresetRule).length;
|
|
52
|
+
if (presets === 0) return 'scan';
|
|
53
|
+
return presets === rules.length ? 'preset' : 'both';
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
/** The most common budget among the rules; the first one wins a tie. */
|
|
44
57
|
function commonBudget(rules) {
|
|
45
58
|
const tally = new Map();
|
|
@@ -89,6 +102,7 @@ export function summarizeModelRules(rules) {
|
|
|
89
102
|
budget_calls: budget.calls,
|
|
90
103
|
budget_out: budget.out,
|
|
91
104
|
since: dates[0] || null,
|
|
105
|
+
origin: ruleOrigin(list),
|
|
92
106
|
});
|
|
93
107
|
}
|
|
94
108
|
}
|