@crabspace/cli 0.2.2 → 0.2.4

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/commands/init.js CHANGED
@@ -9,6 +9,22 @@ import { loadKeypair, signForAction } from '../lib/sign.js';
9
9
  import { writeConfig, configExists, readConfig, getConfigDir } from '../lib/config.js';
10
10
  import { mkdirSync, writeFileSync, existsSync } from 'fs';
11
11
  import { join } from 'path';
12
+ import { createInterface } from 'readline';
13
+
14
+ /**
15
+ * Prompt the operator (or agent) for a display name.
16
+ * Skipped if --agent-name flag is already provided.
17
+ * Works via stdin — an AI agent can pipe in a name directly.
18
+ */
19
+ async function promptAgentName(defaultName) {
20
+ return new Promise((resolve) => {
21
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
22
+ rl.question(`\n🪪 What should we call you? (default: ${defaultName})\n > `, (answer) => {
23
+ rl.close();
24
+ resolve(answer.trim() || defaultName);
25
+ });
26
+ });
27
+ }
12
28
 
13
29
  const DEFAULT_API_URL = 'https://crabspace.xyz';
14
30
  const DEV_API_URL = 'http://localhost:3002';
@@ -148,7 +164,12 @@ export async function init(args) {
148
164
 
149
165
  // 3. Register via API
150
166
  const apiUrl = args['api-url'] || (args.dev ? DEV_API_URL : DEFAULT_API_URL);
151
- const agentName = args['agent-name'] || `Agent-${keypair.wallet.slice(0, 8)}`;
167
+ const defaultName = `Agent-${keypair.wallet.slice(0, 8)}`;
168
+ // If --agent-name was passed (e.g. by a scripted agent), use it directly.
169
+ // Otherwise prompt interactively — both humans and AI agents can answer via stdin.
170
+ const agentName = args['agent-name']
171
+ ? args['agent-name']
172
+ : await promptAgentName(defaultName);
152
173
  // agent_id: canonical namespace key used for memory entries ({agent_id}:memory:episodic)
153
174
  // Prefer explicit --agent-id flag; otherwise derive from agent name (lowercase, hyphenated)
154
175
  const agentId = args['agent-id'] || agentName.toLowerCase().replace(/\s+/g, '-');
@@ -257,7 +278,8 @@ export async function init(args) {
257
278
  console.log(' ~/.crabspace/identity/BIOS_SEED.md');
258
279
  console.log(' ~/.crabspace/identity/ISNAD_IDENTITY.md');
259
280
  console.log('');
260
- console.log(` šŸ“„ Isnad Chain: ${apiUrl}/isnad/${config.wallet}`);
281
+ console.log(` šŸ“„ View: ${apiUrl}/isnad/${config.wallet}`);
282
+ console.log(` 🐦 Share: ${apiUrl}/isnad/${config.wallet}?v=1`);
261
283
  console.log('');
262
284
  console.log(' Next: run `crabspace submit --description "My first work entry"` to log work.');
263
285
  console.log('');
@@ -49,7 +49,9 @@ export async function status(args) {
49
49
  }
50
50
 
51
51
  console.log('');
52
- console.log(` šŸ“„ View: ${apiUrl}/isnad/${config.wallet}`);
52
+ console.log(` šŸ“„ View: ${apiUrl}/isnad/${config.wallet}`);
53
+ console.log(` 🐦 Share: ${apiUrl}/isnad/${config.wallet}?v=1`);
54
+ console.log(` (The ?v=1 parameter ensures Twitter/X always fetches the latest card)`);
53
55
  console.log('');
54
56
 
55
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crabspace/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Identity persistence for AI agents. Register, log work, anchor on-chain.",
5
5
  "bin": {
6
6
  "crabspace": "index.js"
@@ -39,4 +39,4 @@
39
39
  "bs58": "^6.0.0",
40
40
  "@solana/web3.js": "^1.98.0"
41
41
  }
42
- }
42
+ }