Skip to content

emrg: GUI / 指令 P1 — 解析器 + 补全菜单 + 纯操作类指令 - #486

Merged
argszero merged 1 commit into
masterfrom
feature/gui-slash-commands-p1
Aug 6, 2026
Merged

emrg: GUI / 指令 P1 — 解析器 + 补全菜单 + 纯操作类指令#486
argszero merged 1 commit into
masterfrom
feature/gui-slash-commands-p1

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

GUI / command support — P1 (parser + autocomplete + pure ops) of rant 19:44 ("GUI 全面支持 TUI 的 / 指令"). Command parsing lives entirely in the renderer/main side; daemon is zero-change (existing protocol reused).

What's in P1

  • renderer/js/commands.js — command registry with all 15 TUI slash commands (/clear /compact /delete /help /image /memory /model /rant /rename /resume /rewind /sessions /skills /trigger /version), each with a hint and a phase tag (1=pure ops, 2=sessions, 3=model/memory/skills, 4=evolution)
  • parseInput() — three-state parse: message / command (case-insensitive, with args) / unknown
  • / autocomplete menu — appears when input starts with /, filters as you type, navigable with ↑↓/Enter/click, Esc closes
  • Pure-op commands implemented (phase 1): /clear (clear_session), /compact (compact), /version (instance info), /help (dialog listing all 15 commands), /image (paste hint). Phase 2+ commands show a friendly "coming in a later phase" message
  • main.js IPC: emrg:clearSession / emrg:compactSession (reuse existing daemon clear_session / compact protocol)
  • Help dialog with all commands + friendly hints

Verification

  • cd emrg/gui && npm test47 passed (3 new commands.test.js + smoke test module list updated)
  • uv run pytest tests/ -q — 473 passed (no Python changes)
  • uv run python -c "from emrg.client.app import run_client" ✓ / uv run python -m emrg --help

Staging (per rant)

P1 parser+autocomplete+pure ops (this PR) → P2 session commands → P3 model/memory/skills → P4 evolution (/rant dialog, /trigger) → P5 regression + docs.

- commands.js 指令注册表:TUI 15 个 / 指令全部注册(hint + phase 分期)
- parseInput 三态:message / command / unknown
- / 补全菜单:输入即过滤,↑↓/Enter/点击选择,Esc 关闭
- 纯操作类已实现:/clear /compact /version /help /image(daemon 零改动,复用现有协议)
- main.js IPC:emrg:clearSession / emrg:compactSession
- 测试:commands.test.js 3 项 + smoke test 模块列表更新(47 pass)

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 200725 (self-check)

Registry covers all 15 TUI slash commands with hints + phase tags; parseInput three-state verified by tests (message/command/unknown, case-insensitive, args). Autocomplete filters as you type with ↑↓/Enter/click/Esc. Pure ops (/clear /compact /version /help /image) route through existing daemon protocol — daemon zero-change. main.js IPC validates session_id before sendCommandAndWait. npm test 47 passed (3 new), pytest 473 passed.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-202237

Verified:

  1. commands.js registry covers all 15 TUI slash commands with hint + phase (1-4)
  2. parseInput three-state (message/command/unknown), case-insensitive, args split — tested
  3. getCompletions prefix filter + hint passthrough — tested
  4. P1 pure-ops wired via existing daemon protocol (clear_session/compact) — daemon zero-change confirmed
  5. Autocomplete menu keyboard nav (↑↓/Enter/Esc) consistent with v0.2.6 keyboard accessibility
  6. Phase 2+ commands correctly show '暂未开放'
  7. Tests verified in worktree: commands.test.js (3) + renderer.smoke.test.js (15) all pass; full suite 44/44 on master (worktree env failure is pre-existing .venv path assertion, unrelated)

Minor (non-blocking): switchSession comment merged onto signature line — cosmetic, can clean up in follow-up.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-202708 (emrg-00c41753)

Re-verified independently this cycle:

  1. main.js: clearSession/compactSession IPC handlers validate sessionId, use existing daemon protocol (clear_session/compact) — daemon zero-change
  2. commands.js: 15-command registry (hint + phase 1-4), parseInput three-state, getCompletions prefix filter
  3. Tests re-run in worktree: commands.test.js + renderer.smoke.test.js 18/18 pass
  4. Autocomplete keyboard nav (↑↓/Enter/Esc) consistent with v0.2.6 accessibility
  5. Phase 2+ commands gate via meta.phase — staged rollout correct

3rd LGTM (3/3) — mergeable

@argszero
argszero merged commit 1b3572a into master Aug 6, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 6, 2026
* emrg: persist repo URL in install-info.json for evolution workspace self-heal (rant 20:42)

_cache_tool_paths now also writes 'repo' = https://github.com/argszero/emrg.git
alongside git_path/gh_path. Complements PR #489's read side: packaged
installs have no git remote to detect, so the clone-on-demand self-heal
needs a repo source persisted at runtime.

2 new tests (repo field written, existing fields preserved).

* emrg: GUI / 指令 P3 — 模型/记忆/技能类指令(/model /memory /skills,rant 19:44)

Phase 3 of GUI slash-command support (rant 2026-08-06T19:44:38; P1 #486,
P2 #487 merged). Opens /model /memory /skills in the GUI:

- /model → triggers the existing model switcher (click .model-switcher)
- /memory [session|<id>] → memory browser dialog:
  list_memories → click a memory → read_memory → inline detail panel
- /skills → skills list dialog (main process reads ~/.emrg/skills and
  <projectDir>/.emrg/skills frontmatter; daemon has no skills protocol,
  mirrors TUI's local load_skills)

main.js: new IPC emrg:listMemories / emrg:readMemory (daemon
list_memories/read_memory protocol, session scope validated) /
emrg:listSkills (local fs read, no daemon change). preload.js exposes
them. index.html: memory-dialog + skills-dialog. components.css:
.memory-detail styles. commands.js phase comments updated.

Tests: app-commands +4 P3 route tests (55 total GUI, was 51); smoke
element IDs updated. pytest 475 passed; import + --help OK.

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 6, 2026
Version bump 0.2.7 → 0.2.8 across all 6 version sources
(pyproject.toml / emrg/__init__.py / make-installer.sh /
build-runtime.sh / gui/package.json / uv.lock). Release includes
#486/#487/#491 GUI slash commands P1-P3, #488/#492/#493 i18n prompts,
#489/#490 evolution workspace self-heal, #484/#485 README/language
policy, #483 docs cleanup. test_version_sync all green.

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 6, 2026
Phase 4 — final phase of GUI slash-command support (rant 19:44; P1 #486,
P2 #487, P3 #491 merged). All 15 TUI slash commands now work in the GUI:

- /rant [message] → evolution dialog with project dropdown (list_projects)
  + textarea; /rant <text> submits directly; sends via daemon rant
  protocol (field order timestamp/project/status/progress/completed/message
  preserved by daemon)
- /trigger [name] → task list dialog (list_tasks); /trigger <name>
  triggers immediately via daemon trigger_task

main.js: new IPC emrg:listProjects / emrg:listTasks / emrg:triggerTask /
emrg:sendRant (daemon protocols already exist — zero daemon changes).
preload.js exposes them. index.html: rant-dialog + tasks-dialog.
commands.js phase comments updated (1-4 all done).

Tests: app-commands +4 P4 route tests (58 total GUI, was 55); smoke
element IDs updated. pytest 480 passed; import + --help OK.

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/gui-slash-commands-p1 branch August 6, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant