@detergent-software/atk 9.1.0-dev.4 → 9.1.0-dev.5

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.
@@ -5,6 +5,19 @@ export interface NonInteractiveState {
5
5
  }
6
6
  /** Minimum width of the {@link renderJson} Box; wider when the JSON has longer lines. */
7
7
  export declare const MIN_JSON_WIDTH = 9999;
8
+ /** The `--json` error payload for a command state that keeps its error as `error*` fields. */
9
+ export declare function errorStateJson(state: {
10
+ errorCode?: string;
11
+ errorCommand?: string;
12
+ errorHint?: string;
13
+ errorMessage: string;
14
+ }): {
15
+ message: string;
16
+ outcome: string;
17
+ hint?: string | undefined;
18
+ command?: string | undefined;
19
+ code?: string | undefined;
20
+ };
8
21
  /**
9
22
  * Renders an arbitrary value as pretty-printed JSON wrapped in a Box wide
10
23
  * enough that Ink never soft-wraps a line (a wrap inside a string literal
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAW1C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAMD,yFAAyF;AACzF,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAQvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,mBAAmB,CAMxE"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAW1C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAMD,yFAAyF;AACzF,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;;;;;;EAQA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAQvD;AAMD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,mBAAmB,CAMxE"}
@@ -7,6 +7,16 @@ import { getNotices, toJsonNotice } from './notices.js';
7
7
  // ---------------------------------------------------------------------------
8
8
  /** Minimum width of the {@link renderJson} Box; wider when the JSON has longer lines. */
9
9
  export const MIN_JSON_WIDTH = 9999;
10
+ /** The `--json` error payload for a command state that keeps its error as `error*` fields. */
11
+ export function errorStateJson(state) {
12
+ return {
13
+ ...(state.errorCode ? { code: state.errorCode } : {}),
14
+ ...(state.errorCommand ? { command: state.errorCommand } : {}),
15
+ ...(state.errorHint ? { hint: state.errorHint } : {}),
16
+ message: state.errorMessage,
17
+ outcome: 'error',
18
+ };
19
+ }
10
20
  /**
11
21
  * Renders an arbitrary value as pretty-printed JSON wrapped in a Box wide
12
22
  * enough that Ink never soft-wraps a line (a wrap inside a string literal
@@ -23,6 +33,9 @@ export function renderJson(value) {
23
33
  const longest = text.split('\n').reduce((max, line) => Math.max(max, line.length), 0);
24
34
  return (_jsx(Box, { width: Math.max(MIN_JSON_WIDTH, longest * 2 + 1), children: _jsx(Text, { children: text }) }));
25
35
  }
36
+ // ---------------------------------------------------------------------------
37
+ // Render helpers
38
+ // ---------------------------------------------------------------------------
26
39
  /**
27
40
  * Returns the JSON / TTY decision shared across every command.
28
41
  *
@@ -40,9 +53,6 @@ export function useNonInteractive(jsonFlag) {
40
53
  json: jsonFlag || !isRawModeSupported,
41
54
  };
42
55
  }
43
- // ---------------------------------------------------------------------------
44
- // Render helpers
45
- // ---------------------------------------------------------------------------
46
56
  function withNotices(value) {
47
57
  const notices = getNotices();
48
58
  const plainObject = typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype;
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAWxD,8EAA8E;AAC9E,OAAO;AACP,8EAA8E;AAE9E,yFAAyF;AACzF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC;IACnE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACtF,OAAO,CACL,KAAC,GAAG,IAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,YACnD,KAAC,IAAI,cAAE,IAAI,GAAQ,GACf,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,MAAM,EAAE,kBAAkB,EAAE,GAAG,QA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,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,CAAC;IACrH,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACtG,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { RegistryChangePlan, RegistryChangeReceipt } from './atk-api/index.js';
2
+ /**
3
+ * The `--json` shapes `unpublish`, `promote` and `deprecate` share: `opened` is the same for all
4
+ * three; `dry-run` is the unpublish/promote plan (deprecate's plan has its own).
5
+ */
6
+ export declare function registryChangeOpenedJson(name: string, org: string | undefined, result: RegistryChangeReceipt): {
7
+ outcome: string;
8
+ prNumber: number;
9
+ prUrl: string;
10
+ warnings: readonly string[];
11
+ org?: string | undefined;
12
+ branchName: string;
13
+ name: string;
14
+ };
15
+ /** The plan without its PR body, which is for the registry's reviewers. */
16
+ export declare function registryChangePlanJson(plan: RegistryChangePlan): {
17
+ outcome: string;
18
+ prTitle: string;
19
+ versions: readonly string[];
20
+ warnings: readonly string[];
21
+ org?: string | undefined;
22
+ branchName: string;
23
+ changes: readonly {
24
+ readonly from: string;
25
+ readonly to?: string;
26
+ }[];
27
+ kind: "bundle" | "asset";
28
+ name: string;
29
+ assetType?: "skill" | "agent" | "rule" | "hook" | "memory-template" | "mcp-config" | undefined;
30
+ action: "promote" | "unpublish";
31
+ };
32
+ //# sourceMappingURL=registry-change-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-change-json.d.ts","sourceRoot":"","sources":["../../src/lib/registry-change-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;;GAGG;AAEH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,qBAAqB;;;;;;;;EAU5G;AAED,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB;;;;;;;;;;;;;;;EAc9D"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The `--json` shapes `unpublish`, `promote` and `deprecate` share: `opened` is the same for all
3
+ * three; `dry-run` is the unpublish/promote plan (deprecate's plan has its own).
4
+ */
5
+ export function registryChangeOpenedJson(name, org, result) {
6
+ return {
7
+ branchName: result.branchName,
8
+ name,
9
+ ...(org ? { org } : {}),
10
+ outcome: 'opened',
11
+ prNumber: result.prNumber,
12
+ prUrl: result.prUrl,
13
+ warnings: result.warnings,
14
+ };
15
+ }
16
+ /** The plan without its PR body, which is for the registry's reviewers. */
17
+ export function registryChangePlanJson(plan) {
18
+ return {
19
+ action: plan.action,
20
+ ...(plan.assetType ? { assetType: plan.assetType } : {}),
21
+ branchName: plan.branchName,
22
+ changes: plan.changes,
23
+ kind: plan.kind,
24
+ name: plan.name,
25
+ ...(plan.org ? { org: plan.org } : {}),
26
+ outcome: 'dry-run',
27
+ prTitle: plan.prTitle,
28
+ versions: plan.versions,
29
+ warnings: plan.warnings,
30
+ };
31
+ }
32
+ //# sourceMappingURL=registry-change-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-change-json.js","sourceRoot":"","sources":["../../src/lib/registry-change-json.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,MAAM,UAAU,wBAAwB,CAAC,IAAY,EAAE,GAAuB,EAAE,MAA6B;IAC3G,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,IAAI;QACJ,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB,CAAC,IAAwB;IAC7D,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@detergent-software/atk",
3
- "version": "9.1.0-dev.4",
3
+ "version": "9.1.0-dev.5",
4
4
  "description": "Agentic Tool Kit — CLI for managing AI coding tool assets.",
5
5
  "type": "module",
6
6
  "bin": {