@ai-primitives-hub/app 0.0.1-alpha.1
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/README.md +26 -0
- package/dist/collection/generate-skill.d.ts +43 -0
- package/dist/collection/generate-skill.d.ts.map +1 -0
- package/dist/collection/generate-skill.js +244 -0
- package/dist/collection/generate-skill.js.map +1 -0
- package/dist/collection/index.d.ts +8 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +23 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/read-collection.d.ts +60 -0
- package/dist/collection/read-collection.d.ts.map +1 -0
- package/dist/collection/read-collection.js +291 -0
- package/dist/collection/read-collection.js.map +1 -0
- package/dist/context-detection/detector.d.ts +126 -0
- package/dist/context-detection/detector.d.ts.map +1 -0
- package/dist/context-detection/detector.js +408 -0
- package/dist/context-detection/detector.js.map +1 -0
- package/dist/context-detection/index.d.ts +11 -0
- package/dist/context-detection/index.d.ts.map +1 -0
- package/dist/context-detection/index.js +14 -0
- package/dist/context-detection/index.js.map +1 -0
- package/dist/context-detection/types.d.ts +74 -0
- package/dist/context-detection/types.d.ts.map +1 -0
- package/dist/context-detection/types.js +13 -0
- package/dist/context-detection/types.js.map +1 -0
- package/dist/discovery/index.d.ts +7 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +23 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/profile-generator.d.ts +31 -0
- package/dist/discovery/profile-generator.d.ts.map +1 -0
- package/dist/discovery/profile-generator.js +55 -0
- package/dist/discovery/profile-generator.js.map +1 -0
- package/dist/discovery/recommendation-engine.d.ts +76 -0
- package/dist/discovery/recommendation-engine.d.ts.map +1 -0
- package/dist/discovery/recommendation-engine.js +210 -0
- package/dist/discovery/recommendation-engine.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/install/index.d.ts +14 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +20 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/install-bundle.d.ts +31 -0
- package/dist/install/install-bundle.d.ts.map +1 -0
- package/dist/install/install-bundle.js +23 -0
- package/dist/install/install-bundle.js.map +1 -0
- package/dist/install/layout-resolver.d.ts +31 -0
- package/dist/install/layout-resolver.d.ts.map +1 -0
- package/dist/install/layout-resolver.js +70 -0
- package/dist/install/layout-resolver.js.map +1 -0
- package/dist/install/pipeline.d.ts +111 -0
- package/dist/install/pipeline.d.ts.map +1 -0
- package/dist/install/pipeline.js +138 -0
- package/dist/install/pipeline.js.map +1 -0
- package/dist/install/uninstall-bundle.d.ts +36 -0
- package/dist/install/uninstall-bundle.d.ts.map +1 -0
- package/dist/install/uninstall-bundle.js +37 -0
- package/dist/install/uninstall-bundle.js.map +1 -0
- package/dist/install/uninstall-pipeline.d.ts +119 -0
- package/dist/install/uninstall-pipeline.d.ts.map +1 -0
- package/dist/install/uninstall-pipeline.js +187 -0
- package/dist/install/uninstall-pipeline.js.map +1 -0
- package/dist/registry/activate-registry-profile.d.ts +67 -0
- package/dist/registry/activate-registry-profile.d.ts.map +1 -0
- package/dist/registry/activate-registry-profile.js +150 -0
- package/dist/registry/activate-registry-profile.js.map +1 -0
- package/dist/registry/create-source-adapter.d.ts +43 -0
- package/dist/registry/create-source-adapter.d.ts.map +1 -0
- package/dist/registry/create-source-adapter.js +53 -0
- package/dist/registry/create-source-adapter.js.map +1 -0
- package/dist/registry/deactivate-registry-profile.d.ts +38 -0
- package/dist/registry/deactivate-registry-profile.d.ts.map +1 -0
- package/dist/registry/deactivate-registry-profile.js +45 -0
- package/dist/registry/deactivate-registry-profile.js.map +1 -0
- package/dist/registry/detect-updates.d.ts +12 -0
- package/dist/registry/detect-updates.d.ts.map +1 -0
- package/dist/registry/detect-updates.js +76 -0
- package/dist/registry/detect-updates.js.map +1 -0
- package/dist/registry/hub-manager.d.ts +229 -0
- package/dist/registry/hub-manager.d.ts.map +1 -0
- package/dist/registry/hub-manager.js +473 -0
- package/dist/registry/hub-manager.js.map +1 -0
- package/dist/registry/index.d.ts +23 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +39 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/install-registry-bundle.d.ts +56 -0
- package/dist/registry/install-registry-bundle.d.ts.map +1 -0
- package/dist/registry/install-registry-bundle.js +150 -0
- package/dist/registry/install-registry-bundle.js.map +1 -0
- package/dist/registry/list-all-profiles.d.ts +27 -0
- package/dist/registry/list-all-profiles.d.ts.map +1 -0
- package/dist/registry/list-all-profiles.js +52 -0
- package/dist/registry/list-all-profiles.js.map +1 -0
- package/dist/registry/list-installed-bundles.d.ts +37 -0
- package/dist/registry/list-installed-bundles.d.ts.map +1 -0
- package/dist/registry/list-installed-bundles.js +27 -0
- package/dist/registry/list-installed-bundles.js.map +1 -0
- package/dist/registry/load-hub-sources.d.ts +56 -0
- package/dist/registry/load-hub-sources.d.ts.map +1 -0
- package/dist/registry/load-hub-sources.js +123 -0
- package/dist/registry/load-hub-sources.js.map +1 -0
- package/dist/registry/local-profile-crud.d.ts +58 -0
- package/dist/registry/local-profile-crud.d.ts.map +1 -0
- package/dist/registry/local-profile-crud.js +85 -0
- package/dist/registry/local-profile-crud.js.map +1 -0
- package/dist/registry/profile-lifecycle.d.ts +190 -0
- package/dist/registry/profile-lifecycle.d.ts.map +1 -0
- package/dist/registry/profile-lifecycle.js +400 -0
- package/dist/registry/profile-lifecycle.js.map +1 -0
- package/dist/registry/registry-settings.d.ts +32 -0
- package/dist/registry/registry-settings.d.ts.map +1 -0
- package/dist/registry/registry-settings.js +145 -0
- package/dist/registry/registry-settings.js.map +1 -0
- package/dist/registry/resolve-installation-bundle.d.ts +46 -0
- package/dist/registry/resolve-installation-bundle.d.ts.map +1 -0
- package/dist/registry/resolve-installation-bundle.js +98 -0
- package/dist/registry/resolve-installation-bundle.js.map +1 -0
- package/dist/registry/search-registry-bundles.d.ts +47 -0
- package/dist/registry/search-registry-bundles.d.ts.map +1 -0
- package/dist/registry/search-registry-bundles.js +129 -0
- package/dist/registry/search-registry-bundles.js.map +1 -0
- package/dist/registry/uninstall-installed-bundle.d.ts +48 -0
- package/dist/registry/uninstall-installed-bundle.d.ts.map +1 -0
- package/dist/registry/uninstall-installed-bundle.js +45 -0
- package/dist/registry/uninstall-installed-bundle.js.map +1 -0
- package/dist/registry/update-registry-bundle.d.ts +36 -0
- package/dist/registry/update-registry-bundle.d.ts.map +1 -0
- package/dist/registry/update-registry-bundle.js +113 -0
- package/dist/registry/update-registry-bundle.js.map +1 -0
- package/dist/registry/user-config-paths.d.ts +24 -0
- package/dist/registry/user-config-paths.d.ts.map +1 -0
- package/dist/registry/user-config-paths.js +82 -0
- package/dist/registry/user-config-paths.js.map +1 -0
- package/dist/registry/version-consolidator.d.ts +123 -0
- package/dist/registry/version-consolidator.d.ts.map +1 -0
- package/dist/registry/version-consolidator.js +231 -0
- package/dist/registry/version-consolidator.js.map +1 -0
- package/dist/search/export-profile.d.ts +63 -0
- package/dist/search/export-profile.d.ts.map +1 -0
- package/dist/search/export-profile.js +138 -0
- package/dist/search/export-profile.js.map +1 -0
- package/dist/search/index.d.ts +6 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +22 -0
- package/dist/search/index.js.map +1 -0
- package/dist/stores/index.d.ts +8 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/index.js +24 -0
- package/dist/stores/index.js.map +1 -0
- package/dist/stores/json-lockfile-store.d.ts +203 -0
- package/dist/stores/json-lockfile-store.d.ts.map +1 -0
- package/dist/stores/json-lockfile-store.js +277 -0
- package/dist/stores/json-lockfile-store.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +26 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/transformer-registry.d.ts +52 -0
- package/dist/transform/transformer-registry.d.ts.map +1 -0
- package/dist/transform/transformer-registry.js +53 -0
- package/dist/transform/transformer-registry.js.map +1 -0
- package/dist/transform/transformers/claude-code-transformer.d.ts +67 -0
- package/dist/transform/transformers/claude-code-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/claude-code-transformer.js +140 -0
- package/dist/transform/transformers/claude-code-transformer.js.map +1 -0
- package/dist/transform/transformers/kiro-transformer.d.ts +51 -0
- package/dist/transform/transformers/kiro-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/kiro-transformer.js +128 -0
- package/dist/transform/transformers/kiro-transformer.js.map +1 -0
- package/dist/transform/transformers/noop-transformer.d.ts +25 -0
- package/dist/transform/transformers/noop-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/noop-transformer.js +20 -0
- package/dist/transform/transformers/noop-transformer.js.map +1 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts +63 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/windsurf-transformer.js +125 -0
- package/dist/transform/transformers/windsurf-transformer.js.map +1 -0
- package/dist/update/auto-update.d.ts +84 -0
- package/dist/update/auto-update.d.ts.map +1 -0
- package/dist/update/auto-update.js +217 -0
- package/dist/update/auto-update.js.map +1 -0
- package/dist/update/check-updates.d.ts +51 -0
- package/dist/update/check-updates.d.ts.map +1 -0
- package/dist/update/check-updates.js +168 -0
- package/dist/update/check-updates.js.map +1 -0
- package/dist/update/index.d.ts +8 -0
- package/dist/update/index.d.ts.map +1 -0
- package/dist/update/index.js +24 -0
- package/dist/update/index.js.map +1 -0
- package/dist/update/log-event.d.ts +15 -0
- package/dist/update/log-event.d.ts.map +1 -0
- package/dist/update/log-event.js +11 -0
- package/dist/update/log-event.js.map +1 -0
- package/dist/writers/file-tree-writer.d.ts +136 -0
- package/dist/writers/file-tree-writer.d.ts.map +1 -0
- package/dist/writers/file-tree-writer.js +337 -0
- package/dist/writers/file-tree-writer.js.map +1 -0
- package/dist/writers/index.d.ts +7 -0
- package/dist/writers/index.d.ts.map +1 -0
- package/dist/writers/index.js +23 -0
- package/dist/writers/index.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-updates.d.ts","sourceRoot":"","sources":["../../src/registry/detect-updates.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,YAAY,EACZ,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,UAAU,EACX,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC,CAkDzB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectBundleUpdates = detectBundleUpdates;
|
|
4
|
+
/**
|
|
5
|
+
* Raw update detection — ported from the extension's
|
|
6
|
+
* `src/services/registry-manager.ts` (`RegistryManager.checkUpdates`).
|
|
7
|
+
* Compares each installed bundle's version against its source's latest
|
|
8
|
+
* known version, falling back to GitHub bundle-identity resolution when
|
|
9
|
+
* a versioned bundle ID is no longer directly resolvable (e.g. a
|
|
10
|
+
* source's cached bundle list has moved on to a newer version).
|
|
11
|
+
*
|
|
12
|
+
* Distinct from `../update/check-updates.ts`'s `UpdateCheckerCore`,
|
|
13
|
+
* which wraps *this* raw diff with caching and per-bundle preference
|
|
14
|
+
* enrichment: `RegistryManager.checkUpdates()` (the very method
|
|
15
|
+
* `UpdateCheckerCore` calls through its `registry: UpdateRegistryReader`
|
|
16
|
+
* port) is now a thin delegator to `detectBundleUpdates` below.
|
|
17
|
+
* @module registry/detect-updates
|
|
18
|
+
*/
|
|
19
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
20
|
+
/**
|
|
21
|
+
* Compare every installed bundle's version against its source's latest
|
|
22
|
+
* known version, returning only the ones that differ. Per-bundle
|
|
23
|
+
* failures (network errors, a bundle no longer resolvable at all) are
|
|
24
|
+
* logged and skipped rather than failing the whole check.
|
|
25
|
+
* @param ports - Read access to bundle details, sources, and installation records.
|
|
26
|
+
* @param onLog - Optional sink for diagnostic log events.
|
|
27
|
+
*/
|
|
28
|
+
async function detectBundleUpdates(ports, onLog) {
|
|
29
|
+
const log = (level, message, error) => {
|
|
30
|
+
onLog?.({ level, message, error });
|
|
31
|
+
};
|
|
32
|
+
log('info', 'Checking for bundle updates');
|
|
33
|
+
const installed = await ports.getInstalledBundles();
|
|
34
|
+
const updates = [];
|
|
35
|
+
for (const bundle of installed) {
|
|
36
|
+
try {
|
|
37
|
+
// Try to get bundle details, handling versioned IDs that may not exist in consolidated list
|
|
38
|
+
let latest;
|
|
39
|
+
try {
|
|
40
|
+
latest = await ports.getBundleDetails(bundle.bundleId);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
// If versioned ID not found, try extracting identity for GitHub bundles
|
|
44
|
+
const sources = await ports.listSources();
|
|
45
|
+
// Try both scopes to find the installed bundle
|
|
46
|
+
let installedBundle = await ports.getInstalledBundle(bundle.bundleId, 'user');
|
|
47
|
+
if (!installedBundle) {
|
|
48
|
+
installedBundle = await ports.getInstalledBundle(bundle.bundleId, 'workspace');
|
|
49
|
+
}
|
|
50
|
+
const source = sources.find((s) => s.id === installedBundle?.sourceId);
|
|
51
|
+
if (source?.type === 'github') {
|
|
52
|
+
const identity = (0, core_1.extractBundleIdentity)(bundle.bundleId, 'github');
|
|
53
|
+
log('debug', `Versioned bundle '${bundle.bundleId}' not found, trying identity '${identity}'`);
|
|
54
|
+
latest = await ports.getBundleDetails(identity);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw error; // Re-throw if not a GitHub bundle
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (latest.version !== bundle.version) {
|
|
61
|
+
updates.push({
|
|
62
|
+
bundleId: bundle.bundleId,
|
|
63
|
+
currentVersion: bundle.version,
|
|
64
|
+
latestVersion: latest.version
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
70
|
+
log('error', `Failed to check update for '${bundle.bundleId}'`, err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
log('info', `Found ${updates.length} bundle updates`);
|
|
74
|
+
return updates;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=detect-updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-updates.js","sourceRoot":"","sources":["../../src/registry/detect-updates.ts"],"names":[],"mappings":";;AAoCA,kDAqDC;AAzFD;;;;;;;;;;;;;;GAcG;AACH,kDAEiC;AAWjC;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,KAA4B,EAC5B,KAAkB;IAElB,MAAM,GAAG,GAAG,CAAC,KAAwB,EAAE,OAAe,EAAE,KAAa,EAAQ,EAAE;QAC7E,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,mBAAmB,EAAE,CAAC;IACpD,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,4FAA4F;YAC5F,IAAI,MAAc,CAAC;YACnB,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACzD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,wEAAwE;gBACxE,MAAM,OAAO,GAAG,MAAM,KAAK,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AC,CAAC,CAAC;YACtE,GAAG,CAAC,OAAO,EAAE,+BAA+B,MAAM,CAAC,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,GAAG,CAAC,MAAM,EAAE,SAAS,OAAO,CAAC,MAAM,iBAAiB,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HubManager (app) — CRUD + fetch/validate orchestration for hubs.
|
|
3
|
+
*
|
|
4
|
+
* Stages 1+3 of the staged strangler-fig port of the extension's
|
|
5
|
+
* `src/services/hub-manager.ts` (migration plan §7.5, HubManager
|
|
6
|
+
* item): Stage 1 — import / list / get / getActive / setActive /
|
|
7
|
+
* sync / delete a hub, plus availability probing. Stage 3 — favorited
|
|
8
|
+
* profiles (`isProfileFavorite`/`getFavoriteProfiles`/
|
|
9
|
+
* `toggleProfileFavorite`/`cleanupOrphanedFavorites`/
|
|
10
|
+
* `removeHubFavorites`). Deliberately excludes (ported in later
|
|
11
|
+
* stages):
|
|
12
|
+
* - source-loading/dedup into `RegistryManager` (Stage 2 — landed, see `load-hub-sources.ts`)
|
|
13
|
+
* - profile activation/deactivation + conflict detection (Stage 4)
|
|
14
|
+
* - the sync scheduler (Stage 5)
|
|
15
|
+
*
|
|
16
|
+
* Framework-agnostic by design (no `vscode.*`): the extension's own
|
|
17
|
+
* `HubManager` fires its existing `vscode.EventEmitter`-backed events
|
|
18
|
+
* itself, around calls into this class, rather than this class owning
|
|
19
|
+
* events (unlike the extension, this class has no listeners of its
|
|
20
|
+
* own to serve — it is also usable standalone from a future CLI).
|
|
21
|
+
* @module registry/hub-manager
|
|
22
|
+
*/
|
|
23
|
+
import type { HubConfig, HubProfile, HubReference, RegistrySource, ValidationResult } from '@ai-primitives-hub/core';
|
|
24
|
+
import type { ActiveHubStore, FavoritesStore, HubResolver, HubStore, LoadHubResult } from '@ai-primitives-hub/infra';
|
|
25
|
+
export interface HubInfo {
|
|
26
|
+
id: string;
|
|
27
|
+
config: HubConfig;
|
|
28
|
+
reference: HubReference;
|
|
29
|
+
}
|
|
30
|
+
export interface HubListItem {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
reference: HubReference;
|
|
35
|
+
}
|
|
36
|
+
export interface HubDetailInfo extends HubInfo {
|
|
37
|
+
metadata: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
lastModified: string;
|
|
41
|
+
size: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Dependencies for the app-layer `HubManager`.
|
|
46
|
+
*/
|
|
47
|
+
export interface HubManagerDeps {
|
|
48
|
+
store: HubStore;
|
|
49
|
+
activeStore: ActiveHubStore;
|
|
50
|
+
resolver: HubResolver;
|
|
51
|
+
favoritesStore: FavoritesStore;
|
|
52
|
+
/**
|
|
53
|
+
* Fully-composed validator (schema + runtime). Injected rather than
|
|
54
|
+
* built here since schema/AJV validation stays delivery-context
|
|
55
|
+
* code (the extension's `SchemaValidator`) for now.
|
|
56
|
+
*/
|
|
57
|
+
validateConfig: (config: HubConfig) => Promise<ValidationResult>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lib-side counterpart of the extension's `HubManager`, covering the
|
|
61
|
+
* CRUD + fetch/validate surface (Stage 1 of the staged port).
|
|
62
|
+
*/
|
|
63
|
+
export declare class HubManager {
|
|
64
|
+
private readonly deps;
|
|
65
|
+
/**
|
|
66
|
+
* Construct a HubManager instance.
|
|
67
|
+
* @param deps Store/resolver/validator dependencies.
|
|
68
|
+
*/
|
|
69
|
+
constructor(deps: HubManagerDeps);
|
|
70
|
+
private generateHubId;
|
|
71
|
+
private validateReference;
|
|
72
|
+
/**
|
|
73
|
+
* Import a hub from its reference. Persists the config; does not
|
|
74
|
+
* touch the active-hub pointer (mirrors the extension, which never
|
|
75
|
+
* auto-activates on import either).
|
|
76
|
+
* @param reference Hub reference (GitHub, URL, or local path).
|
|
77
|
+
* @param hubId Optional explicit id (auto-generated when omitted).
|
|
78
|
+
* @returns The persisted hub id.
|
|
79
|
+
*/
|
|
80
|
+
importHub(reference: HubReference, hubId?: string): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Load a hub from storage, re-validating it on the way out.
|
|
83
|
+
* @param hubId Hub identifier.
|
|
84
|
+
* @returns Loaded hub configuration and reference.
|
|
85
|
+
*/
|
|
86
|
+
loadHub(hubId: string): Promise<LoadHubResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Validate a hub configuration via the injected validator.
|
|
89
|
+
* @param config Hub configuration to validate.
|
|
90
|
+
* @returns Validation result.
|
|
91
|
+
*/
|
|
92
|
+
validateHub(config: HubConfig): Promise<ValidationResult>;
|
|
93
|
+
/**
|
|
94
|
+
* List every hub on disk (id + name + description + reference).
|
|
95
|
+
* @returns Hub list items; malformed hubs are skipped.
|
|
96
|
+
*/
|
|
97
|
+
listHubs(): Promise<HubListItem[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Delete a hub's storage entry. Callers that also need to clean up
|
|
100
|
+
* dependent resources (sources/profiles/favorites tied to the hub)
|
|
101
|
+
* are responsible for doing so themselves before calling this
|
|
102
|
+
* (mirrors the extension's own `cleanupHubResources` split).
|
|
103
|
+
* @param hubId Hub identifier to delete.
|
|
104
|
+
*/
|
|
105
|
+
deleteHub(hubId: string): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Re-fetch a hub's config from its recorded reference and persist
|
|
108
|
+
* the updated version.
|
|
109
|
+
* @param hubId Hub identifier to sync.
|
|
110
|
+
*/
|
|
111
|
+
syncHub(hubId: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Get detailed hub information, including sidecar metadata.
|
|
114
|
+
* @param hubId Hub identifier.
|
|
115
|
+
* @returns Hub information.
|
|
116
|
+
*/
|
|
117
|
+
getHubInfo(hubId: string): Promise<HubDetailInfo>;
|
|
118
|
+
/**
|
|
119
|
+
* Probe whether a hub reference is reachable, without importing it.
|
|
120
|
+
* Never throws.
|
|
121
|
+
* @param reference Hub reference to verify.
|
|
122
|
+
* @returns true iff the reference validates and the config fetch succeeds.
|
|
123
|
+
*/
|
|
124
|
+
verifyHubAvailability(reference: HubReference): Promise<boolean>;
|
|
125
|
+
/**
|
|
126
|
+
* Get the id of the currently active hub.
|
|
127
|
+
* @returns Active hub id, or null if none is active.
|
|
128
|
+
*/
|
|
129
|
+
getActiveHubId(): Promise<string | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Get the currently active hub. Auto-clears a stale pointer (one
|
|
132
|
+
* referencing a hub that no longer exists) and returns null.
|
|
133
|
+
* @returns Active hub info, or null if none is active.
|
|
134
|
+
*/
|
|
135
|
+
getActiveHub(): Promise<HubInfo | null>;
|
|
136
|
+
/**
|
|
137
|
+
* Get a single hub by id.
|
|
138
|
+
* @param hubId Hub identifier.
|
|
139
|
+
* @returns Hub info, or null when not found/malformed.
|
|
140
|
+
*/
|
|
141
|
+
getHub(hubId: string): Promise<HubInfo | null>;
|
|
142
|
+
/**
|
|
143
|
+
* Set the active hub. Throws when the hub is not on disk (unless
|
|
144
|
+
* `null` is passed to clear).
|
|
145
|
+
* @param hubId Hub id or null.
|
|
146
|
+
*/
|
|
147
|
+
setActiveHub(hubId: string | null): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Check if a profile is favorited.
|
|
150
|
+
* @param hubId Hub identifier.
|
|
151
|
+
* @param profileId Profile identifier.
|
|
152
|
+
* @returns true iff the profile is in that hub's favorites list.
|
|
153
|
+
*/
|
|
154
|
+
isProfileFavorite(hubId: string, profileId: string): Promise<boolean>;
|
|
155
|
+
/**
|
|
156
|
+
* Get every hub's favorited profiles.
|
|
157
|
+
* @returns Map of hub id to favorited profile ids.
|
|
158
|
+
*/
|
|
159
|
+
getFavoriteProfiles(): Promise<Record<string, string[]>>;
|
|
160
|
+
/**
|
|
161
|
+
* Toggle a profile's favorite status for a hub. Removes the hub's
|
|
162
|
+
* entry entirely once its favorites list becomes empty, rather than
|
|
163
|
+
* leaving a stale empty array around.
|
|
164
|
+
* @param hubId Hub identifier.
|
|
165
|
+
* @param profileId Profile identifier.
|
|
166
|
+
*/
|
|
167
|
+
toggleProfileFavorite(hubId: string, profileId: string): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Remove all favorited profiles for a single hub (e.g. on hub
|
|
170
|
+
* delete, or when switching the active hub away from it). Callers
|
|
171
|
+
* are responsible for their own event/logging side effects — see
|
|
172
|
+
* `deleteHub`'s doc for the rationale.
|
|
173
|
+
* @param hubId Hub identifier whose favorites should be cleared.
|
|
174
|
+
* @returns true iff that hub had any favorites to remove.
|
|
175
|
+
*/
|
|
176
|
+
removeHubFavorites(hubId: string): Promise<boolean>;
|
|
177
|
+
/**
|
|
178
|
+
* Remove favorites recorded against hubs that no longer exist on
|
|
179
|
+
* disk (stale data from hubs deleted before cleanup-on-delete
|
|
180
|
+
* existed). Callers are responsible for their own event/logging
|
|
181
|
+
* side effects, per hub id returned.
|
|
182
|
+
* @returns Ids of hubs whose orphaned favorites were removed.
|
|
183
|
+
*/
|
|
184
|
+
cleanupOrphanedFavorites(): Promise<string[]>;
|
|
185
|
+
/**
|
|
186
|
+
* Aggregate sources from a chosen hub (default: active).
|
|
187
|
+
* @param hubId Optional hub id; defaults to the active hub.
|
|
188
|
+
* @returns Sources (each decorated with its `hubId`), or an empty
|
|
189
|
+
* list when no hub id is given and none is active.
|
|
190
|
+
*/
|
|
191
|
+
listSources(hubId?: string): Promise<RegistrySource[]>;
|
|
192
|
+
/**
|
|
193
|
+
* List sources across **every** hub on disk (used by `source list`
|
|
194
|
+
* with no `--hub` filter). Each source carries its `hubId`.
|
|
195
|
+
* @returns Flattened source list; malformed hubs are skipped.
|
|
196
|
+
*/
|
|
197
|
+
listSourcesAcrossAllHubs(): Promise<RegistrySource[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Add a detached source, i.e. one not tied to any imported hub.
|
|
200
|
+
* Creates the synthetic `default-local` hub on first call.
|
|
201
|
+
* Replaces any existing source with the same id.
|
|
202
|
+
* @param source Source to add (its `hubId` is ignored — always set to `default-local`).
|
|
203
|
+
* @returns The persisted source.
|
|
204
|
+
*/
|
|
205
|
+
addDetachedSource(source: Omit<RegistrySource, 'hubId'>): Promise<RegistrySource>;
|
|
206
|
+
/**
|
|
207
|
+
* Remove a detached source from the default-local hub.
|
|
208
|
+
* @param sourceId Source id.
|
|
209
|
+
* @returns true iff a source was actually removed.
|
|
210
|
+
*/
|
|
211
|
+
removeDetachedSource(sourceId: string): Promise<boolean>;
|
|
212
|
+
/**
|
|
213
|
+
* Add a profile to a hub. Auto-creates the hub (e.g. `default-local`)
|
|
214
|
+
* if it doesn't exist yet. Replaces any existing profile with the
|
|
215
|
+
* same id.
|
|
216
|
+
* @param hubId Hub identifier.
|
|
217
|
+
* @param profile Profile to add.
|
|
218
|
+
* @returns The persisted profile.
|
|
219
|
+
*/
|
|
220
|
+
addProfile(hubId: string, profile: HubProfile): Promise<HubProfile>;
|
|
221
|
+
/**
|
|
222
|
+
* Remove a profile from a hub.
|
|
223
|
+
* @param hubId Hub identifier.
|
|
224
|
+
* @param profileId Profile identifier.
|
|
225
|
+
* @returns true iff a profile was actually removed.
|
|
226
|
+
*/
|
|
227
|
+
removeProfile(hubId: string, profileId: string): Promise<boolean>;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=hub-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-manager.d.ts","sourceRoot":"","sources":["../../src/registry/hub-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,QA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