@bilalimamoglu/sift 0.2.2 → 0.2.3
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 +139 -89
- package/dist/cli.js +1132 -347
- package/dist/index.d.ts +29 -1
- package/dist/index.js +530 -47
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="assets/brand/sift-logo-badge-monochrome.svg" alt="sift logo" width="88" />
|
|
4
4
|
|
|
5
|
-
`sift` is a small command
|
|
5
|
+
`sift` is a small CLI that runs a noisy shell command, keeps the useful signal, and returns a much smaller answer.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It is a good fit when you want an agent or CI job to understand:
|
|
8
|
+
- test results
|
|
9
|
+
- typecheck failures
|
|
10
|
+
- lint failures
|
|
11
|
+
- build logs
|
|
12
|
+
- `git diff`
|
|
13
|
+
- `npm audit`
|
|
14
|
+
- `terraform plan`
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
16
|
+
It is not a good fit when you need:
|
|
17
|
+
- the exact raw log as the main output
|
|
18
|
+
- interactive or TUI commands
|
|
19
|
+
- shell behavior that depends on raw command output
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
- exact raw log inspection
|
|
16
|
-
- TUI tools
|
|
17
|
-
- password/confirmation prompts
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
21
|
+
## Install
|
|
20
22
|
|
|
21
23
|
Requires Node.js 20 or later.
|
|
22
24
|
|
|
@@ -26,7 +28,7 @@ npm install -g @bilalimamoglu/sift
|
|
|
26
28
|
|
|
27
29
|
## One-time setup
|
|
28
30
|
|
|
29
|
-
The easiest path is
|
|
31
|
+
The easiest setup path is:
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
34
|
sift config setup
|
|
@@ -38,9 +40,9 @@ That writes a machine-wide config to:
|
|
|
38
40
|
~/.config/sift/config.yaml
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
After that, any terminal can use `sift
|
|
43
|
+
After that, any terminal on the machine can use `sift`. A repo-local config can still override it later.
|
|
42
44
|
|
|
43
|
-
If you
|
|
45
|
+
If you prefer manual setup, this is the smallest useful OpenAI setup:
|
|
44
46
|
|
|
45
47
|
```bash
|
|
46
48
|
export SIFT_PROVIDER=openai
|
|
@@ -49,86 +51,116 @@ export SIFT_MODEL=gpt-5-nano
|
|
|
49
51
|
export OPENAI_API_KEY=your_openai_api_key
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
Then check it:
|
|
53
55
|
|
|
54
56
|
```bash
|
|
55
|
-
sift
|
|
57
|
+
sift doctor
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
## Quick start
|
|
59
61
|
|
|
60
62
|
```bash
|
|
61
|
-
sift
|
|
63
|
+
sift exec "what changed?" -- git diff
|
|
64
|
+
sift exec --preset test-status -- npm test
|
|
65
|
+
sift exec --preset typecheck-summary -- npm run typecheck
|
|
66
|
+
sift exec --preset lint-failures -- eslint .
|
|
67
|
+
sift exec --preset audit-critical -- npm audit
|
|
68
|
+
sift exec --preset infra-risk -- terraform plan
|
|
62
69
|
```
|
|
63
70
|
|
|
64
|
-
|
|
71
|
+
## The main workflow
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
~/.config/sift/config.yaml
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Then keep the API key in your shell profile so every terminal can use it:
|
|
73
|
+
`sift exec` is the default path:
|
|
71
74
|
|
|
72
75
|
```bash
|
|
73
|
-
|
|
76
|
+
sift exec "what changed?" -- git diff
|
|
77
|
+
sift exec --preset test-status -- npm test
|
|
78
|
+
sift exec --preset test-status --show-raw -- npm test
|
|
79
|
+
sift exec --preset test-status --detail focused -- npm test
|
|
80
|
+
sift exec --preset test-status --detail verbose -- npm test
|
|
74
81
|
```
|
|
75
82
|
|
|
76
|
-
If
|
|
83
|
+
If your project uses `pytest`, `vitest`, `jest`, `bun test`, or another test runner instead of `npm test`, use the same preset with that command.
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
What happens:
|
|
86
|
+
1. `sift` runs the command
|
|
87
|
+
2. captures `stdout` and `stderr`
|
|
88
|
+
3. trims the noise
|
|
89
|
+
4. sends a smaller input to the model
|
|
90
|
+
5. prints a short answer or JSON
|
|
91
|
+
6. preserves the child command exit code in `exec` mode
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
- `
|
|
85
|
-
- `GROQ_API_KEY`
|
|
93
|
+
Useful debug flags:
|
|
94
|
+
- `--dry-run`: show the reduced input and prompt without calling the provider
|
|
95
|
+
- `--show-raw`: print the captured raw input to `stderr`
|
|
86
96
|
|
|
87
|
-
##
|
|
97
|
+
## `test-status` detail modes
|
|
88
98
|
|
|
89
|
-
|
|
90
|
-
sift exec "what changed?" -- git diff
|
|
91
|
-
sift exec --preset test-status -- pytest
|
|
92
|
-
sift exec --preset typecheck-summary -- tsc --noEmit
|
|
93
|
-
sift exec --preset lint-failures -- eslint .
|
|
94
|
-
sift exec --preset audit-critical -- npm audit
|
|
95
|
-
sift exec --preset infra-risk -- terraform plan
|
|
96
|
-
sift exec --preset audit-critical --fail-on -- npm audit
|
|
97
|
-
sift exec --preset infra-risk --fail-on -- terraform plan
|
|
98
|
-
```
|
|
99
|
+
If you are running `npm test` and want `sift` to check the result, use `--preset test-status`.
|
|
99
100
|
|
|
100
|
-
|
|
101
|
+
`test-status` becomes test-aware because you chose the preset. It does **not** infer “this is a test command” from `pytest`, `vitest`, `npm test`, or any other runner name.
|
|
101
102
|
|
|
102
|
-
|
|
103
|
+
Available detail levels:
|
|
104
|
+
|
|
105
|
+
- `standard`
|
|
106
|
+
- short default summary
|
|
107
|
+
- no file list
|
|
108
|
+
- `focused`
|
|
109
|
+
- groups failures by error type
|
|
110
|
+
- shows a few representative failing tests or modules
|
|
111
|
+
- `verbose`
|
|
112
|
+
- flat list of visible failing tests or modules and their normalized reason
|
|
113
|
+
- useful when Codex needs to know exactly what to fix first
|
|
114
|
+
|
|
115
|
+
Examples:
|
|
103
116
|
|
|
104
117
|
```bash
|
|
105
|
-
sift exec
|
|
106
|
-
sift exec --
|
|
118
|
+
sift exec --preset test-status -- npm test
|
|
119
|
+
sift exec --preset test-status --detail focused -- npm test
|
|
120
|
+
sift exec --preset test-status --detail verbose -- npm test
|
|
121
|
+
sift exec --preset test-status --detail verbose --show-raw -- npm test
|
|
107
122
|
```
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
1. runs the command
|
|
111
|
-
2. captures `stdout` and `stderr`
|
|
112
|
-
3. sanitizes, optionally redacts, and truncates the output
|
|
113
|
-
4. sends the reduced input to a smaller model
|
|
114
|
-
5. prints a short answer or JSON
|
|
115
|
-
6. preserves the wrapped command's exit code
|
|
124
|
+
If you use a different runner, swap in your command:
|
|
116
125
|
|
|
117
|
-
|
|
126
|
+
```bash
|
|
127
|
+
sift exec --preset test-status -- pytest
|
|
128
|
+
sift exec --preset test-status --detail focused -- vitest
|
|
129
|
+
sift exec --preset test-status --detail verbose -- bun test
|
|
130
|
+
```
|
|
118
131
|
|
|
119
|
-
|
|
120
|
-
- `infra-risk`
|
|
121
|
-
- `audit-critical`
|
|
132
|
+
Typical shapes:
|
|
122
133
|
|
|
123
|
-
|
|
134
|
+
`standard`
|
|
135
|
+
```text
|
|
136
|
+
- Tests did not complete.
|
|
137
|
+
- 114 errors occurred during collection.
|
|
138
|
+
- Most failures are import/dependency errors during test collection.
|
|
139
|
+
- Missing modules include pydantic, fastapi, botocore, PIL, httpx, numpy.
|
|
140
|
+
```
|
|
124
141
|
|
|
125
|
-
|
|
126
|
-
|
|
142
|
+
`focused`
|
|
143
|
+
```text
|
|
144
|
+
- Tests did not complete.
|
|
145
|
+
- 114 errors occurred during collection.
|
|
146
|
+
- import/dependency errors during collection
|
|
147
|
+
- tests/unit/test_auth_refresh.py -> missing module: botocore
|
|
148
|
+
- tests/unit/test_cognito.py -> missing module: pydantic
|
|
149
|
+
- and 103 more failing modules
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`verbose`
|
|
153
|
+
```text
|
|
154
|
+
- Tests did not complete.
|
|
155
|
+
- 114 errors occurred during collection.
|
|
156
|
+
- tests/unit/test_auth_refresh.py -> missing module: botocore
|
|
157
|
+
- tests/unit/test_cognito.py -> missing module: pydantic
|
|
158
|
+
- tests/unit/test_dataset_use_case_facade.py -> missing module: fastapi
|
|
127
159
|
```
|
|
128
160
|
|
|
129
161
|
## Built-in presets
|
|
130
162
|
|
|
131
|
-
- `test-status`: summarize test
|
|
163
|
+
- `test-status`: summarize test runs
|
|
132
164
|
- `typecheck-summary`: group blocking type errors by root cause
|
|
133
165
|
- `lint-failures`: group repeated lint violations and highlight the files or rules that matter
|
|
134
166
|
- `audit-critical`: extract only high and critical vulnerabilities
|
|
@@ -137,21 +169,25 @@ git diff 2>&1 | sift "what changed?"
|
|
|
137
169
|
- `build-failure`: explain the most likely build failure
|
|
138
170
|
- `log-errors`: extract the most relevant error signals
|
|
139
171
|
|
|
140
|
-
|
|
172
|
+
List or inspect them:
|
|
141
173
|
|
|
142
174
|
```bash
|
|
143
175
|
sift presets list
|
|
144
|
-
sift presets show
|
|
176
|
+
sift presets show test-status
|
|
145
177
|
```
|
|
146
178
|
|
|
147
|
-
##
|
|
179
|
+
## CI-friendly usage
|
|
148
180
|
|
|
149
|
-
-
|
|
150
|
-
- `bullets`
|
|
151
|
-
- `json`
|
|
152
|
-
- `verdict`
|
|
181
|
+
Some commands succeed technically but should still block CI. `--fail-on` handles that for the built-in semantic presets that have stable machine-readable output:
|
|
153
182
|
|
|
154
|
-
|
|
183
|
+
```bash
|
|
184
|
+
sift exec --preset audit-critical --fail-on -- npm audit
|
|
185
|
+
sift exec --preset infra-risk --fail-on -- terraform plan
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Supported presets for `--fail-on`:
|
|
189
|
+
- `audit-critical`
|
|
190
|
+
- `infra-risk`
|
|
155
191
|
|
|
156
192
|
## Config
|
|
157
193
|
|
|
@@ -167,16 +203,16 @@ sift doctor
|
|
|
167
203
|
|
|
168
204
|
`sift config show` masks secrets by default. Use `--show-secrets` only when you explicitly need raw values.
|
|
169
205
|
|
|
170
|
-
|
|
206
|
+
Config precedence:
|
|
171
207
|
1. CLI flags
|
|
172
208
|
2. environment variables
|
|
173
|
-
3. `sift.config.yaml` or `sift.config.yml`
|
|
174
|
-
4. `~/.config/sift/config.yaml` or `~/.config/sift/config.yml`
|
|
209
|
+
3. repo-local `sift.config.yaml` or `sift.config.yml`
|
|
210
|
+
4. machine-wide `~/.config/sift/config.yaml` or `~/.config/sift/config.yml`
|
|
175
211
|
5. built-in defaults
|
|
176
212
|
|
|
177
213
|
If you pass `--config <path>`, that path is strict. Missing explicit config paths are errors.
|
|
178
214
|
|
|
179
|
-
Minimal example:
|
|
215
|
+
Minimal config example:
|
|
180
216
|
|
|
181
217
|
```yaml
|
|
182
218
|
provider:
|
|
@@ -195,16 +231,36 @@ runtime:
|
|
|
195
231
|
rawFallback: true
|
|
196
232
|
```
|
|
197
233
|
|
|
198
|
-
##
|
|
234
|
+
## OpenAI vs OpenAI-compatible
|
|
235
|
+
|
|
236
|
+
Use `provider: openai` for `api.openai.com`.
|
|
237
|
+
|
|
238
|
+
Use `provider: openai-compatible` for third-party compatible gateways or self-hosted endpoints.
|
|
239
|
+
|
|
240
|
+
For OpenAI:
|
|
241
|
+
```bash
|
|
242
|
+
export OPENAI_API_KEY=your_openai_api_key
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
For third-party compatible endpoints, use either the endpoint-native env var or:
|
|
199
246
|
|
|
200
|
-
|
|
247
|
+
```bash
|
|
248
|
+
export SIFT_PROVIDER_API_KEY=your_provider_api_key
|
|
249
|
+
```
|
|
201
250
|
|
|
202
|
-
|
|
251
|
+
Known compatible env fallbacks include:
|
|
252
|
+
- `OPENROUTER_API_KEY`
|
|
253
|
+
- `TOGETHER_API_KEY`
|
|
254
|
+
- `GROQ_API_KEY`
|
|
255
|
+
|
|
256
|
+
## Agent usage
|
|
203
257
|
|
|
204
|
-
The
|
|
205
|
-
-
|
|
258
|
+
The simple rule is:
|
|
259
|
+
- use `sift exec` for long, noisy, non-interactive command output
|
|
206
260
|
- skip `sift` when exact raw output matters
|
|
207
|
-
|
|
261
|
+
|
|
262
|
+
For Codex, put that rule in `~/.codex/AGENTS.md`.
|
|
263
|
+
For Claude Code, put the same rule in `CLAUDE.md`.
|
|
208
264
|
|
|
209
265
|
## Safety and limits
|
|
210
266
|
|
|
@@ -222,13 +278,7 @@ Release flow:
|
|
|
222
278
|
2. merge to `main`
|
|
223
279
|
3. run the `release` workflow manually
|
|
224
280
|
|
|
225
|
-
The workflow
|
|
226
|
-
1. installs dependencies
|
|
227
|
-
2. runs typecheck, tests, and build
|
|
228
|
-
3. packs and smoke-tests the tarball
|
|
229
|
-
4. publishes to npm
|
|
230
|
-
5. creates and pushes the `vX.Y.Z` tag
|
|
231
|
-
6. creates a GitHub Release
|
|
281
|
+
The workflow runs typecheck, tests, coverage, build, packaging smoke checks, npm publish, tag creation, and GitHub Release creation.
|
|
232
282
|
|
|
233
283
|
## Brand assets
|
|
234
284
|
|