opencode-quill 0.6.3 → 0.6.4
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/CHANGELOG.md +7 -0
- package/README.md +4 -1
- package/package.json +5 -5
- package/src/predictor.ts +24 -9
- package/src/shell.ts +8 -2
- package/src/tui.tsx +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes are documented in this file using
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.6.4] - 2026-11-08
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Harden shell secret masking and tighten predictor hot paths (#20)
|
|
12
|
+
|
|
7
13
|
## [0.6.3] - 2026-11-01
|
|
8
14
|
|
|
9
15
|
### Fixed
|
|
@@ -151,6 +157,7 @@ All notable changes are documented in this file using
|
|
|
151
157
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
152
158
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
153
159
|
|
|
160
|
+
[0.6.4]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.3...v0.6.4
|
|
154
161
|
[0.6.3]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.2...v0.6.3
|
|
155
162
|
[0.6.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.1...v0.6.2
|
|
156
163
|
[0.6.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.0...v0.6.1
|
package/README.md
CHANGED
|
@@ -56,7 +56,10 @@ and restart OpenCode ([details](#install)).
|
|
|
56
56
|
subcommands and flags from a separate vocabulary learned from the commands
|
|
57
57
|
you ran, never from prose. Shell completion is case-sensitive, never corrects
|
|
58
58
|
typos, and skips paths, quoted strings, `$` expansions, assignments and any
|
|
59
|
-
command that mentions a token, secret, password, key or
|
|
59
|
+
command that mentions a token, secret, password, passphrase, key, cookie or
|
|
60
|
+
credential, passes a password flag (`curl -u user:pass`, `mysql -p…`,
|
|
61
|
+
`sshpass -p`, `docker login -p`), or contains a recognisable API token
|
|
62
|
+
(`sk-`, `ghp_`, `glpat-`, `xoxb-`, JWT, AWS key ID). Attachment and pasted-text chips are treated as non-prose:
|
|
60
63
|
words are still suggested after them, but never inside them, and typo
|
|
61
64
|
replacements are not offered while a chip is present.
|
|
62
65
|
- **End-of-draft by default:** Suggestions appear on a partial word or after a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "OpenCode prompt autocomplete: local n-gram word and next-word prediction shown as inline ghost text in the TUI composer, accepted with Tab.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"prepublishOnly": "bun run test && bun run typecheck"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@opentui/core": "^0.8.
|
|
55
|
-
"@opentui/solid": "^0.8.
|
|
54
|
+
"@opentui/core": "^0.8.1",
|
|
55
|
+
"@opentui/solid": "^0.8.1",
|
|
56
56
|
"subtlex-word-frequencies": "2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^21.2.2",
|
|
64
64
|
"@commitlint/config-conventional": "^21.2.2",
|
|
65
|
-
"@opencode/plugin": "2.2.
|
|
65
|
+
"@opencode/plugin": "2.2.6",
|
|
66
66
|
"@types/bun": "^1.4.2",
|
|
67
|
-
"@types/node": "26.6.
|
|
67
|
+
"@types/node": "26.6.6",
|
|
68
68
|
"husky": "^9.1.7",
|
|
69
69
|
"solid-js": "1.9.12",
|
|
70
70
|
"typescript": "7.0.2"
|
package/src/predictor.ts
CHANGED
|
@@ -212,6 +212,8 @@ export class WordPredictor {
|
|
|
212
212
|
private bigramTotals = new Map<string, Totals>()
|
|
213
213
|
private trigramTotals = new Map<string, Totals>()
|
|
214
214
|
private vocabulary: string[] = []
|
|
215
|
+
private known = new Set<string>()
|
|
216
|
+
private followers = new Map<string, string[]>()
|
|
215
217
|
private forms = new Map<string, string>()
|
|
216
218
|
|
|
217
219
|
constructor(prior: readonly Frequency[], readonly grammar: Grammar = proseGrammar) {
|
|
@@ -245,6 +247,18 @@ export class WordPredictor {
|
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
this.vocabulary = [...new Set([...this.prior.keys(), ...learned.filter((word) => !fragments.has(word))])].sort()
|
|
250
|
+
this.known = new Set(this.vocabulary)
|
|
251
|
+
this.followers = new Map()
|
|
252
|
+
for (const map of [this.personal.bigrams, this.personal.trigrams]) {
|
|
253
|
+
for (const [key, count] of map) {
|
|
254
|
+
if (count < 2) continue
|
|
255
|
+
const split = key.lastIndexOf("\0")
|
|
256
|
+
const context = key.slice(0, split)
|
|
257
|
+
const list = this.followers.get(context) ?? []
|
|
258
|
+
list.push(key.slice(split + 1))
|
|
259
|
+
this.followers.set(context, list)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
248
262
|
const forms = new Map<string, [string, number]>()
|
|
249
263
|
for (const [form, count] of this.personal.forms) {
|
|
250
264
|
const word = this.grammar.normalize(form)
|
|
@@ -315,10 +329,6 @@ export class WordPredictor {
|
|
|
315
329
|
return resolved
|
|
316
330
|
}
|
|
317
331
|
|
|
318
|
-
complete(query: CompletionQuery): Prediction | undefined {
|
|
319
|
-
return this.candidates(query, 1)[0]
|
|
320
|
-
}
|
|
321
|
-
|
|
322
332
|
candidates(query: CompletionQuery, limit = 5): Prediction[] {
|
|
323
333
|
const maximum = Number.isFinite(limit) ? Math.max(0, Math.min(5, Math.floor(limit))) : 5
|
|
324
334
|
if (!maximum) return []
|
|
@@ -337,10 +347,15 @@ export class WordPredictor {
|
|
|
337
347
|
(pair ? this.personal.trigrams.get(`${pair}\0${word}`) ?? 0 : 0) >= 2
|
|
338
348
|
const eligible = (word: string) => !query.next || followed(word)
|
|
339
349
|
const candidates = new Map<string, number>()
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
|
|
350
|
+
if (query.next) {
|
|
351
|
+
const next = new Set([...this.followers.get(previous ?? "") ?? [], ...(pair && this.followers.get(pair)) || []])
|
|
352
|
+
for (const word of [...next].sort()) if (this.known.has(word) && word.startsWith(prefix)) candidates.set(word, 1)
|
|
353
|
+
} else {
|
|
354
|
+
for (let index = lowerBound(this.vocabulary, prefix); index < this.vocabulary.length; index++) {
|
|
355
|
+
const word = this.vocabulary[index]
|
|
356
|
+
if (!word.startsWith(prefix)) break
|
|
357
|
+
if (slash === word.includes("/")) candidates.set(word, 1)
|
|
358
|
+
}
|
|
344
359
|
}
|
|
345
360
|
for (const word of local.keys()) if (!word.includes("/") && word.startsWith(prefix) && (query.next || !slash) && eligible(word)) candidates.set(word, 1)
|
|
346
361
|
const suggest = (): Prediction[] => {
|
|
@@ -364,7 +379,7 @@ export class WordPredictor {
|
|
|
364
379
|
const form = this.forms.get(best) ?? best
|
|
365
380
|
const shouting = this.grammar.prose && query.prefix.length > 1 && query.prefix === query.prefix.toUpperCase()
|
|
366
381
|
if (bestWeight < 1 || (!query.next && best.startsWith("i'") && query.prefix[0] === "i") ||
|
|
367
|
-
(!query.next && !shouting && form !== best && !form.startsWith(query.prefix))) {
|
|
382
|
+
(!query.next && ((!shouting && form !== best && !form.startsWith(query.prefix)) || form.length !== best.length))) {
|
|
368
383
|
predictions.push({ suffix: applyCase(query.prefix, form), word: best, confidence, replace: query.prefix.length })
|
|
369
384
|
} else if (query.next) {
|
|
370
385
|
predictions.push({ suffix: this.grammar.prose ? applyCase("", form) : form, word: best, confidence })
|
package/src/shell.ts
CHANGED
|
@@ -5,7 +5,13 @@ const PIECE = new RegExp(`^(?:-{1,2}|${NAME})$`)
|
|
|
5
5
|
const WORD = /-{0,2}[A-Za-z](?:[A-Za-z0-9._+:-]*[A-Za-z0-9])?/g
|
|
6
6
|
const WHOLE_WORD = /^-{0,2}[A-Za-z](?:[A-Za-z0-9._+:-]*[A-Za-z0-9])?$/
|
|
7
7
|
const OPERATORS = /[|;&<>()]+/
|
|
8
|
-
const
|
|
8
|
+
const SECRET_WORDS = /token|secret|passw|passphrase|\bpass:|\s-pass(?:in|out)?\b|pwd=|bearer|authorization|credential|(?:api|access|private)[-_]?key|cookie\s*[:=]|--cookie|\b(?:curl|wget)\b.*cookie/i
|
|
9
|
+
const SECRET_SHAPES = new RegExp([
|
|
10
|
+
/\bsk[-_]|\bgh[pousr]_|\bgithub_pat_|\bglpat-|\bxox[abprs]-|\beyJ[\w-]{10,}|\bAKIA[0-9A-Z]{16}/.source,
|
|
11
|
+
/\b(?:curl|wget|https?|xh)\b.*\s(?:-u\s*|--user[\s=]+)\S*:/.source,
|
|
12
|
+
/\b(?:mysql|mysqldump|mysqladmin|mariadb)\b.*\s-p\S/.source,
|
|
13
|
+
/\b(?:sshpass|redis-cli|mongosh?)\b.*\s-[pa]|\b(?:docker|podman)\s+login\b.*\s-p\b|\bzip\b.*\s-P\s/.source,
|
|
14
|
+
].join("|"))
|
|
9
15
|
const QUOTED = /"(?:[^"\\\n]|\\.)*"?|'[^'\n]*'?|`[^`\n]*`?|\$\{[^}\n]*\}?|\$\([^)\n]*\)?|\$[\w@#?*!$-]*/g
|
|
10
16
|
|
|
11
17
|
function plausible(piece: string): boolean {
|
|
@@ -13,7 +19,7 @@ function plausible(piece: string): boolean {
|
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export function maskShell(text: string): string {
|
|
16
|
-
if (
|
|
22
|
+
if (SECRET_WORDS.test(text) || SECRET_SHAPES.test(text)) return blank(text)
|
|
17
23
|
return text.replace(QUOTED, blank).replace(/\S+/g, (token) => token.split(OPERATORS).every(plausible) ? token : blank(token))
|
|
18
24
|
}
|
|
19
25
|
|
package/src/tui.tsx
CHANGED
|
@@ -42,10 +42,16 @@ export default Plugin.define({
|
|
|
42
42
|
return route.type === "home" ? "home" : route.type === "session" ? route.sessionID : undefined
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
let found: { marker: BoxRenderable; editor: TextareaRenderable | undefined; text: string } | undefined
|
|
45
46
|
const currentEditor = () => {
|
|
46
47
|
const key = routeKey()
|
|
47
48
|
const composer = key && composers.get(key)
|
|
48
|
-
|
|
49
|
+
if (!composer) return
|
|
50
|
+
const cached = found?.marker === composer.marker && found.editor
|
|
51
|
+
if (cached && !cached.isDestroyed && !composer.marker.isDestroyed && cached.parent && !cached.parent.isDestroyed && cached.plainText === found!.text) return cached
|
|
52
|
+
const editor = findComposer(composer.marker, (node): node is TextareaRenderable => node instanceof TextareaRenderable && !(node instanceof InputRenderable))
|
|
53
|
+
found = { marker: composer.marker, editor, text: editor?.plainText ?? "" }
|
|
54
|
+
return editor
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
const syncEditor = () => {
|