commitshow 0.3.31 → 0.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/audit.js +38 -1
- package/dist/commands/extract.js +17 -4
- package/package.json +1 -1
package/dist/commands/audit.js
CHANGED
|
@@ -161,6 +161,39 @@ export async function audit(args) {
|
|
|
161
161
|
// Error envelope
|
|
162
162
|
if ('error' in result) {
|
|
163
163
|
const err = result;
|
|
164
|
+
// Friendly path for the most common CLI miss: trying to audit a
|
|
165
|
+
// private/missing/typo'd repo. Used to silently produce a 'ghost
|
|
166
|
+
// repo' snapshot scored 4 — confusing because users assumed their
|
|
167
|
+
// project actually scored that. Server now bails early with a
|
|
168
|
+
// dedicated envelope; we render a clear panel instead of a score.
|
|
169
|
+
if (err.error === 'github_inaccessible') {
|
|
170
|
+
if (asJson) {
|
|
171
|
+
process.stdout.write(JSON.stringify({
|
|
172
|
+
error: 'github_inaccessible',
|
|
173
|
+
reason: err.reason,
|
|
174
|
+
slug: err.slug,
|
|
175
|
+
github_url: err.github_url,
|
|
176
|
+
message: err.message,
|
|
177
|
+
hints: err.hints,
|
|
178
|
+
target: target.github_url,
|
|
179
|
+
}) + '\n');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
console.error('');
|
|
183
|
+
console.error(` ${c.scarlet('✗')} ${c.bold(c.cream("Couldn't reach"))} ${c.gold(err.slug ?? target.github_url)}`);
|
|
184
|
+
console.error('');
|
|
185
|
+
console.error(` ${c.muted(err.message ?? "We can't see this repo.")}`);
|
|
186
|
+
console.error('');
|
|
187
|
+
if (err.hints && err.hints.length > 0) {
|
|
188
|
+
console.error(` ${c.muted('common causes:')}`);
|
|
189
|
+
for (const hint of err.hints) {
|
|
190
|
+
console.error(` ${c.gold('·')} ${c.muted(hint)}`);
|
|
191
|
+
}
|
|
192
|
+
console.error('');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
164
197
|
if (err.error === 'rate_limited') {
|
|
165
198
|
if (asJson) {
|
|
166
199
|
process.stdout.write(JSON.stringify({
|
|
@@ -175,8 +208,12 @@ export async function audit(args) {
|
|
|
175
208
|
}
|
|
176
209
|
else {
|
|
177
210
|
console.error('');
|
|
211
|
+
// err.reason can include non-cap values (e.g. private_or_missing)
|
|
212
|
+
// since PreviewError unions all reasons; renderRateLimitDeny only
|
|
213
|
+
// accepts the cap variants — narrow the input before passing.
|
|
214
|
+
const capReason = err.reason === 'url_cap' || err.reason === 'global_cap' ? err.reason : 'ip_cap';
|
|
178
215
|
console.error(renderRateLimitDeny({
|
|
179
|
-
reason:
|
|
216
|
+
reason: capReason,
|
|
180
217
|
message: err.message ?? 'Rate limit hit. Try again later.',
|
|
181
218
|
limit: err.limit ?? 0,
|
|
182
219
|
count: err.count ?? 0,
|
package/dist/commands/extract.js
CHANGED
|
@@ -139,21 +139,34 @@ function copyToClipboard(text) {
|
|
|
139
139
|
export async function extract(args) {
|
|
140
140
|
const asJson = args.includes('--json');
|
|
141
141
|
const positional = args.find(a => !a.startsWith('--'));
|
|
142
|
-
|
|
142
|
+
// Unlike `audit`, extract doesn't NEED a GitHub URL — it just scans
|
|
143
|
+
// ~/.claude/projects/<encoded-cwd>/*.jsonl for token usage. github_url
|
|
144
|
+
// is purely optional metadata in the blob (helps the server match the
|
|
145
|
+
// receipt back to the right project on commit.show). So we try to
|
|
146
|
+
// resolve a target but fall back to a cwd-only target when there's no
|
|
147
|
+
// git remote — instead of bailing with audit's "No git remote" error.
|
|
148
|
+
let target = null;
|
|
143
149
|
try {
|
|
144
150
|
target = resolveTarget(positional, { workspace: null });
|
|
145
151
|
}
|
|
146
152
|
catch (e) {
|
|
147
153
|
if (e instanceof TargetError) {
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
// Treat as 'no github_url' rather than fatal · scan still works.
|
|
155
|
+
target = { github_url: null, localPath: positional ? positional : process.cwd() };
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
throw e;
|
|
150
159
|
}
|
|
151
|
-
throw e;
|
|
152
160
|
}
|
|
153
161
|
if (!asJson) {
|
|
154
162
|
console.log();
|
|
155
163
|
console.log(HEADER);
|
|
156
164
|
console.log();
|
|
165
|
+
if (!target.github_url) {
|
|
166
|
+
console.log(c.muted(` no git remote detected · receipt will scan local Claude Code sessions only`));
|
|
167
|
+
console.log(c.muted(` paste the blob into your project's audition form on commit.show — that's where it gets matched`));
|
|
168
|
+
console.log();
|
|
169
|
+
}
|
|
157
170
|
}
|
|
158
171
|
// Use the local cwd (or the path target) as the lookup key. Remote URL
|
|
159
172
|
// targets fall back to scanning the entire ~/.claude/projects/ for any
|