create-identity 0.2.4 → 0.2.7
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/index.js +7 -55
- package/letus.js +1 -78
- package/package.json +3 -4
package/index.js
CHANGED
|
@@ -1,60 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawnSync } = require('node:child_process');
|
|
3
|
-
const {
|
|
3
|
+
const { bootstrap } = require('letussocial/bootstrap.js');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
if (rawArgs[0] === 'follow') {
|
|
7
|
-
if (!rawArgs[1]) {
|
|
8
|
-
console.log(' Usage: create-identity follow <@handle or url>\n');
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
return rawArgs.slice(1);
|
|
12
|
-
}
|
|
13
|
-
return rawArgs;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function resolveInstalledAspCreate() {
|
|
17
|
-
try {
|
|
18
|
-
const packageJsonPath = require.resolve('asp-create/package.json');
|
|
19
|
-
return join(dirname(packageJsonPath), 'dist', 'index.js');
|
|
20
|
-
} catch {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const env = {
|
|
26
|
-
...process.env,
|
|
27
|
-
ASP_CREATE_HOSTING_MODE: 'managed',
|
|
28
|
-
ASP_HUB_WEB_URL: process.env.ASP_HUB_WEB_URL ?? 'https://letus.social',
|
|
29
|
-
ASP_HUB_API_URL: process.env.ASP_HUB_API_URL ?? 'https://letus.social/api',
|
|
30
|
-
ASP_HOSTED_HANDLE_DOMAIN: process.env.ASP_HOSTED_HANDLE_DOMAIN ?? 'letus.social',
|
|
31
|
-
ASP_CREATE_POWERED_BY: process.env.ASP_CREATE_POWERED_BY ?? 'Powered by Agent Social Protocol',
|
|
32
|
-
ASP_CREATE_DEFAULT_POST: process.env.ASP_CREATE_DEFAULT_POST ?? 'Just joined letus.social — ready to connect!',
|
|
33
|
-
ASP_CREATE_POST_PROMPT: process.env.ASP_CREATE_POST_PROMPT ?? '\n Your first post [Enter to publish, or type your own]:\n > ',
|
|
34
|
-
ASP_CREATE_IDENTITY_LABEL: process.env.ASP_CREATE_IDENTITY_LABEL ?? 'Your primary identity',
|
|
35
|
-
ASP_CREATE_VALUE_PROP: process.env.ASP_CREATE_VALUE_PROP ?? 'Post, follow, and let your agent represent you.',
|
|
36
|
-
ASP_CREATE_SHARE_LABEL: process.env.ASP_CREATE_SHARE_LABEL ?? 'Share this to connect with friends:',
|
|
37
|
-
ASP_CREATE_SHARE_COMMAND: process.env.ASP_CREATE_SHARE_COMMAND ?? 'npx letussocial follow {target}',
|
|
38
|
-
ASP_CREATE_PROFILE_BASE_URL: process.env.ASP_CREATE_PROFILE_BASE_URL ?? 'https://letus.social',
|
|
39
|
-
ASP_ACTIONS: process.env.ASP_ACTIONS ?? JSON.stringify([
|
|
40
|
-
{ command: 'asp post "Hello"', description: 'Publish a post' },
|
|
41
|
-
{ command: 'asp follow @handle', description: 'Follow someone' },
|
|
42
|
-
{ command: 'asp send @handle "msg"', description: 'Send a message' },
|
|
43
|
-
{ command: 'asp feed', description: 'View your feed' },
|
|
44
|
-
]),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const args = normalizeArgs(process.argv.slice(2));
|
|
48
|
-
|
|
49
|
-
let result = spawnSync('asp-create', args, { stdio: 'inherit', env });
|
|
50
|
-
if (result.error && result.error.code === 'ENOENT') {
|
|
51
|
-
const installedAspCreate = resolveInstalledAspCreate();
|
|
52
|
-
if (installedAspCreate) {
|
|
53
|
-
result = spawnSync(process.execPath, [installedAspCreate, ...args], { stdio: 'inherit', env });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (result.error && result.error.code === 'ENOENT') {
|
|
57
|
-
result = spawnSync('npx', ['-y', 'asp-create', ...args], { stdio: 'inherit', env });
|
|
58
|
-
}
|
|
5
|
+
bootstrap('create-identity');
|
|
59
6
|
|
|
7
|
+
// Delegate to letussocial (same product, different name)
|
|
8
|
+
const script = require.resolve('letussocial/index.js');
|
|
9
|
+
const result = spawnSync(process.execPath, [script, ...process.argv.slice(2)], {
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
});
|
|
60
12
|
process.exit(result.status ?? 1);
|
package/letus.js
CHANGED
|
@@ -1,79 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
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 run(bin, args) {
|
|
22
|
-
let result = spawnSync(bin, args, { stdio: 'inherit' });
|
|
23
|
-
if (result.error && result.error.code === 'ENOENT') {
|
|
24
|
-
result = spawnSync('npx', [bin, ...args], { stdio: 'inherit' });
|
|
25
|
-
}
|
|
26
|
-
process.exit(result.status ?? 1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const args = process.argv.slice(2);
|
|
30
|
-
const first = args[0];
|
|
31
|
-
|
|
32
|
-
if (!first) {
|
|
33
|
-
console.log('\n letus — consumer entrypoint for ASP\n');
|
|
34
|
-
console.log(' letus social [referrer] Join letus.social');
|
|
35
|
-
console.log(' letus date Start the dating onboarding');
|
|
36
|
-
console.log(' letus meet [target] Start the scheduling onboarding');
|
|
37
|
-
console.log(' letus follow @target Follow someone, onboarding first if needed');
|
|
38
|
-
console.log(' letus <asp-command> Run the protocol CLI through the letus brand');
|
|
39
|
-
console.log('');
|
|
40
|
-
process.exit(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (first === 'social') {
|
|
44
|
-
run('letussocial', args.slice(1));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (first === 'date') {
|
|
48
|
-
run('letusdate', args.slice(1));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (first === 'meet') {
|
|
52
|
-
run('letusmeet', args.slice(1));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (first === 'play') {
|
|
56
|
-
run('letusplay', args.slice(1));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (first === 'follow' && !existsSync(getManifestPath())) {
|
|
60
|
-
const target = args[1];
|
|
61
|
-
if (!target) {
|
|
62
|
-
console.log(' Usage: letus follow <@handle or url>\n');
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
run('letussocial', [target]);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let result = spawnSync('asp', args, { stdio: 'inherit' });
|
|
69
|
-
if (result.error && result.error.code === 'ENOENT') {
|
|
70
|
-
const installedAspCli = resolveInstalledAspCli();
|
|
71
|
-
if (installedAspCli) {
|
|
72
|
-
result = spawnSync(process.execPath, [installedAspCli, ...args], { stdio: 'inherit' });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (result.error && result.error.code === 'ENOENT') {
|
|
76
|
-
result = spawnSync('npx', ['-y', '-p', 'asp-protocol', 'asp', ...args], { stdio: 'inherit' });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
process.exit(result.status ?? 1);
|
|
2
|
+
require('letussocial/letus.js');
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-identity",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Create your ASP identity —
|
|
3
|
+
"version": "0.2.7",
|
|
4
|
+
"description": "Create your ASP identity — onboarding entry for letus.social",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-identity": "index.js",
|
|
7
7
|
"letus": "letus.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"
|
|
11
|
-
"asp-protocol": "^0.2.2"
|
|
10
|
+
"letussocial": "^0.0.4"
|
|
12
11
|
},
|
|
13
12
|
"keywords": [
|
|
14
13
|
"asp",
|