ardent-cli-beta 0.0.2 → 0.0.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/dist/commands/login.d.ts +2 -1
- package/dist/commands/login.js +5 -2
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +2 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +2 -1
- package/dist/help.d.ts +6 -0
- package/dist/help.js +52 -0
- package/oclif.manifest.json +7 -5
- package/package.json +4 -5
package/dist/commands/login.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { type Organization } from '../auth/token.js';
|
|
|
2
2
|
import { ArdentCommand } from '../command.js';
|
|
3
3
|
export default class Login extends ArdentCommand {
|
|
4
4
|
static description: string;
|
|
5
|
+
static helpGroup: string;
|
|
5
6
|
static flags: {
|
|
6
|
-
token: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
};
|
|
8
9
|
run(): Promise<{
|
|
9
10
|
authenticated: true;
|
package/dist/commands/login.js
CHANGED
|
@@ -2,12 +2,15 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { loginWithToken } from '../auth/token.js';
|
|
3
3
|
import { ArdentCommand } from '../command.js';
|
|
4
4
|
export default class Login extends ArdentCommand {
|
|
5
|
-
static description = 'Log in
|
|
5
|
+
static description = 'Log in to Ardent';
|
|
6
|
+
static helpGroup = 'Authentication';
|
|
6
7
|
static flags = {
|
|
7
|
-
token: Flags.string({ description: 'Existing Ardent API token', env: 'ARDENT_TOKEN'
|
|
8
|
+
token: Flags.string({ description: 'Existing Ardent API token', env: 'ARDENT_TOKEN' }),
|
|
8
9
|
};
|
|
9
10
|
async run() {
|
|
10
11
|
const { flags } = await this.parse(Login);
|
|
12
|
+
if (!flags.token)
|
|
13
|
+
this.error('Interactive login is not implemented yet.');
|
|
11
14
|
const organizations = await loginWithToken(this.config.configDir, flags.token);
|
|
12
15
|
if (!this.jsonEnabled()) {
|
|
13
16
|
this.log('✓ Logged in to Ardent');
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { clearSession } from '../auth/credentials.js';
|
|
2
2
|
import { ArdentCommand } from '../command.js';
|
|
3
3
|
export default class Logout extends ArdentCommand {
|
|
4
|
-
static description = '
|
|
4
|
+
static description = 'Log out of Ardent on this device';
|
|
5
|
+
static helpGroup = 'Authentication';
|
|
5
6
|
async run() {
|
|
6
7
|
await clearSession(this.config.configDir);
|
|
7
8
|
if (!this.jsonEnabled())
|
package/dist/commands/status.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { loadSession } from '../auth/credentials.js';
|
|
2
2
|
import { ArdentCommand } from '../command.js';
|
|
3
3
|
export default class Status extends ArdentCommand {
|
|
4
|
-
static description = 'Show
|
|
4
|
+
static description = 'Show your Ardent login status';
|
|
5
|
+
static helpGroup = 'Authentication';
|
|
5
6
|
async run() {
|
|
6
7
|
const session = await loadSession(this.config.configDir);
|
|
7
8
|
const result = { authenticated: session !== undefined };
|
package/dist/help.d.ts
ADDED
package/dist/help.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ux } from '@oclif/core';
|
|
2
|
+
import { getHelpFlagAdditions, Help } from '@oclif/core/help';
|
|
3
|
+
import { loadSession } from './auth/credentials.js';
|
|
4
|
+
export default class ArdentHelp extends Help {
|
|
5
|
+
async showHelp(arguments_) {
|
|
6
|
+
const rootHelp = arguments_.every((argument) => getHelpFlagAdditions(this.config).includes(argument));
|
|
7
|
+
if (!rootHelp)
|
|
8
|
+
return super.showHelp(arguments_);
|
|
9
|
+
const authenticated = await this.authenticated();
|
|
10
|
+
if (arguments_.length > 0 || authenticated) {
|
|
11
|
+
this.showArdentHelp(authenticated);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
this.log('Get started:');
|
|
15
|
+
this.log('');
|
|
16
|
+
this.log(ux.colorize('green', ' ardent login Standard CLI login'));
|
|
17
|
+
this.log(' ardent login --token <token> Non-interactive login (CI and automation)');
|
|
18
|
+
this.log('');
|
|
19
|
+
this.log('For all commands:');
|
|
20
|
+
this.log('');
|
|
21
|
+
this.log(' ardent --help');
|
|
22
|
+
}
|
|
23
|
+
async authenticated() {
|
|
24
|
+
try {
|
|
25
|
+
return (await loadSession(this.config.configDir)) !== undefined;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
showArdentHelp(authenticated) {
|
|
32
|
+
this.log(`Ardent CLI ${ux.colorize('dim', `v${this.config.version}`)}`);
|
|
33
|
+
this.log('');
|
|
34
|
+
this.log(this.section('USAGE', '$ ardent <command>'));
|
|
35
|
+
const groups = new Map();
|
|
36
|
+
for (const command of this.sortedCommands) {
|
|
37
|
+
if (command.hidden || command.pluginName !== this.config.name || typeof command.helpGroup !== 'string')
|
|
38
|
+
continue;
|
|
39
|
+
const commands = groups.get(command.helpGroup) ?? [];
|
|
40
|
+
commands.push(command);
|
|
41
|
+
groups.set(command.helpGroup, commands);
|
|
42
|
+
}
|
|
43
|
+
for (const [group, commands] of groups) {
|
|
44
|
+
const rows = commands.map((command) => {
|
|
45
|
+
const name = `ardent ${command.id.replaceAll(':', ' ')}`;
|
|
46
|
+
return [!authenticated && command.id === 'login' ? ux.colorize('green', name) : name, this.summary(command)];
|
|
47
|
+
});
|
|
48
|
+
this.log('');
|
|
49
|
+
this.log(this.section(group.toUpperCase(), rows));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"login": {
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {},
|
|
6
|
-
"description": "Log in
|
|
6
|
+
"description": "Log in to Ardent",
|
|
7
7
|
"flags": {
|
|
8
8
|
"json": {
|
|
9
9
|
"description": "Format output as json.",
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"description": "Existing Ardent API token",
|
|
17
17
|
"env": "ARDENT_TOKEN",
|
|
18
18
|
"name": "token",
|
|
19
|
-
"required": true,
|
|
20
19
|
"hasDynamicHelp": false,
|
|
21
20
|
"multiple": false,
|
|
22
21
|
"type": "option"
|
|
@@ -30,6 +29,7 @@
|
|
|
30
29
|
"pluginType": "core",
|
|
31
30
|
"strict": true,
|
|
32
31
|
"enableJsonFlag": true,
|
|
32
|
+
"helpGroup": "Authentication",
|
|
33
33
|
"isESM": true,
|
|
34
34
|
"relativePath": [
|
|
35
35
|
"dist",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"logout": {
|
|
41
41
|
"aliases": [],
|
|
42
42
|
"args": {},
|
|
43
|
-
"description": "
|
|
43
|
+
"description": "Log out of Ardent on this device",
|
|
44
44
|
"flags": {
|
|
45
45
|
"json": {
|
|
46
46
|
"description": "Format output as json.",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"pluginType": "core",
|
|
59
59
|
"strict": true,
|
|
60
60
|
"enableJsonFlag": true,
|
|
61
|
+
"helpGroup": "Authentication",
|
|
61
62
|
"isESM": true,
|
|
62
63
|
"relativePath": [
|
|
63
64
|
"dist",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"status": {
|
|
69
70
|
"aliases": [],
|
|
70
71
|
"args": {},
|
|
71
|
-
"description": "Show
|
|
72
|
+
"description": "Show your Ardent login status",
|
|
72
73
|
"flags": {
|
|
73
74
|
"json": {
|
|
74
75
|
"description": "Format output as json.",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"pluginType": "core",
|
|
87
88
|
"strict": true,
|
|
88
89
|
"enableJsonFlag": true,
|
|
90
|
+
"helpGroup": "Authentication",
|
|
89
91
|
"isESM": true,
|
|
90
92
|
"relativePath": [
|
|
91
93
|
"dist",
|
|
@@ -94,5 +96,5 @@
|
|
|
94
96
|
]
|
|
95
97
|
}
|
|
96
98
|
},
|
|
97
|
-
"version": "0.0.
|
|
99
|
+
"version": "0.0.4"
|
|
98
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ardent-cli-beta",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "The Ardent command-line interface",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"bin": "ardent",
|
|
26
26
|
"dirname": "ardent",
|
|
27
27
|
"commands": "./dist/commands",
|
|
28
|
+
"helpClass": "./dist/help",
|
|
28
29
|
"plugins": [
|
|
29
|
-
"@oclif/plugin-autocomplete"
|
|
30
|
-
"@oclif/plugin-help"
|
|
30
|
+
"@oclif/plugin-autocomplete"
|
|
31
31
|
],
|
|
32
32
|
"topicSeparator": " "
|
|
33
33
|
},
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@oclif/core": "^5.0.0",
|
|
44
|
-
"@oclif/plugin-autocomplete": "^4.0.0"
|
|
45
|
-
"@oclif/plugin-help": "^7.0.0"
|
|
44
|
+
"@oclif/plugin-autocomplete": "^4.0.0"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"@types/node": "^22.0.0",
|