@series-a/cli 1.2.0 → 1.3.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/CHANGELOG.md +175 -39
- package/LICENSE +7 -0
- package/README.md +257 -91
- package/SKILLS.md +344 -0
- package/bin/advisoros.mjs +2 -0
- package/package.json +50 -15
- package/src/api.mjs +102 -0
- package/src/commands/auth.mjs +193 -0
- package/src/commands/brand.mjs +439 -0
- package/src/commands/flow.mjs +175 -0
- package/src/commands/insights.mjs +1813 -0
- package/src/commands/knowledge-sync.mjs +519 -0
- package/src/commands/resources.mjs +2196 -0
- package/src/commands/strategies.mjs +242 -0
- package/src/commands/voice.mjs +212 -0
- package/src/config.mjs +82 -0
- package/src/index.mjs +77 -0
- package/src/ui.mjs +104 -0
- package/bin/setu.mjs +0 -607
- package/lib/api.mjs +0 -84
- package/lib/config.mjs +0 -42
- package/lib/ui.mjs +0 -68
package/lib/config.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import { join, dirname } from "node:path";
|
|
3
|
-
import { mkdirSync, readFileSync, writeFileSync, existsSync, chmodSync, rmSync } from "node:fs";
|
|
4
|
-
|
|
5
|
-
const DEFAULT_API =
|
|
6
|
-
process.env.SETU_API_URL || "https://vaanfxluxietcicoikcg.supabase.co/functions/v1";
|
|
7
|
-
|
|
8
|
-
function configPath() {
|
|
9
|
-
const base = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
10
|
-
return join(base, "setu", "config.json");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function loadConfig() {
|
|
14
|
-
const path = configPath();
|
|
15
|
-
if (!existsSync(path)) return { api: DEFAULT_API, key: process.env.SETU_CLI_API_KEY || "", operator: "" };
|
|
16
|
-
try {
|
|
17
|
-
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
18
|
-
return {
|
|
19
|
-
api: process.env.SETU_API_URL || raw.api || DEFAULT_API,
|
|
20
|
-
key: process.env.SETU_CLI_API_KEY || raw.key || "",
|
|
21
|
-
operator: raw.operator || "",
|
|
22
|
-
};
|
|
23
|
-
} catch {
|
|
24
|
-
return { api: DEFAULT_API, key: process.env.SETU_CLI_API_KEY || "", operator: "" };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function saveConfig(cfg) {
|
|
29
|
-
const path = configPath();
|
|
30
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
31
|
-
writeFileSync(path, JSON.stringify(cfg, null, 2));
|
|
32
|
-
try { chmodSync(path, 0o600); } catch { /* windows */ }
|
|
33
|
-
return path;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function clearConfig() {
|
|
37
|
-
const path = configPath();
|
|
38
|
-
try { rmSync(path, { force: true }); } catch { /* ignore */ }
|
|
39
|
-
return path;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { DEFAULT_API, configPath };
|
package/lib/ui.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { createInterface } from "node:readline/promises";
|
|
2
|
-
import { stdin, stdout } from "node:process";
|
|
3
|
-
|
|
4
|
-
const useColor = stdout.isTTY && !process.env.NO_COLOR;
|
|
5
|
-
const wrap = (code) => (s) => (useColor ? `\u001b[${code}m${s}\u001b[0m` : String(s));
|
|
6
|
-
|
|
7
|
-
export const c = {
|
|
8
|
-
bold: wrap("1"),
|
|
9
|
-
dim: wrap("2"),
|
|
10
|
-
blue: wrap("36"),
|
|
11
|
-
green: wrap("32"),
|
|
12
|
-
yellow: wrap("33"),
|
|
13
|
-
red: wrap("31"),
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function log(...args) { console.log(...args); }
|
|
17
|
-
export function ok(msg) { log(`${c.green("✔")} ${msg}`); }
|
|
18
|
-
export function warn(msg) { log(`${c.yellow("!")} ${msg}`); }
|
|
19
|
-
export function fail(msg) { console.error(`${c.red("✖")} ${msg}`); }
|
|
20
|
-
|
|
21
|
-
export function heading(msg) { log(`\n${c.bold(msg)}`); }
|
|
22
|
-
|
|
23
|
-
export function table(rows) {
|
|
24
|
-
for (const [k, v] of rows) {
|
|
25
|
-
log(` ${c.dim(String(k).padEnd(18))} ${v ?? c.dim("—")}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function ask(question, { silent = false } = {}) {
|
|
30
|
-
const rl = createInterface({ input: stdin, output: stdout, terminal: true });
|
|
31
|
-
if (!silent) {
|
|
32
|
-
const answer = await rl.question(question);
|
|
33
|
-
rl.close();
|
|
34
|
-
return answer.trim();
|
|
35
|
-
}
|
|
36
|
-
// Hidden input for secrets.
|
|
37
|
-
const onData = (char) => {
|
|
38
|
-
if (["\n", "\r", "\u0004"].includes(char.toString())) return;
|
|
39
|
-
stdout.write("\u001b[2K\u001b[200D" + question + "*".repeat(rl.line.length));
|
|
40
|
-
};
|
|
41
|
-
stdin.on("data", onData);
|
|
42
|
-
const answer = await rl.question(question);
|
|
43
|
-
stdin.off("data", onData);
|
|
44
|
-
rl.close();
|
|
45
|
-
stdout.write("\n");
|
|
46
|
-
return answer.trim();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export async function confirm(question) {
|
|
50
|
-
const a = await ask(`${question} ${c.dim("(y/N)")} `);
|
|
51
|
-
return /^y(es)?$/i.test(a);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function spinner(label) {
|
|
55
|
-
if (!stdout.isTTY) { log(`${label}…`); return { stop: () => {} }; }
|
|
56
|
-
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
57
|
-
let i = 0;
|
|
58
|
-
const timer = setInterval(() => {
|
|
59
|
-
stdout.write(`\r${c.blue(frames[i++ % frames.length])} ${label} `);
|
|
60
|
-
}, 80);
|
|
61
|
-
return {
|
|
62
|
-
stop: (final) => {
|
|
63
|
-
clearInterval(timer);
|
|
64
|
-
stdout.write("\r\u001b[2K");
|
|
65
|
-
if (final) log(final);
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|