ngx-git 1.0.0 → 1.0.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/README.txt +35 -0
- package/cli.js +1 -1
- package/package.json +1 -1
- package/data/test.txt +0 -1
- package/readmi.txt +0 -189
package/README.txt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
install: npm i -g ngx-git
|
|
3
|
+
|
|
4
|
+
NGX v4.0.0 — GitHub proxy CLI
|
|
5
|
+
|
|
6
|
+
Auth:
|
|
7
|
+
ngx login GitHub OAuth (opens browser)
|
|
8
|
+
ngx logout Clear saved session
|
|
9
|
+
ngx whoami Show current user
|
|
10
|
+
|
|
11
|
+
Push / Clone:
|
|
12
|
+
ngx push Push current folder to GitHub
|
|
13
|
+
ngx push my-repo Push with specific repo name
|
|
14
|
+
ngx push my-repo --public Push as public repo
|
|
15
|
+
ngx push my-repo --path ./src Push a subfolder
|
|
16
|
+
ngx push my-repo --message "feat: x" Custom commit message
|
|
17
|
+
ngx clone owner/repo Clone repo (downloads all files)
|
|
18
|
+
ngx clone owner/repo ./local-dir Clone into specific directory
|
|
19
|
+
|
|
20
|
+
Repos:
|
|
21
|
+
ngx repos List your GitHub repos
|
|
22
|
+
ngx create <name> [--public] Create a new GitHub repo
|
|
23
|
+
ngx delete <name> Delete a GitHub repo
|
|
24
|
+
ngx visibility <repo> public|private Change repo visibility
|
|
25
|
+
|
|
26
|
+
Logs:
|
|
27
|
+
ngx logs Your NGX activity log
|
|
28
|
+
|
|
29
|
+
Config:
|
|
30
|
+
ngx config server <url> Point to a different NGX server
|
|
31
|
+
ngx -v Show version
|
|
32
|
+
|
|
33
|
+
Auto-ignored on push:
|
|
34
|
+
.env node_modules .git dist build *.key *.pem secrets
|
|
35
|
+
Add extras in .ngxignore or .gitignore
|
package/cli.js
CHANGED
|
@@ -545,7 +545,7 @@ const { flags, rest } = parseArgs(rawArgs || []);
|
|
|
545
545
|
|
|
546
546
|
case "whoami":
|
|
547
547
|
const u = getUsername();
|
|
548
|
-
if (u) console.log(`Logged in as: ${C.bold(u)}
|
|
548
|
+
if (u) console.log(`Logged in as: ${C.bold(u)} "nginxSoft"`);
|
|
549
549
|
else console.log("Not logged in");
|
|
550
550
|
break;
|
|
551
551
|
|
package/package.json
CHANGED
package/data/test.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
how are
|
package/readmi.txt
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
# NGX v2.0 — Minimal GitHub-like Code Vault
|
|
2
|
-
|
|
3
|
-
A self-hosted, lightweight code repository server with JWT auth, repo tokens, public/private repos, activity logging, and a React UI.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 🚀 Quick Start
|
|
8
|
-
|
|
9
|
-
### 1. Install dependencies
|
|
10
|
-
```bash
|
|
11
|
-
npm install
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### 2. Configure environment
|
|
15
|
-
```bash
|
|
16
|
-
cp .env.example .env
|
|
17
|
-
# Edit .env: set a strong JWT_SECRET
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### 3. Start the server
|
|
21
|
-
```bash
|
|
22
|
-
npm start
|
|
23
|
-
# Server runs at http://localhost:3000
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### 4. Open the UI
|
|
27
|
-
Open `ui.html` in your browser (or serve it via any static server).
|
|
28
|
-
|
|
29
|
-
### 5. Install CLI globally
|
|
30
|
-
```bash
|
|
31
|
-
npm link
|
|
32
|
-
# Now you can use `ngx` anywhere
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 📡 Server API
|
|
38
|
-
|
|
39
|
-
| Method | Route | Auth | Description |
|
|
40
|
-
|--------|-------|------|-------------|
|
|
41
|
-
| GET | `/status` | None | Server health check |
|
|
42
|
-
| POST | `/auth/register` | None | Create account |
|
|
43
|
-
| POST | `/auth/login` | None | Login, get JWT |
|
|
44
|
-
| GET | `/repos/:user` | Optional | List repos (private filtered) |
|
|
45
|
-
| GET | `/repos/:user/:repo` | Optional | Get repo info |
|
|
46
|
-
| POST | `/repos/:user/:repo` | JWT | Create repo |
|
|
47
|
-
| PATCH | `/repos/:user/:repo/visibility` | JWT | Toggle public/private |
|
|
48
|
-
| DELETE | `/repos/:user/:repo` | JWT | Delete repo |
|
|
49
|
-
| GET | `/repos/:user/:repo/token` | JWT | Get repo token |
|
|
50
|
-
| POST | `/repos/:user/:repo/token/regenerate` | JWT | Regenerate token |
|
|
51
|
-
| POST | `/push/:user/:repo` | JWT or Repo Token | Push zip |
|
|
52
|
-
| GET | `/clone/:user/:repo` | None (public) / JWT or Repo Token (private) | Download zip |
|
|
53
|
-
| GET | `/logs/:user` | JWT | Your activity log |
|
|
54
|
-
| GET | `/logs/:user/:repo` | JWT (private) / None (public) | Repo activity |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## 🖥 CLI Commands
|
|
59
|
-
|
|
60
|
-
### Auth
|
|
61
|
-
```bash
|
|
62
|
-
ngx register <username> <password> # Register
|
|
63
|
-
ngx login <username> <password> # Login (saves JWT to ~/.ngxconfig)
|
|
64
|
-
ngx logout # Clear session
|
|
65
|
-
ngx whoami # Show current user
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Repo Management
|
|
69
|
-
```bash
|
|
70
|
-
ngx init <reponame> [public|private] # Create a repo (default: private)
|
|
71
|
-
ngx repos # List your repos
|
|
72
|
-
ngx delete <reponame> # Delete (asks confirmation)
|
|
73
|
-
ngx visibility <reponame> public # Make public
|
|
74
|
-
ngx visibility <reponame> private # Make private
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Push / Clone
|
|
78
|
-
```bash
|
|
79
|
-
# Push (using JWT — must be logged in)
|
|
80
|
-
ngx push ./my-project
|
|
81
|
-
|
|
82
|
-
# Push (using repo token — no login needed)
|
|
83
|
-
ngx push ./my-project --token <repo-token>
|
|
84
|
-
|
|
85
|
-
# Clone public repo (no auth)
|
|
86
|
-
ngx clone alice/my-project
|
|
87
|
-
|
|
88
|
-
# Clone private repo (JWT must be logged in as owner)
|
|
89
|
-
ngx clone alice/my-project
|
|
90
|
-
|
|
91
|
-
# Clone private repo (using repo token)
|
|
92
|
-
ngx clone alice/my-project --token <repo-token>
|
|
93
|
-
|
|
94
|
-
# Clone into specific folder
|
|
95
|
-
ngx clone alice/my-project ./local-copy
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
> **Note:** `push` and `clone` use the folder/repo name automatically.
|
|
99
|
-
> `.ngxsafe`, `node_modules`, and `.git` are excluded from push.
|
|
100
|
-
|
|
101
|
-
### Tokens
|
|
102
|
-
```bash
|
|
103
|
-
ngx token show <reponame> # Show current repo token
|
|
104
|
-
ngx token regen <reponame> # Regenerate (old token immediately invalid)
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Logs
|
|
108
|
-
```bash
|
|
109
|
-
ngx logs # Your last 100 actions
|
|
110
|
-
ngx logs <reponame> # Activity for a specific repo
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Server Config
|
|
114
|
-
```bash
|
|
115
|
-
ngx config server http://my-server.com:3000 # Point CLI to custom server
|
|
116
|
-
ngx -v # Show version
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## 🔐 Auth System
|
|
122
|
-
|
|
123
|
-
### JWT (for UI and CLI login sessions)
|
|
124
|
-
- Expires in **7 days**
|
|
125
|
-
- Stored in `~/.ngxconfig` (CLI) or `sessionStorage` (UI)
|
|
126
|
-
- Required for: creating repos, deleting, changing visibility, viewing tokens
|
|
127
|
-
|
|
128
|
-
### Repo Token (for CI/CD, scripts, team sharing)
|
|
129
|
-
- A UUID generated when repo is created
|
|
130
|
-
- Does **not** expire unless regenerated
|
|
131
|
-
- Can be used with `--token` flag in CLI
|
|
132
|
-
- For **private repos**: needed by anyone who isn't the owner
|
|
133
|
-
- For **public repos**: not needed for clone; needed for push
|
|
134
|
-
|
|
135
|
-
### Public vs Private
|
|
136
|
-
| Operation | Public Repo | Private Repo |
|
|
137
|
-
|-----------|-------------|--------------|
|
|
138
|
-
| Clone | Anyone, no auth | Owner JWT or Repo Token |
|
|
139
|
-
| Push | Owner JWT or Repo Token | Owner JWT or Repo Token |
|
|
140
|
-
| View info | Anyone | Owner only |
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## 📁 File Structure
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
ngx-server/
|
|
148
|
-
├── server.js # Express API server
|
|
149
|
-
├── cli.js # CLI tool
|
|
150
|
-
├── ui.html # React UI (single file)
|
|
151
|
-
├── package.json
|
|
152
|
-
├── .env # Your config (JWT_SECRET, PORT)
|
|
153
|
-
├── .env.example
|
|
154
|
-
├── data.json # Users + repos DB (auto-created)
|
|
155
|
-
├── activity.log # Activity log (auto-created, NDJSON)
|
|
156
|
-
├── repos/ # Stored zips (auto-created)
|
|
157
|
-
│ └── <username>/
|
|
158
|
-
│ └── <reponame>/
|
|
159
|
-
│ └── latest.zip
|
|
160
|
-
└── tmp/ # Upload temp dir (auto-created)
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## 🛡 Security Notes
|
|
166
|
-
|
|
167
|
-
1. **Change `JWT_SECRET`** in `.env` before deploying — use a long random string.
|
|
168
|
-
2. The `data.json` contains hashed passwords (bcrypt, 10 rounds). Never expose it publicly.
|
|
169
|
-
3. For production, put HTTPS in front (nginx/caddy recommended).
|
|
170
|
-
4. Consider adding rate limiting (e.g., `express-rate-limit`) for public deployments.
|
|
171
|
-
5. Repo tokens are UUIDs — treat them like passwords.
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 🔧 Dependencies
|
|
176
|
-
|
|
177
|
-
| Package | Purpose |
|
|
178
|
-
|---------|---------|
|
|
179
|
-
| express | HTTP server |
|
|
180
|
-
| multer | File upload handling |
|
|
181
|
-
| jsonwebtoken | JWT sign/verify |
|
|
182
|
-
| bcryptjs | Password hashing |
|
|
183
|
-
| uuid | Repo token generation |
|
|
184
|
-
| cors | Cross-origin requests |
|
|
185
|
-
| adm-zip | Zip/unzip for push/clone |
|
|
186
|
-
| axios | HTTP client (CLI) |
|
|
187
|
-
| form-data | Multipart form (CLI) |
|
|
188
|
-
| cross-spawn | Process spawning |
|
|
189
|
-
| dotenv | Environment config |
|