quilltap 4.13.0-dev.8 → 4.14.0-dev.44
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/README.md +17 -3
- package/bin/quilltap.js +17 -1
- package/lib/__tests__/theme-commands.test.js +241 -0
- package/lib/completion/bash.template +3 -3
- package/lib/completion/fish.template +1 -0
- package/lib/completion/zsh.template +1 -0
- package/lib/theme-commands.js +169 -222
- package/lib/theme-engine.generated.js +170 -0
- package/package.json +4 -4
- package/lib/theme-validation.js +0 -423
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ quilltap [options]
|
|
|
37
37
|
|
|
38
38
|
Options:
|
|
39
39
|
-p, --port <number> Port to listen on (default: 3000)
|
|
40
|
+
--host <address> Address to bind (default: 127.0.0.1)
|
|
40
41
|
-d, --data-dir <path> Data directory (default: platform-specific)
|
|
41
42
|
-o, --open Open browser after server starts
|
|
42
43
|
-v, --version Show version number
|
|
@@ -56,6 +57,10 @@ quilltap --port 8080
|
|
|
56
57
|
# Use a custom data directory
|
|
57
58
|
quilltap --data-dir /mnt/data/quilltap
|
|
58
59
|
|
|
60
|
+
# Listen on every interface (Quilltap has no login: trusted networks only;
|
|
61
|
+
# reach it by IP address, or list host names in QUILLTAP_ALLOWED_HOSTS)
|
|
62
|
+
quilltap --host 0.0.0.0
|
|
63
|
+
|
|
59
64
|
# Start and open browser automatically
|
|
60
65
|
quilltap --open
|
|
61
66
|
|
|
@@ -96,14 +101,19 @@ Register a data directory once and point the CLI at it by name, instead of repea
|
|
|
96
101
|
```bash
|
|
97
102
|
quilltap instances add Friday ~/iCloud/Quilltap/Friday # Register (prompts for the passphrase if encrypted)
|
|
98
103
|
quilltap instances list # Registered instances (* marks the default)
|
|
104
|
+
quilltap instances show Friday # One instance (passphrase status only, never the value)
|
|
105
|
+
quilltap instances path # Print the path to instances.json
|
|
106
|
+
quilltap instances set-passphrase Friday # Change or clear the stored passphrase (prompts hidden)
|
|
99
107
|
quilltap instances default Friday # Make it the fall-through for flag-free runs
|
|
100
108
|
quilltap instances rename Friday Weekday # Rename, preserving the stored passphrase
|
|
101
|
-
quilltap instances remove Friday # Unregister
|
|
109
|
+
quilltap instances remove Friday # Unregister (aliases: rm, delete)
|
|
102
110
|
quilltap instances restore-key Friday # Rebuild a lost or passphrase-locked .dbkey
|
|
103
111
|
quilltap instances default --clear # Revert to the OS platform default
|
|
104
112
|
quilltap instances list --json # The registry as JSON, for scripts
|
|
105
113
|
```
|
|
106
114
|
|
|
115
|
+
`instances set-passphrase` changes only the passphrase the *registry* remembers for an instance, not the one its `.dbkey` is wrapped with. It first offers to clear the stored passphrase; otherwise it prompts twice, hidden, and checks the new one against the instance's `.dbkey` before saving — a passphrase that does not unlock it, or a `.dbkey` that needs none, is refused. With no `.dbkey` on disk yet, it saves without the check. To change the passphrase the database itself is locked with, use the server's Change Passphrase card.
|
|
116
|
+
|
|
107
117
|
If an instance's `quilltap.dbkey` goes missing — or its passphrase does — `instances restore-key` rebuilds it. The file only *wraps* the pepper; the pepper itself is the database key, so an operator who kept the one printed at first-run setup can get back in. The pepper is read from `ENCRYPTION_MASTER_PEPPER` or prompted for hidden, never passed as a flag, and it is proved against the encrypted databases on disk before anything is written. Run it with the server down — the command refuses while the instance lock is held. Flags: `--passphrase <pass>` / `--no-passphrase` (the new wrapping), `-d, --data-dir <path>`, `--force` (proceed when there is no encrypted database to prove against — a fresh or still-plaintext instance), `-y, --yes`. An existing key file is backed up to `quilltap.dbkey.bak-<timestamp>` first, and a registered instance's stored passphrase is updated to match.
|
|
108
118
|
|
|
109
119
|
**It does not re-encrypt character archive bundles.** Those are keyed on the *passphrase*, not the pepper; only the server's Change Passphrase card rewrites them. Bundles made under a passphrase you have just replaced still want the old one.
|
|
@@ -478,10 +488,10 @@ The CLI includes theme management commands:
|
|
|
478
488
|
```bash
|
|
479
489
|
quilltap themes list # List all installed themes
|
|
480
490
|
quilltap themes install my.qtap-theme # Install a .qtap-theme bundle
|
|
481
|
-
quilltap themes validate my.qtap-theme # Validate a bundle
|
|
491
|
+
quilltap themes validate my.qtap-theme # Validate a bundle (or a bundle directory)
|
|
482
492
|
quilltap themes uninstall my-theme # Uninstall a bundle theme
|
|
483
493
|
quilltap themes export earl-grey # Export any theme as a bundle
|
|
484
|
-
quilltap themes create sunset #
|
|
494
|
+
quilltap themes create sunset # Write a blank theme bundle to ./sunset/
|
|
485
495
|
quilltap themes search "dark" # Search registries
|
|
486
496
|
quilltap themes update # Check for theme updates
|
|
487
497
|
quilltap themes registry list # List configured registries
|
|
@@ -494,6 +504,10 @@ quilltap themes registry keygen [--output <dir>] # Generate an Ed25519 keypa
|
|
|
494
504
|
quilltap themes registry sign <dir> --key <private> # Sign a registry directory
|
|
495
505
|
```
|
|
496
506
|
|
|
507
|
+
Bundles are checked by the same theme engine the app uses, so `validate` reports exactly what an install would: schema errors in `theme.json` and `tokens.json`, and warnings from the hook lint with the file and line. Only version 2 bundles are accepted — `validate`, `install`, `update` and `export` all refuse one made for an earlier Quilltap. Archives containing symbolic links or paths that leave the bundle are refused.
|
|
508
|
+
|
|
509
|
+
`create <name>` writes a blank version 2 bundle — `theme.json` and an empty `tokens.json`, both naming their published schema — to `./<id>/`, the id derived from the name as the Atelier derives one (`"Brass Parlour"` → `brass-parlour`). It is the same pair of files a new draft in the Atelier starts from, and it refuses a directory that already exists. From there, pack the folder as a `.qtap-theme` and open it in the Atelier with **Open a theme file**; the Atelier is where a theme is made.
|
|
510
|
+
|
|
497
511
|
## Shell Completion
|
|
498
512
|
|
|
499
513
|
Tab-completion for bash, zsh, and fish. Pick the block that matches your shell.
|
package/bin/quilltap.js
CHANGED
|
@@ -29,6 +29,7 @@ function getVersion() {
|
|
|
29
29
|
function parseArgs(argv) {
|
|
30
30
|
const opts = {
|
|
31
31
|
port: 3000,
|
|
32
|
+
host: '',
|
|
32
33
|
dataDir: '',
|
|
33
34
|
instance: '',
|
|
34
35
|
open: false,
|
|
@@ -49,6 +50,13 @@ function parseArgs(argv) {
|
|
|
49
50
|
process.exit(1);
|
|
50
51
|
}
|
|
51
52
|
break;
|
|
53
|
+
case '--host':
|
|
54
|
+
opts.host = args[++i];
|
|
55
|
+
if (!opts.host) {
|
|
56
|
+
console.error('Error: --host needs an address (e.g. 127.0.0.1 or 0.0.0.0)');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
52
60
|
case '--data-dir':
|
|
53
61
|
case '-d':
|
|
54
62
|
opts.dataDir = args[++i];
|
|
@@ -108,6 +116,8 @@ Subcommands:
|
|
|
108
116
|
|
|
109
117
|
Options:
|
|
110
118
|
-p, --port <number> Port to listen on (default: 3000)
|
|
119
|
+
--host <address> Address to bind (default: 127.0.0.1; 0.0.0.0 for every
|
|
120
|
+
interface — there is no login, so only on a trusted network)
|
|
111
121
|
-d, --data-dir <path> Data directory (default: platform-specific)
|
|
112
122
|
-i, --instance <name> Use a registered instance (see 'quilltap instances')
|
|
113
123
|
-o, --open Open browser after server starts
|
|
@@ -358,8 +368,11 @@ async function main() {
|
|
|
358
368
|
...process.env,
|
|
359
369
|
NODE_ENV: 'production',
|
|
360
370
|
PORT: String(opts.port),
|
|
361
|
-
HOSTNAME: '0.0.0.0',
|
|
362
371
|
};
|
|
372
|
+
// Loopback unless asked otherwise: Quilltap has no login.
|
|
373
|
+
const bindHost = opts.host || process.env.QUILLTAP_HOST || '127.0.0.1';
|
|
374
|
+
env.QUILLTAP_HOST = bindHost;
|
|
375
|
+
env.HOSTNAME = bindHost;
|
|
363
376
|
|
|
364
377
|
if (opts.dataDir && opts.instance) {
|
|
365
378
|
console.error('Error: Specify either --instance or --data-dir, not both.');
|
|
@@ -393,6 +406,9 @@ async function main() {
|
|
|
393
406
|
console.log(` Quilltap v${version}`);
|
|
394
407
|
console.log('');
|
|
395
408
|
console.log(` URL: ${url}`);
|
|
409
|
+
if (bindHost !== '127.0.0.1' && bindHost !== 'localhost' && bindHost !== '::1') {
|
|
410
|
+
console.log(` Bind: ${bindHost} — reachable from the network; Quilltap has no login`);
|
|
411
|
+
}
|
|
396
412
|
if (opts.dataDir) {
|
|
397
413
|
console.log(` Data dir: ${env.QUILLTAP_DATA_DIR}`);
|
|
398
414
|
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `quilltap themes` against the bundled theme engine.
|
|
3
|
+
*
|
|
4
|
+
* The CLI validates, installs and exports through the same engine the app
|
|
5
|
+
* uses (theme-engine.generated.js): version 2 bundles only, one extraction
|
|
6
|
+
* routine that refuses symbolic links and escaping paths, and theme ids that
|
|
7
|
+
* cannot name a directory outside the themes folder.
|
|
8
|
+
*
|
|
9
|
+
* @jest-environment node
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const fsp = require('fs/promises');
|
|
16
|
+
const os = require('os');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const { execFileSync } = require('child_process');
|
|
19
|
+
|
|
20
|
+
const engine = require('../theme-engine.generated');
|
|
21
|
+
const { themesCommand } = require('../theme-commands');
|
|
22
|
+
|
|
23
|
+
const REPO_ROOT = path.resolve(__dirname, '../../../..');
|
|
24
|
+
const BUNDLED_THEMES = path.join(REPO_ROOT, 'themes/bundled');
|
|
25
|
+
const V1_FIXTURE = path.join(REPO_ROOT, '__tests__/fixtures/themes/v1-sample');
|
|
26
|
+
|
|
27
|
+
const MANIFEST = {
|
|
28
|
+
format: 'qtap-theme',
|
|
29
|
+
formatVersion: 2,
|
|
30
|
+
id: 'cli-test-theme',
|
|
31
|
+
name: 'CLI Test Theme',
|
|
32
|
+
author: 'Test Author',
|
|
33
|
+
version: '1.0.0',
|
|
34
|
+
supportsDarkMode: true,
|
|
35
|
+
tokensPath: 'tokens.json',
|
|
36
|
+
};
|
|
37
|
+
const TOKENS = { primitives: {}, tokens: { '--theme-primary': { value: '#3b82f6', dark: '#60a5fa' } }, choices: {} };
|
|
38
|
+
|
|
39
|
+
let tempDir;
|
|
40
|
+
let dataDir;
|
|
41
|
+
|
|
42
|
+
function zip(dir, out, args = ['-r', '-q']) {
|
|
43
|
+
execFileSync('zip', [...args, out, '.'], { cwd: dir, stdio: 'pipe' });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function writeBundleDir(dir, manifest = MANIFEST) {
|
|
47
|
+
await fsp.mkdir(dir, { recursive: true });
|
|
48
|
+
await fsp.writeFile(path.join(dir, 'theme.json'), JSON.stringify(manifest, null, 2));
|
|
49
|
+
await fsp.writeFile(path.join(dir, 'tokens.json'), JSON.stringify(TOKENS, null, 2));
|
|
50
|
+
return dir;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function makeBundle(name = 'theme', manifest = MANIFEST) {
|
|
54
|
+
const dir = await writeBundleDir(path.join(tempDir, `${name}-src`), manifest);
|
|
55
|
+
const out = path.join(tempDir, `${name}.qtap-theme`);
|
|
56
|
+
zip(dir, out);
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Run a themes subcommand; returns its exit code and printed output. */
|
|
61
|
+
async function run(args) {
|
|
62
|
+
const lines = [];
|
|
63
|
+
const log = jest.spyOn(console, 'log').mockImplementation((...a) => lines.push(a.join(' ')));
|
|
64
|
+
const err = jest.spyOn(console, 'error').mockImplementation((...a) => lines.push(a.join(' ')));
|
|
65
|
+
const exit = jest.spyOn(process, 'exit').mockImplementation((code) => {
|
|
66
|
+
throw Object.assign(new Error('exit'), { exitCode: code });
|
|
67
|
+
});
|
|
68
|
+
let code = 0;
|
|
69
|
+
try {
|
|
70
|
+
await themesCommand([...args, '--data-dir', dataDir]);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e.exitCode === undefined) throw e;
|
|
73
|
+
code = e.exitCode;
|
|
74
|
+
} finally {
|
|
75
|
+
log.mockRestore();
|
|
76
|
+
err.mockRestore();
|
|
77
|
+
exit.mockRestore();
|
|
78
|
+
}
|
|
79
|
+
// Strip colour codes so assertions read the words.
|
|
80
|
+
return { code, output: lines.join('\n').replace(/\x1b\[[0-9;]*m/g, '') };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function themesDir() {
|
|
84
|
+
return path.join(dataDir, 'themes');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
beforeEach(async () => {
|
|
88
|
+
tempDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'qtap-cli-themes-'));
|
|
89
|
+
dataDir = path.join(tempDir, 'instance');
|
|
90
|
+
await fsp.mkdir(dataDir, { recursive: true });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
afterEach(async () => {
|
|
94
|
+
await fsp.rm(tempDir, { recursive: true, force: true });
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('the bundled theme engine', () => {
|
|
98
|
+
const bundled = fs.readdirSync(BUNDLED_THEMES).filter(d => fs.existsSync(path.join(BUNDLED_THEMES, d, 'theme.json')));
|
|
99
|
+
|
|
100
|
+
it.each(bundled)('validates the bundled theme %s with no warnings', async (dir) => {
|
|
101
|
+
const result = await engine.validateThemeDirectory(path.join(BUNDLED_THEMES, dir));
|
|
102
|
+
expect(result.errors).toEqual([]);
|
|
103
|
+
expect(result.warnings).toEqual([]);
|
|
104
|
+
expect(result.valid).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('refuses a symbolic link inside an archive', async () => {
|
|
108
|
+
const dir = await writeBundleDir(path.join(tempDir, 'linked'));
|
|
109
|
+
await fsp.symlink('/etc/hosts', path.join(dir, 'hosts.txt'));
|
|
110
|
+
const out = path.join(tempDir, 'linked.qtap-theme');
|
|
111
|
+
zip(dir, out, ['-r', '-q', '--symlinks']);
|
|
112
|
+
|
|
113
|
+
const result = await engine.validateThemeBundle(out);
|
|
114
|
+
expect(result.valid).toBe(false);
|
|
115
|
+
expect(result.errors).toContain('Symbolic links are not allowed in theme bundles: hosts.txt');
|
|
116
|
+
|
|
117
|
+
const installed = await run(['install', out]);
|
|
118
|
+
expect(installed.code).toBe(1);
|
|
119
|
+
expect(fs.existsSync(path.join(themesDir(), 'cli-test-theme'))).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('refuses an archive entry that climbs out of the bundle', async () => {
|
|
123
|
+
// A stored entry named "../escape.txt": built by hand, since zip will not.
|
|
124
|
+
const dir = await writeBundleDir(path.join(tempDir, 'escaping', 'inner'));
|
|
125
|
+
await fsp.writeFile(path.join(tempDir, 'escaping', 'escape.txt'), 'out');
|
|
126
|
+
const out = path.join(tempDir, 'escaping.qtap-theme');
|
|
127
|
+
execFileSync('zip', ['-q', out, 'theme.json', 'tokens.json', '../escape.txt'], { cwd: dir, stdio: 'pipe' });
|
|
128
|
+
|
|
129
|
+
const result = await engine.validateThemeBundle(out);
|
|
130
|
+
expect(result.valid).toBe(false);
|
|
131
|
+
expect(fs.existsSync(path.join(os.tmpdir(), 'escape.txt'))).toBe(false);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('quilltap themes validate', () => {
|
|
136
|
+
it('accepts a valid .qtap-theme file', async () => {
|
|
137
|
+
const { code, output } = await run(['validate', await makeBundle()]);
|
|
138
|
+
expect(code).toBe(0);
|
|
139
|
+
expect(output).toContain('Valid version 2 theme bundle');
|
|
140
|
+
expect(output).toContain('cli-test-theme');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('accepts a bundle directory', async () => {
|
|
144
|
+
const dir = await writeBundleDir(path.join(tempDir, 'as-dir'));
|
|
145
|
+
const { code, output } = await run(['validate', dir]);
|
|
146
|
+
expect(code).toBe(0);
|
|
147
|
+
expect(output).toContain('Valid version 2 theme bundle');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('refuses a version 1 bundle with the earlier-theme message', async () => {
|
|
151
|
+
const { code, output } = await run(['validate', V1_FIXTURE]);
|
|
152
|
+
expect(code).toBe(1);
|
|
153
|
+
expect(output).toContain(engine.earlierThemeMessage('Version 1 Sample'));
|
|
154
|
+
expect(output).toContain('Only version 2 theme bundles are accepted.');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('reports a missing path', async () => {
|
|
158
|
+
const { code, output } = await run(['validate', path.join(tempDir, 'nope.qtap-theme')]);
|
|
159
|
+
expect(code).toBe(1);
|
|
160
|
+
expect(output).toContain('Bundle file not found or not readable');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('quilltap themes install / uninstall / export', () => {
|
|
165
|
+
it('installs a valid bundle and records it in the index', async () => {
|
|
166
|
+
const { code } = await run(['install', await makeBundle()]);
|
|
167
|
+
expect(code).toBe(0);
|
|
168
|
+
expect(fs.existsSync(path.join(themesDir(), 'cli-test-theme', 'theme.json'))).toBe(true);
|
|
169
|
+
const index = JSON.parse(await fsp.readFile(path.join(themesDir(), 'themes-index.json'), 'utf-8'));
|
|
170
|
+
expect(index.themes.map(t => t.id)).toEqual(['cli-test-theme']);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('refuses a version 1 bundle at install before anything is written', async () => {
|
|
174
|
+
const out = path.join(tempDir, 'v1.qtap-theme');
|
|
175
|
+
zip(V1_FIXTURE, out);
|
|
176
|
+
const { code, output } = await run(['install', out]);
|
|
177
|
+
expect(code).toBe(1);
|
|
178
|
+
expect(output).toContain(engine.earlierThemeMessage('Version 1 Sample'));
|
|
179
|
+
expect(fs.existsSync(path.join(themesDir(), 'v1-sample'))).toBe(false);
|
|
180
|
+
expect(fs.existsSync(path.join(themesDir(), 'themes-index.json'))).toBe(false);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('exports an installed theme to a bundle that validates', async () => {
|
|
184
|
+
await run(['install', await makeBundle()]);
|
|
185
|
+
const out = path.join(tempDir, 'exported.qtap-theme');
|
|
186
|
+
const { code } = await run(['export', 'cli-test-theme', '--output', out]);
|
|
187
|
+
expect(code).toBe(0);
|
|
188
|
+
const result = await engine.validateThemeBundle(out);
|
|
189
|
+
expect(result.valid).toBe(true);
|
|
190
|
+
expect(result.manifest.id).toBe('cli-test-theme');
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('refuses to export a version 1 theme found among the installed themes', async () => {
|
|
194
|
+
await fsp.cp(V1_FIXTURE, path.join(themesDir(), 'v1-sample'), { recursive: true });
|
|
195
|
+
const out = path.join(tempDir, 'v1-out.qtap-theme');
|
|
196
|
+
const { code, output } = await run(['export', 'v1-sample', '--output', out]);
|
|
197
|
+
expect(code).toBe(1);
|
|
198
|
+
expect(output).toContain(engine.earlierThemeMessage('Version 1 Sample'));
|
|
199
|
+
expect(fs.existsSync(out)).toBe(false);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('will not uninstall or export a theme id that names a path', async () => {
|
|
203
|
+
const outside = path.join(dataDir, 'precious');
|
|
204
|
+
await fsp.mkdir(outside, { recursive: true });
|
|
205
|
+
await fsp.writeFile(path.join(outside, 'theme.json'), JSON.stringify(MANIFEST));
|
|
206
|
+
|
|
207
|
+
const uninstalled = await run(['uninstall', '../precious']);
|
|
208
|
+
expect(uninstalled.code).toBe(1);
|
|
209
|
+
expect(fs.existsSync(outside)).toBe(true);
|
|
210
|
+
|
|
211
|
+
const exported = await run(['export', '../precious', '--output', path.join(tempDir, 'x.qtap-theme')]);
|
|
212
|
+
expect(exported.code).toBe(1);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('icon overrides', () => {
|
|
217
|
+
async function iconBundle(icons) {
|
|
218
|
+
const dir = await writeBundleDir(path.join(tempDir, 'icons'), { ...MANIFEST, icons });
|
|
219
|
+
await fsp.mkdir(path.join(dir, 'icons'), { recursive: true });
|
|
220
|
+
await fsp.writeFile(path.join(dir, 'icons/chat.svg'), '<svg xmlns="http://www.w3.org/2000/svg"/>');
|
|
221
|
+
await fsp.writeFile(path.join(dir, 'icons/chat.png'), 'not really');
|
|
222
|
+
return engine.validateThemeDirectory(dir);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
it('accepts an .svg override of an app icon', async () => {
|
|
226
|
+
const result = await iconBundle({ chat: 'icons/chat.svg' });
|
|
227
|
+
expect(result.errors).toEqual([]);
|
|
228
|
+
expect(result.valid).toBe(true);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it.each([
|
|
232
|
+
['an asset that is not .svg or .webp', { chat: 'icons/chat.png' }, 'must be .svg or .webp'],
|
|
233
|
+
['a climbing path', { chat: '../../../etc/passwd.svg' }, 'Must be a path inside the bundle'],
|
|
234
|
+
['an absolute path', { chat: '/etc/passwd.svg' }, 'Must be a path inside the bundle'],
|
|
235
|
+
['a name that is no app icon', { 'not-an-icon-zz': 'icons/chat.svg' }, 'not an app icon'],
|
|
236
|
+
])('refuses %s', async (_label, icons, message) => {
|
|
237
|
+
const result = await iconBundle(icons);
|
|
238
|
+
expect(result.valid).toBe(false);
|
|
239
|
+
expect(result.errors.join(' ')).toContain(message);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
@@ -58,7 +58,7 @@ _quilltap_complete() {
|
|
|
58
58
|
cword=$COMP_CWORD
|
|
59
59
|
|
|
60
60
|
# Global options that can appear before subcommands
|
|
61
|
-
local global_opts="-d --data-dir -i --instance -p --port -o --open -v --version -h --help --update --passphrase"
|
|
61
|
+
local global_opts="-d --data-dir -i --instance -p --port --host -o --open -v --version -h --help --update --passphrase"
|
|
62
62
|
|
|
63
63
|
# Top-level subcommands
|
|
64
64
|
local top_cmds="db docs sync themes instances memories memory-diff recall-replay anchor-probe logs migrations maintenance file-verify completion"
|
|
@@ -68,7 +68,7 @@ _quilltap_complete() {
|
|
|
68
68
|
# reserves -i for --ignore-case rather than --instance. Counting those wrong
|
|
69
69
|
# makes a flag's value look like the subcommand's verb, which is how
|
|
70
70
|
# `quilltap docs --limit 5 <TAB>` used to lose the verb list.
|
|
71
|
-
local vf_global=" -d --data-dir -i --instance -p --port --passphrase "
|
|
71
|
+
local vf_global=" -d --data-dir -i --instance -p --port --host --passphrase "
|
|
72
72
|
local vf_db=" --limit --grep --character --project --about --source --tier --chat --message --field --tail --last --from --type --out --id --count "
|
|
73
73
|
local vf_docs=" --mount --folder --type --ext --limit --max --context --top --threshold --sort --depth --max-nodes --format "
|
|
74
74
|
local vf_sync=" --direction --prefer "
|
|
@@ -146,7 +146,7 @@ _quilltap_complete() {
|
|
|
146
146
|
COMPREPLY=($(compgen -d -- "$cur"))
|
|
147
147
|
return
|
|
148
148
|
fi
|
|
149
|
-
if [[ "$prev" == "-p" ]] || [[ "$prev" == "--port" ]] || [[ "$prev" == "--passphrase" ]]; then
|
|
149
|
+
if [[ "$prev" == "-p" ]] || [[ "$prev" == "--port" ]] || [[ "$prev" == "--host" ]] || [[ "$prev" == "--passphrase" ]]; then
|
|
150
150
|
return
|
|
151
151
|
fi
|
|
152
152
|
if [[ "$prev" == "--instance" ]] || { [[ "$prev" == "-i" ]] && [[ "$subcommand" != "memories" ]]; }; then
|
|
@@ -70,6 +70,7 @@ complete -c quilltap -n '__quilltap_no_subcommand' -f -a 'completion' -d 'Genera
|
|
|
70
70
|
|
|
71
71
|
# Global options
|
|
72
72
|
complete -c quilltap -n '__quilltap_no_subcommand' -l 'port' -s 'p' -d 'Port to listen on' -x
|
|
73
|
+
complete -c quilltap -n '__quilltap_no_subcommand' -l 'host' -d 'Address to bind (default 127.0.0.1)' -x
|
|
73
74
|
complete -c quilltap -n '__quilltap_no_subcommand' -l 'data-dir' -s 'd' -d 'Data directory' -r -F
|
|
74
75
|
complete -c quilltap -n '__quilltap_no_subcommand' -l 'instance' -s 'i' -d 'Use registered instance' -x -a '(__quilltap_instance_names)'
|
|
75
76
|
complete -c quilltap -n '__quilltap_no_subcommand' -l 'open' -s 'o' -d 'Open browser after start'
|
|
@@ -27,6 +27,7 @@ _quilltap() {
|
|
|
27
27
|
'(-d --data-dir)'{-d,--data-dir}'[Data directory]:directory:_directories'
|
|
28
28
|
'(-i --instance)'{-i,--instance}'[Use a registered instance]:instance:_quilltap_instance_names'
|
|
29
29
|
'(-p --port)'{-p,--port}'[Port to listen on]:port:'
|
|
30
|
+
'--host[Address to bind (default 127.0.0.1)]:address:'
|
|
30
31
|
'(-o --open)'{-o,--open}'[Open browser after server starts]'
|
|
31
32
|
'(-v --version)'{-v,--version}'[Show version number]'
|
|
32
33
|
'(-h --help)'{-h,--help}'[Show help message]'
|