@detergent-software/atk 9.6.1-dev.14 → 9.6.1-dev.16
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.
- package/CHANGELOG.md +17 -0
- package/README.md +8 -8
- package/build/commands/_app.d.ts +17 -1
- package/build/commands/_app.d.ts.map +1 -1
- package/build/commands/_app.js +42 -25
- package/build/commands/_app.js.map +1 -1
- package/build/commands/upgrade.d.ts +5 -2
- package/build/commands/upgrade.d.ts.map +1 -1
- package/build/commands/upgrade.js +2 -4
- package/build/commands/upgrade.js.map +1 -1
- package/build/lib/ink-stdout.d.ts +17 -2
- package/build/lib/ink-stdout.d.ts.map +1 -1
- package/build/lib/ink-stdout.js +47 -2
- package/build/lib/ink-stdout.js.map +1 -1
- package/build/lib/pastel/read-custom-app.d.ts +3 -0
- package/build/lib/pastel/read-custom-app.d.ts.map +1 -1
- package/build/lib/pastel/read-custom-app.js +1 -1
- package/build/lib/pastel/read-custom-app.js.map +1 -1
- package/build/lib/pastel/render-command.d.ts.map +1 -1
- package/build/lib/pastel/render-command.js +1 -0
- package/build/lib/pastel/render-command.js.map +1 -1
- package/build/lib/update-check.d.ts +25 -19
- package/build/lib/update-check.d.ts.map +1 -1
- package/build/lib/update-check.js +50 -61
- package/build/lib/update-check.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [9.6.1-dev.16](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/branchCompare?baseVersion=GTv9.6.1-dev.15&targetVersion=GTv9.6.1-dev.16) (2026-11-11)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **cli:** hold a tall print-once frame through a resize ([6d94457](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/commit/6d94457ca5db023a85d409363ae3a75930902cf1))
|
|
6
|
+
* **cli:** measure the print-once frame when the stdout asks ([57c7d16](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/commit/57c7d16d6b79b38823faddb5262e257d5a60e30c))
|
|
7
|
+
|
|
8
|
+
## [9.6.1-dev.15](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/branchCompare?baseVersion=GTv9.6.1-dev.14&targetVersion=GTv9.6.1-dev.15) (2026-11-11)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **cli:** decide the update banner before the first frame ([c1d18f8](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/commit/c1d18f8d705acbaf25e35e80b2c25537240b17dc))
|
|
13
|
+
|
|
14
|
+
### Refactoring
|
|
15
|
+
|
|
16
|
+
* **cli:** tidy the update banner's shell checks after review ([6b01bb9](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/commit/6b01bb95bf9074e07f800fb2cf6e46745bd98233))
|
|
17
|
+
|
|
1
18
|
## [9.6.1-dev.14](https://emergentcode.visualstudio.com/Emergent%20Software/_git/Emergent.AgenticToolkit/branchCompare?baseVersion=GTv9.6.1-dev.13&targetVersion=GTv9.6.1-dev.14) (2026-11-11)
|
|
2
19
|
|
|
3
20
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -399,14 +399,14 @@ atk config org --reset
|
|
|
399
399
|
|
|
400
400
|
### Available Keys
|
|
401
401
|
|
|
402
|
-
| Key | Default | Description
|
|
403
|
-
| ----------------- | ----------------------------------------- |
|
|
404
|
-
| `apiUrl` | `https://func-atk-prod.azurewebsites.net` | ATK API base URL. The `ATK_API_URL` environment variable overrides it (e.g. to point at dev).
|
|
405
|
-
| `cacheDir` | `~/.atk/cache/` | Override cache directory
|
|
406
|
-
| `cacheTtlMinutes` | `5` | Cache TTL in minutes for registry data
|
|
407
|
-
| `checkUpdates` | `true` | Show a banner when a newer ATK version is available
|
|
408
|
-
| `org` | _(not set)_ | Default organization scope for asset resolution
|
|
409
|
-
| `userRoot` | _(home directory)_ | Root of the user scope (`--user`). A relative or `~/` path is under the home directory. `ATK_USER_ROOT` overrides it.
|
|
402
|
+
| Key | Default | Description |
|
|
403
|
+
| ----------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
404
|
+
| `apiUrl` | `https://func-atk-prod.azurewebsites.net` | ATK API base URL. The `ATK_API_URL` environment variable overrides it (e.g. to point at dev). |
|
|
405
|
+
| `cacheDir` | `~/.atk/cache/` | Override cache directory |
|
|
406
|
+
| `cacheTtlMinutes` | `5` | Cache TTL in minutes for registry data |
|
|
407
|
+
| `checkUpdates` | `true` | Show a banner when a newer ATK version is available (in `--json` output, an `update-available` entry in `notices`). It reads the version from a cache that a background request to npm refreshes at most once a day, so a new release shows from the run after that refresh |
|
|
408
|
+
| `org` | _(not set)_ | Default organization scope for asset resolution |
|
|
409
|
+
| `userRoot` | _(home directory)_ | Root of the user scope (`--user`). A relative or `~/` path is under the home directory. `ATK_USER_ROOT` overrides it. |
|
|
410
410
|
|
|
411
411
|
### Environment Variables
|
|
412
412
|
|
package/build/commands/_app.d.ts
CHANGED
|
@@ -3,10 +3,26 @@ import React from 'react';
|
|
|
3
3
|
import type { AppProps } from '../lib/pastel/index.js';
|
|
4
4
|
import { type RawModeState } from '../lib/ink-stdout.js';
|
|
5
5
|
export default function App({ commandProps, Component }: AppProps): React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* What the shell settles before its first frame: the update banner, from the npm cache with no wait on npm. A banner
|
|
8
|
+
* that arrived later would change a frame that may already be taller than the terminal, and a print-once output would
|
|
9
|
+
* then be written twice, its top left in the scrollback (ATK-966). A command that declares `hidesUpdateBanner` (`atk
|
|
10
|
+
* upgrade`, which the banner would tell the user to run) never shows it. A run with no shell (`--json`, no TTY) reads
|
|
11
|
+
* nothing: `cli.tsx` notes the update for its payload.
|
|
12
|
+
*/
|
|
13
|
+
export declare function beforeRender(Component: object, options: Record<string, unknown>, streams?: {
|
|
14
|
+
stdin: {
|
|
15
|
+
isTTY?: boolean;
|
|
16
|
+
};
|
|
17
|
+
stdout: {
|
|
18
|
+
isTTY?: boolean;
|
|
19
|
+
};
|
|
20
|
+
}): Promise<void>;
|
|
6
21
|
/**
|
|
7
22
|
* Ink's render options for this run. A full-screen screen (`browse`, `list`), in a terminal and without `--json`, gives
|
|
8
23
|
* Ink the terminal's height: the screen sizes itself by it. Every other run gives it only while a prompt takes keys, so
|
|
9
|
-
* output nobody can type into never makes Ink clear the terminal, however long it is (ATK-965)
|
|
24
|
+
* output nobody can type into never makes Ink clear the terminal, however long it is (ATK-965), nor write it again on a
|
|
25
|
+
* resize once it fills the terminal (ATK-967).
|
|
10
26
|
*/
|
|
11
27
|
export declare function renderOptions(Component: AppProps['Component'], options: Record<string, unknown>, streams?: {
|
|
12
28
|
stdin: RawModeState & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/commands/_app.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/commands/_app.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,aAAa,EAAQ,MAAM,KAAK,CAAC;AAIrF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWvD,OAAO,EAAc,KAAK,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAoEnF,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,QAAQ,qBAoEhE;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,GAAE;IAAE,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAY,GAC7E,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,GAAE;IAAE,KAAK,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;CAAY,GAC3F,aAAa,CAGf"}
|
package/build/commands/_app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
2
|
+
import { Box, measureElement, Text } from 'ink';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -13,10 +13,10 @@ import { useMeasuredRows } from '../hooks/useMeasuredRows.js';
|
|
|
13
13
|
import { useRenderOnResize } from '../hooks/useRenderOnResize.js';
|
|
14
14
|
import { declaresFullScreen, ShellContext } from '../hooks/useShell.js';
|
|
15
15
|
import { errorGuidance } from '../lib/errors.js';
|
|
16
|
-
import { rowsWhileRaw } from '../lib/ink-stdout.js';
|
|
16
|
+
import { drawnFrame, rowsWhileRaw } from '../lib/ink-stdout.js';
|
|
17
17
|
import { getNotices, subscribeNotices } from '../lib/notices.js';
|
|
18
18
|
import { processCanPrompt, renderJson, useCanPrompt } from '../lib/output.js';
|
|
19
|
-
import {
|
|
19
|
+
import { getUpdateBanner, hideUpdateBanner, loadUpdateBanner, subscribeUpdateBanner } from '../lib/update-check.js';
|
|
20
20
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
21
|
const pkg = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf8'));
|
|
22
22
|
/** The empty row the shell draws above the header and below the command */
|
|
@@ -65,25 +65,8 @@ export default function App({ commandProps, Component }) {
|
|
|
65
65
|
// Once-per-run notices arrive while the command runs; subscribing
|
|
66
66
|
// re-renders the shell in place.
|
|
67
67
|
const notices = React.useSyncExternalStore(subscribeNotices, getNotices, getNotices);
|
|
68
|
-
//
|
|
69
|
-
const
|
|
70
|
-
const [updateInfo, setUpdateInfo] = React.useState(null);
|
|
71
|
-
React.useEffect(() => {
|
|
72
|
-
if (effectiveJson)
|
|
73
|
-
return;
|
|
74
|
-
let cancelled = false;
|
|
75
|
-
getUpdateInfo()
|
|
76
|
-
.then((info) => {
|
|
77
|
-
if (!cancelled)
|
|
78
|
-
setUpdateInfo(info);
|
|
79
|
-
})
|
|
80
|
-
.catch(() => {
|
|
81
|
-
// getUpdateInfo never throws, but guard defensively.
|
|
82
|
-
});
|
|
83
|
-
return () => {
|
|
84
|
-
cancelled = true;
|
|
85
|
-
};
|
|
86
|
-
}, [effectiveJson]);
|
|
68
|
+
// Loaded by `beforeRender`, so it is in the first frame; `atk doctor --fix` hides it once its upgrade made it stale.
|
|
69
|
+
const updateInfo = React.useSyncExternalStore(subscribeUpdateBanner, getUpdateBanner, getUpdateBanner);
|
|
87
70
|
// A full-screen screen (`browse`, `list`) asks for the one-line header and sizes itself by the rows the shell
|
|
88
71
|
// really draws, measured with the update banner and notices as they arrive (ATK-961).
|
|
89
72
|
const [fullScreen, setFullScreen] = React.useState(() => declaresFullScreen(Component, commandProps.options));
|
|
@@ -92,20 +75,54 @@ export default function App({ commandProps, Component }) {
|
|
|
92
75
|
// A resize renders the whole tree again: the shell measures its rewrapped rows and the screen refits (ATK-964)
|
|
93
76
|
useRenderOnResize(!effectiveJson);
|
|
94
77
|
const shell = React.useMemo(() => ({ rows: 2 * SHELL_MARGIN + aboveRows, setFullScreen }), [aboveRows]);
|
|
78
|
+
// The frame's rows, for the print-once stdout, which holds one as tall as the terminal through a resize (ATK-967).
|
|
79
|
+
// Measured when the stdout asks, from Ink's last layout, so a render of the command alone counts too. The cleanup
|
|
80
|
+
// runs after Ink's last render, on unmount.
|
|
81
|
+
const frameRef = React.useRef(null);
|
|
82
|
+
React.useLayoutEffect(() => {
|
|
83
|
+
drawnFrame.measure = () => (frameRef.current ? measureElement(frameRef.current).height + 2 * SHELL_MARGIN : 0);
|
|
84
|
+
return () => {
|
|
85
|
+
drawnFrame.measure = () => 0;
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
95
88
|
if (effectiveJson) {
|
|
96
89
|
return (_jsx(CommandErrorBoundary, { json: true, children: _jsx(Component, { ...commandProps }) }));
|
|
97
90
|
}
|
|
98
|
-
return (_jsx(ShellContext.Provider, { value: shell, children: _jsxs(Box, { flexDirection: 'column', marginBottom: SHELL_MARGIN, marginTop: SHELL_MARGIN, children: [_jsxs(MeasuredBox, { clip: fullScreen, measureRef: aboveRef, rows: aboveRows, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Header, { compact: fullScreen, version: pkg.version }) }), updateInfo &&
|
|
91
|
+
return (_jsx(ShellContext.Provider, { value: shell, children: _jsxs(Box, { flexDirection: 'column', marginBottom: SHELL_MARGIN, marginTop: SHELL_MARGIN, ref: frameRef, children: [_jsxs(MeasuredBox, { clip: fullScreen, measureRef: aboveRef, rows: aboveRows, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Header, { compact: fullScreen, version: pkg.version }) }), updateInfo && (_jsx(Box, { marginBottom: 1, children: _jsx(UpdateBanner, { info: updateInfo }) })), notices.length > 0 && (_jsx(Box, { marginBottom: 1, children: _jsx(NoticeBanner, { notices: notices }) }))] }), _jsx(CommandErrorBoundary, { json: false, children: _jsx(Component, { ...commandProps }) })] }) }));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What the shell settles before its first frame: the update banner, from the npm cache with no wait on npm. A banner
|
|
95
|
+
* that arrived later would change a frame that may already be taller than the terminal, and a print-once output would
|
|
96
|
+
* then be written twice, its top left in the scrollback (ATK-966). A command that declares `hidesUpdateBanner` (`atk
|
|
97
|
+
* upgrade`, which the banner would tell the user to run) never shows it. A run with no shell (`--json`, no TTY) reads
|
|
98
|
+
* nothing: `cli.tsx` notes the update for its payload.
|
|
99
|
+
*/
|
|
100
|
+
export async function beforeRender(Component, options, streams = process) {
|
|
101
|
+
if (!drawsShell(options, streams))
|
|
102
|
+
return;
|
|
103
|
+
if ('hidesUpdateBanner' in Component && Component.hidesUpdateBanner === true) {
|
|
104
|
+
hideUpdateBanner();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
await loadUpdateBanner();
|
|
99
108
|
}
|
|
100
109
|
/**
|
|
101
110
|
* Ink's render options for this run. A full-screen screen (`browse`, `list`), in a terminal and without `--json`, gives
|
|
102
111
|
* Ink the terminal's height: the screen sizes itself by it. Every other run gives it only while a prompt takes keys, so
|
|
103
|
-
* output nobody can type into never makes Ink clear the terminal, however long it is (ATK-965)
|
|
112
|
+
* output nobody can type into never makes Ink clear the terminal, however long it is (ATK-965), nor write it again on a
|
|
113
|
+
* resize once it fills the terminal (ATK-967).
|
|
104
114
|
*/
|
|
105
115
|
export function renderOptions(Component, options, streams = process) {
|
|
106
|
-
const fullScreenRun = declaresFullScreen(Component, options) &&
|
|
116
|
+
const fullScreenRun = declaresFullScreen(Component, options) && drawsShell(options, streams);
|
|
107
117
|
return { stdout: fullScreenRun ? streams.stdout : rowsWhileRaw(streams.stdout, streams.stdin) };
|
|
108
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether this run draws the shell, decided before Ink renders: a terminal (stdin and stdout TTYs), without `--json`.
|
|
121
|
+
* App decides the same from Ink's streams (`effectiveJson`).
|
|
122
|
+
*/
|
|
123
|
+
function drawsShell(options, streams) {
|
|
124
|
+
return !options['json'] && processCanPrompt(streams.stdin, streams.stdout);
|
|
125
|
+
}
|
|
109
126
|
/** `ATK_DEBUG` (any value but empty or `0`) adds the stack trace to a crash's output. */
|
|
110
127
|
function isDebug() {
|
|
111
128
|
const value = process.env['ATK_DEBUG'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_app.js","sourceRoot":"","sources":["../../src/commands/_app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"_app.js","sourceRoot":"","sources":["../../src/commands/_app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAmB,cAAc,EAAsB,IAAI,EAAE,MAAM,KAAK,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAqB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,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,IAAI,SAAS,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAC7E,gBAAgB,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IACD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAgC,EAChC,OAAgC,EAChC,UAAqF,OAAO;IAE5F,MAAM,aAAa,GAAG,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7F,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAClG,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CACjB,OAAgC,EAChC,OAAoE;IAEpE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,yFAAyF;AACzF,SAAS,OAAO;IACd,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,CAAC;AAC9D,CAAC"}
|
|
@@ -11,6 +11,9 @@ export declare const options: z.ZodObject<{
|
|
|
11
11
|
type Props = {
|
|
12
12
|
options: z.infer<typeof options>;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare function Upgrade({ options: { allowDowngrade, json, tag } }: Props): import("react").JSX.Element;
|
|
15
|
+
declare namespace Upgrade {
|
|
16
|
+
var hidesUpdateBanner: boolean;
|
|
17
|
+
}
|
|
18
|
+
export default Upgrade;
|
|
16
19
|
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,WAAW,yGACgF,CAAC;AAEzG,eAAO,MAAM,OAAO;;;;;;;iBAoBlB,CAAC;AAEH,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,iBAAwB,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,+BAoDhF;kBApDuB,OAAO;;;eAAP,OAAO"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
import { ErrorView, Spinner } from '../components/index.js';
|
|
6
5
|
import { useCommand } from '../hooks/useCommand.js';
|
|
@@ -8,7 +7,6 @@ import { removeNotice } from '../lib/notices.js';
|
|
|
8
7
|
import { renderJson, useNonInteractive } from '../lib/output.js';
|
|
9
8
|
import { option } from '../lib/pastel/index.js';
|
|
10
9
|
import { defaultUpgradeDeps, UPGRADE_TAGS, upgradeCli } from '../lib/self-upgrade.js';
|
|
11
|
-
import { hideUpdateBanner } from '../lib/update-check.js';
|
|
12
10
|
export const description = 'Upgrade the ATK CLI itself to the newest version on npm (to update installed assets, use atk update)';
|
|
13
11
|
export const options = z.object({
|
|
14
12
|
allowDowngrade: z
|
|
@@ -29,8 +27,6 @@ export const options = z.object({
|
|
|
29
27
|
});
|
|
30
28
|
export default function Upgrade({ options: { allowDowngrade, json, tag } }) {
|
|
31
29
|
const { json: effectiveJson } = useNonInteractive(json);
|
|
32
|
-
// The shell's update banner says to run this command; it runs before the shell's update check answers.
|
|
33
|
-
useEffect(hideUpdateBanner, []);
|
|
34
30
|
const state = useCommand(async (progress) => {
|
|
35
31
|
const result = await upgradeCli({ allowDowngrade, tag }, defaultUpgradeDeps(progress));
|
|
36
32
|
// The update check ran before the command, against the old version: its notice is stale now.
|
|
@@ -61,4 +57,6 @@ export default function Upgrade({ options: { allowDowngrade, json, tag } }) {
|
|
|
61
57
|
}
|
|
62
58
|
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { children: [_jsx(Text, { color: 'green', children: "\u2713" }), " ", data.outcome === 'upgraded' ? 'Upgraded' : 'Downgraded', " ATK ", data.from, " \u2192", ' ', _jsx(Text, { bold: true, children: data.to }), " (npm ", data.tag, ")"] }), _jsx(Text, { dimColor: true, children: "Run atk release-notes to see what's new." })] }));
|
|
63
59
|
}
|
|
60
|
+
// The shell's update banner would tell the user to run this command: it never shows it (ATK-877, ATK-966)
|
|
61
|
+
Upgrade.hidesUpdateBanner = true;
|
|
64
62
|
//# sourceMappingURL=upgrade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBA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E,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAS,WAAM,IAAI,CAAC,IAAI,4BAAwB,IAAI,CAAC,GAAG,6BACtE,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACzB,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAS,OAAE,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,WAAO,IAAI,CAAC,IAAI,aAAI,GAAG,EAC5G,KAAC,IAAI,IAAC,IAAI,kBAAE,IAAI,CAAC,EAAE,GAAQ,YAAO,IAAI,CAAC,GAAG,SACrC,EACP,KAAC,IAAI,IAAC,QAAQ,+DAAqD,IAC/D,CACP,CAAC;AACJ,CAAC;AAED,0GAA0G;AAC1G,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/** Measures the frame Ink laid out last, in rows; 0 while nothing is drawn. */
|
|
2
|
+
export interface DrawnFrame {
|
|
3
|
+
measure: () => number;
|
|
4
|
+
}
|
|
1
5
|
/** The part of stdin that says whether a prompt is taking keys. */
|
|
2
6
|
export interface RawModeState {
|
|
3
7
|
readonly isRaw?: boolean;
|
|
4
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The App shell's frame, which `renderOptions` hands to the view. The shell points `measure` at its outer box while it
|
|
11
|
+
* is mounted. It measures when asked, from Ink's last layout, so it is current whichever component rendered last.
|
|
12
|
+
*/
|
|
13
|
+
export declare const drawnFrame: DrawnFrame;
|
|
5
14
|
/**
|
|
6
15
|
* `stdout` as Ink should see it outside a full-screen screen: the same stream, whose height (`rows`) shows only while
|
|
7
16
|
* stdin is in raw mode, that is, while a prompt or picker takes keys (Ink turns raw mode on for an active `useInput`
|
|
@@ -10,8 +19,14 @@ export interface RawModeState {
|
|
|
10
19
|
* Ink 6 writes `ESC[2J`, clearing the whole terminal, on any render after a frame at least `rows` tall. While a prompt
|
|
11
20
|
* is up that is its redraw of a frame taller than the window, and it stays. Once nothing takes keys the frame is output,
|
|
12
21
|
* and the next render (Ink's unmount always renders once more) would only wipe the terminal: a long `atk list --tree`
|
|
13
|
-
* or `atk info` cleared it on exit (ATK-965).
|
|
22
|
+
* or `atk info` cleared it on exit (ATK-965).
|
|
23
|
+
*
|
|
24
|
+
* Such a frame is also held while nothing takes keys (ATK-967): when `frame` is at least as tall as the terminal, a
|
|
25
|
+
* `resize` doesn't reach the listeners added through the view, and `columns` stays the width the frame was laid out
|
|
26
|
+
* at. Ink lays the frame out again on a resize, on every render and on unmount, and writes it again when it changed;
|
|
27
|
+
* erasing the old one reaches only the rows still in the window, so its top would print a second time. A shorter frame
|
|
28
|
+
* (a spinner, progress) and a prompt taking keys still refit on a resize. Everything else (`write`, `isTTY`, the
|
|
14
29
|
* writable state) is the real stream's, called on it.
|
|
15
30
|
*/
|
|
16
|
-
export declare function rowsWhileRaw<S extends NodeJS.WriteStream>(stdout: S, stdin: RawModeState): S;
|
|
31
|
+
export declare function rowsWhileRaw<S extends NodeJS.WriteStream>(stdout: S, stdin: RawModeState, frame?: Readonly<DrawnFrame>): S;
|
|
17
32
|
//# sourceMappingURL=ink-stdout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink-stdout.d.ts","sourceRoot":"","sources":["../../src/lib/ink-stdout.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"ink-stdout.d.ts","sourceRoot":"","sources":["../../src/lib/ink-stdout.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,MAAM,CAAC;CACvB;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,UAAiC,CAAC;AAe3D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EACvD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,YAAY,EACnB,KAAK,GAAE,QAAQ,CAAC,UAAU,CAAc,GACvC,CAAC,CA2CH"}
|
package/build/lib/ink-stdout.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The App shell's frame, which `renderOptions` hands to the view. The shell points `measure` at its outer box while it
|
|
3
|
+
* is mounted. It measures when asked, from Ink's last layout, so it is current whichever component rendered last.
|
|
4
|
+
*/
|
|
5
|
+
export const drawnFrame = { measure: () => 0 };
|
|
6
|
+
/** The `EventEmitter` methods that take a listener, all of whose `resize` listeners the view gates. */
|
|
7
|
+
const LISTENER_METHODS = new Set([
|
|
8
|
+
'addListener',
|
|
9
|
+
'off',
|
|
10
|
+
'on',
|
|
11
|
+
'once',
|
|
12
|
+
'prependListener',
|
|
13
|
+
'prependOnceListener',
|
|
14
|
+
'removeListener',
|
|
15
|
+
]);
|
|
1
16
|
/**
|
|
2
17
|
* `stdout` as Ink should see it outside a full-screen screen: the same stream, whose height (`rows`) shows only while
|
|
3
18
|
* stdin is in raw mode, that is, while a prompt or picker takes keys (Ink turns raw mode on for an active `useInput`
|
|
@@ -6,10 +21,31 @@
|
|
|
6
21
|
* Ink 6 writes `ESC[2J`, clearing the whole terminal, on any render after a frame at least `rows` tall. While a prompt
|
|
7
22
|
* is up that is its redraw of a frame taller than the window, and it stays. Once nothing takes keys the frame is output,
|
|
8
23
|
* and the next render (Ink's unmount always renders once more) would only wipe the terminal: a long `atk list --tree`
|
|
9
|
-
* or `atk info` cleared it on exit (ATK-965).
|
|
24
|
+
* or `atk info` cleared it on exit (ATK-965).
|
|
25
|
+
*
|
|
26
|
+
* Such a frame is also held while nothing takes keys (ATK-967): when `frame` is at least as tall as the terminal, a
|
|
27
|
+
* `resize` doesn't reach the listeners added through the view, and `columns` stays the width the frame was laid out
|
|
28
|
+
* at. Ink lays the frame out again on a resize, on every render and on unmount, and writes it again when it changed;
|
|
29
|
+
* erasing the old one reaches only the rows still in the window, so its top would print a second time. A shorter frame
|
|
30
|
+
* (a spinner, progress) and a prompt taking keys still refit on a resize. Everything else (`write`, `isTTY`, the
|
|
10
31
|
* writable state) is the real stream's, called on it.
|
|
11
32
|
*/
|
|
12
|
-
export function rowsWhileRaw(stdout, stdin) {
|
|
33
|
+
export function rowsWhileRaw(stdout, stdin, frame = drawnFrame) {
|
|
34
|
+
const held = () => !stdin.isRaw && stdout.rows !== undefined && frame.measure() >= stdout.rows;
|
|
35
|
+
let laidOutColumns = stdout.columns;
|
|
36
|
+
// One gate per listener, so `off` removes what `on` added
|
|
37
|
+
const gates = new WeakMap();
|
|
38
|
+
const gate = (listener) => {
|
|
39
|
+
let gated = gates.get(listener);
|
|
40
|
+
if (!gated) {
|
|
41
|
+
gated = function (...args) {
|
|
42
|
+
if (!held())
|
|
43
|
+
listener.apply(this, args);
|
|
44
|
+
};
|
|
45
|
+
gates.set(listener, gated);
|
|
46
|
+
}
|
|
47
|
+
return gated;
|
|
48
|
+
};
|
|
13
49
|
// Each method is wrapped once, so reading it twice gives the same function (`off` finds what `on` added). It runs on
|
|
14
50
|
// the real stream, and a call that returns the stream for chaining (`on`, `cork` …) gets the view back.
|
|
15
51
|
const wrapped = new WeakMap();
|
|
@@ -17,11 +53,20 @@ export function rowsWhileRaw(stdout, stdin) {
|
|
|
17
53
|
get(target, property) {
|
|
18
54
|
if (property === 'rows')
|
|
19
55
|
return stdin.isRaw ? target.rows : undefined;
|
|
56
|
+
if (property === 'columns') {
|
|
57
|
+
if (!held())
|
|
58
|
+
laidOutColumns = target.columns;
|
|
59
|
+
return laidOutColumns;
|
|
60
|
+
}
|
|
20
61
|
const value = Reflect.get(target, property, target);
|
|
21
62
|
if (typeof value !== 'function' || property === 'constructor')
|
|
22
63
|
return value;
|
|
23
64
|
if (!wrapped.has(value)) {
|
|
65
|
+
const takesListener = LISTENER_METHODS.has(property);
|
|
24
66
|
wrapped.set(value, (...args) => {
|
|
67
|
+
if (takesListener && args[0] === 'resize' && typeof args[1] === 'function') {
|
|
68
|
+
args[1] = gate(args[1]);
|
|
69
|
+
}
|
|
25
70
|
const result = Reflect.apply(value, target, args);
|
|
26
71
|
return result === target ? view : result;
|
|
27
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink-stdout.js","sourceRoot":"","sources":["../../src/lib/ink-stdout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ink-stdout.js","sourceRoot":"","sources":["../../src/lib/ink-stdout.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAe,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;AAE3D,uGAAuG;AACvG,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAc;IAC5C,aAAa;IACb,KAAK;IACL,IAAI;IACJ,MAAM;IACN,iBAAiB;IACjB,qBAAqB;IACrB,gBAAgB;CACjB,CAAC,CAAC;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAS,EACT,KAAmB,EACnB,QAA8B,UAAU;IAExC,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,MAAM,CA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CAAC,EAAE,CAAC;gBACxB,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACrD,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAe,EAAW,EAAE;oBACjD,IAAI,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;wBAC3E,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAa,CAAC,CAAC;oBACtC,CAAC;oBACD,MAAM,MAAM,GAAY,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;oBAC3D,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC3C,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type RenderOptions } from 'ink';
|
|
2
2
|
import { type ComponentType } from 'react';
|
|
3
3
|
import { type AppProps } from './types.js';
|
|
4
|
+
/** Work the app finishes before the first frame of one run of `Component` with its parsed `options`. */
|
|
5
|
+
export type AppBeforeRender = (Component: AppProps['Component'], options: Record<string, unknown>) => Promise<void>;
|
|
4
6
|
/** Ink's render options for one run of `Component` with its parsed `options`. */
|
|
5
7
|
export type AppRenderOptions = (Component: AppProps['Component'], options: Record<string, unknown>) => RenderOptions;
|
|
6
8
|
export type CustomApp = {
|
|
7
9
|
App: ComponentType<AppProps>;
|
|
10
|
+
beforeRender: AppBeforeRender | undefined;
|
|
8
11
|
renderOptions: AppRenderOptions | undefined;
|
|
9
12
|
};
|
|
10
13
|
export default function readCustomApp(directory: string): Promise<CustomApp | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-custom-app.d.ts","sourceRoot":"","sources":["../../../src/lib/pastel/read-custom-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,KAAK,CAAC;AAIzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC;AAErH,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC7B,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C,CAAC;
|
|
1
|
+
{"version":3,"file":"read-custom-app.d.ts","sourceRoot":"","sources":["../../../src/lib/pastel/read-custom-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,KAAK,CAAC;AAIzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,wGAAwG;AACxG,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpH,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC;AAErH,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC7B,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C,CAAC;AAQF,wBAA8B,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAkB7F"}
|
|
@@ -22,7 +22,7 @@ export default async function readCustomApp(directory) {
|
|
|
22
22
|
const filePath = path.join(directory, file);
|
|
23
23
|
const fileUrl = pathToFileURL(filePath);
|
|
24
24
|
const m = (await import(__rewriteRelativeImportExtension(fileUrl.href)));
|
|
25
|
-
customApp = { App: m.default, renderOptions: m.renderOptions };
|
|
25
|
+
customApp = { App: m.default, beforeRender: m.beforeRender, renderOptions: m.renderOptions };
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
return customApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-custom-app.js","sourceRoot":"","sources":["../../../src/lib/pastel/read-custom-app.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAsB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAiB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"read-custom-app.js","sourceRoot":"","sources":["../../../src/lib/pastel/read-custom-app.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAsB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAsB,MAAM,OAAO,CAA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AE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"render-command.d.ts","sourceRoot":"","sources":["../../../src/lib/pastel/render-command.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAK7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D;;;;GAIG;AACH,wBAA8B,aAAa,CACzC,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,cAAc,EACtB,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,iBA+C3G"}
|
|
@@ -37,6 +37,7 @@ export default async function renderCommand(commanderCommand, module, { commands
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const customApp = await readCustomApp(commandsDirectory);
|
|
40
|
+
await customApp?.beforeRender?.(Component, parsedOptions);
|
|
40
41
|
render(React.createElement(customApp?.App ?? App, {
|
|
41
42
|
commandProps: {
|
|
42
43
|
args: arguments_,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-command.js","sourceRoot":"","sources":["../../../src/lib/pastel/render-command.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,aAAa,CACzC,gBAAkC,EAClC,MAAsB,EACtB,EAAE,iBAAiB,EAAE,KAAK,EA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AAM,CAAC,OAAO,EAAE,CAAC;YACnB,UAAU,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACzD,MAAM,SAAS,EAAE,YAAY,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAE1D,MAAM,CACJ,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,GAAG,EAAE;QACzC,YAAY,EAAE;YACZ,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,aAAa;SACvB;QACD,SAAS;KACV,CAAC,EACF,SAAS,EAAE,aAAa,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CACrD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,gBAAkC,EAAE,KAAyC;IAChG,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,EAAE,EAAE,kBAAkB,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;IACpG,gBAAgB,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const NPM_DIST_TAGS_URL = "https://registry.npmjs.org/-/package/@detergent-software%2fatk/dist-tags";
|
|
3
3
|
/** How long the cached dist-tags stand before the check asks npm again; not the registry's `cacheTtlMinutes`. */
|
|
4
4
|
export declare const UPDATE_CHECK_INTERVAL_MS: number;
|
|
5
|
-
/** The
|
|
5
|
+
/** The background refresh of a missing or stale cache makes one attempt and gives up after this long, so it barely delays exit. */
|
|
6
6
|
export declare const BACKGROUND_REFRESH_TIMEOUT_MS = 1500;
|
|
7
7
|
/** `atk doctor`'s npm read, made on every run, is one attempt that gives up after this long, as its `/health` probe does. */
|
|
8
8
|
export declare const VERSION_STATUS_TIMEOUT_MS = 5000;
|
|
@@ -36,14 +36,18 @@ export interface VersionStatus {
|
|
|
36
36
|
}
|
|
37
37
|
type BannerListener = () => void;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
39
|
+
* The newer version of @detergent-software/atk the cached npm dist-tags name, or null. It reads the cache of any age
|
|
40
|
+
* and never asks npm before it answers, so a run decides its update banner or notice at once. A missing cache, or one
|
|
41
|
+
* older than {@link UPDATE_CHECK_INTERVAL_MS}, starts one background fetch (no retries,
|
|
42
|
+
* {@link BACKGROUND_REFRESH_TIMEOUT_MS}) that only rewrites the cache, for the next run. Null, reading nothing, when
|
|
43
|
+
* {@link updateCheckSwitch} names a switch. Never throws.
|
|
44
|
+
*/
|
|
45
|
+
export declare function cachedUpdateInfo(): Promise<null | UpdateInfo>;
|
|
46
|
+
/**
|
|
47
|
+
* The TTY update banner for this run: what {@link loadUpdateBanner} found, or null once {@link hideUpdateBanner} ran.
|
|
48
|
+
* A stable snapshot for `useSyncExternalStore`.
|
|
45
49
|
*/
|
|
46
|
-
export declare function
|
|
50
|
+
export declare function getUpdateBanner(): null | UpdateInfo;
|
|
47
51
|
/**
|
|
48
52
|
* This CLI's version and its channel's version on npm, whether or not that is newer. npm is asked
|
|
49
53
|
* every time, never the cache first, since a cache under a day old can miss a version tagged a moment
|
|
@@ -55,21 +59,23 @@ export declare function getUpdateInfo(): Promise<null | UpdateInfo>;
|
|
|
55
59
|
*/
|
|
56
60
|
export declare function getVersionStatus(): Promise<VersionStatus>;
|
|
57
61
|
/**
|
|
58
|
-
* Hide the TTY update banner for the rest of the run.
|
|
59
|
-
*
|
|
62
|
+
* Hide the TTY update banner for the rest of the run. The banner names a version newer than the one this process
|
|
63
|
+
* loaded, so `atk upgrade` (before its first frame) and `atk doctor --fix` (after its upgrade) hide it: it would
|
|
60
64
|
* tell the user to run the command that just ran (ATK-877).
|
|
61
65
|
*/
|
|
62
66
|
export declare function hideUpdateBanner(): void;
|
|
63
67
|
/** Whether {@link hideUpdateBanner} ran in this process (a stable snapshot for `useSyncExternalStore`). */
|
|
64
68
|
export declare function isUpdateBannerHidden(): boolean;
|
|
65
69
|
/**
|
|
66
|
-
* The update
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*
|
|
70
|
+
* The TTY update banner for this run, from {@link cachedUpdateInfo}. The App shell awaits it before its first frame,
|
|
71
|
+
* so the banner is in that frame and never arrives later: a print-once output already taller than the terminal would
|
|
72
|
+
* be written again, its top a second time (ATK-966). Never throws.
|
|
73
|
+
*/
|
|
74
|
+
export declare function loadUpdateBanner(read?: () => Promise<null | UpdateInfo>): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* The update check for JSON mode, which shows no banner. `cli.tsx` runs it before the command so the payload can
|
|
77
|
+
* carry the result: when {@link cachedUpdateInfo} names a newer version it records an `update-available` notice.
|
|
78
|
+
* Never throws.
|
|
73
79
|
*/
|
|
74
80
|
export declare function noteCachedUpdate(): Promise<void>;
|
|
75
81
|
/**
|
|
@@ -79,9 +85,9 @@ export declare function noteCachedUpdate(): Promise<void>;
|
|
|
79
85
|
* npm couldn't be read, or offline. For `atk upgrade`; doesn't throw.
|
|
80
86
|
*/
|
|
81
87
|
export declare function readDistTagsFresh(): Promise<DistTags | null>;
|
|
82
|
-
/**
|
|
88
|
+
/** Forget the run's banner and show it again once loaded. Intended for tests. */
|
|
83
89
|
export declare function resetUpdateBanner(): void;
|
|
84
|
-
/** Subscribe to {@link hideUpdateBanner}; returns the unsubscribe function. */
|
|
90
|
+
/** Subscribe to {@link loadUpdateBanner} and {@link hideUpdateBanner}; returns the unsubscribe function. */
|
|
85
91
|
export declare function subscribeUpdateBanner(listener: BannerListener): () => void;
|
|
86
92
|
/**
|
|
87
93
|
* The switch that turns the update check off, or null when it runs. An
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAWA,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,6EAA6E,CAAC;AAG5G,iHAAiH;AACjH,eAAO,MAAM,wBAAwB,QAAsB,CAAC;AAE5D,
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAWA,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,6EAA6E,CAAC;AAG5G,iHAAiH;AACjH,eAAO,MAAM,wBAAwB,QAAsB,CAAC;AAE5D,mIAAmI;AACnI,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD,6HAA6H;AAC7H,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG,cAAc,GAAG,IAAI,CAAC;AAE9E,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,sIAAsI;IACtI,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAA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|
/** How long the cached dist-tags stand before the check asks npm again; not the registry's `cacheTtlMinutes`. */
|
|
14
14
|
export const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
15
|
-
/** The
|
|
15
|
+
/** The background refresh of a missing or stale cache makes one attempt and gives up after this long, so it barely delays exit. */
|
|
16
16
|
export const BACKGROUND_REFRESH_TIMEOUT_MS = 1_500;
|
|
17
17
|
/** `atk doctor`'s npm read, made on every run, is one attempt that gives up after this long, as its `/health` probe does. */
|
|
18
18
|
export const VERSION_STATUS_TIMEOUT_MS = 5_000;
|
|
19
|
+
let bannerInfo = null;
|
|
19
20
|
let bannerHidden = false;
|
|
20
21
|
const bannerListeners = new Set();
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* network call.
|
|
23
|
+
* The newer version of @detergent-software/atk the cached npm dist-tags name, or null. It reads the cache of any age
|
|
24
|
+
* and never asks npm before it answers, so a run decides its update banner or notice at once. A missing cache, or one
|
|
25
|
+
* older than {@link UPDATE_CHECK_INTERVAL_MS}, starts one background fetch (no retries,
|
|
26
|
+
* {@link BACKGROUND_REFRESH_TIMEOUT_MS}) that only rewrites the cache, for the next run. Null, reading nothing, when
|
|
27
|
+
* {@link updateCheckSwitch} names a switch. Never throws.
|
|
28
28
|
*/
|
|
29
|
-
export async function
|
|
29
|
+
export async function cachedUpdateInfo() {
|
|
30
30
|
try {
|
|
31
31
|
const config = await loadConfig();
|
|
32
32
|
if (updateCheckSwitch(config)) {
|
|
@@ -36,32 +36,33 @@ export async function getUpdateInfo() {
|
|
|
36
36
|
const cacheDir = getCacheDir(config);
|
|
37
37
|
const cachePath = join(cacheDir, NPM_CACHE_FILE);
|
|
38
38
|
const cached = await readNpmCache(cachePath);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
await writeNpmCache(cachePath, cacheDir, tags);
|
|
39
|
+
if (!cached || cached.ageMs > UPDATE_CHECK_INTERVAL_MS) {
|
|
40
|
+
void fetchDistTags(BACKGROUND_REFRESH_TIMEOUT_MS).then(async (tags) => {
|
|
41
|
+
if (tags) {
|
|
42
|
+
await writeNpmCache(cachePath, cacheDir, tags);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
46
45
|
}
|
|
47
|
-
const latestVersion = tags[channel];
|
|
46
|
+
const latestVersion = cached?.tags[channel];
|
|
48
47
|
if (!latestVersion || !semverValid(CLI_VERSION) || !semverValid(latestVersion)) {
|
|
49
48
|
return null;
|
|
50
49
|
}
|
|
51
50
|
if (!semverGt(latestVersion, CLI_VERSION)) {
|
|
52
51
|
return null;
|
|
53
52
|
}
|
|
54
|
-
return {
|
|
55
|
-
channel,
|
|
56
|
-
currentVersion: CLI_VERSION,
|
|
57
|
-
latestVersion,
|
|
58
|
-
upgradeCommand: UPGRADE_COMMAND,
|
|
59
|
-
};
|
|
53
|
+
return { channel, currentVersion: CLI_VERSION, latestVersion, upgradeCommand: UPGRADE_COMMAND };
|
|
60
54
|
}
|
|
61
55
|
catch {
|
|
62
56
|
return null;
|
|
63
57
|
}
|
|
64
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* The TTY update banner for this run: what {@link loadUpdateBanner} found, or null once {@link hideUpdateBanner} ran.
|
|
61
|
+
* A stable snapshot for `useSyncExternalStore`.
|
|
62
|
+
*/
|
|
63
|
+
export function getUpdateBanner() {
|
|
64
|
+
return bannerHidden ? null : bannerInfo;
|
|
65
|
+
}
|
|
65
66
|
/**
|
|
66
67
|
* This CLI's version and its channel's version on npm, whether or not that is newer. npm is asked
|
|
67
68
|
* every time, never the cache first, since a cache under a day old can miss a version tagged a moment
|
|
@@ -100,8 +101,8 @@ export async function getVersionStatus() {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
|
-
* Hide the TTY update banner for the rest of the run.
|
|
104
|
-
*
|
|
104
|
+
* Hide the TTY update banner for the rest of the run. The banner names a version newer than the one this process
|
|
105
|
+
* loaded, so `atk upgrade` (before its first frame) and `atk doctor --fix` (after its upgrade) hide it: it would
|
|
105
106
|
* tell the user to run the command that just ran (ATK-877).
|
|
106
107
|
*/
|
|
107
108
|
export function hideUpdateBanner() {
|
|
@@ -118,42 +119,29 @@ export function isUpdateBannerHidden() {
|
|
|
118
119
|
return bannerHidden;
|
|
119
120
|
}
|
|
120
121
|
/**
|
|
121
|
-
* The update
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* notice, with no network call on the way. A missing or stale cache starts one
|
|
125
|
-
* background fetch (no retries, {@link BACKGROUND_REFRESH_TIMEOUT_MS}) that
|
|
126
|
-
* only rewrites the cache, for the next run. Does nothing when
|
|
127
|
-
* {@link updateCheckSwitch} names a switch. Never throws.
|
|
122
|
+
* The TTY update banner for this run, from {@link cachedUpdateInfo}. The App shell awaits it before its first frame,
|
|
123
|
+
* so the banner is in that frame and never arrives later: a print-once output already taller than the terminal would
|
|
124
|
+
* be written again, its top a second time (ATK-966). Never throws.
|
|
128
125
|
*/
|
|
129
|
-
export async function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const channel = isPreRelease() ? 'dev' : 'latest';
|
|
136
|
-
const cacheDir = getCacheDir(config);
|
|
137
|
-
const cachePath = join(cacheDir, NPM_CACHE_FILE);
|
|
138
|
-
const cached = await readNpmCache(cachePath);
|
|
139
|
-
const version = cached?.tags[channel];
|
|
140
|
-
if (version && semverValid(CLI_VERSION) && semverValid(version) && semverGt(version, CLI_VERSION)) {
|
|
141
|
-
addNotice({
|
|
142
|
-
command: UPGRADE_COMMAND,
|
|
143
|
-
kind: 'update-available',
|
|
144
|
-
text: `ATK ${version} is available (this is ${CLI_VERSION}). Run \`${UPGRADE_COMMAND}\` to update.`,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (!cached || cached.ageMs > UPDATE_CHECK_INTERVAL_MS) {
|
|
148
|
-
void fetchDistTags(BACKGROUND_REFRESH_TIMEOUT_MS).then(async (tags) => {
|
|
149
|
-
if (tags) {
|
|
150
|
-
await writeNpmCache(cachePath, cacheDir, tags);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
126
|
+
export async function loadUpdateBanner(read = cachedUpdateInfo) {
|
|
127
|
+
bannerInfo = await read().catch(() => null);
|
|
128
|
+
for (const listener of bannerListeners) {
|
|
129
|
+
listener();
|
|
154
130
|
}
|
|
155
|
-
|
|
156
|
-
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The update check for JSON mode, which shows no banner. `cli.tsx` runs it before the command so the payload can
|
|
134
|
+
* carry the result: when {@link cachedUpdateInfo} names a newer version it records an `update-available` notice.
|
|
135
|
+
* Never throws.
|
|
136
|
+
*/
|
|
137
|
+
export async function noteCachedUpdate() {
|
|
138
|
+
const info = await cachedUpdateInfo();
|
|
139
|
+
if (info) {
|
|
140
|
+
addNotice({
|
|
141
|
+
command: info.upgradeCommand,
|
|
142
|
+
kind: 'update-available',
|
|
143
|
+
text: `ATK ${info.latestVersion} is available (this is ${info.currentVersion}). Run \`${info.upgradeCommand}\` to update.`,
|
|
144
|
+
});
|
|
157
145
|
}
|
|
158
146
|
}
|
|
159
147
|
/**
|
|
@@ -175,17 +163,18 @@ export async function readDistTagsFresh() {
|
|
|
175
163
|
}
|
|
176
164
|
return tags;
|
|
177
165
|
}
|
|
178
|
-
/**
|
|
166
|
+
/** Forget the run's banner and show it again once loaded. Intended for tests. */
|
|
179
167
|
export function resetUpdateBanner() {
|
|
180
|
-
if (!bannerHidden) {
|
|
168
|
+
if (!bannerHidden && !bannerInfo) {
|
|
181
169
|
return;
|
|
182
170
|
}
|
|
183
171
|
bannerHidden = false;
|
|
172
|
+
bannerInfo = null;
|
|
184
173
|
for (const listener of bannerListeners) {
|
|
185
174
|
listener();
|
|
186
175
|
}
|
|
187
176
|
}
|
|
188
|
-
/** Subscribe to {@link hideUpdateBanner}; returns the unsubscribe function. */
|
|
177
|
+
/** Subscribe to {@link loadUpdateBanner} and {@link hideUpdateBanner}; returns the unsubscribe function. */
|
|
189
178
|
export function subscribeUpdateBanner(listener) {
|
|
190
179
|
bannerListeners.add(listener);
|
|
191
180
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE3G,qFAAqF;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,0EAA0E,CAAC;AAC5G,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,iHAAiH;AACjH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE5D,
|
|
1
|
+
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,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|
|
3
|
+
"version": "9.6.1-dev.16",
|
|
4
4
|
"description": "Agentic Tool Kit — CLI for managing AI coding tool assets.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"tsx": "^4.23.15",
|
|
63
63
|
"typescript": "~6.0.3",
|
|
64
64
|
"vitest": "^5.0.5",
|
|
65
|
-
"@atk/
|
|
66
|
-
"@atk/
|
|
65
|
+
"@atk/eslint-config": "0.0.0",
|
|
66
|
+
"@atk/tsconfig": "0.0.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "pnpm manifest && tsc",
|