@openagt/dashboard 0.22.0 → 0.24.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.
@@ -1,44 +0,0 @@
1
- /**
2
- * CLI "up-to-date?" check (#312): after the bare-`openagent` version footer,
3
- * tell the user whether a newer version is published on npm. Display only;
4
- * auto-update is a separate, deferred concern. Same seam + node-adapter +
5
- * forgiving-on-error convention as `project.ts` (#380).
6
- */
7
- /** The npm package this CLI ships as; the registry key for the version check. */
8
- export declare const PACKAGE_NAME = "@openagt/dashboard";
9
- /** Fetches the latest published version of `pkg`, or undefined on any failure. Injectable for tests. */
10
- export type VersionFetcher = (pkg: string) => Promise<string | undefined>;
11
- /**
12
- * A {@link VersionFetcher} backed by the npm registry. GETs the packument and
13
- * reads `dist-tags.latest`. A 2.5s AbortSignal.timeout caps it; any error /
14
- * non-ok / offline yields undefined (the check silently degrades to "unknown").
15
- */
16
- export declare function nodeVersionFetcher(): VersionFetcher;
17
- /** The result of an update check. */
18
- export type UpdateStatus = {
19
- kind: 'up-to-date';
20
- current: string;
21
- } | {
22
- kind: 'update-available';
23
- current: string;
24
- latest: string;
25
- } | {
26
- kind: 'unknown';
27
- current: string;
28
- };
29
- /**
30
- * Compare two `major.minor.patch` versions numerically (a prerelease/build
31
- * suffix after `-` or `+` is stripped, missing parts read as 0). Returns
32
- * -1 / 0 / 1. No semver dependency.
33
- */
34
- export declare function compareVersions(a: string, b: string): number;
35
- /**
36
- * Check whether `current` is behind the latest published version. Uses the
37
- * injected fetcher; a missing/failed fetch is 'unknown'. `current` >= latest is
38
- * 'up-to-date' (so running a local build ahead of the registry never reads as
39
- * "update available").
40
- */
41
- export declare function checkForUpdate(current: string, fetchLatest: VersionFetcher, pkg?: string): Promise<UpdateStatus>;
42
- /** The one-line message to print for a status, or undefined for 'unknown' (print nothing). */
43
- export declare function formatUpdateStatus(status: UpdateStatus): string | undefined;
44
- //# sourceMappingURL=update-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iFAAiF;AACjF,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAEhD,wGAAwG;AACxG,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAYnD;AAED,qCAAqC;AACrC,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAExC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAW5D;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,cAAc,EAC3B,GAAG,GAAE,MAAqB,GACzB,OAAO,CAAC,YAAY,CAAC,CAMvB;AAED,8FAA8F;AAC9F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAS3E"}
@@ -1,71 +0,0 @@
1
- /**
2
- * CLI "up-to-date?" check (#312): after the bare-`openagent` version footer,
3
- * tell the user whether a newer version is published on npm. Display only;
4
- * auto-update is a separate, deferred concern. Same seam + node-adapter +
5
- * forgiving-on-error convention as `project.ts` (#380).
6
- */
7
- /** The npm package this CLI ships as; the registry key for the version check. */
8
- export const PACKAGE_NAME = '@openagt/dashboard';
9
- /**
10
- * A {@link VersionFetcher} backed by the npm registry. GETs the packument and
11
- * reads `dist-tags.latest`. A 2.5s AbortSignal.timeout caps it; any error /
12
- * non-ok / offline yields undefined (the check silently degrades to "unknown").
13
- */
14
- export function nodeVersionFetcher() {
15
- return async (pkg) => {
16
- try {
17
- const res = await fetch(`https://registry.npmjs.org/${pkg}`, { signal: AbortSignal.timeout(2500) });
18
- if (!res.ok)
19
- return undefined;
20
- const data = (await res.json());
21
- const latest = data?.['dist-tags']?.latest;
22
- return typeof latest === 'string' ? latest : undefined;
23
- }
24
- catch {
25
- return undefined;
26
- }
27
- };
28
- }
29
- /**
30
- * Compare two `major.minor.patch` versions numerically (a prerelease/build
31
- * suffix after `-` or `+` is stripped, missing parts read as 0). Returns
32
- * -1 / 0 / 1. No semver dependency.
33
- */
34
- export function compareVersions(a, b) {
35
- const parse = (v) => (v.split(/[-+]/)[0] ?? '').split('.').map(n => parseInt(n, 10) || 0);
36
- const pa = parse(a);
37
- const pb = parse(b);
38
- for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
39
- const na = pa[i] ?? 0;
40
- const nb = pb[i] ?? 0;
41
- if (na !== nb)
42
- return na < nb ? -1 : 1;
43
- }
44
- return 0;
45
- }
46
- /**
47
- * Check whether `current` is behind the latest published version. Uses the
48
- * injected fetcher; a missing/failed fetch is 'unknown'. `current` >= latest is
49
- * 'up-to-date' (so running a local build ahead of the registry never reads as
50
- * "update available").
51
- */
52
- export async function checkForUpdate(current, fetchLatest, pkg = PACKAGE_NAME) {
53
- const latest = await fetchLatest(pkg);
54
- if (!latest)
55
- return { kind: 'unknown', current };
56
- return compareVersions(latest, current) > 0
57
- ? { kind: 'update-available', current, latest }
58
- : { kind: 'up-to-date', current };
59
- }
60
- /** The one-line message to print for a status, or undefined for 'unknown' (print nothing). */
61
- export function formatUpdateStatus(status) {
62
- switch (status.kind) {
63
- case 'up-to-date':
64
- return `✅ Up to date (v${status.current})`;
65
- case 'update-available':
66
- return `⬆️ Update available: v${status.latest} (you have v${status.current}). Run: npm i -g ${PACKAGE_NAME}`;
67
- case 'unknown':
68
- return undefined;
69
- }
70
- }
71
- //# sourceMappingURL=update-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-check.js","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAKhD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,EAAC,GAAG,EAAC,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,8BAA8B,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACnG,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,SAAS,CAAA;YAC7B,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAuD,CAAA;YACrF,MAAM,MAAM,GAAG,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;YAC1C,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC,CAAA;AACH,CAAC;AAQD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,MAAM,KAAK,GAAG,CAAC,CAAS,EAAY,EAAE,CACpC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACtE,MAAM,EAAE,GAAG,K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