opencode-quill 0.6.4 → 0.7.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/CHANGELOG.md +7 -0
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/options.ts +3 -1
- package/src/predictor.ts +2 -1
- package/src/tui.tsx +2 -2
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.7.0] - 2026-11-14
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **options:** Add minSuggestedWordLength (#22)
|
|
12
|
+
|
|
7
13
|
## [0.6.4] - 2026-11-08
|
|
8
14
|
|
|
9
15
|
### Fixed
|
|
@@ -157,6 +163,7 @@ All notable changes are documented in this file using
|
|
|
157
163
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
158
164
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
159
165
|
|
|
166
|
+
[0.7.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.4...v0.7.0
|
|
160
167
|
[0.6.4]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.3...v0.6.4
|
|
161
168
|
[0.6.3]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.2...v0.6.3
|
|
162
169
|
[0.6.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.1...v0.6.2
|
package/README.md
CHANGED
|
@@ -196,6 +196,7 @@ Restart OpenCode after editing `cli.json`.
|
|
|
196
196
|
| `enabled` | `boolean` | `true` | Initial default for suggestions and learning; a persisted `/quill` toggle takes precedence. |
|
|
197
197
|
| `completeAtLineEnd` | `boolean` | `false` | Also append completions or next words immediately before a newline within a draft. |
|
|
198
198
|
| `completeShell` | `boolean` | `true` | Initial default for shell-mode suggestions and learning; a persisted `/quill shell` toggle takes precedence. |
|
|
199
|
+
| `minSuggestedWordLength` | `number` | `0` | Minimum number of characters in a suggested word, for both prose and shell suggestions; `0` allows any length. |
|
|
199
200
|
| `acceptKeys` | `string[]` | `["tab", "right"]` | Keys that accept and insert the active word suggestion. |
|
|
200
201
|
| `dismissKeys` | `string[]` | `["escape"]` | Keys that dismiss the visible suggestion without inserting. |
|
|
201
202
|
| `cycleNextKeys` | `string[]` | `[]` | Optional keys for the next confident word suggestion. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|
package/src/options.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Options = { enabled: boolean; completeAtLineEnd: boolean; completeShell: boolean; acceptKeys: string[]; dismissKeys: string[]; cycleNextKeys: string[]; cyclePreviousKeys: string[] }
|
|
1
|
+
export type Options = { enabled: boolean; completeAtLineEnd: boolean; completeShell: boolean; minSuggestedWordLength: number; acceptKeys: string[]; dismissKeys: string[]; cycleNextKeys: string[]; cyclePreviousKeys: string[] }
|
|
2
2
|
|
|
3
3
|
function keys(value: unknown, fallback: string[], name: string): string[] {
|
|
4
4
|
if (value === undefined) return fallback
|
|
@@ -12,10 +12,12 @@ export function resolveOptions(input: Readonly<Record<string, unknown>>): Option
|
|
|
12
12
|
if (input.enabled !== undefined && typeof input.enabled !== "boolean") throw new Error("Quill enabled must be a boolean")
|
|
13
13
|
if (input.completeAtLineEnd !== undefined && typeof input.completeAtLineEnd !== "boolean") throw new Error("Quill completeAtLineEnd must be a boolean")
|
|
14
14
|
if (input.completeShell !== undefined && typeof input.completeShell !== "boolean") throw new Error("Quill completeShell must be a boolean")
|
|
15
|
+
if (input.minSuggestedWordLength !== undefined && (typeof input.minSuggestedWordLength !== "number" || !Number.isInteger(input.minSuggestedWordLength) || input.minSuggestedWordLength < 0)) throw new Error("Quill minSuggestedWordLength must be a non-negative integer")
|
|
15
16
|
return {
|
|
16
17
|
enabled: input.enabled !== false,
|
|
17
18
|
completeAtLineEnd: input.completeAtLineEnd === true,
|
|
18
19
|
completeShell: input.completeShell !== false,
|
|
20
|
+
minSuggestedWordLength: input.minSuggestedWordLength ?? 0,
|
|
19
21
|
acceptKeys: keys(input.acceptKeys, ["tab", "right"], "acceptKeys"),
|
|
20
22
|
dismissKeys: keys(input.dismissKeys, ["escape"], "dismissKeys"),
|
|
21
23
|
cycleNextKeys: keys(input.cycleNextKeys, [], "cycleNextKeys"),
|
package/src/predictor.ts
CHANGED
|
@@ -216,7 +216,7 @@ export class WordPredictor {
|
|
|
216
216
|
private followers = new Map<string, string[]>()
|
|
217
217
|
private forms = new Map<string, string>()
|
|
218
218
|
|
|
219
|
-
constructor(prior: readonly Frequency[], readonly grammar: Grammar = proseGrammar) {
|
|
219
|
+
constructor(prior: readonly Frequency[], readonly grammar: Grammar = proseGrammar, private readonly minSuggestedWordLength = 0) {
|
|
220
220
|
for (const { word, count } of prior) {
|
|
221
221
|
const key = grammar.normalize(word)
|
|
222
222
|
if (!grammar.isWord(key) || !Number.isFinite(count) || count <= 0) continue
|
|
@@ -365,6 +365,7 @@ export class WordPredictor {
|
|
|
365
365
|
const base = this.score(word, context, weight < 1) + (query.next ? 0 : 0.003 * Math.min(local.get(word) ?? 0, 3))
|
|
366
366
|
const score = base * weight
|
|
367
367
|
sum += score
|
|
368
|
+
if (this.minSuggestedWordLength && word !== prefix && [...word].length < this.minSuggestedWordLength) continue
|
|
368
369
|
ranked.push({ word, score, weight })
|
|
369
370
|
ranked.sort((a, b) => b.score - a.score)
|
|
370
371
|
if (ranked.length > maximum) ranked.pop()
|
package/src/tui.tsx
CHANGED
|
@@ -24,8 +24,8 @@ export default Plugin.define({
|
|
|
24
24
|
const [shellLearning, setShellLearning] = context.storage.store("shell", {
|
|
25
25
|
initial: { snapshot: emptySnapshot() },
|
|
26
26
|
})
|
|
27
|
-
const predictor = new WordPredictor(frequencies)
|
|
28
|
-
const shellPredictor = new WordPredictor([], shellGrammar)
|
|
27
|
+
const predictor = new WordPredictor(frequencies, proseGrammar, options.minSuggestedWordLength)
|
|
28
|
+
const shellPredictor = new WordPredictor([], shellGrammar, options.minSuggestedWordLength)
|
|
29
29
|
const composers = new Map<string, { marker: BoxRenderable; mode: () => "normal" | "shell" }>()
|
|
30
30
|
const seeded = new Set<string>()
|
|
31
31
|
const inFlight = new Map<string, { pending: boolean; announce: boolean }>()
|