@indy2kro/agentenv 0.3.0 → 0.3.2

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 (39) hide show
  1. package/dist/commands/apply.d.ts +13 -0
  2. package/dist/commands/apply.d.ts.map +1 -1
  3. package/dist/commands/apply.js +44 -23
  4. package/dist/commands/apply.js.map +1 -1
  5. package/dist/commands/setup.d.ts +2 -0
  6. package/dist/commands/setup.d.ts.map +1 -1
  7. package/dist/commands/setup.js +25 -23
  8. package/dist/commands/setup.js.map +1 -1
  9. package/dist/commands/uninstall.d.ts.map +1 -1
  10. package/dist/commands/uninstall.js +11 -17
  11. package/dist/commands/uninstall.js.map +1 -1
  12. package/dist/commands/update.d.ts.map +1 -1
  13. package/dist/commands/update.js +12 -11
  14. package/dist/commands/update.js.map +1 -1
  15. package/dist/toolchain/fallbacks.d.ts +11 -0
  16. package/dist/toolchain/fallbacks.d.ts.map +1 -1
  17. package/dist/toolchain/fallbacks.js +16 -0
  18. package/dist/toolchain/fallbacks.js.map +1 -1
  19. package/dist/toolchain/mise.d.ts +73 -18
  20. package/dist/toolchain/mise.d.ts.map +1 -1
  21. package/dist/toolchain/mise.js +172 -37
  22. package/dist/toolchain/mise.js.map +1 -1
  23. package/dist/toolchain/rtk.d.ts +9 -0
  24. package/dist/toolchain/rtk.d.ts.map +1 -1
  25. package/dist/toolchain/rtk.js +12 -0
  26. package/dist/toolchain/rtk.js.map +1 -1
  27. package/dist/ui/output.d.ts +9 -0
  28. package/dist/ui/output.d.ts.map +1 -1
  29. package/dist/ui/output.js +37 -2
  30. package/dist/ui/output.js.map +1 -1
  31. package/dist/ui/report.d.ts +35 -0
  32. package/dist/ui/report.d.ts.map +1 -0
  33. package/dist/ui/report.js +64 -0
  34. package/dist/ui/report.js.map +1 -0
  35. package/dist/ui/spinner.d.ts +6 -2
  36. package/dist/ui/spinner.d.ts.map +1 -1
  37. package/dist/ui/spinner.js +5 -2
  38. package/dist/ui/spinner.js.map +1 -1
  39. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ import type { ResultSeverity } from './output.js';
2
+ /**
3
+ * Minimal shape of a `validateConfig` result, so this module never needs to
4
+ * depend on the schema layer.
5
+ */
6
+ export interface ValidationReportView {
7
+ errors: string[];
8
+ warnings: string[];
9
+ }
10
+ /** The one config-path line every mutating command prints after resolving its file. */
11
+ export declare function printConfigPath(configPath: string): void;
12
+ /** Warnings + errors in the shared `warning:` / `error:` shape (colored). */
13
+ export declare function printValidation(report: ValidationReportView): void;
14
+ /**
15
+ * Shared validation gate: print warnings/errors, and when invalid print the
16
+ * given "not applying" line and return false. Callers set the exit code.
17
+ */
18
+ export declare function reportValidation(report: ValidationReportView, notApplying: string): boolean;
19
+ /** Apply/setup result tail: colorized messages, then themed errors. */
20
+ export declare function printMessages(messages: string[], errors: string[]): void;
21
+ /**
22
+ * Human duration for the end-of-run line: sub-second in whole milliseconds,
23
+ * otherwise seconds to one decimal (or `Xm Ys` past a minute). Non-finite and
24
+ * negative inputs clamp to `0ms` so callers never print `NaN`.
25
+ */
26
+ export declare function formatDuration(ms: number): string;
27
+ /** End-of-run timing phrase: `failed in …` for a fail outcome, else `finished in …`. */
28
+ export declare function timingPhrase(severity: ResultSeverity, ms: number): string;
29
+ /**
30
+ * Shared result-box line, gated by TTY/quiet exactly like every other result.
31
+ * When `elapsedMs` is given, a timing line is appended (always printed, so a
32
+ * piped/CI run still records how long the command took).
33
+ */
34
+ export declare function printResult(severity: ResultSeverity, headline: string, summary?: string, elapsedMs?: number): void;
35
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/ui/report.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAGlE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAO3F;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAGxE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAKN"}
@@ -0,0 +1,64 @@
1
+ import { colorizeLine, theme } from './theme.js';
2
+ import { resolveResultLine } from './output.js';
3
+ /** The one config-path line every mutating command prints after resolving its file. */
4
+ export function printConfigPath(configPath) {
5
+ console.log(`Config: ${configPath}`);
6
+ }
7
+ /** Warnings + errors in the shared `warning:` / `error:` shape (colored). */
8
+ export function printValidation(report) {
9
+ for (const warning of report.warnings)
10
+ console.log(theme.warn(`warning: ${warning}`));
11
+ for (const error of report.errors)
12
+ console.error(theme.fail(`error: ${error}`));
13
+ }
14
+ /**
15
+ * Shared validation gate: print warnings/errors, and when invalid print the
16
+ * given "not applying" line and return false. Callers set the exit code.
17
+ */
18
+ export function reportValidation(report, notApplying) {
19
+ printValidation(report);
20
+ if (report.errors.length > 0) {
21
+ console.error(theme.fail(notApplying));
22
+ return false;
23
+ }
24
+ return true;
25
+ }
26
+ /** Apply/setup result tail: colorized messages, then themed errors. */
27
+ export function printMessages(messages, errors) {
28
+ for (const message of messages)
29
+ console.log(colorizeLine(message));
30
+ for (const error of errors)
31
+ console.error(theme.fail(error));
32
+ }
33
+ /**
34
+ * Human duration for the end-of-run line: sub-second in whole milliseconds,
35
+ * otherwise seconds to one decimal (or `Xm Ys` past a minute). Non-finite and
36
+ * negative inputs clamp to `0ms` so callers never print `NaN`.
37
+ */
38
+ export function formatDuration(ms) {
39
+ if (!Number.isFinite(ms) || ms <= 0)
40
+ return '0ms';
41
+ if (ms < 1000)
42
+ return `${Math.round(ms)}ms`;
43
+ const seconds = ms / 1000;
44
+ if (seconds < 60)
45
+ return `${seconds.toFixed(1)}s`;
46
+ const wholeSeconds = Math.floor(seconds);
47
+ return `${Math.floor(wholeSeconds / 60)}m ${wholeSeconds % 60}s`;
48
+ }
49
+ /** End-of-run timing phrase: `failed in …` for a fail outcome, else `finished in …`. */
50
+ export function timingPhrase(severity, ms) {
51
+ return `${severity === 'fail' ? 'failed' : 'finished'} in ${formatDuration(ms)}`;
52
+ }
53
+ /**
54
+ * Shared result-box line, gated by TTY/quiet exactly like every other result.
55
+ * When `elapsedMs` is given, a timing line is appended (always printed, so a
56
+ * piped/CI run still records how long the command took).
57
+ */
58
+ export function printResult(severity, headline, summary, elapsedMs) {
59
+ console.log(`\n${resolveResultLine({ severity, headline, summary })}\n`);
60
+ if (elapsedMs !== undefined) {
61
+ console.log(`${timingPhrase(severity, elapsedMs)}\n`);
62
+ }
63
+ }
64
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/ui/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAYhD,uFAAuF;AACvF,MAAM,UA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AAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC;IAC5C,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IAC1B,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAClD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,KAAK,YAAY,GAAG,EAAE,GAAG,CAAC;AACnE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,YAAY,CAAC,QAAwB,EAAE,EAAU;IAC/D,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,OAAO,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,QAAwB,EACxB,QAAgB,EAChB,OAAgB,EAChB,SAAkB;IAElB,OAAO,CAAC,GAAG,CAAC,KAAK,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
@@ -10,14 +10,18 @@ export interface Spinner {
10
10
  start(): Spinner;
11
11
  succeed(text?: string): Spinner;
12
12
  fail(text?: string): Spinner;
13
+ /** Pause rendering without a succeed/fail glyph, so a caller can print raw output (e.g. streamed mise install progress) without the spinner fighting it for the terminal line, then `start()` again to resume. */
14
+ stop(): Spinner;
13
15
  }
14
16
  export type SpinnerFactory = (text: string) => Spinner;
15
17
  /**
16
18
  * Run fn() under a spinner labeled `label`, resolving succeed/fail from the
17
19
  * result's `success` field. `-q/--quiet` swaps in a no-op spinner so quiet
18
- * output is actually silent even on a TTY.
20
+ * output is actually silent even on a TTY. `fn` receives the spinner itself
21
+ * so a long inner step can `stop()` it before printing raw output and
22
+ * `start()` it again afterwards.
19
23
  */
20
24
  export declare function withSpinner<T extends {
21
25
  success: boolean;
22
- }>(label: string, fn: () => Promise<T>, spinnerFactory?: SpinnerFactory): Promise<T>;
26
+ }>(label: string, fn: (spinner: Spinner) => Promise<T>, spinnerFactory?: SpinnerFactory): Promise<T>;
23
27
  //# sourceMappingURL=spinner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,OAAO;IACtB,KAAK,IAAI,OAAO,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAUvD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EAC9D,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,cAAc,GAAE,cAAsC,GACrD,OAAO,CAAC,CAAC,CAAC,CAYZ"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,OAAO;IACtB,KAAK,IAAI,OAAO,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,kNAAkN;IAClN,IAAI,IAAI,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAWvD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EAC9D,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,EACpC,cAAc,GAAE,cAAsC,GACrD,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -13,17 +13,20 @@ const quietSpinner = {
13
13
  start: () => quietSpinner,
14
14
  succeed: () => quietSpinner,
15
15
  fail: () => quietSpinner,
16
+ stop: () => quietSpinner,
16
17
  };
17
18
  /**
18
19
  * Run fn() under a spinner labeled `label`, resolving succeed/fail from the
19
20
  * result's `success` field. `-q/--quiet` swaps in a no-op spinner so quiet
20
- * output is actually silent even on a TTY.
21
+ * output is actually silent even on a TTY. `fn` receives the spinner itself
22
+ * so a long inner step can `stop()` it before printing raw output and
23
+ * `start()` it again afterwards.
21
24
  */
22
25
  export async function withSpinner(label, fn, spinnerFactory = defaultSpinnerFactory) {
23
26
  const factory = isQuiet() ? () => quietSpinner : spinnerFactory;
24
27
  const spinner = factory(label).start();
25
28
  try {
26
- const result = await fn();
29
+ const result = await fn(spinner);
27
30
  if (result.success)
28
31
  spinner.succeed(label);
29
32
  else
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAUtC,MAAM,qBAAqB,GAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAuB,CAAC;AAExF,MAAM,YAAY,GAAY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AAY;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,EAAoC,EACpC,iBAAiC,qBAAqB;IAEtD,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,GAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC;IACzE,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;;YACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indy2kro/agentenv",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "CLI for configuring a consistent, capable shell environment for AI coding agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",