@drmhse/authos-cli 0.1.0 → 0.1.1
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/README.md +125 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @drmhse/authos-cli
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@drmhse/authos-cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
CLI tool for scaffolding [AuthOS](https://authos.dev) authentication components in your project.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @drmhse/authos-cli -g
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or use without installing globally:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx @drmhse/authos-cli init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
### `authos init`
|
|
23
|
+
|
|
24
|
+
Initialize AuthOS in your project. This command detects your framework (React, Next.js, Vue, Nuxt) and sets up the appropriate configuration.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
authos init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The `init` command will:
|
|
31
|
+
1. Detect your framework from package.json dependencies
|
|
32
|
+
2. Install the appropriate AuthOS adapter package (`@drmhse/authos-react` or `@drmhse/authos-vue`)
|
|
33
|
+
3. Set up the AuthOS provider/plugin in your app
|
|
34
|
+
|
|
35
|
+
### `authos add`
|
|
36
|
+
|
|
37
|
+
Generate and add AuthOS components to your project.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
authos add <template>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Available templates:**
|
|
44
|
+
- `login-form` - Styled login form with email/password and MFA support
|
|
45
|
+
- `org-switcher` - Dropdown for switching between organizations
|
|
46
|
+
- `user-profile` - User avatar button with dropdown menu
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### React / Next.js Project
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Initialize AuthOS in a Next.js project
|
|
54
|
+
authos init
|
|
55
|
+
|
|
56
|
+
# Add a login form component
|
|
57
|
+
authos add login-form
|
|
58
|
+
|
|
59
|
+
# Add organization switcher
|
|
60
|
+
authos add org-switcher
|
|
61
|
+
|
|
62
|
+
# Add user profile component
|
|
63
|
+
authos add user-profile
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Vue / Nuxt Project
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Initialize AuthOS in a Nuxt project
|
|
70
|
+
authos init
|
|
71
|
+
|
|
72
|
+
# Add components
|
|
73
|
+
authos add login-form
|
|
74
|
+
authos add org-switcher
|
|
75
|
+
authos add user-profile
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Templates
|
|
79
|
+
|
|
80
|
+
### login-form
|
|
81
|
+
|
|
82
|
+
A styled login form component with:
|
|
83
|
+
- Email and password fields
|
|
84
|
+
- MFA (TOTP) support
|
|
85
|
+
- Loading states
|
|
86
|
+
- Error handling
|
|
87
|
+
|
|
88
|
+
### org-switcher
|
|
89
|
+
|
|
90
|
+
A dropdown component for switching between organizations when a user belongs to multiple organizations.
|
|
91
|
+
|
|
92
|
+
### user-profile
|
|
93
|
+
|
|
94
|
+
A user avatar button with:
|
|
95
|
+
- Avatar display (with fallback to initials)
|
|
96
|
+
- Dropdown menu showing user info
|
|
97
|
+
- Sign out functionality
|
|
98
|
+
|
|
99
|
+
## Programmatic Usage
|
|
100
|
+
|
|
101
|
+
You can also use the CLI programmatically:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { initCommand, addCommand, getAvailableTemplates } from '@drmhse/authos-cli';
|
|
105
|
+
|
|
106
|
+
// Get available templates
|
|
107
|
+
const templates = getAvailableTemplates();
|
|
108
|
+
console.log(templates); // ['login-form', 'org-switcher', 'user-profile']
|
|
109
|
+
|
|
110
|
+
// Initialize AuthOS
|
|
111
|
+
await initCommand({
|
|
112
|
+
projectDir: process.cwd(),
|
|
113
|
+
framework: 'next'
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Add a component
|
|
117
|
+
await addCommand({
|
|
118
|
+
projectDir: process.cwd(),
|
|
119
|
+
template: 'login-form'
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT © DRM HSE
|