rubik 0.8.1 → 0.9.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.
- checksums.yaml +4 -4
- data/ATTRIBUTION.md +2 -2
- data/CHANGELOG.md +100 -1
- data/bin/rubik +15 -10
- data/lib/rubik/cli/workspace_trust.rb +1 -0
- data/lib/rubik/concurrency/worker.rb +143 -0
- data/lib/rubik/concurrency.rb +1 -0
- data/lib/rubik/config/deep_ops.rb +17 -0
- data/lib/rubik/config/defaults.rb +0 -1
- data/lib/rubik/config/schema.rb +0 -1
- data/lib/rubik/config.rb +7 -3
- data/lib/rubik/context/repo_context_reader.rb +27 -8
- data/lib/rubik/events.rb +18 -0
- data/lib/rubik/kernel/unit.rb +4 -3
- data/lib/rubik/orchestrator/auto_apply.rb +2 -0
- data/lib/rubik/orchestrator/budget_manager.rb +18 -2
- data/lib/rubik/orchestrator/goal_ledger/deep_ops.rb +41 -0
- data/lib/rubik/orchestrator/goal_ledger/drift.rb +2 -1
- data/lib/rubik/orchestrator/goal_ledger/ledger.rb +56 -50
- data/lib/rubik/orchestrator/goal_ledger/observation_projection.rb +26 -0
- data/lib/rubik/orchestrator/goal_ledger/patch.rb +10 -17
- data/lib/rubik/orchestrator/goal_ledger/suspend_lifecycle.rb +9 -41
- data/lib/rubik/orchestrator/goal_ledger/validator.rb +6 -20
- data/lib/rubik/orchestrator/goal_ledger/verifier.rb +3 -14
- data/lib/rubik/orchestrator/goal_ledger/xml_render.rb +21 -14
- data/lib/rubik/orchestrator/goal_state.rb +15 -15
- data/lib/rubik/orchestrator/loop.rb +62 -63
- data/lib/rubik/orchestrator/lsp_feedback.rb +7 -1
- data/lib/rubik/orchestrator/subagent/admission_policy.rb +161 -0
- data/lib/rubik/orchestrator/subagent/builtin_types.rb +3 -2
- data/lib/rubik/orchestrator/subagent/notices.rb +5 -4
- data/lib/rubik/orchestrator/subagent/profile_contract.rb +4 -10
- data/lib/rubik/orchestrator/subagent/run_cycle.rb +22 -1
- data/lib/rubik/orchestrator/subagent/scoped_registry.rb +34 -2
- data/lib/rubik/orchestrator/subagent/type_registry.rb +19 -1
- data/lib/rubik/orchestrator/turn_executor/subagent_channel.rb +6 -1
- data/lib/rubik/orchestrator/turn_executor/user_channel.rb +6 -1
- data/lib/rubik/orchestrator/turn_executor.rb +2 -1
- data/lib/rubik/platform/path.rb +0 -1
- data/lib/rubik/prompt/context_builder.rb +24 -18
- data/lib/rubik/prompt/context_compactor.rb +31 -8
- data/lib/rubik/prompt/conversation_rows.rb +33 -0
- data/lib/rubik/prompt/doctrine.rb +4 -2
- data/lib/rubik/prompt/emergency_compactor.rb +5 -4
- data/lib/rubik/repl/commands/agent_execution.rb +13 -2
- data/lib/rubik/repl/commands/buffer.rb +4 -0
- data/lib/rubik/repl/commands/mcp.rb +5 -0
- data/lib/rubik/repl/commands/subagents.rb +4 -4
- data/lib/rubik/repl/commands/workspace.rb +22 -2
- data/lib/rubik/repl/config_wiring.rb +24 -7
- data/lib/rubik/repl/input_execution.rb +1 -1
- data/lib/rubik/repl/lifecycle.rb +3 -2
- data/lib/rubik/repl/pruner/harness.rb +52 -67
- data/lib/rubik/repl/pruner/rules.rb +3 -1
- data/lib/rubik/repl/service_catalog.rb +1 -1
- data/lib/rubik/repl/synthesized_command_context.rb +3 -0
- data/lib/rubik/repl/turn_recorder.rb +5 -4
- data/lib/rubik/repl.rb +1 -0
- data/lib/rubik/runtime/context.rb +5 -0
- data/lib/rubik/runtime/discovery.rb +55 -0
- data/lib/rubik/runtime/overlay_storage.rb +54 -23
- data/lib/rubik/runtime/repair_probe.rb +20 -2
- data/lib/rubik/runtime/sealed_coeffects.rb +58 -0
- data/lib/rubik/runtime/synthesized_command_context.rb +80 -0
- data/lib/rubik/runtime/synthesized_tool_context.rb +123 -0
- data/lib/rubik/runtime.rb +2 -0
- data/lib/rubik/security/classifier/classifier.rb +16 -8
- data/lib/rubik/security/classifier/commands/biome.yaml +49 -0
- data/lib/rubik/security/classifier/commands/bun.yaml +91 -0
- data/lib/rubik/security/classifier/commands/bundle.yaml +107 -0
- data/lib/rubik/security/classifier/commands/clang-format.yaml +21 -0
- data/lib/rubik/security/classifier/commands/clang.yaml +37 -0
- data/lib/rubik/security/classifier/commands/cmake.yaml +37 -0
- data/lib/rubik/security/classifier/commands/ctest.yaml +30 -0
- data/lib/rubik/security/classifier/commands/gcc.yaml +36 -0
- data/lib/rubik/security/classifier/commands/gem.yaml +104 -0
- data/lib/rubik/security/classifier/commands/gofmt.yaml +15 -0
- data/lib/rubik/security/classifier/commands/pnpm.yaml +8 -8
- data/lib/rubik/security/classifier/commands/python.yaml +18 -1
- data/lib/rubik/security/classifier/commands/python3.yaml +18 -1
- data/lib/rubik/security/classifier/commands/rake.yaml +60 -0
- data/lib/rubik/security/classifier/commands/rspec.yaml +42 -0
- data/lib/rubik/security/classifier/commands/rubocop.yaml +38 -0
- data/lib/rubik/security/classifier/commands/ruby.yaml +25 -0
- data/lib/rubik/security/classifier/commands/rustc.yaml +34 -0
- data/lib/rubik/security/classifier/commands/zig.yaml +77 -0
- data/lib/rubik/security/classifier/database.rb +12 -1
- data/lib/rubik/security/classifier/matcher.rb +17 -2
- data/lib/rubik/security/classifier/models.rb +3 -2
- data/lib/rubik/security/classifier.rb +5 -0
- data/lib/rubik/security/guard.rb +133 -39
- data/lib/rubik/storage/vakanuvis/harness.rb +49 -89
- data/lib/rubik/tools/base.rb +24 -7
- data/lib/rubik/tools/builtins/files.rb +2 -0
- data/lib/rubik/tools/builtins/goal_ledger.rb +9 -9
- data/lib/rubik/tools/builtins/lifecycle.rb +1 -1
- data/lib/rubik/tools/builtins/synthesis.rb +121 -64
- data/lib/rubik/tools/builtins/unsynthesize.rb +38 -0
- data/lib/rubik/tools/catalog.rb +3 -0
- data/lib/rubik/tools/declaration.rb +6 -2
- data/lib/rubik/tools/preflight_runner.rb +107 -14
- data/lib/rubik/tools/registry.rb +2 -0
- data/lib/rubik/tools/uri_resolver.rb +3 -1
- data/lib/rubik/uris.rb +5 -1
- data/lib/rubik/version.rb +1 -1
- data/lib/rubik.rb +1 -0
- metadata +25 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: gofmt
|
|
3
|
+
description: "Go programming language source code formatter"
|
|
4
|
+
classification: READONLY
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--help: {overrides: READONLY}
|
|
9
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
10
|
+
options:
|
|
11
|
+
-w: {overrides: LOCAL_EFFECTS}
|
|
12
|
+
-d: {overrides: READONLY}
|
|
13
|
+
-l: {overrides: READONLY}
|
|
14
|
+
-s: {}
|
|
15
|
+
-r: {takes_value: true}
|
|
@@ -193,16 +193,16 @@ subcommands:
|
|
|
193
193
|
|
|
194
194
|
# --- Script execution (runs arbitrary code from package.json / user input) ---
|
|
195
195
|
run:
|
|
196
|
-
classification:
|
|
196
|
+
classification: LOCAL_EFFECTS
|
|
197
197
|
strict: false
|
|
198
198
|
run-script:
|
|
199
|
-
classification:
|
|
199
|
+
classification: LOCAL_EFFECTS
|
|
200
200
|
strict: false
|
|
201
201
|
test:
|
|
202
|
-
classification:
|
|
202
|
+
classification: LOCAL_EFFECTS
|
|
203
203
|
strict: false
|
|
204
204
|
t:
|
|
205
|
-
classification:
|
|
205
|
+
classification: LOCAL_EFFECTS
|
|
206
206
|
strict: false
|
|
207
207
|
start:
|
|
208
208
|
classification: DANGEROUS
|
|
@@ -220,15 +220,15 @@ subcommands:
|
|
|
220
220
|
# --- Arbitrary command execution with package context ---
|
|
221
221
|
# `pnpm exec [--] <cmd> [args...]` runs arbitrary commands with node_modules/.bin on PATH
|
|
222
222
|
exec:
|
|
223
|
+
classification: LOCAL_EFFECTS
|
|
223
224
|
strict: false
|
|
224
225
|
delegates_to:
|
|
225
|
-
mode:
|
|
226
|
-
separator: "--"
|
|
226
|
+
mode: rest_are_argv
|
|
227
227
|
x:
|
|
228
|
+
classification: LOCAL_EFFECTS
|
|
228
229
|
strict: false
|
|
229
230
|
delegates_to:
|
|
230
|
-
mode:
|
|
231
|
-
separator: "--"
|
|
231
|
+
mode: rest_are_argv
|
|
232
232
|
# `pnpm dlx <pkg>` downloads and runs a package from the registry
|
|
233
233
|
dlx:
|
|
234
234
|
classification: EXTERNAL_EFFECTS
|
|
@@ -3,7 +3,24 @@ command: python
|
|
|
3
3
|
description: "Python language interpreter"
|
|
4
4
|
classification: DANGEROUS
|
|
5
5
|
strict: false
|
|
6
|
-
|
|
6
|
+
global_options:
|
|
7
7
|
--version: {overrides: READONLY}
|
|
8
8
|
-V: {overrides: READONLY}
|
|
9
9
|
--help: {overrides: READONLY}
|
|
10
|
+
-h: {overrides: READONLY}
|
|
11
|
+
-m: {}
|
|
12
|
+
subcommands:
|
|
13
|
+
unittest:
|
|
14
|
+
classification: LOCAL_EFFECTS
|
|
15
|
+
strict: false
|
|
16
|
+
pytest:
|
|
17
|
+
classification: LOCAL_EFFECTS
|
|
18
|
+
strict: false
|
|
19
|
+
mypy:
|
|
20
|
+
classification: LOCAL_EFFECTS
|
|
21
|
+
strict: false
|
|
22
|
+
ruff:
|
|
23
|
+
classification: LOCAL_EFFECTS
|
|
24
|
+
strict: false
|
|
25
|
+
options:
|
|
26
|
+
-c: {overrides: DANGEROUS, takes_value: true}
|
|
@@ -3,7 +3,24 @@ command: python3
|
|
|
3
3
|
description: "Python 3 language interpreter"
|
|
4
4
|
classification: DANGEROUS
|
|
5
5
|
strict: false
|
|
6
|
-
|
|
6
|
+
global_options:
|
|
7
7
|
--version: {overrides: READONLY}
|
|
8
8
|
-V: {overrides: READONLY}
|
|
9
9
|
--help: {overrides: READONLY}
|
|
10
|
+
-h: {overrides: READONLY}
|
|
11
|
+
-m: {}
|
|
12
|
+
subcommands:
|
|
13
|
+
unittest:
|
|
14
|
+
classification: LOCAL_EFFECTS
|
|
15
|
+
strict: false
|
|
16
|
+
pytest:
|
|
17
|
+
classification: LOCAL_EFFECTS
|
|
18
|
+
strict: false
|
|
19
|
+
mypy:
|
|
20
|
+
classification: LOCAL_EFFECTS
|
|
21
|
+
strict: false
|
|
22
|
+
ruff:
|
|
23
|
+
classification: LOCAL_EFFECTS
|
|
24
|
+
strict: false
|
|
25
|
+
options:
|
|
26
|
+
-c: {overrides: DANGEROUS, takes_value: true}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: rake
|
|
3
|
+
description: "Ruby build and task automation tool"
|
|
4
|
+
classification: LOCAL_EFFECTS
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--help: {overrides: READONLY}
|
|
9
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
10
|
+
-H: {overrides: READONLY, aliases: [--help]}
|
|
11
|
+
--version: {overrides: READONLY}
|
|
12
|
+
-V: {overrides: READONLY, aliases: [--version]}
|
|
13
|
+
options:
|
|
14
|
+
-T: {overrides: READONLY}
|
|
15
|
+
--tasks: {overrides: READONLY, aliases: [-T]}
|
|
16
|
+
-P: {overrides: READONLY}
|
|
17
|
+
--prereqs: {overrides: READONLY, aliases: [-P]}
|
|
18
|
+
-W: {overrides: READONLY}
|
|
19
|
+
--where: {overrides: READONLY, aliases: [-W]}
|
|
20
|
+
-D: {overrides: READONLY}
|
|
21
|
+
--describe: {overrides: READONLY, aliases: [-D]}
|
|
22
|
+
-n: {overrides: READONLY}
|
|
23
|
+
--dry-run: {overrides: READONLY, aliases: [-n]}
|
|
24
|
+
--rules: {overrides: READONLY}
|
|
25
|
+
-e: {overrides: DANGEROUS, takes_value: true}
|
|
26
|
+
--execute: {overrides: DANGEROUS, takes_value: true, aliases: [-e]}
|
|
27
|
+
-p: {overrides: DANGEROUS, takes_value: true}
|
|
28
|
+
--execute-print: {overrides: DANGEROUS, takes_value: true, aliases: [-p]}
|
|
29
|
+
-f: {takes_value: true}
|
|
30
|
+
--rakefile: {takes_value: true, aliases: [-f]}
|
|
31
|
+
-I: {takes_value: true}
|
|
32
|
+
--libdir: {takes_value: true, aliases: [-I]}
|
|
33
|
+
-r: {takes_value: true}
|
|
34
|
+
--require: {takes_value: true, aliases: [-r]}
|
|
35
|
+
-j: {takes_value: true}
|
|
36
|
+
--jobs: {takes_value: true, aliases: [-j]}
|
|
37
|
+
-m: {}
|
|
38
|
+
--multitask: {aliases: [-m]}
|
|
39
|
+
-q: {}
|
|
40
|
+
--quiet: {aliases: [-q]}
|
|
41
|
+
-s: {}
|
|
42
|
+
--silent: {aliases: [-s]}
|
|
43
|
+
-v: {}
|
|
44
|
+
--verbose: {aliases: [-v]}
|
|
45
|
+
subcommands:
|
|
46
|
+
test:
|
|
47
|
+
classification: LOCAL_EFFECTS
|
|
48
|
+
strict: false
|
|
49
|
+
spec:
|
|
50
|
+
classification: LOCAL_EFFECTS
|
|
51
|
+
strict: false
|
|
52
|
+
build:
|
|
53
|
+
classification: LOCAL_EFFECTS
|
|
54
|
+
strict: false
|
|
55
|
+
clean:
|
|
56
|
+
classification: LOCAL_EFFECTS
|
|
57
|
+
strict: false
|
|
58
|
+
clobber:
|
|
59
|
+
classification: LOCAL_EFFECTS
|
|
60
|
+
strict: false
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: rspec
|
|
3
|
+
description: "Ruby BDD testing framework"
|
|
4
|
+
classification: LOCAL_EFFECTS
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--help: {overrides: READONLY}
|
|
9
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
10
|
+
--version: {overrides: READONLY}
|
|
11
|
+
-v: {overrides: READONLY, aliases: [--version]}
|
|
12
|
+
options:
|
|
13
|
+
-d: {overrides: READONLY}
|
|
14
|
+
--dry-run: {overrides: READONLY, aliases: [-d]}
|
|
15
|
+
-f: {takes_value: true}
|
|
16
|
+
--format: {takes_value: true, aliases: [-f]}
|
|
17
|
+
-o: {takes_value: true}
|
|
18
|
+
--out: {takes_value: true, aliases: [-o]}
|
|
19
|
+
-b: {}
|
|
20
|
+
--backtrace: {aliases: [-b]}
|
|
21
|
+
-c: {}
|
|
22
|
+
--color: {aliases: [-c]}
|
|
23
|
+
--colour: {aliases: [-c]}
|
|
24
|
+
-C: {}
|
|
25
|
+
--no-color: {aliases: [-C]}
|
|
26
|
+
--no-colour: {aliases: [-C]}
|
|
27
|
+
-e: {takes_value: true}
|
|
28
|
+
--example: {takes_value: true, aliases: [-e]}
|
|
29
|
+
-t: {takes_value: true}
|
|
30
|
+
--tag: {takes_value: true, aliases: [-t]}
|
|
31
|
+
-P: {takes_value: true}
|
|
32
|
+
--pattern: {takes_value: true, aliases: [-P]}
|
|
33
|
+
--exclude-pattern: {takes_value: true}
|
|
34
|
+
--seed: {takes_value: true}
|
|
35
|
+
--order: {takes_value: true}
|
|
36
|
+
-p: {}
|
|
37
|
+
--profile: {aliases: [-p]}
|
|
38
|
+
--fail-fast: {}
|
|
39
|
+
-r: {takes_value: true}
|
|
40
|
+
--require: {takes_value: true, aliases: [-r]}
|
|
41
|
+
-I: {takes_value: true}
|
|
42
|
+
--init: {overrides: LOCAL_EFFECTS}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: rubocop
|
|
3
|
+
description: "Ruby static code analyzer and code formatter"
|
|
4
|
+
classification: READONLY
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--help: {overrides: READONLY}
|
|
9
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
10
|
+
--version: {overrides: READONLY}
|
|
11
|
+
-v: {overrides: READONLY, aliases: [--version]}
|
|
12
|
+
-V: {overrides: READONLY}
|
|
13
|
+
--verbose-version: {overrides: READONLY, aliases: [-V]}
|
|
14
|
+
options:
|
|
15
|
+
-a: {overrides: LOCAL_EFFECTS}
|
|
16
|
+
--autocorrect: {overrides: LOCAL_EFFECTS, aliases: [-a]}
|
|
17
|
+
-A: {overrides: LOCAL_EFFECTS}
|
|
18
|
+
--autocorrect-all: {overrides: LOCAL_EFFECTS, aliases: [-A]}
|
|
19
|
+
--fix: {overrides: LOCAL_EFFECTS, aliases: [-a]}
|
|
20
|
+
-x: {overrides: LOCAL_EFFECTS}
|
|
21
|
+
--fix-layout: {overrides: LOCAL_EFFECTS, aliases: [-x]}
|
|
22
|
+
--auto-gen-config: {overrides: LOCAL_EFFECTS}
|
|
23
|
+
--regenerate-todo: {overrides: LOCAL_EFFECTS}
|
|
24
|
+
--init: {overrides: LOCAL_EFFECTS}
|
|
25
|
+
-f: {takes_value: true}
|
|
26
|
+
--format: {takes_value: true, aliases: [-f]}
|
|
27
|
+
-o: {takes_value: true}
|
|
28
|
+
--out: {takes_value: true, aliases: [-o]}
|
|
29
|
+
-c: {takes_value: true}
|
|
30
|
+
--config: {takes_value: true, aliases: [-c]}
|
|
31
|
+
-d: {}
|
|
32
|
+
--debug: {aliases: [-d]}
|
|
33
|
+
-l: {overrides: READONLY}
|
|
34
|
+
--lint: {overrides: READONLY, aliases: [-l]}
|
|
35
|
+
--parallel: {}
|
|
36
|
+
--fail-level: {takes_value: true}
|
|
37
|
+
--cache: {takes_value: true}
|
|
38
|
+
--show-cops: {overrides: READONLY}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: ruby
|
|
3
|
+
description: "Ruby programming language interpreter"
|
|
4
|
+
classification: LOCAL_EFFECTS
|
|
5
|
+
bare_classification: DANGEROUS
|
|
6
|
+
risk: LOW
|
|
7
|
+
strict: false
|
|
8
|
+
global_options:
|
|
9
|
+
--help: {overrides: READONLY}
|
|
10
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
11
|
+
--version: {overrides: READONLY}
|
|
12
|
+
-v: {overrides: READONLY}
|
|
13
|
+
-c: {overrides: READONLY}
|
|
14
|
+
options:
|
|
15
|
+
-e: {overrides: DANGEROUS, takes_value: true}
|
|
16
|
+
-p: {overrides: DANGEROUS}
|
|
17
|
+
-n: {}
|
|
18
|
+
-r: {takes_value: true}
|
|
19
|
+
-I: {takes_value: true}
|
|
20
|
+
-C: {takes_value: true, captures_directory: true}
|
|
21
|
+
-w: {}
|
|
22
|
+
-W: {takes_value: true}
|
|
23
|
+
-d: {}
|
|
24
|
+
--debug: {aliases: [-d]}
|
|
25
|
+
--verbose: {overrides: READONLY}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: rustc
|
|
3
|
+
description: "Rust language compiler"
|
|
4
|
+
classification: LOCAL_EFFECTS
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--version: {overrides: READONLY}
|
|
9
|
+
-V: {overrides: READONLY, aliases: [--version]}
|
|
10
|
+
-v: {overrides: READONLY}
|
|
11
|
+
--help: {overrides: READONLY}
|
|
12
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
13
|
+
options:
|
|
14
|
+
--print: {overrides: READONLY, takes_value: true}
|
|
15
|
+
--explain: {overrides: READONLY, takes_value: true}
|
|
16
|
+
-o: {takes_value: true}
|
|
17
|
+
--out-dir: {takes_value: true}
|
|
18
|
+
--emit: {takes_value: true}
|
|
19
|
+
--crate-type: {takes_value: true}
|
|
20
|
+
--crate-name: {takes_value: true}
|
|
21
|
+
--edition: {takes_value: true}
|
|
22
|
+
-L: {takes_value: true}
|
|
23
|
+
-l: {takes_value: true}
|
|
24
|
+
--extern: {takes_value: true}
|
|
25
|
+
-O: {}
|
|
26
|
+
-g: {}
|
|
27
|
+
-C: {takes_value: true}
|
|
28
|
+
--codegen: {takes_value: true, aliases: [-C]}
|
|
29
|
+
-W: {takes_value: true}
|
|
30
|
+
-A: {takes_value: true}
|
|
31
|
+
-D: {takes_value: true}
|
|
32
|
+
-F: {takes_value: true}
|
|
33
|
+
--cfg: {takes_value: true}
|
|
34
|
+
--target: {takes_value: true}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# $schema: ../../../schemas/command.schema.json
|
|
2
|
+
command: zig
|
|
3
|
+
description: "General-purpose programming language and toolchain"
|
|
4
|
+
classification: LOCAL_EFFECTS
|
|
5
|
+
risk: LOW
|
|
6
|
+
strict: false
|
|
7
|
+
global_options:
|
|
8
|
+
--help: {overrides: READONLY}
|
|
9
|
+
-h: {overrides: READONLY, aliases: [--help]}
|
|
10
|
+
subcommands:
|
|
11
|
+
version:
|
|
12
|
+
classification: READONLY
|
|
13
|
+
strict: false
|
|
14
|
+
env:
|
|
15
|
+
classification: READONLY
|
|
16
|
+
strict: false
|
|
17
|
+
help:
|
|
18
|
+
classification: READONLY
|
|
19
|
+
strict: false
|
|
20
|
+
zen:
|
|
21
|
+
classification: READONLY
|
|
22
|
+
strict: false
|
|
23
|
+
targets:
|
|
24
|
+
classification: READONLY
|
|
25
|
+
strict: false
|
|
26
|
+
ast-check:
|
|
27
|
+
classification: READONLY
|
|
28
|
+
strict: false
|
|
29
|
+
test:
|
|
30
|
+
classification: LOCAL_EFFECTS
|
|
31
|
+
risk: LOW
|
|
32
|
+
strict: false
|
|
33
|
+
build:
|
|
34
|
+
classification: LOCAL_EFFECTS
|
|
35
|
+
risk: LOW
|
|
36
|
+
strict: false
|
|
37
|
+
subcommands:
|
|
38
|
+
test:
|
|
39
|
+
classification: LOCAL_EFFECTS
|
|
40
|
+
risk: LOW
|
|
41
|
+
strict: false
|
|
42
|
+
build-exe:
|
|
43
|
+
classification: LOCAL_EFFECTS
|
|
44
|
+
strict: false
|
|
45
|
+
options:
|
|
46
|
+
-fno-emit-bin: {overrides: READONLY}
|
|
47
|
+
build-lib:
|
|
48
|
+
classification: LOCAL_EFFECTS
|
|
49
|
+
strict: false
|
|
50
|
+
options:
|
|
51
|
+
-fno-emit-bin: {overrides: READONLY}
|
|
52
|
+
build-obj:
|
|
53
|
+
classification: LOCAL_EFFECTS
|
|
54
|
+
strict: false
|
|
55
|
+
options:
|
|
56
|
+
-fno-emit-bin: {overrides: READONLY}
|
|
57
|
+
fmt:
|
|
58
|
+
classification: LOCAL_EFFECTS
|
|
59
|
+
strict: false
|
|
60
|
+
options:
|
|
61
|
+
--check: {overrides: READONLY}
|
|
62
|
+
--stdin: {}
|
|
63
|
+
run:
|
|
64
|
+
classification: DANGEROUS
|
|
65
|
+
strict: false
|
|
66
|
+
init:
|
|
67
|
+
classification: LOCAL_EFFECTS
|
|
68
|
+
strict: false
|
|
69
|
+
init-exe:
|
|
70
|
+
classification: LOCAL_EFFECTS
|
|
71
|
+
strict: false
|
|
72
|
+
init-lib:
|
|
73
|
+
classification: LOCAL_EFFECTS
|
|
74
|
+
strict: false
|
|
75
|
+
fetch:
|
|
76
|
+
classification: LOCAL_EFFECTS
|
|
77
|
+
strict: false
|
|
@@ -12,7 +12,7 @@ module Rubik
|
|
|
12
12
|
include MonitorMixin
|
|
13
13
|
|
|
14
14
|
ALIAS_FORBIDDEN_KEYS = [
|
|
15
|
-
"classification", "risk", "subcommands", "options", "global_options", "subcommand_mode", "delegates_to", "strict"
|
|
15
|
+
"classification", "bare_classification", "risk", "subcommands", "options", "global_options", "subcommand_mode", "delegates_to", "strict"
|
|
16
16
|
].freeze
|
|
17
17
|
|
|
18
18
|
attr_reader :builtin_dir, :user_dir
|
|
@@ -39,6 +39,16 @@ module Rubik
|
|
|
39
39
|
index_dir(@user_dir) if @user_dir && File.directory?(@user_dir)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def reload!
|
|
43
|
+
synchronize do
|
|
44
|
+
@files.clear
|
|
45
|
+
@cache.clear
|
|
46
|
+
index_dir(@builtin_dir) if @builtin_dir && File.directory?(@builtin_dir)
|
|
47
|
+
index_dir(@user_dir) if @user_dir && File.directory?(@user_dir)
|
|
48
|
+
end
|
|
49
|
+
self
|
|
50
|
+
end
|
|
51
|
+
|
|
42
52
|
def [](key, shell: nil)
|
|
43
53
|
get(key, nil, shell: shell)
|
|
44
54
|
end
|
|
@@ -127,6 +137,7 @@ module Rubik
|
|
|
127
137
|
description: data["description"],
|
|
128
138
|
aliases: parse_aliases(data["aliases"], command_name),
|
|
129
139
|
classification: Classification.normalize(data["classification"]),
|
|
140
|
+
bare_classification: Classification.normalize(data["bare_classification"]),
|
|
130
141
|
risk: Risk.normalize(data["risk"]),
|
|
131
142
|
global_options: parse_options(data["global_options"]),
|
|
132
143
|
subcommands: parse_subcommands(data["subcommands"]),
|
|
@@ -12,6 +12,14 @@ module Rubik
|
|
|
12
12
|
BUILTIN_DIR_CMDS = ["cd", "pushd", "popd"].freeze
|
|
13
13
|
BUILTIN_READONLY_CMDS = ["[", "[[", "test"].freeze
|
|
14
14
|
BUILTIN_DANGEROUS_CMDS = ["source", "."].freeze
|
|
15
|
+
STDIN_TARGET_TOKENS = ["-", "/dev/stdin", "/dev/fd/0"].freeze
|
|
16
|
+
|
|
17
|
+
def self.real_script_target?(positionals)
|
|
18
|
+
effective = positionals.reject { |t| t == "--" }
|
|
19
|
+
return false if effective.empty?
|
|
20
|
+
|
|
21
|
+
!STDIN_TARGET_TOKENS.include?(effective.first)
|
|
22
|
+
end
|
|
15
23
|
|
|
16
24
|
def self.match_command(invocation, database, parse_warnings = nil, shell: nil)
|
|
17
25
|
argv = invocation.argv
|
|
@@ -113,7 +121,12 @@ module Rubik
|
|
|
113
121
|
matched_def, command_def, all_overrides, all_risk_overrides,
|
|
114
122
|
unknown_opts, matched_defs, rem_pos, matched_rule
|
|
115
123
|
)
|
|
116
|
-
|
|
124
|
+
has_target = Matcher.real_script_target?(rem_pos)
|
|
125
|
+
base_class = if matched_def.bare_classification && !has_target && all_overrides.empty?
|
|
126
|
+
matched_def.bare_classification
|
|
127
|
+
else
|
|
128
|
+
matched_def.classification || Classification::READONLY
|
|
129
|
+
end
|
|
117
130
|
base_risk = matched_def.risk || Delegation.default_risk(base_class)
|
|
118
131
|
risk_set = !matched_def.risk.nil?
|
|
119
132
|
|
|
@@ -204,8 +217,10 @@ module Rubik
|
|
|
204
217
|
cmd_inners = 0
|
|
205
218
|
|
|
206
219
|
if matched_def.delegates_to
|
|
220
|
+
delegation_pos = rem_pos.dup
|
|
221
|
+
delegation_pos.shift if matched_def.delegates_to.mode == :rest_are_argv && delegation_pos.first == "--"
|
|
207
222
|
res = Delegation.handle_delegation(
|
|
208
|
-
|
|
223
|
+
delegation_pos, matched_def.delegates_to, database, argv,
|
|
209
224
|
matched_def, parse_warnings
|
|
210
225
|
) { |inv, db, w| match_command(inv, db, w, shell: shell) }
|
|
211
226
|
cmd_inners = res.size
|
|
@@ -112,11 +112,12 @@ module Rubik
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
CommandDef = Data.define(
|
|
115
|
-
:command, :description, :alias_of, :aliases, :classification, :risk,
|
|
115
|
+
:command, :description, :alias_of, :aliases, :classification, :bare_classification, :risk,
|
|
116
116
|
:global_options, :subcommands, :options, :strict,
|
|
117
117
|
:subcommand_mode, :delegates_to
|
|
118
118
|
) do
|
|
119
|
-
def initialize(command:, description: nil, alias_of: nil, aliases: [], classification: nil,
|
|
119
|
+
def initialize(command:, description: nil, alias_of: nil, aliases: [], classification: nil,
|
|
120
|
+
bare_classification: nil, risk: nil,
|
|
120
121
|
global_options: {}, subcommands: {}, options: {}, strict: true,
|
|
121
122
|
subcommand_mode: :hierarchical, delegates_to: nil)
|
|
122
123
|
super
|