@securityreviewai/securityreview-kit 0.1.50 → 0.1.52

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.
Files changed (78) hide show
  1. package/README.md +105 -0
  2. package/bin/securityreview-kit.js +5 -0
  3. package/package.json +30 -24
  4. package/src/cli.js +109 -0
  5. package/src/commands/init.js +851 -0
  6. package/src/commands/status.js +99 -0
  7. package/src/commands/switch-project.js +207 -0
  8. package/src/generators/mcp/claude.js +85 -0
  9. package/src/generators/mcp/claude.test.js +64 -0
  10. package/src/generators/mcp/codex.js +70 -0
  11. package/src/generators/mcp/codex.test.js +43 -0
  12. package/src/generators/mcp/cursor.js +29 -0
  13. package/src/generators/mcp/cursor.test.js +50 -0
  14. package/src/generators/mcp/gemini.js +28 -0
  15. package/src/generators/mcp/vscode.js +29 -0
  16. package/src/generators/mcp/windsurf.js +27 -0
  17. package/src/generators/rules/antigravity.js +22 -0
  18. package/src/generators/rules/claude.js +87 -0
  19. package/src/generators/rules/claude.test.js +60 -0
  20. package/src/generators/rules/codex.js +141 -0
  21. package/src/generators/rules/codex.test.js +59 -0
  22. package/src/generators/rules/content.js +110 -0
  23. package/src/generators/rules/cursor.js +128 -0
  24. package/src/generators/rules/gemini.js +13 -0
  25. package/src/generators/rules/guardrails-init-profile.md +56 -0
  26. package/src/generators/rules/guardrails-profiler/SKILL.md +130 -0
  27. package/src/generators/rules/guardrails-profiler/references/signal-registry.json +514 -0
  28. package/src/generators/rules/guardrails-selection/references/category-threat-map.md +232 -0
  29. package/src/generators/rules/guardrails_rule.md +94 -0
  30. package/src/generators/rules/hooks.json +11 -0
  31. package/src/generators/rules/srai-profile.md +32 -0
  32. package/src/generators/rules/vscode.js +101 -0
  33. package/src/generators/rules/vscode.test.js +54 -0
  34. package/src/generators/rules/windsurf.js +13 -0
  35. package/src/utils/constants.js +95 -0
  36. package/src/utils/cursor-agent-path.js +67 -0
  37. package/src/utils/cursor-cli-permissions.js +28 -0
  38. package/src/utils/detect.js +27 -0
  39. package/src/utils/fs-helpers.js +82 -0
  40. package/src/utils/guardrails-profiler-bundle.js +84 -0
  41. package/src/utils/ide-cli-install.js +138 -0
  42. package/src/utils/profiler-agent.js +446 -0
  43. package/src/utils/profiler-agent.test.js +81 -0
  44. package/src/utils/srai.js +252 -0
  45. package/dist/api.js +0 -44
  46. package/dist/commands/guardrails.js +0 -13
  47. package/dist/commands/init.js +0 -88
  48. package/dist/commands/profile.js +0 -14
  49. package/dist/commands/status.js +0 -27
  50. package/dist/commands/sync.js +0 -6
  51. package/dist/config.js +0 -18
  52. package/dist/fs.js +0 -43
  53. package/dist/index.js +0 -44
  54. package/dist/profile.js +0 -113
  55. package/dist/scaffold/claude-code.js +0 -43
  56. package/dist/scaffold/codex.js +0 -41
  57. package/dist/scaffold/cursor.js +0 -45
  58. package/dist/scaffold/gemini.js +0 -10
  59. package/dist/scaffold/index.js +0 -22
  60. package/dist/scaffold/mcp.js +0 -15
  61. package/dist/scaffold/rules.js +0 -191
  62. package/dist/scaffold/vibreview.js +0 -30
  63. package/dist/scaffold/vscode.js +0 -28
  64. package/dist/scaffold/windsurf.js +0 -10
  65. package/dist/sync/index.js +0 -34
  66. package/dist/sync/payload.js +0 -23
  67. package/dist/sync/state.js +0 -12
  68. package/dist/types.js +0 -1
  69. package/templates/claude/CLAUDE.md +0 -13
  70. package/templates/claude/agents/guardrail_profiler.md +0 -12
  71. package/templates/claude/agents/threat_modeler.md +0 -5
  72. package/templates/claude/skills/vibreview/SKILL.md +0 -21
  73. package/templates/claude/skills/vibreview/guardrail_patterns.md +0 -12
  74. package/templates/cursor/rules/vibreview-security.mdc +0 -8
  75. /package/{templates/shared → src/generators/rules}/content.md +0 -0
  76. /package/{templates/shared/guardrails-selection.md → src/generators/rules/guardrails-selection/SKILL.md} +0 -0
  77. /package/{templates/shared/threat-modelling.md → src/generators/rules/skill.md} +0 -0
  78. /package/{templates/shared → src/generators/rules}/vibereview-sync/SKILL.md +0 -0
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # @securityreviewai/securityreview-kit
2
+
3
+ > Bootstrap [security-review-mcp](https://www.npmjs.com/package/security-review-mcp) for AI IDEs and CLI tools in one command.
4
+
5
+ **@securityreviewai/securityreview-kit** configures the SRAI security review MCP server and installs workspace rules so your AI assistant consults security threat models and countermeasures *before* generating code.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # Interactive mode (recommended)
11
+ npx @securityreviewai/securityreview-kit init
12
+
13
+ # Or specify targets directly
14
+ npx @securityreviewai/securityreview-kit init --target cursor --api-url https://api.example.com --api-key YOUR_TOKEN
15
+
16
+ # Install for multiple targets
17
+ npx @securityreviewai/securityreview-kit init --target cursor claude vscode
18
+
19
+ # Install for all supported targets
20
+ npx @securityreviewai/securityreview-kit init --all --api-url https://api.example.com --api-key YOUR_TOKEN
21
+
22
+ # Re-open project selection menu and update installed rules
23
+ npx @securityreviewai/securityreview-kit init --switch-project
24
+ ```
25
+
26
+ ## Supported Targets
27
+
28
+ | Target | Flag | MCP Config | Workspace Rule |
29
+ |---|---|---|---|
30
+ | Cursor | `cursor` | `.cursor/mcp.json` | `.cursor/rules/srai-security-review.mdc`, `.cursor/rules/guardrails_rule.mdc`, `.cursor/commands/srai-profile.md`, `.cursor/commands/guardrails-init-profile.md`, `.cursor/skills/threat-modelling/SKILL.md`, `.cursor/skills/vibereview-sync/SKILL.md`, `.cursor/hooks.json` |
31
+ | Claude Code | `claude` | `.mcp.json` | `.claude/CLAUDE.md`, `.claude/settings.json`, `.claude/skills/threat-modelling/SKILL.md`, `.claude/skills/vibereview-sync/SKILL.md`, `.claude/skills/guardrails-profiler/SKILL.md`, `.claude/skills/guardrails-selection/SKILL.md`, `.claude/commands/guardrails-init-profile.md` |
32
+ | VS Code Copilot | `vscode` | `.vscode/mcp.json` | `.github/copilot-instructions.md`, `.github/skills/threat-modelling/SKILL.md`, `.github/skills/vibereview-sync/SKILL.md`, `.github/skills/guardrails-profiler/SKILL.md`, `.github/skills/guardrails-selection/SKILL.md`, `.github/hooks/srai-session-policy.json` |
33
+ | Windsurf | `windsurf` | `.windsurf/mcp_config.json` | `.windsurf/rules/srai-security-review.md` |
34
+ | Codex | `codex` | `.codex/config.toml` | `.codex/AGENTS.md`, `.codex/skills/threat-modelling/SKILL.md`, `.codex/skills/vibereview-sync/SKILL.md`, `.codex/skills/guardrails-profiler/SKILL.md`, `.codex/skills/guardrails-selection/SKILL.md`, `.codex/hooks.json`, `.codex/commands/guardrails-init-profile.md` |
35
+ | Gemini CLI | `gemini` | `.gemini/settings.json` | `GEMINI.md` |
36
+ | Antigravity | `antigravity` | `.gemini/settings.json` | `.agents/rules/srai-security-review.md` |
37
+
38
+ ## Commands
39
+
40
+ ### `@securityreviewai/securityreview-kit init`
41
+
42
+ Configure security-review-mcp for your IDE/CLI. Runs interactively when no flags are provided.
43
+
44
+ ```
45
+ Options:
46
+ -t, --target <name...> Target IDE/CLI (cursor, claude, vscode, windsurf, codex, gemini, antigravity)
47
+ -a, --all Install for all supported targets
48
+ --project-name <name> (Optional) Preselect project name from fetched API project list
49
+ --api-url <url> SRAI API URL (or set SECURITY_REVIEW_API_URL env var)
50
+ --api-key <token> SRAI API Token (or set SECURITY_REVIEW_API_TOKEN env var)
51
+ --switch-project Fetch projects and only update mapped workspace rules
52
+ --skip-mcp Skip MCP server config installation
53
+ --skip-rules Skip workspace rule installation
54
+ --profile-repo Run the guardrails profiler after init
55
+ --profiler-claude-login Run Claude Code login before profiling
56
+ --claude-auth-mode <mode>
57
+ Claude profiling auth mode: current, claudeai, console, api_key, gateway, bedrock, vertex, or setup_token
58
+ --claude-api-key <key> Anthropic API key for Claude profiling
59
+ --claude-base-url <url> Anthropic-compatible base URL for Claude profiling
60
+ --claude-auth-token <token>
61
+ Auth token for Claude profiling gateway mode
62
+ --claude-provider-model <model>
63
+ Optional Claude provider model override for gateway, Bedrock, or Vertex profiling
64
+ --profiler-copilot-login
65
+ Run GitHub Copilot CLI login before VS Code Copilot profiling
66
+ --profiler-codex-login Run Codex login before Codex profiling
67
+ --profiler-verbose Show live profiler output while profiling runs
68
+ --show-profiler-logs Alias for --profiler-verbose
69
+ ```
70
+
71
+ ### `@securityreviewai/securityreview-kit init --switch-project`
72
+
73
+ Fetches projects from `https://<api-url>/api/projects/` using `Authorization: Bearer <api-key>`, shows a single-select menu, and updates installed workspace rules with the selected project.
74
+
75
+ ### `@securityreviewai/securityreview-kit status`
76
+
77
+ Show current configuration status for all supported targets in the workspace.
78
+
79
+ ## Environment Variables
80
+
81
+ | Variable | Description |
82
+ |---|---|
83
+ | `SECURITY_REVIEW_PROJECT_NAME` | Optional default project name to preselect in the project menu |
84
+ | `SECURITY_REVIEW_API_URL` | SRAI platform API endpoint |
85
+ | `SECURITY_REVIEW_API_TOKEN` | Your SRAI API token |
86
+
87
+ These can be provided via CLI flags, environment variables, or interactive prompts.
88
+
89
+ ## What Gets Installed
90
+
91
+ **MCP Server Config** — tells your IDE how to launch the `security-review-mcp` server via `npx`.
92
+
93
+ **Workspace Rules** — instructs the AI assistant to consult SRAI threat models and countermeasures before generating security-relevant code. If configured, the selected SRAI project name is injected into the MCP workflow instructions in the installed rule content.
94
+
95
+ ## How It Works
96
+
97
+ 1. Run `@securityreviewai/securityreview-kit init`
98
+ 2. Select your IDE/CLI target(s)
99
+ 3. Choose whether to install workspace rules and MCP config
100
+ 4. If MCP is selected, enter your SRAI credentials (API URL, token)
101
+ 5. The tool fetches `/api/projects/` and you select exactly one SRAI project from the menu
102
+ 6. The tool creates/merges MCP config and workspace rule files
103
+ 7. Your AI assistant now has access to SRAI security reviews
104
+
105
+ The tool is **idempotent** — running it multiple times safely updates existing configs without duplicating content.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { run } from '../src/cli.js';
4
+
5
+ run();
package/package.json CHANGED
@@ -1,38 +1,44 @@
1
1
  {
2
2
  "name": "@securityreviewai/securityreview-kit",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
+ "description": "Bootstrap security-review-mcp for AI IDEs and CLI tools",
5
+ "author": "Debarshi Das <debarshi.das@we45.com>",
6
+ "license": "UNLICENSED",
4
7
  "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
8
  "bin": {
9
- "securityreview-kit": "./dist/index.js",
10
- "vibreview": "./dist/index.js"
9
+ "securityreview-kit": "./bin/securityreview-kit.js"
11
10
  },
12
11
  "files": [
13
- "dist",
14
- "templates",
12
+ "bin/",
13
+ "src/",
15
14
  "README.md"
16
15
  ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
17
19
  "scripts": {
18
- "build": "tsc -p tsconfig.json",
19
- "dev": "tsx src/index.ts",
20
- "lint": "tsc -p tsconfig.json --noEmit",
21
- "test": "vitest run"
20
+ "test": "node --test",
21
+ "start": "node bin/securityreview-kit.js"
22
22
  },
23
+ "keywords": [
24
+ "security",
25
+ "mcp",
26
+ "security-review",
27
+ "srai",
28
+ "ai-ide",
29
+ "cursor",
30
+ "claude",
31
+ "codex",
32
+ "gemini",
33
+ "windsurf",
34
+ "vscode"
35
+ ],
23
36
  "dependencies": {
24
- "chalk": "^5.6.2",
25
- "commander": "^14.0.2",
26
- "inquirer": "^12.10.0",
27
- "zod": "^4.4.3"
28
- },
29
- "devDependencies": {
30
- "@types/node": "^25.6.0",
31
- "tsx": "^4.21.0",
32
- "typescript": "^5.9.3",
33
- "vitest": "^4.1.5"
37
+ "chalk": "^5.4.0",
38
+ "commander": "^13.0.0",
39
+ "inquirer": "^12.0.0"
34
40
  },
35
- "engines": {
36
- "node": ">=20"
41
+ "publishConfig": {
42
+ "access": "public"
37
43
  }
38
44
  }
package/src/cli.js ADDED
@@ -0,0 +1,109 @@
1
+ import { Command } from 'commander';
2
+ import { initCommand } from './commands/init.js';
3
+ import { statusCommand } from './commands/status.js';
4
+ import { switchProjectCommand } from './commands/switch-project.js';
5
+ import { TARGET_NAMES } from './utils/constants.js';
6
+
7
+ export function run() {
8
+ const program = new Command();
9
+
10
+ program
11
+ .name('securityreview-kit')
12
+ .description('Bootstrap security-review-mcp for AI IDEs and CLI tools')
13
+ .version('0.1.0');
14
+
15
+ program
16
+ .command('init')
17
+ .description('Configure security-review-mcp for your IDE / CLI tool')
18
+ .option(
19
+ '-t, --target <name...>',
20
+ `Target IDE/CLI (${TARGET_NAMES.join(', ')}). Omit for interactive mode.`,
21
+ )
22
+ .option('-a, --all', 'Install for all supported targets')
23
+ .option('--project-name <name>', 'Default SRAI project name to preselect in project menu')
24
+ .option('--api-url <url>', 'SRAI API URL (or set SECURITY_REVIEW_API_URL env var)')
25
+ .option('--api-key <token>', 'SRAI API Token (or set SECURITY_REVIEW_API_TOKEN env var)')
26
+ .option('--switch-project', 'Fetch projects and only update mapped workspace rules')
27
+ .option('--skip-mcp', 'Skip MCP server config installation')
28
+ .option('--skip-rules', 'Skip workspace rule installation')
29
+ .option('--skip-ide-cli-install', 'Do not install Cursor / Copilot / Claude Code / Codex CLIs when those targets are selected')
30
+ .option('--profile-repo', 'After init, run the guardrails profiler agent (non-interactive; needs cursor, vscode, claude, or codex target)')
31
+ .option('--no-profile-repo', 'Skip the optional profiler agent step after init')
32
+ .option(
33
+ '--profiler-no-trust',
34
+ 'When profiling with Cursor, do not pass --trust (use if you need interactive workspace trust or login in the terminal)',
35
+ )
36
+ .option(
37
+ '--profiler-cursor-login',
38
+ 'Before Cursor profiling, run `agent login` (or `cursor-agent login`) in this terminal (then profiling runs in the same init)',
39
+ )
40
+ .option(
41
+ '--profiler-claude-login',
42
+ 'Before Claude Code profiling, run `claude auth login` in this terminal',
43
+ )
44
+ .option(
45
+ '--claude-auth-mode <mode>',
46
+ 'Claude profiling auth mode: current, claudeai, console, api_key, gateway, bedrock, vertex, or setup_token',
47
+ )
48
+ .option(
49
+ '--claude-api-key <key>',
50
+ 'Anthropic API key for Claude profiling when using --claude-auth-mode api_key',
51
+ )
52
+ .option(
53
+ '--claude-base-url <url>',
54
+ 'Anthropic-compatible base URL for Claude profiling when using --claude-auth-mode gateway',
55
+ )
56
+ .option(
57
+ '--claude-auth-token <token>',
58
+ 'Auth token for Claude profiling when using --claude-auth-mode gateway',
59
+ )
60
+ .option(
61
+ '--claude-provider-model <model>',
62
+ 'Optional Claude provider model override for gateway, Bedrock, or Vertex profiling',
63
+ )
64
+ .option(
65
+ '--profiler-copilot-login',
66
+ 'Before VS Code Copilot profiling, run `copilot login` in this terminal',
67
+ )
68
+ .option(
69
+ '--profiler-codex-login',
70
+ 'Before Codex profiling, run `codex login --device-auth` in this terminal',
71
+ )
72
+ .option(
73
+ '--profiler-quiet',
74
+ 'When profiling, use the standard progress message (default; retained for compatibility)',
75
+ )
76
+ .option(
77
+ '--profiler-verbose',
78
+ 'When profiling, show live agent output for troubleshooting',
79
+ )
80
+ .option(
81
+ '--show-profiler-logs',
82
+ 'Alias for --profiler-verbose; show live profiler logs while profiling runs',
83
+ )
84
+ .action(async (options) => {
85
+ try {
86
+ if (options.switchProject) {
87
+ await switchProjectCommand(options);
88
+ } else {
89
+ await initCommand(options);
90
+ }
91
+ } catch (err) {
92
+ if (err.name === 'ExitPromptError') {
93
+ // User cancelled interactive prompt
94
+ console.log('\n Cancelled.\n');
95
+ process.exit(0);
96
+ }
97
+ throw err;
98
+ }
99
+ });
100
+
101
+ program
102
+ .command('status')
103
+ .description('Show current security-review-mcp configuration status')
104
+ .action(async () => {
105
+ await statusCommand();
106
+ });
107
+
108
+ program.parse();
109
+ }