@ai-primitives-hub/app 0.0.1-alpha.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/collection/read-collection.d.ts +3 -1
  2. package/dist/collection/read-collection.d.ts.map +1 -1
  3. package/dist/collection/read-collection.js +27 -2
  4. package/dist/collection/read-collection.js.map +1 -1
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/install/index.d.ts +2 -1
  10. package/dist/install/index.d.ts.map +1 -1
  11. package/dist/install/index.js +4 -1
  12. package/dist/install/index.js.map +1 -1
  13. package/dist/install/pipeline.d.ts +8 -0
  14. package/dist/install/pipeline.d.ts.map +1 -1
  15. package/dist/install/pipeline.js +3 -2
  16. package/dist/install/pipeline.js.map +1 -1
  17. package/dist/install/target-write.d.ts +77 -1
  18. package/dist/install/target-write.d.ts.map +1 -1
  19. package/dist/install/target-write.js +195 -0
  20. package/dist/install/target-write.js.map +1 -1
  21. package/dist/install/uninstall-pipeline.d.ts +1 -0
  22. package/dist/install/uninstall-pipeline.d.ts.map +1 -1
  23. package/dist/install/uninstall-pipeline.js +10 -4
  24. package/dist/install/uninstall-pipeline.js.map +1 -1
  25. package/dist/registry/create-source-adapter.d.ts +11 -1
  26. package/dist/registry/create-source-adapter.d.ts.map +1 -1
  27. package/dist/registry/create-source-adapter.js +37 -6
  28. package/dist/registry/create-source-adapter.js.map +1 -1
  29. package/dist/registry/hub-manager.d.ts +19 -0
  30. package/dist/registry/hub-manager.d.ts.map +1 -1
  31. package/dist/registry/hub-manager.js +58 -5
  32. package/dist/registry/hub-manager.js.map +1 -1
  33. package/dist/registry/index.d.ts +2 -0
  34. package/dist/registry/index.d.ts.map +1 -1
  35. package/dist/registry/index.js +2 -0
  36. package/dist/registry/index.js.map +1 -1
  37. package/dist/registry/load-hub-sources.d.ts +42 -8
  38. package/dist/registry/load-hub-sources.d.ts.map +1 -1
  39. package/dist/registry/load-hub-sources.js +198 -21
  40. package/dist/registry/load-hub-sources.js.map +1 -1
  41. package/dist/registry/profile-lifecycle.d.ts +5 -1
  42. package/dist/registry/profile-lifecycle.d.ts.map +1 -1
  43. package/dist/registry/profile-lifecycle.js +20 -2
  44. package/dist/registry/profile-lifecycle.js.map +1 -1
  45. package/dist/registry/remap-bundle-source.d.ts +33 -0
  46. package/dist/registry/remap-bundle-source.d.ts.map +1 -0
  47. package/dist/registry/remap-bundle-source.js +66 -0
  48. package/dist/registry/remap-bundle-source.js.map +1 -0
  49. package/dist/registry/resolve-install-source.d.ts +52 -0
  50. package/dist/registry/resolve-install-source.d.ts.map +1 -0
  51. package/dist/registry/resolve-install-source.js +126 -0
  52. package/dist/registry/resolve-install-source.js.map +1 -0
  53. package/dist/registry/source-sync-queue.d.ts +8 -1
  54. package/dist/registry/source-sync-queue.d.ts.map +1 -1
  55. package/dist/registry/source-sync-queue.js +24 -5
  56. package/dist/registry/source-sync-queue.js.map +1 -1
  57. package/dist/registry/user-config-paths.d.ts.map +1 -1
  58. package/dist/registry/user-config-paths.js +5 -7
  59. package/dist/registry/user-config-paths.js.map +1 -1
  60. package/dist/release/index.d.ts +6 -0
  61. package/dist/release/index.d.ts.map +1 -0
  62. package/dist/release/index.js +22 -0
  63. package/dist/release/index.js.map +1 -0
  64. package/dist/release/plan-bundle-release.d.ts +33 -0
  65. package/dist/release/plan-bundle-release.d.ts.map +1 -0
  66. package/dist/release/plan-bundle-release.js +42 -0
  67. package/dist/release/plan-bundle-release.js.map +1 -0
  68. package/dist/replicate/replicate.d.ts +20 -0
  69. package/dist/replicate/replicate.d.ts.map +1 -0
  70. package/dist/replicate/replicate.js +122 -0
  71. package/dist/replicate/replicate.js.map +1 -0
  72. package/dist/search/build-index.d.ts +11 -0
  73. package/dist/search/build-index.d.ts.map +1 -1
  74. package/dist/search/build-index.js +170 -9
  75. package/dist/search/build-index.js.map +1 -1
  76. package/dist/search/bundle-search-keys.d.ts +37 -0
  77. package/dist/search/bundle-search-keys.d.ts.map +1 -1
  78. package/dist/search/bundle-search-keys.js +73 -7
  79. package/dist/search/bundle-search-keys.js.map +1 -1
  80. package/dist/search/search-index.d.ts.map +1 -1
  81. package/dist/search/search-index.js +10 -0
  82. package/dist/search/search-index.js.map +1 -1
  83. package/dist/search/search-profile.d.ts +19 -0
  84. package/dist/search/search-profile.d.ts.map +1 -1
  85. package/dist/search/search-profile.js +4 -2
  86. package/dist/search/search-profile.js.map +1 -1
  87. package/dist/stores/json-lockfile-store.d.ts +29 -2
  88. package/dist/stores/json-lockfile-store.d.ts.map +1 -1
  89. package/dist/stores/json-lockfile-store.js +37 -4
  90. package/dist/stores/json-lockfile-store.js.map +1 -1
  91. package/dist/writers/file-tree-writer.d.ts +39 -12
  92. package/dist/writers/file-tree-writer.d.ts.map +1 -1
  93. package/dist/writers/file-tree-writer.js +238 -68
  94. package/dist/writers/file-tree-writer.js.map +1 -1
  95. package/package.json +7 -6
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Resolve the `--source` value of `install <bundle-id> --source <value>`
3
+ * to a configured hub source.
4
+ *
5
+ * `--source` names a hub id in list/interactive mode, but a remote install
6
+ * historically treated it only as a GitHub `owner/repo` slug. This use case
7
+ * lets the remote path accept the same names the rest of the CLI prints:
8
+ * a source id (or name) in the active hub first, then a hub id (whose
9
+ * profiles say which source carries the bundle). The caller falls back to
10
+ * the `owner/repo` interpretation when nothing matches.
11
+ * @module registry/resolve-install-source
12
+ */
13
+ import { type HubConfig, type RegistrySource } from '@ai-primitives-hub/core';
14
+ /**
15
+ * Hub read access needed by {@link resolveInstallSource}; satisfied by
16
+ * `HubManager`.
17
+ */
18
+ export interface InstallSourceHubs {
19
+ getActiveHubId(): Promise<string | null>;
20
+ /** Whether the hub's config is on disk (malformed or not). */
21
+ hasHub(hubId: string): Promise<boolean>;
22
+ getHub(hubId: string): Promise<{
23
+ id: string;
24
+ config: HubConfig;
25
+ } | null>;
26
+ listSources(hubId?: string): Promise<RegistrySource[]>;
27
+ }
28
+ /**
29
+ * Resolve an install `--source` value to a hub source: first as a source
30
+ * id (or name) in the active hub, then as a hub id.
31
+ * @param hubs Hub read access (e.g. `HubManager`).
32
+ * @param value `--source` value from the command line.
33
+ * @param bundleId Bundle id being installed (used for the hub-id lookup).
34
+ * @returns The resolved source, or null when neither lookup matches.
35
+ * @throws {RegistryError} `HUB.LOAD_FAILED` when nothing matched and the
36
+ * active hub (or the hub named by `value`) exists but its configuration
37
+ * could not be loaded — the match may be hiding in it.
38
+ */
39
+ export declare function resolveInstallSource(hubs: InstallSourceHubs, value: string, bundleId: string): Promise<RegistrySource | null>;
40
+ /**
41
+ * The `owner/repo` slug of a GitHub source, used to match hub bundle ids
42
+ * of the form `{owner}-{repo}-{name}` against the bundle's manifest.
43
+ * @param source Registry source or lockfile source entry (`type` + `url`).
44
+ * @param source.type
45
+ * @param source.url
46
+ * @returns The slug, or undefined for non-GitHub or unparsable sources.
47
+ */
48
+ export declare function githubRepoSlugForSource(source: {
49
+ type: string;
50
+ url: string;
51
+ }): string | undefined;
52
+ //# sourceMappingURL=resolve-install-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-install-source.d.ts","sourceRoot":"","sources":["../../src/registry/resolve-install-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAKjC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,8DAA8D;IAC9D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACzE,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACxD;AAqFD;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAehC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAUjG"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveInstallSource = resolveInstallSource;
4
+ exports.githubRepoSlugForSource = githubRepoSlugForSource;
5
+ /**
6
+ * Resolve the `--source` value of `install <bundle-id> --source <value>`
7
+ * to a configured hub source.
8
+ *
9
+ * `--source` names a hub id in list/interactive mode, but a remote install
10
+ * historically treated it only as a GitHub `owner/repo` slug. This use case
11
+ * lets the remote path accept the same names the rest of the CLI prints:
12
+ * a source id (or name) in the active hub first, then a hub id (whose
13
+ * profiles say which source carries the bundle). The caller falls back to
14
+ * the `owner/repo` interpretation when nothing matches.
15
+ * @module registry/resolve-install-source
16
+ */
17
+ const core_1 = require("@ai-primitives-hub/core");
18
+ const infra_1 = require("@ai-primitives-hub/infra");
19
+ const matchesSource = (source, value) => source.id === value || source.name === value;
20
+ /**
21
+ * List a hub's sources. A hub that is not on disk has none; a hub that
22
+ * is on disk but fails to load is recorded in `failures` so the caller
23
+ * can report it instead of a bare "not found".
24
+ * @param hubs Hub read access.
25
+ * @param hubId Hub to read.
26
+ * @param failures Load failures collected so far.
27
+ * @returns The sources, or null when the hub is missing or unreadable.
28
+ */
29
+ const loadHubSources = async (hubs, hubId, failures) => {
30
+ if (!(await hubs.hasHub(hubId))) {
31
+ return null;
32
+ }
33
+ try {
34
+ return await hubs.listSources(hubId);
35
+ }
36
+ catch (cause) {
37
+ failures.push({ hubId, cause });
38
+ return null;
39
+ }
40
+ };
41
+ /**
42
+ * Look `value` up as a source id/name in the active hub.
43
+ * @param hubs Hub read access.
44
+ * @param value `--source` value.
45
+ * @param failures Load failures collected so far.
46
+ * @returns Matching source, or null.
47
+ */
48
+ const findActiveHubSource = async (hubs, value, failures) => {
49
+ const activeHubId = await hubs.getActiveHubId();
50
+ if (activeHubId === null) {
51
+ return null;
52
+ }
53
+ const sources = await loadHubSources(hubs, activeHubId, failures);
54
+ return sources?.find((source) => matchesSource(source, value)) ?? null;
55
+ };
56
+ /**
57
+ * Look `value` up as a hub id; pick the source its profiles name for
58
+ * `bundleId`, or its only source when no profile names the bundle.
59
+ * @param hubs Hub read access.
60
+ * @param value `--source` value.
61
+ * @param bundleId Bundle id being installed.
62
+ * @param failures Load failures collected so far.
63
+ * @returns Matching source, or null.
64
+ */
65
+ const findHubSource = async (hubs, value, bundleId, failures) => {
66
+ const sources = await loadHubSources(hubs, value, failures);
67
+ const hub = sources === null ? null : await hubs.getHub(value);
68
+ if (sources === null || hub === null) {
69
+ return null;
70
+ }
71
+ const profileBundle = hub.config.profiles
72
+ .flatMap((profile) => profile.bundles)
73
+ .find((bundle) => bundle.id === bundleId);
74
+ if (profileBundle !== undefined) {
75
+ return sources.find((source) => matchesSource(source, profileBundle.source)) ?? null;
76
+ }
77
+ return sources.length === 1 ? sources[0] : null;
78
+ };
79
+ /**
80
+ * Resolve an install `--source` value to a hub source: first as a source
81
+ * id (or name) in the active hub, then as a hub id.
82
+ * @param hubs Hub read access (e.g. `HubManager`).
83
+ * @param value `--source` value from the command line.
84
+ * @param bundleId Bundle id being installed (used for the hub-id lookup).
85
+ * @returns The resolved source, or null when neither lookup matches.
86
+ * @throws {RegistryError} `HUB.LOAD_FAILED` when nothing matched and the
87
+ * active hub (or the hub named by `value`) exists but its configuration
88
+ * could not be loaded — the match may be hiding in it.
89
+ */
90
+ async function resolveInstallSource(hubs, value, bundleId) {
91
+ const failures = [];
92
+ const match = await findActiveHubSource(hubs, value, failures)
93
+ ?? await findHubSource(hubs, value, bundleId, failures);
94
+ if (match !== null || failures.length === 0) {
95
+ return match;
96
+ }
97
+ const { hubId, cause } = failures[0];
98
+ throw new core_1.RegistryError({
99
+ code: 'HUB.LOAD_FAILED',
100
+ message: `hub "${hubId}" configuration could not be loaded while resolving --source "${value}": ${cause instanceof Error ? cause.message : String(cause)}`,
101
+ hint: `Fix the hub configuration, or re-import it with \`ai-primitives-hub hub sync ${hubId}\`.`,
102
+ cause,
103
+ context: { hubId, source: value }
104
+ });
105
+ }
106
+ /**
107
+ * The `owner/repo` slug of a GitHub source, used to match hub bundle ids
108
+ * of the form `{owner}-{repo}-{name}` against the bundle's manifest.
109
+ * @param source Registry source or lockfile source entry (`type` + `url`).
110
+ * @param source.type
111
+ * @param source.url
112
+ * @returns The slug, or undefined for non-GitHub or unparsable sources.
113
+ */
114
+ function githubRepoSlugForSource(source) {
115
+ if (source.type !== 'github') {
116
+ return undefined;
117
+ }
118
+ try {
119
+ const target = (0, infra_1.parseGitHubRepositoryTarget)(source.url);
120
+ return `${target.owner}/${target.repository}`;
121
+ }
122
+ catch {
123
+ return undefined;
124
+ }
125
+ }
126
+ //# sourceMappingURL=resolve-install-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-install-source.js","sourceRoot":"","sources":["../../src/registry/resolve-install-source.ts"],"names":[],"mappings":";;AA+HA,oDAmBC;AAUD,0DAUC;AAtKD;;;;;;;;;;;GAWG;AACH,kDAIiC;AACjC,oDAEkC;AAoBlC,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAE,KAAa,EAAW,EAAE,CACvE,MAAM,CAAC,EAAE,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,c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,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC1J,IAAI,EAAE,gFAAgF,KAAK,KAAK;QAChG,KAAK;QACL,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;KAClC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,MAAqC;IAC3E,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,mCAA2B,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvD,OAAO,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -4,6 +4,12 @@ export interface SourceSyncQueue {
4
4
  onIdle: () => Promise<void>;
5
5
  onFirstSettled: () => Promise<void>;
6
6
  }
7
+ /**
8
+ * Normalize a caller-provided concurrency limit to a usable queue size.
9
+ * @param concurrency Requested concurrency limit.
10
+ * @returns A finite integer of at least one.
11
+ */
12
+ export declare function normalizeConcurrency(concurrency: number): number;
7
13
  /**
8
14
  * Creates a bounded-concurrency queue that syncs sources via the provided
9
15
  * `syncSource` callback.
@@ -17,6 +23,7 @@ export interface SourceSyncQueue {
17
23
  * empty. Also resolves immediately when the queue is already idle.
18
24
  * @param syncSource
19
25
  * @param concurrency
26
+ * @param onError
20
27
  */
21
- export declare function createSourceSyncQueue(syncSource: (sourceId: string) => Promise<void>, concurrency: number): SourceSyncQueue;
28
+ export declare function createSourceSyncQueue(syncSource: (sourceId: string) => Promise<void>, concurrency: number, onError?: (sourceId: string, error: Error) => void): SourceSyncQueue;
22
29
  //# sourceMappingURL=source-sync-queue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-sync-queue.d.ts","sourceRoot":"","sources":["../../src/registry/source-sync-queue.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/C,WAAW,EAAE,MAAM,GAClB,eAAe,CA8DjB"}
1
+ {"version":3,"file":"source-sync-queue.d.ts","sourceRoot":"","sources":["../../src/registry/source-sync-queue.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,GACjD,eAAe,CAoEjB"}
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeConcurrency = normalizeConcurrency;
3
4
  exports.createSourceSyncQueue = createSourceSyncQueue;
5
+ /**
6
+ * Normalize a caller-provided concurrency limit to a usable queue size.
7
+ * @param concurrency Requested concurrency limit.
8
+ * @returns A finite integer of at least one.
9
+ */
10
+ function normalizeConcurrency(concurrency) {
11
+ return Number.isFinite(concurrency) && concurrency > 0
12
+ ? Math.max(1, Math.floor(concurrency))
13
+ : 1;
14
+ }
4
15
  /**
5
16
  * Creates a bounded-concurrency queue that syncs sources via the provided
6
17
  * `syncSource` callback.
@@ -14,8 +25,10 @@ exports.createSourceSyncQueue = createSourceSyncQueue;
14
25
  * empty. Also resolves immediately when the queue is already idle.
15
26
  * @param syncSource
16
27
  * @param concurrency
28
+ * @param onError
17
29
  */
18
- function createSourceSyncQueue(syncSource, concurrency) {
30
+ function createSourceSyncQueue(syncSource, concurrency, onError) {
31
+ const normalizedConcurrency = normalizeConcurrency(concurrency);
19
32
  const pending = [];
20
33
  const idleResolvers = [];
21
34
  const firstSettledResolvers = [];
@@ -36,9 +49,15 @@ function createSourceSyncQueue(syncSource, concurrency) {
36
49
  };
37
50
  const startSync = (sourceId) => {
38
51
  activeSyncs++;
39
- // .catch() prevents unhandled rejections — callers are expected to handle
40
- // errors inside their syncSource callback, but any leak is silenced here.
41
- void syncSource(sourceId).catch(() => undefined).finally(() => {
52
+ void syncSource(sourceId).catch((error) => {
53
+ const normalizedError = error instanceof Error ? error : new Error(String(error));
54
+ try {
55
+ onError?.(sourceId, normalizedError);
56
+ }
57
+ catch {
58
+ return;
59
+ }
60
+ }).finally(() => {
42
61
  activeSyncs--;
43
62
  startAvailableSyncs();
44
63
  resolveFirstSettled();
@@ -46,7 +65,7 @@ function createSourceSyncQueue(syncSource, concurrency) {
46
65
  });
47
66
  };
48
67
  const startAvailableSyncs = () => {
49
- while (activeSyncs < concurrency && pending.length > 0) {
68
+ while (activeSyncs < normalizedConcurrency && pending.length > 0) {
50
69
  startSync(pending.shift());
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1 +1 @@
1
- {"version":3,"file":"user-config-paths.d.ts","sourceRoot":"","sources":["../../src/registry/user-config-paths.ts"],"names":[],"mappings":"AA8BA,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,eAWhF,CAAC"}
1
+ {"version":3,"file":"user-config-paths.d.ts","sourceRoot":"","sources":["../../src/registry/user-config-paths.ts"],"names":[],"mappings":"AA4BA,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,eAWhF,CAAC"}
@@ -46,13 +46,11 @@ exports.resolveUserConfigPaths = void 0;
46
46
  * (ADR-0005 decision 2's shared resolver) rather than re-implementing
47
47
  * `XDG_CONFIG_HOME`/`~/.config` fallback logic inline as the reference
48
48
  * branch's own version of this file does — avoids reintroducing the
49
- * exact duplication that resolver was created to consolidate. One
50
- * behavioral difference from the reference's own inline version: the
51
- * no-`XDG_CONFIG_HOME` fallback is `os.homedir()` (via `xdgConfigDir`),
52
- * not `env.HOME`/`env.USERPROFILE` — matching every other XDG-based path
53
- * in this codebase (e.g. the harvest cache dir) rather than diverging
54
- * from them; a caller wanting a fully-hermetic override should still set
55
- * `XDG_CONFIG_HOME` itself, which both approaches honour identically.
49
+ * exact duplication that resolver was created to consolidate. The
50
+ * no-`XDG_CONFIG_HOME` fallback is the env's own home (`HOME`, or
51
+ * `USERPROFILE` on Windows) via `xdgConfigDir`, then `os.homedir()` —
52
+ * the same rule as every other XDG-based path in this codebase (e.g. the
53
+ * harvest cache dir).
56
54
  * All artifact names here are the CLI's own, not-yet-released state
57
55
  * (rebranded per migration plan §8 decision 3 — `prompt-registry` ->
58
56
  * `ai-primitives-hub`); this is unrelated to, and does not rename, the
@@ -1 +1 @@
1
- {"version":3,"file":"user-config-paths.js","sourceRoot":"","sources":["../../src/registry/user-config-paths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,gDAAkC;AAClC,oDAEkC;AAoBlC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAuC,EAAmB,EAAE;IACjG,MAAM,IAAI,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IAC/B,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QAC7B,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC;QAC1D,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC;QAC7C,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QAC3C,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACpC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,6BAA6B,CAAC;KAC7D,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
1
+ {"version":3,"file":"user-config-paths.js","sourceRoot":"","sources":["../../src/registry/user-config-paths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,gDAAkC;AAClC,oDAEkC;AAoBlC;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAuC,EAAmB,EAAE;IACjG,MAAM,IAAI,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IAC/B,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QAC7B,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC;QAC1D,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC;QAC7C,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QAC3C,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACpC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,6BAA6B,CAAC;KAC7D,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Release use-cases: planning `bundle build` release archives.
3
+ * @module app/release
4
+ */
5
+ export * from './plan-bundle-release';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Release use-cases: planning `bundle build` release archives.
19
+ * @module app/release
20
+ */
21
+ __exportStar(require("./plan-bundle-release"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/release/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,wDAAsC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `bundle build` release planning use case.
3
+ *
4
+ * Plans the governed release from the committed revision and, only when
5
+ * that revision carries no license evidence, falls back to the legacy
6
+ * working-tree release with a warning. The fallback rule and warning text
7
+ * live in core (`isMissingSourceLicenseError`, `LEGACY_RELEASE_WARNING`).
8
+ * @module release/plan-bundle-release
9
+ */
10
+ import { type ReleaseManifestPlan, type ReleaseSourceReader } from '@ai-primitives-hub/core';
11
+ /** Inputs for {@link planBundleRelease}. */
12
+ export interface PlanBundleReleaseOptions {
13
+ /** Absolute repository root. */
14
+ repoRoot: string;
15
+ /** Collection file, repo-relative or absolute under `repoRoot`. */
16
+ collectionFile: string;
17
+ version: string;
18
+ /** Source reader; defaults to {@link NodeReleaseSourceReader}. */
19
+ sources?: ReleaseSourceReader;
20
+ }
21
+ /** A release plan and the warnings raised while planning it. */
22
+ export interface BundleReleasePlan {
23
+ plan: ReleaseManifestPlan;
24
+ warnings: string[];
25
+ }
26
+ /**
27
+ * Plan the release archive for one collection.
28
+ * @param options - Planning inputs.
29
+ * @returns The governed plan, or the legacy plan plus {@link LEGACY_RELEASE_WARNING}.
30
+ * Rejects with any planning failure other than missing license evidence.
31
+ */
32
+ export declare function planBundleRelease(options: PlanBundleReleaseOptions): Promise<BundleReleasePlan>;
33
+ //# sourceMappingURL=plan-bundle-release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-bundle-release.d.ts","sourceRoot":"","sources":["../../src/release/plan-bundle-release.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAKjC,4CAA4C;AAC5C,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmBrG"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planBundleRelease = planBundleRelease;
4
+ /**
5
+ * `bundle build` release planning use case.
6
+ *
7
+ * Plans the governed release from the committed revision and, only when
8
+ * that revision carries no license evidence, falls back to the legacy
9
+ * working-tree release with a warning. The fallback rule and warning text
10
+ * live in core (`isMissingSourceLicenseError`, `LEGACY_RELEASE_WARNING`).
11
+ * @module release/plan-bundle-release
12
+ */
13
+ const core_1 = require("@ai-primitives-hub/core");
14
+ const infra_1 = require("@ai-primitives-hub/infra");
15
+ /**
16
+ * Plan the release archive for one collection.
17
+ * @param options - Planning inputs.
18
+ * @returns The governed plan, or the legacy plan plus {@link LEGACY_RELEASE_WARNING}.
19
+ * Rejects with any planning failure other than missing license evidence.
20
+ */
21
+ async function planBundleRelease(options) {
22
+ const sources = options.sources ?? new infra_1.NodeReleaseSourceReader();
23
+ const planOptions = {
24
+ repoRoot: options.repoRoot,
25
+ collectionFile: options.collectionFile,
26
+ version: options.version
27
+ };
28
+ const warnings = [];
29
+ let plan;
30
+ try {
31
+ plan = await (0, core_1.createReleaseManifestPlan)(planOptions, sources);
32
+ }
33
+ catch (err) {
34
+ if (!(0, core_1.isMissingSourceLicenseError)(err)) {
35
+ throw err;
36
+ }
37
+ plan = await (0, core_1.createLegacyReleaseManifestPlan)(planOptions, sources);
38
+ warnings.push(core_1.LEGACY_RELEASE_WARNING);
39
+ }
40
+ return { plan, warnings };
41
+ }
42
+ //# sourceMappingURL=plan-bundle-release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-bundle-release.js","sourceRoot":"","sources":["../../src/release/plan-bundle-release.ts"],"names":[],"mappings":";;AA4CA,8CAmBC;AA/DD;;;;;;;;GAQG;AACH,kDAOiC;AACjC,oDAEkC;AAmBlC;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAAiC;IACvE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,+BAAuB,EAAE,CAAC;IACjE,MAAM,WAAW,GAAG;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;IACF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,IAAyB,CAAC;IAC9B,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,IAAA,gCAAyB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAA,kCAA2B,EAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,IAAI,GAAG,MAAM,IAAA,sCAA+B,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACnE,QAAQ,CAAC,IAAI,CAAC,6BAAsB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ReplicationPublisherPort, ReplicationResult, ReplicationSourcePort } from '@ai-primitives-hub/core';
2
+ export interface ReplicateOptions {
3
+ sourceHub: string;
4
+ sourceRef: string;
5
+ targetRoot: string;
6
+ mode: 'latest' | 'all';
7
+ publish?: boolean;
8
+ allowUnverifiedExisting?: boolean;
9
+ workers?: number;
10
+ targetAuth?: 'anonymous' | 'bearer';
11
+ targetCredentialRef?: string;
12
+ }
13
+ /**
14
+ *
15
+ * @param options
16
+ * @param source
17
+ * @param publisher
18
+ */
19
+ export declare function replicateHub(options: ReplicateOptions, source: ReplicationSourcePort, publisher?: ReplicationPublisherPort): Promise<ReplicationResult>;
20
+ //# sourceMappingURL=replicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicate.d.ts","sourceRoot":"","sources":["../../src/replicate/replicate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AASD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,SAAS,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAsF7J"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replicateHub = replicateHub;
4
+ /* eslint-disable @stylistic/max-len, @stylistic/max-statements-per-line, @typescript-eslint/no-base-to-string, jsdoc/require-description -- orchestration adapter */
5
+ const node_crypto_1 = require("node:crypto");
6
+ const core_1 = require("@ai-primitives-hub/core");
7
+ const REPLICATED_SOURCE_PATH = 'sources/replicated';
8
+ const sha256 = (data) => (0, node_crypto_1.createHash)('sha256').update(data).digest('hex');
9
+ const sourceUrl = (source) => String(source.url ?? '');
10
+ const repoFromUrl = (url) => {
11
+ const value = url.replace(/^https?:\/\/github\.com\//, '').replace(/\.git$/, '').replace(/^\/+|\/+$/g, '');
12
+ const [owner, repo] = value.split('/');
13
+ if (!owner || !repo || value.includes('?') || value.includes('#')) {
14
+ throw new Error(`Invalid GitHub source URL: ${url}`);
15
+ }
16
+ return { owner, repo };
17
+ };
18
+ /**
19
+ *
20
+ * @param options
21
+ * @param source
22
+ * @param publisher
23
+ */
24
+ async function replicateHub(options, source, publisher) {
25
+ const raw = await source.getHubConfig(options.sourceHub, options.sourceRef);
26
+ const configuredSources = Array.isArray(raw.sources) ? raw.sources : [];
27
+ const enabled = configuredSources.filter((item) => {
28
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
29
+ return false;
30
+ }
31
+ const sourceRecord = item;
32
+ return sourceRecord.enabled !== false && sourceRecord.type === 'github' && typeof sourceRecord.id === 'string';
33
+ });
34
+ const groups = [];
35
+ const workers = Math.max(1, Math.floor(options.workers ?? 4));
36
+ for (let offset = 0; offset < enabled.length; offset += workers) {
37
+ const batch = enabled.slice(offset, offset + workers);
38
+ groups.push(...await Promise.all(batch.map(async (item) => {
39
+ const repo = repoFromUrl(sourceUrl(item));
40
+ return source.listReleaseCandidates(repo.owner, repo.repo, String(item.id));
41
+ })));
42
+ }
43
+ const candidates = groups.flatMap((group) => group.candidates);
44
+ const selection = (0, core_1.selectReplications)(candidates, (0, core_1.requestsFromHubConfig)(raw), options.mode);
45
+ const warnings = groups.flatMap((group) => group.warnings);
46
+ const entries = [];
47
+ const verified = new Set();
48
+ for (const candidate of selection.selected) {
49
+ const manifestPath = `bundles/${candidate.bundleId}/${candidate.version}/deployment-manifest.yml`;
50
+ const archivePath = `bundles/${candidate.bundleId}/${candidate.version}/${candidate.bundleId}-${candidate.version}.zip`;
51
+ if (options.publish) {
52
+ if (!publisher) {
53
+ throw new Error('Publisher is required when --publish is enabled');
54
+ }
55
+ const archive = await source.downloadArchive(candidate);
56
+ if (archive.byteLength === 0) {
57
+ throw new Error(`Empty release archive for ${candidate.bundleId}@${candidate.version}`);
58
+ }
59
+ const manifestStatus = await publisher.publish(`${REPLICATED_SOURCE_PATH}/${manifestPath}`, candidate.manifestBytes, 'application/yaml');
60
+ const bundleStatus = manifestStatus === 'skipped-unverified'
61
+ ? manifestStatus
62
+ : await publisher.publish(`${REPLICATED_SOURCE_PATH}/${archivePath}`, archive, 'application/zip');
63
+ if (bundleStatus === 'skipped-unverified') {
64
+ warnings.push(`Skipped unverified existing bundle ${candidate.bundleId}@${candidate.version}. Check the target objects before retrying.`);
65
+ continue;
66
+ }
67
+ entries.push((0, core_1.makeReplicatedEntry)(candidate, manifestPath, archivePath, archive, sha256));
68
+ for (const sourceId of candidate.sourceIds ?? [candidate.sourceId]) {
69
+ verified.add(`${sourceId}\0${candidate.bundleId}\0${candidate.version}`);
70
+ }
71
+ }
72
+ else {
73
+ const placeholder = new Uint8Array(candidate.archiveSize);
74
+ entries.push((0, core_1.makeReplicatedEntry)(candidate, manifestPath, archivePath, placeholder, () => '0'.repeat(64)));
75
+ }
76
+ }
77
+ const updatedAt = new Date().toISOString();
78
+ const index = { formatVersion: 1, source: { id: 'replicated', name: 'Replicated GitHub hub', description: 'Bundles replicated from GitHub releases', updatedAt }, bundles: entries };
79
+ if (options.publish && publisher) {
80
+ const verifiedCandidates = selection.selected.filter((candidate) => (candidate.sourceIds ?? [candidate.sourceId]).some((sourceId) => verified.has(`${sourceId}\0${candidate.bundleId}\0${candidate.version}`)));
81
+ const publicationProfiles = (0, core_1.resolveReplicatedProfiles)(raw, verifiedCandidates, selection.selected);
82
+ warnings.push(...publicationProfiles.warnings);
83
+ const profiles = publicationProfiles.profiles.map((profile) => ({
84
+ ...profile,
85
+ bundles: profile.bundles.map((bundle) => ({ ...bundle, source: 'replicated' }))
86
+ }));
87
+ const indexBytes = new TextEncoder().encode(JSON.stringify(index, null, 2) + '\n');
88
+ const indexFile = `indexes/${sha256(indexBytes)}/index-v1.json`;
89
+ const generationStatus = await publisher.publish(`${REPLICATED_SOURCE_PATH}/${indexFile}`, indexBytes, 'application/json');
90
+ if (generationStatus === 'skipped-unverified') {
91
+ throw new Error('Unverified existing catalog generation. Check the target objects before retrying.');
92
+ }
93
+ const indexStatus = await publisher.publish(`${REPLICATED_SOURCE_PATH}/index-v1.json`, indexBytes, 'application/json', { replaceExisting: true });
94
+ if (indexStatus === 'skipped-unverified') {
95
+ throw new Error('Unverified existing metadata at sources/replicated/index-v1.json. Check the target objects before retrying.');
96
+ }
97
+ const targetAuth = options.targetAuth ?? 'bearer';
98
+ const config = {
99
+ version: typeof raw.version === 'string' ? raw.version : '1',
100
+ metadata: { name: 'Replicated GitHub hub', description: 'Bundles replicated from GitHub releases', maintainer: 'ai-primitives-hub', updatedAt },
101
+ sources: [{
102
+ id: 'replicated', name: 'Replicated GitHub hub', type: 'artifactory',
103
+ url: `${options.targetRoot.replace(/\/$/, '')}/${REPLICATED_SOURCE_PATH}`, enabled: true, priority: 0,
104
+ private: targetAuth === 'bearer',
105
+ config: {
106
+ indexFile, authMode: targetAuth,
107
+ ...(targetAuth === 'bearer' && options.targetCredentialRef ? { credentialRef: options.targetCredentialRef } : {})
108
+ }
109
+ }],
110
+ profiles: profiles
111
+ };
112
+ const hubStatus = await publisher.publish('hub-config.yml', new TextEncoder().encode(JSON.stringify(config, null, 2) + '\n'), 'application/yaml', { replaceExisting: true });
113
+ if (hubStatus === 'skipped-unverified') {
114
+ throw new Error('Unverified existing metadata at hub-config.yml. Check the target objects before retrying.');
115
+ }
116
+ return { index, hubConfig: config, warnings, selected: selection.selected };
117
+ }
118
+ const dryRunProfiles = (0, core_1.resolveReplicatedProfiles)(raw, selection.selected);
119
+ warnings.push(...dryRunProfiles.warnings);
120
+ return { index, hubConfig: { version: '1', metadata: { name: 'Replicated GitHub hub', description: '', maintainer: '', updatedAt }, sources: [], profiles: [] }, warnings, selected: selection.selected };
121
+ }
122
+ //# sourceMappingURL=replicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicate.js","sourceRoot":"","sources":["../../src/replicate/replicate.ts"],"names":[],"mappings":";;AA2CA,oCAsFC;AAjID,qKAAqK;AACrK,6CAEqB;AAQrB,kDAKiC;AAajC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AACpD,MAAM,MAAM,GAAG,CAAC,IAAgB,EAAU,EAAE,CAAC,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7F,MAAM,SAAS,GAAG,CAAC,MAA+B,EAAU,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,EA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