moqi-tui 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/bin/moqi.mjs +38 -0
  2. package/package.json +2 -2
package/bin/moqi.mjs CHANGED
@@ -6,8 +6,14 @@
6
6
  * Works identically from a git checkout and a global npm install — the
7
7
  * package root is resolved from this file's own location, and the profile's
8
8
  * `link:` dependency points at whichever copy is running.
9
+ *
10
+ * Arguments are read before anything is written. Installing the profile
11
+ * rewrites `$DSH_HOME/profiles/tui` and repoints it at whichever copy of the
12
+ * package is running, so `moqi --help` used to hijack a working profile just
13
+ * by asking what the flags were.
9
14
  */
10
15
  import { execFileSync } from 'node:child_process'
16
+ import { readFileSync } from 'node:fs'
11
17
  import { dirname, resolve } from 'node:path'
12
18
  import { fileURLToPath } from 'node:url'
13
19
 
@@ -15,6 +21,38 @@ const here = dirname(fileURLToPath(import.meta.url))
15
21
  const root = resolve(here, '..')
16
22
 
17
23
  const args = process.argv.slice(2)
24
+
25
+ /** The launcher's own flags, which never reach dsh and never touch the disk. */
26
+ const asks = (...names) => args.some((arg) => names.includes(arg))
27
+
28
+ if (asks('-h', '--help')) {
29
+ const { name } = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'))
30
+ console.log(
31
+ [
32
+ 'moqi — the unspoken understanding between you and your harness.',
33
+ '',
34
+ 'Usage:',
35
+ ' moqi [dsh flags…] install or refresh the tui profile, then start it',
36
+ ' moqi install install or refresh the profile and stop',
37
+ ' moqi --help this message',
38
+ ' moqi --version the installed version',
39
+ '',
40
+ 'Flags other than these are passed to dsh, so the app\'s own options',
41
+ '(--resume, --model, --thinking, --mouse, --peer, …) work as documented.',
42
+ 'For that list, run: dsh --profile tui --help',
43
+ '',
44
+ `Installed from ${name}; the profile it manages is $DSH_HOME/profiles/tui.`,
45
+ ].join('\n'),
46
+ )
47
+ process.exit(0)
48
+ }
49
+
50
+ if (asks('-v', '--version')) {
51
+ const { version } = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'))
52
+ console.log(version)
53
+ process.exit(0)
54
+ }
55
+
18
56
  const command = args[0] === 'install' ? 'install' : 'run'
19
57
 
20
58
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moqi-tui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Moqi — the unspoken understanding between you and your harness. A terminal app for DeepSeek Harness: bordered composer, live token counter, slash palette, markdown transcript with syntax-highlighted code.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "link-types": "node scripts/link-harness-types.mjs",
50
50
  "install-profile": "node scripts/install-profile.mjs",
51
51
  "prepublishOnly": "npm run build && npm run typecheck && npm test && npm run test:package",
52
- "test": "node tests/harness-root-smoke.mjs && node --experimental-strip-types tests/offline-imports-smoke.ts && node --experimental-strip-types tests/keys-smoke.ts && node --experimental-strip-types tests/render-smoke.ts && node --experimental-strip-types tests/atfile-smoke.ts && node --experimental-strip-types tests/panels-smoke.ts && node --experimental-strip-types tests/selection-smoke.ts && node --experimental-strip-types tests/rewind-smoke.ts && node --experimental-strip-types tests/jobs-smoke.ts && node --experimental-strip-types tests/cross-find-smoke.ts && node --experimental-strip-types tests/tui-host-smoke.ts && node --experimental-strip-types tests/mcp-smoke.ts && node --experimental-strip-types tests/i18n-smoke.ts && node --experimental-strip-types tests/render-cache-smoke.ts && node --experimental-strip-types tests/vim-smoke.ts && node --experimental-strip-types tests/queue-smoke.ts && node --experimental-strip-types tests/persist.ts && node --experimental-strip-types tests/stream-smoke.ts && node --experimental-strip-types tests/tool-detail-smoke.ts && node --experimental-strip-types tests/export-smoke.ts && node --experimental-strip-types tests/sessions-store-smoke.ts && node --experimental-strip-types tests/rename-smoke.ts && node --experimental-strip-types tests/fleet-smoke.ts && node --experimental-strip-types tests/theme-smoke.ts && node --experimental-strip-types tests/plugins-smoke.ts && node --experimental-strip-types tests/voice-smoke.ts && node --experimental-strip-types tests/patch-smoke.ts && node --experimental-strip-types tests/pty.ts",
52
+ "test": "node tests/harness-root-smoke.mjs && node --experimental-strip-types tests/offline-imports-smoke.ts && node --experimental-strip-types tests/launcher-smoke.ts && node --experimental-strip-types tests/keys-smoke.ts && node --experimental-strip-types tests/render-smoke.ts && node --experimental-strip-types tests/atfile-smoke.ts && node --experimental-strip-types tests/panels-smoke.ts && node --experimental-strip-types tests/selection-smoke.ts && node --experimental-strip-types tests/rewind-smoke.ts && node --experimental-strip-types tests/jobs-smoke.ts && node --experimental-strip-types tests/cross-find-smoke.ts && node --experimental-strip-types tests/tui-host-smoke.ts && node --experimental-strip-types tests/mcp-smoke.ts && node --experimental-strip-types tests/i18n-smoke.ts && node --experimental-strip-types tests/render-cache-smoke.ts && node --experimental-strip-types tests/vim-smoke.ts && node --experimental-strip-types tests/queue-smoke.ts && node --experimental-strip-types tests/persist.ts && node --experimental-strip-types tests/stream-smoke.ts && node --experimental-strip-types tests/tool-detail-smoke.ts && node --experimental-strip-types tests/export-smoke.ts && node --experimental-strip-types tests/sessions-store-smoke.ts && node --experimental-strip-types tests/rename-smoke.ts && node --experimental-strip-types tests/fleet-smoke.ts && node --experimental-strip-types tests/theme-smoke.ts && node --experimental-strip-types tests/plugins-smoke.ts && node --experimental-strip-types tests/voice-smoke.ts && node --experimental-strip-types tests/patch-smoke.ts && node --experimental-strip-types tests/pty.ts",
53
53
  "preview": "node --experimental-strip-types tests/preview.ts",
54
54
  "test:pty": "node --experimental-strip-types tests/pty.ts",
55
55
  "setup-voice": "node scripts/install-voice.mjs",