whatisit 0.1.0__tar.gz
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.
- whatisit-0.1.0/LICENSE +202 -0
- whatisit-0.1.0/NOTICE +27 -0
- whatisit-0.1.0/PKG-INFO +135 -0
- whatisit-0.1.0/README.md +112 -0
- whatisit-0.1.0/pyproject.toml +59 -0
- whatisit-0.1.0/setup.cfg +4 -0
- whatisit-0.1.0/tests/test_cli.py +167 -0
- whatisit-0.1.0/tests/test_config.py +280 -0
- whatisit-0.1.0/tests/test_engine.py +230 -0
- whatisit-0.1.0/tests/test_extract.py +115 -0
- whatisit-0.1.0/tests/test_naming.py +70 -0
- whatisit-0.1.0/tests/test_safety.py +464 -0
- whatisit-0.1.0/whatisit/__init__.py +1 -0
- whatisit-0.1.0/whatisit/__main__.py +5 -0
- whatisit-0.1.0/whatisit/cli.py +445 -0
- whatisit-0.1.0/whatisit/config.py +161 -0
- whatisit-0.1.0/whatisit/engine.py +452 -0
- whatisit-0.1.0/whatisit/extract.py +54 -0
- whatisit-0.1.0/whatisit/hostctx.py +212 -0
- whatisit-0.1.0/whatisit/safety.py +976 -0
- whatisit-0.1.0/whatisit.egg-info/PKG-INFO +135 -0
- whatisit-0.1.0/whatisit.egg-info/SOURCES.txt +24 -0
- whatisit-0.1.0/whatisit.egg-info/dependency_links.txt +1 -0
- whatisit-0.1.0/whatisit.egg-info/entry_points.txt +2 -0
- whatisit-0.1.0/whatisit.egg-info/requires.txt +6 -0
- whatisit-0.1.0/whatisit.egg-info/top_level.txt +1 -0
whatisit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Mukesh Poudel
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
whatisit-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
whatisit
|
|
2
|
+
Copyright 2026 Mukesh Poudel
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0. You may obtain a copy of
|
|
5
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The model weights are a LoRA fine-tune of Qwen2.5-Coder-1.5B-Instruct,
|
|
10
|
+
Copyright Alibaba Cloud, used under the Apache License, Version 2.0.
|
|
11
|
+
|
|
12
|
+
Training data, by measured share of the 125,770-row pool:
|
|
13
|
+
|
|
14
|
+
32.8% Fig autocomplete specs MIT
|
|
15
|
+
23.1% tldr-pages CC-BY-4.0
|
|
16
|
+
18.0% NL2SH-ALFA training split MIT
|
|
17
|
+
11.8% cli-commands-explained CC0-1.0 (declared, unverified)
|
|
18
|
+
7.3% command-generation Apache-2.0 (declared, unverified)
|
|
19
|
+
7.1% git-instruction MIT (declared, unverified)
|
|
20
|
+
|
|
21
|
+
5.67% is verbatim NL2Bash via the ALFA split; its data/bash is MIT, not GPL.
|
|
22
|
+
Warp workflows are not used.
|
|
23
|
+
|
|
24
|
+
Attribution, required by CC-BY-4.0: this work includes content from tldr-pages
|
|
25
|
+
(https://github.com/tldr-pages/tldr) under CC-BY-4.0
|
|
26
|
+
(https://creativecommons.org/licenses/by/4.0/). Page content is CC-BY-4.0;
|
|
27
|
+
only scripts/ is MIT.
|
whatisit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: whatisit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Natural language to shell command, fully local and fast. No API keys, no network.
|
|
5
|
+
Author: Mukesh Poudel
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: shell,cli,llm,local,bash
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: System Administrators
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: System :: Shells
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov>=4; extra == "dev"
|
|
20
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
21
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# whatisit
|
|
25
|
+
|
|
26
|
+
Natural language to shell command. Fully local, no API key, no network call.
|
|
27
|
+
|
|
28
|
+
```console
|
|
29
|
+
$ whatisit show which processes are using the most memory
|
|
30
|
+
ps aux --sort=-%mem | head -n 11
|
|
31
|
+
|
|
32
|
+
$ whatisit find files bigger than 100MB in this folder
|
|
33
|
+
find . -size +100M -exec ls -lh {} \;
|
|
34
|
+
|
|
35
|
+
$ whatisit delete everything in the root directory
|
|
36
|
+
!! DANGER recursive force-delete of a critical path
|
|
37
|
+
rm -rf /
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# not on PyPI yet -- install from source
|
|
44
|
+
git clone https://github.com/ThorOdinson246/nl2sh
|
|
45
|
+
cd nl2sh && pip install ./whatisit_pkg
|
|
46
|
+
|
|
47
|
+
# the model (941 MB)
|
|
48
|
+
hf download ThorOdinson246/nl2sh-1.5b-Q4_K_M nl2sh-1.5b-Q4_K_M.gguf --local-dir .
|
|
49
|
+
|
|
50
|
+
# a llama.cpp runtime: prebuilt binaries from
|
|
51
|
+
# https://github.com/ggml-org/llama.cpp/releases
|
|
52
|
+
|
|
53
|
+
whatisit setup --model ./nl2sh-1.5b-Q4_K_M.gguf --bin-dir /path/to/llama.cpp/bin
|
|
54
|
+
whatisit doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`setup` does not fetch anything itself yet; point it at the files above.
|
|
58
|
+
`whatisit doctor` reports exactly what is missing.
|
|
59
|
+
|
|
60
|
+
## Use
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
whatisit <your request> # unquoted is fine
|
|
64
|
+
whatisit -n 3 compress this folder # show 3 alternatives
|
|
65
|
+
whatisit -e count lines in every py file # run it, after confirming
|
|
66
|
+
eval "$(whatisit -q show disk usage)" # bare output, for scripting
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| command | what it does |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `whatisit setup --model <gguf>` | register a local model file |
|
|
72
|
+
| `whatisit doctor` | check the install and report what's missing |
|
|
73
|
+
| `whatisit stop` | unload the model from memory |
|
|
74
|
+
| `whatisit config --set threads=3` | change settings |
|
|
75
|
+
|
|
76
|
+
## Security notes
|
|
77
|
+
|
|
78
|
+
**Never run `whatisit` through `sudo`.** Three environment variables
|
|
79
|
+
(`WHATISIT_LLAMA_SERVER`, `WHATISIT_LLAMA_CLI`, `WHATISIT_RUNTIME_LIB`) point at
|
|
80
|
+
the binaries and shared libraries it executes. That is harmless when it is your own
|
|
81
|
+
environment running as you, but across a privilege boundary -- `sudo -E`, a cron
|
|
82
|
+
or setuid wrapper -- they become a way to run an arbitrary binary as root.
|
|
83
|
+
|
|
84
|
+
The model server listens on a **UNIX socket** inside a `0700` directory, not a
|
|
85
|
+
TCP port, and requires a per-run bearer token. On a shared machine loopback is
|
|
86
|
+
reachable by every other user, so a TCP port would let a co-tenant use your model
|
|
87
|
+
or -- worse -- claim the port first and answer in place of the real server with a
|
|
88
|
+
command of their choosing. Config, query log, pid, token and server log are all
|
|
89
|
+
`0600`.
|
|
90
|
+
|
|
91
|
+
**The safety check is a seatbelt, not a sandbox.** It is a denylist over a
|
|
92
|
+
Turing-complete language: `eval`, base64 indirection and aliasing defeat any
|
|
93
|
+
static check. The real protection is that nothing runs unless you ask it to.
|
|
94
|
+
|
|
95
|
+
## Design notes
|
|
96
|
+
|
|
97
|
+
**It never runs anything on its own.** The default prints the command and
|
|
98
|
+
stops. `-e` runs it, but only after an interactive confirmation, and it
|
|
99
|
+
*refuses* on anything flagged `DANGER` — you have to copy those yourself.
|
|
100
|
+
Compound commands are split on `;`, `&&`, `||` and `|` and every segment is
|
|
101
|
+
checked independently, because a plausible first clause followed by a
|
|
102
|
+
destructive one is a real observed failure mode.
|
|
103
|
+
|
|
104
|
+
**The model stays resident.** The first query starts a small local server that
|
|
105
|
+
holds the model in RAM; later queries reuse it. Reloading a ~1 GB model per
|
|
106
|
+
invocation costs several seconds and is most of what makes local tools feel
|
|
107
|
+
slow. `whatisit stop` unloads it.
|
|
108
|
+
|
|
109
|
+
**Threads default to half your cores, capped at 4.** Decoding is limited by
|
|
110
|
+
memory bandwidth, not compute — measured at ~31 GB/s saturated by both a 1.5B
|
|
111
|
+
and a 4B model — so throughput stops improving well before your core count,
|
|
112
|
+
and spending every core only spins the fans.
|
|
113
|
+
|
|
114
|
+
**Zero Python dependencies.** `pip install whatisit` cannot disturb anything else
|
|
115
|
+
in your environment.
|
|
116
|
+
|
|
117
|
+
## Model
|
|
118
|
+
|
|
119
|
+
A 1.5B-parameter model fine-tuned for this one job and quantised to Q4_K_M
|
|
120
|
+
(941 MB): [ThorOdinson246/nl2sh-1.5b-Q4_K_M](https://huggingface.co/ThorOdinson246/nl2sh-1.5b-Q4_K_M).
|
|
121
|
+
|
|
122
|
+
On [InterCode-ALFA](https://github.com/westenfelder/InterCode-ALFA) — 300 tasks
|
|
123
|
+
scored by *executing* each command in a container and comparing filesystem
|
|
124
|
+
state, file contents and stdout against a reference — it scores **0.620**,
|
|
125
|
+
against 0.540 for the untuned base it was fine-tuned from (+0.080, p = 0.004).
|
|
126
|
+
That puts it level with an untuned Qwen2.5-Coder-7B at 0.613: a difference of
|
|
127
|
+
0.007, p = 0.91, statistically indistinguishable at roughly a fifth the size.
|
|
128
|
+
|
|
129
|
+
It is not as good as a frontier model — GPT-4o is about 11 points ahead on the
|
|
130
|
+
same benchmark — and it is weakest on multi-stage pipelines. It is meant for
|
|
131
|
+
the one-liner you'd otherwise go and look up.
|
|
132
|
+
|
|
133
|
+
## Licence
|
|
134
|
+
|
|
135
|
+
Apache-2.0, as is the Qwen2.5-Coder base model it derives from.
|
whatisit-0.1.0/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# whatisit
|
|
2
|
+
|
|
3
|
+
Natural language to shell command. Fully local, no API key, no network call.
|
|
4
|
+
|
|
5
|
+
```console
|
|
6
|
+
$ whatisit show which processes are using the most memory
|
|
7
|
+
ps aux --sort=-%mem | head -n 11
|
|
8
|
+
|
|
9
|
+
$ whatisit find files bigger than 100MB in this folder
|
|
10
|
+
find . -size +100M -exec ls -lh {} \;
|
|
11
|
+
|
|
12
|
+
$ whatisit delete everything in the root directory
|
|
13
|
+
!! DANGER recursive force-delete of a critical path
|
|
14
|
+
rm -rf /
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# not on PyPI yet -- install from source
|
|
21
|
+
git clone https://github.com/ThorOdinson246/nl2sh
|
|
22
|
+
cd nl2sh && pip install ./whatisit_pkg
|
|
23
|
+
|
|
24
|
+
# the model (941 MB)
|
|
25
|
+
hf download ThorOdinson246/nl2sh-1.5b-Q4_K_M nl2sh-1.5b-Q4_K_M.gguf --local-dir .
|
|
26
|
+
|
|
27
|
+
# a llama.cpp runtime: prebuilt binaries from
|
|
28
|
+
# https://github.com/ggml-org/llama.cpp/releases
|
|
29
|
+
|
|
30
|
+
whatisit setup --model ./nl2sh-1.5b-Q4_K_M.gguf --bin-dir /path/to/llama.cpp/bin
|
|
31
|
+
whatisit doctor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`setup` does not fetch anything itself yet; point it at the files above.
|
|
35
|
+
`whatisit doctor` reports exactly what is missing.
|
|
36
|
+
|
|
37
|
+
## Use
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
whatisit <your request> # unquoted is fine
|
|
41
|
+
whatisit -n 3 compress this folder # show 3 alternatives
|
|
42
|
+
whatisit -e count lines in every py file # run it, after confirming
|
|
43
|
+
eval "$(whatisit -q show disk usage)" # bare output, for scripting
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| command | what it does |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `whatisit setup --model <gguf>` | register a local model file |
|
|
49
|
+
| `whatisit doctor` | check the install and report what's missing |
|
|
50
|
+
| `whatisit stop` | unload the model from memory |
|
|
51
|
+
| `whatisit config --set threads=3` | change settings |
|
|
52
|
+
|
|
53
|
+
## Security notes
|
|
54
|
+
|
|
55
|
+
**Never run `whatisit` through `sudo`.** Three environment variables
|
|
56
|
+
(`WHATISIT_LLAMA_SERVER`, `WHATISIT_LLAMA_CLI`, `WHATISIT_RUNTIME_LIB`) point at
|
|
57
|
+
the binaries and shared libraries it executes. That is harmless when it is your own
|
|
58
|
+
environment running as you, but across a privilege boundary -- `sudo -E`, a cron
|
|
59
|
+
or setuid wrapper -- they become a way to run an arbitrary binary as root.
|
|
60
|
+
|
|
61
|
+
The model server listens on a **UNIX socket** inside a `0700` directory, not a
|
|
62
|
+
TCP port, and requires a per-run bearer token. On a shared machine loopback is
|
|
63
|
+
reachable by every other user, so a TCP port would let a co-tenant use your model
|
|
64
|
+
or -- worse -- claim the port first and answer in place of the real server with a
|
|
65
|
+
command of their choosing. Config, query log, pid, token and server log are all
|
|
66
|
+
`0600`.
|
|
67
|
+
|
|
68
|
+
**The safety check is a seatbelt, not a sandbox.** It is a denylist over a
|
|
69
|
+
Turing-complete language: `eval`, base64 indirection and aliasing defeat any
|
|
70
|
+
static check. The real protection is that nothing runs unless you ask it to.
|
|
71
|
+
|
|
72
|
+
## Design notes
|
|
73
|
+
|
|
74
|
+
**It never runs anything on its own.** The default prints the command and
|
|
75
|
+
stops. `-e` runs it, but only after an interactive confirmation, and it
|
|
76
|
+
*refuses* on anything flagged `DANGER` — you have to copy those yourself.
|
|
77
|
+
Compound commands are split on `;`, `&&`, `||` and `|` and every segment is
|
|
78
|
+
checked independently, because a plausible first clause followed by a
|
|
79
|
+
destructive one is a real observed failure mode.
|
|
80
|
+
|
|
81
|
+
**The model stays resident.** The first query starts a small local server that
|
|
82
|
+
holds the model in RAM; later queries reuse it. Reloading a ~1 GB model per
|
|
83
|
+
invocation costs several seconds and is most of what makes local tools feel
|
|
84
|
+
slow. `whatisit stop` unloads it.
|
|
85
|
+
|
|
86
|
+
**Threads default to half your cores, capped at 4.** Decoding is limited by
|
|
87
|
+
memory bandwidth, not compute — measured at ~31 GB/s saturated by both a 1.5B
|
|
88
|
+
and a 4B model — so throughput stops improving well before your core count,
|
|
89
|
+
and spending every core only spins the fans.
|
|
90
|
+
|
|
91
|
+
**Zero Python dependencies.** `pip install whatisit` cannot disturb anything else
|
|
92
|
+
in your environment.
|
|
93
|
+
|
|
94
|
+
## Model
|
|
95
|
+
|
|
96
|
+
A 1.5B-parameter model fine-tuned for this one job and quantised to Q4_K_M
|
|
97
|
+
(941 MB): [ThorOdinson246/nl2sh-1.5b-Q4_K_M](https://huggingface.co/ThorOdinson246/nl2sh-1.5b-Q4_K_M).
|
|
98
|
+
|
|
99
|
+
On [InterCode-ALFA](https://github.com/westenfelder/InterCode-ALFA) — 300 tasks
|
|
100
|
+
scored by *executing* each command in a container and comparing filesystem
|
|
101
|
+
state, file contents and stdout against a reference — it scores **0.620**,
|
|
102
|
+
against 0.540 for the untuned base it was fine-tuned from (+0.080, p = 0.004).
|
|
103
|
+
That puts it level with an untuned Qwen2.5-Coder-7B at 0.613: a difference of
|
|
104
|
+
0.007, p = 0.91, statistically indistinguishable at roughly a fifth the size.
|
|
105
|
+
|
|
106
|
+
It is not as good as a frontier model — GPT-4o is about 11 points ahead on the
|
|
107
|
+
same benchmark — and it is weakest on multi-stage pipelines. It is meant for
|
|
108
|
+
the one-liner you'd otherwise go and look up.
|
|
109
|
+
|
|
110
|
+
## Licence
|
|
111
|
+
|
|
112
|
+
Apache-2.0, as is the Qwen2.5-Coder base model it derives from.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "whatisit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Natural language to shell command, fully local and fast. No API keys, no network."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "Mukesh Poudel" }]
|
|
13
|
+
keywords = ["shell", "cli", "llm", "local", "bash"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: System Administrators",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: System :: Shells",
|
|
20
|
+
]
|
|
21
|
+
# Deliberately zero runtime dependencies: stdlib urllib talks to the local
|
|
22
|
+
# server, so `pip install whatisit` cannot break someone's environment.
|
|
23
|
+
dependencies = []
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = ["pytest>=7", "pytest-cov>=4", "ruff>=0.5", "build>=1"]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
whatisit = "whatisit.cli:main"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
# Apache-2.0 requires the NOTICE to travel with every redistribution.
|
|
33
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
include = ["whatisit*"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
addopts = "-ra"
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 100
|
|
44
|
+
target-version = "py39"
|
|
45
|
+
|
|
46
|
+
[tool.ruff.lint]
|
|
47
|
+
select = ["E", "F", "I", "B", "W"]
|
|
48
|
+
ignore = [
|
|
49
|
+
"E731", # lambda assignments -- cli.py uses them deliberately for the
|
|
50
|
+
# colour helpers (BOLD/DIM/RED/...); not worth a refactor here.
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint.per-file-ignores]
|
|
54
|
+
"tests/*" = ["E402"] # test_safety.py needs sys.path.insert before its import
|
|
55
|
+
# test_safety.py is the crown-jewel regression file: every entry is a
|
|
56
|
+
# confirmed bypass or false positive from four adversarial audits. Its
|
|
57
|
+
# content (including these literal '\;' find(1) strings and long inline
|
|
58
|
+
# comments) is deliberately left untouched rather than reformatted.
|
|
59
|
+
"tests/test_safety.py" = ["E402", "E501", "W605"]
|
whatisit-0.1.0/setup.cfg
ADDED