skillgauntlet 1.2.0 → 1.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/LICENSE CHANGED
@@ -1,201 +1,201 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -28,7 +28,7 @@ can be compared.
28
28
  - [Codex probe](step0/data/2026-10-28_codex_probe/BATCH.md): facts only, no trigger rate (see
29
29
  "Hosts and models").
30
30
  - [Static layer](step0/data/2026-10-28_all_haiku/static/SUMMARY.md): all 18 skills, no model calls.
31
- - [Leaderboard](LEADERBOARD.md): the maintainer's batches and community submissions in one generated page, one table per host.
31
+ - [Leaderboard](https://skillgauntlet.github.io/SkillGauntlet/): the maintainer's batches and community submissions in one generated page, one table per host. It is rebuilt from the data on `main` every time a submission is merged.
32
32
 
33
33
  ## Usage
34
34
 
@@ -123,9 +123,23 @@ command. Results stay on your machine until you run it; nothing is uploaded auto
123
123
  4. Sign the [CLA](CLA.md) when the bot asks (once). CI then comments on the pull request with a pass, or with
124
124
  exactly what is missing.
125
125
 
126
+ **Passing submissions are merged automatically**, usually within a few minutes, and appear on the
127
+ [leaderboard](https://skillgauntlet.github.io/SkillGauntlet/) as a *community single sample*. A bot re-checks your files from scratch (it does not trust the
128
+ result shown on your own pull request) and merges only when everything holds: exactly one new submission folder with
129
+ the four files, the format and hashes check out, the CLA is signed, and the account is in good standing.
130
+
131
+ **When it goes to manual review.** The pull request gets a `needs-review` label and a comment listing why, and a
132
+ maintainer looks at it. This happens when it changes anything besides one new submission folder, fails a check, is
133
+ over the size limits, comes from an account younger than 30 days or one whose submission was refused in the last 24
134
+ hours, exceeds 5 automatic merges per account per day, or arrives before the CLA is signed (sign it and ask a
135
+ maintainer to re-run the check). Maintainers' own pull requests skip the account-age and recent-refusal rules.
136
+
137
+ The very first pull request from a new account still needs a maintainer to click "Approve and run" on its workflow
138
+ run, a GitHub rule for first-time fork contributors; the automatic merge starts after that.
139
+
126
140
  A merged submission is a **community single sample**. It becomes **confirmed** when another independent
127
141
  submission, or a maintainer run, lands on the same grade for the same skill version, host and model.
128
- Disagreeing results are kept side by side. See [`LEADERBOARD.md`](LEADERBOARD.md) for the current rows and what
142
+ Disagreeing results are kept side by side. See the [leaderboard](https://skillgauntlet.github.io/SkillGauntlet/) for the current rows and what
129
143
  each tag means, and [CONTRIBUTING.md](CONTRIBUTING.md#submitting-results) for the details, including what CI
130
144
  checks and what it cannot.
131
145
 
@@ -13,17 +13,19 @@ import { fingerprint, cacheFileFor, readCachedQueries, writeCachedQueries } from
13
13
  import { openRun, querySetHash, readRun, validRecords } from '../lib/runs.js';
14
14
  import { DEPTHS, minutesFor } from '../lib/depth.js';
15
15
  import { ask, choose, select, confirm, say, closeUi, hasTerminal, setBack, Back } from '../lib/ui.js';
16
- import { hostModels } from '../lib/models.js';
16
+ import { hostModels, unknownModel } from '../lib/models.js';
17
17
  import { browseDir } from '../lib/browse.js';
18
18
  import { withTicker } from '../lib/ticker.js';
19
19
  import { renderResult, bar } from '../lib/chart.js';
20
20
  import { setLang, detectLang, errorText, t } from '../lib/i18n.js';
21
- import { resolveBin, backend, backendFor, isDeepseekModel, HOSTS, checkModel, draftQueries, draftQuality, runTrial, requireHost, pingHost, setHostBin, binInstalled } from '../lib/trial.js';
21
+ import { resolveBin, backend, backendFor, usesOwnDeepseek, setNativeModels, HOSTS, checkModel, draftQueries, draftQuality, runTrial, requireHost, pingHost, setHostBin, binInstalled } from '../lib/trial.js';
22
22
  import { HOST_CLI, searchHost, installCommand, installHost } from '../lib/findhost.js';
23
23
  import { runGain } from '../lib/gain.js';
24
24
  import { ERROR_STREAK_STOP, executeTrials, finishRun, resumeRun } from '../lib/execute.js';
25
25
  import { cmdSubmit } from '../lib/submit.js';
26
26
  import { gitFacts } from '../lib/submission.js';
27
+ import { checkForUpdate, declineUpdate, currentVersion, isCheckout } from '../lib/update.js';
28
+ import { spawnSync as runSync, execSync } from 'node:child_process';
27
29
 
28
30
  function relLabel(root, dir) {
29
31
  const rel = path.relative(root, dir).replace(/\\/g, '/');
@@ -117,9 +119,19 @@ const waitText = (label, extra = {}) => ({ label, elapsed: t('waitElapsed'), abo
117
119
  // Asking a host CLI for its models takes a few seconds (CodeBuddy about three), so it shows a wait line and is
118
120
  // remembered for the rest of the run.
119
121
  const modelCache = new Map();
122
+
123
+ // A typed model the host does not list: say so now, while nothing has been spent, and ask again.
124
+ function notListed(model, known, label) {
125
+ const list = unknownModel(model, known);
126
+ if (!list) return false;
127
+ say(`\n${t('modelUnknown', { model, host: label, list: list.slice(0, 8).join(', ') })}`);
128
+ return true;
129
+ }
120
130
  function modelsOf(host, label) {
121
131
  if (!modelCache.has(host)) {
122
- modelCache.set(host, withTicker(waitText(t('waitModels', { host: label }), { slowAfter: 600 }), () => hostModels(host, resolveBin(host))));
132
+ const list = withTicker(waitText(t('waitModels', { host: label }), { slowAfter: 600 }), () => hostModels(host, resolveBin(host)));
133
+ setNativeModels(host, list);
134
+ modelCache.set(host, list);
123
135
  }
124
136
  return modelCache.get(host);
125
137
  }
@@ -366,6 +378,40 @@ async function pickAmong(found, root) {
366
378
  return [{ name: path.basename(dir), dir, root }];
367
379
  }
368
380
 
381
+ // Before the questions: is there a newer published version? The user chooses; if the update cannot be fetched or
382
+ // does not run, the session carries on with the version that is already running.
383
+ async function offerUpdate() {
384
+ if (!hasTerminal() || (isCheckout() && !process.env.SG_FORCE_UPDATE_CHECK)) return; // a checkout is not nagged unless asked
385
+ const found = await checkForUpdate();
386
+ if (!found) return;
387
+ say(`\n${t('updateAvail', found)}`);
388
+ const pick = await choose(t('updateQ'), [
389
+ { label: t('updateNow'), value: 'now' },
390
+ { label: t('updateSkip'), value: 'skip' },
391
+ ], 1);
392
+ if (pick !== 'now') {
393
+ declineUpdate(found.latest);
394
+ return;
395
+ }
396
+ const spec = `skillgauntlet@${found.latest}`;
397
+ const env = { ...process.env, SG_NO_UPDATE_CHECK: '1' };
398
+ try {
399
+ // fetch it first and check it answers as the version asked for, so a failed download never costs the session
400
+ const said = withTicker(waitText(t('updating', found), { slowAfter: 600 }), () => execSync(`npx -y ${spec} --version`, { encoding: 'utf8', timeout: 180000, windowsHide: true, env, stdio: ['ignore', 'pipe', 'pipe'] }));
401
+ if (String(said).trim() !== found.latest) throw new Error(`it reported ${String(said).trim() || 'nothing'}`);
402
+ } catch (err) {
403
+ // npm's own words when it gave any ("... is not in this registry"), else the error's first line
404
+ const lines = String(err.stderr || err.message).split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
405
+ const why = (lines.find((l) => /no matching version|not in this registry|404/i.test(l)) || lines.find((l) => /error|ERR/.test(l)) || lines[0] || 'unknown')
406
+ .replace(/^npm error\s*(notarget\s*)?/i, '').replace(/[.。]+$/, '');
407
+ say(t('updateFailed', { why: why.slice(0, 160), current: found.current }));
408
+ return;
409
+ }
410
+ closeUi();
411
+ const r = runSync(`npx -y ${spec}`, process.argv.slice(2), { stdio: 'inherit', env, shell: true });
412
+ process.exit(r.status ?? 0);
413
+ }
414
+
369
415
  async function interactive() {
370
416
  const langChoice = await select(`${t('langTitle')}`, [
371
417
  { label: t('langZh'), value: 'zh' },
@@ -373,6 +419,7 @@ async function interactive() {
373
419
  { label: t('langJa'), value: 'ja' },
374
420
  ], 0);
375
421
  setLang(langChoice);
422
+ await offerUpdate();
376
423
 
377
424
  say('');
378
425
  say(t('title'));
@@ -386,10 +433,11 @@ async function interactive() {
386
433
  const S = { targets: [], host: null, depth: null, model: null, wantProbe: false };
387
434
 
388
435
  const sourceStep = async () => {
436
+ say(`\n${t('sourceNote')}`);
389
437
  const source = await choose(t('sourceQ'), [
390
438
  { label: t('srcInstalled'), hint: t('srcInstalledHint'), value: 'installed' },
391
439
  { label: t('srcPath'), value: 'path' },
392
- { label: t('srcRepo'), hint: 'owner/repo', value: 'repo' },
440
+ { label: t('srcRepo'), hint: t('srcRepoHint'), value: 'repo' },
393
441
  ], 1);
394
442
 
395
443
  let targets = [];
@@ -445,8 +493,8 @@ async function interactive() {
445
493
  S.depth = DEPTHS[depthId];
446
494
 
447
495
  const provider = await choose(t('providerQ'), [
448
- { label: t('provClaude'), hint: t('provClaudeHint'), value: 'claude' },
449
- { label: t('provDeepseek'), hint: t('provDeepseekHint'), value: 'deepseek' },
496
+ { label: t('provClaude'), value: 'claude' },
497
+ { label: t('provDeepseek'), value: 'deepseek' },
450
498
  { label: t('provManual'), value: 'manual' },
451
499
  ], 1);
452
500
 
@@ -493,7 +541,8 @@ async function interactive() {
493
541
  ], 1);
494
542
  S.depth = DEPTHS[depthId];
495
543
  S.model = await pickModel(modelsOf('codebuddy', 'CodeBuddy'));
496
- if (isDeepseekModel(S.model) && !process.env.DEEPSEEK_API_KEY) {
544
+ if (notListed(S.model, modelsOf('codebuddy', 'CodeBuddy'), 'CodeBuddy')) return AGAIN;
545
+ if (usesOwnDeepseek('codebuddy', S.model) && !process.env.DEEPSEEK_API_KEY) {
497
546
  say(`\n${t('needDeepseekKey')}`);
498
547
  return END;
499
548
  }
@@ -501,7 +550,8 @@ async function interactive() {
501
550
  } else {
502
551
  say(`\n${t('codexNote')}`);
503
552
  S.model = await pickModel(modelsOf('codex', 'Codex'));
504
- if (isDeepseekModel(S.model) && !process.env.DEEPSEEK_API_KEY) {
553
+ if (notListed(S.model, modelsOf('codex', 'Codex'), 'Codex')) return AGAIN;
554
+ if (usesOwnDeepseek('codex', S.model) && !process.env.DEEPSEEK_API_KEY) {
505
555
  say(`\n${t('needDeepseekKey')}`);
506
556
  return END;
507
557
  }
@@ -596,7 +646,8 @@ async function interactive() {
596
646
  let explained = false;
597
647
  const submittable = finishedRuns.filter(canSubmit);
598
648
  if (finishedRuns.length && !submittable.length) {
599
- say(`\n${t('noSubmitNoSource')}`);
649
+ const manual = finishedRuns.map((d) => `npx skillgauntlet submit "${d}" --repo https://github.com/owner/repo --commit <sha> [--subdir path]`).join('\n ');
650
+ say(`\n${t('noSubmitNoSource', { cmd: manual })}`);
600
651
  explained = true;
601
652
  } else if (submittable.length && process.exitCode !== 3) {
602
653
  if (hasTerminal() && await confirm(t('contributeQ', { n: submittable.length }), false)) {
@@ -645,6 +696,10 @@ async function main() {
645
696
  say(t('usage'));
646
697
  return;
647
698
  }
699
+ if (args.includes('--version') || args.includes('-v')) {
700
+ say(currentVersion() || 'unknown');
701
+ return;
702
+ }
648
703
  if (args[0] === 'static') {
649
704
  await cmdStatic(args[1] || '.', args.includes('--json'));
650
705
  return;
@@ -0,0 +1,107 @@
1
+ // The decision rules of the submission auto-merge, as pure functions: no network, no files, no clock.
2
+ // scripts/automerge.mjs gathers the facts (through the GitHub API, as data) and applies the verdict.
3
+ //
4
+ // A pull request is merged automatically only when every rule here holds. Anything else is not an
5
+ // error: it is sent to a maintainer with the reasons written on the pull request.
6
+ import { FILES, LIMITS } from './submission.js';
7
+
8
+ export const POLICY = {
9
+ fileBytes: LIMITS.fileBytes, // per file (the same cap the validator enforces)
10
+ totalBytes: 10 * 1024 * 1024, // all four files of one submission
11
+ maxFiles: FILES.length,
12
+ perAccountPerDay: 5, // auto-merged submissions per account in the last 24 hours
13
+ minAccountAgeDays: 30, // younger accounts go to manual review
14
+ trustedAssociations: ['OWNER', 'MEMBER', 'COLLABORATOR'], // skip the account-age and recent-failure rules only
15
+ claContext: 'license/cla',
16
+ label: 'needs-review',
17
+ };
18
+
19
+ const DIR_RE = new RegExp(`^(submissions/[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*/[0-9]{8}T[0-9]{6}Z-[A-Za-z0-9][A-Za-z0-9-]*)/(${FILES.map((f) => f.replace('.', '\\.')).join('|')})$`);
20
+
21
+ // The text goes into a pull-request comment: no @mentions, one line, bounded.
22
+ const safe = (s) => String(s).replace(/@/g, '@​').replace(/[\r\n`]+/g, ' ').slice(0, 200);
23
+
24
+ // changed: [{ filename, status }] from the pull request's file list.
25
+ // entries: { [path]: { type, size } } from the contents API at the head commit (type is 'file' for a plain
26
+ // file, 'symlink' / 'submodule' / 'dir' otherwise). Returns { ok, reasons, dir }.
27
+ export function gateFiles(changed, entries = {}) {
28
+ const reasons = [];
29
+ const dirs = new Set();
30
+ if (!changed.length) reasons.push('the pull request lists no changed files');
31
+ if (changed.length > POLICY.maxFiles) reasons.push(`it changes ${changed.length} files; a submission is exactly ${POLICY.maxFiles}`);
32
+ let total = 0;
33
+ const seen = new Set();
34
+ for (const { filename, status } of changed) {
35
+ const name = String(filename);
36
+ if (name.split('/').some((seg) => seg === '..' || seg === '.' || seg === '') || name.includes('\\')) {
37
+ reasons.push(`\`${safe(name)}\` is not a plain relative path`);
38
+ continue;
39
+ }
40
+ const m = DIR_RE.exec(name);
41
+ if (!m) { reasons.push(`\`${safe(name)}\` is outside a submission directory or is not one of ${FILES.join(', ')}`); continue; }
42
+ dirs.add(m[1]);
43
+ seen.add(m[2]);
44
+ if (status !== 'added') { reasons.push(`\`${safe(name)}\` is ${safe(status)}, not added`); continue; }
45
+ const e = entries[name];
46
+ if (!e) { reasons.push(`\`${safe(name)}\` could not be read at the head commit`); continue; }
47
+ if (e.type !== 'file') { reasons.push(`\`${safe(name)}\` is a ${safe(e.type)}, not a regular file`); continue; }
48
+ if (!Number.isInteger(e.size) || e.size < 0) { reasons.push(`\`${safe(name)}\` has no usable size`); continue; }
49
+ if (e.size > POLICY.fileBytes) reasons.push(`\`${safe(name)}\` is ${e.size} bytes; the limit is ${POLICY.fileBytes}`);
50
+ total += e.size;
51
+ }
52
+ if (dirs.size > 1) reasons.push(`it touches ${dirs.size} submission directories; automatic merging takes exactly one`);
53
+ if (dirs.size === 1 && !reasons.length) {
54
+ const missing = FILES.filter((f) => !seen.has(f));
55
+ if (missing.length) reasons.push(`missing file(s): ${missing.join(', ')}`);
56
+ }
57
+ if (total > POLICY.totalBytes) reasons.push(`the files total ${total} bytes; the limit is ${POLICY.totalBytes}`);
58
+ return { ok: reasons.length === 0 && dirs.size === 1, reasons, dir: dirs.size === 1 ? [...dirs][0] : null };
59
+ }
60
+
61
+ // account: { createdAt, association, mergedLastDay, flaggedLastDay } (counts exclude this pull request).
62
+ export function gateAccount(account, now, policy = POLICY) {
63
+ const reasons = [];
64
+ if (account.mergedLastDay >= policy.perAccountPerDay) {
65
+ reasons.push(`this account already has ${account.mergedLastDay} auto-merged submissions in the last 24 hours (limit ${policy.perAccountPerDay})`);
66
+ }
67
+ if (!policy.trustedAssociations.includes(account.association)) {
68
+ const created = Date.parse(account.createdAt);
69
+ if (!Number.isFinite(created)) reasons.push('the account creation date is unknown');
70
+ else if ((now - created) / 86400000 < policy.minAccountAgeDays) reasons.push(`the account is younger than ${policy.minAccountAgeDays} days`);
71
+ if (account.flaggedLastDay > 0) reasons.push('a submission from this account was refused in the last 24 hours');
72
+ }
73
+ return { ok: reasons.length === 0, reasons };
74
+ }
75
+
76
+ // facts: {
77
+ // validatedSha, currentSha – the head commit the validation read, and the head right now
78
+ // files: gateFiles() result, validation: { ok, errors }, cla: 'success' | other | null,
79
+ // account: gateAccount() result
80
+ // }
81
+ // Returns { merge, reasons, waitForCla }. waitForCla marks a refusal that is only "not yet": the maintainer or
82
+ // contributor fixes it by signing, and no needs-review label is warranted.
83
+ export function decide({ validatedSha, currentSha, files, validation, cla, account }) {
84
+ const reasons = [];
85
+ if (!validatedSha || validatedSha !== currentSha) {
86
+ return { merge: false, reasons: ['the pull request changed after it was checked; the next run will check the new commit'], stale: true, waitForCla: false };
87
+ }
88
+ if (!files.ok) reasons.push(...files.reasons);
89
+ if (files.ok && !validation.ok) reasons.push(...validation.errors.map((e) => `check: ${e}`));
90
+ if (files.ok && validation.ok && validation.dir && validation.dir !== files.dir) reasons.push('the validated directory differs from the changed directory');
91
+ const claOk = cla === 'success';
92
+ if (!claOk) reasons.push(`the \`${POLICY.claContext}\` check is ${cla || 'missing'}; sign the CLA (see the comment from the CLA bot) and a maintainer can re-run this`);
93
+ if (!account.ok) reasons.push(...account.reasons);
94
+ const onlyCla = !claOk && reasons.length === 1;
95
+ return { merge: reasons.length === 0, reasons, stale: false, waitForCla: onlyCla };
96
+ }
97
+
98
+ export function renderVerdict({ merge, reasons, stale }, { dir } = {}) {
99
+ const marker = '<!-- skillgauntlet-automerge -->';
100
+ if (merge) return `${marker}\n### ✅ Merged automatically\n\n\`${safe(dir)}\` passed every check and was merged as a **community single sample**.\n`;
101
+ if (stale) return null;
102
+ return `${marker}\n### ⏸️ Not merged automatically\n\n${reasons.map((r) => `- ${r}`).join('\n')}\n\nA maintainer will look at this by hand. Nothing is wrong with asking: this is a safety rule, not a verdict on your results.\n`;
103
+ }
104
+
105
+ export function mergeTitle(dir) {
106
+ return `Add submission ${dir.replace(/^submissions\//, '')}`;
107
+ }
package/lib/chart.js CHANGED
@@ -31,9 +31,12 @@ function staticLines(result) {
31
31
  for (const g of result.groups) {
32
32
  const mark = g.verdict === 'pass' ? green('✓') : g.verdict === 'warn' ? yellow('!') : red('✗');
33
33
  L.push(` ${mark} ${g.id} ${t(g.titleKey)}`);
34
- // A group that is not clean says which checks and why: a letter and a mark alone cannot be acted on.
35
- for (const c of g.checks.filter((x) => x.status === 'warn' || x.status === 'fail')) {
36
- L.push(` ${c.status === 'fail' ? red('✗') : yellow('!')} ${c.id} ${t(c.titleKey)}${dim(` — ${cut(t(c.detailKey, c.detailVars), 70)}`)}`);
34
+ // Every check of the group with its reason: a letter and a mark alone cannot be acted on. Clean ones are dimmed.
35
+ for (const c of g.checks) {
36
+ const flagged = c.status === 'warn' || c.status === 'fail';
37
+ const sym = c.status === 'fail' ? red('✗') : c.status === 'warn' ? yellow('!') : c.status === 'info' ? dim('·') : green('✓');
38
+ const text = `${c.id} ${t(c.titleKey)} — ${cut(t(c.detailKey, c.detailVars), 70)}`;
39
+ L.push(` ${sym} ${flagged ? text : dim(text)}`);
37
40
  for (const e of (c.evidence || []).slice(0, 2)) L.push(` ${dim(`${cut(`${e.file || ''}:${e.line}`, 56)} ${cut(e.match, 40)}`)}`);
38
41
  }
39
42
  }
package/lib/i18n.js CHANGED
@@ -13,6 +13,8 @@ const MESSAGES = {
13
13
  srcInstalledHint: '扫 .agents/skills、.claude/skills、.codex/skills',
14
14
  srcPath: '另一个本地目录',
15
15
  srcRepo: 'GitHub 仓库(未安装)',
16
+ srcRepoHint: 'owner/repo · 可分享结果',
17
+ sourceNote: '提示:想把测试结果分享到公开榜单,最省事的是选“GitHub 仓库”:程序会自动知道技能来自哪个仓库的哪个提交。已安装的技能和本地目录也可以分享,但前提是它在带 GitHub origin 的 git 仓库里、改动已提交并推送;否则要自己补上仓库地址和提交,结果页会给出命令。',
16
18
  noInstalled: '本机没有找到已安装的技能。',
17
19
  foundInstalled: '找到 {n} 个已安装的技能。',
18
20
  scopeQ: '测哪些?',
@@ -36,7 +38,7 @@ const MESSAGES = {
36
38
  needDeepseekKey: '要用 DeepSeek 模型,请先在环境变量里设 DEEPSEEK_API_KEY(只放变量,不要把密钥写进命令行或文件)。',
37
39
  hostCodewhale: 'Codewhale',
38
40
  hostCodewhaleHint: '能测触发率(原 DeepSeek-TUI,用 DeepSeek 模型)',
39
- codewhaleNote: 'Codewhale 的技能调用在事件流里是名为 load_skill 的工具调用:第一个 input.name 等于被测技能才算触发(查询和列目录不算)。试跑在一个只装了被测技能的临时 HOME 里进行,只开放 load_skill 这一个工具;用 DEEPSEEK_API_KEY,花 DeepSeek 现金。这是 Codewhale 的数字,不与其他宿主的合并比较。需要 codewhale 在 PATH 里(npm install -g codewhale --allow-scripts=codewhale)。',
41
+ codewhaleNote: 'Codewhale 的技能调用在事件流里是名为 load_skill 的工具调用:第一个 input.name 等于被测技能才算触发(查询和列目录不算)。试跑在一个只装了被测技能的临时 HOME 里进行,只开放 load_skill 这一个工具;用 DEEPSEEK_API_KEY。费用取决于后端和你的计划。这是 Codewhale 的数字,不与其他宿主的合并比较。需要 codewhale 在 PATH 里(npm install -g codewhale --allow-scripts=codewhale)。',
40
42
  hostCodex: 'Codex',
41
43
  hostCodexHint: '触发不可观测:只测静态与激活探针',
42
44
  codexNote: 'Codex 把技能当作宿主侧上下文注入,事件流里没有"技能被调用"这一项(只有 command_execution / file_change / mcp_tool_call 等)。所以这里不给触发率——给了就是编的。替代方案是激活探针:同一请求装与不装各跑一次,比首个动作与改动文件。',
@@ -67,9 +69,7 @@ const MESSAGES = {
67
69
  depthDeepHint: '~10 分钟 · 加只读探索与配对增益',
68
70
  providerQ: '用哪个后端?',
69
71
  provClaude: 'Claude Code 订阅',
70
- provClaudeHint: '占周额度',
71
72
  provDeepseek: 'DeepSeek',
72
- provDeepseekHint: '按 DeepSeek 用量计费',
73
73
  provManual: '手动输入模型名',
74
74
  modelQ: '模型',
75
75
  modelOptionalQ: '模型(直接回车 = 默认模型)',
@@ -90,7 +90,6 @@ const MESSAGES = {
90
90
  modelExpensive: '最贵',
91
91
  needBaseUrl: '需要先设置后端:\n ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic\n ANTHROPIC_AUTH_TOKEN=<你的 key>',
92
92
  backendLine: '后端:{backend} 模型:{model}',
93
- estimate: '即将运行:{skills} 个技能 × {trials} 次试跑 ≈ 每个 {minutes} 分钟,合计约 {totalMinutes} 分钟\n费用取决于后端和计划:订阅走额度,DeepSeek 按量计费(这里不估金额)',
94
93
  confirmRun: '继续?',
95
94
  cancelled: '已取消。免费的静态层不需要确认:npx skillgauntlet static <目录>',
96
95
  staticDone: '静态层:{verdicts}',
@@ -132,6 +131,13 @@ const MESSAGES = {
132
131
  'chart.otherSkill': '改用别的技能:{name}',
133
132
  'chart.more': '…还有 {n} 题,见完整报告',
134
133
  'chart.wrongTitle': '不该触发却触发的 {n} 次',
134
+ modelUnknown: '{host} 的模型清单里没有“{model}”。它现在支持:{list}。请重新选一个,或选“默认模型”。',
135
+ updateAvail: '有新版本 {latest}(你现在用的是 {current})。',
136
+ updateQ: '要更新吗?',
137
+ updateNow: '更新并重新启动',
138
+ updateSkip: '先用当前版本(这个版本不再提醒)',
139
+ updating: '正在下载新版 {latest}…',
140
+ updateFailed: '更新没有成功:{why}。继续使用当前版本 {current}。',
135
141
  waitCloning: '正在下载仓库(大仓库可能要几十秒)…',
136
142
  waitAnalyze: '正在做静态检查…',
137
143
  waitModels: '正在读取 {host} 的模型列表…',
@@ -146,7 +152,7 @@ const MESSAGES = {
146
152
  'chart.probeMixed': '读法:第一步和产出只有一项不同,信号弱;只跑了一次,不能下结论。',
147
153
  'chart.static': '静态检查(不调用模型)',
148
154
  'chart.staticLegend': '✓ 通过 ! 警告(值得看一眼) ✗ 失败(建议处理);每项的完整说明见完整报告',
149
- noSubmitNoSource: '这个技能不是从公开的 GitHub 仓库测的(本地目录或已安装的技能),榜单需要知道它来自哪个仓库的哪个提交,所以不能提交。想提交,请用“GitHub 仓库”这个来源再测一次。',
155
+ noSubmitNoSource: '这次的结果暂时不能自动提交:程序看不出这个技能来自哪个公开仓库的哪个提交。\n有两种办法:\n 1. 如果技能在带 GitHub origin 的 git 仓库里,把改动提交并推送到 GitHub,再对同一目录重测(榜单会核对公开仓库里的 SKILL.md 与你测的一致)。\n 2. 你知道它的仓库和提交,直接用下面的命令补上(--subdir 是技能在仓库里的子目录,在仓库根目录就省略):\n {cmd}',
150
156
  'chart.trigger': '触发率:该用这个技能的时候,它被用上了吗',
151
157
  'chart.verdict': '结论',
152
158
  'chart.grade.well': '触发准确',
@@ -166,7 +172,7 @@ const MESSAGES = {
166
172
  'chart.gainLegend': '每项是一条程序能判分的要求,条越长越符合',
167
173
  'chart.full': '完整报告:{path}',
168
174
  progressLine: '试跑',
169
- draftFirst: '接下来先为每个技能出题(每个技能 1 次模型调用),出完会告诉你确切的试跑次数,你同意后才开始试跑。费用取决于后端和你的计划(订阅走额度,DeepSeek 按用量计费)。',
175
+ draftFirst: '接下来先为每个技能出题(每个技能 1 次模型调用),出完会告诉你确切的试跑次数,你同意后才开始试跑。费用取决于后端和你的计划。',
170
176
  trialsQ: '{q} 道题 × {runs} 次 = {n} 次试跑,约 {minutes} 分钟。',
171
177
  trialsGo: '开始试跑',
172
178
  trialsAll: '开始,后面的技能不再逐个询问',
@@ -373,6 +379,8 @@ const MESSAGES = {
373
379
  srcInstalledHint: 'scans .agents/skills, .claude/skills, .codex/skills',
374
380
  srcPath: 'Another local directory',
375
381
  srcRepo: 'GitHub repository (not installed)',
382
+ srcRepoHint: 'owner/repo · results can be shared',
383
+ sourceNote: 'Tip: to share the results on the public leaderboard, the easiest is "GitHub repository": the program then knows which repository and commit the skill came from. An installed skill or a local folder can be shared too, but only if it is in a git repository with a GitHub origin and its changes are committed and pushed; otherwise you supply the repository and commit yourself, and the results page gives you the command.',
376
384
  noInstalled: 'No installed skills found on this machine.',
377
385
  foundInstalled: 'Found {n} installed skills.',
378
386
  scopeQ: 'Which ones?',
@@ -396,7 +404,7 @@ const MESSAGES = {
396
404
  needDeepseekKey: 'To use a DeepSeek model, set DEEPSEEK_API_KEY in the environment first (a variable only; keep the key out of the command line and files).',
397
405
  hostCodewhale: 'Codewhale',
398
406
  hostCodewhaleHint: 'trigger rate is measurable (formerly DeepSeek-TUI, runs DeepSeek models)',
399
- codewhaleNote: 'In Codewhale a skill call is a tool call named load_skill: the first one whose input.name equals the tested skill counts as a trigger (a query or a catalogue listing does not). Trials run in a throw-away HOME holding only the tested skill, with load_skill as the only tool; it uses DEEPSEEK_API_KEY and spends DeepSeek cash. The number is a Codewhale number and is not merged with another host. It needs codewhale on PATH (npm install -g codewhale --allow-scripts=codewhale).',
407
+ codewhaleNote: 'In Codewhale a skill call is a tool call named load_skill: the first one whose input.name equals the tested skill counts as a trigger (a query or a catalogue listing does not). Trials run in a throw-away HOME holding only the tested skill, with load_skill as the only tool; it uses DEEPSEEK_API_KEY. Cost depends on the backend and your plan. The number is a Codewhale number and is not merged with another host. It needs codewhale on PATH (npm install -g codewhale --allow-scripts=codewhale).',
400
408
  hostCodex: 'Codex',
401
409
  hostCodexHint: 'trigger is not observable: static plus an activation probe',
402
410
  codexNote: 'Codex injects a skill as host-side context; the event stream has no "skill was used" item (only command_execution, file_change, mcp_tool_call). A trigger rate here would have to be invented, so instead there is an activation probe: the same request with and without the skill, comparing the first action and the files changed.',
@@ -427,9 +435,7 @@ const MESSAGES = {
427
435
  depthDeepHint: '~10 min · adds read-only exploration and paired gain',
428
436
  providerQ: 'Which backend?',
429
437
  provClaude: 'Claude Code subscription',
430
- provClaudeHint: 'spends weekly quota',
431
438
  provDeepseek: 'DeepSeek',
432
- provDeepseekHint: 'billed by DeepSeek usage',
433
439
  provManual: 'Type a model name',
434
440
  modelQ: 'Model',
435
441
  modelOptionalQ: 'Model (press Enter for the default)',
@@ -450,7 +456,6 @@ const MESSAGES = {
450
456
  modelExpensive: 'most expensive',
451
457
  needBaseUrl: 'Set the backend first:\n ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic\n ANTHROPIC_AUTH_TOKEN=<your key>',
452
458
  backendLine: 'Backend: {backend} model: {model}',
453
- estimate: 'About to run: {skills} skill(s) × {trials} trials ≈ {minutes} min each, {totalMinutes} min in total\nCost depends on the backend and plan: a subscription spends quota, DeepSeek bills per use (no amount is estimated here)',
454
459
  confirmRun: 'Continue?',
455
460
  cancelled: 'Cancelled. The free static layer needs no confirmation: npx skillgauntlet static <dir>',
456
461
  staticDone: 'Static: {verdicts}',
@@ -492,6 +497,13 @@ const MESSAGES = {
492
497
  'chart.otherSkill': 'used another skill: {name}',
493
498
  'chart.more': '…{n} more, see the full report',
494
499
  'chart.wrongTitle': '{n} times it triggered when it should not have',
500
+ modelUnknown: '{host} does not list a model called "{model}". It currently supports: {list}. Pick another, or choose the default model.',
501
+ updateAvail: 'A newer version {latest} is available (you are on {current}).',
502
+ updateQ: 'Update?',
503
+ updateNow: 'Update and restart',
504
+ updateSkip: 'Keep this version (do not ask about this one again)',
505
+ updating: 'Downloading {latest}…',
506
+ updateFailed: 'The update did not work: {why}. Continuing with {current}.',
495
507
  waitCloning: 'Downloading the repository (a big one can take tens of seconds)…',
496
508
  waitAnalyze: 'Running the static checks…',
497
509
  waitModels: 'Reading the model list from {host}…',
@@ -506,7 +518,7 @@ const MESSAGES = {
506
518
  'chart.probeMixed': 'Reading: only one of the first step and the output differs, a weak signal; one run each is not a conclusion.',
507
519
  'chart.static': 'Static checks (no model calls)',
508
520
  'chart.staticLegend': '✓ pass ! warning (worth a look) ✗ fail (should be handled); each check is explained in the full report',
509
- noSubmitNoSource: 'This skill was not tested from a public GitHub repository (a local folder or an installed skill). The leaderboard needs to know which repository and commit it came from, so it cannot be submitted. To submit, test it again using the "GitHub repository" source.',
521
+ noSubmitNoSource: 'These results cannot be submitted automatically yet: the program cannot tell which public repository and commit this skill came from.\nTwo ways forward:\n 1. If the skill is in a git repository with a GitHub origin, commit and push your changes, then test the same folder again (the leaderboard checks that SKILL.md in the public repository matches what you tested).\n 2. If you know its repository and commit, add them with the command below (--subdir is the skill\'s folder inside the repository; leave it out at the repository root):\n {cmd}',
510
522
  'chart.trigger': 'Trigger rate: is the skill used when it should be?',
511
523
  'chart.verdict': 'Verdict',
512
524
  'chart.grade.well': 'triggers accurately',
@@ -526,7 +538,7 @@ const MESSAGES = {
526
538
  'chart.gainLegend': 'Each item is a requirement a program can grade; a longer bar means more of it is met',
527
539
  'chart.full': 'Full report: {path}',
528
540
  progressLine: 'Trials',
529
- draftFirst: 'Next, questions are drafted for each skill (one model call per skill). You will then be told the exact number of trials and nothing is run until you agree. Cost depends on the backend and your plan (a subscription spends quota, DeepSeek bills per use).',
541
+ draftFirst: 'Next, questions are drafted for each skill (one model call per skill). You will then be told the exact number of trials and nothing is run until you agree. Cost depends on the backend and your plan.',
530
542
  trialsQ: '{q} questions × {runs} run(s) = {n} trials, about {minutes} min.',
531
543
  trialsGo: 'Start the trials',
532
544
  trialsAll: 'Start, and do not ask again for the next skills',
@@ -728,6 +740,8 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
728
740
  srcInstalledHint: '.agents/skills、.claude/skills、.codex/skills を走査',
729
741
  srcPath: '別のローカルディレクトリ',
730
742
  srcRepo: 'GitHub リポジトリ(未インストール)',
743
+ srcRepoHint: 'owner/repo · 結果を共有できます',
744
+ sourceNote: 'ヒント:結果を公開リーダーボードで共有するなら「GitHub リポジトリ」が最も簡単です。スキルがどのリポジトリのどのコミットかをプログラムが自動で把握します。インストール済みのスキルやローカルフォルダも共有できますが、GitHub の origin を持つ git リポジトリにあり、変更がコミット・プッシュ済みであることが条件です。そうでなければリポジトリとコミットを自分で指定します(結果画面にコマンドが表示されます)。',
731
745
  noInstalled: 'このマシンにインストール済みのスキルが見つかりません。',
732
746
  foundInstalled: 'インストール済みのスキルが {n} 件見つかりました。',
733
747
  scopeQ: 'どれをテストしますか?',
@@ -753,7 +767,7 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
753
767
  needDeepseekKey: 'DeepSeek のモデルを使うには、先に環境変数 DEEPSEEK_API_KEY を設定してください(変数にのみ置き、キーをコマンドラインやファイルに書かないでください)。',
754
768
  hostCodewhale: 'Codewhale',
755
769
  hostCodewhaleHint: '発動率を測定できます(旧 DeepSeek-TUI、DeepSeek のモデルで動作)',
756
- codewhaleNote: 'Codewhale では、スキルの呼び出しは load_skill という名前のツール呼び出しです。最初の呼び出しの input.name が対象スキルと一致した場合のみ発動とみなします(検索や一覧表示は含みません)。試行は対象スキルだけを入れた使い捨ての HOME で行い、使えるツールは load_skill のみです。DEEPSEEK_API_KEY を使い、DeepSeek の現金がかかります。これは Codewhale の数値であり、他のホストの数値とは合算・比較しません。codewhale が PATH 上に必要です(npm install -g codewhale --allow-scripts=codewhale)。',
770
+ codewhaleNote: 'Codewhale では、スキルの呼び出しは load_skill という名前のツール呼び出しです。最初の呼び出しの input.name が対象スキルと一致した場合のみ発動とみなします(検索や一覧表示は含みません)。試行は対象スキルだけを入れた使い捨ての HOME で行い、使えるツールは load_skill のみです。DEEPSEEK_API_KEY を使います。費用はバックエンドとプランによります。これは Codewhale の数値であり、他のホストの数値とは合算・比較しません。codewhale が PATH 上に必要です(npm install -g codewhale --allow-scripts=codewhale)。',
757
771
  codexNote: 'Codex はスキルをホスト側のコンテキストとして注入するため、イベントストリームに「スキルが使われた」という項目がありません(command_execution / file_change / mcp_tool_call などのみ)。ここで発動率を出すと作り話になるので出しません。代わりに有効化プローブを使います:同じリクエストをスキルあり・なしで 1 回ずつ実行し、最初の動作と変更されたファイルを比べます。',
758
772
  probeQ: '有効化プローブを実行しますか?(2 回実行)',
759
773
  probeRun: 'プローブ実行中(スキルあり、次にスキルなし)…',
@@ -782,9 +796,7 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
782
796
  depthDeepHint: '約 10 分 · 読み取り専用の探索とペア比較の効果測定を追加',
783
797
  providerQ: 'どのバックエンドを使いますか?',
784
798
  provClaude: 'Claude Code サブスクリプション',
785
- provClaudeHint: '週間の利用枠を消費',
786
799
  provDeepseek: 'DeepSeek',
787
- provDeepseekHint: 'DeepSeek の従量課金',
788
800
  provManual: 'モデル名を手入力',
789
801
  modelQ: 'モデル',
790
802
  modelOptionalQ: 'モデル(Enter で既定のモデル)',
@@ -805,7 +817,6 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
805
817
  modelExpensive: '最も高価',
806
818
  needBaseUrl: '先にバックエンドを設定してください:\n ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic\n ANTHROPIC_AUTH_TOKEN=<あなたの key>',
807
819
  backendLine: 'バックエンド:{backend} モデル:{model}',
808
- estimate: '実行予定:{skills} 件のスキル × {trials} 回の試行 ≈ 1 件あたり {minutes} 分、合計約 {totalMinutes} 分\n費用はバックエンドとプランによります:サブスクリプションは利用枠を消費し、DeepSeek は従量課金です(ここでは金額を見積もりません)',
809
820
  confirmRun: '続行しますか?',
810
821
  cancelled: 'キャンセルしました。無料の静的チェックは確認不要です:npx skillgauntlet static <ディレクトリ>',
811
822
  staticDone: '静的チェック:{verdicts}',
@@ -900,6 +911,13 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
900
911
  'chart.otherSkill': '別のスキルを使用:{name}',
901
912
  'chart.more': '…ほか {n} 件は詳細レポートへ',
902
913
  'chart.wrongTitle': '発動すべきでないのに発動した {n} 回',
914
+ modelUnknown: '{host} のモデル一覧に「{model}」はありません。現在対応:{list}。別のものを選ぶか、既定のモデルを選んでください。',
915
+ updateAvail: '新しいバージョン {latest} があります(現在は {current})。',
916
+ updateQ: '更新しますか?',
917
+ updateNow: '更新して再起動',
918
+ updateSkip: '今のバージョンのまま使う(このバージョンは再通知しない)',
919
+ updating: '{latest} をダウンロード中…',
920
+ updateFailed: '更新に失敗しました:{why}。現在の {current} で続行します。',
903
921
  waitCloning: 'リポジトリをダウンロード中(大きいものは数十秒かかります)…',
904
922
  waitAnalyze: '静的チェックを実行中…',
905
923
  waitModels: '{host} のモデル一覧を読み込み中…',
@@ -914,7 +932,7 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
914
932
  'chart.probeMixed': '読み方:最初の動作と成果物のどちらか一方だけが異なり、弱い信号です。各 1 回では結論は出せません。',
915
933
  'chart.static': '静的チェック(モデル呼び出しなし)',
916
934
  'chart.staticLegend': '✓ 合格 ! 警告(確認推奨) ✗ 不合格(対処推奨)。各項目の説明は詳細レポートに',
917
- noSubmitNoSource: 'このスキルは公開 GitHub リポジトリからテストされていません(ローカルフォルダまたはインストール済み)。リーダーボードにはどのリポジトリのどのコミットかが必要なため提出できません。提出するには「GitHub リポジトリ」から選んでもう一度テストしてください。',
935
+ noSubmitNoSource: '今回の結果はまだ自動提出できません:このスキルがどの公開リポジトリのどのコミットか、プログラムには分かりません。\n方法は 2 つあります:\n 1. スキルが GitHub の origin を持つ git リポジトリにあるなら、変更をコミットして GitHub にプッシュし、同じフォルダをもう一度テストします(リーダーボードは公開リポジトリの SKILL.md がテストした内容と一致するか確認します)。\n 2. リポジトリとコミットが分かっているなら、次のコマンドで補います(--subdir はリポジトリ内のスキルのフォルダ。リポジトリ直下なら省略):\n {cmd}',
918
936
  'chart.trigger': '発動率:使うべき時にスキルが使われるか',
919
937
  'chart.verdict': '評価',
920
938
  'chart.grade.well': '正確に発動',
@@ -934,7 +952,7 @@ Layer 0 always runs first: it is free, and it disqualifies most problems before
934
952
  'chart.gainLegend': '各項目はプログラムが採点できる要件です。バーが長いほど満たしています',
935
953
  'chart.full': '詳細レポート:{path}',
936
954
  progressLine: '試行',
937
- draftFirst: 'まず各スキルのテスト用質問を作成します(スキルごとにモデル呼び出し 1 回)。その後、試行回数を正確にお知らせし、同意いただいてから試行を開始します。費用はバックエンドとプランによります(サブスクリプションは利用枠を消費、DeepSeek は従量課金)。',
955
+ draftFirst: 'まず各スキルのテスト用質問を作成します(スキルごとにモデル呼び出し 1 回)。その後、試行回数を正確にお知らせし、同意いただいてから試行を開始します。費用はバックエンドとプランによります。',
938
956
  trialsQ: '質問 {q} 件 × {runs} 回 = {n} 回の試行、約 {minutes} 分。',
939
957
  trialsGo: '試行を開始する',
940
958
  trialsAll: '開始し、以降のスキルでは確認しない',
package/lib/models.js CHANGED
@@ -36,3 +36,11 @@ export function hostModels(host, bin, exec = run) {
36
36
  } catch { /* the caller falls back to typing */ }
37
37
  return [];
38
38
  }
39
+
40
+ // A model the user typed that the host does not list would fail only after the question-drafting call started. Names the
41
+ // package turns into a DeepSeek model of its own (deepseek-*) are exempt: they are not in the host's list by design.
42
+ // Returns the host's current list when the name is not in it, else null (also null when the list could not be read).
43
+ export function unknownModel(model, known) {
44
+ if (!model || !known?.length || known.includes(model) || /^deepseek/i.test(model)) return null;
45
+ return known;
46
+ }
package/lib/static.js CHANGED
@@ -158,9 +158,9 @@ export function analyze(skillDir) {
158
158
  // E. description quality -- the only layer that is also the trigger layer's input
159
159
  const E = [];
160
160
  E.push(check('E1', desc ? 'pass' : 'fail', desc ? 'check.E1.detail' : 'check.E1.missing', { chars: desc.length }));
161
- const tw = hits(desc, RE.triggerWords, 1);
161
+ const tw = hits(desc, RE.triggerWords, 1, 'SKILL.md (description)');
162
162
  E.push(check('E2', tw.length ? 'pass' : 'warn', tw.length ? 'check.E2.hit' : 'check.E2.miss'));
163
- const wide = hits(desc, RE.wide, 1);
163
+ const wide = hits(desc, RE.wide, 1, 'SKILL.md (description)');
164
164
  E.push(check('E3', wide.length ? 'warn' : 'pass', wide.length ? 'check.E3.hit' : 'check.E3.none', {}, wide));
165
165
  const clauses = (desc.match(/\bor\b|、|,|,|\//g) || []).length + 1;
166
166
  E.push(check('E4', 'info', 'check.E4.detail', { n: clauses }));
package/lib/trial.js CHANGED
@@ -8,7 +8,7 @@
8
8
  // answers without calling any tool -> not_triggered, counted apart
9
9
  //
10
10
  // NOT YET VERIFIED against a live host: written from the Python runner, exercised only in dry-run.
11
- import { execFileSync, spawn } from 'node:child_process';
11
+ import { execFileSync, spawn, spawnSync } from 'node:child_process';
12
12
  import fs from 'node:fs';
13
13
  import os from 'node:os';
14
14
  import path from 'node:path';
@@ -31,12 +31,19 @@ export const HOSTS = {
31
31
  export function backendFor(host, model) {
32
32
  if (host === 'codewhale') return 'codewhale:api.deepseek.com';
33
33
  if (host !== 'codebuddy') return backendHost();
34
- return isDeepseekModel(model) ? 'codebuddy:api.deepseek.com' : 'codebuddy';
34
+ return usesOwnDeepseek('codebuddy', model) ? 'codebuddy:api.deepseek.com' : 'codebuddy';
35
35
  }
36
36
 
37
37
  // A model id starting with "deepseek" means the DeepSeek API, whichever host drives it.
38
38
  export const isDeepseekModel = (model) => /^deepseek/i.test(String(model || ''));
39
39
 
40
+ // A DeepSeek model that the host lists itself (CodeBuddy's own deepseek-v4.1-flash) is served by the host's account
41
+ // and needs no key of ours. Only a deepseek-* name the host does not list takes the package's own DeepSeek route
42
+ // (a models.json entry in the trial directory and DEEPSEEK_API_KEY from the environment).
43
+ const nativeModels = new Map();
44
+ export const setNativeModels = (host, list) => nativeModels.set(host, new Set(list || []));
45
+ export const usesOwnDeepseek = (host, model) => isDeepseekModel(model) && !nativeModels.get(host)?.has(model);
46
+
40
47
  // DeepSeek's integration guide for WorkBuddy/CodeBuddy: a models.json entry whose key is read from the
41
48
  // environment (${DEEPSEEK_API_KEY}), so the file holds no secret. It is written into the trial's own
42
49
  // directory (project level), never into the user's ~/.codebuddy.
@@ -111,18 +118,35 @@ export function requireHost(host, probe = binInstalled) {
111
118
 
112
119
  // One tiny call before the real work: a host that is not signed in retries silently for minutes, so the user
113
120
  // would stare at a frozen screen. A short timeout turns that into an immediate, actionable message.
114
- export function pingHost(host, { bin, model = null, timeout = 90, run = execFileSync } = {}) {
121
+ // The first non-empty line of some CLI output, for an error message.
122
+ const firstLine = (text) => String(text || '').split(LINE_BREAK).map((l) => l.trim()).find(Boolean) || '';
123
+
124
+ // What a host CLI answered, as an error reason: the CLI's own words when it gave any. A CLI can exit 0 with nothing on
125
+ // stdout and its complaint on stderr (CodeBuddy does for a custom model without an endpoint url), so a clean exit
126
+ // status proves nothing; an empty or unreadable stdout is the failure.
127
+ export function hostAnswerProblem(r, timeout) {
128
+ if (r.error) return r.error.code === 'ETIMEDOUT' ? `no answer within ${timeout}s` : String(r.error.message).split(LINE_BREAK)[0];
129
+ if (r.signal) return `no answer within ${timeout}s`;
130
+ const out = String(r.stdout || '');
131
+ if (r.status !== 0) return firstLine(r.stderr) || firstLine(out) || `exit status ${r.status}`;
132
+ if (!out.trim()) return firstLine(r.stderr) || 'the CLI answered with nothing';
133
+ try {
134
+ const parsed = JSON.parse(out);
135
+ const last = Array.isArray(parsed) ? parsed.filter((m) => m?.type === 'result').pop() : parsed;
136
+ if (last?.is_error) return firstLine(last.result) || 'the CLI reported an error';
137
+ } catch { return firstLine(out); }
138
+ return null;
139
+ }
140
+
141
+ export function pingHost(host, { bin, model = null, timeout = 90, spawn = spawnSync } = {}) {
115
142
  const spec = HOSTS[host];
116
143
  if (!spec || host === 'codewhale') return;
117
144
  const args = ['-p', 'Reply with the single word OK.', '--output-format', 'json', '--tools', '', '--no-session-persistence'];
118
- if (model && !isDeepseekModel(model)) args.push('--model', model);
145
+ if (model && !usesOwnDeepseek(host, model)) args.push('--model', model); // the package's own DeepSeek route has no host-side name
119
146
  const launch = launchSpec(bin, args, spec.bin);
120
- try {
121
- run(launch.cmd, launch.args, { encoding: 'utf8', timeout: timeout * 1000, shell: launch.shell, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
122
- } catch (err) {
123
- const why = err.code === 'ETIMEDOUT' || err.killed
124
- ? `no answer within ${timeout}s`
125
- : String(err.stderr || err.message).split(LINE_BREAK).map((l) => l.trim()).find(Boolean) || `exit status ${err.status}`;
147
+ const r = spawn(launch.cmd, launch.args, { encoding: 'utf8', timeout: timeout * 1000, shell: launch.shell, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
148
+ const why = hostAnswerProblem(r, timeout);
149
+ if (why) {
126
150
  const e = new Error(`host ${host} did not answer: ${why}`);
127
151
  e.messageKey = 'hostNotReady';
128
152
  e.vars = { host: HOST_NAME[host] || host, why: why.slice(0, 200) };
@@ -216,7 +240,7 @@ export function runTrial({ bin, skillDir, skillName, query, model, timeout = 180
216
240
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sg-'));
217
241
  const spec = HOSTS[host];
218
242
  copyDir(skillDir, path.join(tmp, ...spec.skillsDir, skillName));
219
- if (host === 'codebuddy' && isDeepseekModel(model)) writeModelsJson(tmp, model);
243
+ if (host === 'codebuddy' && usesOwnDeepseek('codebuddy', model)) writeModelsJson(tmp, model);
220
244
  const args = host === 'codebuddy'
221
245
  ? ['-p', query, '--output-format', 'stream-json', '--verbose', '--setting-sources', 'project', '--strict-mcp-config',
222
246
  '--no-session-persistence', '--tools', spec.tools]
@@ -389,23 +413,24 @@ ${text}`;
389
413
  const launch = launchSpec(bin, args, HOSTS[host].bin);
390
414
  // CodeBuddy reads a custom model from the working directory's .codebuddy/models.json, so a DeepSeek draft
391
415
  // runs in a scratch directory that has one.
392
- const scratch = host === 'codebuddy' && isDeepseekModel(model) ? fs.mkdtempSync(path.join(os.tmpdir(), 'sg-draft-')) : null;
416
+ const scratch = host === 'codebuddy' && usesOwnDeepseek('codebuddy', model) ? fs.mkdtempSync(path.join(os.tmpdir(), 'sg-draft-')) : null;
393
417
  if (scratch) writeModelsJson(scratch, model);
394
- let out;
418
+ let r;
395
419
  try {
396
- out = execFileSync(launch.cmd, launch.args, {
420
+ r = spawnSync(launch.cmd, launch.args, {
397
421
  encoding: 'utf8', timeout: timeout * 1000, maxBuffer: 32 * 1024 * 1024,
398
- shell: launch.shell, windowsHide: true, ...(scratch ? { cwd: scratch } : {}),
422
+ shell: launch.shell, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'], ...(scratch ? { cwd: scratch } : {}),
399
423
  });
400
- } catch (err) {
401
- // The default message of a failed execFileSync is the whole command line, which here is the drafting prompt.
402
- const why = err.code === 'ETIMEDOUT' || err.killed
403
- ? `no answer within ${timeout}s (a rejected key or an unreachable endpoint retries silently until then)`
404
- : String(err.stderr || err.message).split(/\r?\n/).map((l) => l.trim()).find(Boolean) || 'exit status ' + err.status;
405
- throw new Error(`the drafting call failed: ${why}`);
406
424
  } finally {
407
425
  if (scratch) { try { fs.rmSync(scratch, { recursive: true, force: true }); } catch { /* best effort */ } }
408
426
  }
427
+ // The CLI's own words, not "Unexpected end of JSON input": an empty answer with a complaint on stderr is common.
428
+ const problem = hostAnswerProblem(r, timeout);
429
+ if (problem) {
430
+ const hint = r.error?.code === 'ETIMEDOUT' || r.signal ? ' (a rejected key or an unreachable endpoint retries silently until then)' : '';
431
+ throw new Error(`the drafting call failed: ${problem}${hint}`);
432
+ }
433
+ const out = r.stdout;
409
434
  const parsed = JSON.parse(out);
410
435
  // Claude Code answers with one result object; CodeBuddy Code with the whole message list, whose last
411
436
  // element is the result.
package/lib/update.js ADDED
@@ -0,0 +1,73 @@
1
+ // A check for a newer published version before an interactive session. It must never get in the way: any failure
2
+ // (offline, slow registry, odd reply, unwritable cache) means "no update known" and the session goes on with the
3
+ // version that is running.
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const REGISTRY = 'https://registry.npmjs.org/skillgauntlet/latest';
10
+ const CHECK_EVERY_MS = 12 * 60 * 60 * 1000;
11
+ const here = path.dirname(fileURLToPath(import.meta.url));
12
+
13
+ export function currentVersion() {
14
+ try { return JSON.parse(fs.readFileSync(path.join(here, '..', 'package.json'), 'utf8')).version; } catch { return null; }
15
+ }
16
+
17
+ // a.b.c with an optional pre-release tail; a pre-release is older than its release.
18
+ export function isNewer(latest, current) {
19
+ const parse = (v) => {
20
+ const m = String(v).trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);
21
+ return m ? { n: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] || null } : null;
22
+ };
23
+ const a = parse(latest);
24
+ const b = parse(current);
25
+ if (!a || !b) return false;
26
+ for (let i = 0; i < 3; i += 1) if (a.n[i] !== b.n[i]) return a.n[i] > b.n[i];
27
+ return Boolean(b.pre) && !a.pre;
28
+ }
29
+
30
+ // A copy that runs from a git checkout is a developer's own; it is not nagged about releases.
31
+ export function isCheckout() {
32
+ return fs.existsSync(path.join(here, '..', '.git'));
33
+ }
34
+
35
+ function cachePath() {
36
+ return path.join(process.env.SKILLGAUNTLET_CACHE || path.join(os.homedir(), '.cache', 'skillgauntlet'), 'update-check.json');
37
+ }
38
+
39
+ function readCache(file) {
40
+ try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return {}; }
41
+ }
42
+
43
+ function writeCache(file, data) {
44
+ try {
45
+ fs.mkdirSync(path.dirname(file), { recursive: true });
46
+ fs.writeFileSync(file, `${JSON.stringify(data)}\n`);
47
+ } catch { /* the cache is an optimisation */ }
48
+ }
49
+
50
+ // { current, latest } when a newer version is known and has not been declined, else null. Never throws.
51
+ export async function checkForUpdate({ fetchLatest, now = Date.now(), file = cachePath(), current = currentVersion(), env = process.env } = {}) {
52
+ try {
53
+ if (!current || env.SG_NO_UPDATE_CHECK || env.CI) return null;
54
+ const cache = readCache(file);
55
+ let latest = cache.latest;
56
+ if (!latest || !cache.checkedAt || now - cache.checkedAt > CHECK_EVERY_MS) {
57
+ const get = fetchLatest || (async () => {
58
+ const res = await fetch(REGISTRY, { signal: AbortSignal.timeout(3000), headers: { accept: 'application/json' } });
59
+ if (!res.ok) throw new Error(`registry ${res.status}`);
60
+ return (await res.json()).version;
61
+ });
62
+ latest = await get();
63
+ writeCache(file, { ...cache, latest, checkedAt: now });
64
+ }
65
+ if (!isNewer(latest, current) || cache.declined === latest) return null;
66
+ return { current, latest };
67
+ } catch { return null; }
68
+ }
69
+
70
+ // Remember that the user said no to this version, so the question is not asked again until a newer one appears.
71
+ export function declineUpdate(latest, file = cachePath()) {
72
+ writeCache(file, { ...readCache(file), declined: latest });
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillgauntlet",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Check an agent skill before you install it: context cost, permission surface, code risk, instruction hijacking, description quality, trigger rate and gain.",
5
5
  "type": "module",
6
6
  "bin": {