@nostrbox/cli 1.1.0 ā 1.1.2
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/dist/nip05check.js +67 -40
- package/dist/nip05check.js.map +1 -1
- package/dist/nip05lookup.js +93 -44
- package/dist/nip05lookup.js.map +1 -1
- package/dist/utils/argParser.d.ts +31 -0
- package/dist/utils/argParser.d.ts.map +1 -0
- package/dist/utils/argParser.js +152 -0
- package/dist/utils/argParser.js.map +1 -0
- package/package.json +7 -3
package/dist/nip05check.js
CHANGED
|
@@ -1,55 +1,82 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const core_1 = require("@nostrbox/core");
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const argParser_js_1 = require("./utils/argParser.js");
|
|
10
|
+
function createParser() {
|
|
11
|
+
return new argParser_js_1.ArgumentParser({
|
|
12
|
+
options: [
|
|
13
|
+
{
|
|
14
|
+
name: 'omit-relay-check',
|
|
15
|
+
alias: 'o',
|
|
16
|
+
type: 'flag',
|
|
17
|
+
description: 'Skip relay validation'
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
positional: {
|
|
21
|
+
name: 'domain',
|
|
22
|
+
description: 'Domain to check (e.g., domain.com)',
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function parseArgs(args) {
|
|
28
|
+
const parser = createParser();
|
|
29
|
+
const parsed = parser.parse(args);
|
|
30
|
+
return {
|
|
31
|
+
omitRelayCheck: parsed['omit-relay-check'] || false,
|
|
32
|
+
domain: parsed._positional || ''
|
|
33
|
+
};
|
|
34
|
+
}
|
|
5
35
|
async function main() {
|
|
6
36
|
const args = process.argv.slice(2);
|
|
7
37
|
if (args.length === 0) {
|
|
8
|
-
|
|
9
|
-
|
|
38
|
+
const parser = createParser();
|
|
39
|
+
parser.printHelp('nip05check', 'š NIP-05 Domain Checker', undefined, 'domain.com');
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
let parsedArgs;
|
|
43
|
+
try {
|
|
44
|
+
parsedArgs = parseArgs(args);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error(`ā Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
10
48
|
process.exit(1);
|
|
11
49
|
}
|
|
12
|
-
const domain =
|
|
50
|
+
const { domain, omitRelayCheck } = parsedArgs;
|
|
13
51
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(`š Well-known directory: ${result.wellKnownExists ? 'ā
Exists' : 'ā Missing'}`);
|
|
21
|
-
console.log(`š nostr.json file: ${result.nostrJsonExists ? 'ā
Found' : 'ā Not found'}`);
|
|
22
|
-
console.log(`āļø nostr.json valid: ${result.nostrJsonValid ? 'ā
Valid' : 'ā Invalid'}`);
|
|
23
|
-
console.log(`š„ Entries count: ${result.entriesCount}`);
|
|
24
|
-
if (result.relayValidation) {
|
|
25
|
-
console.log(`\nš Relay Validation:`);
|
|
26
|
-
console.log(` Total relays: ${result.relayValidation.totalRelays}`);
|
|
27
|
-
console.log(` Unique relays: ${result.relayValidation.uniqueRelays}`);
|
|
28
|
-
console.log(` Valid relays: ${result.relayValidation.validRelays}`);
|
|
29
|
-
console.log(` Invalid relays: ${result.relayValidation.invalidRelays}`);
|
|
30
|
-
if (result.relayValidation.relayDetails && result.relayValidation.relayDetails.length > 0) {
|
|
31
|
-
console.log(`\nš Relay Details:`);
|
|
32
|
-
for (const relay of result.relayValidation.relayDetails) {
|
|
33
|
-
const status = relay.isValid ? 'ā
' : 'ā';
|
|
34
|
-
const timeInfo = relay.responseTime ? `[${relay.responseTime}ms]` : '';
|
|
35
|
-
const errorInfo = relay.error ? `(${relay.error})` : '';
|
|
36
|
-
console.log(` ${status} ${relay.url} ${errorInfo} ${timeInfo}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
52
|
+
const spinner = (0, ora_1.default)('Checking nostr.json file...').start();
|
|
53
|
+
const nostrBox = new core_1.NostrBoxCore();
|
|
54
|
+
// Add a small delay to show the first message
|
|
55
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
56
|
+
if (!omitRelayCheck) {
|
|
57
|
+
spinner.text = 'Validating domain and relays...';
|
|
39
58
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const error of result.errors) {
|
|
43
|
-
console.log(` ⢠${error}`);
|
|
44
|
-
}
|
|
59
|
+
else {
|
|
60
|
+
spinner.text = 'Validating domain (skipping relay check)...';
|
|
45
61
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
const result = await nostrBox.nip05Check(domain, omitRelayCheck);
|
|
63
|
+
spinner.text = 'Loading user data...';
|
|
64
|
+
// Display all users and their relays
|
|
65
|
+
let users = [];
|
|
66
|
+
try {
|
|
67
|
+
users = await nostrBox.listUsersWithRelays(domain, omitRelayCheck);
|
|
68
|
+
spinner.text = 'Formatting results...';
|
|
69
|
+
// Small delay to show the formatting message
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
71
|
+
}
|
|
72
|
+
catch (userError) {
|
|
73
|
+
spinner.text = 'Formatting results...';
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
51
75
|
}
|
|
52
|
-
|
|
76
|
+
spinner.succeed('Validation complete!');
|
|
77
|
+
// Use the NostrBoxCore formatting method
|
|
78
|
+
const formattedOutput = nostrBox.formatDomainValidationResult(result, users, omitRelayCheck);
|
|
79
|
+
formattedOutput.forEach((line) => console.log(line));
|
|
53
80
|
// Exit with error code if validation failed
|
|
54
81
|
if (!result.nostrJsonValid) {
|
|
55
82
|
process.exit(1);
|
|
@@ -60,7 +87,7 @@ async function main() {
|
|
|
60
87
|
process.exit(1);
|
|
61
88
|
}
|
|
62
89
|
}
|
|
63
|
-
main().catch(error => {
|
|
90
|
+
main().catch((error) => {
|
|
64
91
|
console.error(`Fatal error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
65
92
|
process.exit(1);
|
|
66
93
|
});
|
package/dist/nip05check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nip05check.js","sourceRoot":"","sources":["../src/nip05check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nip05check.js","sourceRoot":"","sources":["../src/nip05check.ts"],"names":[],"mappings":";;;;;;AAEA,yCAA6C;AAE7C,8CAAqB;AACrB,uDAAqD;AAOrD,SAAS,YAAY;IACnB,OAAO,IAAI,6BAAc,CAAC;QACxB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,kBAAkB;gBACxB,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,uBAAuB;aACrC;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,MAAM,GAAG,YAAY,EAAE,CAAA;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEjC,OAAO;QACL,cAAc,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAAI,KAAK;QACnD,MAAM,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;KACjC,CAAA;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CA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Y,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC3E,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/nip05lookup.js
CHANGED
|
@@ -2,62 +2,111 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const core_1 = require("@nostrbox/core");
|
|
5
|
+
const argParser_js_1 = require("./utils/argParser.js");
|
|
6
|
+
function createParser() {
|
|
7
|
+
return new argParser_js_1.ArgumentParser({
|
|
8
|
+
options: [
|
|
9
|
+
{
|
|
10
|
+
name: 'type',
|
|
11
|
+
alias: 't',
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'Specify output type',
|
|
14
|
+
choices: ['hex', 'bech32', 'relays', 'all']
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'raw',
|
|
18
|
+
alias: 'r',
|
|
19
|
+
type: 'flag',
|
|
20
|
+
description: 'Output raw value without formatting'
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
positional: {
|
|
24
|
+
name: 'identifier',
|
|
25
|
+
description: 'NIP-05 identifier (e.g., dave@jb55.com)',
|
|
26
|
+
required: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function parseArgs(args) {
|
|
31
|
+
const parser = createParser();
|
|
32
|
+
const parsed = parser.parse(args);
|
|
33
|
+
return {
|
|
34
|
+
type: parsed.type || 'all',
|
|
35
|
+
raw: parsed.raw || false,
|
|
36
|
+
identifier: parsed._positional || ''
|
|
37
|
+
};
|
|
38
|
+
}
|
|
5
39
|
async function main() {
|
|
6
40
|
const args = process.argv.slice(2);
|
|
7
41
|
if (args.length === 0) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.error('Types: hex, bech32, relays, all (default)');
|
|
12
|
-
console.error('');
|
|
13
|
-
console.error('Examples:');
|
|
14
|
-
console.error(' nip05lookup dave@jb55.com # All information');
|
|
15
|
-
console.error(' nip05lookup -t hex dave@jb55.com # Hex pubkey only');
|
|
16
|
-
console.error(' nip05lookup -t bech32 dave@jb55.com # Npub format only');
|
|
17
|
-
console.error(' nip05lookup -t relays dave@jb55.com # Relays only');
|
|
18
|
-
console.error(' nip05lookup jb55.com # Domain-only lookup');
|
|
19
|
-
process.exit(1);
|
|
42
|
+
const parser = createParser();
|
|
43
|
+
parser.printHelp('nip05lookup', 'š NIP-05 Lookup Tool', undefined, 'dave@jb55.com');
|
|
44
|
+
process.exit(0);
|
|
20
45
|
}
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const typeArg = args[1];
|
|
25
|
-
if (!['hex', 'bech32', 'relays', 'all'].includes(typeArg)) {
|
|
26
|
-
console.error(`ā Invalid type: ${typeArg}`);
|
|
27
|
-
console.error('Valid types: hex, bech32, relays, all');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
type = typeArg;
|
|
31
|
-
identifier = args[2];
|
|
46
|
+
let parsedArgs;
|
|
47
|
+
try {
|
|
48
|
+
parsedArgs = parseArgs(args);
|
|
32
49
|
}
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(`ā Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
52
|
+
process.exit(1);
|
|
35
53
|
}
|
|
54
|
+
const { type, raw, identifier } = parsedArgs;
|
|
36
55
|
try {
|
|
37
56
|
const result = await (0, core_1.lookupNip05)(identifier, type);
|
|
38
57
|
const outputs = (0, core_1.formatNip05Output)(result, type);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log('='.repeat(50));
|
|
43
|
-
// Show the results based on type
|
|
44
|
-
if (type === 'hex' || type === 'all') {
|
|
45
|
-
if (outputs.includes(result.pubkey)) {
|
|
46
|
-
console.log(`\nš Hex pubkey:`);
|
|
58
|
+
if (raw) {
|
|
59
|
+
// Raw output - just the values without formatting
|
|
60
|
+
if (type === 'hex') {
|
|
47
61
|
console.log(result.pubkey);
|
|
48
62
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
else if (type === 'bech32') {
|
|
64
|
+
if (result.npub) {
|
|
65
|
+
console.log(result.npub);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else if (type === 'relays') {
|
|
69
|
+
if (result.relays && result.relays.length > 0) {
|
|
70
|
+
result.relays.forEach((relay) => console.log(relay));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (type === 'all') {
|
|
74
|
+
// For 'all' type with raw, output each value on separate lines
|
|
75
|
+
console.log(result.pubkey);
|
|
76
|
+
if (result.npub) {
|
|
77
|
+
console.log(result.npub);
|
|
78
|
+
}
|
|
79
|
+
if (result.relays && result.relays.length > 0) {
|
|
80
|
+
result.relays.forEach((relay) => console.log(relay));
|
|
81
|
+
}
|
|
54
82
|
}
|
|
55
83
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
else {
|
|
85
|
+
// Formatted output
|
|
86
|
+
const displayName = result.name
|
|
87
|
+
? `${result.name}@${result.domain}`
|
|
88
|
+
: `_@${result.domain}`;
|
|
89
|
+
console.log(`š NIP-05 Lookup: ${displayName}`);
|
|
90
|
+
console.log('='.repeat(50));
|
|
91
|
+
// Show the results based on type
|
|
92
|
+
if (type === 'hex' || type === 'all') {
|
|
93
|
+
if (outputs.includes(result.pubkey)) {
|
|
94
|
+
console.log(`\nš Hex pubkey:`);
|
|
95
|
+
console.log(result.pubkey);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (type === 'bech32' || type === 'all') {
|
|
99
|
+
if (result.npub && outputs.includes(result.npub)) {
|
|
100
|
+
console.log(`\nš Npub (bech32):`);
|
|
101
|
+
console.log(result.npub);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (type === 'relays' || type === 'all') {
|
|
105
|
+
if (result.relays && result.relays.length > 0) {
|
|
106
|
+
console.log(`\nš Relays:`);
|
|
107
|
+
for (const relay of result.relays) {
|
|
108
|
+
console.log(relay);
|
|
109
|
+
}
|
|
61
110
|
}
|
|
62
111
|
}
|
|
63
112
|
}
|
|
@@ -67,7 +116,7 @@ async function main() {
|
|
|
67
116
|
process.exit(1);
|
|
68
117
|
}
|
|
69
118
|
}
|
|
70
|
-
main().catch(error => {
|
|
119
|
+
main().catch((error) => {
|
|
71
120
|
console.error(`ā Fatal error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
72
121
|
process.exit(1);
|
|
73
122
|
});
|
package/dist/nip05lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nip05lookup.js","sourceRoot":"","sources":["../src/nip05lookup.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"nip05lookup.js","sourceRoot":"","sources":["../src/nip05lookup.ts"],"names":[],"mappings":";;;AAEA,yCAA+D;AAE/D,uDAAqD;AAQrD,SAAS,YAAY;IACnB,OAAO,IAAI,6BAAc,CAAC;QACxB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qBAAqB;gBAClC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;aAC5C;YACD;gBACE,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,qCAAqC;aACnD;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS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,CACX,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACvE,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CACX,kBAAkB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ArgOption {
|
|
2
|
+
name: string;
|
|
3
|
+
alias?: string;
|
|
4
|
+
type: 'flag' | 'string';
|
|
5
|
+
description?: string;
|
|
6
|
+
choices?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ArgDefinition {
|
|
9
|
+
options: ArgOption[];
|
|
10
|
+
positional?: {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ParsedArguments {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
_positional?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class ArgumentParser {
|
|
21
|
+
private definition;
|
|
22
|
+
constructor(definition: ArgDefinition);
|
|
23
|
+
parse(args: string[]): ParsedArguments;
|
|
24
|
+
private findOption;
|
|
25
|
+
private generateUsage;
|
|
26
|
+
private generateOptions;
|
|
27
|
+
private generateExamples;
|
|
28
|
+
printHelp(command: string, title?: string, description?: string, exampleValue?: string): void;
|
|
29
|
+
private getExampleDescription;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=argParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argParser.d.ts","sourceRoot":"","sources":["../../src/utils/argParser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAe;gBAErB,UAAU,EAAE,aAAa;IAIrC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe;IAuDtC,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,eAAe;IAgCvB,OAAO,CAAC,gBAAgB;IAiCxB,SAAS,CACP,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI;IAyBP,OAAO,CAAC,qBAAqB;CAe9B"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArgumentParser = void 0;
|
|
4
|
+
class ArgumentParser {
|
|
5
|
+
constructor(definition) {
|
|
6
|
+
this.definition = definition;
|
|
7
|
+
}
|
|
8
|
+
parse(args) {
|
|
9
|
+
const result = {};
|
|
10
|
+
let i = 0;
|
|
11
|
+
while (i < args.length) {
|
|
12
|
+
const arg = args[i];
|
|
13
|
+
if (arg.startsWith('-')) {
|
|
14
|
+
const option = this.findOption(arg);
|
|
15
|
+
if (!option) {
|
|
16
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
17
|
+
}
|
|
18
|
+
if (option.type === 'flag') {
|
|
19
|
+
result[option.name] = true;
|
|
20
|
+
i++;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (i + 1 >= args.length) {
|
|
24
|
+
const choices = option.choices
|
|
25
|
+
? ` (choices: ${option.choices.join(', ')})`
|
|
26
|
+
: '';
|
|
27
|
+
throw new Error(`Option ${arg} requires a value${choices}`);
|
|
28
|
+
}
|
|
29
|
+
const value = args[i + 1];
|
|
30
|
+
if (option.choices && !option.choices.includes(value)) {
|
|
31
|
+
throw new Error(`Invalid value for ${arg}: ${value}. Valid choices: ${option.choices.join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
result[option.name] = value;
|
|
34
|
+
i += 2;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Positional argument
|
|
39
|
+
if (this.definition.positional) {
|
|
40
|
+
result._positional = arg;
|
|
41
|
+
}
|
|
42
|
+
i++;
|
|
43
|
+
break; // Only handle one positional for now
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Check required positional
|
|
47
|
+
if (this.definition.positional?.required && !result._positional) {
|
|
48
|
+
const desc = this.definition.positional.description ||
|
|
49
|
+
this.definition.positional.name;
|
|
50
|
+
throw new Error(`Required argument missing: ${desc}`);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
findOption(arg) {
|
|
55
|
+
const cleanArg = arg.replace(/^-+/, '');
|
|
56
|
+
return this.definition.options.find((opt) => opt.name === cleanArg || opt.alias === cleanArg);
|
|
57
|
+
}
|
|
58
|
+
generateUsage(programName) {
|
|
59
|
+
let usage = `Usage: ${programName}`;
|
|
60
|
+
if (this.definition.options.length > 0) {
|
|
61
|
+
usage += ' [options]';
|
|
62
|
+
}
|
|
63
|
+
if (this.definition.positional) {
|
|
64
|
+
const pos = this.definition.positional;
|
|
65
|
+
usage += pos.required ? ` <${pos.name}>` : ` [${pos.name}]`;
|
|
66
|
+
}
|
|
67
|
+
return usage;
|
|
68
|
+
}
|
|
69
|
+
generateOptions() {
|
|
70
|
+
const lines = [];
|
|
71
|
+
if (this.definition.options.length > 0) {
|
|
72
|
+
lines.push('Options:');
|
|
73
|
+
for (const opt of this.definition.options) {
|
|
74
|
+
let optLine = ' ';
|
|
75
|
+
if (opt.alias) {
|
|
76
|
+
optLine += `-${opt.alias}, `;
|
|
77
|
+
}
|
|
78
|
+
optLine += `--${opt.name}`;
|
|
79
|
+
if (opt.type !== 'flag') {
|
|
80
|
+
optLine += ` <${opt.name}>`;
|
|
81
|
+
}
|
|
82
|
+
if (opt.description) {
|
|
83
|
+
optLine = optLine.padEnd(25) + opt.description;
|
|
84
|
+
}
|
|
85
|
+
if (opt.choices) {
|
|
86
|
+
optLine += ` (choices: ${opt.choices.join(', ')})`;
|
|
87
|
+
}
|
|
88
|
+
lines.push(optLine);
|
|
89
|
+
}
|
|
90
|
+
lines.push('');
|
|
91
|
+
}
|
|
92
|
+
return lines;
|
|
93
|
+
}
|
|
94
|
+
generateExamples(programName, exampleValue) {
|
|
95
|
+
const examples = [];
|
|
96
|
+
const sampleValue = exampleValue || 'input';
|
|
97
|
+
// Basic usage
|
|
98
|
+
if (this.definition.positional) {
|
|
99
|
+
examples.push(`${programName} ${sampleValue}`);
|
|
100
|
+
}
|
|
101
|
+
// Generate examples for each option
|
|
102
|
+
for (const opt of this.definition.options) {
|
|
103
|
+
if (opt.type === 'flag') {
|
|
104
|
+
if (opt.alias) {
|
|
105
|
+
examples.push(`${programName} -${opt.alias} ${sampleValue}`);
|
|
106
|
+
}
|
|
107
|
+
examples.push(`${programName} --${opt.name} ${sampleValue}`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const optValue = opt.choices?.[0] || 'value';
|
|
111
|
+
if (opt.alias) {
|
|
112
|
+
examples.push(`${programName} -${opt.alias} ${optValue} ${sampleValue}`);
|
|
113
|
+
}
|
|
114
|
+
examples.push(`${programName} --${opt.name} ${optValue} ${sampleValue}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return examples;
|
|
118
|
+
}
|
|
119
|
+
printHelp(command, title, description, exampleValue) {
|
|
120
|
+
if (title)
|
|
121
|
+
console.log(title);
|
|
122
|
+
if (description)
|
|
123
|
+
console.log(description);
|
|
124
|
+
console.log(this.generateUsage(command));
|
|
125
|
+
console.log('');
|
|
126
|
+
const optionLines = this.generateOptions();
|
|
127
|
+
optionLines.forEach((line) => console.log(line));
|
|
128
|
+
const examples = this.generateExamples(command, exampleValue);
|
|
129
|
+
if (examples.length > 0) {
|
|
130
|
+
console.log('Examples:');
|
|
131
|
+
const maxLength = Math.max(...examples.map((ex) => ex.length));
|
|
132
|
+
const padding = Math.max(maxLength + 6, 45);
|
|
133
|
+
examples.forEach((example) => {
|
|
134
|
+
const paddedExample = ` ${example}`.padEnd(padding);
|
|
135
|
+
console.log(`${paddedExample}# ${this.getExampleDescription(example, command)}`);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
getExampleDescription(example, programName) {
|
|
140
|
+
const parts = example.replace(programName, '').trim().split(' ');
|
|
141
|
+
if (parts.length === 1)
|
|
142
|
+
return 'Basic usage';
|
|
143
|
+
const firstArg = parts[0];
|
|
144
|
+
if (firstArg.startsWith('-')) {
|
|
145
|
+
const option = this.definition.options.find((opt) => firstArg === `--${opt.name}` || firstArg === `-${opt.alias}`);
|
|
146
|
+
return option?.description || 'With option';
|
|
147
|
+
}
|
|
148
|
+
return 'Usage example';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.ArgumentParser = ArgumentParser;
|
|
152
|
+
//# sourceMapping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CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CACpE,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAEO,qBAAqB,CAAC,OAAe,EAAE,WAAmB;QAChE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAEhE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,aAAa,CAAA;QAE5C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CACzC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,KAAK,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,QAAQ,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CACtE,CAAA;YACD,OAAO,MAAM,EAAE,WAAW,IAAI,aAAa,CAAA;QAC7C,CAAC;QAED,OAAO,eAAe,CAAA;IACxB,CAAC;CACF;AAlMD,wCAkMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nostrbox/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "CLI tool for NIP-05 operations using NostrBox core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc",
|
|
19
19
|
"dev": "tsc --watch",
|
|
20
|
-
"clean": "rimraf dist"
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"lint": "prettier --check .",
|
|
22
|
+
"lint:fix": "prettier --write ."
|
|
21
23
|
},
|
|
22
24
|
"keywords": [
|
|
23
25
|
"nostr",
|
|
@@ -28,7 +30,8 @@
|
|
|
28
30
|
"author": "",
|
|
29
31
|
"license": "MIT",
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@nostrbox/core": "1.
|
|
33
|
+
"@nostrbox/core": "1.3.0",
|
|
34
|
+
"ora": "^8.2.0"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@saithodev/semantic-release-gitea": "^2.1.0",
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
"@semantic-release/git": "^10.0.1",
|
|
37
40
|
"@semantic-release/npm": "^10.0.6",
|
|
38
41
|
"@types/node": "^20.8.10",
|
|
42
|
+
"prettier": "^3.6.2",
|
|
39
43
|
"rimraf": "^5.0.5",
|
|
40
44
|
"semantic-release": "^24.2.7",
|
|
41
45
|
"typescript": "^5.2.2"
|