commitshow 0.2.1 → 0.2.4
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/README.md +4 -4
- package/dist/commands/audit.js +9 -2
- package/dist/lib/api.js +24 -10
- package/dist/lib/render.js +9 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,16 +17,16 @@ The npm package + command is `commitshow` (no dot — npm doesn't allow it in
|
|
|
17
17
|
package names). Everything else uses the brand `commit.show`.
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npx commitshow audit
|
|
20
|
+
npx commitshow@latest audit
|
|
21
21
|
# or audit any public project by URL — no cd required
|
|
22
|
-
npx commitshow audit github.com/owner/repo
|
|
22
|
+
npx commitshow@latest audit github.com/owner/repo
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
# one-shot
|
|
29
|
-
npx commitshow audit <target>
|
|
29
|
+
npx commitshow@latest audit <target>
|
|
30
30
|
|
|
31
31
|
# or global
|
|
32
32
|
npm i -g commitshow
|
|
@@ -59,7 +59,7 @@ Node 20+.
|
|
|
59
59
|
| Shorthand | `commitshow audit owner/repo` |
|
|
60
60
|
|
|
61
61
|
Remote-URL mode works from any directory, which makes one-line X posts
|
|
62
|
-
(`npx commitshow audit <their-url>`) trivial.
|
|
62
|
+
(`npx commitshow@latest audit <their-url>`) trivial.
|
|
63
63
|
|
|
64
64
|
## The AI-coding loop
|
|
65
65
|
|
package/dist/commands/audit.js
CHANGED
|
@@ -27,7 +27,14 @@ export async function audit(args) {
|
|
|
27
27
|
// already have the snapshot. Covers all full-audition projects.
|
|
28
28
|
// --refresh / --force skips this entirely and goes straight to audit-preview
|
|
29
29
|
// with force=true (counts against IP + URL + global rate limits).
|
|
30
|
-
|
|
30
|
+
//
|
|
31
|
+
// We always look up `existing` (even on --force) so that we can capture the
|
|
32
|
+
// pre-refresh `last_analysis_at` baseline and poll for a *newer* snapshot.
|
|
33
|
+
// Without that baseline, polling sees the stale snapshot's timestamp as
|
|
34
|
+
// "ready" and returns it immediately.
|
|
35
|
+
const existing = await findProjectByGithubUrl(target.github_url);
|
|
36
|
+
const project = force ? null : existing;
|
|
37
|
+
const refreshBaseline = force ? (existing?.last_analysis_at ?? null) : null;
|
|
31
38
|
if (project) {
|
|
32
39
|
const [snapshot, standing] = await Promise.all([
|
|
33
40
|
fetchLatestSnapshot(project.id),
|
|
@@ -128,7 +135,7 @@ export async function audit(args) {
|
|
|
128
135
|
const pending = result;
|
|
129
136
|
if (!asJson)
|
|
130
137
|
console.log(c.dim(' This runs the full Claude audit · ~60-90 seconds. Hang tight.'));
|
|
131
|
-
const waited = await waitForPreviewSnapshot(pending.project_id);
|
|
138
|
+
const waited = await waitForPreviewSnapshot(pending.project_id, refreshBaseline);
|
|
132
139
|
if (!waited) {
|
|
133
140
|
emitError(asJson, 'timeout', 'Preview audit is taking longer than expected. Try `commitshow status <repo>` in a minute.', target.github_url);
|
|
134
141
|
return 1;
|
package/dist/lib/api.js
CHANGED
|
@@ -77,20 +77,34 @@ export async function runPreviewAudit(githubUrl, liveUrl, opts = {}) {
|
|
|
77
77
|
return body;
|
|
78
78
|
return body;
|
|
79
79
|
}
|
|
80
|
-
/** Poll a preview job until the snapshot lands or we time out.
|
|
81
|
-
|
|
80
|
+
/** Poll a preview job until the snapshot lands or we time out.
|
|
81
|
+
*
|
|
82
|
+
* `since` (ISO timestamp) is the baseline we wait past. For an INITIAL audit
|
|
83
|
+
* on a brand-new project, leave it undefined — any snapshot wins. For a
|
|
84
|
+
* REFRESH (force=true) on an existing project, pass the project's previous
|
|
85
|
+
* `last_analysis_at` so we keep polling until a *new* snapshot lands.
|
|
86
|
+
* Without this guard, a force-refresh against an already-analyzed project
|
|
87
|
+
* returns the stale snapshot immediately because `last_analysis_at` is
|
|
88
|
+
* already truthy. (Bug seen in 0.2.1 and earlier.) */
|
|
89
|
+
export async function waitForPreviewSnapshot(projectId, since, timeoutMs = 180_000, intervalMs = 4_000) {
|
|
90
|
+
const sinceMs = since ? new Date(since).getTime() : 0;
|
|
82
91
|
const deadline = Date.now() + timeoutMs;
|
|
83
92
|
while (Date.now() < deadline) {
|
|
84
93
|
const project = await findProjectById(projectId);
|
|
85
94
|
if (project && project.last_analysis_at) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
const lastMs = new Date(project.last_analysis_at).getTime();
|
|
96
|
+
// sinceMs === 0 → first ever audit, accept any snapshot.
|
|
97
|
+
// Otherwise require last_analysis_at to have advanced.
|
|
98
|
+
if (sinceMs === 0 || lastMs > sinceMs) {
|
|
99
|
+
const snapshot = await fetchLatestSnapshot(projectId);
|
|
100
|
+
return {
|
|
101
|
+
project,
|
|
102
|
+
snapshot,
|
|
103
|
+
standing: null,
|
|
104
|
+
is_preview: project.status === 'preview',
|
|
105
|
+
cache_hit: false,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
94
108
|
}
|
|
95
109
|
await new Promise(r => setTimeout(r, intervalMs));
|
|
96
110
|
}
|
package/dist/lib/render.js
CHANGED
|
@@ -39,14 +39,19 @@ const BIG_DIGITS = {
|
|
|
39
39
|
'/': [' █', ' ▄▀', ' ▄▀ ', ' ▄▀ ', '█ '],
|
|
40
40
|
' ': [' ', ' ', ' ', ' ', ' '],
|
|
41
41
|
};
|
|
42
|
-
/** Render a string ("68", "100", "82/100") as 5 rows of big ASCII.
|
|
42
|
+
/** Render a string ("68", "100", "82/100") as 5 rows of big ASCII.
|
|
43
|
+
* Uses 2-space gutters between glyphs (was 1) so adjacent block-char
|
|
44
|
+
* digits don't visually fuse — terminals render block runes at a width
|
|
45
|
+
* that often makes the 1-char gap collapse, especially for digits like
|
|
46
|
+
* '5' / '0' / '8' whose outer column is full block. */
|
|
43
47
|
function bigText(text) {
|
|
44
48
|
const rows = ['', '', '', '', ''];
|
|
49
|
+
const GAP = ' '; // 2-space gutter between digits
|
|
45
50
|
for (let i = 0; i < text.length; i++) {
|
|
46
51
|
const ch = text[i];
|
|
47
52
|
const glyph = BIG_DIGITS[ch] ?? BIG_DIGITS[' '];
|
|
48
53
|
for (let r = 0; r < 5; r++)
|
|
49
|
-
rows[r] += glyph[r] + (i < text.length - 1 ?
|
|
54
|
+
rows[r] += glyph[r] + (i < text.length - 1 ? GAP : '');
|
|
50
55
|
}
|
|
51
56
|
return rows;
|
|
52
57
|
}
|
|
@@ -117,7 +122,7 @@ export function renderAudit(view) {
|
|
|
117
122
|
// computed and exposed in JSON as `walk_on_audit_normalized` for agents
|
|
118
123
|
// that want a deterministic floor, but the user-facing big-digit uses
|
|
119
124
|
// the calibrated total.
|
|
120
|
-
const WALK_ON_AUDIT_MAX =
|
|
125
|
+
const WALK_ON_AUDIT_MAX = 50;
|
|
121
126
|
const isWalkOn = p.status === 'preview';
|
|
122
127
|
const total = p.score_total ?? 0;
|
|
123
128
|
// Header
|
|
@@ -323,7 +328,7 @@ export function toAgentShape(view) {
|
|
|
323
328
|
// Walk-on context fields. The user-facing score is Claude's calibrated
|
|
324
329
|
// total (score_total). `walk_on_audit_normalized` is the deterministic
|
|
325
330
|
// pillar-only fallback (Brief slot excluded · base /45).
|
|
326
|
-
const WALK_ON_AUDIT_MAX =
|
|
331
|
+
const WALK_ON_AUDIT_MAX = 50;
|
|
327
332
|
const isWalkOn = p.status === 'preview';
|
|
328
333
|
const walkOnTotal = isWalkOn ? (p.score_total ?? 0) : null;
|
|
329
334
|
const walkOnAuditNormalized = isWalkOn
|