codeslick-cli 1.0.2 → 1.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/README.md
CHANGED
|
@@ -15,6 +15,22 @@ Catch security vulnerabilities before they enter your codebase with automated pr
|
|
|
15
15
|
- **CI/CD Ready** - JSON output mode for automation
|
|
16
16
|
- **OWASP Top 10:2025 Compliant** - 268 comprehensive security checks
|
|
17
17
|
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
**Git is required** - CodeSlick CLI works with any git repository (local or remote):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Initialize git in your project (if not already done)
|
|
24
|
+
git init
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Note**: You do NOT need GitHub, GitLab, or any remote hosting. CodeSlick works with local git repositories, GitHub repositories, GitLab, Bitbucket, or any git-based workflow.
|
|
28
|
+
|
|
29
|
+
**System Requirements**:
|
|
30
|
+
- Node.js 18.0.0 or higher
|
|
31
|
+
- Git (any version)
|
|
32
|
+
- macOS, Linux, or Windows
|
|
33
|
+
|
|
18
34
|
## Installation
|
|
19
35
|
|
|
20
36
|
### Option 1: Use `npx` (Recommended - No Installation Required)
|
|
@@ -60,10 +76,18 @@ npx codeslick-cli init
|
|
|
60
76
|
|
|
61
77
|
## Quick Start
|
|
62
78
|
|
|
63
|
-
### 1.
|
|
79
|
+
### 1. Make Sure You Have Git Initialized
|
|
64
80
|
|
|
65
81
|
```bash
|
|
66
82
|
cd your-project/
|
|
83
|
+
|
|
84
|
+
# If not already a git repository, initialize it first:
|
|
85
|
+
git init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 2. Initialize CodeSlick in Your Repository
|
|
89
|
+
|
|
90
|
+
```bash
|
|
67
91
|
npx codeslick-cli init
|
|
68
92
|
# or if you installed globally:
|
|
69
93
|
codeslick init # or: cs init
|
|
@@ -71,18 +95,18 @@ codeslick init # or: cs init
|
|
|
71
95
|
|
|
72
96
|
This will:
|
|
73
97
|
- Create `.codeslick.json` configuration file
|
|
74
|
-
- Install pre-commit hook
|
|
98
|
+
- Install pre-commit hook in `.git/hooks/`
|
|
75
99
|
- Configure automatic scanning
|
|
76
100
|
|
|
77
|
-
###
|
|
101
|
+
### 3. Configure Severity Threshold (Optional)
|
|
78
102
|
|
|
79
103
|
```bash
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
npx codeslick-cli config set severity critical # Block only CRITICAL issues
|
|
105
|
+
npx codeslick-cli config set severity high # Block HIGH+ issues (recommended)
|
|
106
|
+
npx codeslick-cli config set severity medium # Block MEDIUM+ issues (default)
|
|
83
107
|
```
|
|
84
108
|
|
|
85
|
-
###
|
|
109
|
+
### 4. Commit as Usual
|
|
86
110
|
|
|
87
111
|
```bash
|
|
88
112
|
git add .
|
|
@@ -172,7 +196,7 @@ codeslick config set languages js,ts,py # Enable only JS, TS, Python
|
|
|
172
196
|
|
|
173
197
|
## Command Aliases
|
|
174
198
|
|
|
175
|
-
|
|
199
|
+
**If installed globally**, you can use the shorter `cs` alias:
|
|
176
200
|
|
|
177
201
|
| Long Command | Short Alias | Description |
|
|
178
202
|
|--------------|-------------|-------------|
|
|
@@ -183,20 +207,17 @@ For faster typing, use `cs` instead of `codeslick`:
|
|
|
183
207
|
| `codeslick --help` | `cs --help` | Show help |
|
|
184
208
|
| `codeslick --version` | `cs --version` | Show version |
|
|
185
209
|
|
|
186
|
-
**Examples:**
|
|
210
|
+
**Examples (global installation only):**
|
|
187
211
|
```bash
|
|
188
|
-
#
|
|
212
|
+
# These only work after global installation:
|
|
189
213
|
codeslick scan --staged
|
|
190
214
|
cs scan --staged
|
|
191
215
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
codeslick init --force
|
|
196
|
-
cs init --force
|
|
216
|
+
# If using npx, use:
|
|
217
|
+
npx codeslick-cli scan --staged
|
|
197
218
|
```
|
|
198
219
|
|
|
199
|
-
|
|
220
|
+
**Note**: The `codeslick` and `cs` commands only work after global installation. If using `npx`, always use `npx codeslick-cli <command>`.
|
|
200
221
|
|
|
201
222
|
## Configuration
|
|
202
223
|
|
|
@@ -353,12 +374,22 @@ codeslick init --force # Re-install hook
|
|
|
353
374
|
|
|
354
375
|
**Problem**: Running `codeslick init` in a non-git directory.
|
|
355
376
|
|
|
377
|
+
**Why this happens**: CodeSlick CLI requires git to:
|
|
378
|
+
- Install pre-commit hooks in `.git/hooks/` directory
|
|
379
|
+
- Track staged files for scanning
|
|
380
|
+
- Work with your existing git workflow
|
|
381
|
+
|
|
356
382
|
**Solution**: Initialize git first:
|
|
357
383
|
```bash
|
|
384
|
+
# Initialize git in your project
|
|
358
385
|
git init
|
|
359
|
-
|
|
386
|
+
|
|
387
|
+
# Now run CodeSlick init
|
|
388
|
+
npx codeslick-cli init
|
|
360
389
|
```
|
|
361
390
|
|
|
391
|
+
**Note**: You do NOT need GitHub or any remote repository. CodeSlick works with local git repositories.
|
|
392
|
+
|
|
362
393
|
### "No staged files found" error
|
|
363
394
|
|
|
364
395
|
**Problem**: Running `codeslick scan --staged` with no staged files.
|
package/bin/codeslick.cjs
CHANGED
|
@@ -25,6 +25,7 @@ const { scanCommand } = require('../dist/packages/cli/src/commands/scan');
|
|
|
25
25
|
const { initCommand } = require('../dist/packages/cli/src/commands/init');
|
|
26
26
|
const { configCommand } = require('../dist/packages/cli/src/commands/config');
|
|
27
27
|
const { loginCommand, logoutCommand, whoamiCommand } = require('../dist/packages/cli/src/commands/auth');
|
|
28
|
+
const { version } = require('../package.json');
|
|
28
29
|
|
|
29
30
|
// Detect if running as 'cs' or 'codeslick'
|
|
30
31
|
const scriptName = process.argv[1].includes('/cs') ? 'cs' : 'codeslick';
|
|
@@ -146,7 +147,7 @@ yargs(hideBin(process.argv))
|
|
|
146
147
|
.demandCommand(1, 'You must provide a command')
|
|
147
148
|
.help()
|
|
148
149
|
.alias('help', 'h')
|
|
149
|
-
.version(
|
|
150
|
+
.version(version)
|
|
150
151
|
.alias('version', 'v')
|
|
151
152
|
.epilog('For more information, visit https://codeslick.dev/docs/cli')
|
|
152
153
|
.strict()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH;;GAEG;AACH,UAAU,QAAQ;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACnD;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH;;GAEG;AACH,UAAU,QAAQ;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACnD;AAsGD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D/D"}
|
|
@@ -25,6 +25,7 @@ const config_loader_1 = require("../config/config-loader");
|
|
|
25
25
|
const cli_reporter_1 = require("../reporters/cli-reporter");
|
|
26
26
|
/**
|
|
27
27
|
* Pre-commit hook template
|
|
28
|
+
* Uses npx to work regardless of installation method (global or npx)
|
|
28
29
|
*/
|
|
29
30
|
const PRE_COMMIT_HOOK = `#!/bin/sh
|
|
30
31
|
# CodeSlick pre-commit hook
|
|
@@ -33,7 +34,8 @@ const PRE_COMMIT_HOOK = `#!/bin/sh
|
|
|
33
34
|
# To skip this hook temporarily, use: git commit --no-verify
|
|
34
35
|
|
|
35
36
|
# Run CodeSlick scan on staged files
|
|
36
|
-
|
|
37
|
+
# Uses npx to work with both global and npx installations
|
|
38
|
+
npx codeslick-cli scan --staged
|
|
37
39
|
|
|
38
40
|
# Exit with the scan status
|
|
39
41
|
exit $?
|
|
@@ -149,9 +151,9 @@ async function initCommand(args) {
|
|
|
149
151
|
console.log('CodeSlick will automatically scan staged files before each commit.');
|
|
150
152
|
console.log('');
|
|
151
153
|
console.log('To scan files manually:');
|
|
152
|
-
console.log(' codeslick scan # Scan all files');
|
|
153
|
-
console.log(' codeslick scan --staged # Scan staged files only');
|
|
154
|
-
console.log(' codeslick scan src/**/*.js # Scan specific files');
|
|
154
|
+
console.log(' npx codeslick-cli scan # Scan all files');
|
|
155
|
+
console.log(' npx codeslick-cli scan --staged # Scan staged files only');
|
|
156
|
+
console.log(' npx codeslick-cli scan src/**/*.js # Scan specific files');
|
|
155
157
|
console.log('');
|
|
156
158
|
console.log('To skip the pre-commit hook temporarily:');
|
|
157
159
|
console.log(' git commit --no-verify');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../src/commands/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../src/commands/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;AAmIH,kCA4DC;AA7LD,2BAAgC;AAChC,0CAAsD;AACtD,+BAA+B;AAC/B,8CAAsB;AACtB,2DAKiC;AACjC,4DAAmF;AAUnF;;;GAGG;AACH,MAAM,eAAe,GAAG;;;;;;;;;;;;CAYvB,CAAC;AAEF;;GAEG;AACH,SAAS,eAAe,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAClD,OAAO,IAAA,eAAU,EAAC,IAAA,cAAO,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC/C,OAAO,IAAA,cAAO,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;GAE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AAC,CAAC;QAC1C,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -34,6 +34,7 @@ interface InitArgs {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Pre-commit hook template
|
|
37
|
+
* Uses npx to work regardless of installation method (global or npx)
|
|
37
38
|
*/
|
|
38
39
|
const PRE_COMMIT_HOOK = `#!/bin/sh
|
|
39
40
|
# CodeSlick pre-commit hook
|
|
@@ -42,7 +43,8 @@ const PRE_COMMIT_HOOK = `#!/bin/sh
|
|
|
42
43
|
# To skip this hook temporarily, use: git commit --no-verify
|
|
43
44
|
|
|
44
45
|
# Run CodeSlick scan on staged files
|
|
45
|
-
|
|
46
|
+
# Uses npx to work with both global and npx installations
|
|
47
|
+
npx codeslick-cli scan --staged
|
|
46
48
|
|
|
47
49
|
# Exit with the scan status
|
|
48
50
|
exit $?
|
|
@@ -182,9 +184,9 @@ export async function initCommand(args: InitArgs): Promise<void> {
|
|
|
182
184
|
console.log('CodeSlick will automatically scan staged files before each commit.');
|
|
183
185
|
console.log('');
|
|
184
186
|
console.log('To scan files manually:');
|
|
185
|
-
console.log(' codeslick scan # Scan all files');
|
|
186
|
-
console.log(' codeslick scan --staged # Scan staged files only');
|
|
187
|
-
console.log(' codeslick scan src/**/*.js # Scan specific files');
|
|
187
|
+
console.log(' npx codeslick-cli scan # Scan all files');
|
|
188
|
+
console.log(' npx codeslick-cli scan --staged # Scan staged files only');
|
|
189
|
+
console.log(' npx codeslick-cli scan src/**/*.js # Scan specific files');
|
|
188
190
|
console.log('');
|
|
189
191
|
console.log('To skip the pre-commit hook temporarily:');
|
|
190
192
|
console.log(' git commit --no-verify');
|