@detergent-software/atk 9.4.0-dev.8 → 9.4.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.
- package/CHANGELOG.md +398 -0
- package/README.md +7 -2
- package/build/command-manifest.json +33 -7
- package/build/commands/_app.d.ts.map +1 -1
- package/build/commands/_app.js +4 -2
- package/build/commands/_app.js.map +1 -1
- package/build/commands/audit.d.ts.map +1 -1
- package/build/commands/audit.js +7 -4
- package/build/commands/audit.js.map +1 -1
- package/build/commands/diff.d.ts.map +1 -1
- package/build/commands/diff.js +10 -10
- package/build/commands/diff.js.map +1 -1
- package/build/commands/doctor.d.ts.map +1 -1
- package/build/commands/doctor.js +1 -1
- package/build/commands/doctor.js.map +1 -1
- package/build/commands/info.d.ts.map +1 -1
- package/build/commands/info.js +16 -14
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.d.ts.map +1 -1
- package/build/commands/init.js +1 -1
- package/build/commands/init.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +145 -64
- package/build/commands/install.js.map +1 -1
- package/build/commands/move.d.ts.map +1 -1
- package/build/commands/move.js +5 -4
- package/build/commands/move.js.map +1 -1
- package/build/commands/outdated.js +1 -1
- package/build/commands/outdated.js.map +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +6 -4
- package/build/commands/sync.js.map +1 -1
- package/build/commands/update.d.ts +1 -1
- package/build/commands/update.d.ts.map +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/update.js.map +1 -1
- package/build/commands/upgrade.d.ts +16 -0
- package/build/commands/upgrade.d.ts.map +1 -0
- package/build/commands/upgrade.js +64 -0
- package/build/commands/upgrade.js.map +1 -0
- package/build/commands/why.d.ts.map +1 -1
- package/build/commands/why.js +28 -7
- package/build/commands/why.js.map +1 -1
- package/build/components/DiffView.d.ts +3 -1
- package/build/components/DiffView.d.ts.map +1 -1
- package/build/components/DiffView.js +18 -4
- package/build/components/DiffView.js.map +1 -1
- package/build/components/EnabledEntriesHint.d.ts +14 -0
- package/build/components/EnabledEntriesHint.d.ts.map +1 -0
- package/build/components/EnabledEntriesHint.js +13 -0
- package/build/components/EnabledEntriesHint.js.map +1 -0
- package/build/components/InitSuccess.d.ts.map +1 -1
- package/build/components/InitSuccess.js +4 -1
- package/build/components/InitSuccess.js.map +1 -1
- package/build/components/InstallSummary.d.ts +7 -2
- package/build/components/InstallSummary.d.ts.map +1 -1
- package/build/components/InstallSummary.js +3 -1
- package/build/components/InstallSummary.js.map +1 -1
- package/build/components/LeftoverFilesHint.d.ts +21 -0
- package/build/components/LeftoverFilesHint.d.ts.map +1 -0
- package/build/components/LeftoverFilesHint.js +13 -0
- package/build/components/LeftoverFilesHint.js.map +1 -0
- package/build/components/index.d.ts +2 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +2 -0
- package/build/components/index.js.map +1 -1
- package/build/hooks/useInitState.d.ts +9 -1
- package/build/hooks/useInitState.d.ts.map +1 -1
- package/build/hooks/useInitState.js +52 -10
- package/build/hooks/useInitState.js.map +1 -1
- package/build/hooks/useListActions.d.ts.map +1 -1
- package/build/hooks/useListActions.js +4 -1
- package/build/hooks/useListActions.js.map +1 -1
- package/build/hooks/useUninstallState.d.ts.map +1 -1
- package/build/hooks/useUninstallState.js +46 -23
- package/build/hooks/useUninstallState.js.map +1 -1
- package/build/lib/adapter.d.ts +14 -9
- package/build/lib/adapter.d.ts.map +1 -1
- package/build/lib/adapter.js +46 -8
- package/build/lib/adapter.js.map +1 -1
- package/build/lib/api-client.d.ts.map +1 -1
- package/build/lib/api-client.js +2 -1
- package/build/lib/api-client.js.map +1 -1
- package/build/lib/asset-tools.d.ts +8 -0
- package/build/lib/asset-tools.d.ts.map +1 -1
- package/build/lib/asset-tools.js +14 -0
- package/build/lib/asset-tools.js.map +1 -1
- package/build/lib/completion/candidates.d.ts.map +1 -1
- package/build/lib/completion/candidates.js +21 -8
- package/build/lib/completion/candidates.js.map +1 -1
- package/build/lib/config-entries.d.ts +3 -3
- package/build/lib/config-entries.d.ts.map +1 -1
- package/build/lib/config-entries.js +16 -6
- package/build/lib/config-entries.js.map +1 -1
- package/build/lib/config-lock.d.ts +2 -1
- package/build/lib/config-lock.d.ts.map +1 -1
- package/build/lib/config-lock.js +10 -2
- package/build/lib/config-lock.js.map +1 -1
- package/build/lib/cross-scope.d.ts +6 -2
- package/build/lib/cross-scope.d.ts.map +1 -1
- package/build/lib/cross-scope.js +20 -13
- package/build/lib/cross-scope.js.map +1 -1
- package/build/lib/diagnostics.d.ts +3 -2
- package/build/lib/diagnostics.d.ts.map +1 -1
- package/build/lib/diagnostics.js +11 -11
- package/build/lib/diagnostics.js.map +1 -1
- package/build/lib/diff-command.d.ts +9 -3
- package/build/lib/diff-command.d.ts.map +1 -1
- package/build/lib/diff-command.js +58 -21
- package/build/lib/diff-command.js.map +1 -1
- package/build/lib/diff.d.ts +8 -4
- package/build/lib/diff.d.ts.map +1 -1
- package/build/lib/diff.js +23 -4
- package/build/lib/diff.js.map +1 -1
- package/build/lib/doctor-fix.d.ts +8 -3
- package/build/lib/doctor-fix.d.ts.map +1 -1
- package/build/lib/doctor-fix.js +50 -3
- package/build/lib/doctor-fix.js.map +1 -1
- package/build/lib/enabled-list.d.ts +7 -3
- package/build/lib/enabled-list.d.ts.map +1 -1
- package/build/lib/enabled-list.js +7 -5
- package/build/lib/enabled-list.js.map +1 -1
- package/build/lib/gitignore.d.ts +8 -0
- package/build/lib/gitignore.d.ts.map +1 -1
- package/build/lib/gitignore.js +51 -6
- package/build/lib/gitignore.js.map +1 -1
- package/build/lib/hook-config.d.ts +90 -7
- package/build/lib/hook-config.d.ts.map +1 -1
- package/build/lib/hook-config.js +135 -11
- package/build/lib/hook-config.js.map +1 -1
- package/build/lib/hook-script.d.ts +45 -0
- package/build/lib/hook-script.d.ts.map +1 -1
- package/build/lib/hook-script.js +118 -1
- package/build/lib/hook-script.js.map +1 -1
- package/build/lib/init.d.ts +34 -12
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js +180 -32
- package/build/lib/init.js.map +1 -1
- package/build/lib/install-targets.d.ts +35 -8
- package/build/lib/install-targets.d.ts.map +1 -1
- package/build/lib/install-targets.js +87 -14
- package/build/lib/install-targets.js.map +1 -1
- package/build/lib/installer.d.ts +15 -5
- package/build/lib/installer.d.ts.map +1 -1
- package/build/lib/installer.js +201 -41
- package/build/lib/installer.js.map +1 -1
- package/build/lib/local-edits.d.ts +15 -2
- package/build/lib/local-edits.d.ts.map +1 -1
- package/build/lib/local-edits.js +40 -13
- package/build/lib/local-edits.js.map +1 -1
- package/build/lib/lockfile.d.ts +2 -2
- package/build/lib/lockfile.js +4 -4
- package/build/lib/lockfile.js.map +1 -1
- package/build/lib/mover.d.ts +5 -4
- package/build/lib/mover.d.ts.map +1 -1
- package/build/lib/mover.js +43 -35
- package/build/lib/mover.js.map +1 -1
- package/build/lib/multi-tool-install.d.ts +28 -5
- package/build/lib/multi-tool-install.d.ts.map +1 -1
- package/build/lib/multi-tool-install.js +105 -26
- package/build/lib/multi-tool-install.js.map +1 -1
- package/build/lib/named-entry.d.ts +12 -0
- package/build/lib/named-entry.d.ts.map +1 -1
- package/build/lib/named-entry.js +16 -8
- package/build/lib/named-entry.js.map +1 -1
- package/build/lib/notices.d.ts +2 -0
- package/build/lib/notices.d.ts.map +1 -1
- package/build/lib/notices.js +10 -0
- package/build/lib/notices.js.map +1 -1
- package/build/lib/schemas/adapter.d.ts +33 -0
- package/build/lib/schemas/adapter.d.ts.map +1 -1
- package/build/lib/schemas/adapter.js +31 -5
- package/build/lib/schemas/adapter.js.map +1 -1
- package/build/lib/self-upgrade.d.ts +66 -0
- package/build/lib/self-upgrade.d.ts.map +1 -0
- package/build/lib/self-upgrade.js +183 -0
- package/build/lib/self-upgrade.js.map +1 -0
- package/build/lib/sync.d.ts +39 -0
- package/build/lib/sync.d.ts.map +1 -1
- package/build/lib/sync.js +181 -10
- package/build/lib/sync.js.map +1 -1
- package/build/lib/touched-paths.d.ts.map +1 -1
- package/build/lib/touched-paths.js +2 -1
- package/build/lib/touched-paths.js.map +1 -1
- package/build/lib/uninstaller.d.ts +29 -1
- package/build/lib/uninstaller.d.ts.map +1 -1
- package/build/lib/uninstaller.js +99 -5
- package/build/lib/uninstaller.js.map +1 -1
- package/build/lib/update-check.d.ts +27 -1
- package/build/lib/update-check.d.ts.map +1 -1
- package/build/lib/update-check.js +74 -8
- package/build/lib/update-check.js.map +1 -1
- package/build/lib/updater.d.ts +2 -0
- package/build/lib/updater.d.ts.map +1 -1
- package/build/lib/updater.js +36 -3
- package/build/lib/updater.js.map +1 -1
- package/build/lib/version.d.ts +12 -4
- package/build/lib/version.d.ts.map +1 -1
- package/build/lib/version.js +19 -7
- package/build/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/tool-adapters/claude-code.json +2 -1
- package/tool-adapters/codex-cli.json +5 -1
- package/tool-adapters/copilot-cli.json +58 -9
|
@@ -15,6 +15,13 @@ export interface FindNamedEntryOptions {
|
|
|
15
15
|
/** A requested version, carried into the suggested commands. */
|
|
16
16
|
version?: string;
|
|
17
17
|
}
|
|
18
|
+
/** What a name reaches in a lockfile, as {@link lookupNamedEntry} resolves it. */
|
|
19
|
+
export interface NamedEntryLookup {
|
|
20
|
+
/** When the name reaches no entry: how the commands name the entries of that name it missed. */
|
|
21
|
+
elsewhere: string[];
|
|
22
|
+
/** The entries the name reaches: one, or one per type when it needs `--type`. */
|
|
23
|
+
matches: InstalledAsset[];
|
|
24
|
+
}
|
|
18
25
|
/**
|
|
19
26
|
* How a command names an installed entry so that {@link findNamedEntry} finds it again: `@org/name`
|
|
20
27
|
* for an org's entry, and the bare name for a global one, unless the lockfile org has an entry of
|
|
@@ -29,4 +36,9 @@ export declare function entrySpec(lockfile: Lockfile, asset: Pick<InstalledAsset
|
|
|
29
36
|
* type needs `type` to pick one.
|
|
30
37
|
*/
|
|
31
38
|
export declare function findNamedEntry(lockfile: Lockfile, spec: string, { command, error: NamedError, root, scope, type, version }: FindNamedEntryOptions): InstalledAsset;
|
|
39
|
+
/**
|
|
40
|
+
* The entries a name reaches, as {@link findNamedEntry} resolves it, for a command that reports a
|
|
41
|
+
* name it doesn't reach instead of refusing it (`why`), or words its own refusal (`move`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function lookupNamedEntry(lockfile: Lockfile, spec: string, type?: AssetType): NamedEntryLookup;
|
|
32
44
|
//# sourceMappingURL=named-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"named-entry.d.ts","sourceRoot":"","sources":["../../src/lib/named-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,EAAE,KAAK,KAAK,EAA6B,MAAM,YAAY,CAAC;AAEnE,MAAM,WAAW,qBAAqB;IACpC,sGAAsG;IACtG,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,KAAK,KAAK,CAAC;IACpE,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC,EACpD,IAAI,CAAC,EAAE,SAAS,GACf,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc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AAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,qBAAqB,GAChF,cAAc,CA4BhB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAUrG"}
|
package/build/lib/named-entry.js
CHANGED
|
@@ -19,13 +19,7 @@ export function entrySpec(lockfile, asset, type) {
|
|
|
19
19
|
* type needs `type` to pick one.
|
|
20
20
|
*/
|
|
21
21
|
export function findNamedEntry(lockfile, spec, { command, error: NamedError, root, scope, type, version }) {
|
|
22
|
-
const
|
|
23
|
-
const sameName = (lockfile.assets ?? []).filter((a) => a.name === named.name && (!type || a.type === type));
|
|
24
|
-
const inOrg = (org) => sameName.filter((a) => a.org === org);
|
|
25
|
-
let matches = inOrg(named.kind === 'default' ? lockfile.org : inlineOrgOf(named));
|
|
26
|
-
if (matches.length === 0 && named.kind === 'default' && lockfile.org) {
|
|
27
|
-
matches = inOrg(undefined);
|
|
28
|
-
}
|
|
22
|
+
const { elsewhere, matches } = lookupNamedEntry(lockfile, spec, type);
|
|
29
23
|
const versionSuffix = version ? `@${version}` : '';
|
|
30
24
|
if (matches.length > 1) {
|
|
31
25
|
const types = matches.map((a) => a.type).sort();
|
|
@@ -34,7 +28,6 @@ export function findNamedEntry(lockfile, spec, { command, error: NamedError, roo
|
|
|
34
28
|
if (matches.length === 1)
|
|
35
29
|
return matches[0];
|
|
36
30
|
const notInstalled = `Asset "${spec}" is not installed${root ? ` in ${scopeLabel({ root, scope: scope ?? 'project' })}` : ''}.`;
|
|
37
|
-
const elsewhere = [...new Set(sameName.map((a) => entrySpec(lockfile, a, type)))].sort();
|
|
38
31
|
if (elsewhere.length > 0) {
|
|
39
32
|
throw new NamedError(`${notInstalled} Installed as: ${elsewhere.join(', ')}.`, elsewhere.length === 1
|
|
40
33
|
? {
|
|
@@ -44,4 +37,19 @@ export function findNamedEntry(lockfile, spec, { command, error: NamedError, roo
|
|
|
44
37
|
}
|
|
45
38
|
throw new NamedError(notInstalled);
|
|
46
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The entries a name reaches, as {@link findNamedEntry} resolves it, for a command that reports a
|
|
42
|
+
* name it doesn't reach instead of refusing it (`why`), or words its own refusal (`move`).
|
|
43
|
+
*/
|
|
44
|
+
export function lookupNamedEntry(lockfile, spec, type) {
|
|
45
|
+
const named = parseNameScope(spec);
|
|
46
|
+
const sameName = (lockfile.assets ?? []).filter((a) => a.name === named.name && (!type || a.type === type));
|
|
47
|
+
const inOrg = (org) => sameName.filter((a) => a.org === org);
|
|
48
|
+
let matches = inOrg(named.kind === 'default' ? lockfile.org : inlineOrgOf(named));
|
|
49
|
+
if (matches.length === 0 && named.kind === 'default' && lockfile.org) {
|
|
50
|
+
matches = inOrg(undefined);
|
|
51
|
+
}
|
|
52
|
+
const elsewhere = matches.length > 0 ? [] : [...new Set(sameName.map((a) => entrySpec(lockfile, a, type)))].sort();
|
|
53
|
+
return { elsewhere, matches };
|
|
54
|
+
}
|
|
47
55
|
//# sourceMappingURL=named-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"named-entry.js","sourceRoot":"","sources":["../../src/lib/named-entry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,EAAc,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"named-entry.js","sourceRoot":"","sources":["../../src/lib/named-entry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,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,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAC5G,MAAM,KAAK,GAAG,CAAC,GAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACjF,IAAI,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC;QACrE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACnH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
package/build/lib/notices.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare function addNotice(notice: Notice): void;
|
|
|
32
32
|
export declare function clearNotices(): void;
|
|
33
33
|
/** Current notices, as a stable array reference (safe for `useSyncExternalStore`). */
|
|
34
34
|
export declare function getNotices(): readonly Notice[];
|
|
35
|
+
/** Drop the queued notice of one kind, once the run has dealt with it (`atk upgrade` and `update-available`). */
|
|
36
|
+
export declare function removeNotice(kind: string): void;
|
|
35
37
|
/** Subscribe to changes; returns the unsubscribe function. */
|
|
36
38
|
export declare function subscribeNotices(listener: Listener): () => void;
|
|
37
39
|
export declare function toJsonNotice({ command, kind, text }: Notice): JsonNotice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notices.d.ts","sourceRoot":"","sources":["../../src/lib/notices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAK3B,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAQ9C;AAED,oDAAoD;AACpD,wBAAgB,YAAY,IAAI,IAAI,CAKnC;AAED,sFAAsF;AACtF,wBAAgB,UAAU,IAAI,SAAS,MAAM,EAAE,CAE9C;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAK/D;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,GAAG,UAAU,CAExE"}
|
|
1
|
+
{"version":3,"file":"notices.d.ts","sourceRoot":"","sources":["../../src/lib/notices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAK3B,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAQ9C;AAED,oDAAoD;AACpD,wBAAgB,YAAY,IAAI,IAAI,CAKnC;AAED,sFAAsF;AACtF,wBAAgB,UAAU,IAAI,SAAS,MAAM,EAAE,CAE9C;AAED,iHAAiH;AACjH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQ/C;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAK/D;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,GAAG,UAAU,CAExE"}
|
package/build/lib/notices.js
CHANGED
|
@@ -32,6 +32,16 @@ export function clearNotices() {
|
|
|
32
32
|
export function getNotices() {
|
|
33
33
|
return notices;
|
|
34
34
|
}
|
|
35
|
+
/** Drop the queued notice of one kind, once the run has dealt with it (`atk upgrade` and `update-available`). */
|
|
36
|
+
export function removeNotice(kind) {
|
|
37
|
+
if (!notices.some((n) => n.kind === kind)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
notices = notices.filter((n) => n.kind !== kind);
|
|
41
|
+
for (const listener of listeners) {
|
|
42
|
+
listener();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
35
45
|
/** Subscribe to changes; returns the unsubscribe function. */
|
|
36
46
|
export function subscribeNotices(listener) {
|
|
37
47
|
listeners.add(listener);
|
package/build/lib/notices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../../src/lib/notices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsBH,IAAI,OAAO,GAAsB,EAAE,CAAC;AACpC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAC;AAEtC,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,OAAO,GAAG,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,QAAQ,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,YAAY;IAC1B,OAAO,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,QAAQ,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAU;IAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1C,CA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AC,QAAkB;IACjD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAU;IAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const PlacementConfig: z.ZodObject<{
|
|
3
3
|
configCommand: z.ZodOptional<z.ZodString>;
|
|
4
4
|
configCommandEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
5
6
|
configCommandPrefix: z.ZodOptional<z.ZodString>;
|
|
6
7
|
configEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
8
|
configFile: z.ZodOptional<z.ZodString>;
|
|
@@ -11,16 +12,26 @@ export declare const PlacementConfig: z.ZodObject<{
|
|
|
11
12
|
}>>;
|
|
12
13
|
configFragment: z.ZodOptional<z.ZodBoolean>;
|
|
13
14
|
configFragmentKey: z.ZodOptional<z.ZodString>;
|
|
15
|
+
configHookEvents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
|
+
configHookFormat: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
"matcher-groups": "matcher-groups";
|
|
18
|
+
copilot: "copilot";
|
|
19
|
+
}>>;
|
|
14
20
|
configHookMerge: z.ZodOptional<z.ZodBoolean>;
|
|
15
21
|
configKey: z.ZodOptional<z.ZodString>;
|
|
16
22
|
configLockFile: z.ZodOptional<z.ZodString>;
|
|
17
23
|
configMerge: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
disabledListKey: z.ZodOptional<z.ZodString>;
|
|
18
25
|
enabledListFile: z.ZodOptional<z.ZodString>;
|
|
19
26
|
enabledListKey: z.ZodOptional<z.ZodString>;
|
|
20
27
|
entrypointName: z.ZodOptional<z.ZodString>;
|
|
21
28
|
fileless: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
jsonEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
path: z.ZodString;
|
|
31
|
+
}, z.core.$strip>>;
|
|
22
32
|
nodeEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
23
33
|
configCommand: z.ZodString;
|
|
34
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
24
35
|
path: z.ZodString;
|
|
25
36
|
}, z.core.$strip>>;
|
|
26
37
|
path: z.ZodString;
|
|
@@ -54,6 +65,7 @@ export declare const AdapterSchema: z.ZodObject<{
|
|
|
54
65
|
}> & z.core.$partial, z.ZodObject<{
|
|
55
66
|
configCommand: z.ZodOptional<z.ZodString>;
|
|
56
67
|
configCommandEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
68
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
57
69
|
configCommandPrefix: z.ZodOptional<z.ZodString>;
|
|
58
70
|
configEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
71
|
configFile: z.ZodOptional<z.ZodString>;
|
|
@@ -63,16 +75,26 @@ export declare const AdapterSchema: z.ZodObject<{
|
|
|
63
75
|
}>>;
|
|
64
76
|
configFragment: z.ZodOptional<z.ZodBoolean>;
|
|
65
77
|
configFragmentKey: z.ZodOptional<z.ZodString>;
|
|
78
|
+
configHookEvents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
79
|
+
configHookFormat: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
"matcher-groups": "matcher-groups";
|
|
81
|
+
copilot: "copilot";
|
|
82
|
+
}>>;
|
|
66
83
|
configHookMerge: z.ZodOptional<z.ZodBoolean>;
|
|
67
84
|
configKey: z.ZodOptional<z.ZodString>;
|
|
68
85
|
configLockFile: z.ZodOptional<z.ZodString>;
|
|
69
86
|
configMerge: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
disabledListKey: z.ZodOptional<z.ZodString>;
|
|
70
88
|
enabledListFile: z.ZodOptional<z.ZodString>;
|
|
71
89
|
enabledListKey: z.ZodOptional<z.ZodString>;
|
|
72
90
|
entrypointName: z.ZodOptional<z.ZodString>;
|
|
73
91
|
fileless: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
jsonEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
path: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>;
|
|
74
95
|
nodeEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
75
96
|
configCommand: z.ZodString;
|
|
97
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
76
98
|
path: z.ZodString;
|
|
77
99
|
}, z.core.$strip>>;
|
|
78
100
|
path: z.ZodString;
|
|
@@ -107,6 +129,7 @@ export declare const AdapterSchema: z.ZodObject<{
|
|
|
107
129
|
}> & z.core.$partial, z.ZodObject<{
|
|
108
130
|
configCommand: z.ZodOptional<z.ZodString>;
|
|
109
131
|
configCommandEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
110
133
|
configCommandPrefix: z.ZodOptional<z.ZodString>;
|
|
111
134
|
configEntryDefaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
135
|
configFile: z.ZodOptional<z.ZodString>;
|
|
@@ -116,16 +139,26 @@ export declare const AdapterSchema: z.ZodObject<{
|
|
|
116
139
|
}>>;
|
|
117
140
|
configFragment: z.ZodOptional<z.ZodBoolean>;
|
|
118
141
|
configFragmentKey: z.ZodOptional<z.ZodString>;
|
|
142
|
+
configHookEvents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
143
|
+
configHookFormat: z.ZodOptional<z.ZodEnum<{
|
|
144
|
+
"matcher-groups": "matcher-groups";
|
|
145
|
+
copilot: "copilot";
|
|
146
|
+
}>>;
|
|
119
147
|
configHookMerge: z.ZodOptional<z.ZodBoolean>;
|
|
120
148
|
configKey: z.ZodOptional<z.ZodString>;
|
|
121
149
|
configLockFile: z.ZodOptional<z.ZodString>;
|
|
122
150
|
configMerge: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
disabledListKey: z.ZodOptional<z.ZodString>;
|
|
123
152
|
enabledListFile: z.ZodOptional<z.ZodString>;
|
|
124
153
|
enabledListKey: z.ZodOptional<z.ZodString>;
|
|
125
154
|
entrypointName: z.ZodOptional<z.ZodString>;
|
|
126
155
|
fileless: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
jsonEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
path: z.ZodString;
|
|
158
|
+
}, z.core.$strip>>;
|
|
127
159
|
nodeEntrypoint: z.ZodOptional<z.ZodObject<{
|
|
128
160
|
configCommand: z.ZodString;
|
|
161
|
+
configCommandPowershell: z.ZodOptional<z.ZodString>;
|
|
129
162
|
path: z.ZodString;
|
|
130
163
|
}, z.core.$strip>>;
|
|
131
164
|
path: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/schemas/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/schemas/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,aAAa;;;;;;iBAyBxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,UAAU;;;;EAIpB,CAAC;AACJ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG;IACpD;;;;OAIG;IACH,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC,CAAC"}
|
|
@@ -4,15 +4,19 @@ export const PlacementConfig = z.object({
|
|
|
4
4
|
configCommand: z
|
|
5
5
|
.string()
|
|
6
6
|
.optional()
|
|
7
|
-
.describe('For hook placements: the hook command template (supports {name},
|
|
7
|
+
.describe('For hook placements: the hook command template (supports {name}, {path} for the placed path, and {homePath}: at the user scope, "$HOME/" + the placed path, or the path itself when it is absolute), used instead of configCommandPrefix + the installed script path when the command does not name that path as a prefix would (e.g. "\\"$HOME/.claude/hooks/{name}.sh\\"")'),
|
|
8
8
|
configCommandEntryDefaults: z
|
|
9
9
|
.record(z.string(), z.unknown())
|
|
10
10
|
.optional()
|
|
11
11
|
.describe('For configFragment placements: keys added to each merged entry that has a command (a local stdio server) and lacks them, on top of configEntryDefaults (e.g. {"args": []} for Copilot CLI’s ~/.copilot/mcp-config.json, which refuses the whole file when a local server has no args list)'),
|
|
12
|
+
configCommandPowershell: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('For "copilot" configHookFormat placements: the template for an entry’s powershell command, which Copilot CLI runs on Windows, with configCommand’s placeholders; without it, powershell gets the bash command. For a .sh hook, so it can find Git Bash itself rather than the bash PowerShell finds first on PATH, which can be WSL’s'),
|
|
12
16
|
configCommandPrefix: z
|
|
13
17
|
.string()
|
|
14
18
|
.optional()
|
|
15
|
-
.describe('For hook placements: prefix prepended to the installed script path to form the hook command (e.g. "$CLAUDE_PROJECT_DIR
|
|
19
|
+
.describe('For hook placements: prefix prepended to the installed script path to form the hook command (e.g. `: "$(exit 0)"; exec "$CLAUDE_PROJECT_DIR"/`: quoted so a path with a space stays one word, and a line PowerShell parses and exits 0 on, since Copilot CLI runs it there on Windows)'),
|
|
16
20
|
configEntryDefaults: z
|
|
17
21
|
.record(z.string(), z.unknown())
|
|
18
22
|
.optional()
|
|
@@ -30,6 +34,14 @@ export const PlacementConfig = z.object({
|
|
|
30
34
|
.string()
|
|
31
35
|
.optional()
|
|
32
36
|
.describe('For configFragment placements: key inside the asset content that holds the entry map when it differs from configKey (e.g. "mcpServers" when configKey is "mcp_servers"). Lookup order: content[configKey], then content[configFragmentKey], then the whole content.'),
|
|
37
|
+
configHookEvents: z
|
|
38
|
+
.record(z.string(), z.string())
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('For configHookMerge placements: the tool’s own name for each hookConfig event (hookConfig uses Claude Code’s, e.g. {"Stop": "agentStop"} for Copilot CLI). When set, an event that is neither a key nor a value here is left out.'),
|
|
41
|
+
configHookFormat: z
|
|
42
|
+
.enum(['matcher-groups', 'copilot'])
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('For configHookMerge placements: the shape of each event’s entries. "matcher-groups" (the default) is Claude Code’s `{ matcher?, hooks: [{ type, command, timeout? }] }`; "copilot" is Copilot CLI’s `{ type, bash, powershell, timeoutSec? }` in a `{ "version": 1, "hooks": … }` file, which takes no matcher'),
|
|
33
45
|
configHookMerge: z
|
|
34
46
|
.boolean()
|
|
35
47
|
.optional()
|
|
@@ -43,6 +55,10 @@ export const PlacementConfig = z.object({
|
|
|
43
55
|
.boolean()
|
|
44
56
|
.optional()
|
|
45
57
|
.describe('When true, merge actual asset content into configFile[configKey] instead of writing a simple marker'),
|
|
58
|
+
disabledListKey: z
|
|
59
|
+
.string()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Key of the string array within enabledListFile that lists entry names the user denied (e.g., disabledMcpjsonServers). ATK never adds a name listed there to enabledListKey.'),
|
|
46
62
|
enabledListFile: z
|
|
47
63
|
.string()
|
|
48
64
|
.optional()
|
|
@@ -59,11 +75,21 @@ export const PlacementConfig = z.object({
|
|
|
59
75
|
.boolean()
|
|
60
76
|
.optional()
|
|
61
77
|
.describe('When true, no standalone files are placed. Asset content is only used for config merging.'),
|
|
78
|
+
jsonEntrypoint: z
|
|
79
|
+
.object({
|
|
80
|
+
path: z.string().describe('Placement path template for the entrypoint (supports {name})'),
|
|
81
|
+
})
|
|
82
|
+
.optional()
|
|
83
|
+
.describe('For hook placements: where a hook whose manifest entrypoint is the tool’s own hook config (.json) is placed, as it is, in place of path and with no config merge (e.g. Copilot CLI’s ".github/hooks/{name}.json")'),
|
|
62
84
|
nodeEntrypoint: z
|
|
63
85
|
.object({
|
|
64
86
|
configCommand: z
|
|
65
87
|
.string()
|
|
66
|
-
.describe('The hook command that runs the placed script with node,
|
|
88
|
+
.describe('The hook command that runs the placed script with node. Without a configCommandPowershell beside it, use no shell syntax, so it runs the same under every shell the tool may use (e.g. cmd on Windows). Supports {name}, and {path}: the placed path, relative to the project or user root, or absolute when a moved user config directory is on another drive (resolve it, do not join it, at the user scope), and {homePath}, as for the placement’s configCommand, for a tool whose hooks run only under shells that expand $HOME (Copilot CLI’s bash and PowerShell)'),
|
|
89
|
+
configCommandPowershell: z
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('For "copilot" configHookFormat placements: the template for an entry’s powershell command, with configCommand’s placeholders, when configCommand has syntax only bash runs; without it, powershell gets configCommand. The placement’s own configCommandPowershell is for its script entrypoint and never applies here'),
|
|
67
93
|
path: z.string().describe('Placement path template for the entrypoint (supports {name})'),
|
|
68
94
|
})
|
|
69
95
|
.optional()
|
|
@@ -84,11 +110,11 @@ export const UserConfigDir = z.object({
|
|
|
84
110
|
keep: z
|
|
85
111
|
.array(z.string())
|
|
86
112
|
.optional()
|
|
87
|
-
.describe('User placement paths under `dir/` that stay put while `env` is set, as path prefixes (e.g. [".
|
|
113
|
+
.describe('User placement paths under `dir/` that stay put while `env` is set, as path prefixes (e.g. [".tool/hooks/"] for a tool that reads its hooks from the home directory whatever `env` says)'),
|
|
88
114
|
subdir: z
|
|
89
115
|
.string()
|
|
90
116
|
.optional()
|
|
91
|
-
.describe('The tool’s directory inside the path `env` names, when it is not that path itself (e.g. ".
|
|
117
|
+
.describe('The tool’s directory inside the path `env` names, when it is not that path itself (e.g. ".tool" for a tool that reads `$XDG_CONFIG_HOME/.tool`)'),
|
|
92
118
|
});
|
|
93
119
|
export const ScopeClash = z
|
|
94
120
|
.enum(['both', 'project', 'user'])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/lib/schemas/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/lib/schemas/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,IAAI,SAA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C,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,oEAAoE,CAAC;IACnH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC5D,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACvG,UAAU,EAAE,CAAC;SACV,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC;SACpC,QAAQ,EAAE;SACV,QAAQ,CACP,6LAA6L,CAC9L;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAChE,aAAa,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC9C,sMAAsM,CACvM;IACD,cAAc,EAAE,CAAC;SACd,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC;SACzC,QAAQ,EAAE;SACV,QAAQ,CACP,yJAAyJ,CAC1J;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ApiCodeError } from './errors.js';
|
|
2
|
+
import { type DistTags } from './update-check.js';
|
|
3
|
+
export declare const UPGRADE_TAGS: readonly ["dev", "latest"];
|
|
4
|
+
export type UpgradeTag = (typeof UPGRADE_TAGS)[number];
|
|
5
|
+
export interface NpmResult {
|
|
6
|
+
/** The exit code, or null when npm was stopped (a timeout) or never started. */
|
|
7
|
+
code: null | number;
|
|
8
|
+
/** stdout and stderr together, for a failure's tail. */
|
|
9
|
+
output: string;
|
|
10
|
+
/** stdout alone, for an answer npm prints there (`npm root --global`). */
|
|
11
|
+
stdout: string;
|
|
12
|
+
}
|
|
13
|
+
/** Every effect `atk upgrade` has, so its order of work is tested without npm (as `conduct upgrade`'s is). */
|
|
14
|
+
export interface UpgradeDeps {
|
|
15
|
+
/** The realpath of the running package's folder. */
|
|
16
|
+
cliPath: string;
|
|
17
|
+
/** The version this process loaded. */
|
|
18
|
+
currentVersion: string;
|
|
19
|
+
/** The installed package's version, read again from disk after the install. */
|
|
20
|
+
installedVersion: () => string;
|
|
21
|
+
npmInstall: (spec: string) => Promise<NpmResult>;
|
|
22
|
+
/** The realpath of `npm root --global`; throws when npm can't be asked. */
|
|
23
|
+
npmRoot: () => Promise<string>;
|
|
24
|
+
offline: boolean;
|
|
25
|
+
platform?: NodeJS.Platform;
|
|
26
|
+
progress: (message: string) => void;
|
|
27
|
+
/** npm's dist-tags read fresh, or null when npm couldn't be read. */
|
|
28
|
+
tagVersions: () => Promise<DistTags | null>;
|
|
29
|
+
}
|
|
30
|
+
export type UpgradeErrorCode = 'downgrade_refused' | 'install_failed' | 'not_npm_global' | 'npm_unreachable' | 'offline' | 'tag_missing';
|
|
31
|
+
export interface UpgradeOptions {
|
|
32
|
+
allowDowngrade?: boolean;
|
|
33
|
+
/** The dist-tag to install from; by default the running CLI's channel. */
|
|
34
|
+
tag?: UpgradeTag;
|
|
35
|
+
}
|
|
36
|
+
export interface UpgradeResult {
|
|
37
|
+
from: string;
|
|
38
|
+
outcome: 'current' | 'downgraded' | 'upgraded';
|
|
39
|
+
tag: UpgradeTag;
|
|
40
|
+
to: string;
|
|
41
|
+
}
|
|
42
|
+
/** Why `atk upgrade` installed nothing, or why its install failed. */
|
|
43
|
+
export declare class UpgradeError extends ApiCodeError {
|
|
44
|
+
code: UpgradeErrorCode;
|
|
45
|
+
name: string;
|
|
46
|
+
constructor(code: UpgradeErrorCode, message: string, options?: {
|
|
47
|
+
command?: string;
|
|
48
|
+
hint?: string;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** The real npm, the running package and the update check's npm read. */
|
|
52
|
+
export declare function defaultUpgradeDeps(progress: (message: string) => void): UpgradeDeps;
|
|
53
|
+
/** True when cliPath lies under npm's global node_modules. A linked checkout and npx's cache resolve outside it. */
|
|
54
|
+
export declare function isGlobalInstall(cliPath: string, npmRoot: string, platform?: NodeJS.Platform): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The realpath of the folder `npm root --global` printed. stdout alone: npm writes its warnings
|
|
57
|
+
* (an unknown .npmrc key, its update notice) to stderr. Throws when npm failed.
|
|
58
|
+
*/
|
|
59
|
+
export declare function npmRootOf(result: NpmResult): string;
|
|
60
|
+
/**
|
|
61
|
+
* Install the tag's version over the running CLI. Refuses, before it installs anything: offline,
|
|
62
|
+
* outside an npm global install, a tag npm doesn't have, and a version older than the running one
|
|
63
|
+
* unless allowDowngrade. Does nothing when the tag's version is the running one.
|
|
64
|
+
*/
|
|
65
|
+
export declare function upgradeCli(options: UpgradeOptions, deps: UpgradeDeps): Promise<UpgradeResult>;
|
|
66
|
+
//# sourceMappingURL=self-upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-upgrade.d.ts","sourceRoot":"","sources":["../../src/lib/self-upgrade.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,mBAAmB,CAAC;AAWrE,eAAO,MAAM,YAAY,4BAA6B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAQvD,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8GAA8G;AAC9G,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,MAAM,CAAC;IAC/B,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CA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IT;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAKnD;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CA+EnG"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `atk upgrade`: install the newest CLI on an npm dist-tag over the running one (ATK-873), as
|
|
3
|
+
* `conduct upgrade` does for the conductor (apps/conductor/src/upgrade.ts).
|
|
4
|
+
*
|
|
5
|
+
* npm replaces the package while this process runs from it. That works on Windows too: Node holds
|
|
6
|
+
* no handle on a module once it has loaded it, and npm rewrites the `atk.cmd` shim with the same
|
|
7
|
+
* bytes. So everything this module needs is a static import, loaded before the install, and the
|
|
8
|
+
* new version is read from the installed `package.json` on disk, never from `CLI_VERSION`.
|
|
9
|
+
*/
|
|
10
|
+
import { spawn } from 'node:child_process';
|
|
11
|
+
import { realpathSync } from 'node:fs';
|
|
12
|
+
import { posix, win32 } from 'node:path';
|
|
13
|
+
import { eq as semverEq, lt as semverLt, valid as semverValid } from 'semver';
|
|
14
|
+
import { ApiCodeError } from './errors.js';
|
|
15
|
+
import { isOffline } from './offline.js';
|
|
16
|
+
import { readDistTagsFresh } from './update-check.js';
|
|
17
|
+
import { channelOf, CLI_VERSION, npmInstallCommand, PACKAGE_DIR, PACKAGE_NAME, readInstalledVersion, UPGRADE_COMMAND, } from './version.js';
|
|
18
|
+
export const UPGRADE_TAGS = ['dev', 'latest'];
|
|
19
|
+
/** npm can take a while on a slow network; past this the install is stopped and reported. */
|
|
20
|
+
const NPM_INSTALL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
21
|
+
const NPM_ROOT_TIMEOUT_MS = 30 * 1000;
|
|
22
|
+
/** How much of npm's output a failed install shows. */
|
|
23
|
+
const OUTPUT_TAIL_CHARS = 1500;
|
|
24
|
+
/** Why `atk upgrade` installed nothing, or why its install failed. */
|
|
25
|
+
export class UpgradeError extends ApiCodeError {
|
|
26
|
+
name = 'UpgradeError';
|
|
27
|
+
constructor(code, message, options = {}) {
|
|
28
|
+
super(message, { ...options, code });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The real npm, the running package and the update check's npm read. */
|
|
32
|
+
export function defaultUpgradeDeps(progress) {
|
|
33
|
+
return {
|
|
34
|
+
cliPath: realpathSync(PACKAGE_DIR),
|
|
35
|
+
currentVersion: CLI_VERSION,
|
|
36
|
+
installedVersion: readInstalledVersion,
|
|
37
|
+
// --prefer-online: npm resolves the exact version against a fresh packument, not a cached one
|
|
38
|
+
// that may not list it yet (ATK-558).
|
|
39
|
+
npmInstall: (spec) => runNpm(['install', '--global', '--prefer-online', spec], NPM_INSTALL_TIMEOUT_MS),
|
|
40
|
+
npmRoot: async () => npmRootOf(await runNpm(['root', '--global'], NPM_ROOT_TIMEOUT_MS)),
|
|
41
|
+
offline: isOffline(),
|
|
42
|
+
progress,
|
|
43
|
+
tagVersions: readDistTagsFresh,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** True when cliPath lies under npm's global node_modules. A linked checkout and npx's cache resolve outside it. */
|
|
47
|
+
export function isGlobalInstall(cliPath, npmRoot, platform = process.platform) {
|
|
48
|
+
const path = platform === 'win32' ? win32 : posix;
|
|
49
|
+
const rel = path.relative(npmRoot, cliPath);
|
|
50
|
+
return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The realpath of the folder `npm root --global` printed. stdout alone: npm writes its warnings
|
|
54
|
+
* (an unknown .npmrc key, its update notice) to stderr. Throws when npm failed.
|
|
55
|
+
*/
|
|
56
|
+
export function npmRootOf(result) {
|
|
57
|
+
if (result.code !== 0) {
|
|
58
|
+
throw new Error(tail(result.output) || `npm root --global exited ${String(result.code)}`);
|
|
59
|
+
}
|
|
60
|
+
return realpathSync(result.stdout.trim());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Install the tag's version over the running CLI. Refuses, before it installs anything: offline,
|
|
64
|
+
* outside an npm global install, a tag npm doesn't have, and a version older than the running one
|
|
65
|
+
* unless allowDowngrade. Does nothing when the tag's version is the running one.
|
|
66
|
+
*/
|
|
67
|
+
export async function upgradeCli(options, deps) {
|
|
68
|
+
const from = deps.currentVersion;
|
|
69
|
+
const tag = options.tag ?? channelOf(from);
|
|
70
|
+
const manual = npmInstallCommand(tag);
|
|
71
|
+
if (deps.offline) {
|
|
72
|
+
throw new UpgradeError('offline', "Can't upgrade with --offline: the new version comes from npm.", {
|
|
73
|
+
command: UPGRADE_COMMAND,
|
|
74
|
+
hint: 'Run it again without --offline.',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
deps.progress('Finding the npm global install...');
|
|
78
|
+
let root;
|
|
79
|
+
try {
|
|
80
|
+
root = await deps.npmRoot();
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
throw notGlobal(`Couldn't ask npm for its global folder (${err instanceof Error ? err.message : String(err)}).`, manual);
|
|
84
|
+
}
|
|
85
|
+
if (!isGlobalInstall(deps.cliPath, root, deps.platform)) {
|
|
86
|
+
throw notGlobal(`This atk (${deps.cliPath}) isn't an npm global install (${root}).`, manual);
|
|
87
|
+
}
|
|
88
|
+
deps.progress(`Reading the ${tag} version from npm...`);
|
|
89
|
+
const tags = await deps.tagVersions();
|
|
90
|
+
if (!tags) {
|
|
91
|
+
throw new UpgradeError('npm_unreachable', `Couldn't read ${PACKAGE_NAME}'s dist-tags from npm.`, {
|
|
92
|
+
command: UPGRADE_COMMAND,
|
|
93
|
+
hint: 'Check your network connection and run it again.',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const target = tags[tag];
|
|
97
|
+
if (!target || !semverValid(target)) {
|
|
98
|
+
throw new UpgradeError('tag_missing', `npm has no ${PACKAGE_NAME}@${tag}.`, {
|
|
99
|
+
hint: `Pick the other channel with --tag ${tag === 'dev' ? 'latest' : 'dev'}.`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (semverValid(from) && semverEq(target, from)) {
|
|
103
|
+
return { from, outcome: 'current', tag, to: from };
|
|
104
|
+
}
|
|
105
|
+
const downgrade = semverValid(from) !== null && semverLt(target, from);
|
|
106
|
+
if (downgrade && !options.allowDowngrade) {
|
|
107
|
+
throw new UpgradeError('downgrade_refused', `${PACKAGE_NAME}@${tag} is ${target}, older than this CLI's ${from}; nothing was installed.`, {
|
|
108
|
+
command: `${UPGRADE_COMMAND} --tag ${tag} --allow-downgrade`,
|
|
109
|
+
hint: 'Add --allow-downgrade to install it anyway.',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// The version just compared, not the tag, which may move before npm resolves it.
|
|
113
|
+
const exact = `${PACKAGE_NAME}@${target}`;
|
|
114
|
+
deps.progress(`Installing ${exact}...`);
|
|
115
|
+
const installed = await deps.npmInstall(exact);
|
|
116
|
+
if (installed.code !== 0) {
|
|
117
|
+
const output = tail(installed.output);
|
|
118
|
+
throw new UpgradeError('install_failed', `npm couldn't install ${exact}${installed.code === null ? ' (it was stopped)' : ` (exit ${String(installed.code)})`}.${output ? `\n${output}` : ''}`, { command: npmInstallCommand(target) });
|
|
119
|
+
}
|
|
120
|
+
// npm can succeed and leave this copy alone: one nested in another global package's node_modules.
|
|
121
|
+
const to = deps.installedVersion();
|
|
122
|
+
if (to !== target) {
|
|
123
|
+
throw new UpgradeError('install_failed', `npm installed ${exact}, but this atk (${deps.cliPath}) still reads ${to}: it isn't the copy npm replaced.`, { command: npmInstallCommand(target), hint: 'Run `atk --version` to see which copy is on your PATH.' });
|
|
124
|
+
}
|
|
125
|
+
return { from, outcome: downgrade ? 'downgraded' : 'upgraded', tag, to };
|
|
126
|
+
}
|
|
127
|
+
function notGlobal(message, manual) {
|
|
128
|
+
return new UpgradeError('not_npm_global', `${message} Nothing was installed.`, {
|
|
129
|
+
command: manual,
|
|
130
|
+
hint: 'atk upgrade only replaces an npm global install. Under npx or a linked checkout, run the npm command; with pnpm, yarn or bun, upgrade the package with that tool.',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** What an npm argument may hold: flags and package specs, nothing a shell would read (`&`, `^`, `%`, quotes). */
|
|
134
|
+
const SAFE_NPM_ARG = /^[\w@./:+-]+$/;
|
|
135
|
+
/**
|
|
136
|
+
* npm, with its output captured. On Windows npm is `npm.cmd`, which only a shell starts, so the
|
|
137
|
+
* command goes as one quoted line, and an argument a shell could read otherwise is refused.
|
|
138
|
+
*/
|
|
139
|
+
function runNpm(args, timeoutMs) {
|
|
140
|
+
const unsafe = args.find((a) => !SAFE_NPM_ARG.test(a));
|
|
141
|
+
if (unsafe !== undefined) {
|
|
142
|
+
return Promise.resolve({ code: null, output: `refused an npm argument a shell could read: ${unsafe}`, stdout: '' });
|
|
143
|
+
}
|
|
144
|
+
return new Promise((resolve) => {
|
|
145
|
+
const onWindows = process.platform === 'win32';
|
|
146
|
+
const stdio = ['ignore', 'pipe', 'pipe'];
|
|
147
|
+
const child = onWindows
|
|
148
|
+
? spawn(['npm', ...args.map((a) => `"${a}"`)].join(' '), [], { shell: true, stdio, windowsHide: true })
|
|
149
|
+
: spawn('npm', [...args], { stdio, windowsHide: true });
|
|
150
|
+
let output = '';
|
|
151
|
+
let stdout = '';
|
|
152
|
+
let timedOut = false;
|
|
153
|
+
child.stdout.on('data', (chunk) => {
|
|
154
|
+
stdout += chunk.toString();
|
|
155
|
+
output += chunk.toString();
|
|
156
|
+
});
|
|
157
|
+
child.stderr.on('data', (chunk) => (output += chunk.toString()));
|
|
158
|
+
const timer = setTimeout(() => {
|
|
159
|
+
timedOut = true;
|
|
160
|
+
if (onWindows && child.pid !== undefined) {
|
|
161
|
+
// Killing the shell alone would leave npm running; /T ends the tree.
|
|
162
|
+
spawn('taskkill', ['/pid', String(child.pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true }).on('error', () => { });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
child.kill();
|
|
166
|
+
}
|
|
167
|
+
}, timeoutMs);
|
|
168
|
+
child.on('error', (err) => {
|
|
169
|
+
clearTimeout(timer);
|
|
170
|
+
resolve({ code: null, output: `${output}${err.message}`, stdout });
|
|
171
|
+
});
|
|
172
|
+
child.on('close', (code) => {
|
|
173
|
+
clearTimeout(timer);
|
|
174
|
+
// taskkill /F leaves exit code 1 on Windows; a stopped npm reads the same on every platform.
|
|
175
|
+
resolve({ code: timedOut ? null : code, output, stdout });
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function tail(output) {
|
|
180
|
+
const trimmed = output.trim();
|
|
181
|
+
return trimmed.length > OUTPUT_TAIL_CHARS ? `…${trimmed.slice(-OUTPUT_TAIL_CHARS)}` : trimmed;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=self-upgrade.js.map
|