hacklab 0.22.3 → 26.921.1
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 +23 -430
- package/dist/index.js +132 -23
- package/package.json +20 -42
- package/LICENSE +0 -21
- package/dist/agent-handoff.d.ts +0 -51
- package/dist/agent-handoff.d.ts.map +0 -1
- package/dist/agent-handoff.js +0 -91
- package/dist/agent-handoff.js.map +0 -1
- package/dist/api-client.d.ts +0 -18
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -40
- package/dist/api-client.js.map +0 -1
- package/dist/belt.d.ts +0 -25
- package/dist/belt.d.ts.map +0 -1
- package/dist/belt.js +0 -113
- package/dist/belt.js.map +0 -1
- package/dist/card.d.ts +0 -66
- package/dist/card.d.ts.map +0 -1
- package/dist/card.js +0 -151
- package/dist/card.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -238
- package/dist/cli.js.map +0 -1
- package/dist/commands/book.d.ts +0 -14
- package/dist/commands/book.d.ts.map +0 -1
- package/dist/commands/book.js +0 -90
- package/dist/commands/book.js.map +0 -1
- package/dist/commands/chat.d.ts +0 -36
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js +0 -642
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -84
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -19
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -72
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drop.d.ts +0 -12
- package/dist/commands/drop.d.ts.map +0 -1
- package/dist/commands/drop.js +0 -103
- package/dist/commands/drop.js.map +0 -1
- package/dist/commands/drops.d.ts +0 -9
- package/dist/commands/drops.d.ts.map +0 -1
- package/dist/commands/drops.js +0 -96
- package/dist/commands/drops.js.map +0 -1
- package/dist/commands/essay.d.ts +0 -40
- package/dist/commands/essay.d.ts.map +0 -1
- package/dist/commands/essay.js +0 -651
- package/dist/commands/essay.js.map +0 -1
- package/dist/commands/hackathon.d.ts +0 -2
- package/dist/commands/hackathon.d.ts.map +0 -1
- package/dist/commands/hackathon.js +0 -893
- package/dist/commands/hackathon.js.map +0 -1
- package/dist/commands/hacker.d.ts +0 -2
- package/dist/commands/hacker.d.ts.map +0 -1
- package/dist/commands/hacker.js +0 -87
- package/dist/commands/hacker.js.map +0 -1
- package/dist/commands/jobs.d.ts +0 -18
- package/dist/commands/jobs.d.ts.map +0 -1
- package/dist/commands/jobs.js +0 -138
- package/dist/commands/jobs.js.map +0 -1
- package/dist/commands/keys.d.ts +0 -2
- package/dist/commands/keys.d.ts.map +0 -1
- package/dist/commands/keys.js +0 -138
- package/dist/commands/keys.js.map +0 -1
- package/dist/commands/login.d.ts +0 -83
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -236
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -22
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/org-jobs.d.ts +0 -50
- package/dist/commands/org-jobs.d.ts.map +0 -1
- package/dist/commands/org-jobs.js +0 -383
- package/dist/commands/org-jobs.js.map +0 -1
- package/dist/commands/org.d.ts +0 -67
- package/dist/commands/org.d.ts.map +0 -1
- package/dist/commands/org.js +0 -1244
- package/dist/commands/org.js.map +0 -1
- package/dist/commands/ping.d.ts +0 -2
- package/dist/commands/ping.d.ts.map +0 -1
- package/dist/commands/ping.js +0 -50
- package/dist/commands/ping.js.map +0 -1
- package/dist/commands/profile.d.ts +0 -72
- package/dist/commands/profile.d.ts.map +0 -1
- package/dist/commands/profile.js +0 -672
- package/dist/commands/profile.js.map +0 -1
- package/dist/commands/project.d.ts +0 -2
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -583
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/referral.d.ts +0 -6
- package/dist/commands/referral.d.ts.map +0 -1
- package/dist/commands/referral.js +0 -93
- package/dist/commands/referral.js.map +0 -1
- package/dist/commands/rtfm.d.ts +0 -9
- package/dist/commands/rtfm.d.ts.map +0 -1
- package/dist/commands/rtfm.js +0 -114
- package/dist/commands/rtfm.js.map +0 -1
- package/dist/commands/scan.d.ts +0 -13
- package/dist/commands/scan.d.ts.map +0 -1
- package/dist/commands/scan.js +0 -286
- package/dist/commands/scan.js.map +0 -1
- package/dist/commands/scout.d.ts +0 -18
- package/dist/commands/scout.d.ts.map +0 -1
- package/dist/commands/scout.js +0 -232
- package/dist/commands/scout.js.map +0 -1
- package/dist/commands/setup-rail.d.ts +0 -58
- package/dist/commands/setup-rail.d.ts.map +0 -1
- package/dist/commands/setup-rail.js +0 -135
- package/dist/commands/setup-rail.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -29
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -442
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -9
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -345
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/update.d.ts +0 -2
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js +0 -92
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -41
- package/dist/commands/whoami.js.map +0 -1
- package/dist/config.d.ts +0 -78
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -93
- package/dist/config.js.map +0 -1
- package/dist/daily-sync.d.ts +0 -150
- package/dist/daily-sync.d.ts.map +0 -1
- package/dist/daily-sync.js +0 -665
- package/dist/daily-sync.js.map +0 -1
- package/dist/dossier.d.ts +0 -73
- package/dist/dossier.d.ts.map +0 -1
- package/dist/dossier.js +0 -141
- package/dist/dossier.js.map +0 -1
- package/dist/field-normalize.d.ts +0 -4
- package/dist/field-normalize.d.ts.map +0 -1
- package/dist/field-normalize.js +0 -8
- package/dist/field-normalize.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/job-fields.d.ts +0 -47
- package/dist/job-fields.d.ts.map +0 -1
- package/dist/job-fields.js +0 -148
- package/dist/job-fields.js.map +0 -1
- package/dist/machine.d.ts +0 -15
- package/dist/machine.d.ts.map +0 -1
- package/dist/machine.js +0 -64
- package/dist/machine.js.map +0 -1
- package/dist/org-fields.d.ts +0 -57
- package/dist/org-fields.d.ts.map +0 -1
- package/dist/org-fields.js +0 -167
- package/dist/org-fields.js.map +0 -1
- package/dist/posthog.d.ts +0 -38
- package/dist/posthog.d.ts.map +0 -1
- package/dist/posthog.js +0 -224
- package/dist/posthog.js.map +0 -1
- package/dist/project-fields.d.ts +0 -40
- package/dist/project-fields.d.ts.map +0 -1
- package/dist/project-fields.js +0 -79
- package/dist/project-fields.js.map +0 -1
- package/dist/prompt-consent.d.ts +0 -73
- package/dist/prompt-consent.d.ts.map +0 -1
- package/dist/prompt-consent.js +0 -191
- package/dist/prompt-consent.js.map +0 -1
- package/dist/prompt-stats.d.ts +0 -226
- package/dist/prompt-stats.d.ts.map +0 -1
- package/dist/prompt-stats.js +0 -561
- package/dist/prompt-stats.js.map +0 -1
- package/dist/referral.d.ts +0 -14
- package/dist/referral.d.ts.map +0 -1
- package/dist/referral.js +0 -28
- package/dist/referral.js.map +0 -1
- package/dist/registry.d.ts +0 -15
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -180
- package/dist/registry.js.map +0 -1
- package/dist/resolve-command.d.ts +0 -20
- package/dist/resolve-command.d.ts.map +0 -1
- package/dist/resolve-command.js +0 -21
- package/dist/resolve-command.js.map +0 -1
- package/dist/scanners/antigravity.d.ts +0 -41
- package/dist/scanners/antigravity.d.ts.map +0 -1
- package/dist/scanners/antigravity.js +0 -210
- package/dist/scanners/antigravity.js.map +0 -1
- package/dist/scanners/github-copilot-telemetry.d.ts +0 -23
- package/dist/scanners/github-copilot-telemetry.d.ts.map +0 -1
- package/dist/scanners/github-copilot-telemetry.js +0 -220
- package/dist/scanners/github-copilot-telemetry.js.map +0 -1
- package/dist/scanners/github-copilot.d.ts +0 -68
- package/dist/scanners/github-copilot.d.ts.map +0 -1
- package/dist/scanners/github-copilot.js +0 -262
- package/dist/scanners/github-copilot.js.map +0 -1
- package/dist/scanners/incremental.d.ts +0 -282
- package/dist/scanners/incremental.d.ts.map +0 -1
- package/dist/scanners/incremental.js +0 -788
- package/dist/scanners/incremental.js.map +0 -1
- package/dist/scanners/index.d.ts +0 -116
- package/dist/scanners/index.d.ts.map +0 -1
- package/dist/scanners/index.js +0 -726
- package/dist/scanners/index.js.map +0 -1
- package/dist/scanners/sqlite.d.ts +0 -18
- package/dist/scanners/sqlite.d.ts.map +0 -1
- package/dist/scanners/sqlite.js +0 -63
- package/dist/scanners/sqlite.js.map +0 -1
- package/dist/scanners/util.d.ts +0 -112
- package/dist/scanners/util.d.ts.map +0 -1
- package/dist/scanners/util.js +0 -167
- package/dist/scanners/util.js.map +0 -1
- package/dist/session.d.ts +0 -106
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -191
- package/dist/session.js.map +0 -1
- package/dist/share-card-colors.d.ts +0 -19
- package/dist/share-card-colors.d.ts.map +0 -1
- package/dist/share-card-colors.js +0 -36
- package/dist/share-card-colors.js.map +0 -1
- package/dist/share-card.d.ts +0 -31
- package/dist/share-card.d.ts.map +0 -1
- package/dist/share-card.js +0 -380
- package/dist/share-card.js.map +0 -1
- package/dist/share.d.ts +0 -17
- package/dist/share.d.ts.map +0 -1
- package/dist/share.js +0 -75
- package/dist/share.js.map +0 -1
- package/dist/sync.d.ts +0 -100
- package/dist/sync.d.ts.map +0 -1
- package/dist/sync.js +0 -304
- package/dist/sync.js.map +0 -1
- package/dist/ui.d.ts +0 -33
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -127
- package/dist/ui.js.map +0 -1
- package/dist/utils/npmGlobal.d.ts +0 -30
- package/dist/utils/npmGlobal.d.ts.map +0 -1
- package/dist/utils/npmGlobal.js +0 -69
- package/dist/utils/npmGlobal.js.map +0 -1
- package/dist/utils/openBrowser.d.ts +0 -14
- package/dist/utils/openBrowser.d.ts.map +0 -1
- package/dist/utils/openBrowser.js +0 -47
- package/dist/utils/openBrowser.js.map +0 -1
- package/dist/utils/updateCheck.d.ts +0 -16
- package/dist/utils/updateCheck.d.ts.map +0 -1
- package/dist/utils/updateCheck.js +0 -111
- package/dist/utils/updateCheck.js.map +0 -1
- package/dist/utils/waitForEnter.d.ts +0 -12
- package/dist/utils/waitForEnter.d.ts.map +0 -1
- package/dist/utils/waitForEnter.js +0 -43
- package/dist/utils/waitForEnter.js.map +0 -1
package/dist/card.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { getTitle } from './belt.js';
|
|
2
|
-
import { formatTokens } from './scanners/util.js';
|
|
3
|
-
import { dim, displayWidth, mint, padEndTo, rankColor, stripControl, truncateToWidth, white, } from './ui.js';
|
|
4
|
-
const DESIGN_WIDTH = 68;
|
|
5
|
-
const MIN_WIDTH = 45; // below this the fixed 30d row can't fit; wrapping is accepted
|
|
6
|
-
/** 8 log-scaled buckets for the 30-day sparkline. Zero renders dim, lit cells mint. */
|
|
7
|
-
const SPARK = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
|
|
8
|
-
function resolveWidth(columns) {
|
|
9
|
-
const cols = columns ?? DESIGN_WIDTH;
|
|
10
|
-
return Math.max(MIN_WIDTH, Math.min(DESIGN_WIDTH, cols));
|
|
11
|
-
}
|
|
12
|
-
/** ISO string → `YYYY-MM-DD`. */
|
|
13
|
-
function ymd(iso) {
|
|
14
|
-
return iso.slice(0, 10);
|
|
15
|
-
}
|
|
16
|
-
function ageDays(iso, now) {
|
|
17
|
-
return Math.max(0, Math.floor((now.getTime() - Date.parse(iso)) / 86_400_000));
|
|
18
|
-
}
|
|
19
|
-
/** A left segment and a right segment on one line, right-aligned to `width`. */
|
|
20
|
-
function justify(width, leftColored, rightColored) {
|
|
21
|
-
const gap = Math.max(1, width - displayWidth(leftColored) - displayWidth(rightColored));
|
|
22
|
-
return leftColored + ' '.repeat(gap) + rightColored;
|
|
23
|
-
}
|
|
24
|
-
function rule(width) {
|
|
25
|
-
return dim('─'.repeat(width));
|
|
26
|
-
}
|
|
27
|
-
/** `████ L32 SHINOBI` — coloured band + dim romaji rank. Belt derived from level. */
|
|
28
|
-
function beltBadge(level) {
|
|
29
|
-
const band = rankColor(level, '████');
|
|
30
|
-
const label = dim(` L${level} ${getTitle(level).toUpperCase()}`);
|
|
31
|
-
return band + label;
|
|
32
|
-
}
|
|
33
|
-
function sparkline(values) {
|
|
34
|
-
const max = Math.max(0, ...values);
|
|
35
|
-
const denom = Math.log2(max + 1);
|
|
36
|
-
return values
|
|
37
|
-
.map((v) => {
|
|
38
|
-
if (v <= 0)
|
|
39
|
-
return dim('▁');
|
|
40
|
-
const frac = denom > 0 ? Math.log2(v + 1) / denom : 0;
|
|
41
|
-
const idx = Math.min(SPARK.length - 1, Math.max(0, Math.round(frac * (SPARK.length - 1))));
|
|
42
|
-
return mint(SPARK[idx] ?? '█');
|
|
43
|
-
})
|
|
44
|
-
.join('');
|
|
45
|
-
}
|
|
46
|
-
/** A `label value` row; the label is dim, the value plain, truncated to width. */
|
|
47
|
-
function labelled(width, label, value) {
|
|
48
|
-
const head = dim(padEndTo(label, 8)); // "joined ", "streak ", …
|
|
49
|
-
const budget = width - displayWidth(head);
|
|
50
|
-
return head + truncateToWidth(value, budget);
|
|
51
|
-
}
|
|
52
|
-
/** A recent-list section: `HEADER N` then rows, or `HEADER 0 nothing yet`. */
|
|
53
|
-
function section(width, label, total, rows) {
|
|
54
|
-
if (total === 0)
|
|
55
|
-
return [dim(`${label} 0 nothing yet`)];
|
|
56
|
-
return [`${label} ${total}`, ...rows.map((r) => truncateToWidth(r, width))];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Projects/essays row-budget rule: ≤3 rows below the header. When more than 3
|
|
60
|
-
* exist, show 2 items + `+N more`; otherwise show them all.
|
|
61
|
-
*/
|
|
62
|
-
function recentRows(total, items, row) {
|
|
63
|
-
if (total > 3) {
|
|
64
|
-
return [...items.slice(0, 2).map(row), ` +${total - 2} more`];
|
|
65
|
-
}
|
|
66
|
-
return items.map(row);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Render the full one-screen card as an array of lines (caller joins with \n).
|
|
70
|
-
* Pure: no I/O, deterministic given `now`. Every user-supplied string is passed
|
|
71
|
-
* through stripControl before it reaches the terminal.
|
|
72
|
-
*/
|
|
73
|
-
export function renderCard(card, opts = {}) {
|
|
74
|
-
const width = resolveWidth(opts.columns);
|
|
75
|
-
const now = opts.now ?? new Date();
|
|
76
|
-
const lines = [];
|
|
77
|
-
// Line 1 — identity + belt.
|
|
78
|
-
const name = card.displayName ? ` · ${stripControl(card.displayName)}` : '';
|
|
79
|
-
const identity = white(truncateToWidth(`${stripControl(card.handle)}${name}`, width - displayWidth(beltBadge(card.level)) - 1));
|
|
80
|
-
lines.push(justify(width, identity, beltBadge(card.level)));
|
|
81
|
-
// Line 2 — bio (left) + open-to-work dot (right). Skipped when both absent.
|
|
82
|
-
const bio = card.bio
|
|
83
|
-
? truncateToWidth(stripControl(card.bio), width - 16)
|
|
84
|
-
: '';
|
|
85
|
-
const otw = card.openToWork ? `${mint('●')} open to work` : '';
|
|
86
|
-
if (bio || otw)
|
|
87
|
-
lines.push(justify(width, bio, otw));
|
|
88
|
-
lines.push(rule(width));
|
|
89
|
-
// Identity block.
|
|
90
|
-
const claimed = card.claimedAt
|
|
91
|
-
? `claimed ${ymd(card.claimedAt)}`
|
|
92
|
-
: 'not claimed yet';
|
|
93
|
-
const rank = card.rank != null ? ` rank #${card.rank}` : '';
|
|
94
|
-
lines.push(labelled(width, 'joined', `${ymd(card.joinedAt)} (${ageDays(card.joinedAt, now)}d) ${claimed}${rank}`));
|
|
95
|
-
// Activity block, with the two null-state collapses.
|
|
96
|
-
if (card.tokensTotal === 0) {
|
|
97
|
-
lines.push(dim('no activity yet. run hacklab sync to bank the proof.'));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
lines.push(labelled(width, 'streak', `${card.currentStreak}d current · ${card.longestStreak}d longest active ${card.activeDays30}/30d`));
|
|
101
|
-
const cost = `$${Math.round(card.estimatedCost).toLocaleString('en-US')} est. cost`;
|
|
102
|
-
lines.push(labelled(width, 'tokens', `${formatTokens(card.tokensTotal)} burned · ${formatTokens(card.tokens30d)} last 30d · ${cost}`));
|
|
103
|
-
// Models + sparkline collapse when there's no 30-day activity.
|
|
104
|
-
if (card.tokens30d > 0) {
|
|
105
|
-
const models = card.topModels30d
|
|
106
|
-
.slice(0, 2)
|
|
107
|
-
.map((m) => `${m.model} ${m.pct}%`)
|
|
108
|
-
.join(' · ');
|
|
109
|
-
if (models)
|
|
110
|
-
lines.push(labelled(width, 'models', models));
|
|
111
|
-
lines.push(dim(padEndTo('30d', 8)) + sparkline(card.activity30));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
lines.push(rule(width));
|
|
115
|
-
// Recent work.
|
|
116
|
-
lines.push(...section(width, 'PROJECTS', card.counts.projects, recentRows(card.counts.projects, card.recent.projects, (p) => ` ${padEndTo(truncateToWidth(stripControl(p.title), 16), 16)} ${stripControl(p.description ?? '')}`)));
|
|
117
|
-
lines.push(...section(width, 'ESSAYS', card.counts.essays, recentRows(card.counts.essays, card.recent.essays, (e) => ` ${e.publishedAt ? ymd(e.publishedAt) : ' '} ${stripControl(e.title)}`)));
|
|
118
|
-
// Drops: 1 item, no "+N more"; the count lives in the header.
|
|
119
|
-
if (card.counts.drops === 0) {
|
|
120
|
-
lines.push(dim('DROPS 0 nothing yet'));
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
const last = card.recent.drops[0];
|
|
124
|
-
lines.push(`DROPS ${card.counts.drops}${last ? ` · last ${ymd(last.createdAt)}` : ''}`);
|
|
125
|
-
if (last) {
|
|
126
|
-
lines.push(truncateToWidth(` "${stripControl(last.text)}"`, width));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
lines.push(rule(width));
|
|
130
|
-
lines.push(dim(`--json for the full payload · hacklab.so/${card.handle}`));
|
|
131
|
-
return lines;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* The compact in-chat card (`/who`): 4 lines, no rules, no sparkline. Same
|
|
135
|
-
* strip discipline. Returned as separate lines so the chat renderer can push
|
|
136
|
-
* them as one Entry per row (preserving the one-row-per-entry invariant).
|
|
137
|
-
*/
|
|
138
|
-
export function renderCompact(card) {
|
|
139
|
-
const name = card.displayName ? ` · ${stripControl(card.displayName)}` : '';
|
|
140
|
-
const otw = card.openToWork ? ` · ${mint('●')} open to work` : '';
|
|
141
|
-
const joined = card.claimedAt
|
|
142
|
-
? `joined ${ageDays(card.claimedAt, new Date())}d ago`
|
|
143
|
-
: 'not claimed yet';
|
|
144
|
-
return [
|
|
145
|
-
`${white(stripControl(card.handle))}${name} · ${beltBadge(card.level)}${otw}`,
|
|
146
|
-
`${formatTokens(card.tokensTotal)} tokens · ${formatTokens(card.tokens30d)}/30d · ${card.currentStreak}d streak · ${joined}`,
|
|
147
|
-
`${card.counts.projects} projects · ${card.counts.essays} essays · ${card.counts.drops} drops`,
|
|
148
|
-
dim(`hacklab.so/${card.handle}`),
|
|
149
|
-
];
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=card.js.map
|
package/dist/card.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,O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CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE;QAC7E,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,aAAa,cAAc,MAAM,EAAE;QAC5H,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,eAAe,IAAI,CAAC,MAAM,CAAC,MAAM,aAAa,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ;QAC9F,GAAG,CAAC,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC;KACjC,CAAA;AACH,CAAC"}
|
package/dist/cli.d.ts
DELETED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
// The real CLI. Loaded via a dynamic import from index.ts *after* its Node
|
|
2
|
-
// version guard passes — so the Node 20+ APIs these imports reach (e.g.
|
|
3
|
-
// @clack/core's `styleText` from node:util) never link on an unsupported Node.
|
|
4
|
-
import { createRequire } from 'node:module';
|
|
5
|
-
import { clearSyncPaused, readSyncPaused } from './daily-sync.js';
|
|
6
|
-
import { captureException, maybePrintTelemetryNotice, shutdownTelemetry, } from './posthog.js';
|
|
7
|
-
import { findCommand } from './registry.js';
|
|
8
|
-
import { resolveCommand } from './resolve-command.js';
|
|
9
|
-
import { HACKLAB_ENVIRONMENTS, loadSession, resolveHacklabEnv, } from './session.js';
|
|
10
|
-
import { banner, bold, dim } from './ui.js';
|
|
11
|
-
import { notifyIfOutdated } from './utils/updateCheck.js';
|
|
12
|
-
// Single source of the published version: read it from package.json (one level
|
|
13
|
-
// up from this module in both `dist/` and `src/`) instead of hardcoding a string
|
|
14
|
-
// that silently drifts from the real package version. `createRequire` resolves
|
|
15
|
-
// JSON the same way under tsx (dev) and the compiled bin.
|
|
16
|
-
const require = createRequire(import.meta.url);
|
|
17
|
-
const { version: VERSION } = require('../package.json');
|
|
18
|
-
/**
|
|
19
|
-
* The global flags, each mapping onto the env var the rest of the CLI already
|
|
20
|
-
* reads. Going through the env is what makes precedence fall out for free: the
|
|
21
|
-
* flag overwrites any inherited value, and the readers (getAppUrl,
|
|
22
|
-
* resolveCursorAuth) prefer the env over the config file. It also means a value
|
|
23
|
-
* passed once on the command line reaches anything the command shells out to.
|
|
24
|
-
*/
|
|
25
|
-
const GLOBAL_FLAGS = {
|
|
26
|
-
'--env': (value) => {
|
|
27
|
-
const env = resolveHacklabEnv(value);
|
|
28
|
-
if (!env) {
|
|
29
|
-
console.error(`--env must be one of: ${Object.keys(HACKLAB_ENVIRONMENTS).join(', ')} (abbreviations like dev/prod/stag work)`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
process.env.HACKLAB_APP_URL = HACKLAB_ENVIRONMENTS[env];
|
|
33
|
-
},
|
|
34
|
-
'--cursor-api-key': (value) => {
|
|
35
|
-
process.env.CURSOR_API_KEY = value;
|
|
36
|
-
},
|
|
37
|
-
'--cursor-email': (value) => {
|
|
38
|
-
process.env.CURSOR_EMAIL = value;
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Pull the global flags out of argv and apply them, returning the remaining args
|
|
43
|
-
* so per-command parsing never sees them. Both `--flag value` and `--flag=value`
|
|
44
|
-
* spellings work.
|
|
45
|
-
*/
|
|
46
|
-
function applyGlobalFlags(argv) {
|
|
47
|
-
const rest = [];
|
|
48
|
-
for (let i = 0; i < argv.length; i++) {
|
|
49
|
-
const arg = argv[i];
|
|
50
|
-
const eq = arg.indexOf('=');
|
|
51
|
-
const name = eq === -1 ? arg : arg.slice(0, eq);
|
|
52
|
-
const apply = GLOBAL_FLAGS[name];
|
|
53
|
-
if (!apply) {
|
|
54
|
-
rest.push(arg);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const value = eq === -1 ? argv[++i] : arg.slice(eq + 1);
|
|
58
|
-
if (!value) {
|
|
59
|
-
console.error(`${name} requires a value`);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
apply(value);
|
|
63
|
-
}
|
|
64
|
-
return rest;
|
|
65
|
-
}
|
|
66
|
-
const [cmd, ...args] = applyGlobalFlags(process.argv.slice(2));
|
|
67
|
-
// The help page is a curated, hand-grouped tour of the CLI — not a dump of the
|
|
68
|
-
// registry. That's deliberate: the registry stays the source of truth for
|
|
69
|
-
// dispatch, while this listing groups commands by what the user is trying to do
|
|
70
|
-
// and leaves out the niche ones (book, jobs, keys, scout) that would drown the
|
|
71
|
-
// core flow. Adding a command to the registry does NOT add it here — decide
|
|
72
|
-
// whether it belongs on the front page.
|
|
73
|
-
const HELP_GROUPS = [
|
|
74
|
-
{
|
|
75
|
-
title: 'start here',
|
|
76
|
-
rows: [
|
|
77
|
-
{
|
|
78
|
-
label: 'setup',
|
|
79
|
-
summary: 'first run: scan, sign in, start the background sync',
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
title: 'auth',
|
|
85
|
-
rows: [
|
|
86
|
-
{ label: 'login', summary: 'sign in to hacklab' },
|
|
87
|
-
{ label: 'logout', summary: "clear this machine's session" },
|
|
88
|
-
{ label: 'whoami', summary: "who you're logged in as" },
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
title: 'you',
|
|
93
|
-
rows: [
|
|
94
|
-
{ label: 'profile', summary: 'view and edit your profile' },
|
|
95
|
-
{ label: 'referral', summary: 'your invite link' },
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
title: 'game',
|
|
100
|
-
rows: [
|
|
101
|
-
{ label: 'rules', summary: 'understand how the ranking works' },
|
|
102
|
-
{ label: 'scan', summary: 'scan this machine and share the card' },
|
|
103
|
-
{ label: 'sync', summary: 'upload local AI usage to your profile' },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
title: 'posting',
|
|
108
|
-
rows: [
|
|
109
|
-
{ label: 'drop <message>', summary: 'post a drop' },
|
|
110
|
-
{ label: 'drops', summary: 'your drops' },
|
|
111
|
-
{ label: 'project', summary: 'add, list, and edit your projects' },
|
|
112
|
-
{ label: 'essay', summary: 'post, list, and update your essays' },
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
title: 'people',
|
|
117
|
-
rows: [
|
|
118
|
-
{ label: 'chat', summary: 'the live public chat channel' },
|
|
119
|
-
{ label: 'hacker', summary: 'view hacker profiles' },
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: 'organisations',
|
|
124
|
-
rows: [{ label: 'org', summary: 'create and edit your organisations' }],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
title: 'hackathons',
|
|
128
|
-
rows: [{ label: 'hackathon', summary: 'RSVP, team up, and submit' }],
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
title: 'manuals',
|
|
132
|
-
rows: [
|
|
133
|
-
{ label: 'rtfm', summary: 'list all manuals' },
|
|
134
|
-
{
|
|
135
|
-
label: 'rtfm <topic>',
|
|
136
|
-
summary: 'print the manual: exact commands, prereqs, done-when criteria',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
title: 'settings',
|
|
142
|
-
rows: [
|
|
143
|
-
{ label: 'update', summary: 'update this CLI' },
|
|
144
|
-
{
|
|
145
|
-
label: 'daemon [off]',
|
|
146
|
-
summary: 'summon the background sync (off tears it down)',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
label: 'config <key> <val>',
|
|
150
|
-
summary: 'cursor key, email, prompt-sync',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
title: 'flags',
|
|
156
|
-
rows: [
|
|
157
|
-
{
|
|
158
|
-
label: '--json',
|
|
159
|
-
summary: 'machine-readable output (agents: always use this)',
|
|
160
|
-
},
|
|
161
|
-
{ label: '--help / -h', summary: 'show help for a command' },
|
|
162
|
-
{ label: '--version / -v', summary: 'show CLI version' },
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
];
|
|
166
|
-
function printHelp() {
|
|
167
|
-
banner();
|
|
168
|
-
// Align the summaries: pad every label to the widest one across all groups so
|
|
169
|
-
// the whole page reads as one table.
|
|
170
|
-
const width = Math.max(...HELP_GROUPS.flatMap((g) => g.rows.map((r) => r.label.length)));
|
|
171
|
-
for (const { title, rows } of HELP_GROUPS) {
|
|
172
|
-
console.log('');
|
|
173
|
-
console.log(bold(` ${title}`));
|
|
174
|
-
for (const { label, summary } of rows) {
|
|
175
|
-
console.log(` ${dim(label.padEnd(width))} ${summary}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
console.log('');
|
|
179
|
-
}
|
|
180
|
-
// Node-version guard (T9). The CLI uses modern Node APIs (global fetch,
|
|
181
|
-
// AbortSignal.timeout). Fail fast with a clear message instead of a cryptic
|
|
182
|
-
// runtime error on an old runtime. The nvm hint matters because a piped
|
|
183
|
-
async function main() {
|
|
184
|
-
// Bare `hacklab` (no command) prints help, same as `--help`/`-h`. Runs before
|
|
185
|
-
// the update nudge so it reads as plain help, matching the `--help` path.
|
|
186
|
-
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
187
|
-
printHelp();
|
|
188
|
-
process.exit(0);
|
|
189
|
-
}
|
|
190
|
-
if (cmd === '--version' || cmd === '-v') {
|
|
191
|
-
console.log(VERSION);
|
|
192
|
-
process.exit(0);
|
|
193
|
-
}
|
|
194
|
-
// One-time anonymous-telemetry notice (interactive only, shown once). Before
|
|
195
|
-
// the update nudge so, on the very first run, consent is disclosed above any
|
|
196
|
-
// other output.
|
|
197
|
-
await maybePrintTelemetryNotice();
|
|
198
|
-
// One-line nudge if a newer hacklab is published (interactive only, cached
|
|
199
|
-
// daily, timeout-guarded). Must run before any command output so it reads as
|
|
200
|
-
// a header, not buried in results.
|
|
201
|
-
await notifyIfOutdated(VERSION);
|
|
202
|
-
// Resolve a possibly-abbreviated command to its full name (e.g. `sy` -> sync,
|
|
203
|
-
// `or` -> org). Exact matches always win; an ambiguous prefix is
|
|
204
|
-
// rejected with the candidates so the user can disambiguate.
|
|
205
|
-
const resolution = resolveCommand(cmd);
|
|
206
|
-
if (resolution.kind === 'ambiguous') {
|
|
207
|
-
console.error(`ambiguous command "${cmd}": ${resolution.matches.join(' or ')}?`);
|
|
208
|
-
process.exit(1);
|
|
209
|
-
}
|
|
210
|
-
const command = resolution.kind === 'match' ? findCommand(resolution.name) : undefined;
|
|
211
|
-
if (!command) {
|
|
212
|
-
console.error(`unknown command: ${cmd}`);
|
|
213
|
-
console.error('run hacklab --help for usage');
|
|
214
|
-
process.exit(1);
|
|
215
|
-
}
|
|
216
|
-
// Surface a paused daily background sync (e.g. the session expired while the
|
|
217
|
-
// machine was off) once, then clear the marker. Skipped for the auth commands
|
|
218
|
-
// that fix it (login), so we never nag mid-fix.
|
|
219
|
-
if (process.stdout.isTTY && command.name !== 'login') {
|
|
220
|
-
const paused = await readSyncPaused();
|
|
221
|
-
if (paused) {
|
|
222
|
-
console.error(dim(`paused: daily background sync — ${paused}`));
|
|
223
|
-
await clearSyncPaused();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
await command.run(args);
|
|
227
|
-
// Best-effort final flush for the happy path. Per-event captures already flush
|
|
228
|
-
// eagerly (flushAt: 1), so this mainly drains any autocaptured exception.
|
|
229
|
-
await shutdownTelemetry();
|
|
230
|
-
}
|
|
231
|
-
main().catch(async (err) => {
|
|
232
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
233
|
-
const session = await loadSession().catch(() => null);
|
|
234
|
-
await captureException(err, session?.handle);
|
|
235
|
-
await shutdownTelemetry();
|
|
236
|
-
process.exit(1);
|
|
237
|
-
});
|
|
238
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,+EAA+E;AAC/E,iFAAiF;AACjF,+EAA+E;AAC/E,0DAA0D;AAC1D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAA;AAE9E;;;;;;GAMG;AACH,MAAM,YAAY,GAA4C;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;QACpC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,KAAK,CACX,yBAAyB,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,I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AAO,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAmC,MAAM,EAAE,CAAC,CAAC,CAAA;YAC/D,MAAM,eAAe,EAAE,CAAA;QACzB,CAAC;IACH,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAEvB,+EAA+E;IAC/E,0EAA0E;IAC1E,MAAM,iBAAiB,EAAE,CAAA;AAC3B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,GAAY,EAAE,EAAE;IAClC,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAC/D,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IACrD,MAAM,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAC5C,MAAM,iBAAiB,EAAE,CAAA;IACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/commands/book.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type BookArgs = {
|
|
2
|
-
title: string;
|
|
3
|
-
author: string;
|
|
4
|
-
takeaways?: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Parse `book` args: free words become the title, `-a/--author` and
|
|
8
|
-
* `-t/--takeaways` take a quoted value. Mirrors `parseDropArgs` (drop.ts) so
|
|
9
|
-
* each command owns its own parsing. Deliberately no manifest file — a book is
|
|
10
|
-
* three fields, and quoting them beats authoring YAML for it.
|
|
11
|
-
*/
|
|
12
|
-
export declare function parseBookArgs(args: string[]): BookArgs;
|
|
13
|
-
export declare function book({ title, author, takeaways }: BookArgs): Promise<void>;
|
|
14
|
-
//# sourceMappingURL=book.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../src/commands/book.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CA4CtD;AAED,wBAAsB,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,QAAQ,iBA2ChE"}
|
package/dist/commands/book.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { loadSession, resolveAppUrl } from '../session.js';
|
|
2
|
-
import { dim, error, info, success } from '../ui.js';
|
|
3
|
-
const TITLE_MAX = 200;
|
|
4
|
-
const AUTHOR_MAX = 200;
|
|
5
|
-
const TAKEAWAYS_MAX = 5000;
|
|
6
|
-
const USAGE = 'usage: hacklab book "Title" --author "Name" [--takeaways "what stuck with you"]';
|
|
7
|
-
/**
|
|
8
|
-
* Parse `book` args: free words become the title, `-a/--author` and
|
|
9
|
-
* `-t/--takeaways` take a quoted value. Mirrors `parseDropArgs` (drop.ts) so
|
|
10
|
-
* each command owns its own parsing. Deliberately no manifest file — a book is
|
|
11
|
-
* three fields, and quoting them beats authoring YAML for it.
|
|
12
|
-
*/
|
|
13
|
-
export function parseBookArgs(args) {
|
|
14
|
-
let author;
|
|
15
|
-
let takeaways;
|
|
16
|
-
const words = [];
|
|
17
|
-
for (let i = 0; i < args.length; i++) {
|
|
18
|
-
const arg = args[i];
|
|
19
|
-
if ((arg === '-a' || arg === '--author') && args[i + 1] !== undefined) {
|
|
20
|
-
author = args[i + 1];
|
|
21
|
-
i++;
|
|
22
|
-
}
|
|
23
|
-
else if ((arg === '-t' || arg === '--takeaways') &&
|
|
24
|
-
args[i + 1] !== undefined) {
|
|
25
|
-
takeaways = args[i + 1];
|
|
26
|
-
i++;
|
|
27
|
-
}
|
|
28
|
-
else if (arg.startsWith('-')) {
|
|
29
|
-
console.error(`unknown flag: ${arg}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
words.push(arg);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const title = words.join(' ').trim();
|
|
37
|
-
if (!title) {
|
|
38
|
-
console.error(USAGE);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
if (!author?.trim()) {
|
|
42
|
-
console.error('missing --author');
|
|
43
|
-
console.error(USAGE);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
const trimmedTakeaways = takeaways?.trim();
|
|
47
|
-
return {
|
|
48
|
-
title,
|
|
49
|
-
author: author.trim(),
|
|
50
|
-
...(trimmedTakeaways ? { takeaways: trimmedTakeaways } : {}),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export async function book({ title, author, takeaways }) {
|
|
54
|
-
const session = await loadSession();
|
|
55
|
-
if (!session) {
|
|
56
|
-
error('not logged in');
|
|
57
|
-
info(`run ${dim('hacklab login')} first`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
if (title.length > TITLE_MAX) {
|
|
61
|
-
error(`title too long — ${title.length}/${TITLE_MAX} chars`);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
if (author.length > AUTHOR_MAX) {
|
|
65
|
-
error(`author too long — ${author.length}/${AUTHOR_MAX} chars`);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
if (takeaways && takeaways.length > TAKEAWAYS_MAX) {
|
|
69
|
-
error(`takeaways too long — ${takeaways.length}/${TAKEAWAYS_MAX} chars`);
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
const res = await fetch(`${resolveAppUrl(session)}/api/books`, {
|
|
73
|
-
method: 'POST',
|
|
74
|
-
headers: {
|
|
75
|
-
'Content-Type': 'application/json',
|
|
76
|
-
Authorization: `Bearer ${session.token}`,
|
|
77
|
-
},
|
|
78
|
-
body: JSON.stringify({ title, author, takeaways }),
|
|
79
|
-
});
|
|
80
|
-
if (!res.ok) {
|
|
81
|
-
const data = await res.json().catch(() => null);
|
|
82
|
-
error(data?.error ?? `failed (${res.status})`);
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
success('shelved.');
|
|
86
|
-
if (!takeaways) {
|
|
87
|
-
info(`no takeaways — the card shows without a details button`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=book.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"book.js","sourceRoot":"","sources":["../../src/commands/book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEpD,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,UAAU,GAAG,GAAG,CAAA;AACtB,MAAM,aAAa,GAAG,IAAI,CAAA;AAE1B,MAAM,KAAK,GACT,iFAAiF,CAAA;AAQnF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,IAAI,MAA0B,CAAA;IAC9B,IAAI,SAA6B,CAAA;IACjC,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAA;QACpB,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAA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EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;KACnD,CAAC,CAAA;IAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;QAC/C,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,WAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAA;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,CAAA;IACnB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAI,CAAC,wDAAwD,CAAC,CAAA;IAChE,CAAC;AACH,CAAC"}
|
package/dist/commands/chat.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Session } from '../session.js';
|
|
2
|
-
export { stripControl } from '../ui.js';
|
|
3
|
-
export declare function baseUrl(session?: Session | null): string;
|
|
4
|
-
export declare function datePrefix(when: Date, now: Date): string;
|
|
5
|
-
export declare function formatTimestamp(when: string | Date, now?: Date): string;
|
|
6
|
-
type RenderableMessage = {
|
|
7
|
-
createdAt: string;
|
|
8
|
-
senderHandle: string;
|
|
9
|
-
content: string;
|
|
10
|
-
senderLevel?: number | null;
|
|
11
|
-
};
|
|
12
|
-
export declare function formatLine(m: RenderableMessage, now?: Date): string;
|
|
13
|
-
export declare function formatPendingLine(handle: string, content: string, tag: string, at?: string, now?: Date): string;
|
|
14
|
-
export type LineIntent = {
|
|
15
|
-
kind: 'empty';
|
|
16
|
-
} | {
|
|
17
|
-
kind: 'command';
|
|
18
|
-
cmd: string;
|
|
19
|
-
args: string[];
|
|
20
|
-
} | {
|
|
21
|
-
kind: 'message';
|
|
22
|
-
content: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Decide what a typed line means. A single leading slash is a local command and
|
|
26
|
-
* never posts. A DOUBLED leading slash is how you post a message that starts with
|
|
27
|
-
* a slash: it posts (and displays) verbatim, both slashes intact. Nothing is
|
|
28
|
-
* stripped, so the optimistic placeholder, the POST body, and the server echo all
|
|
29
|
-
* agree (reconcile-by-content) — and the server can reject single-leading-slash
|
|
30
|
-
* content (a stale client posting a command it doesn't know is local) without
|
|
31
|
-
* catching the doubled form. Pure + exported so these semantics are unit-tested
|
|
32
|
-
* without driving readline.
|
|
33
|
-
*/
|
|
34
|
-
export declare function parseLine(input: string): LineIntent;
|
|
35
|
-
export declare function chat(args: string[]): Promise<void>;
|
|
36
|
-
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAexE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAqCvC,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAExD;AAqED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM,CASxD;AAKD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,GAAG,GAAE,IAAiB,GACrB,MAAM,CAKR;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,wBAAgB,UAAU,CACxB,CAAC,EAAE,iBAAiB,EACpB,GAAG,GAAE,IAAiB,GACrB,MAAM,CAQR;AAQD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,GAAG,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