lystbot 0.2.1 โ†’ 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lystbot",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "LystBot CLI - Manage your lists from the terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "cli",
19
19
  "productivity"
20
20
  ],
21
- "author": "AI Ventures Holding / TourAround UG",
21
+ "author": "TourAround UG",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "commander": "^12.0.0"
package/src/config.js CHANGED
@@ -2,12 +2,30 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const os = require('os');
4
4
 
5
+ // Support per-agent config via LYSTBOT_CONFIG env var or --config flag
6
+ let _configPath = process.env.LYSTBOT_CONFIG || null;
7
+
8
+ function setConfigPath(p) {
9
+ _configPath = p;
10
+ }
11
+
12
+ function getConfigDir() {
13
+ if (_configPath) return path.dirname(_configPath);
14
+ return path.join(os.homedir(), '.lystbot');
15
+ }
16
+
17
+ function getConfigPath() {
18
+ if (_configPath) return _configPath;
19
+ return path.join(os.homedir(), '.lystbot', 'config.json');
20
+ }
21
+
22
+ // Keep backwards compat
5
23
  const CONFIG_DIR = path.join(os.homedir(), '.lystbot');
6
24
  const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
7
25
 
8
26
  function read() {
9
27
  try {
10
- const data = fs.readFileSync(CONFIG_PATH, 'utf8');
28
+ const data = fs.readFileSync(getConfigPath(), 'utf8');
11
29
  return JSON.parse(data);
12
30
  } catch {
13
31
  return null;
@@ -15,13 +33,13 @@ function read() {
15
33
  }
16
34
 
17
35
  function write(config) {
18
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
19
- fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n');
36
+ fs.mkdirSync(getConfigDir(), { recursive: true });
37
+ fs.writeFileSync(getConfigPath(), JSON.stringify(config, null, 2) + '\n');
20
38
  }
21
39
 
22
40
  function remove() {
23
41
  try {
24
- fs.unlinkSync(CONFIG_PATH);
42
+ fs.unlinkSync(getConfigPath());
25
43
  return true;
26
44
  } catch {
27
45
  return false;
@@ -53,4 +71,4 @@ function getBaseUrl() {
53
71
  return PROD_URL;
54
72
  }
55
73
 
56
- module.exports = { read, write, remove, getApiKey, getBaseUrl, setCustomUrl, PROD_URL, CONFIG_PATH };
74
+ module.exports = { read, write, remove, getApiKey, getBaseUrl, setCustomUrl, setConfigPath, getConfigPath, PROD_URL, CONFIG_PATH };
package/src/index.js CHANGED
@@ -14,8 +14,12 @@ program
14
14
  .description('๐Ÿ“‹ LystBot CLI - Manage your lists from the terminal')
15
15
  .version(pkg.version)
16
16
  .option('--api <url>', 'Use custom API URL')
17
+ .option('--config <path>', 'Use custom config file (for multi-agent setups)')
17
18
  .hook('preAction', () => {
18
19
  const opts = program.opts();
20
+ if (opts.config) {
21
+ config.setConfigPath(opts.config);
22
+ }
19
23
  if (opts.api) {
20
24
  config.setCustomUrl(opts.api);
21
25
  console.log(`๐Ÿ”— API: ${opts.api}\n`);
@@ -197,9 +201,18 @@ program
197
201
  .action(async (listQuery, rawItems) => {
198
202
  config.getApiKey();
199
203
 
200
- // Smart parsing: split on commas, trim, flatten
204
+ // Smart parsing: each CLI argument is one item.
205
+ // Within a single argument, split on ", " (comma+space) for batch input.
206
+ // To include a literal comma+space in an item, use semicolons as separator instead.
207
+ // e.g. "Milch; Eier; Brot" or "Kรคse, Wurst, Senf" both work as batch.
208
+ // Single item with comma: pass as separate arg without comma+space pattern.
201
209
  const items = rawItems
202
- .flatMap(i => i.split(','))
210
+ .flatMap(i => {
211
+ // If argument contains semicolons, use those as separators (commas stay literal)
212
+ if (i.includes(';')) return i.split(';');
213
+ // Otherwise split on ", " (comma followed by space)
214
+ return i.split(', ');
215
+ })
203
216
  .map(i => i.trim())
204
217
  .filter(Boolean);
205
218