@basestream/cli 0.1.2 → 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/dist/cli.mjs +730 -0
- package/package.json +6 -3
- package/dist/cli/commands/hook-stop.d.ts +0 -1
- package/dist/cli/commands/hook-stop.js +0 -261
- 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 -90
- 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 -1
- package/dist/cli/index.js +0 -60
- package/dist/cli/util.d.ts +0 -11
- package/dist/cli/util.js +0 -18
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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli/index.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { init } from "./commands/init.js";
|
|
2
|
-
import { status } from "./commands/status.js";
|
|
3
|
-
import { sync } from "./commands/sync.js";
|
|
4
|
-
import { hookStop } from "./commands/hook-stop.js";
|
|
5
|
-
import { login } from "./commands/login.js";
|
|
6
|
-
const HELP = `
|
|
7
|
-
basestream — AI work intelligence for teams
|
|
8
|
-
|
|
9
|
-
Usage:
|
|
10
|
-
npx @basestream/cli init Set up everything (hooks, auth, buffer)
|
|
11
|
-
|
|
12
|
-
Commands:
|
|
13
|
-
basestream init Detect AI tools, inject hooks, authenticate
|
|
14
|
-
basestream login Authenticate with your Basestream account
|
|
15
|
-
basestream status Show this week's logged sessions
|
|
16
|
-
basestream sync Manually sync buffered entries to Basestream
|
|
17
|
-
|
|
18
|
-
Options:
|
|
19
|
-
--help, -h Show this help message
|
|
20
|
-
--version, -v Show version
|
|
21
|
-
`;
|
|
22
|
-
async function main() {
|
|
23
|
-
const command = process.argv[2];
|
|
24
|
-
if (command === "--help" || command === "-h") {
|
|
25
|
-
console.log(HELP.trim());
|
|
26
|
-
process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
if (command === "--version" || command === "-v") {
|
|
29
|
-
// CLI_VERSION is injected at build time by esbuild
|
|
30
|
-
console.log(typeof CLI_VERSION !== "undefined" ? CLI_VERSION : "dev");
|
|
31
|
-
process.exit(0);
|
|
32
|
-
}
|
|
33
|
-
switch (command || "init") {
|
|
34
|
-
case "init":
|
|
35
|
-
await init();
|
|
36
|
-
process.exit(0);
|
|
37
|
-
break;
|
|
38
|
-
case "login":
|
|
39
|
-
await login();
|
|
40
|
-
process.exit(0);
|
|
41
|
-
break;
|
|
42
|
-
case "status":
|
|
43
|
-
await status();
|
|
44
|
-
break;
|
|
45
|
-
case "sync":
|
|
46
|
-
await sync();
|
|
47
|
-
break;
|
|
48
|
-
case "_hook-stop":
|
|
49
|
-
await hookStop();
|
|
50
|
-
break;
|
|
51
|
-
default:
|
|
52
|
-
console.error(`Unknown command: ${command}`);
|
|
53
|
-
console.log(HELP.trim());
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
main().catch((err) => {
|
|
58
|
-
console.error(err.message || err);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
});
|
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
|
-
}
|