@lotics/cli 0.3.0 → 0.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/README.md CHANGED
@@ -27,7 +27,8 @@ The CLI checks for updates once per day and prompts when a new version is availa
27
27
 
28
28
  ```bash
29
29
  # 1. Authenticate
30
- lotics auth
30
+ lotics auth # interactive prompt
31
+ lotics auth ltk_... # non-interactive (for agents/CI)
31
32
 
32
33
  # 2. Discover tools
33
34
  lotics tools # list tools by category with descriptions
package/dist/src/cli.js CHANGED
@@ -15,7 +15,7 @@ Lotics is an AI-powered operations platform. Through this CLI you can:
15
15
  - Create and manage apps, knowledge docs, and files
16
16
 
17
17
  USAGE
18
- 1. lotics auth Authenticate (saves key to ~/.lotics/config.json)
18
+ 1. lotics auth [api_key] Authenticate (saves key to ~/.lotics/config.json)
19
19
  2. lotics tools List available tools by category
20
20
  3. lotics tools <name> Show tool description and full input schema
21
21
  4. lotics run <tool> '<json>' Execute a tool with JSON arguments
@@ -25,7 +25,7 @@ USAGE
25
25
  Query tools return IDs used as arguments to other tools.
26
26
 
27
27
  COMMANDS
28
- lotics auth Save API key (interactive)
28
+ lotics auth [api_key] Save API key (interactive prompt if omitted)
29
29
  lotics logout Remove saved credentials
30
30
  lotics tools List all available tools
31
31
  lotics tools <name> Show tool description and input schema
@@ -147,8 +147,8 @@ function prompt(question) {
147
147
  });
148
148
  });
149
149
  }
150
- async function handleAuth() {
151
- const apiKey = await prompt("Enter your API key: ");
150
+ async function handleAuth(providedKey) {
151
+ const apiKey = providedKey ?? await prompt("Enter your API key: ");
152
152
  if (!apiKey) {
153
153
  console.error("No API key provided.");
154
154
  process.exit(1);
@@ -208,7 +208,7 @@ async function main() {
208
208
  }
209
209
  // --- Commands that don't require auth ---
210
210
  if (command === "auth") {
211
- await handleAuth();
211
+ await handleAuth(subcommand ?? flags.apiKey);
212
212
  return;
213
213
  }
214
214
  if (command === "logout") {
@@ -70,7 +70,18 @@ async function fetchLatestVersion() {
70
70
  clearTimeout(timeout);
71
71
  }
72
72
  }
73
+ function isNewerVersion(latest, current) {
74
+ const [lMaj, lMin, lPat] = latest.split(".").map(Number);
75
+ const [cMaj, cMin, cPat] = current.split(".").map(Number);
76
+ if (lMaj !== cMaj)
77
+ return lMaj > cMaj;
78
+ if (lMin !== cMin)
79
+ return lMin > cMin;
80
+ return lPat > cPat;
81
+ }
73
82
  function printUpdateWarning(current, latest) {
83
+ if (!isNewerVersion(latest, current))
84
+ return;
74
85
  console.error(`\nUpdate available: ${current} → ${latest}`);
75
86
  console.error(`Run: npm i -g @lotics/cli\n`);
76
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {