qrlkit 0.11.0 → 0.12.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.
Files changed (2) hide show
  1. package/README.md +177 -48
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -195,8 +195,10 @@ State is stored in `$XDG_STATE_HOME/qrlkit/state.yaml` on Linux, falling back to
195
195
 
196
196
  Each example replaces the previous one.
197
197
 
198
- Resource arguments match every placeholder name.
199
- CLI values follow argument declaration order.
198
+ References use their full path, like `{shared.repos}`.
199
+ Strings supply fixed values. Lists offer choices when no value is supplied.
200
+ CLI values follow first-reference order, including lookup inputs.
201
+ Use `args` to declare argument order. Repeated references reuse the same selection.
200
202
 
201
203
  ### URLs
202
204
 
@@ -214,42 +216,42 @@ Choose the repository with an argument.
214
216
  open = "https://github.com/qrlkit/{repo}"
215
217
  ```
216
218
 
217
- Reuse an organization through a constant.
219
+ Reuse an organization.
218
220
 
219
221
  ```toml
220
- [constants]
222
+ [shared]
223
+ hidden = true
221
224
  org = "qrlkit"
222
225
 
223
226
  [repos]
224
- open = "https://github.com/{constants.org}/{repo}"
227
+ open = "https://github.com/{shared.org}/{repo}"
225
228
  ```
226
229
 
227
230
  Add hints and override the browser.
228
231
 
229
232
  ```toml
230
- [constants]
233
+ [shared]
234
+ hidden = true
231
235
  org = "qrlkit"
232
236
 
233
237
  [repos]
234
238
  browser = "firefox"
235
239
  # hint: Browse the source code
236
- open = "https://github.com/{constants.org}/{repo}"
240
+ open = "https://github.com/{shared.org}/{repo}"
237
241
  ```
238
242
 
239
- Offer repository choices from a constant.
243
+ Offer repository choices.
240
244
 
241
245
  ```toml
242
- [constants]
246
+ [shared]
247
+ hidden = true
243
248
  org = "qrlkit"
244
249
  repos = ["qrlkit-rs", "qrlkit-web"]
245
250
 
246
251
  [repos.open]
247
- url = "https://github.com/{constants.org}/{repo}"
252
+ url = "https://github.com/{shared.org}/{shared.repos}"
248
253
  hint = "Browse the source code"
249
254
  browser = "firefox"
250
- args = [
251
- { name = "repo", enum = { ref = "constants.repos" } },
252
- ]
253
255
  ```
254
256
 
255
257
  ```sh
@@ -281,37 +283,38 @@ readme = "~/dev/{repo}/README.md"
281
283
  Reuse your development directory across paths.
282
284
 
283
285
  ```toml
284
- [constants]
286
+ [shared]
287
+ hidden = true
285
288
  root = "~/dev"
286
289
 
287
290
  [files]
288
- readme = "{constants.root}/{repo}/README.md"
291
+ readme = "{shared.root}/{repo}/README.md"
289
292
  ```
290
293
 
291
294
  Add hints and open your editor.
292
295
 
293
296
  ```toml
294
- [constants]
297
+ [shared]
298
+ hidden = true
295
299
  root = "~/dev"
296
300
 
297
301
  [files]
298
302
  filehook = "nvim $file"
299
- readme = "{constants.root}/{repo}/README.md" # hint: Edit the project README
303
+ readme = "{shared.root}/{repo}/README.md" # hint: Edit the project README
300
304
  ```
301
305
 
302
306
  Offer project choices before opening files.
303
307
 
304
308
  ```toml
305
- [constants]
309
+ [shared]
310
+ hidden = true
306
311
  root = "~/dev"
312
+ repos = ["qrlkit-rs", "qrlkit-web"]
307
313
 
308
314
  [files.readme]
309
- url = "{constants.root}/{repo}/README.md"
315
+ url = "{shared.root}/{shared.repos}/README.md"
310
316
  hint = "Edit the project README"
311
317
  filehook = "nvim $file"
312
- args = [
313
- { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
314
- ]
315
318
  ```
316
319
 
317
320
  ```sh
@@ -340,38 +343,39 @@ project = "~/dev/{repo}"
340
343
  Reuse your development directory across projects.
341
344
 
342
345
  ```toml
343
- [constants]
346
+ [shared]
347
+ hidden = true
344
348
  root = "~/dev"
345
349
 
346
350
  [dirs]
347
- project = "{constants.root}/{repo}"
351
+ project = "{shared.root}/{repo}"
348
352
  ```
349
353
 
350
354
  Add hints and list directory contents.
351
355
 
352
356
  ```toml
353
- [constants]
357
+ [shared]
358
+ hidden = true
354
359
  root = "~/dev"
355
360
 
356
361
  [dirs]
357
362
  dirhook = "cd $dir && tree -L 1"
358
363
  # hint: Enter and inspect the project
359
- project = "{constants.root}/{repo}"
364
+ project = "{shared.root}/{repo}"
360
365
  ```
361
366
 
362
367
  Offer project choices before changing directories.
363
368
 
364
369
  ```toml
365
- [constants]
370
+ [shared]
371
+ hidden = true
366
372
  root = "~/dev"
373
+ repos = ["qrlkit-rs", "qrlkit-web"]
367
374
 
368
375
  [dirs.project]
369
- url = "{constants.root}/{repo}"
376
+ url = "{shared.root}/{shared.repos}"
370
377
  hint = "Enter and inspect the project"
371
378
  dirhook = "cd $dir && tree -L 1"
372
- args = [
373
- { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
374
- ]
375
379
  ```
376
380
 
377
381
  ```sh
@@ -398,40 +402,43 @@ args = [{ name = "name" }]
398
402
  run = 'printf "Hello, %s!\n" "$1"'
399
403
  ```
400
404
 
401
- Supply constants through `env` without prompting.
405
+ Supply fixed values through `env` without prompting.
402
406
 
403
407
  ```toml
404
- [constants]
408
+ [shared]
409
+ hidden = true
405
410
  name = "World"
406
411
 
407
412
  [greet]
408
413
  run = 'printf "Hello, %s!\n" "$NAME"'
409
414
 
410
415
  [greet.env]
411
- NAME = "{constants.name}"
416
+ NAME = "{shared.name}"
412
417
  ```
413
418
 
414
- Combine constant values with argument choices.
419
+ Combine shared values with argument choices.
415
420
 
416
421
  ```toml
417
- [constants]
422
+ [shared]
423
+ hidden = true
418
424
  name = "World"
419
425
  greetings = ["Hello", "Hi", "Hey"]
420
426
 
421
427
  [greet]
422
428
  args = [
423
- { name = "greeting", enum = { ref = "constants.greetings" } },
429
+ { name = "greeting", enum = { ref = "shared.greetings" } },
424
430
  ]
425
431
  run = 'printf "%s, %s!\n" "$1" "$NAME"'
426
432
 
427
433
  [greet.env]
428
- NAME = "{constants.name}"
434
+ NAME = "{shared.name}"
429
435
  ```
430
436
 
431
437
  Add hints and choose your shell.
432
438
 
433
439
  ```toml
434
- [constants]
440
+ [shared]
441
+ hidden = true
435
442
  name = "World"
436
443
  greetings = ["Hello", "Hi", "Hey"]
437
444
 
@@ -439,7 +446,7 @@ greetings = ["Hello", "Hi", "Hey"]
439
446
  hint = "Say hello with some personality"
440
447
  shell = "zsh"
441
448
  args = [
442
- { name = "greeting", enum = { ref = "constants.greetings" } },
449
+ { name = "greeting", enum = { ref = "shared.greetings" } },
443
450
  ]
444
451
  run = '''
445
452
  printf '%s, %s!\n' "$1" "$NAME"
@@ -447,7 +454,7 @@ printf 'Have a lovely day!\n'
447
454
  '''
448
455
 
449
456
  [greet.env]
450
- NAME = "{constants.name}"
457
+ NAME = "{shared.name}"
451
458
  ```
452
459
 
453
460
  ```sh
@@ -456,31 +463,153 @@ qrlkit greet Hey
456
463
 
457
464
  Supported shells: `bash`, `sh`, and `zsh`.
458
465
 
459
- ### Shared constants
466
+ Use a script's output in another resource.
460
467
 
461
- Place `constants.toml` beside your state file.
468
+ ```toml
469
+ [system]
470
+ hidden = true
471
+
472
+ [system.hostname]
473
+ run = "hostname"
474
+
475
+ [logs]
476
+ url = "https://logs.example.com/search?host={system.hostname}"
477
+ ```
478
+
479
+ Referenced scripts run only when needed. Their stdout is reused within the command,
480
+ with trailing newlines removed. A failed script stops the command.
481
+ Script bodies stay literal; use `args` and `env` to pass values.
482
+
483
+ ### Shared values
484
+
485
+ Put shared values in any config and register it with `qrlkit add`.
462
486
 
463
487
  ```toml
464
- # constants.toml
465
- [constants]
488
+ # shared.toml
489
+ [shared]
490
+ hidden = true
466
491
  root = "~/dev"
467
492
  name = "World"
468
493
  ```
469
494
 
470
- Reference shared constants with `{global.name}` syntax.
495
+ ```sh
496
+ qrlkit add shared.toml
497
+ ```
498
+
499
+ Reference them from other registered configs.
471
500
 
472
501
  ```toml
473
502
  # QRLs.toml
474
503
  [dirs]
475
- project = "{global.root}/{repo}"
504
+ project = "{shared.root}/{repo}"
476
505
 
477
506
  [greet]
478
507
  run = 'printf "Hello, %s!\n" "$NAME"'
479
508
 
480
509
  [greet.env]
481
- NAME = "{global.name}"
510
+ NAME = "{shared.name}"
511
+ ```
512
+
513
+ `constants.toml` is no longer loaded automatically. Register shared values explicitly
514
+ and replace `{global.name}` with their full path. `constants` is now an ordinary group.
515
+
516
+ ### Composition
517
+
518
+ Reference another resource's target without opening it.
519
+
520
+ ```toml
521
+ [shared]
522
+ hidden = true
523
+ repos = ["qrlkit-rs", "qrlkit-web"]
524
+
525
+ [repos.open]
526
+ url = "https://github.com/qrlkit/{shared.repos}"
527
+
528
+ [repos.prs]
529
+ url = "{repos.open}/pulls"
530
+ ```
531
+
532
+ ```sh
533
+ repos prs qrlkit-web # Opens the repository's pull requests
534
+ repos prs # Choose the repository
482
535
  ```
483
536
 
537
+ Missing references and circular dependencies are errors.
538
+
539
+ ### Lookups
540
+
541
+ Choose a URL part from a mapping. Use one selector for a flat mapping,
542
+ or multiple selectors to walk nested mappings.
543
+
544
+ ```toml
545
+ [projects]
546
+ hidden = true
547
+ repos = ["qrlkit-rs", "qrlkit-web"]
548
+
549
+ [shared]
550
+ hidden = true
551
+ environments = ["sim", "live"]
552
+
553
+ [logs]
554
+ url = "https://{logs.subdomains[projects.repos, shared.environments]}.logs.example.com"
555
+
556
+ [logs.subdomains]
557
+ hidden = true
558
+
559
+ [logs.subdomains.qrlkit-rs]
560
+ sim = "rust-sandbox"
561
+ live = "rust-production"
562
+
563
+ [logs.subdomains.qrlkit-web]
564
+ sim = "web-sandbox"
565
+ live = "web-production"
566
+ ```
567
+
568
+ Put `url` directly on a group to call it without a subcommand.
569
+
570
+ ```sh
571
+ logs qrlkit-rs live # Opens https://rust-production.logs.example.com
572
+ logs qrlkit-rs # Choose the environment
573
+ logs # Choose the repository and environment
574
+ ```
575
+
576
+ Missing lookup keys are errors. Child commands take precedence over arguments;
577
+ use `--` before a value that matches a child command's name.
578
+
579
+ ### Hints and hidden groups
580
+
581
+ Hide a group from pickers with `hidden = true`. Its values can still be referenced
582
+ or called directly. Add hints to groups, tools, lists, and individual choices.
583
+
584
+ ```toml
585
+ [projects]
586
+ hidden = true
587
+
588
+ [projects.repos]
589
+ hint = "Choose a qrlkit project"
590
+ values = [
591
+ { value = "qrlkit-rs", hint = "Rust CLI" },
592
+ { value = "qrlkit-web", hint = "Documentation website" },
593
+ ]
594
+
595
+ [repos]
596
+ hint = "GitHub resources"
597
+
598
+ [repos.open]
599
+ hint = "Browse the repository"
600
+ url = "https://github.com/qrlkit/{projects.repos}"
601
+ ```
602
+
603
+ ```sh
604
+ repos open # Choose a repository with hints
605
+ projects repos # Choose and print a value from the hidden group
606
+ ```
607
+
608
+ Use `values = ["qrlkit-rs", "qrlkit-web"]` when only the list needs a hint.
609
+ Each tool keeps its own hint when composing resources.
610
+
611
+ See [examples/composition.toml](examples/composition.toml) for a complete config.
612
+
484
613
  ## Themes
485
614
 
486
615
  Make the picker fit your terminal.
package/package.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "README.md"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "qrlkit-darwin-arm64": "0.11.0",
13
- "qrlkit-darwin-x64": "0.11.0",
14
- "qrlkit-linux-arm64": "0.11.0",
15
- "qrlkit-linux-x64": "0.11.0"
12
+ "qrlkit-darwin-arm64": "0.12.0",
13
+ "qrlkit-darwin-x64": "0.12.0",
14
+ "qrlkit-linux-arm64": "0.12.0",
15
+ "qrlkit-linux-x64": "0.12.0"
16
16
  },
17
17
  "os": [
18
18
  "linux",
@@ -34,5 +34,5 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/qrlkit/qrlkit-rs/issues"
36
36
  },
37
- "version": "0.11.0"
37
+ "version": "0.12.0"
38
38
  }