@wildbappy/bappy-cli 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +8 -8
  2. package/bin/bappy.js +39 -14
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # bappy CLI
1
+ # comptracker CLI (alias: bappy)
2
2
 
3
- Command-line access to Bappy's competitive intelligence dashboard subagent API.
3
+ Command-line access to Comptracker's competitive intelligence dashboard subagent API.
4
4
 
5
5
  ## Install
6
6
 
@@ -11,7 +11,7 @@ npm install -g @wildbappy/bappy-cli
11
11
  ## First Run
12
12
 
13
13
  ```bash
14
- bappy "how many recent blog posts has peer AI made?"
14
+ comptracker "how many recent blog posts has peer AI made?"
15
15
  ```
16
16
 
17
17
  On first run, the CLI prompts for your token:
@@ -22,9 +22,9 @@ On first run, the CLI prompts for your token:
22
22
  ## Commands
23
23
 
24
24
  ```bash
25
- bappy auth
26
- bappy logout
27
- bappy update
28
- bappy --json "question"
29
- bappy --url http://149-28-213-47.nip.io "question"
25
+ comptracker auth
26
+ comptracker logout
27
+ comptracker update
28
+ comptracker --json "question"
29
+ comptracker --url http://149-28-213-47.nip.io "question"
30
30
  ```
package/bin/bappy.js CHANGED
@@ -9,6 +9,8 @@ const { stdin, stdout, stderr, exit } = require('process');
9
9
 
10
10
  const DEFAULT_BASE_URL = 'http://149-28-213-47.nip.io';
11
11
  const TOKEN_PATTERN = /^cta_[A-Za-z0-9_-]{20,}$/;
12
+ const TOOL_NAME = 'comptracker';
13
+ const TOOL_ALIASES = ['bappy'];
12
14
 
13
15
  function notifyIfUpdateAvailable() {
14
16
  try {
@@ -27,15 +29,19 @@ function notifyIfUpdateAvailable() {
27
29
  }
28
30
 
29
31
  function getConfigDir() {
30
- const envDir = String(process.env.BAPPY_CONFIG_DIR || '').trim();
32
+ const envDir = String(process.env.COMPTRACKER_CONFIG_DIR || process.env.BAPPY_CONFIG_DIR || '').trim();
31
33
  if (envDir) return envDir;
32
- return path.join(os.homedir(), '.bappy-cli');
34
+ return path.join(os.homedir(), '.comptracker-cli');
33
35
  }
34
36
 
35
37
  function getConfigPath() {
36
38
  return path.join(getConfigDir(), 'config.json');
37
39
  }
38
40
 
41
+ function getLegacyConfigPath() {
42
+ return path.join(os.homedir(), '.bappy-cli', 'config.json');
43
+ }
44
+
39
45
  async function readConfig() {
40
46
  const file = getConfigPath();
41
47
  try {
@@ -43,6 +49,16 @@ async function readConfig() {
43
49
  const parsed = JSON.parse(raw);
44
50
  return parsed && typeof parsed === 'object' ? parsed : {};
45
51
  } catch {
52
+ // Backwards compat: read legacy config if present.
53
+ try {
54
+ const raw = await fs.readFile(getLegacyConfigPath(), 'utf8');
55
+ const parsed = JSON.parse(raw);
56
+ if (parsed && typeof parsed === 'object') {
57
+ // Best-effort migration so future writes land in the new location.
58
+ try { await writeConfig(parsed); } catch {}
59
+ return parsed;
60
+ }
61
+ } catch {}
46
62
  return {};
47
63
  }
48
64
  }
@@ -72,23 +88,26 @@ function sanitizeBaseUrl(value) {
72
88
  }
73
89
 
74
90
  function printWelcome(baseUrl) {
75
- stdout.write("Welcome to bappy's competitive intelligence dashboard! Thanks for trying it out.\n\n");
91
+ stdout.write("Welcome to Comptracker's competitive intelligence dashboard! Thanks for trying it out.\n\n");
76
92
  stdout.write(`You can find your token in your settings at ${baseUrl}/ after you log in.\n\n`);
77
93
  }
78
94
 
79
95
  function printHelp() {
80
- stdout.write(`bappy - Competitive intelligence CLI\n\n`);
96
+ stdout.write(`${TOOL_NAME} - Competitive intelligence CLI\n`);
97
+ stdout.write(`Alias: ${TOOL_ALIASES.join(', ')}\n\n`);
81
98
  stdout.write(`Usage:\n`);
82
- stdout.write(` bappy "<question>"\n`);
83
- stdout.write(` bappy auth\n`);
84
- stdout.write(` bappy logout\n`);
85
- stdout.write(` bappy update\n`);
86
- stdout.write(` bappy --url <baseUrl> "<question>"\n`);
87
- stdout.write(` bappy --token <cta_...> "<question>"\n`);
88
- stdout.write(` bappy --json "<question>"\n\n`);
99
+ stdout.write(` ${TOOL_NAME} "<question>"\n`);
100
+ stdout.write(` ${TOOL_NAME} auth\n`);
101
+ stdout.write(` ${TOOL_NAME} logout\n`);
102
+ stdout.write(` ${TOOL_NAME} update\n`);
103
+ stdout.write(` ${TOOL_NAME} --url <baseUrl> "<question>"\n`);
104
+ stdout.write(` ${TOOL_NAME} --token <cta_...> "<question>"\n`);
105
+ stdout.write(` ${TOOL_NAME} --json "<question>"\n\n`);
89
106
  stdout.write(`Env vars:\n`);
90
- stdout.write(` BAPPY_API_URL Override API base URL\n`);
91
- stdout.write(` BAPPY_CONFIG_DIR Override config directory\n`);
107
+ stdout.write(` COMPTRACKER_API_URL Override API base URL (preferred)\n`);
108
+ stdout.write(` COMPTRACKER_CONFIG_DIR Override config directory (preferred)\n`);
109
+ stdout.write(` BAPPY_API_URL Backwards-compatible alias\n`);
110
+ stdout.write(` BAPPY_CONFIG_DIR Backwards-compatible alias\n`);
92
111
  }
93
112
 
94
113
  function parseArgs(argv) {
@@ -272,7 +291,13 @@ async function run() {
272
291
  }
273
292
 
274
293
  const config = await readConfig();
275
- const baseUrl = sanitizeBaseUrl(flags.url || process.env.BAPPY_API_URL || config.baseUrl || DEFAULT_BASE_URL);
294
+ const baseUrl = sanitizeBaseUrl(
295
+ flags.url ||
296
+ process.env.COMPTRACKER_API_URL ||
297
+ process.env.BAPPY_API_URL ||
298
+ config.baseUrl ||
299
+ DEFAULT_BASE_URL
300
+ );
276
301
 
277
302
  if (command === 'logout') {
278
303
  const next = { ...config, baseUrl };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@wildbappy/bappy-cli",
3
- "version": "0.1.0",
4
- "description": "CLI for Bappy's competitive intelligence dashboard",
3
+ "version": "0.1.1",
4
+ "description": "CLI for Comptracker's competitive intelligence dashboard",
5
5
  "bin": {
6
- "bappy": "bin/bappy.js"
6
+ "bappy": "bin/bappy.js",
7
+ "comptracker": "bin/bappy.js"
7
8
  },
8
9
  "files": [
9
10
  "bin",