pruff-skills 1.5.0 → 1.5.1

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 (2) hide show
  1. package/dist/cli.mjs +30 -0
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -6384,6 +6384,25 @@ function applyOwnedEnv(settings, desired, previouslyOwned) {
6384
6384
  keptUserValues
6385
6385
  };
6386
6386
  }
6387
+ function addAllowEntries(settings, permissionAllow, autoModeAllow) {
6388
+ const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
6389
+ const strings = (value) => Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
6390
+ const merge = (current, added) => [...current, ...added.filter((entry) => !current.includes(entry))];
6391
+ const permissions = isObject(settings.permissions) ? settings.permissions : {};
6392
+ const autoMode = isObject(settings.autoMode) ? settings.autoMode : {};
6393
+ const currentAutoAllow = Array.isArray(autoMode.allow) ? strings(autoMode.allow) : ["$defaults"];
6394
+ return {
6395
+ ...settings,
6396
+ permissions: {
6397
+ ...permissions,
6398
+ allow: merge(strings(permissions.allow), permissionAllow)
6399
+ },
6400
+ autoMode: {
6401
+ ...autoMode,
6402
+ allow: merge(currentAutoAllow, autoModeAllow)
6403
+ }
6404
+ };
6405
+ }
6387
6406
  const HOOK_EVENTS = [
6388
6407
  "PreToolUse",
6389
6408
  "PostToolUse",
@@ -6648,6 +6667,8 @@ const DB_READER_SECRET_PREFIX = "pruff/db-reader/";
6648
6667
  const DB_READER_ALLOW_ENTRY = "Bash(pruff-db-query:*)";
6649
6668
  const DB_READER_VERIFY_DATABASE = "pruff-sii";
6650
6669
  const DB_READER_SKILL = "prod-db-query";
6670
+ const DB_READER_USER_ALLOW = ["Bash(pruff-db-query:*)", "Bash(pruff-db-verify:*)"];
6671
+ const DB_READER_AUTO_MODE_ALLOW = "Read-only production queries through the pruff-db-query wrapper are allowed, including loops and pipes that run it across tenant databases: it connects as the engineer's personal SELECT-only MySQL user (no write grants, verified TLS, 5-connection cap), so it cannot modify production. This never covers Prisma with prod.env, mysql -u admin, the RDS host directly, or any write.";
6651
6672
  const DB_READER_SCRIPTS = ["pruff-db-query", "pruff-db-verify"];
6652
6673
  const RDS_CA_URL = `https://truststore.pki.rds.amazonaws.com/${DB_READER_REGION}/${DB_READER_REGION}-bundle.pem`;
6653
6674
  const MAX_SUGGESTED_NAME_LENGTH = 23;
@@ -6776,6 +6797,14 @@ function mergeAllowlist(workspace) {
6776
6797
  renameSync(tmp, path);
6777
6798
  return "added";
6778
6799
  }
6800
+ function allowInUserSettings(note) {
6801
+ try {
6802
+ writeClaudeSettings$1(addAllowEntries(readClaudeSettings$1(), DB_READER_USER_ALLOW, [DB_READER_AUTO_MODE_ALLOW]));
6803
+ M.success("pruff-db-query allowed in every folder, auto mode included");
6804
+ } catch (error) {
6805
+ note(`Could not update ~/.claude/settings.json (${error instanceof Error ? error.message : String(error)}). Auto mode may deny pruff-db-query with [Production Reads]: add ${import_picocolors.default.cyan(DB_READER_ALLOW_ENTRY)} to permissions.allow and an autoMode.allow rule for it by hand.`);
6806
+ }
6807
+ }
6779
6808
  async function installReaderSkill(workspace, note) {
6780
6809
  if (existsSync(join(workspace, ".claude", "skills", DB_READER_SKILL, "SKILL.md"))) return;
6781
6810
  const prevCwd = process.cwd();
@@ -6870,6 +6899,7 @@ async function setupDbReader({ workspace, note }) {
6870
6899
  if (mergeAllowlist(workspace) === "invalid") note(`Add ${import_picocolors.default.cyan(DB_READER_ALLOW_ENTRY)} to permissions.allow in ${join(workspace, ".claude", "settings.json")} by hand — the file is not valid JSON.`);
6871
6900
  const hooks = await installHooks(["prod-db-guard"]);
6872
6901
  for (const failure of hooks.failed) note(`Hook ${failure.name} not installed: ${failure.reason}`);
6902
+ allowInUserSettings(note);
6873
6903
  await installReaderSkill(workspace, note);
6874
6904
  if (!existsSync(join(workspace, ".claude", "rules", "prod-db-reads.md"))) note(`The prod-db-reads rule is missing from the workspace — run ${import_picocolors.default.cyan("npx pruff-skills rules add --all")} from ${workspace}.`);
6875
6905
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruff-skills",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "The official Pruff agent skills CLI",
5
5
  "type": "module",
6
6
  "bin": {