@kidd-cli/core 0.4.0 → 0.5.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 (46) hide show
  1. package/README.md +21 -5
  2. package/dist/{config-D8e5qxLp.js → config-BiEi8RG2.js} +2 -2
  3. package/dist/{config-D8e5qxLp.js.map → config-BiEi8RG2.js.map} +1 -1
  4. package/dist/{create-store-OHdkm_Yt.js → create-store-CGeHrTcl.js} +2 -2
  5. package/dist/{create-store-OHdkm_Yt.js.map → create-store-CGeHrTcl.js.map} +1 -1
  6. package/dist/index.d.ts +3 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +37 -56
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/config.js +2 -2
  11. package/dist/lib/format.d.ts +73 -0
  12. package/dist/lib/format.d.ts.map +1 -0
  13. package/dist/lib/format.js +20 -0
  14. package/dist/lib/format.js.map +1 -0
  15. package/dist/lib/logger.d.ts +1 -1
  16. package/dist/lib/logger.js +10 -0
  17. package/dist/lib/logger.js.map +1 -1
  18. package/dist/lib/project.d.ts +1 -1
  19. package/dist/lib/project.js +1 -1
  20. package/dist/lib/store.d.ts +1 -1
  21. package/dist/lib/store.js +2 -2
  22. package/dist/{logger-9j49T5da.d.ts → logger-Bm-LRSeQ.d.ts} +17 -1
  23. package/dist/logger-Bm-LRSeQ.d.ts.map +1 -0
  24. package/dist/middleware/auth.d.ts +1 -1
  25. package/dist/middleware/auth.js +3 -3
  26. package/dist/middleware/http.d.ts +1 -1
  27. package/dist/middleware/http.js +1 -1
  28. package/dist/middleware/icons.d.ts +119 -0
  29. package/dist/middleware/icons.d.ts.map +1 -0
  30. package/dist/middleware/icons.js +824 -0
  31. package/dist/middleware/icons.js.map +1 -0
  32. package/dist/{middleware-BWnPSRWR.js → middleware-BewRXb2G.js} +1 -1
  33. package/dist/{middleware-BWnPSRWR.js.map → middleware-BewRXb2G.js.map} +1 -1
  34. package/dist/{project-D0g84bZY.js → project-CoWHMVc8.js} +1 -1
  35. package/dist/{project-D0g84bZY.js.map → project-CoWHMVc8.js.map} +1 -1
  36. package/dist/tally-ioa20iGw.js +220 -0
  37. package/dist/tally-ioa20iGw.js.map +1 -0
  38. package/dist/{types-D-BxshYM.d.ts → types-Boe_1EjY.d.ts} +1 -1
  39. package/dist/{types-D-BxshYM.d.ts.map → types-Boe_1EjY.d.ts.map} +1 -1
  40. package/dist/types-Cp8_uIil.d.ts +160 -0
  41. package/dist/types-Cp8_uIil.d.ts.map +1 -0
  42. package/dist/{types-U73X_oQ_.d.ts → types-s-yUj9Zj.d.ts} +47 -37
  43. package/dist/types-s-yUj9Zj.d.ts.map +1 -0
  44. package/package.json +14 -5
  45. package/dist/logger-9j49T5da.d.ts.map +0 -1
  46. package/dist/types-U73X_oQ_.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { p as Context, u as Middleware } from "../types-U73X_oQ_.js";
1
+ import { f as Middleware, h as Context } from "../types-s-yUj9Zj.js";
2
2
  import { AsyncResult } from "@kidd-cli/utils/fp";
3
3
 
4
4
  //#region src/middleware/auth/require.d.ts
@@ -1,6 +1,6 @@
1
- import { n as decorateContext, t as middleware } from "../middleware-BWnPSRWR.js";
2
- import "../project-D0g84bZY.js";
3
- import { t as createStore } from "../create-store-OHdkm_Yt.js";
1
+ import { n as decorateContext, t as middleware } from "../middleware-BewRXb2G.js";
2
+ import "../project-CoWHMVc8.js";
3
+ import { t as createStore } from "../create-store-CGeHrTcl.js";
4
4
  import { join } from "node:path";
5
5
  import { attempt, attemptAsync, isPlainObject, match, ok } from "@kidd-cli/utils/fp";
6
6
  import { z } from "zod";
@@ -1,4 +1,4 @@
1
- import { p as Context, u as Middleware } from "../types-U73X_oQ_.js";
1
+ import { f as Middleware, h as Context } from "../types-s-yUj9Zj.js";
2
2
 
3
3
  //#region src/middleware/http/types.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as decorateContext, t as middleware } from "../middleware-BWnPSRWR.js";
1
+ import { n as decorateContext, t as middleware } from "../middleware-BewRXb2G.js";
2
2
  import { attemptAsync } from "@kidd-cli/utils/fp";
3
3
  //#region src/middleware/http/create-http-client.ts
4
4
  /**
@@ -0,0 +1,119 @@
1
+ import { f as Middleware } from "../types-s-yUj9Zj.js";
2
+ import { AsyncResult } from "@kidd-cli/utils/fp";
3
+
4
+ //#region src/middleware/icons/types.d.ts
5
+ /**
6
+ * A single icon definition with both Nerd Font glyph and emoji fallback.
7
+ */
8
+ interface IconDefinition {
9
+ readonly nerdFont: string;
10
+ readonly emoji: string;
11
+ }
12
+ /**
13
+ * Supported icon categories for grouping icons by domain.
14
+ */
15
+ type IconCategory = "git" | "devops" | "status" | "files";
16
+ /**
17
+ * Error returned by icons middleware operations.
18
+ */
19
+ interface IconsError {
20
+ readonly type: "detection_failed" | "install_failed";
21
+ readonly message: string;
22
+ }
23
+ /**
24
+ * Options accepted by the `icons()` middleware factory.
25
+ *
26
+ * @property icons - Custom icon definitions to merge with defaults.
27
+ * @property autoSetup - When true, prompts to install Nerd Fonts if not detected.
28
+ * @property font - The Nerd Font family to install (defaults to JetBrainsMono).
29
+ * @property forceSetup - When true, always show the install prompt even if fonts are detected.
30
+ */
31
+ interface IconsOptions {
32
+ readonly icons?: Readonly<Record<string, IconDefinition>>;
33
+ readonly autoSetup?: boolean;
34
+ readonly font?: string;
35
+ readonly forceSetup?: boolean;
36
+ }
37
+ /**
38
+ * Icons context decorated onto `ctx.icons` by the icons middleware.
39
+ *
40
+ * Provides methods to resolve icon names to glyphs, check installation
41
+ * status, and interactively install Nerd Fonts.
42
+ */
43
+ interface IconsContext {
44
+ /**
45
+ * Resolve an icon name to its glyph string.
46
+ *
47
+ * @param name - The icon name to resolve.
48
+ * @returns The resolved glyph string, or empty string if not found.
49
+ */
50
+ readonly get: (name: string) => string;
51
+ /**
52
+ * Check whether an icon name is defined.
53
+ *
54
+ * @param name - The icon name to check.
55
+ * @returns True when the icon name exists in definitions.
56
+ */
57
+ readonly has: (name: string) => boolean;
58
+ /**
59
+ * Check whether Nerd Fonts are detected on the system.
60
+ *
61
+ * @returns True when Nerd Fonts are installed.
62
+ */
63
+ readonly installed: () => boolean;
64
+ /**
65
+ * Interactively prompt to install Nerd Fonts.
66
+ *
67
+ * @returns A Result with true on success or an IconsError on failure.
68
+ */
69
+ readonly setup: () => AsyncResult<boolean, IconsError>;
70
+ /**
71
+ * Get all resolved icons for a given category.
72
+ *
73
+ * @param cat - The icon category to retrieve.
74
+ * @returns A record mapping icon names to resolved glyph strings.
75
+ */
76
+ readonly category: (cat: IconCategory) => Readonly<Record<string, string>>;
77
+ }
78
+ /**
79
+ * Factory function type for the icons middleware.
80
+ */
81
+ type IconsFactory = (options?: IconsOptions) => Middleware;
82
+ /**
83
+ * Augments the base {@link Context} with an optional `icons` property.
84
+ *
85
+ * When a consumer imports `@kidd-cli/core/icons`, this declaration merges
86
+ * `icons` onto `Context` so that `ctx.icons` is typed without manual casting.
87
+ */
88
+ declare module "@kidd-cli/core" {
89
+ interface Context {
90
+ readonly icons: IconsContext;
91
+ }
92
+ }
93
+ //#endregion
94
+ //#region src/middleware/icons/icons.d.ts
95
+ /**
96
+ * Create an icons middleware that decorates `ctx.icons`.
97
+ *
98
+ * Detects whether Nerd Fonts are installed. When `autoSetup` is enabled
99
+ * and fonts are missing, prompts the user to install them. Merges any
100
+ * custom icon definitions with the built-in defaults.
101
+ *
102
+ * @param options - Optional middleware configuration.
103
+ * @returns A Middleware instance.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * import { icons } from '@kidd-cli/core/icons'
108
+ *
109
+ * cli({
110
+ * middleware: [
111
+ * icons({ autoSetup: true, font: 'JetBrainsMono' }),
112
+ * ],
113
+ * })
114
+ * ```
115
+ */
116
+ declare function icons(options?: IconsOptions): Middleware;
117
+ //#endregion
118
+ export { type IconCategory, type IconDefinition, type IconsContext, type IconsError, type IconsFactory, type IconsOptions, icons };
119
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","names":[],"sources":["../../src/middleware/icons/types.ts","../../src/middleware/icons/icons.ts"],"mappings":";;;;;;;UAoBiB,cAAA;EAAA,SACN,QAAA;EAAA,SACA,KAAA;AAAA;;;AAoCX;KA1BY,YAAA;;;;UASK,UAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;AAAA;;;;;;;;;UAeM,YAAA;EAAA,SACN,KAAA,GAAQ,QAAA,CAAS,MAAA,SAAe,cAAA;EAAA,SAChC,SAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;AAAA;;;;;;;UAaM,YAAA;;;;;;;WAON,GAAA,GAAM,IAAA;;;;;;AAwCjB;WAhCW,GAAA,GAAM,IAAA;;;;;;WAON,SAAA;EAyB4C;AAAA;;;;EAAA,SAlB5C,KAAA,QAAa,WAAA,UAAqB,UAAA;;;;;;;WAQlC,QAAA,GAAW,GAAA,EAAK,YAAA,KAAiB,QAAA,CAAS,MAAA;AAAA;ACnErD;;;AAAA,KD6EY,YAAA,IAAgB,OAAA,GAAU,YAAA,KAAiB,UAAA;;;;;;;;YAa3C,OAAA;IAAA,SACC,KAAA,EAAO,YAAA;EAAA;AAAA;;;;;AApHpB;;;;;AAYA;;;;;AASA;;;;;AAiBA;;;;iBCbgB,KAAA,CAAM,OAAA,GAAU,YAAA,GAAe,UAAA"}