@cohaku/cli 0.2.6

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.
@@ -0,0 +1,64 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ VERSION
4
+ } from "./chunk-2CDNPZUE.js";
5
+
6
+ // src/shared/banner.ts
7
+ import { basename } from "path";
8
+ import { homedir } from "os";
9
+ var c = {
10
+ reset: "\x1B[0m",
11
+ bold: "\x1B[1m",
12
+ dim: "\x1B[2m",
13
+ amber: "\x1B[38;5;214m",
14
+ yellow: "\x1B[38;5;220m",
15
+ gray: "\x1B[38;5;245m",
16
+ green: "\x1B[38;5;114m",
17
+ white: "\x1B[97m"
18
+ };
19
+ function printBanner(opts) {
20
+ const projectName = opts.projectId ? basename(opts.projectId) : void 0;
21
+ const scopeLabel = projectName ? `${c.green}${projectName}${c.reset}` : `${c.gray}global${c.reset}`;
22
+ const lines = [
23
+ "",
24
+ ` ${c.amber}${c.bold}\u25C6 Cohaku AI${c.reset} ${c.dim}v${VERSION}${c.reset}`
25
+ ];
26
+ if (opts.latestVersion) {
27
+ lines.push(` ${c.yellow}\u26A0 v${opts.latestVersion} available${c.reset} ${c.dim}\u2014 npx @cohaku/cli@latest${c.reset}`);
28
+ }
29
+ lines.push(
30
+ "",
31
+ ` ${c.gray}Scope${c.reset} ${scopeLabel}`,
32
+ ` ${c.gray}Database${c.reset} ${c.dim}${opts.dbPath.replace(homedir(), "~")}${c.reset}`,
33
+ ` ${c.gray}Transport${c.reset} ${c.dim}${opts.transport}${c.reset}`
34
+ );
35
+ if (opts.dashboardUrl) {
36
+ lines.push(` ${c.gray}Dashboard${c.reset} ${c.dim}${opts.dashboardUrl}${c.reset}`);
37
+ }
38
+ lines.push(
39
+ "",
40
+ ` ${c.green}\u25CF${c.reset} ${c.white}Ready${c.reset}`,
41
+ ""
42
+ );
43
+ process.stderr.write(lines.join("\n") + "\n");
44
+ }
45
+
46
+ // src/shared/update-check.ts
47
+ async function checkForUpdate() {
48
+ try {
49
+ const res = await fetch("https://registry.npmjs.org/@cohaku/cli/latest", {
50
+ signal: AbortSignal.timeout(3e3)
51
+ });
52
+ if (!res.ok) return null;
53
+ const data = await res.json();
54
+ if (data.version && data.version !== VERSION) return data.version;
55
+ return null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+
61
+ export {
62
+ printBanner,
63
+ checkForUpdate
64
+ };