commitshow 0.3.12 → 0.3.14

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.
@@ -1,12 +1,21 @@
1
1
  import { resolveTarget, verifyRemoteExists, TargetError } from '../lib/target.js';
2
2
  import { findProjectByGithubUrl, fetchLatestSnapshot, fetchStanding, runPreviewAudit, waitForPreviewSnapshot, } from '../lib/api.js';
3
- import { renderAudit, renderMarkdown, renderJson, renderUpsell, renderQuotaFooter, renderRateLimitDeny, renderAuditError, writeAuditMarkdown, writeAuditJson, } from '../lib/render.js';
3
+ import { renderAudit, renderMarkdown, renderJson, renderUpsell, renderStarCta, renderQuotaFooter, renderRateLimitDeny, renderAuditError, writeAuditMarkdown, writeAuditJson, } from '../lib/render.js';
4
4
  import { c } from '../lib/colors.js';
5
5
  import { Spinner } from '../lib/spinner.js';
6
6
  export async function audit(args) {
7
7
  const asJson = args.includes('--json');
8
8
  const force = args.includes('--refresh') || args.includes('--force');
9
- const positional = args.find(a => !a.startsWith('--'));
9
+ // --source=<name> · self-reported call origin (claude-code · cursor ·
10
+ // antigravity · gemini-cli · codex · raw-cli · etc.). Falls back to
11
+ // the COMMITSHOW_SOURCE env var (used by IDE plugins that wrap the
12
+ // CLI) and ultimately empty string. Surfaced in /admin > CLI 사용
13
+ // tab as a distribution chart.
14
+ const sourceFlag = args.find(a => a.startsWith('--source='))?.split('=')[1]
15
+ ?? args[args.indexOf('--source') + 1]?.replace(/^-/, '') // tolerate --source X
16
+ ?? process.env.COMMITSHOW_SOURCE
17
+ ?? null;
18
+ const positional = args.find(a => !a.startsWith('--') && a !== sourceFlag);
10
19
  let target;
11
20
  try {
12
21
  target = resolveTarget(positional);
@@ -93,6 +102,9 @@ export async function audit(args) {
93
102
  console.log('');
94
103
  console.log(renderUpsell(project.github_url ?? target.github_url));
95
104
  }
105
+ // Star CTA always lands last · highest-leverage moment for a star.
106
+ console.log('');
107
+ console.log(renderStarCta());
96
108
  console.log('');
97
109
  }
98
110
  if (target.kind === 'local') {
@@ -115,7 +127,7 @@ export async function audit(args) {
115
127
  else
116
128
  console.log(c.dim('First time on commit.show for this repo — running a preview audit…'));
117
129
  }
118
- const result = await runPreviewAudit(target.github_url, undefined, { force });
130
+ const result = await runPreviewAudit(target.github_url, undefined, { force, source: sourceFlag });
119
131
  // Error envelope
120
132
  if ('error' in result) {
121
133
  const err = result;
package/dist/lib/api.js CHANGED
@@ -18,12 +18,37 @@ const DEFAULT_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhY
18
18
  function baseUrl() {
19
19
  return readConfig().base_url ?? DEFAULT_BASE_URL;
20
20
  }
21
+ // Self-identifying User-Agent so the server can break down CLI hits by
22
+ // version + runtime + platform (visible in /admin > CLI 사용 탭).
23
+ // Anonymous — no PII, just version/runtime breakdown for traction signal.
24
+ // Format: 'commitshow-cli/<ver> node/<v> <platform>-<arch>'
25
+ // e.g. 'commitshow-cli/0.3.13 node/v20.10.0 darwin-arm64'
26
+ const CLI_USER_AGENT = (() => {
27
+ // package.json version is bundled at build time via tsc resolution; we
28
+ // still hardcode a fallback so a stripped binary doesn't crash.
29
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
30
+ let version = 'unknown';
31
+ try {
32
+ // Lazy-require so this import doesn't break in Deno-like envs.
33
+ // The build script copies package.json next to the bundle.
34
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
35
+ const pkg = require('../../package.json');
36
+ if (typeof pkg?.version === 'string')
37
+ version = pkg.version;
38
+ }
39
+ catch { /* fall through · version stays 'unknown' */ }
40
+ const node = process.version || 'node';
41
+ const plat = `${process.platform}-${process.arch}`;
42
+ return `commitshow-cli/${version} node/${node} ${plat}`;
43
+ })();
21
44
  function headers(extra = {}) {
22
45
  const cfg = readConfig();
23
46
  return {
24
47
  apikey: DEFAULT_ANON_KEY,
25
48
  Authorization: `Bearer ${cfg.token ?? DEFAULT_ANON_KEY}`,
26
49
  'Content-Type': 'application/json',
50
+ 'User-Agent': CLI_USER_AGENT,
51
+ 'X-Commitshow-Source': process.env.COMMITSHOW_SOURCE ?? '',
27
52
  ...extra,
28
53
  };
29
54
  }
@@ -68,7 +93,12 @@ export async function runPreviewAudit(githubUrl, liveUrl, opts = {}) {
68
93
  const res = await fetch(`${baseUrl()}/functions/v1/audit-preview`, {
69
94
  method: 'POST',
70
95
  headers: headers(),
71
- body: JSON.stringify({ github_url: githubUrl, live_url: liveUrl, force: opts.force === true }),
96
+ body: JSON.stringify({
97
+ github_url: githubUrl,
98
+ live_url: liveUrl,
99
+ force: opts.force === true,
100
+ source: opts.source ?? null,
101
+ }),
72
102
  });
73
103
  const body = await res.json().catch(() => ({ error: 'invalid_json' }));
74
104
  if (res.status === 202)
@@ -401,6 +401,17 @@ export function renderAudit(view) {
401
401
  lines.push(' '.repeat(footerPad) + c.gold(wordmark));
402
402
  return lines.join('\n');
403
403
  }
404
+ /**
405
+ * Star CTA · single line, brand-colored. The CLI prints this last on a
406
+ * successful audit (after renderAudit + any renderUpsell box) — the
407
+ * audit just delivered concrete value (concerns + score), which is the
408
+ * highest-leverage moment to ask for a GitHub star. Caller controls the
409
+ * placement so it always lands at the bottom of the full output.
410
+ */
411
+ export function renderStarCta() {
412
+ return ' ' + c.muted('★ Like what you see? Star us · ')
413
+ + c.cream('github.com/commitshow/commitshow');
414
+ }
404
415
  function vibeChecklistLines(vc) {
405
416
  const out = [];
406
417
  // 1. Webhook idempotency
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commitshow",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "commit.show CLI — audit any vibe-coded project from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {