create-identity 0.2.3 → 0.2.5

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 (2) hide show
  1. package/letus.js +98 -0
  2. package/package.json +5 -3
package/letus.js ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('node:child_process');
3
+ const { existsSync } = require('node:fs');
4
+ const { homedir } = require('node:os');
5
+ const { dirname, join } = require('node:path');
6
+
7
+ function resolveInstalledAspCli() {
8
+ try {
9
+ const packageJsonPath = require.resolve('asp-protocol/package.json');
10
+ return join(dirname(packageJsonPath), 'dist', 'bin', 'asp.js');
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+
16
+ function getManifestPath() {
17
+ const storeDir = process.env.ASP_STORE_DIR || join(homedir(), '.asp');
18
+ return join(storeDir, 'manifest.yaml');
19
+ }
20
+
21
+ function runVertical(bin, args) {
22
+ let result = spawnSync(bin, args, { stdio: 'inherit' });
23
+ if (result.error && result.error.code === 'ENOENT') {
24
+ result = spawnSync('npx', ['-y', bin, ...args], { stdio: 'inherit' });
25
+ }
26
+ process.exit(result.status ?? 1);
27
+ }
28
+
29
+ function runAsp(args) {
30
+ let result = spawnSync('asp', args, { stdio: 'inherit' });
31
+ if (result.error && result.error.code === 'ENOENT') {
32
+ const resolved = resolveInstalledAspCli();
33
+ if (resolved) {
34
+ result = spawnSync(process.execPath, [resolved, ...args], { stdio: 'inherit' });
35
+ if (!result.error) return result;
36
+ }
37
+ result = spawnSync('npx', ['-y', '-p', 'asp-protocol', 'asp', ...args], { stdio: 'inherit' });
38
+ }
39
+ return result;
40
+ }
41
+
42
+ const args = process.argv.slice(2);
43
+ const first = args[0];
44
+
45
+ if (!first) {
46
+ console.log('\n letus — your agent-native social CLI\n');
47
+ console.log(' Verticals:');
48
+ console.log(' letus social [referrer] Join letus.social');
49
+ console.log(' letus meet <command> Events — search, info, rsvp, ask');
50
+ console.log(' letus date Dating onboarding');
51
+ console.log(' letus play Gaming (coming soon)');
52
+ console.log('');
53
+ console.log(' Social:');
54
+ console.log(' letus follow @handle Follow someone');
55
+ console.log(' letus post "text" Publish a post');
56
+ console.log(' letus send @handle "msg" Send a message');
57
+ console.log(' letus feed View your feed');
58
+ console.log('');
59
+ console.log(' Setup:');
60
+ console.log(' letus tools install --all Configure MCP server and skills');
61
+ console.log('');
62
+ process.exit(0);
63
+ }
64
+
65
+ if (first === 'social') {
66
+ runVertical('letussocial', args.slice(1));
67
+ }
68
+
69
+ if (first === 'date') {
70
+ runVertical('letusdate', args.slice(1));
71
+ }
72
+
73
+ if (first === 'meet') {
74
+ runVertical('letusmeet', args.slice(1));
75
+ }
76
+
77
+ if (first === 'play') {
78
+ runVertical('letusplay', args.slice(1));
79
+ }
80
+
81
+ // follow without identity → onboard first via asp-create
82
+ if (first === 'follow' && !existsSync(getManifestPath())) {
83
+ const target = args[1];
84
+ if (!target) {
85
+ console.log(' Usage: letus follow <@handle or url>\n');
86
+ process.exit(1);
87
+ }
88
+ // Use asp-create directly (available as dependency), not a specific vertical
89
+ let result = spawnSync('asp-create', [target], { stdio: 'inherit' });
90
+ if (result.error && result.error.code === 'ENOENT') {
91
+ result = spawnSync('npx', ['-y', 'asp-create', target], { stdio: 'inherit' });
92
+ }
93
+ process.exit(result.status ?? 1);
94
+ }
95
+
96
+ // Everything else → asp CLI
97
+ const result = runAsp(args);
98
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "create-identity",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Create your ASP identity — public onboarding alias for letus.social",
5
5
  "bin": {
6
- "create-identity": "index.js"
6
+ "create-identity": "index.js",
7
+ "letus": "letus.js"
7
8
  },
8
9
  "dependencies": {
9
- "asp-create": "^0.2.2"
10
+ "asp-create": "^0.2.2",
11
+ "asp-protocol": "^0.2.2"
10
12
  },
11
13
  "keywords": [
12
14
  "asp",