@ericrisco/rsc 4.1.8 → 4.1.10

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/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.1.8",
2
+ "version": "4.1.10",
3
3
  "counts": {
4
4
  "skills": 273,
5
5
  "agents": 34,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericrisco/rsc",
3
- "version": "4.1.8",
3
+ "version": "4.1.10",
4
4
  "description": "A guided harness builder that turns your goal into a minimal, verified AI-agent setup using strict best practices.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -891,6 +891,43 @@ providers:
891
891
  Dashboard: https://dashboard.cohere.com/api-keys
892
892
  `COHERE_API_KEY` — secret.
893
893
 
894
+ - id: MINIMAX
895
+ category: ia_texto
896
+ detectors:
897
+ imports: ["@ai-sdk/minimax"]
898
+ env_vars: ["MINIMAX_API_KEY"]
899
+ deps: ["@ai-sdk/minimax"]
900
+ dashboard_url: "https://platform.minimax.io/console/keys"
901
+ env_example: |
902
+ MINIMAX_API_KEY=
903
+ # Use cn for a mainland China key.
904
+ MINIMAX_REGION=global
905
+ files:
906
+ test_connection.sh: |
907
+ #!/usr/bin/env bash
908
+ set -euo pipefail
909
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
910
+ source "$SCRIPT_DIR/.env"
911
+ : "${MINIMAX_API_KEY:?MINIMAX_API_KEY not set}"
912
+ case "${MINIMAX_REGION:-global}" in
913
+ global) base_url="https://api.minimax.io/v1" ;;
914
+ cn) base_url="https://api.minimax.cn/v1" ;;
915
+ *) echo "MINIMAX_REGION must be global or cn" >&2; exit 1 ;;
916
+ esac
917
+ curl -fsS --max-time 30 "$base_url/models" -H "Authorization: Bearer $MINIMAX_API_KEY" |
918
+ python3 -c 'import json, sys; models = json.load(sys.stdin)["data"]; print("Available models:", ", ".join(model["id"] for model in models))'
919
+ README.md: |
920
+ # MiniMax
921
+ Copy `.env.example` to `.env`, run `chmod 600 .env`, and set the key and region.
922
+ Run `./test_connection.sh` to list the models available to the account.
923
+ Text model IDs include `MiniMax-M3.1-Flash` and `MiniMax-M3`.
924
+ CREDENTIALS.md: |
925
+ # MiniMax credentials
926
+ For `MINIMAX_REGION=global`, get the key at https://platform.minimax.io/console/keys.
927
+ For `MINIMAX_REGION=cn`, get the key at https://platform.minimax.cn/console/keys.
928
+ Set `MINIMAX_API_KEY` to the key issued in that region.
929
+ Keep the key in the local `.env` file.
930
+
894
931
  - id: MISTRAL
895
932
  category: ia_texto
896
933
  detectors:
package/targets/claude.js CHANGED
@@ -316,15 +316,15 @@ export function wireHook(paths, sourceMd, policy = {}) {
316
316
  settings.hooks.PreToolUse ||= [];
317
317
  settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter((e) => !hookWiringOf(e).includes('.rsc/danger-guard.'));
318
318
  if (policy.dangerGuard !== false) {
319
- // Danger guard: a PreToolUse(Bash) hook that DENIES irreversible foot-gun commands
319
+ // Danger guard: a PreToolUse shell hook that DENIES irreversible foot-gun commands
320
320
  // (rm -rf, git push --force, DROP/TRUNCATE, DELETE/UPDATE without WHERE, dd to /dev,
321
321
  // curl|bash, …) when the user-profile says the user is NON-technical (default-safe
322
- // when no profile exists yet; never guards a fully `technical` user). Materialized +
322
+ // when no profile exists yet). Technical profiles confirm the high-risk subset. Materialized +
323
323
  // node-run (Windows-safe), idempotent, fail-open, opt-out via .rsc/.no-danger-guard.
324
324
  const dgDest = join(paths.projectRoot, '.rsc', 'danger-guard.mjs');
325
325
  copyFileSync(join(HERE, 'danger-guard.mjs'), dgDest);
326
326
  const dgCmd = viaBootstrap('guard', at('.rsc', 'danger-guard.mjs'), `"${P}"`);
327
- settings.hooks.PreToolUse.push({ matcher: 'Bash', hooks: [{ type: 'command', command: dgCmd }] });
327
+ settings.hooks.PreToolUse.push({ matcher: 'Bash|PowerShell', hooks: [{ type: 'command', command: dgCmd }] });
328
328
  written.push(dgDest);
329
329
  } else {
330
330
  rmSync(join(paths.projectRoot, '.rsc', 'danger-guard.mjs'), { force: true });
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- // rsc Danger guard (claude). Wired by targets/claude.js onto PreToolUse (matcher Bash)
2
+ // rsc Danger guard (claude). Wired by targets/claude.js onto PreToolUse (matcher Bash|PowerShell)
3
3
  // as `node ...` so it runs on every platform including Windows.
4
4
  // argv[2] = absolute project root stdin = PreToolUse hook JSON
5
5
  //
6
6
  // For a NON-TECHNICAL user (per 02-DOCS/wiki/harness/user-profile.md → technical_level),
7
- // it DENIES irreversible, foot-gun Bash commands and tells the agent to find a safer,
7
+ // it DENIES irreversible, foot-gun shell commands and tells the agent to find a safer,
8
8
  // scoped alternative. Default-safe: if there is no profile yet, the harness convention is
9
9
  // "assume non-technical", so the guard is ON.
10
10
  //
@@ -17,7 +17,8 @@
17
17
  // Disable per project with .rsc/.no-danger-guard — but only when the USER explicitly asks
18
18
  // for it (the deny message says so). Fail-open on any internal error (never brick a shell).
19
19
  import { existsSync, readFileSync } from 'node:fs';
20
- import { join } from 'node:path';
20
+ import { homedir } from 'node:os';
21
+ import { join, win32 } from 'node:path';
21
22
 
22
23
  const root = process.argv[2] || process.cwd();
23
24
 
@@ -68,12 +69,75 @@ function technicalLevel() {
68
69
  }
69
70
  const technical = technicalLevel() === 'technical';
70
71
 
71
- // Only Bash commands can be dangerous here.
72
+ // Claude sends the same command field for either shell.
72
73
  let input = {};
73
74
  try { input = JSON.parse(readFileSync(0, 'utf8') || '{}'); } catch { allow(); }
74
- if ((input.tool_name || input.toolName) !== 'Bash') allow();
75
- const cmd = input.tool_input?.command || input.toolInput?.command || '';
76
- if (typeof cmd !== 'string' || !cmd) allow();
75
+ const tool = input.tool_name || input.toolName;
76
+ if (tool !== 'Bash' && tool !== 'PowerShell') allow();
77
+ const command = input.tool_input?.command || input.toolInput?.command || '';
78
+ if (typeof command !== 'string' || !command) allow();
79
+
80
+ // Read literal arguments of direct PowerShell commands. A backslash is a path separator in
81
+ // this shell. Quoted paths stay together and quoted text is never split at a semicolon.
82
+ function powerShellCommands(line) {
83
+ const commands = [];
84
+ let words = [];
85
+ let invoke = false;
86
+ for (const [token] of line.matchAll(/`\r?\n|#[^\r\n]*|'(?:''|[^'])*'|"(?:`[\s\S]|""|[^"`])*"|[;|&\r\n]|(?:`[\s\S]|[^\s;|&'"`])+/g)) {
87
+ if (/^`\r?\n$/.test(token) || token.startsWith('#')) continue;
88
+ if (/^[;|&\r\n]$/.test(token)) {
89
+ if (words.length) commands.push(words);
90
+ words = [];
91
+ invoke = token === '&';
92
+ } else {
93
+ words.push(invoke ? token.replace(/^(['"])(.*)\1$/, '$2') : token);
94
+ invoke = false;
95
+ }
96
+ }
97
+ if (words.length) commands.push(words);
98
+ return commands;
99
+ }
100
+
101
+ function protectedPowerShellPath(raw) {
102
+ const path = raw.replace(/^(['"])(.*)\1$/, '$2').replace(/\//g, '\\');
103
+ const target = win32.normalize(path).replace(/\\(?:\*)?$/, '').toLowerCase();
104
+ if (['.', '..', '*', '.git', '~'].includes(target)) return true;
105
+ if (!raw.startsWith("'") && ['$home', '$env:userprofile'].includes(target)) return true;
106
+ const absolute = win32.isAbsolute(path);
107
+ if (!absolute) return false;
108
+ const same = (value) => target === win32.normalize(value).replace(/\\$/, '').toLowerCase();
109
+ return same(win32.parse(path).root) || same(root) || same(homedir());
110
+ }
111
+
112
+ // Option values such as the include filter or the output variable are not deletion targets.
113
+ const PS_REMOVE_VALUE = /^-(?:filter|include|exclude|credential|erroraction|warningaction|informationaction|progressaction|errorvariable|warningvariable|informationvariable|outvariable|pipelinevariable|outbuffer)$/i;
114
+ function protectedRemoval(args) {
115
+ for (let i = 0; i < args.length; i++) {
116
+ const arg = args[i];
117
+ if (PS_REMOVE_VALUE.test(arg)) { i++; continue; }
118
+ if (!arg.startsWith('-') && protectedPowerShellPath(arg)) return true;
119
+ }
120
+ return false;
121
+ }
122
+
123
+ const psCommands = tool === 'PowerShell' ? powerShellCommands(command) : null;
124
+ if (psCommands) {
125
+ for (const [name, ...args] of psCommands) {
126
+ if (!/^(?:Microsoft\.PowerShell\.Management\\)?(?:Remove-Item|rm|ri|del|erase|rd|rmdir)$/i.test(name)) continue;
127
+ const flag = (key) => args.some((arg) => arg.toLowerCase() === key || arg.toLowerCase() === key + ':$true');
128
+ if (!flag('-recurse') || !flag('-force') || flag('-whatif')) continue;
129
+ const why = 'recursively deletes files and folders with PowerShell';
130
+ if (!technical) deny(why);
131
+ if (protectedRemoval(args)) ask(why);
132
+ }
133
+ }
134
+
135
+ // PowerShell output commands and standalone string literals only display their text. Other
136
+ // segments still reach the shared rules, including external database clients and disk tools.
137
+ const cmd = psCommands
138
+ ? psCommands.filter(([name]) => !/^(?:['"]|(?:echo|write-(?:output|host|verbose|warning|information|debug|error))$)/i.test(name))
139
+ .map((words) => words.join(' ')).join('; ')
140
+ : command;
77
141
 
78
142
  // --- the dangerous-command list ---------------------------------------------
79
143
  // High-signal, low-false-positive. Each rule: what it catches and the plain why.
@@ -138,11 +202,13 @@ const runSegments = () => {
138
202
 
139
203
  // A git rule judges the segment that RUNS git, so `echo 'git reset --hard'` is a sentence, not a reset.
140
204
  function gitSegment(re) {
205
+ if (psCommands) return psCommands.some(([name, ...args]) =>
206
+ /(?:^|[\\/])git(?:\.exe)?$/i.test(name) && re.test(['git', ...args].join(' ')));
141
207
  return runSegments().some((segment) => runs(segment, 'git') && re.test(segment));
142
208
  }
143
209
 
144
210
  function isRmRecursiveForce() {
145
- if (!/\brm\b/.test(cmd)) return false;
211
+ if (psCommands || !/\brm\b/.test(cmd)) return false;
146
212
  for (const segment of runSegments()) {
147
213
  if (!runsRm(segment)) continue;
148
214
  const flags = rmFlagsIn(segment);