commitshow 0.1.4 → 0.1.5
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 +17 -6
- package/dist/index.js +2 -1
- package/dist/lib/api.js +5 -3
- package/package.json +1 -1
package/dist/commands/audit.js
CHANGED
|
@@ -4,6 +4,7 @@ import { renderAudit, renderMarkdown, renderJson, renderUpsell, renderQuotaFoote
|
|
|
4
4
|
import { c } from '../lib/colors.js';
|
|
5
5
|
export async function audit(args) {
|
|
6
6
|
const asJson = args.includes('--json');
|
|
7
|
+
const force = args.includes('--refresh') || args.includes('--force');
|
|
7
8
|
const positional = args.find(a => !a.startsWith('--'));
|
|
8
9
|
let target;
|
|
9
10
|
try {
|
|
@@ -16,11 +17,17 @@ export async function audit(args) {
|
|
|
16
17
|
}
|
|
17
18
|
throw err;
|
|
18
19
|
}
|
|
19
|
-
if (!asJson)
|
|
20
|
-
|
|
20
|
+
if (!asJson) {
|
|
21
|
+
if (force)
|
|
22
|
+
console.log(c.dim(`Refreshing audit for ${target.slug}…`));
|
|
23
|
+
else
|
|
24
|
+
console.log(c.dim(`Auditing ${target.slug}…`));
|
|
25
|
+
}
|
|
21
26
|
// 1. Try cached/registered flow first — avoid re-running Claude if we
|
|
22
27
|
// already have the snapshot. Covers all full-audition projects.
|
|
23
|
-
|
|
28
|
+
// --refresh / --force skips this entirely and goes straight to audit-preview
|
|
29
|
+
// with force=true (counts against IP + URL + global rate limits).
|
|
30
|
+
const project = force ? null : await findProjectByGithubUrl(target.github_url);
|
|
24
31
|
if (project) {
|
|
25
32
|
const [snapshot, standing] = await Promise.all([
|
|
26
33
|
fetchLatestSnapshot(project.id),
|
|
@@ -77,9 +84,13 @@ export async function audit(args) {
|
|
|
77
84
|
}
|
|
78
85
|
// 2. Unregistered repo — kick off a preview audit. Full Claude depth,
|
|
79
86
|
// no season entry. Rate-limited server-side.
|
|
80
|
-
if (!asJson)
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
if (!asJson) {
|
|
88
|
+
if (force)
|
|
89
|
+
console.log(c.dim('Forcing a fresh audit · counts against your daily IP cap…'));
|
|
90
|
+
else
|
|
91
|
+
console.log(c.dim('First time on commit.show for this repo — running a preview audit…'));
|
|
92
|
+
}
|
|
93
|
+
const result = await runPreviewAudit(target.github_url, undefined, { force });
|
|
83
94
|
// Error envelope
|
|
84
95
|
if ('error' in result) {
|
|
85
96
|
const err = result;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { status } from './commands/status.js';
|
|
|
5
5
|
import { login } from './commands/login.js';
|
|
6
6
|
import { whoami } from './commands/whoami.js';
|
|
7
7
|
import { c } from './lib/colors.js';
|
|
8
|
-
const VERSION = '0.1.
|
|
8
|
+
const VERSION = '0.1.5';
|
|
9
9
|
const USAGE = `
|
|
10
10
|
${c.bold(c.gold('commit.show'))} ${c.dim(`v${VERSION}`)} ${c.muted('—')} ${c.cream('audit any vibe-coded project from your terminal.')}
|
|
11
11
|
|
|
@@ -22,6 +22,7 @@ ${c.muted('COMMANDS')}
|
|
|
22
22
|
|
|
23
23
|
${c.muted('FLAGS')}
|
|
24
24
|
${c.gold('--json')} stable machine-readable output (for agents · CI · jq pipes)
|
|
25
|
+
${c.gold('--refresh')} bypass the 7-day cache · re-run a fresh audit ${c.dim('(counts against IP cap)')}
|
|
25
26
|
|
|
26
27
|
${c.muted('TARGET FORMS')} ${c.dim('(default: cwd)')}
|
|
27
28
|
${c.cream('commitshow audit')} ${c.dim('# cwd · git remote origin')}
|
package/dist/lib/api.js
CHANGED
|
@@ -61,12 +61,14 @@ export async function fetchStanding(projectId) {
|
|
|
61
61
|
const rows = await rest(`/season_standings?project_id=eq.${projectId}&limit=1`);
|
|
62
62
|
return rows[0] ?? null;
|
|
63
63
|
}
|
|
64
|
-
/** Kicks off (or returns cached) a preview audit. 202 → poll; 200 → done.
|
|
65
|
-
|
|
64
|
+
/** Kicks off (or returns cached) a preview audit. 202 → poll; 200 → done.
|
|
65
|
+
* force=true skips the 7-day cache and forces a fresh analyze-project run.
|
|
66
|
+
* Counts against IP + URL + global rate limits (real Claude spend). */
|
|
67
|
+
export async function runPreviewAudit(githubUrl, liveUrl, opts = {}) {
|
|
66
68
|
const res = await fetch(`${baseUrl()}/functions/v1/audit-preview`, {
|
|
67
69
|
method: 'POST',
|
|
68
70
|
headers: headers(),
|
|
69
|
-
body: JSON.stringify({ github_url: githubUrl, live_url: liveUrl }),
|
|
71
|
+
body: JSON.stringify({ github_url: githubUrl, live_url: liveUrl, force: opts.force === true }),
|
|
70
72
|
});
|
|
71
73
|
const body = await res.json().catch(() => ({ error: 'invalid_json' }));
|
|
72
74
|
if (res.status === 202)
|