@cefense-npm/cefense-cli 0.1.0 → 1.1.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.md → LICENSE} +1 -1
- package/README.md +427 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +41 -5
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +12 -0
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/fixcmds.d.ts +7 -0
- package/dist/commands/fixcmds.d.ts.map +1 -0
- package/dist/commands/fixcmds.js +183 -0
- package/dist/commands/fixcmds.js.map +1 -0
- package/dist/commands/observed.d.ts +3 -0
- package/dist/commands/observed.d.ts.map +1 -1
- package/dist/commands/observed.js +93 -3
- package/dist/commands/observed.js.map +1 -1
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +34 -1
- package/dist/commands/repo.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +7 -0
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/skill.d.ts +24 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +424 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +12 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +4 -1
- package/dist/core/client.js.map +1 -1
- package/dist/core/compact.d.ts +13 -0
- package/dist/core/compact.d.ts.map +1 -0
- package/dist/core/compact.js +111 -0
- package/dist/core/compact.js.map +1 -0
- package/dist/core/errors.d.ts +3 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +8 -5
- package/dist/core/errors.js.map +1 -1
- package/dist/core/session.d.ts +1 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js.map +1 -1
- package/dist/index.js +78 -8
- package/dist/index.js.map +1 -1
- package/dist/ui/mode.d.ts +3 -0
- package/dist/ui/mode.d.ts.map +1 -0
- package/dist/ui/mode.js +8 -0
- package/dist/ui/mode.js.map +1 -0
- package/dist/ui/output.d.ts +3 -0
- package/dist/ui/output.d.ts.map +1 -1
- package/dist/ui/output.js +40 -1
- package/dist/ui/output.js.map +1 -1
- package/dist/ui/screen.d.ts.map +1 -1
- package/dist/ui/screen.js +3 -0
- package/dist/ui/screen.js.map +1 -1
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +4 -0
- package/dist/ui/spinner.js.map +1 -1
- package/package.json +2 -1
- package/skills/cefense/POINTER.md +18 -0
- package/skills/cefense/SKILL.md +138 -0
package/{LICENSE.md → LICENSE}
RENAMED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Cefense CLI
|
|
4
|
+
|
|
5
|
+
**Find, understand, and fix security vulnerabilities in your code. From your terminal, or from your agent.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@cefense-npm/cefense-cli)
|
|
8
|
+
[](https://nodejs.org)
|
|
9
|
+
[](https://www.typescriptlang.org)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
[Install](#install) · [Quickstart](#quickstart) · [Commands](#commands) · [Agent mode](#agent-mode) · [Coding agents](#teaching-your-coding-agent) · [CI](#continuous-integration) · [Security](#where-your-credentials-live)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<!--
|
|
19
|
+
DEMO VIDEO
|
|
20
|
+
Record the terminal, drag the file into a GitHub issue or PR comment, and GitHub
|
|
21
|
+
returns a https://github.com/user-attachments/assets/<id> URL.
|
|
22
|
+
Replace the block below with that URL on its own line.
|
|
23
|
+
-->
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
|
|
27
|
+
https://github.com/user-attachments/assets/REPLACE_WITH_UPLOADED_VIDEO
|
|
28
|
+
|
|
29
|
+
_`cf observed`, a generated patch, and a pull request, in under a minute._
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## What this is
|
|
36
|
+
|
|
37
|
+
Cefense scans your repositories for vulnerabilities, joins each finding to the security research that explains it, and generates patches you can ship as pull requests.
|
|
38
|
+
|
|
39
|
+
This CLI is a complete alternative to the web workspace. Everything the GUI does against a real API route, this does too: connect repositories, run scans, browse findings, read the research behind them, generate a patch, review the diff, and open the pull request.
|
|
40
|
+
|
|
41
|
+
It talks only to the Cefense public API. It never reaches into a database, and it ships with no client secret and no baked-in endpoints.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install -g @cefense-npm/cefense-cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Requires **Node 22.12 or newer**. Both `cefense` and `cf` are installed and are the same binary. Every example below uses the short one.
|
|
50
|
+
|
|
51
|
+
<details>
|
|
52
|
+
<summary>Other package managers</summary>
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pnpm add -g @cefense-npm/cefense-cli
|
|
56
|
+
yarn global add @cefense-npm/cefense-cli
|
|
57
|
+
bun add -g @cefense-npm/cefense-cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or run it without installing. The package name differs from both binaries, so `-p` is required:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npx -p @cefense-npm/cefense-cli cf status
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
</details>
|
|
67
|
+
|
|
68
|
+
## Quickstart
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
cf auth login # sign in through your browser
|
|
72
|
+
cf repo connect # pick a repository and watch its first scan
|
|
73
|
+
cf observed # browse what the scan found
|
|
74
|
+
cf skill install # teach your coding agent to do all of the above
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
From the findings view, press `g` to generate a patch and `p` to open a pull request. You never leave the finding you are reading.
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
### Authentication
|
|
82
|
+
|
|
83
|
+
| Command | What it does |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `cf auth login` | sign in through your browser using OAuth2 with PKCE |
|
|
86
|
+
| `cf auth logout` | revoke the token at the identity provider and forget it |
|
|
87
|
+
| `cf auth status` | who you are, where the token lives, what you are entitled to |
|
|
88
|
+
|
|
89
|
+
`cf auth logout --all` signs out of every stored instance. `cf auth login --force` signs in again over an existing session.
|
|
90
|
+
|
|
91
|
+
### Repositories
|
|
92
|
+
|
|
93
|
+
| Command | What it does |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `cf repo connect [owner/name]` | connect a GitHub repository and follow its first scan |
|
|
96
|
+
| `cf repo list` | connected repositories, their scan state and finding counts |
|
|
97
|
+
| `cf repo set-default [owner/name]` | choose the repository this directory acts on |
|
|
98
|
+
| `cf repo disconnect [owner/name]` | disconnect one repository |
|
|
99
|
+
| `cf repo disconnect --account` | disconnect the GitHub account entirely |
|
|
100
|
+
|
|
101
|
+
`cf repo set-default --unset` clears the link for the current directory. `cf repo connect --no-watch` queues the scan without following it.
|
|
102
|
+
|
|
103
|
+
### Findings and fixes
|
|
104
|
+
|
|
105
|
+
| Command | What it does |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `cf status` | the dashboard: repositories, live scan progress, finding counts |
|
|
108
|
+
| `cf scan` | rescan a repository and watch it run |
|
|
109
|
+
| `cf observed` | browse every finding in your code |
|
|
110
|
+
| `cf observed show <finding-id>` | one finding in full, with research, data flow and references |
|
|
111
|
+
| `cf matched` | only the findings joined to the research that explains them |
|
|
112
|
+
| `cf fix` | browse findings and their patches side by side |
|
|
113
|
+
| `cf fix show <finding-id>` | the patch generated for one finding |
|
|
114
|
+
| `cf fix generate <finding-id>` | generate a patch, `--wait` to block until it is ready |
|
|
115
|
+
| `cf fix publish <finding-id>` | open a pull request with a generated patch |
|
|
116
|
+
|
|
117
|
+
Findings and fixes are the same data from two angles. `cf observed` carries the same `g` and `p` keys as `cf fix`, so you can patch a vulnerability without switching views.
|
|
118
|
+
|
|
119
|
+
### Coding agents
|
|
120
|
+
|
|
121
|
+
| Command | What it does |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `cf skill install [agents...]` | write the Cefense skill into every coding agent detected here |
|
|
124
|
+
| `cf skill list` | every supported agent, where it writes, what is installed |
|
|
125
|
+
| `cf skill show [agent]` | print the skill without writing it anywhere |
|
|
126
|
+
| `cf skill uninstall [agents...]` | remove it again, including the section it added |
|
|
127
|
+
|
|
128
|
+
`cf skill` on its own installs. See [Teaching your coding agent](#teaching-your-coding-agent).
|
|
129
|
+
|
|
130
|
+
## Interactive by default
|
|
131
|
+
|
|
132
|
+
Every browsing command opens a full-screen view.
|
|
133
|
+
|
|
134
|
+
| Key | Action |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `up` `down`, or `k` `j` | move through the list |
|
|
137
|
+
| `enter` | open the detail pane |
|
|
138
|
+
| `left` `right` | previous and next item, from inside the detail pane |
|
|
139
|
+
| `/` | filter as you type |
|
|
140
|
+
| `pageup` `pagedown` `home` `end` | jump |
|
|
141
|
+
| `q` or `escape` | close the pane, then leave |
|
|
142
|
+
|
|
143
|
+
Single keys act on whatever is selected. Labels are context aware, so a finding whose pull request is already open offers `view pull request` rather than `open pull request`.
|
|
144
|
+
|
|
145
|
+
| Key | Where | Action |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `g` | `observed`, `matched`, `fix` | generate a patch, or regenerate, or retry |
|
|
148
|
+
| `p` | `observed`, `matched`, `fix` | open the pull request, or view it |
|
|
149
|
+
| `o` | `observed`, `matched` | open the file on GitHub |
|
|
150
|
+
| `a` | `observed`, `matched` | read the research behind the finding |
|
|
151
|
+
| `u` | `fix` | refresh |
|
|
152
|
+
| `f` `r` `o` `d` `c` | `status` | findings, rescan, open, set default, connect |
|
|
153
|
+
|
|
154
|
+
Publishing always requires typing the repository name to confirm. There is no accidental pull request.
|
|
155
|
+
|
|
156
|
+
## Agent mode
|
|
157
|
+
|
|
158
|
+
`--agent` turns the CLI into a machine interface. It is the supported way for a coding agent (Claude Code, Cursor, Codex, or your own) to drive Cefense.
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
cf observed --repo acme/api --agent
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
It implies `--json --no-color --no-link`, forces non-interactive so the full-screen view can never open, silences all progress output, and prints exactly **one line of JSON on stdout**. It does **not** imply `--yes`.
|
|
165
|
+
|
|
166
|
+
### Response envelope
|
|
167
|
+
|
|
168
|
+
Success:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"schemaVersion": 1,
|
|
173
|
+
"ok": true,
|
|
174
|
+
"command": "observed",
|
|
175
|
+
"data": { "repository": "acme/api", "total": 32, "counts": { "critical": 5, "high": 14 }, "findings": [] },
|
|
176
|
+
"next": ["cf observed show <id> --repo acme/api --agent", "cf fix generate <id> --wait --agent"]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Failure, on stdout as well, so an agent never has to parse prose from stderr:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"schemaVersion": 1,
|
|
185
|
+
"ok": false,
|
|
186
|
+
"command": "fix publish",
|
|
187
|
+
"error": {
|
|
188
|
+
"code": "confirmation_required",
|
|
189
|
+
"message": "Publishing opens a real pull request on GitHub.",
|
|
190
|
+
"remedy": "Pass --yes to confirm: cf fix publish <id> --yes",
|
|
191
|
+
"exitCode": 2
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The `next` array names real commands that act on what was just returned, so an agent is handed its next step instead of guessing at one.
|
|
197
|
+
|
|
198
|
+
### A complete agent workflow
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
cf auth status --agent # 3 if not signed in
|
|
202
|
+
cf observed --repo acme/api --agent # ids, severities, counts
|
|
203
|
+
cf observed show <finding-id> --agent # one finding, in full
|
|
204
|
+
cf fix generate <finding-id> --wait --agent # blocks until ready or failed
|
|
205
|
+
cf fix publish <finding-id> --yes --agent # opens the pull request
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Error codes
|
|
209
|
+
|
|
210
|
+
Stable across releases. Match on `error.code`, never on `error.message`.
|
|
211
|
+
|
|
212
|
+
| Code | Exit | Meaning |
|
|
213
|
+
| --- | --- | --- |
|
|
214
|
+
| `auth_required` | 3 | not signed in |
|
|
215
|
+
| `usage_error` | 2 | a flag or argument is missing or wrong |
|
|
216
|
+
| `invalid_severity` | 2 | unrecognised value passed to `--severity` |
|
|
217
|
+
| `invalid_category` | 2 | unrecognised value passed to `--category` |
|
|
218
|
+
| `finding_not_found` | 2 | no such finding in the latest scan |
|
|
219
|
+
| `fix_not_found` | 2 | no patch has been generated yet |
|
|
220
|
+
| `fix_not_ready` | 2 | the patch is not in a publishable state |
|
|
221
|
+
| `fix_in_progress` | 2 | a patch is already generating |
|
|
222
|
+
| `confirmation_required` | 2 | a destructive action needs `--yes` |
|
|
223
|
+
| `feature_required` | 4 | the account lacks the required feature pack |
|
|
224
|
+
| `api_error` | 4 | the Cefense API returned an error |
|
|
225
|
+
| `cancelled` | 130 | interrupted |
|
|
226
|
+
| `unknown_target` | 2 | `cf skill install` was given an agent it does not know |
|
|
227
|
+
| `global_unsupported` | 2 | `--global` used with an agent that has no user-wide location |
|
|
228
|
+
| `skill_missing` | 4 | the bundled skill is absent, reinstall the package |
|
|
229
|
+
| `internal_error` | 4 | unexpected failure |
|
|
230
|
+
|
|
231
|
+
### Notes for agents
|
|
232
|
+
|
|
233
|
+
- **Signing in blocks.** `cf auth login` opens a browser and waits for the loopback callback, which is inherent to OAuth2 with PKCE. Run it in the background, read the sign-in URL from **stderr**, surface it to the user, then poll `cf auth status --agent`.
|
|
234
|
+
- **Publishing is gated.** `cf fix publish` refuses with `confirmation_required` unless `--yes` is passed. Treat that as a decision for the user, not a flag to add automatically.
|
|
235
|
+
- **Pass `--repo owner/name`** to skip the directory-linking prompt entirely.
|
|
236
|
+
- **Payloads are compact.** Null and internal fields are stripped, and heavy fields are summarised. The same 32 findings are 45 KB under `--json` and 18 KB under `--agent`.
|
|
237
|
+
|
|
238
|
+
## Teaching your coding agent
|
|
239
|
+
|
|
240
|
+
Cefense ships the instructions an agent needs to drive it, and `cf skill install` writes them where each tool actually looks.
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
cf skill install
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
With no arguments it detects the agents configured in the repository and writes to all of them. If it detects none, it writes `AGENTS.md`.
|
|
247
|
+
|
|
248
|
+
| Agent | Where it writes |
|
|
249
|
+
| --- | --- |
|
|
250
|
+
| Claude Code | `.claude/skills/cefense/SKILL.md` |
|
|
251
|
+
| Cursor | `.cursor/rules/cefense.mdc` |
|
|
252
|
+
| GitHub Copilot | `.github/instructions/cefense.instructions.md` |
|
|
253
|
+
| Google Antigravity | `.agents/rules/cefense.md` |
|
|
254
|
+
| Windsurf | `.windsurf/rules/cefense.md` |
|
|
255
|
+
| Devin Desktop | `.devin/rules/cefense.md` |
|
|
256
|
+
| Cline, Roo Code | `.clinerules/cefense.md` |
|
|
257
|
+
| Gemini CLI | `GEMINI.md` |
|
|
258
|
+
| Codex, Amp, OpenCode, Jules | `AGENTS.md` |
|
|
259
|
+
|
|
260
|
+
Each file is written in the format that tool expects: Agent Skills frontmatter for Claude Code, MDC with `alwaysApply: false` for Cursor, `applyTo` for Copilot, a `model_decision` trigger for Windsurf and Devin.
|
|
261
|
+
|
|
262
|
+
`AGENTS.md` and `GEMINI.md` are shared files, so they get a short delimited section rather than the whole document, and the full guide lands at `.cefense/SKILL.md` alongside it. Reinstalling replaces that section in place, and `cf skill uninstall` removes it and leaves the rest of the file untouched.
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
cf skill list # what is supported, what is detected, what is installed
|
|
266
|
+
cf skill install claude cursor # name them instead of detecting
|
|
267
|
+
cf skill install --all # every supported agent
|
|
268
|
+
cf skill install --global # for your user: claude, gemini, agents
|
|
269
|
+
cf skill show cursor # print it, write nothing
|
|
270
|
+
cf skill uninstall # remove all of it
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The files it writes are part of the repository and belong in a commit. They are managed, so hand edits are replaced on the next install.
|
|
274
|
+
|
|
275
|
+
For onboarding an agent that has never seen Cefense at all, point it at <https://cefense.com/skill.md>. That document installs the CLI, signs the user in, connects the repository, and finishes by running `cf skill install`.
|
|
276
|
+
|
|
277
|
+
## Scripting
|
|
278
|
+
|
|
279
|
+
Three output modes, in order of precedence:
|
|
280
|
+
|
|
281
|
+
```sh
|
|
282
|
+
cf observed --agent # one line of JSON, envelope, stable contract
|
|
283
|
+
cf observed --json # pretty-printed raw API response
|
|
284
|
+
cf observed | grep critical # tab-separated lines when piped
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
`--json` gives you the unmodified API payload for exploration:
|
|
288
|
+
|
|
289
|
+
```sh
|
|
290
|
+
cf observed --json | jq '.findings[] | select(.severity == "critical") | .filePath'
|
|
291
|
+
cf repo list --json | jq -r '.[].fullName'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Anything that would prompt fails with exit code 2 and names the flag that would have answered it, so nothing hangs.
|
|
295
|
+
|
|
296
|
+
## Continuous integration
|
|
297
|
+
|
|
298
|
+
Set `CEFENSE_TOKEN` instead of signing in. It is read from the environment and never written to disk.
|
|
299
|
+
|
|
300
|
+
```yaml
|
|
301
|
+
- name: Cefense security scan
|
|
302
|
+
env:
|
|
303
|
+
CEFENSE_TOKEN: ${{ secrets.CEFENSE_TOKEN }}
|
|
304
|
+
run: |
|
|
305
|
+
npm install -g @cefense-npm/cefense-cli
|
|
306
|
+
cf scan --repo ${{ github.repository }}
|
|
307
|
+
cf observed --repo ${{ github.repository }} --severity critical,high --exit-code
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
`--exit-code` returns 1 when a critical or high finding is present, which fails the job.
|
|
311
|
+
|
|
312
|
+
## Severity vocabulary
|
|
313
|
+
|
|
314
|
+
Cefense displays four severities. The wire values differ, and filters accept both.
|
|
315
|
+
|
|
316
|
+
| Displayed | Wire value | `--severity` accepts |
|
|
317
|
+
| --- | --- | --- |
|
|
318
|
+
| Critical | `critical` | `critical` |
|
|
319
|
+
| High | `high` | `high` |
|
|
320
|
+
| Watch | `medium` | `watch`, `medium` |
|
|
321
|
+
| Info | `low` | `info`, `low` |
|
|
322
|
+
|
|
323
|
+
Under `--agent`, every finding carries both `severity` (the wire value, so filters round-trip) and `severityLabel` (what a human should be told).
|
|
324
|
+
|
|
325
|
+
## Linking a directory to a repository
|
|
326
|
+
|
|
327
|
+
`observed`, `matched`, `fix` and `scan` act on one repository. The first time you run any of them in a directory, the CLI asks which one and remembers the answer:
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
This directory is not linked to a Cefense repository.
|
|
331
|
+
/Users/you/code/api
|
|
332
|
+
git remote acme/api
|
|
333
|
+
|
|
334
|
+
How should this directory resolve?
|
|
335
|
+
> Link this directory to acme/api matches your git remote
|
|
336
|
+
Link to a different repository
|
|
337
|
+
Just this once
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Resolution order, first match wins:
|
|
341
|
+
|
|
342
|
+
1. `--repo owner/name`
|
|
343
|
+
2. `CEFENSE_REPO`
|
|
344
|
+
3. the link stored for this directory
|
|
345
|
+
4. the prompt above, seeded from your git remote
|
|
346
|
+
|
|
347
|
+
"Just this once" resolves without remembering. `--no-link` does the same non-interactively, and `--repo` skips the question entirely. `cf repo set-default` sets the link ahead of time and `--unset` clears it.
|
|
348
|
+
|
|
349
|
+
`cf status` and `cf repo list` are not scoped to one repository, so they never ask.
|
|
350
|
+
|
|
351
|
+
## Configuration
|
|
352
|
+
|
|
353
|
+
| Variable | Effect |
|
|
354
|
+
| --- | --- |
|
|
355
|
+
| `CEFENSE_API_URL` | the Cefense instance to talk to, default `https://cefense.com` |
|
|
356
|
+
| `CEFENSE_REPO` | the repository to act on, same as `--repo` |
|
|
357
|
+
| `CEFENSE_TOKEN` | an access token to use instead of the keychain, never persisted |
|
|
358
|
+
| `NO_COLOR` | disable colour |
|
|
359
|
+
| `FORCE_COLOR` | keep colour when piping |
|
|
360
|
+
|
|
361
|
+
Global flags, available on every command:
|
|
362
|
+
|
|
363
|
+
| Flag | Effect |
|
|
364
|
+
| --- | --- |
|
|
365
|
+
| `--api-url <url>` | override the instance for one invocation |
|
|
366
|
+
| `--repo <owner/name>` | override the repository for one invocation |
|
|
367
|
+
| `--json` | emit the raw API response as pretty JSON |
|
|
368
|
+
| `--agent` | machine mode, see [Agent mode](#agent-mode) |
|
|
369
|
+
| `--no-color` | disable colour |
|
|
370
|
+
| `--verbose` | print a stack trace on failure |
|
|
371
|
+
| `-y, --yes` | skip confirmation prompts |
|
|
372
|
+
| `--no-link` | resolve the repository without remembering it |
|
|
373
|
+
| `-v, --version` | print the version |
|
|
374
|
+
| `-h, --help` | print help for any command |
|
|
375
|
+
|
|
376
|
+
## Exit codes
|
|
377
|
+
|
|
378
|
+
| Code | Meaning |
|
|
379
|
+
| --- | --- |
|
|
380
|
+
| 0 | success |
|
|
381
|
+
| 1 | findings present, with `--exit-code` |
|
|
382
|
+
| 2 | usage error, including a prompt that could not be shown |
|
|
383
|
+
| 3 | not signed in |
|
|
384
|
+
| 4 | the API returned an error |
|
|
385
|
+
| 130 | interrupted |
|
|
386
|
+
|
|
387
|
+
## Programmatic use
|
|
388
|
+
|
|
389
|
+
`src/core` is presentation-free and published as a subpath export, so you can build on the same client, credential store and repository resolution the CLI uses:
|
|
390
|
+
|
|
391
|
+
```ts
|
|
392
|
+
import { openSession, CefenseClient } from "@cefense-npm/cefense-cli/core";
|
|
393
|
+
|
|
394
|
+
const session = await openSession({}, { auth: true });
|
|
395
|
+
const { findings } = await session.client.findings(githubRepoId, { severity: "critical" });
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
This is the foundation the Cefense MCP server is built on.
|
|
399
|
+
|
|
400
|
+
## Development
|
|
401
|
+
|
|
402
|
+
```sh
|
|
403
|
+
git clone https://github.com/Cefense/CLI.git
|
|
404
|
+
cd CLI
|
|
405
|
+
npm install
|
|
406
|
+
npm run check-types
|
|
407
|
+
npm test
|
|
408
|
+
npm run build
|
|
409
|
+
npm link # cf is now on your PATH
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Run against a local backend:
|
|
413
|
+
|
|
414
|
+
```sh
|
|
415
|
+
cf status --api-url http://localhost:3001
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
| Script | What it does |
|
|
419
|
+
| --- | --- |
|
|
420
|
+
| `npm run build` | compile to `dist` |
|
|
421
|
+
| `npm run watch` | compile on change |
|
|
422
|
+
| `npm run check-types` | type-check without emitting |
|
|
423
|
+
| `npm test` | compile tests and run them with `node --test` |
|
|
424
|
+
|
|
425
|
+
## License
|
|
426
|
+
|
|
427
|
+
MIT. See [LICENSE](./LICENSE).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUxD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,OAAO,CAAC,MAAM,CAAC,CAiGjB;AAED,wBAAsB,UAAU,CAC9B,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9B,OAAO,CAAC,MAAM,CAAC,CAuDjB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAkFxE"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -11,6 +11,8 @@ import { confirm, spinner } from "../ui/prompts.js";
|
|
|
11
11
|
import { c, glyph } from "../ui/theme.js";
|
|
12
12
|
import { keyValue } from "../ui/table.js";
|
|
13
13
|
import { VERSION } from "../version.js";
|
|
14
|
+
import { isAgentMode } from "../ui/mode.js";
|
|
15
|
+
import { prune } from "../core/compact.js";
|
|
14
16
|
export async function authLogin(globals, options = {}) {
|
|
15
17
|
const apiUrl = resolveApiUrl(globals.apiUrl);
|
|
16
18
|
const existing = await loadCredentials(apiUrl);
|
|
@@ -34,10 +36,15 @@ export async function authLogin(globals, options = {}) {
|
|
|
34
36
|
try {
|
|
35
37
|
authorization = await requestAuthorizationCode(config, {
|
|
36
38
|
onUrl: (url) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (isAgentMode()) {
|
|
40
|
+
process.stderr.write(`Open this URL to sign in: ${url}\n`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
out.info("Opening your browser to sign in. If it does not open, paste this:");
|
|
44
|
+
out.line();
|
|
45
|
+
out.line(` ${c.cyan(url)}`);
|
|
46
|
+
out.line();
|
|
47
|
+
}
|
|
41
48
|
void open(url).catch(() => undefined);
|
|
42
49
|
progress.start("Waiting for authentication in the browser");
|
|
43
50
|
},
|
|
@@ -52,7 +59,7 @@ export async function authLogin(globals, options = {}) {
|
|
|
52
59
|
const client = new CefenseClient({ apiUrl, config, credentials });
|
|
53
60
|
const me = await client.me().catch((error) => {
|
|
54
61
|
throw new CefenseError("Signed in, but that token could not read your Cefense account.", {
|
|
55
|
-
remedy: "Run cf
|
|
62
|
+
remedy: "Run cf auth status to check the API, then try again.",
|
|
56
63
|
cause: error,
|
|
57
64
|
});
|
|
58
65
|
});
|
|
@@ -69,6 +76,16 @@ export async function authLogin(globals, options = {}) {
|
|
|
69
76
|
if (saved.warning)
|
|
70
77
|
out.warn(saved.warning);
|
|
71
78
|
const github = await client.githubStatus().catch(() => null);
|
|
79
|
+
if (isAgentMode()) {
|
|
80
|
+
out.agentEmit({
|
|
81
|
+
apiUrl,
|
|
82
|
+
authenticated: true,
|
|
83
|
+
email: me.user.email,
|
|
84
|
+
userId: me.user.id,
|
|
85
|
+
credentialBackend: saved.backend,
|
|
86
|
+
}, github?.connected ? ["cf status --agent"] : ["cf repo connect <owner/name>"]);
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
72
89
|
out.line();
|
|
73
90
|
if (github && !github.connected) {
|
|
74
91
|
out.info("Next: connect a repository");
|
|
@@ -124,6 +141,10 @@ export async function authLogout(globals, options = {}) {
|
|
|
124
141
|
out.success(`Credentials removed for ${apiUrl}`);
|
|
125
142
|
signedOut += 1;
|
|
126
143
|
}
|
|
144
|
+
if (isAgentMode()) {
|
|
145
|
+
out.agentEmit({ signedOut }, signedOut > 0 ? ["cf auth login"] : []);
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
127
148
|
if (signedOut === 0) {
|
|
128
149
|
out.line();
|
|
129
150
|
out.info("You were not signed in.");
|
|
@@ -134,6 +155,10 @@ export async function authLogout(globals, options = {}) {
|
|
|
134
155
|
export async function authStatus(globals) {
|
|
135
156
|
const session = await openSession(globals, { auth: false });
|
|
136
157
|
if (!session.credentials) {
|
|
158
|
+
if (isAgentMode()) {
|
|
159
|
+
out.agentEmit({ apiUrl: session.apiUrl, authenticated: false }, ["cf auth login"]);
|
|
160
|
+
return 3;
|
|
161
|
+
}
|
|
137
162
|
if (out.isJsonMode()) {
|
|
138
163
|
out.json({ apiUrl: session.apiUrl, authenticated: false });
|
|
139
164
|
return 3;
|
|
@@ -149,6 +174,17 @@ export async function authStatus(globals) {
|
|
|
149
174
|
session.client.githubStatus().catch(() => null),
|
|
150
175
|
session.client.billing().catch(() => null),
|
|
151
176
|
]);
|
|
177
|
+
if (isAgentMode()) {
|
|
178
|
+
out.agentEmit({
|
|
179
|
+
apiUrl: session.apiUrl,
|
|
180
|
+
authenticated: true,
|
|
181
|
+
email: me.user.email,
|
|
182
|
+
userId: me.user.id,
|
|
183
|
+
credentialBackend: session.backend,
|
|
184
|
+
github: github ? prune({ connected: github.connected, login: github.login }) : null,
|
|
185
|
+
}, github?.connected ? ["cf status --agent"] : ["cf repo connect <owner/name>"]);
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
152
188
|
if (out.isJsonMode()) {
|
|
153
189
|
out.json({
|
|
154
190
|
apiUrl: session.apiUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9H,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC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EAAgB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../../src/commands/fix.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,aAAa,EAAgB,MAAM,oBAAoB,CAAC;AAoGnF,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAgGxE"}
|
package/dist/commands/fix.js
CHANGED
|
@@ -5,6 +5,8 @@ import * as out from "../ui/output.js";
|
|
|
5
5
|
import { wrapText } from "../ui/format.js";
|
|
6
6
|
import { c, displaySeverity, glyph, severityColor, severityRank } from "../ui/theme.js";
|
|
7
7
|
import { fixActions, fixLabel, renderDiff } from "./fixactions.js";
|
|
8
|
+
import { isAgentMode } from "../ui/mode.js";
|
|
9
|
+
import { compactFix } from "../core/compact.js";
|
|
8
10
|
function detail(row, width) {
|
|
9
11
|
const lines = [];
|
|
10
12
|
const push = (value = "") => lines.push(value ? ` ${value}` : "");
|
|
@@ -75,6 +77,16 @@ export async function fixCommand(globals) {
|
|
|
75
77
|
const session = await openSession(globals, { auth: true });
|
|
76
78
|
const { project } = await resolveLinkedProject(session, globals);
|
|
77
79
|
const { rows, scanId } = await loadRows(session, project);
|
|
80
|
+
if (isAgentMode()) {
|
|
81
|
+
out.agentEmit({
|
|
82
|
+
repository: project.fullName,
|
|
83
|
+
scanId,
|
|
84
|
+
fixes: rows
|
|
85
|
+
.filter((row) => row.fix)
|
|
86
|
+
.map((row) => compactFix(row.fix, { diff: true })),
|
|
87
|
+
});
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
78
90
|
if (out.isJsonMode()) {
|
|
79
91
|
out.json({ repository: project.fullName, scanId, fixes: rows.map((row) => row.fix).filter(Boolean) });
|
|
80
92
|
return 0;
|
package/dist/commands/fix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix.js","sourceRoot":"","sources":["../../src/commands/fix.ts"],"names":[],"mapp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AAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;YACvE,OAAO;gBACL,GAAG,MAAM,IAAI,QAAQ,IAAI,KAAK,EAAE;gBAChC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC3D,EAAE;aACH,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE;QAC5F,YAAY,EAAE,8BAA8B;QAC5C,OAAO;QACP,OAAO,EAAE;YACP,GAAG,UAAU,CAAM,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CACzD;YACD;gBACE,GAAG,EAAE,GAAG;gBACR,KAAK,EAAE,SAAS;gBAChB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;oBAC3B,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;oBACxB,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBAClC,CAAC;aACF;SACF;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type GlobalOptions } from "../core/session.js";
|
|
2
|
+
export declare function fixShow(globals: GlobalOptions, findingId: string): Promise<number>;
|
|
3
|
+
export declare function fixGenerate(globals: GlobalOptions, findingId: string, options?: {
|
|
4
|
+
wait?: boolean;
|
|
5
|
+
}): Promise<number>;
|
|
6
|
+
export declare function fixPublish(globals: GlobalOptions, findingId: string): Promise<number>;
|
|
7
|
+
//# sourceMappingURL=fixcmds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixcmds.d.ts","sourceRoot":"","sources":["../../src/commands/fixcmds.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,aAAa,EAAgB,MAAM,oBAAoB,CAAC;AAoDnF,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BxF;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,OAAO,CAAC,MAAM,CAAC,CA0DjB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkF3F"}
|