Browse Source
G-013: raw input mode as the repl default - per-keystroke debug emissions (add_chunk frame, rhs editbuf view) individually gated and repl-toggleable, raw editor parity for history/cursor movement, debugrepl marked-line form retained for simple terminals with its first-word activation mechanism under review; retires the tcl 8.6 idle-prompt query residue guarded in punk::console 0.7.1. G-014: complete ::punk::config - toml files in the XDG config dir with per-named-subshell override/inherit resolution; first consumer is the G-013 editbuf-view startup default. Write-back persistence deferred. Both proposed; detail files under goals/. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
3 changed files with 127 additions and 0 deletions
@ -0,0 +1,71 @@ |
|||||||
|
# G-013 Raw mode as the repl's default input mode |
||||||
|
|
||||||
|
Status: proposed |
||||||
|
Scope: src/modules/punk/repl-999999.0a1.0.tm, src/modules/punk/console-999999.0a1.0.tm |
||||||
|
Acceptance: as in root GOALS.md index (canonical). |
||||||
|
|
||||||
|
## Context |
||||||
|
|
||||||
|
Line mode is today's default because on Windows it gives OS-provided line editing |
||||||
|
and arrow-key history for free. Raw mode is the intended default, blocked by (1) |
||||||
|
debug output emitted with cursor-move sequences, and (2) unfinished raw editor |
||||||
|
features. Beyond display polish, flipping the default retires the last known |
||||||
|
reader-cooperation hole on tcl 8.6: terminal queries fired while the line-mode |
||||||
|
reader is armed at an idle prompt are hostage-prone by design (punk::console 0.7.1 |
||||||
|
made this fail fast rather than hang; raw default makes it work). It also removes |
||||||
|
the line-mode type-ahead-loss window during terminal-query raw cycling |
||||||
|
(#review, repl-999999.0a1.0.tm ~1677). |
||||||
|
|
||||||
|
## Debug emission inventory (as of repl 0.2.2) |
||||||
|
|
||||||
|
1. **add_chunk top-left frame** (repl ~1145-1173) - per-keystroke framed dump of the |
||||||
|
overtype::renderline merge, painted at row 2 col 1. Currently ungated. This is |
||||||
|
definitely a debug feature: it gets its own toggle, operable from within a |
||||||
|
running repl, default off. |
||||||
|
2. **Right-hand live editbuf view** (console_editbufview, repl ~2043, called ~2315) - |
||||||
|
currently ungated. An important development aid for per-keystroke features |
||||||
|
(e.g. command completion) and stays available, but behind its own separate gate. |
||||||
|
Its startup default should ultimately come from stored configuration via |
||||||
|
::punk::config (see G-014) - toml-backed, independently configurable per named |
||||||
|
subshell - with off as the built-in fallback. Longer term, once the console |
||||||
|
framework is more complete (G-001 backends), this live view could be streamed |
||||||
|
off-console instead - e.g. over udp to a monitoring app, or to a tk text-widget |
||||||
|
system acting as a pseudo terminal. |
||||||
|
3. **console_debugview** (repl ~1976) - already gated (debug_repl > 0). |
||||||
|
4. **Marked-line form** (debug_repl_emit, repl ~2566-2599, debug_repl > 100) - emits |
||||||
|
prefixed lines before the command result via the debugreport pseudo-channel, no |
||||||
|
cursor addressing. Retained as the baseline debug form for simple terminals |
||||||
|
(vt52, other console systems we implement) where complex terminal interaction |
||||||
|
is unavailable or unwanted. |
||||||
|
|
||||||
|
## debugrepl activation review |
||||||
|
|
||||||
|
Current mechanism: first word "debugrepl" in the submitted command is intercepted |
||||||
|
before eval; bare/N/cancel manipulate a oneshot decrementing counter whose |
||||||
|
thresholds (>0, >100) select display layers. Review whether first-word |
||||||
|
interception is worth retaining or whether a proper Tcl command is better: a real |
||||||
|
command can be restricted in subshells via interp hide (aligns with G-003/G-009 |
||||||
|
restriction mechanisms), and named toggles would replace the magic thresholds now |
||||||
|
that gates are separate. Whatever the outcome, the marked-line output form itself |
||||||
|
stays (see inventory item 4). |
||||||
|
|
||||||
|
## Approach notes |
||||||
|
|
||||||
|
- Cursor save/restore is a single slot, not a stack: the code already mixes |
||||||
|
cursorsave_ and plain move_emitblock variants to avoid collisions (comment at |
||||||
|
repl ~2031). Toggleable frames need one coherent cursor-bookkeeping policy. |
||||||
|
- The raw chunk path calls punk::console::get_size per keystroke to position the |
||||||
|
rhs frames (repl ~2296-2308, acknowledged 1+ms). Cache the size with explicit |
||||||
|
invalidation; avoid any per-keystroke terminal query when no debug view is on. |
||||||
|
- Raw editor stubs to replace: arrow-right/up and esc currently just rputs debug |
||||||
|
notices (repl ~2477-2492); history navigation and cursor movement are the |
||||||
|
parity items. |
||||||
|
- Toggle startup defaults resolve through ::punk::config stored configuration when |
||||||
|
available (G-014); built-in defaults apply when no configuration exists. |
||||||
|
|
||||||
|
## Alternatives considered |
||||||
|
|
||||||
|
- Keeping line mode as default and making idle-prompt queries cooperate with the |
||||||
|
8.6 parked reader - rejected: the 8.6 console driver parks a cooked ReadConsole |
||||||
|
that a raw flip cannot rescue (established 2026-07-05); cooperation is not |
||||||
|
achievable there, only fail-fast. |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
# G-014 ::punk::config stored configuration: toml files with named-subshell scoping |
||||||
|
|
||||||
|
Status: proposed |
||||||
|
Scope: src/modules/punk/config-0.1.tm, src/modules/punk/repl-999999.0a1.0.tm, src/modules/punk/repl/codethread-999999.0a1.0.tm |
||||||
|
Acceptance: as in root GOALS.md index (canonical). |
||||||
|
|
||||||
|
## Context |
||||||
|
|
||||||
|
punk::config 0.1 already establishes the config-dir convention (XDG_CONFIG_HOME |
||||||
|
preferred, ~/.config/punk/shell fallback - see punk::config::dir) and declares |
||||||
|
toml as the config file format, with a configset/config.toml startup-file notion |
||||||
|
sketched but not implemented. Runtime configuration today is a mix of env-var |
||||||
|
derived values and hardcoded defaults; there is no path for a user to declare a |
||||||
|
setting in a file and have a feature pick it up, and no way to configure named |
||||||
|
subshells independently. |
||||||
|
|
||||||
|
The immediate consumer motivating completion is G-013: the raw-mode debug-view |
||||||
|
toggles (notably the right-hand live editbuf view) need startup defaults that |
||||||
|
come from stored configuration rather than hardcoded values, and a named subshell |
||||||
|
should be able to carry its own defaults (a subshell dedicated to developing |
||||||
|
per-keystroke features might default the editbuf view on, while the top-level |
||||||
|
shell keeps it off). |
||||||
|
|
||||||
|
## Approach |
||||||
|
|
||||||
|
- toml files under the punk::config::dir location, organised by configset. |
||||||
|
- Resolution order: named-subshell override -> parent/default scope -> built-in |
||||||
|
default. Absence of any config files must be a fully silent, working state |
||||||
|
(beyond the existing missing-dir notice). |
||||||
|
- Settings must be resolvable from the contexts that need them (repl thread and |
||||||
|
code interp / codethread workers), consistent with the G-007 |
||||||
|
location-transparency model. |
||||||
|
- Ties into G-009 themed subshell profiles: a named profile is a natural configset |
||||||
|
consumer. |
||||||
|
|
||||||
|
## Alternatives considered |
||||||
|
|
||||||
|
- Write-back (persisting a toggle changed in a running repl to the toml configset |
||||||
|
on explicit request, surviving restart) - deferred: kept out of acceptance to |
||||||
|
stop this goal sprawling; a natural follow-on goal once read-side resolution is |
||||||
|
proven. |
||||||
|
- Reusing Tcl-native config formats (plain dict/script files) - rejected: toml is |
||||||
|
already the declared format in punk::config 0.1 and is editable/diffable by |
||||||
|
users without Tcl knowledge. |
||||||
Loading…
Reference in new issue