@code-sentinel-cli/code-sentinel-cli 3.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.
@@ -0,0 +1 @@
1
+ export default { initialize() {}, connectToDevTools() {} };
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "react-devtools-core",
3
+ "version": "0.0.0-code-sentinel-stub",
4
+ "type": "module",
5
+ "exports": "./index.js"
6
+ }
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@code-sentinel-cli/code-sentinel-cli",
3
+ "version": "3.0.2",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Hybrid (rule-based + AI) code review CLI tool for Angular 19 (FE) and Spring Boot (BE) — built for Viettel internal use.",
7
+ "license": "UNLICENSED",
8
+ "author": "Viettel",
9
+ "keywords": [
10
+ "code-review",
11
+ "static-analysis",
12
+ "angular",
13
+ "spring-boot",
14
+ "ai-review",
15
+ "viettel"
16
+ ],
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "bin": {
20
+ "code-sentinel": "./dist/bin.js",
21
+ "cs": "./dist/bin.js"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "templates"
32
+ ],
33
+ "engines": {
34
+ "node": ">=22"
35
+ },
36
+ "dependencies": {
37
+ "@ai-sdk/google": "^3.0.75",
38
+ "@ai-sdk/groq": "^3.0.39",
39
+ "@ai-sdk/openai-compatible": "^2.0.47",
40
+ "@inquirer/prompts": "^7.2.1",
41
+ "@libsql/client": "^0.14.0",
42
+ "ai": "^6.0.185",
43
+ "chokidar": "^5.0.0",
44
+ "commander": "^12.1.0",
45
+ "cosmiconfig": "^9.0.0",
46
+ "dotenv": "^17.4.2",
47
+ "drizzle-orm": "^0.36.4",
48
+ "ink": "^7.0.3",
49
+ "ink-spinner": "^5.0.0",
50
+ "mariadb": "^3.5.3",
51
+ "picocolors": "^1.1.1",
52
+ "pino": "^9.5.0",
53
+ "pino-pretty": "^13.0.0",
54
+ "react": "^19.2.6",
55
+ "tinyglobby": "^0.2.10",
56
+ "tree-sitter-html": "^0.23.2",
57
+ "tree-sitter-java": "^0.23.5",
58
+ "tree-sitter-typescript": "^0.23.2",
59
+ "ts-morph": "^24.0.0",
60
+ "ulid": "^2.3.0",
61
+ "web-tree-sitter": "^0.25.10",
62
+ "yaml": "^2.6.1",
63
+ "zod": "^3.24.1",
64
+ "react-devtools-core": "0.0.0-code-sentinel-stub"
65
+ },
66
+ "bundledDependencies": [
67
+ "react-devtools-core"
68
+ ],
69
+ "publishConfig": {
70
+ "registry": "https://registry.npmjs.org/",
71
+ "access": "public"
72
+ }
73
+ }
@@ -0,0 +1,76 @@
1
+ # code-sentinel CI template v2 — requires the pinned CLI image >= 3.0.0.
2
+ #
3
+ # Configure the approved internal registry/image before enabling this workflow.
4
+ # This template deliberately does not use npx or a mutable `latest` reference.
5
+ # To require central ingest, provide the scoped non-human project credential as
6
+ # repository secrets/environment and set CODE_SENTINEL_CI_PUSH=always. Never
7
+ # echo CODE_SENTINEL_DASHBOARD_TOKEN.
8
+ name: code-sentinel
9
+
10
+ on:
11
+ pull_request:
12
+ push:
13
+ branches: [main, master]
14
+
15
+ permissions:
16
+ contents: read
17
+ security-events: write
18
+
19
+ jobs:
20
+ review:
21
+ name: Static + AI review
22
+ runs-on: ubuntu-latest
23
+ container:
24
+ image: registry.example.vn/code-sentinel/cli:3.0.0
25
+ timeout-minutes: 15
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 0
31
+
32
+ - name: Verify pinned CLI artifact
33
+ run: cs version --json
34
+
35
+ - name: Run review and create SARIF
36
+ run: |
37
+ set +e
38
+ PUSH_ARGS=""
39
+ if [ "${CODE_SENTINEL_CI_PUSH:-}" = "always" ]; then PUSH_ARGS="--push=always"; fi
40
+ cs review . \
41
+ --output code-sentinel.sarif \
42
+ --report-format sarif \
43
+ --min-severity warning \
44
+ --min-confidence 60 \
45
+ --silent \
46
+ $PUSH_ARGS
47
+ EXIT=$?
48
+ set -e
49
+ echo "CS_EXIT=$EXIT" >> "$GITHUB_ENV"
50
+
51
+ - name: Upload SARIF to GitHub code-scanning
52
+ if: always()
53
+ uses: github/codeql-action/upload-sarif@v3
54
+ with:
55
+ sarif_file: code-sentinel.sarif
56
+ category: code-sentinel
57
+
58
+ - name: Upload SARIF artifact
59
+ if: always()
60
+ uses: actions/upload-artifact@v4
61
+ with:
62
+ name: code-sentinel-sarif
63
+ path: code-sentinel.sarif
64
+ retention-days: 30
65
+
66
+ - name: Classify review exit
67
+ if: always()
68
+ run: |
69
+ case "${CS_EXIT:-1}" in
70
+ 0) echo "code-sentinel review completed" ;;
71
+ 1) echo "::error::code-sentinel configuration or command failure. Check review logs."; exit 1 ;;
72
+ 2) echo "::error::code-sentinel runtime, authentication, network, or required push failure. Retry only when safe."; exit 1 ;;
73
+ 3) echo "::error::code-sentinel quality gate failed: error findings."; exit 1 ;;
74
+ 4) echo "::error::code-sentinel quality gate failed: blocker findings."; exit 1 ;;
75
+ *) echo "::error::code-sentinel returned an unexpected exit ${CS_EXIT}."; exit 1 ;;
76
+ esac
@@ -0,0 +1,57 @@
1
+ # code-sentinel CI template v2 — requires the pinned CLI image >= 3.0.0.
2
+ #
3
+ # Migrate legacy Docker/token invocation to the CI workload identity contract
4
+ # when the server deployment enables it. Do not print that identity. Local
5
+ # Markdown/JSON artifacts remain independent from any central ingestion.
6
+ # Set CODE_SENTINEL_CI_PUSH=always only with a masked, scoped
7
+ # CODE_SENTINEL_DASHBOARD_TOKEN and the corresponding server/project variables.
8
+ stages:
9
+ - review
10
+
11
+ code-sentinel:
12
+ stage: review
13
+ image:
14
+ name: registry.example.vn/code-sentinel/cli:3.0.0
15
+ entrypoint: [""]
16
+ rules:
17
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
18
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
19
+ cache:
20
+ key:
21
+ files:
22
+ - .codereviewrc.yaml
23
+ - .codereviewrc.json
24
+ prefix: cs-${CI_COMMIT_REF_SLUG}
25
+ paths:
26
+ - .code-sentinel/
27
+ policy: pull-push
28
+ script:
29
+ - cs version --json
30
+ - |
31
+ set +e
32
+ PUSH_ARGS=""
33
+ if [ "${CODE_SENTINEL_CI_PUSH:-}" = "always" ]; then PUSH_ARGS="--push=always"; fi
34
+ cs review . \
35
+ --output code-sentinel.md \
36
+ --report-format both \
37
+ --min-severity warning \
38
+ --min-confidence 60 \
39
+ --silent \
40
+ $PUSH_ARGS
41
+ EXIT=$?
42
+ set -e
43
+ case "$EXIT" in
44
+ 0) echo "code-sentinel review completed" ;;
45
+ 1) echo "code-sentinel configuration or command failure. Check review logs."; exit 1 ;;
46
+ 2) echo "code-sentinel runtime, authentication, network, or required push failure. Retry only when safe."; exit 2 ;;
47
+ 3) echo "code-sentinel quality gate failed: error findings."; exit 1 ;;
48
+ 4) echo "code-sentinel quality gate failed: blocker findings."; exit 1 ;;
49
+ *) echo "code-sentinel returned an unexpected exit $EXIT."; exit 1 ;;
50
+ esac
51
+ artifacts:
52
+ name: 'code-sentinel-${CI_COMMIT_SHORT_SHA}'
53
+ when: always
54
+ expire_in: 30 days
55
+ paths:
56
+ - code-sentinel.md
57
+ - code-sentinel.json
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env sh
2
+ # code-sentinel pre-commit hook.
3
+ #
4
+ # Drop into `.husky/pre-commit` (or run `cs install-hooks` to copy
5
+ # it for you). Runs the review only on staged files so the hook is
6
+ # fast — no full-tree scan, no AI rules invoked by default.
7
+ #
8
+ # To skip in an emergency: `git commit --no-verify` (bypass ALL hooks).
9
+ # To soften: set `--min-confidence 80` so only high-confidence findings
10
+ # block the commit. To harden: drop `--min-severity warning` to `info`.
11
+
12
+ set -e
13
+
14
+ # Only run if code-sentinel is callable. This prevents commits from
15
+ # failing in checkouts where the standalone CLI has not been installed yet.
16
+ if ! command -v cs >/dev/null 2>&1; then
17
+ echo "code-sentinel pre-commit hook: cs not found — skipping."
18
+ echo " (install Code Sentinel CLI, or run \`cs install-hooks --uninstall\` to remove.)"
19
+ exit 0
20
+ fi
21
+
22
+ # Review only staged files. `--ai-off` keeps the hook fast and offline.
23
+ # `--min-severity warning` blocks on warning+; tune to `info` if you want
24
+ # all findings to surface, or to `error` if the hook feels too noisy.
25
+ cs review . \
26
+ --staged \
27
+ --ai-off \
28
+ --min-severity warning \
29
+ --min-confidence 70 \
30
+ --silent