@detergent-software/atk 7.13.0-dev.2 → 7.13.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 (68) hide show
  1. package/README.md +5 -6
  2. package/build/commands/promote.d.ts +1 -10
  3. package/build/commands/promote.d.ts.map +1 -1
  4. package/build/commands/promote.js +31 -30
  5. package/build/commands/promote.js.map +1 -1
  6. package/build/commands/release-notes.js +1 -1
  7. package/build/commands/release-notes.js.map +1 -1
  8. package/build/commands/unpublish.d.ts +1 -10
  9. package/build/commands/unpublish.d.ts.map +1 -1
  10. package/build/commands/unpublish.js +19 -30
  11. package/build/commands/unpublish.js.map +1 -1
  12. package/build/components/index.d.ts +0 -1
  13. package/build/components/index.d.ts.map +1 -1
  14. package/build/components/index.js +0 -1
  15. package/build/components/index.js.map +1 -1
  16. package/build/hooks/usePromoteState.d.ts +51 -0
  17. package/build/hooks/usePromoteState.d.ts.map +1 -0
  18. package/build/hooks/usePromoteState.js +139 -0
  19. package/build/hooks/usePromoteState.js.map +1 -0
  20. package/build/hooks/useUnpublishState.d.ts +52 -0
  21. package/build/hooks/useUnpublishState.d.ts.map +1 -0
  22. package/build/hooks/useUnpublishState.js +140 -0
  23. package/build/hooks/useUnpublishState.js.map +1 -0
  24. package/build/lib/api/index.d.ts +2 -2
  25. package/build/lib/api/index.d.ts.map +1 -1
  26. package/build/lib/api/index.js +1 -1
  27. package/build/lib/api/index.js.map +1 -1
  28. package/build/lib/api/sdk.gen.d.ts +1 -21
  29. package/build/lib/api/sdk.gen.d.ts.map +1 -1
  30. package/build/lib/api/sdk.gen.js +0 -56
  31. package/build/lib/api/sdk.gen.js.map +1 -1
  32. package/build/lib/api/types.gen.d.ts +0 -387
  33. package/build/lib/api/types.gen.d.ts.map +1 -1
  34. package/build/lib/api-client.d.ts +0 -5
  35. package/build/lib/api-client.d.ts.map +1 -1
  36. package/build/lib/api-client.js +0 -31
  37. package/build/lib/api-client.js.map +1 -1
  38. package/build/lib/auth.d.ts +14 -1
  39. package/build/lib/auth.d.ts.map +1 -1
  40. package/build/lib/auth.js +30 -1
  41. package/build/lib/auth.js.map +1 -1
  42. package/build/lib/diagnostics.d.ts.map +1 -1
  43. package/build/lib/diagnostics.js +19 -1
  44. package/build/lib/diagnostics.js.map +1 -1
  45. package/build/lib/publisher.d.ts.map +1 -1
  46. package/build/lib/publisher.js +7 -1
  47. package/build/lib/publisher.js.map +1 -1
  48. package/build/lib/registry-mutate.d.ts +64 -23
  49. package/build/lib/registry-mutate.d.ts.map +1 -1
  50. package/build/lib/registry-mutate.js +409 -50
  51. package/build/lib/registry-mutate.js.map +1 -1
  52. package/build/lib/registry-repo.d.ts +3 -2
  53. package/build/lib/registry-repo.d.ts.map +1 -1
  54. package/build/lib/registry-repo.js +3 -2
  55. package/build/lib/registry-repo.js.map +1 -1
  56. package/build/lib/release-notes.d.ts +14 -18
  57. package/build/lib/release-notes.d.ts.map +1 -1
  58. package/build/lib/release-notes.js +42 -10
  59. package/build/lib/release-notes.js.map +1 -1
  60. package/package.json +1 -1
  61. package/build/components/RegistryChangeSummary.d.ts +0 -21
  62. package/build/components/RegistryChangeSummary.d.ts.map +0 -1
  63. package/build/components/RegistryChangeSummary.js +0 -24
  64. package/build/components/RegistryChangeSummary.js.map +0 -1
  65. package/build/hooks/useRegistryChangeState.d.ts +0 -57
  66. package/build/hooks/useRegistryChangeState.d.ts.map +0 -1
  67. package/build/hooks/useRegistryChangeState.js +0 -112
  68. package/build/hooks/useRegistryChangeState.js.map +0 -1
@@ -1,12 +1,17 @@
1
1
  import { eq as semverEq, gt as semverGt, prerelease as semverPrerelease, rcompare as semverRcompare, valid as semverValid, } from 'semver';
2
- import { getApiClient, unwrap } from './api-client.js';
3
- import { getCliReleases } from './api/sdk.gen.js';
2
+ import { getGitHubToken } from './auth.js';
3
+ import { fetchWithRetry } from './fetch-retry.js';
4
4
  import { CLI_VERSION, isPreRelease } from './version.js';
5
5
  /** Default number of releases shown in list mode before `--all` is needed. */
6
6
  export const DEFAULT_RELEASE_LIMIT = 15;
7
7
  /**
8
- * Fetch the CLI's releases from the ATK API (`GET /cli/releases`) and return
9
- * release notes for browsing.
8
+ * The CLI's own source repository (distinct from the registry repo).
9
+ * GitHub Releases for this repo are the source of the `release-notes` command.
10
+ */
11
+ const DEFAULT_CLI_REPO = 'EmergentSoftware/agentic-toolkit-cli';
12
+ const RELEASES_URL = `https://api.github.com/repos/${DEFAULT_CLI_REPO}/releases?per_page=100`;
13
+ /**
14
+ * Fetch GitHub Releases for the CLI repo and return release notes for browsing.
10
15
  *
11
16
  * Without a `version`, returns the release history (newest-first), channel-filtered
12
17
  * and capped at a limit, with each entry flagged for whether it is the installed
@@ -21,9 +26,14 @@ export const DEFAULT_RELEASE_LIMIT = 15;
21
26
  * command can surface them via `ErrorView`.
22
27
  */
23
28
  export async function getReleaseNotes(options = {}, progress) {
29
+ progress?.('Authenticating...');
30
+ const token = await getGitHubToken();
24
31
  progress?.('Fetching releases...');
25
- const client = await getApiClient();
26
- const raw = unwrap(await getCliReleases({ client }), 'CLI releases').releases;
32
+ const response = await fetchWithRetry(RELEASES_URL, { headers: buildGitHubHeaders(token) });
33
+ if (!response.ok) {
34
+ throw new Error(httpErrorMessage(response.status, 'CLI releases'));
35
+ }
36
+ const raw = (await response.json());
27
37
  // A specific version lookup ignores the channel filter so you can always read
28
38
  // the notes for any published version (including pre-releases).
29
39
  if (options.version) {
@@ -48,7 +58,7 @@ export async function getReleaseNotes(options = {}, progress) {
48
58
  };
49
59
  }
50
60
  /**
51
- * Pure selection logic: from raw releases, return valid releases ordered
61
+ * Pure selection logic: from raw GitHub releases, return valid releases ordered
52
62
  * newest-first, optionally including pre-releases, with each entry flagged for
53
63
  * whether it is the installed version or newer than it. Exported separately so
54
64
  * channel filtering, version comparison, and flagging are unit-testable without
@@ -56,14 +66,14 @@ export async function getReleaseNotes(options = {}, progress) {
56
66
  *
57
67
  * - Tags are normalized by stripping a leading `v`; entries that aren't valid
58
68
  * semver are skipped.
59
- * - A release's channel is `dev` when its `prerelease` flag is set OR the
69
+ * - A release's channel is `dev` when GitHub's `prerelease` flag is set OR the
60
70
  * version carries a semver pre-release component; otherwise `latest`.
61
71
  * - When `includePrerelease` is false, `dev` releases are dropped.
62
72
  */
63
73
  export function selectReleaseNotes(raw, currentVersion, includePrerelease) {
64
74
  const notes = [];
65
75
  for (const entry of raw) {
66
- const version = normalizeTag(entry.version ?? entry.tag);
76
+ const version = normalizeTag(entry.tag_name);
67
77
  if (!version || !semverValid(version)) {
68
78
  continue;
69
79
  }
@@ -78,13 +88,35 @@ export function selectReleaseNotes(raw, currentVersion, includePrerelease) {
78
88
  installed: semverValid(currentVersion) ? semverEq(version, currentVersion) : false,
79
89
  newer: semverValid(currentVersion) ? semverGt(version, currentVersion) : false,
80
90
  prerelease,
81
- publishedAt: entry.publishedAt ?? null,
91
+ publishedAt: entry.published_at ?? null,
82
92
  version,
83
93
  });
84
94
  }
85
95
  notes.sort((a, b) => semverRcompare(a.version, b.version));
86
96
  return notes;
87
97
  }
98
+ /** Standard GitHub REST API headers for the releases request. */
99
+ function buildGitHubHeaders(token) {
100
+ return {
101
+ Accept: 'application/vnd.github+json',
102
+ Authorization: `Bearer ${token}`,
103
+ 'X-GitHub-Api-Version': '2022-11-28',
104
+ };
105
+ }
106
+ /** User-friendly message for a failed GitHub API response. */
107
+ function httpErrorMessage(status, resource) {
108
+ switch (status) {
109
+ case 401:
110
+ case 403:
111
+ return 'Authentication failed. Check your GitHub token or run `gh auth login`.';
112
+ case 404:
113
+ return `File not found at ${resource}.`;
114
+ case 429:
115
+ return 'GitHub API rate limit exceeded. Try again later.';
116
+ default:
117
+ return `Failed to fetch ${resource}: HTTP ${status}`;
118
+ }
119
+ }
88
120
  /** Strip a single leading `v` from a release tag, returning undefined when empty. */
89
121
  function normalizeTag(tagName) {
90
122
  if (!tagName)
@@ -1 +1 @@
1
- {"version":3,"file":"release-notes.js","sourceRoot":"","sources":["../../src/lib/release-not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U,KAAK,EAAE;QAChC,sBAAsB,EAAE,YAAY;KACrC,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,SAAS,gBAAgB,CAAC,MAAc,EAAE,QAAgB;IACxD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACN,OAAO,wEAAwE,CAAC;QAClF,KAAK,GAAG;YACN,OAAO,qBAAqB,QAAQ,GAAG,CAAC;QAC1C,KAAK,GAAG;YACN,OAAO,kDAAkD,CAAC;QAC5D;YACE,OAAO,mBAAmB,QAAQ,UAAU,MAAM,EAAE,CAAC;IACzD,CAAC;AACH,CAAC;AAED,qFAAqF;AACrF,SAAS,YAAY,CAAC,OAAgB;IACpC,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACtE,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@detergent-software/atk",
3
- "version": "7.13.0-dev.2",
3
+ "version": "7.13.0",
4
4
  "description": "Agentic Tool Kit — CLI for managing AI coding tool assets.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,21 +0,0 @@
1
- import type { RegistryChangePlan, RegistryChangeResponse } from '../lib/registry-mutate.js';
2
- interface RegistryChangePlanViewProps {
3
- plan: RegistryChangePlan;
4
- /** Render the dry-run banner and branch line (dry run) or the confirmation prompt (confirming). */
5
- variant: 'confirm' | 'dry-run';
6
- }
7
- interface RegistryChangeResultViewProps {
8
- plan: RegistryChangePlan | undefined;
9
- result: RegistryChangeResponse;
10
- }
11
- /** `@org/name` or `name`, optionally with an asset type prefix (`skill my-skill`). */
12
- export declare function formatChangeTarget(plan: Pick<RegistryChangePlan, 'assetType' | 'kind' | 'name' | 'org'>): string;
13
- /** The PR the API opened for an unpublish / promote. */
14
- export declare function RegistryChangeResult({ plan, result }: RegistryChangeResultViewProps): import("react/jsx-runtime").JSX.Element;
15
- /**
16
- * The server's plan for `atk unpublish` / `atk promote`: target, versions,
17
- * one line per version directory (`remove:` or `move: from → to`), warnings.
18
- */
19
- export default function RegistryChangeSummary({ plan, variant }: RegistryChangePlanViewProps): import("react/jsx-runtime").JSX.Element;
20
- export {};
21
- //# sourceMappingURL=RegistryChangeSummary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RegistryChangeSummary.d.ts","sourceRoot":"","sources":["../../src/components/RegistryChangeSummary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAI5F,UAAU,2BAA2B;IACnC,IAAI,EAAE,kBAAkB,CAAC;IACzB,mGAAmG;IACnG,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC;AAED,UAAU,6BAA6B;IACrC,IAAI,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACrC,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,MAAM,CAIhH;AAED,wDAAwD;AACxD,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,6BAA6B,2CA4BnF;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,2BAA2B,2CA+D3F"}
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Box, Text } from 'ink';
3
- import { CheckIcon } from './StatusBadge.js';
4
- /** `@org/name` or `name`, optionally with an asset type prefix (`skill my-skill`). */
5
- export function formatChangeTarget(plan) {
6
- const scoped = plan.org ? `@${plan.org}/${plan.name}` : plan.name;
7
- const label = plan.kind === 'bundle' ? 'bundle' : plan.assetType;
8
- return label ? `${label} ${scoped}` : scoped;
9
- }
10
- /** The PR the API opened for an unpublish / promote. */
11
- export function RegistryChangeResult({ plan, result }) {
12
- const verb = plan?.action === 'promote' ? 'Promote' : 'Unpublish';
13
- const target = plan ? formatChangeTarget(plan) : undefined;
14
- return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { color: 'green', children: [verb, " PR #", result.prNumber, " opened", target ? ' for ' : '', target ? _jsx(Text, { bold: true, children: target }) : null] }), _jsx(Text, { children: " " }), _jsxs(Text, { children: ["PR: ", _jsx(Text, { color: 'cyan', children: result.prUrl })] }), _jsxs(Text, { children: ["Branch: ", _jsx(Text, { dimColor: true, children: result.branchName })] }), result.warnings.length > 0 ? (_jsx(Box, { flexDirection: 'column', marginTop: 1, children: result.warnings.map((w) => (_jsxs(Text, { children: [_jsx(CheckIcon, { status: 'warn' }), " ", w] }, w))) })) : null] }));
15
- }
16
- /**
17
- * The server's plan for `atk unpublish` / `atk promote`: target, versions,
18
- * one line per version directory (`remove:` or `move: from → to`), warnings.
19
- */
20
- export default function RegistryChangeSummary({ plan, variant }) {
21
- const verb = plan.action === 'promote' ? 'Promote' : 'Unpublish';
22
- return (_jsxs(Box, { flexDirection: 'column', children: [variant === 'dry-run' ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: 'yellow', children: "~ Dry run \u2014 no changes will be made" }), _jsx(Text, { children: " " })] })) : (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, children: [verb, " Summary"] }) })), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Target: " }), _jsx(Text, { bold: true, children: formatChangeTarget(plan) }), plan.action === 'promote' ? _jsx(Text, { children: " \u2192 global" }) : null] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Versions: " }), plan.versions.length > 0 ? plan.versions.join(', ') : '(none)'] }), _jsx(Text, { children: " " }), _jsx(Text, { bold: true, children: plan.action === 'promote' ? 'Path moves:' : 'Paths to remove:' }), plan.changes.map((change) => (_jsxs(Text, { children: [' ', change.to ? (_jsxs(_Fragment, { children: [change.from, "/ \u2192 ", change.to, "/"] })) : (_jsxs(_Fragment, { children: [change.from, "/"] }))] }, change.from))), plan.warnings.length > 0 ? (_jsx(Box, { flexDirection: 'column', marginTop: 1, children: plan.warnings.map((w) => (_jsxs(Text, { children: [_jsx(CheckIcon, { status: 'warn' }), " ", w] }, w))) })) : null, _jsx(Text, { children: " " }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Branch: " }), plan.branchName] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Action: " }), "Create PR"] }), variant === 'confirm' ? (_jsx(Box, { marginTop: 1, children: _jsx(Text, { children: "Proceed? (y/n)" }) })) : null] }));
23
- }
24
- //# sourceMappingURL=RegistryChangeSummary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RegistryChangeSummary.js","sourceRoot":"","sources":["../../src/components/RegistryChangeSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAIhC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAa7C,sFAAsF;AACtF,MAAM,UAAU,kBAAkB,CAAC,IAAqE;IACtG,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAClE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,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,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,MAAC,IAAI,eACF,IAAI,EACJ,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CACX,8BACG,MAAM,CAAC,IAAI,eAAM,MAAM,CAAC,EAAE,SAC1B,CACJ,CAAC,CAAC,CAAC,CACF,8BAAG,MAAM,CAAC,IAAI,SAAK,CACpB,KARQ,MAAM,CAAC,IAAI,CASf,CACR,CAAC,EACD,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,YACrC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACxB,MAAC,IAAI,eACH,KAAC,SAAS,IAAC,MAAM,EAAC,MAAM,GAAG,OAAE,CAAC,KADrB,CAAC,CAEL,CACR,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,IAAI,oBAAS,EACd,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,QAAQ,+BAAgB,EAC7B,IAAI,CAAC,UAAU,IACX,EACP,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,QAAQ,+BAAgB,iBAEzB,EACN,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,iCAAsB,GACvB,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
@@ -1,57 +0,0 @@
1
- import type { RegistryChangePlan, RegistryChangeResponse } from '../lib/registry-mutate.js';
2
- export type RegistryChangeAction = {
3
- command?: string;
4
- hint?: string;
5
- message: string;
6
- type: 'ERROR';
7
- } | {
8
- message: string;
9
- type: 'PROGRESS';
10
- } | {
11
- plan: RegistryChangePlan;
12
- type: 'PLAN_READY';
13
- } | {
14
- result: RegistryChangeResponse;
15
- type: 'DONE';
16
- } | {
17
- type: 'CANCEL';
18
- } | {
19
- type: 'CONFIRM';
20
- };
21
- /**
22
- * What a registry-change command (`unpublish`, `promote`) plugs into the shared
23
- * flow: fetch the server's plan, then ask the server to open the PR.
24
- */
25
- export interface RegistryChangeOptions {
26
- /** Shown as the error message when the user declines the confirmation. */
27
- cancelledMessage: string;
28
- dryRun: boolean;
29
- execute: (progress: (message: string) => void) => Promise<RegistryChangeResponse>;
30
- plan: () => Promise<RegistryChangePlan>;
31
- projectRoot?: string;
32
- }
33
- export type RegistryChangePhase = 'confirming' | 'done' | 'dry-run-result' | 'error' | 'executing' | 'planning';
34
- export interface RegistryChangeState {
35
- cancelledMessage: string;
36
- dryRun: boolean;
37
- errorCommand?: string;
38
- errorHint?: string;
39
- errorMessage: string;
40
- phase: RegistryChangePhase;
41
- plan: RegistryChangePlan | undefined;
42
- progressMessage: string;
43
- result: RegistryChangeResponse | undefined;
44
- }
45
- export declare function createInitialState(options: {
46
- cancelledMessage: string;
47
- dryRun: boolean;
48
- }): RegistryChangeState;
49
- export declare function registryChangeReducer(state: RegistryChangeState, action: RegistryChangeAction): RegistryChangeState;
50
- /**
51
- * Plan → confirm → execute flow shared by `atk unpublish` and `atk promote`.
52
- * The plan comes from the API, so `--dry-run` shows exactly what the server
53
- * would do; confirmation (or `--yes`) is driven by the command via
54
- * `CONFIRM` / `CANCEL`.
55
- */
56
- export declare function useRegistryChangeState(options: RegistryChangeOptions): readonly [RegistryChangeState, React.Dispatch<RegistryChangeAction>];
57
- //# sourceMappingURL=useRegistryChangeState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRegistryChangeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useRegistryChangeState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAQ5F,MAAM,MAAM,oBAAoB,GAC5B;IAAE,OAAO,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wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,CAU9G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,GAAG,mBAAmB,CA+BnH;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAmDtE"}
@@ -1,112 +0,0 @@
1
- import { useEffect, useReducer } from 'react';
2
- import { findProjectRoot } from '../lib/paths.js';
3
- // ---------------------------------------------------------------------------
4
- // Reducer
5
- // ---------------------------------------------------------------------------
6
- export function createInitialState(options) {
7
- return {
8
- cancelledMessage: options.cancelledMessage,
9
- dryRun: options.dryRun,
10
- errorMessage: '',
11
- phase: 'planning',
12
- plan: undefined,
13
- progressMessage: '',
14
- result: undefined,
15
- };
16
- }
17
- export function registryChangeReducer(state, action) {
18
- switch (action.type) {
19
- case 'CANCEL':
20
- if (state.phase !== 'confirming')
21
- return state;
22
- return { ...state, errorMessage: state.cancelledMessage, phase: 'error' };
23
- case 'CONFIRM':
24
- if (state.phase !== 'confirming')
25
- return state;
26
- return { ...state, phase: 'executing' };
27
- case 'DONE':
28
- return { ...state, phase: 'done', result: action.result };
29
- case 'ERROR':
30
- return {
31
- ...state,
32
- errorCommand: action.command,
33
- errorHint: action.hint,
34
- errorMessage: action.message,
35
- phase: 'error',
36
- };
37
- case 'PLAN_READY':
38
- return { ...state, phase: state.dryRun ? 'dry-run-result' : 'confirming', plan: action.plan };
39
- case 'PROGRESS':
40
- return { ...state, progressMessage: action.message };
41
- default:
42
- return state;
43
- }
44
- }
45
- // ---------------------------------------------------------------------------
46
- // Hook
47
- // ---------------------------------------------------------------------------
48
- /**
49
- * Plan → confirm → execute flow shared by `atk unpublish` and `atk promote`.
50
- * The plan comes from the API, so `--dry-run` shows exactly what the server
51
- * would do; confirmation (or `--yes`) is driven by the command via
52
- * `CONFIRM` / `CANCEL`.
53
- */
54
- export function useRegistryChangeState(options) {
55
- const [state, dispatch] = useReducer(registryChangeReducer, options, createInitialState);
56
- // --- Phase: planning ---
57
- useEffect(() => {
58
- if (state.phase !== 'planning')
59
- return;
60
- let cancelled = false;
61
- const run = async () => {
62
- // Resolve the project root so the setup gateway behaves as it does for publish.
63
- findProjectRoot(options.projectRoot);
64
- const plan = await options.plan();
65
- if (!cancelled)
66
- dispatch({ plan, type: 'PLAN_READY' });
67
- };
68
- run().catch((err) => {
69
- if (!cancelled)
70
- dispatch(toErrorAction(err));
71
- });
72
- return () => {
73
- cancelled = true;
74
- };
75
- // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [state.phase]);
77
- // --- Phase: executing ---
78
- useEffect(() => {
79
- if (state.phase !== 'executing')
80
- return;
81
- let cancelled = false;
82
- const run = async () => {
83
- const progress = (message) => {
84
- if (!cancelled)
85
- dispatch({ message, type: 'PROGRESS' });
86
- };
87
- const result = await options.execute(progress);
88
- if (!cancelled)
89
- dispatch({ result, type: 'DONE' });
90
- };
91
- run().catch((err) => {
92
- if (!cancelled)
93
- dispatch(toErrorAction(err));
94
- });
95
- return () => {
96
- cancelled = true;
97
- };
98
- // eslint-disable-next-line react-hooks/exhaustive-deps
99
- }, [state.phase]);
100
- return [state, dispatch];
101
- }
102
- /** Carry an error's message plus any `hint` / `command` (ApiRequestError, AuthError) into state. */
103
- function toErrorAction(err) {
104
- const { command, hint } = (typeof err === 'object' && err !== null ? err : {});
105
- return {
106
- command: typeof command === 'string' ? command : undefined,
107
- hint: typeof hint === 'string' ? hint : undefined,
108
- message: err instanceof Error ? err.message : String(err),
109
- type: 'ERROR',
110
- };
111
- }
112
- //# sourceMappingURL=useRegistryChangeState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRegistryChangeState.js","sourceRoot":"","sources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