@sdkurjnk/blackshell 0.3.3 → 0.4.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/README.md +2 -2
- package/dist/cli.js +27 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Units are **source files**. git-style staging — stage units, then seal the set
|
|
|
49
49
|
|
|
50
50
|
```sh
|
|
51
51
|
blackshell check <source> # preview: is this region eligible? (gate only)
|
|
52
|
-
blackshell add <source> --level
|
|
52
|
+
blackshell add <source> --level 2 # stage a unit (N=1..3, cumulative L1..LN; default 3)
|
|
53
53
|
blackshell list # show staged units and levels
|
|
54
54
|
blackshell drop <source> # unstage
|
|
55
55
|
blackshell enshell # seal all staged units -> object files
|
|
@@ -58,7 +58,7 @@ blackshell enshell # seal all staged units -> object files
|
|
|
58
58
|
Example:
|
|
59
59
|
|
|
60
60
|
```sh
|
|
61
|
-
blackshell add src/engine/examples/add2.c --level
|
|
61
|
+
blackshell add src/engine/examples/add2.c --level 2
|
|
62
62
|
blackshell enshell
|
|
63
63
|
```
|
|
64
64
|
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ const pkg = JSON.parse(readFileSync(here("../package.json"), "utf8"));
|
|
|
13
13
|
const USAGE = `blackshell <command> [options]
|
|
14
14
|
|
|
15
15
|
check <source> Gate verdict only (dummy: accept-all)
|
|
16
|
-
add <source> [--level
|
|
16
|
+
add <source> [--level N] Stage a unit for sealing (N = strength 1..3, cumulative L1..LN; default 3)
|
|
17
17
|
drop <source> Unstage a unit
|
|
18
18
|
list Show staged units and their levels
|
|
19
19
|
enshell Seal every staged unit -> object files
|
|
@@ -31,6 +31,18 @@ export function writeStage(units) {
|
|
|
31
31
|
mkdirSync(".blackshell", { recursive: true });
|
|
32
32
|
writeFileSync(STAGE_FILE, JSON.stringify(units, null, 2) + "\n");
|
|
33
33
|
}
|
|
34
|
+
const MAX_LEVEL = 3; // L1..L3 are the noising dials defined in the plan §6.
|
|
35
|
+
// User-facing dial "N" -> the cumulative set {L1..LN} the engine consumes.
|
|
36
|
+
// The levels stay an orthogonal set in the engine/harness (§9 per-pass toggle);
|
|
37
|
+
// this ladder is only the simple front-door UX. undefined -> full strength.
|
|
38
|
+
// Returns null on an invalid dial so the caller can reject at the boundary.
|
|
39
|
+
export function expandLevel(value) {
|
|
40
|
+
const n = value === undefined ? MAX_LEVEL : Number(value);
|
|
41
|
+
if (!Number.isInteger(n) || n < 1 || n > MAX_LEVEL) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return Array.from({ length: n }, (_, i) => `L${i + 1}`);
|
|
45
|
+
}
|
|
34
46
|
export function showLevels(levels) {
|
|
35
47
|
if (levels.length === 0) {
|
|
36
48
|
return "L0 (identity)";
|
|
@@ -123,6 +135,14 @@ export function onePositional(rest) {
|
|
|
123
135
|
}
|
|
124
136
|
return positionals[0];
|
|
125
137
|
}
|
|
138
|
+
// engine argv for sealing one unit; forwards the staged levels (empty = L0).
|
|
139
|
+
export function enshellArgs(u) {
|
|
140
|
+
const args = ["enshell", u.path];
|
|
141
|
+
if (u.levels.length > 0) {
|
|
142
|
+
args.push("--level", u.levels.join(","));
|
|
143
|
+
}
|
|
144
|
+
return args;
|
|
145
|
+
}
|
|
126
146
|
// --- commands ---
|
|
127
147
|
function cmdCheck(rest) {
|
|
128
148
|
const src = onePositional(rest);
|
|
@@ -145,7 +165,11 @@ function cmdAdd(rest) {
|
|
|
145
165
|
console.error(`error: file not found: ${src}`);
|
|
146
166
|
return 1;
|
|
147
167
|
}
|
|
148
|
-
const levels = opt.value
|
|
168
|
+
const levels = expandLevel(opt.value);
|
|
169
|
+
if (levels === null) {
|
|
170
|
+
console.error(`error: --level must be an integer 1..${MAX_LEVEL}`);
|
|
171
|
+
return 1;
|
|
172
|
+
}
|
|
149
173
|
const units = readStage().filter((u) => u.path !== src);
|
|
150
174
|
units.push({ path: src, levels });
|
|
151
175
|
writeStage(units);
|
|
@@ -187,7 +211,7 @@ function cmdEnshell() {
|
|
|
187
211
|
}
|
|
188
212
|
let code = 0;
|
|
189
213
|
for (const u of units) {
|
|
190
|
-
const { token, status } = engine(
|
|
214
|
+
const { token, status } = engine(enshellArgs(u));
|
|
191
215
|
emit(token);
|
|
192
216
|
if (status !== 0) {
|
|
193
217
|
code = status;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdkurjnk/blackshell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Build-stage protection tool that seals critical code regions at the compiler IR level, communicating with the outside only by value.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"typescript": "^7.0.2"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@sdkurjnk/blackshell-darwin-arm64": "0.
|
|
49
|
-
"@sdkurjnk/blackshell-darwin-x64": "0.
|
|
50
|
-
"@sdkurjnk/blackshell-linux-arm64": "0.
|
|
51
|
-
"@sdkurjnk/blackshell-linux-x64": "0.
|
|
52
|
-
"@sdkurjnk/blackshell-win32-x64": "0.
|
|
48
|
+
"@sdkurjnk/blackshell-darwin-arm64": "0.4.0",
|
|
49
|
+
"@sdkurjnk/blackshell-darwin-x64": "0.4.0",
|
|
50
|
+
"@sdkurjnk/blackshell-linux-arm64": "0.4.0",
|
|
51
|
+
"@sdkurjnk/blackshell-linux-x64": "0.4.0",
|
|
52
|
+
"@sdkurjnk/blackshell-win32-x64": "0.4.0"
|
|
53
53
|
}
|
|
54
54
|
}
|