@basestream/cli 0.1.0 → 0.1.3
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.
Potentially problematic release.
This version of @basestream/cli might be problematic. Click here for more details.
- package/bin/basestream.js +1 -1
- package/dist/cli.mjs +730 -0
- package/package.json +9 -51
- package/dist/cli/commands/hook-stop.d.ts +0 -1
- package/dist/cli/commands/hook-stop.js +0 -247
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -92
- package/dist/cli/commands/login.d.ts +0 -1
- package/dist/cli/commands/login.js +0 -75
- package/dist/cli/commands/status.d.ts +0 -1
- package/dist/cli/commands/status.js +0 -97
- package/dist/cli/commands/sync.d.ts +0 -7
- package/dist/cli/commands/sync.js +0 -77
- package/dist/cli/config.d.ts +0 -12
- package/dist/cli/config.js +0 -31
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -57
- package/dist/cli/util.d.ts +0 -11
- package/dist/cli/util.js +0 -18
package/dist/cli/config.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const BASESTREAM_DIR: string;
|
|
2
|
-
export declare const BUFFER_DIR: string;
|
|
3
|
-
export declare const CONFIG_FILE: string;
|
|
4
|
-
export declare const SESSION_DIR: string;
|
|
5
|
-
export interface BasestreamConfig {
|
|
6
|
-
apiKey: string;
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
orgId?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function ensureDirs(): void;
|
|
11
|
-
export declare function readConfig(): BasestreamConfig | null;
|
|
12
|
-
export declare function writeConfig(config: BasestreamConfig): void;
|
package/dist/cli/config.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
export const BASESTREAM_DIR = path.join(os.homedir(), ".basestream");
|
|
5
|
-
export const BUFFER_DIR = path.join(BASESTREAM_DIR, "buffer");
|
|
6
|
-
export const CONFIG_FILE = path.join(BASESTREAM_DIR, "config.json");
|
|
7
|
-
export const SESSION_DIR = path.join(BASESTREAM_DIR, "sessions");
|
|
8
|
-
export function ensureDirs() {
|
|
9
|
-
for (const dir of [BASESTREAM_DIR, BUFFER_DIR, SESSION_DIR]) {
|
|
10
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function readConfig() {
|
|
14
|
-
if (!fs.existsSync(CONFIG_FILE))
|
|
15
|
-
return null;
|
|
16
|
-
try {
|
|
17
|
-
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8"));
|
|
18
|
-
// BASESTREAM_URL env var always overrides stored baseUrl (useful for local testing)
|
|
19
|
-
if (process.env.BASESTREAM_URL) {
|
|
20
|
-
config.baseUrl = process.env.BASESTREAM_URL;
|
|
21
|
-
}
|
|
22
|
-
return config;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function writeConfig(config) {
|
|
29
|
-
ensureDirs();
|
|
30
|
-
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
31
|
-
}
|
package/dist/cli/index.d.ts
DELETED
package/dist/cli/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { init } from "./commands/init.js";
|
|
3
|
-
import { status } from "./commands/status.js";
|
|
4
|
-
import { sync } from "./commands/sync.js";
|
|
5
|
-
import { hookStop } from "./commands/hook-stop.js";
|
|
6
|
-
import { login } from "./commands/login.js";
|
|
7
|
-
const HELP = `
|
|
8
|
-
basestream — AI work intelligence for teams
|
|
9
|
-
|
|
10
|
-
Usage:
|
|
11
|
-
basestream init Detect AI tools, inject hooks, authenticate
|
|
12
|
-
basestream login Authenticate with your Basestream account
|
|
13
|
-
basestream status Show this week's logged sessions
|
|
14
|
-
basestream sync Manually sync buffered entries to Basestream
|
|
15
|
-
basestream _hook-stop (internal) Claude Code Stop hook handler
|
|
16
|
-
|
|
17
|
-
Options:
|
|
18
|
-
--help, -h Show this help message
|
|
19
|
-
--version, -v Show version
|
|
20
|
-
`;
|
|
21
|
-
async function main() {
|
|
22
|
-
const command = process.argv[2];
|
|
23
|
-
if (!command || command === "--help" || command === "-h") {
|
|
24
|
-
console.log(HELP.trim());
|
|
25
|
-
process.exit(0);
|
|
26
|
-
}
|
|
27
|
-
if (command === "--version" || command === "-v") {
|
|
28
|
-
const pkg = await import("../../package.json", { with: { type: "json" } });
|
|
29
|
-
console.log(pkg.default.version);
|
|
30
|
-
process.exit(0);
|
|
31
|
-
}
|
|
32
|
-
switch (command) {
|
|
33
|
-
case "init":
|
|
34
|
-
await init();
|
|
35
|
-
break;
|
|
36
|
-
case "login":
|
|
37
|
-
await login();
|
|
38
|
-
break;
|
|
39
|
-
case "status":
|
|
40
|
-
await status();
|
|
41
|
-
break;
|
|
42
|
-
case "sync":
|
|
43
|
-
await sync();
|
|
44
|
-
break;
|
|
45
|
-
case "_hook-stop":
|
|
46
|
-
await hookStop();
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
console.error(`Unknown command: ${command}`);
|
|
50
|
-
console.log(HELP.trim());
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
main().catch((err) => {
|
|
55
|
-
console.error(err.message || err);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
});
|
package/dist/cli/util.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const c: {
|
|
2
|
-
green: (s: string) => string;
|
|
3
|
-
yellow: (s: string) => string;
|
|
4
|
-
red: (s: string) => string;
|
|
5
|
-
cyan: (s: string) => string;
|
|
6
|
-
dim: (s: string) => string;
|
|
7
|
-
bold: (s: string) => string;
|
|
8
|
-
};
|
|
9
|
-
export declare function check(msg: string): void;
|
|
10
|
-
export declare function warn(msg: string): void;
|
|
11
|
-
export declare function fail(msg: string): void;
|
package/dist/cli/util.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Terminal color helpers (no dependencies)
|
|
2
|
-
export const c = {
|
|
3
|
-
green: (s) => `\x1b[32m${s}\x1b[0m`,
|
|
4
|
-
yellow: (s) => `\x1b[33m${s}\x1b[0m`,
|
|
5
|
-
red: (s) => `\x1b[31m${s}\x1b[0m`,
|
|
6
|
-
cyan: (s) => `\x1b[36m${s}\x1b[0m`,
|
|
7
|
-
dim: (s) => `\x1b[2m${s}\x1b[0m`,
|
|
8
|
-
bold: (s) => `\x1b[1m${s}\x1b[0m`,
|
|
9
|
-
};
|
|
10
|
-
export function check(msg) {
|
|
11
|
-
console.log(` ${c.green("✓")} ${c.green(msg)}`);
|
|
12
|
-
}
|
|
13
|
-
export function warn(msg) {
|
|
14
|
-
console.log(` ${c.yellow("!")} ${c.yellow(msg)}`);
|
|
15
|
-
}
|
|
16
|
-
export function fail(msg) {
|
|
17
|
-
console.log(` ${c.red("✗")} ${c.red(msg)}`);
|
|
18
|
-
}
|