claude-warden 1.1.4 → 1.1.6
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/dist/index.cjs +156 -74
- package/package.json +11 -10
package/dist/index.cjs
CHANGED
|
@@ -18784,6 +18784,144 @@ var import_os = require("os");
|
|
|
18784
18784
|
var import_path2 = require("path");
|
|
18785
18785
|
|
|
18786
18786
|
// src/defaults.ts
|
|
18787
|
+
var SAFE_DEV_TOOLS = [
|
|
18788
|
+
"jest",
|
|
18789
|
+
"vitest",
|
|
18790
|
+
"tsc",
|
|
18791
|
+
"eslint",
|
|
18792
|
+
"prettier",
|
|
18793
|
+
"mkdirp",
|
|
18794
|
+
"concurrently",
|
|
18795
|
+
"turbo",
|
|
18796
|
+
"next",
|
|
18797
|
+
"nuxt",
|
|
18798
|
+
"vite",
|
|
18799
|
+
"astro",
|
|
18800
|
+
"playwright",
|
|
18801
|
+
"cypress",
|
|
18802
|
+
"mocha",
|
|
18803
|
+
"nyc",
|
|
18804
|
+
"c8",
|
|
18805
|
+
"ts-jest",
|
|
18806
|
+
"tsup",
|
|
18807
|
+
"esbuild",
|
|
18808
|
+
"rollup",
|
|
18809
|
+
"webpack",
|
|
18810
|
+
"prisma",
|
|
18811
|
+
"drizzle-kit",
|
|
18812
|
+
"typeorm",
|
|
18813
|
+
"knex",
|
|
18814
|
+
"sequelize-cli",
|
|
18815
|
+
"tailwindcss",
|
|
18816
|
+
"postcss",
|
|
18817
|
+
"autoprefixer",
|
|
18818
|
+
"lint-staged",
|
|
18819
|
+
"husky",
|
|
18820
|
+
"changeset",
|
|
18821
|
+
"semantic-release",
|
|
18822
|
+
"lerna",
|
|
18823
|
+
"nx",
|
|
18824
|
+
"create-react-app",
|
|
18825
|
+
"create-next-app",
|
|
18826
|
+
"create-vite",
|
|
18827
|
+
"degit",
|
|
18828
|
+
"storybook",
|
|
18829
|
+
"wrangler",
|
|
18830
|
+
"netlify",
|
|
18831
|
+
"vercel",
|
|
18832
|
+
"json"
|
|
18833
|
+
];
|
|
18834
|
+
var SCRIPT_RUNNERS = ["tsx", "ts-node", "nodemon"];
|
|
18835
|
+
var REGISTRY_OPS = ["publish", "unpublish", "deprecate", "owner", "access", "token", "adduser", "login", "logout"];
|
|
18836
|
+
var SAFE_PKG_MANAGER_CMDS = [
|
|
18837
|
+
"install",
|
|
18838
|
+
"add",
|
|
18839
|
+
"remove",
|
|
18840
|
+
"uninstall",
|
|
18841
|
+
"update",
|
|
18842
|
+
"upgrade",
|
|
18843
|
+
"outdated",
|
|
18844
|
+
"ls",
|
|
18845
|
+
"list",
|
|
18846
|
+
"run",
|
|
18847
|
+
"test",
|
|
18848
|
+
"start",
|
|
18849
|
+
"build",
|
|
18850
|
+
"init",
|
|
18851
|
+
"create",
|
|
18852
|
+
"info",
|
|
18853
|
+
"view",
|
|
18854
|
+
"show",
|
|
18855
|
+
"why",
|
|
18856
|
+
"pack",
|
|
18857
|
+
"cache",
|
|
18858
|
+
"config",
|
|
18859
|
+
"get",
|
|
18860
|
+
"set",
|
|
18861
|
+
"version",
|
|
18862
|
+
"help",
|
|
18863
|
+
"exec",
|
|
18864
|
+
"dedupe",
|
|
18865
|
+
"prune",
|
|
18866
|
+
"audit",
|
|
18867
|
+
"completion"
|
|
18868
|
+
];
|
|
18869
|
+
var VERSION_HELP_FLAGS = {
|
|
18870
|
+
match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] },
|
|
18871
|
+
decision: "allow",
|
|
18872
|
+
description: "Version/help flags"
|
|
18873
|
+
};
|
|
18874
|
+
function anyArgMatchesPattern(items) {
|
|
18875
|
+
return `^(${items.join("|")})$`;
|
|
18876
|
+
}
|
|
18877
|
+
function safeDevToolsPattern() {
|
|
18878
|
+
return {
|
|
18879
|
+
match: { anyArgMatches: [anyArgMatchesPattern(SAFE_DEV_TOOLS)] },
|
|
18880
|
+
decision: "allow",
|
|
18881
|
+
description: "Well-known dev tools"
|
|
18882
|
+
};
|
|
18883
|
+
}
|
|
18884
|
+
function scriptRunnersPattern() {
|
|
18885
|
+
return {
|
|
18886
|
+
match: { anyArgMatches: [anyArgMatchesPattern(SCRIPT_RUNNERS)] },
|
|
18887
|
+
decision: "ask",
|
|
18888
|
+
reason: "Script runners can execute arbitrary code"
|
|
18889
|
+
};
|
|
18890
|
+
}
|
|
18891
|
+
function registryOpsPattern() {
|
|
18892
|
+
return {
|
|
18893
|
+
match: { anyArgMatches: [anyArgMatchesPattern(REGISTRY_OPS)] },
|
|
18894
|
+
decision: "ask",
|
|
18895
|
+
reason: "Registry modification"
|
|
18896
|
+
};
|
|
18897
|
+
}
|
|
18898
|
+
function pkgManagerRule(command, extraSafeCmds = []) {
|
|
18899
|
+
const safeCmds = [...SAFE_PKG_MANAGER_CMDS, ...extraSafeCmds];
|
|
18900
|
+
return {
|
|
18901
|
+
command,
|
|
18902
|
+
default: "ask",
|
|
18903
|
+
argPatterns: [
|
|
18904
|
+
registryOpsPattern(),
|
|
18905
|
+
{
|
|
18906
|
+
match: { anyArgMatches: [anyArgMatchesPattern(safeCmds)] },
|
|
18907
|
+
decision: "allow",
|
|
18908
|
+
description: `Standard ${command} commands`
|
|
18909
|
+
},
|
|
18910
|
+
VERSION_HELP_FLAGS
|
|
18911
|
+
]
|
|
18912
|
+
};
|
|
18913
|
+
}
|
|
18914
|
+
function pkgRunnerRule(command) {
|
|
18915
|
+
return {
|
|
18916
|
+
command,
|
|
18917
|
+
default: "ask",
|
|
18918
|
+
argPatterns: [
|
|
18919
|
+
safeDevToolsPattern(),
|
|
18920
|
+
scriptRunnersPattern(),
|
|
18921
|
+
VERSION_HELP_FLAGS
|
|
18922
|
+
]
|
|
18923
|
+
};
|
|
18924
|
+
}
|
|
18787
18925
|
var DEFAULT_CONFIG = {
|
|
18788
18926
|
defaultDecision: "ask",
|
|
18789
18927
|
askOnSubshell: true,
|
|
@@ -18945,27 +19083,13 @@ var DEFAULT_CONFIG = {
|
|
|
18945
19083
|
]
|
|
18946
19084
|
},
|
|
18947
19085
|
// --- Shell interpreters ---
|
|
18948
|
-
{
|
|
18949
|
-
command:
|
|
18950
|
-
default: "ask",
|
|
18951
|
-
argPatterns: [
|
|
18952
|
-
{ match: { anyArgMatches: ["^--(version|help)$"] }, decision: "allow", description: "Version/help flags" }
|
|
18953
|
-
]
|
|
18954
|
-
},
|
|
18955
|
-
{
|
|
18956
|
-
command: "sh",
|
|
18957
|
-
default: "ask",
|
|
18958
|
-
argPatterns: [
|
|
18959
|
-
{ match: { anyArgMatches: ["^--(version|help)$"] }, decision: "allow", description: "Version/help flags" }
|
|
18960
|
-
]
|
|
18961
|
-
},
|
|
18962
|
-
{
|
|
18963
|
-
command: "zsh",
|
|
19086
|
+
...["bash", "sh", "zsh"].map((cmd) => ({
|
|
19087
|
+
command: cmd,
|
|
18964
19088
|
default: "ask",
|
|
18965
19089
|
argPatterns: [
|
|
18966
19090
|
{ match: { anyArgMatches: ["^--(version|help)$"] }, decision: "allow", description: "Version/help flags" }
|
|
18967
19091
|
]
|
|
18968
|
-
},
|
|
19092
|
+
})),
|
|
18969
19093
|
// --- Node.js ecosystem ---
|
|
18970
19094
|
{
|
|
18971
19095
|
command: "node",
|
|
@@ -18976,74 +19100,32 @@ var DEFAULT_CONFIG = {
|
|
|
18976
19100
|
{ match: { noArgs: true }, decision: "ask", reason: "Interactive REPL" }
|
|
18977
19101
|
]
|
|
18978
19102
|
},
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
},
|
|
18988
|
-
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" }
|
|
18989
|
-
]
|
|
18990
|
-
},
|
|
18991
|
-
{
|
|
18992
|
-
command: "bunx",
|
|
18993
|
-
default: "ask",
|
|
18994
|
-
argPatterns: [
|
|
18995
|
-
{
|
|
18996
|
-
match: { anyArgMatches: ["^(jest|vitest|tsx|ts-node|tsc|eslint|prettier|mkdirp|concurrently|turbo|next|nuxt|vite|astro|playwright|cypress|mocha|nyc|c8|nodemon|ts-jest|tsup|esbuild|rollup|webpack|prisma|drizzle-kit|typeorm|knex|sequelize-cli|tailwindcss|postcss|autoprefixer|lint-staged|husky|changeset|semantic-release|lerna|nx|create-react-app|create-next-app|create-vite|degit|storybook|wrangler|netlify|vercel)$"] },
|
|
18997
|
-
decision: "allow",
|
|
18998
|
-
description: "Well-known dev tools"
|
|
18999
|
-
},
|
|
19000
|
-
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" }
|
|
19001
|
-
]
|
|
19002
|
-
},
|
|
19003
|
-
{
|
|
19004
|
-
command: "npm",
|
|
19005
|
-
default: "allow",
|
|
19006
|
-
argPatterns: [
|
|
19007
|
-
{ match: { anyArgMatches: ["^(publish|unpublish|deprecate|owner|access|token|adduser|login)$"] }, decision: "ask", reason: "Registry modification" }
|
|
19008
|
-
]
|
|
19009
|
-
},
|
|
19010
|
-
{
|
|
19011
|
-
command: "pnpm",
|
|
19012
|
-
default: "allow",
|
|
19013
|
-
argPatterns: [
|
|
19014
|
-
{ match: { anyArgMatches: ["^(publish|unpublish|deprecate|owner|access|token|adduser|login)$"] }, decision: "ask", reason: "Registry modification" }
|
|
19015
|
-
]
|
|
19016
|
-
},
|
|
19017
|
-
{
|
|
19018
|
-
command: "yarn",
|
|
19019
|
-
default: "allow",
|
|
19020
|
-
argPatterns: [
|
|
19021
|
-
{ match: { anyArgMatches: ["^(publish|unpublish|owner|access|token|login|logout)$"] }, decision: "ask", reason: "Registry modification" }
|
|
19022
|
-
]
|
|
19023
|
-
},
|
|
19103
|
+
// npx / bunx — package runners
|
|
19104
|
+
pkgRunnerRule("npx"),
|
|
19105
|
+
pkgRunnerRule("bunx"),
|
|
19106
|
+
// npm / pnpm / yarn — package managers
|
|
19107
|
+
pkgManagerRule("npm", ["ci", "search", "explain", "prefix", "root", "fund", "doctor", "diff", "pkg", "query", "shrinkwrap"]),
|
|
19108
|
+
pkgManagerRule("pnpm", ["store", "fetch", "doctor", "patch"]),
|
|
19109
|
+
pkgManagerRule("yarn", ["up", "dlx", "workspaces"]),
|
|
19110
|
+
// bun — runtime + package manager
|
|
19024
19111
|
{
|
|
19025
19112
|
command: "bun",
|
|
19026
19113
|
default: "ask",
|
|
19027
19114
|
argPatterns: [
|
|
19028
|
-
{ match: { anyArgMatches: ["
|
|
19029
|
-
|
|
19115
|
+
{ match: { anyArgMatches: [anyArgMatchesPattern([...SAFE_PKG_MANAGER_CMDS, "ci", "pm", "x", "link", "unlink"])] }, decision: "allow", description: "Standard bun commands" },
|
|
19116
|
+
safeDevToolsPattern(),
|
|
19117
|
+
scriptRunnersPattern(),
|
|
19118
|
+
VERSION_HELP_FLAGS
|
|
19030
19119
|
]
|
|
19031
19120
|
},
|
|
19032
19121
|
// --- Python ---
|
|
19033
|
-
{
|
|
19034
|
-
command:
|
|
19122
|
+
...["python", "python3"].map((cmd) => ({
|
|
19123
|
+
command: cmd,
|
|
19035
19124
|
default: "ask",
|
|
19036
19125
|
argPatterns: [
|
|
19037
19126
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19038
19127
|
]
|
|
19039
|
-
},
|
|
19040
|
-
{
|
|
19041
|
-
command: "python3",
|
|
19042
|
-
default: "ask",
|
|
19043
|
-
argPatterns: [
|
|
19044
|
-
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19045
|
-
]
|
|
19046
|
-
},
|
|
19128
|
+
})),
|
|
19047
19129
|
{ command: "pip", default: "allow" },
|
|
19048
19130
|
{ command: "pip3", default: "allow" },
|
|
19049
19131
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-warden",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Smart command safety filter for Claude Code — auto-approves safe commands, blocks dangerous ones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -28,6 +28,15 @@
|
|
|
28
28
|
"README.md",
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"dev": "tsup --watch",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"eval": "node dist/index.cjs",
|
|
38
|
+
"prepublishOnly": "pnpm run build && pnpm run test"
|
|
39
|
+
},
|
|
31
40
|
"devDependencies": {
|
|
32
41
|
"@types/node": "^20.0.0",
|
|
33
42
|
"bash-parser": "^0.5.0",
|
|
@@ -35,13 +44,5 @@
|
|
|
35
44
|
"typescript": "^5.4.0",
|
|
36
45
|
"vitest": "^1.6.0",
|
|
37
46
|
"yaml": "^2.4.0"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "tsup",
|
|
41
|
-
"dev": "tsup --watch",
|
|
42
|
-
"test": "vitest run",
|
|
43
|
-
"test:watch": "vitest",
|
|
44
|
-
"typecheck": "tsc --noEmit",
|
|
45
|
-
"eval": "node dist/index.cjs"
|
|
46
47
|
}
|
|
47
|
-
}
|
|
48
|
+
}
|