@oked/sdk 0.2.1 → 0.3.0
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/classify.js +9 -3
- package/package.json +1 -1
package/dist/classify.js
CHANGED
|
@@ -19,7 +19,7 @@ import { TIER_ORDER } from "./degraded.js";
|
|
|
19
19
|
// dirs, OKed's own config), sudo, outward message/email sends.
|
|
20
20
|
// Tier 4 - high_stakes: push + number matching. Destructive / irreversible /
|
|
21
21
|
// external: rm of non-temp data, DROP/TRUNCATE/DELETE FROM,
|
|
22
|
-
// git push / reset --hard / branch -D, mkfs / dd-to-device /
|
|
22
|
+
// git push --force / reset --hard / branch -D, mkfs / dd-to-device /
|
|
23
23
|
// shutdown, curl POST/DELETE, ssh/scp, npm publish, kill.
|
|
24
24
|
// Tools that are always safe (read-only, no side effects)
|
|
25
25
|
const SAFE_TOOLS = new Set([
|
|
@@ -75,7 +75,9 @@ const DELETE_PATTERNS = [
|
|
|
75
75
|
// Scanned on the FULL command (some patterns, e.g. download|shell, span a pipe).
|
|
76
76
|
// File deletion lives in DELETE_PATTERNS (per-stage) instead, see above.
|
|
77
77
|
const HIGH_STAKES_COMMANDS = [
|
|
78
|
-
|
|
78
|
+
// Force push rewrites remote history irreversibly. A plain push is downgraded
|
|
79
|
+
// to `warning` in WARNING_COMMANDS below. Mirrors describe.ts force detection.
|
|
80
|
+
/\bgit\s+push\b[^\n]*\s(?:--force(?:-with-lease)?|-f)\b/,
|
|
79
81
|
/\bgit\s+reset\s+--hard\b/,
|
|
80
82
|
/\bgit\s+clean\s+-f/,
|
|
81
83
|
/\bgit\s+checkout\s+--\s+\./,
|
|
@@ -169,12 +171,16 @@ const REVIEW_COMMANDS = [
|
|
|
169
171
|
const WARNING_COMMANDS = [
|
|
170
172
|
// Local, reversible git writes — stage/commit/switch/stash. They mutate the
|
|
171
173
|
// local repo but can be undone (amend, reset, checkout). Destructive git
|
|
172
|
-
// (push, reset --hard, branch -D, stash drop/clear) is caught above and wins.
|
|
174
|
+
// (force push, reset --hard, branch -D, stash drop/clear) is caught above and wins.
|
|
173
175
|
/^git\s+add\b/,
|
|
174
176
|
/^git\s+commit\b/,
|
|
175
177
|
/^git\s+checkout\s+-b\b/,
|
|
176
178
|
/^git\s+switch\b/,
|
|
177
179
|
/^git\s+stash\b(?!\s+(?:drop|clear))/,
|
|
180
|
+
// Plain push (no force). Outward, but the remote keeps full history and the
|
|
181
|
+
// push is recoverable, so by policy it logs rather than prompts. Force push is
|
|
182
|
+
// high_stakes in the full scan above and wins before reaching here.
|
|
183
|
+
/^git\s+push\b/,
|
|
178
184
|
/^gh\s+pr\s+create\b/,
|
|
179
185
|
// Package installs always mutate node_modules and run dependency postinstall
|
|
180
186
|
// scripts — a known local mutation worth an audit line.
|