@nibgat/ncli 0.0.0-stage → 2.0.0
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/LICENSE +21 -0
- package/README.md +156 -2
- package/dist/bin/ncli.d.ts +2 -0
- package/dist/bin/ncli.js +9 -0
- package/dist/bin/ncli.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +723 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/buyment.d.ts +2 -0
- package/dist/commands/buyment.js +174 -0
- package/dist/commands/buyment.js.map +1 -0
- package/dist/commands/cloud.d.ts +2 -0
- package/dist/commands/cloud.js +281 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/context.d.ts +25 -0
- package/dist/commands/context.js +92 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/front.d.ts +2 -0
- package/dist/commands/front.js +135 -0
- package/dist/commands/front.js.map +1 -0
- package/dist/commands/git.d.ts +2 -0
- package/dist/commands/git.js +726 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/health.d.ts +2 -0
- package/dist/commands/health.js +99 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/mail.d.ts +2 -0
- package/dist/commands/mail.js +265 -0
- package/dist/commands/mail.js.map +1 -0
- package/dist/commands/pipeline.d.ts +2 -0
- package/dist/commands/pipeline.js +333 -0
- package/dist/commands/pipeline.js.map +1 -0
- package/dist/commands/profile.d.ts +2 -0
- package/dist/commands/profile.js +229 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/runner.d.ts +2 -0
- package/dist/commands/runner.js +266 -0
- package/dist/commands/runner.js.map +1 -0
- package/dist/commands/support.d.ts +2 -0
- package/dist/commands/support.js +133 -0
- package/dist/commands/support.js.map +1 -0
- package/dist/constants/index.d.ts +26 -0
- package/dist/constants/index.js +40 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/http/client.d.ts +46 -0
- package/dist/http/client.js +262 -0
- package/dist/http/client.js.map +1 -0
- package/dist/http/coreApi.d.ts +136 -0
- package/dist/http/coreApi.js +485 -0
- package/dist/http/coreApi.js.map +1 -0
- package/dist/http/gitApi.d.ts +128 -0
- package/dist/http/gitApi.js +255 -0
- package/dist/http/gitApi.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline/detect.d.ts +13 -0
- package/dist/pipeline/detect.js +90 -0
- package/dist/pipeline/detect.js.map +1 -0
- package/dist/pipeline/release.d.ts +36 -0
- package/dist/pipeline/release.js +250 -0
- package/dist/pipeline/release.js.map +1 -0
- package/dist/pipeline/schema.d.ts +10 -0
- package/dist/pipeline/schema.js +155 -0
- package/dist/pipeline/schema.js.map +1 -0
- package/dist/runner/config.d.ts +21 -0
- package/dist/runner/config.js +235 -0
- package/dist/runner/config.js.map +1 -0
- package/dist/runner/server.d.ts +25 -0
- package/dist/runner/server.js +803 -0
- package/dist/runner/server.js.map +1 -0
- package/dist/runner/systemd.d.ts +14 -0
- package/dist/runner/systemd.js +82 -0
- package/dist/runner/systemd.js.map +1 -0
- package/dist/runner/tarExtract.d.ts +4 -0
- package/dist/runner/tarExtract.js +215 -0
- package/dist/runner/tarExtract.js.map +1 -0
- package/dist/security/execSafe.d.ts +20 -0
- package/dist/security/execSafe.js +216 -0
- package/dist/security/execSafe.js.map +1 -0
- package/dist/security/pkce.d.ts +9 -0
- package/dist/security/pkce.js +35 -0
- package/dist/security/pkce.js.map +1 -0
- package/dist/security/redact.d.ts +3 -0
- package/dist/security/redact.js +76 -0
- package/dist/security/redact.js.map +1 -0
- package/dist/security/sanitize.d.ts +18 -0
- package/dist/security/sanitize.js +216 -0
- package/dist/security/sanitize.js.map +1 -0
- package/dist/security/vault.d.ts +34 -0
- package/dist/security/vault.js +291 -0
- package/dist/security/vault.js.map +1 -0
- package/dist/types/index.d.ts +116 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/output.d.ts +25 -0
- package/dist/ui/output.js +100 -0
- package/dist/ui/output.js.map +1 -0
- package/dist/ui/prompt.d.ts +4 -0
- package/dist/ui/prompt.js +100 -0
- package/dist/ui/prompt.js.map +1 -0
- package/package.json +54 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NİBGAT®
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `ncli` — NİBGAT® Core-Complex Official CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official zero-trust command-line interface for the **NİBGAT® Core Complex** ecosystem (`core.nibgat.space`, `git.nibgat.space`, `nauth.nibgat.space`, `nchar.nibgat.space`, `mail.nibgat.space`, `support.nibgat.space`, `docs.nibgat.space`).
|
|
4
|
+
|
|
5
|
+
Full documentation: **[https://docs.nibgat.space/cli](https://docs.nibgat.space/cli)**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Key Capabilities
|
|
10
|
+
|
|
11
|
+
- **Zero-Trust Encrypted Credential Vault (`~/.ncli/credentials.enc`)**
|
|
12
|
+
- Authenticated **AES-256-GCM** encryption with random 12-byte IV, 16-byte auth tag, 32-byte salt, and **scrypt** key derivation bound to local machine/user entropy (plus optional `NCLI_VAULT_PASSPHRASE`).
|
|
13
|
+
- Atomic `0600` file writes (`0700` directory); plaintext tokens and session cookies are never written to disk.
|
|
14
|
+
- Multi-profile isolation (`--profile <name>`) and headless CI environment overrides (`NCLI_TOKEN`, `NGIT_TOKEN`, `NCLI_SESSION_COOKIE`, `NCLI_CORE_URL`, `NCLI_GIT_URL`).
|
|
15
|
+
- **N - Auth SSO (+ 2FA), OAuth2 + PKCE (S256), and N - Git PAT Authentication**
|
|
16
|
+
- Interactive N - Auth SSO login with masked password prompt and full 2FA challenge support (TOTP, SMS, Email).
|
|
17
|
+
- Browser OAuth2 + PKCE (`S256`) loopback flow (`127.0.0.1`).
|
|
18
|
+
- Direct PAT login (`--token` / `--token-stdin`) for automated pipelines.
|
|
19
|
+
- **Full Core Complex Management**
|
|
20
|
+
- **Health**: `ncli health` / `ncli status`
|
|
21
|
+
- **N - Char Profile**: `ncli profile show|update|history|mails|phones|public`
|
|
22
|
+
- **N - Git & OCI Registry**: `ncli git overview|quota|orgs|repos|branches|issues|releases|webhooks|runners|deployments|registry|ssh-keys|audits`
|
|
23
|
+
- **N - Notifier Mail**: `ncli mail health|orgs|domains|mailboxes|aliases|notifications|inbox`
|
|
24
|
+
- **Support Desk**: `ncli support tickets list|show|create|reply|quota`
|
|
25
|
+
- **Public Catalog**: `ncli front products|services|news|announcements`
|
|
26
|
+
- **Release-to-Deploy CI/CD Pipelines & Hardened Self-Hosted Runner**
|
|
27
|
+
- `ncli pipeline init|validate|release|status|trigger|logs`
|
|
28
|
+
- `ncli runner init|start|install|doctor` — zero-shell execution (`execFile`/`spawn` only), constant-time HMAC-SHA256 verification, timestamp + `X-NGit-Delivery` replay protection, strict repo allowlisting, Tar-Slip & path confinement, atomic static deploys, and hardened Linux `systemd` + Nginx TLS config generation.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Requires **Node.js >= 22.0.0**.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g @nibgat/ncli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Verify installation:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ncli --version
|
|
44
|
+
ncli health
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### 1. Authenticate
|
|
52
|
+
|
|
53
|
+
Interactive N - Auth SSO (with 2FA & optional CLI PAT minting):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ncli auth login
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
OAuth2 + PKCE (S256) browser flow:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ncli auth login --browser --client-id <your-client-id>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
CI / Headless PAT login via stdin:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
printf '%s' "$NGIT_TOKEN" | ncli auth login --token-stdin
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Inspect session & identity:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
ncli auth status
|
|
75
|
+
ncli auth whoami
|
|
76
|
+
ncli auth sessions list
|
|
77
|
+
ncli auth 2fa status
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2. Initialize & Validate a CI/CD Pipeline
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
ncli pipeline init --managed
|
|
84
|
+
ncli pipeline validate
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Publish a release and stream live deployment stages/logs:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
ncli pipeline release v1.2.0 --title "v1.2.0" --body "Production release"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 3. Deploy Anywhere with the Self-Hosted Runner
|
|
94
|
+
|
|
95
|
+
Initialize runner on your server (registers with `git.nibgat.space` and writes a `0600` config):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ncli runner init \
|
|
99
|
+
--repo owner/my-app \
|
|
100
|
+
--url https://deploy.example.com/webhook \
|
|
101
|
+
--type static \
|
|
102
|
+
--target-dir /var/www/my-app
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Audit security posture & generate hardened `systemd` + Nginx TLS configs:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
ncli runner doctor
|
|
109
|
+
ncli runner install --user ncli-runner --nginx-domain deploy.example.com
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Start the runner directly:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
ncli runner start
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Global Flags
|
|
121
|
+
|
|
122
|
+
| Flag | Description |
|
|
123
|
+
| :--- | :--- |
|
|
124
|
+
| `--json` | Emit machine-readable JSON (ideal for scripts & MCP integrations) |
|
|
125
|
+
| `--profile <name>` | Select credential vault profile (default: `default`) |
|
|
126
|
+
| `--core-url <url>` | Override Core API URL (default: `https://core.nibgat.space`) |
|
|
127
|
+
| `--git-url <url>` | Override N - Git API URL (default: `https://git.nibgat.space`) |
|
|
128
|
+
| `--quiet` | Suppress non-essential output |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Environment Variables
|
|
133
|
+
|
|
134
|
+
| Variable | Purpose |
|
|
135
|
+
| :--- | :--- |
|
|
136
|
+
| `NCLI_CONFIG_DIR` | Override `~/.ncli` directory for vault and runner config |
|
|
137
|
+
| `NCLI_VAULT_PASSPHRASE` | Optional extra passphrase mixed into vault key derivation |
|
|
138
|
+
| `NCLI_TOKEN` / `NGIT_TOKEN` | Headless Bearer token / PAT override for CI/CD |
|
|
139
|
+
| `NCLI_SESSION_COOKIE` | Headless N - Auth SSO cookie override |
|
|
140
|
+
| `NCLI_CORE_URL` | Default Core API URL override |
|
|
141
|
+
| `NCLI_GIT_URL` | Default N - Git API URL override |
|
|
142
|
+
| `NCLI_OAUTH_CLIENT_ID` | Default OAuth2 client ID for `--browser` login |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Development & Testing
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npm install
|
|
150
|
+
npm run type-check
|
|
151
|
+
npm run build
|
|
152
|
+
npm test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT © 2026 NİBGAT®
|
package/dist/bin/ncli.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createProgram } from "../index.js";
|
|
3
|
+
const program = createProgram();
|
|
4
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
5
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6
|
+
process.stderr.write(`Error: ${message}\n`);
|
|
7
|
+
process.exitCode = 1;
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=ncli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ncli.js","sourceRoot":"","sources":["../../src/bin/ncli.ts"],"names":[],"mappings":";AACA,OAAO,EACH,aAAa,EAChB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACpD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,OAAO,IAAI,CAAC,CAAC;IAC5C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
|