@osdlc/wayfinder 0.7.4 → 0.9.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 (121) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/CONTRIBUTING.md +6 -0
  3. package/README.md +310 -150
  4. package/SECURITY.md +19 -5
  5. package/dist/actions.d.ts +23 -0
  6. package/dist/actions.js +97 -0
  7. package/dist/app.d.ts +1 -13
  8. package/dist/app.js +1 -13
  9. package/dist/args.d.ts +11 -6
  10. package/dist/args.js +25 -7
  11. package/dist/cache.d.ts +2 -4
  12. package/dist/cache.js +5 -10
  13. package/dist/catalog.d.ts +45 -4
  14. package/dist/catalog.js +134 -13
  15. package/dist/clean-command.d.ts +65 -36
  16. package/dist/clean-command.js +372 -226
  17. package/dist/cli.d.ts +24 -57
  18. package/dist/cli.js +139 -568
  19. package/dist/commands/browse.d.ts +128 -0
  20. package/dist/commands/browse.js +153 -0
  21. package/dist/commands/index.d.ts +25 -0
  22. package/dist/commands/index.js +71 -0
  23. package/dist/commands/list.d.ts +224 -0
  24. package/dist/commands/list.js +178 -0
  25. package/dist/commands/query.d.ts +166 -0
  26. package/dist/commands/query.js +73 -0
  27. package/dist/commands/run.d.ts +114 -0
  28. package/dist/commands/run.js +139 -0
  29. package/dist/commands/shared.d.ts +152 -0
  30. package/dist/commands/shared.js +209 -0
  31. package/dist/config-command.d.ts +27 -43
  32. package/dist/config-command.js +129 -330
  33. package/dist/config-keys.d.ts +25 -0
  34. package/dist/config-keys.js +29 -0
  35. package/dist/config.d.ts +272 -257
  36. package/dist/config.js +611 -460
  37. package/dist/core/copy-text.d.ts +30 -0
  38. package/dist/core/copy-text.js +50 -0
  39. package/dist/core/filter.d.ts +55 -0
  40. package/dist/core/filter.js +59 -0
  41. package/dist/core/run.d.ts +22 -0
  42. package/dist/core/run.js +59 -0
  43. package/dist/core/saved-view.d.ts +59 -0
  44. package/dist/core/saved-view.js +119 -0
  45. package/dist/core/session.d.ts +282 -0
  46. package/dist/core/session.js +602 -0
  47. package/dist/core/skills.d.ts +53 -0
  48. package/dist/core/skills.js +54 -0
  49. package/dist/core/unknowns.d.ts +72 -0
  50. package/dist/core/unknowns.js +68 -0
  51. package/dist/devlink.d.ts +3 -0
  52. package/dist/devlink.js +5 -2
  53. package/dist/document-schemas.generated.d.ts +22 -0
  54. package/dist/document-schemas.generated.js +916 -0
  55. package/dist/documents.d.ts +508 -0
  56. package/dist/documents.js +181 -0
  57. package/dist/groups.d.ts +22 -26
  58. package/dist/groups.js +13 -29
  59. package/dist/guide.d.ts +26 -13
  60. package/dist/guide.js +119 -103
  61. package/dist/index.d.ts +118 -0
  62. package/dist/index.js +61 -0
  63. package/dist/keys.d.ts +51 -0
  64. package/dist/keys.js +273 -0
  65. package/dist/page.d.ts +18 -8
  66. package/dist/page.js +28 -17
  67. package/dist/providers-command.d.ts +81 -20
  68. package/dist/providers-command.js +33 -75
  69. package/dist/schema.d.ts +48 -0
  70. package/dist/schema.js +61 -0
  71. package/dist/serve/auth.d.ts +46 -0
  72. package/dist/serve/auth.js +82 -0
  73. package/dist/serve/catalog-share.d.ts +63 -0
  74. package/dist/serve/catalog-share.js +155 -0
  75. package/dist/serve/index.d.ts +100 -0
  76. package/dist/serve/index.js +259 -0
  77. package/dist/serve/routes.d.ts +60 -0
  78. package/dist/serve/routes.js +186 -0
  79. package/dist/serve/terminal-input.d.ts +50 -0
  80. package/dist/serve/terminal-input.js +108 -0
  81. package/dist/skills.d.ts +19 -0
  82. package/dist/skills.js +54 -0
  83. package/dist/terminal-text.d.ts +8 -0
  84. package/dist/terminal-text.js +19 -6
  85. package/dist/tool-info.d.ts +24 -0
  86. package/dist/tool-info.js +17 -0
  87. package/dist/trust-command.d.ts +15 -27
  88. package/dist/trust-command.js +110 -208
  89. package/dist/trust-store.d.ts +5 -10
  90. package/dist/trust-store.js +9 -42
  91. package/dist/tui/app.d.ts +193 -0
  92. package/dist/tui/app.js +1400 -0
  93. package/dist/tui/copy.d.ts +29 -0
  94. package/dist/tui/copy.js +39 -0
  95. package/dist/tui/index.d.ts +33 -0
  96. package/dist/tui/index.js +97 -0
  97. package/dist/tui/keys-input.d.ts +27 -0
  98. package/dist/tui/keys-input.js +87 -0
  99. package/dist/tui/settings.d.ts +94 -0
  100. package/dist/tui/settings.js +198 -0
  101. package/dist/tui/style.d.ts +62 -0
  102. package/dist/tui/style.js +77 -0
  103. package/dist/version.d.ts +6 -0
  104. package/dist/version.js +7 -0
  105. package/dist/vocabulary.d.ts +91 -0
  106. package/dist/vocabulary.js +155 -0
  107. package/dist/web/main.js +2232 -582
  108. package/dist/web/page.html +41 -33
  109. package/dist/web/styles.css +513 -329
  110. package/dist/xdg.d.ts +76 -4
  111. package/dist/xdg.js +77 -5
  112. package/package.json +27 -8
  113. package/schema/config.json +133 -0
  114. package/dist/http.d.ts +0 -22
  115. package/dist/http.js +0 -149
  116. package/dist/origin-owner.d.ts +0 -19
  117. package/dist/origin-owner.js +0 -85
  118. package/dist/serve.d.ts +0 -98
  119. package/dist/serve.js +0 -671
  120. package/dist/tui.d.ts +0 -177
  121. package/dist/tui.js +0 -840
@@ -1,43 +1,72 @@
1
1
  /**
2
- * The `clean` subcommand: the three stores wayfinder keeps outside your
3
- * repositories (cache, trust, config). `--cache` and `--trust` also clear
4
- * the old waypost cache and trust store. An old store is listed only when it
5
- * holds something.
2
+ * `way clean`: the data wayfinder keeps outside your repositories. Bare
3
+ * `clean` only reports what each store is, where it is, and whether anything
4
+ * is in it. A flag names what to remove; with no flag nothing is removed.
6
5
  *
7
- * ## Nothing is removed unless asked
6
+ * | flag | store |
7
+ * |---|---|
8
+ * | `--cache` | stored probe results: derived, costs one slow probe |
9
+ * | `--trust` | the repositories you trusted: consent, asked again |
10
+ * | `--user-config` | your user config: the only store a person wrote, so it needs `--yes` |
11
+ * | `--dev` | `way dev` link state, and the `way dev install` shims on PATH |
12
+ * | `--legacy` | files kept under the tool's name before its first release |
8
13
  *
9
- * Bare `clean` only reports: what each store is, where it is, and whether
10
- * anything is in it. A `--dry-run` flag would put the safe behaviour behind a
11
- * flag people forget. Instead the flags name what to remove, and with no flag
12
- * nothing is removed.
14
+ * `--everything` is every one of them, and needs `--yes`. A store that is only
15
+ * listed when it holds something (shims, old files) is left out of the report
16
+ * when it is empty. Once a store is gone, the directories above it are removed
17
+ * while they are empty, up to the base directory (`~/.config`, say).
13
18
  *
14
- * ## Why `--config` alone needs `--yes`
19
+ * Nothing inside a repository is touched: `wayfinder.config.json` belongs to
20
+ * the project. A user config that `WAYFINDER_CONFIG` names is named with the
21
+ * variable in the report and again before it is removed, since it may live in
22
+ * a dotfiles repository.
15
23
  *
16
- * The three stores are not equally easy to replace, and the check follows
17
- * that:
18
- *
19
- * - The cache is derived. Deleting it costs one slow probe.
20
- * - The trust store is consent. Deleting it means answering the trust
21
- * question again for each repository. That is annoying, but nothing is lost.
22
- * - The config is the only one a person wrote. Nothing regenerates it.
23
- *
24
- * So `--config` (and `--all`, which includes it) also needs `--yes`.
25
- *
26
- * ## What it will not touch
27
- *
28
- * Anything inside a repository. `wayfinder.config.json` is a project file that
29
- * belongs to whoever wrote it, not to this tool's data. Only paths under the
30
- * user's home (or their XDG overrides) are removed.
31
- *
32
- * `stdout`, `stderr`, `env` and `home` are injected, so a test cannot read or
33
- * delete the developer's real stores.
24
+ * Clean removes only what it owns. A file store must be a file (a symbolic
25
+ * link is removed, not its target), a directory store a directory, and no
26
+ * store may be the home directory, a directory above it or a filesystem root.
27
+ * A store whose path is, holds or sits in another flag's store is removed
28
+ * only with `--yes`.
29
+ * A file `WAYFINDER_CONFIG` names is removed only when its `$schema` names
30
+ * wayfinder's config schema, which every file wayfinder writes has.
34
31
  */
35
- import { type CliIo } from '@osdlc/cli-tool';
36
- /** `CliIo` plus the environment this command needs injected. */
37
- export interface CleanCommandIO extends CliIo {
38
- /** Defaults to `process.env`. Supplies the XDG overrides. */
39
- env?: Record<string, string | undefined>;
40
- /** Defaults to `homeDir()` from `@osdlc/trust-repo`. The base for every non-XDG path. */
41
- home?: string;
32
+ import { z } from 'zod';
33
+ import { type DataCommand } from '@osdlc/cli-tool/command';
34
+ import type { FlagSpec } from '@osdlc/cli-tool/define-cli';
35
+ import { type CommandEnvOptions } from './config-command.ts';
36
+ /** What a flag removes. */
37
+ export type StoreKey = 'cache' | 'trust' | 'config' | 'dev' | 'legacy';
38
+ /** `way clean`'s output. */
39
+ export declare const CleanOutputSchema: z.ZodObject<{
40
+ mode: z.ZodEnum<{
41
+ report: "report";
42
+ remove: "remove";
43
+ }>;
44
+ stores: z.ZodArray<z.ZodObject<{
45
+ key: z.ZodEnum<{
46
+ config: "config";
47
+ trust: "trust";
48
+ cache: "cache";
49
+ dev: "dev";
50
+ legacy: "legacy";
51
+ }>;
52
+ flag: z.ZodString;
53
+ what: z.ZodString;
54
+ path: z.ZodString;
55
+ bytes: z.ZodNullable<z.ZodNumber>;
56
+ removed: z.ZodBoolean;
57
+ envVar: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>;
60
+ /** What {@link cleanCommand} takes, beside the app's global flags. */
61
+ export interface CleanCommandOptions extends CommandEnvOptions {
62
+ /** The platform the paths are for. Defaults to `process.platform`. */
63
+ platform?: string;
42
64
  }
43
- export declare function runCleanCommand(toolName: string, argv: string[], io: CleanCommandIO): Promise<number>;
65
+ /**
66
+ * The `clean` command. Mount it as `clean: cleanCommand({ globals })`.
67
+ * A call with a flag that removes something is `cli-only`: the MCP and HTTP
68
+ * adapters refuse it. A bare `clean`, the report, is open to them.
69
+ */
70
+ export declare function cleanCommand<G extends FlagSpec = Record<never, never>>(options?: CleanCommandOptions & {
71
+ globals?: G;
72
+ }): DataCommand;