@ai-outfitter/outfitter 1.0.3 → 1.1.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/code/enterprise/cli/privateCatalogGate.cjs +3 -3
- package/dist/cli/OutfitterCli.js +2 -0
- package/dist/cli/OutfitterCli.js.map +1 -1
- package/dist/cli/commands/DumpCommand.js +8 -3
- package/dist/cli/commands/DumpCommand.js.map +1 -1
- package/dist/cli/commands/ListCommand.js +4 -3
- package/dist/cli/commands/ListCommand.js.map +1 -1
- package/dist/cli/commands/PiRuntimeLaunch.js +3 -16
- package/dist/cli/commands/PiRuntimeLaunch.js.map +1 -1
- package/dist/cli/commands/RunAgentCommand.js +1 -0
- package/dist/cli/commands/RunAgentCommand.js.map +1 -1
- package/dist/cli/commands/SetupCommand.d.ts +1 -1
- package/dist/cli/commands/SetupCommand.js +6 -13
- package/dist/cli/commands/SetupCommand.js.map +1 -1
- package/dist/cli/commands/SyncCommand.d.ts +31 -0
- package/dist/cli/commands/SyncCommand.js +162 -0
- package/dist/cli/commands/SyncCommand.js.map +1 -0
- package/dist/cli/commands/ValidateCommand.js +4 -2
- package/dist/cli/commands/ValidateCommand.js.map +1 -1
- package/dist/paths/RepositoryAssets.d.ts +4 -0
- package/dist/paths/RepositoryAssets.js +26 -0
- package/dist/paths/RepositoryAssets.js.map +1 -0
- package/dist/resolver/Layer.d.ts +17 -1
- package/dist/resolver/Layer.js +23 -15
- package/dist/resolver/Layer.js.map +1 -1
- package/dist/resolver/ResolverContext.d.ts +2 -0
- package/dist/resolver/ResolverContext.js +7 -2
- package/dist/resolver/ResolverContext.js.map +1 -1
- package/dist/settings/SettingsLoader.d.ts +12 -3
- package/dist/settings/SettingsLoader.js +25 -11
- package/dist/settings/SettingsLoader.js.map +1 -1
- package/dist/setup/DefaultCatalog.d.ts +2 -1
- package/dist/setup/DefaultCatalog.js +25 -50
- package/dist/setup/DefaultCatalog.js.map +1 -1
- package/dist/sources/GitRepository.d.ts +28 -0
- package/dist/sources/GitRepository.js +139 -0
- package/dist/sources/GitRepository.js.map +1 -0
- package/dist/sources/PrivateCatalogGate.d.ts +27 -0
- package/dist/sources/PrivateCatalogGate.js +23 -0
- package/dist/sources/PrivateCatalogGate.js.map +1 -0
- package/dist/sources/SourceCache.d.ts +11 -1
- package/dist/sources/SourceCache.js +11 -2
- package/dist/sources/SourceCache.js.map +1 -1
- package/docs/documentation/catalogs.md +10 -2
- package/docs/documentation/cli.md +11 -3
- package/docs/documentation/settings.md +4 -2
- package/package.json +1 -1
package/dist/resolver/Layer.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RemoteSourceReference } from '../sources/SourceCache.js';
|
|
1
2
|
import type { Settings } from '../settings/Settings.js';
|
|
2
3
|
import type { Layer } from './Resource.js';
|
|
3
4
|
export interface LayerDiscoveryInput {
|
|
@@ -5,8 +6,23 @@ export interface LayerDiscoveryInput {
|
|
|
5
6
|
readonly projectDirectory: string;
|
|
6
7
|
readonly settings: Settings;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps an already-materialized repository checkout to the layer `outfitter run` would resolve from
|
|
11
|
+
* it. `outfitter sync` reuses this against its temporary checkout so both agree on the payload root.
|
|
12
|
+
*/
|
|
13
|
+
export declare const remoteSourceLayer: (repositoryPath: string, source: RemoteSourceReference) => Layer;
|
|
14
|
+
export interface LayerDiscoveryResult {
|
|
15
|
+
readonly layers: readonly Layer[];
|
|
16
|
+
/**
|
|
17
|
+
* Configured remote sources whose cache is absent, reported with `outfitter sync` guidance rather
|
|
18
|
+
* than silently dropped (OFTR-004.2.18). Reported, never fatal: a private catalog the enterprise
|
|
19
|
+
* gate skips is never cached, so `outfitter sync` skips it again and exits 0 — aborting here
|
|
20
|
+
* would deadlock every other command behind advice the user cannot act on (OFTR-004.2.15).
|
|
21
|
+
*/
|
|
22
|
+
readonly unsynchronized: readonly string[];
|
|
23
|
+
}
|
|
8
24
|
/**
|
|
9
25
|
* Orders layers highest precedence first: workspace `.agents`, then global `~/.agents`,
|
|
10
26
|
* then configured sources in order. Only layers whose root exists on disk are included.
|
|
11
27
|
*/
|
|
12
|
-
export declare const discoverLayers: (input: LayerDiscoveryInput) =>
|
|
28
|
+
export declare const discoverLayers: (input: LayerDiscoveryInput) => LayerDiscoveryResult;
|
package/dist/resolver/Layer.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// Builds the ordered `.agents` layer stack (workspace over global over remote sources) from settings.
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { createRemoteRepositoryCachePath, formatRemoteSourceDisplay, isRemoteSource, resolveRemoteRepositorySubpath, } from '../sources/SourceCache.js';
|
|
5
5
|
const agentsRoot = (directory) => join(directory, '.agents');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* Maps an already-materialized repository checkout to the layer `outfitter run` would resolve from
|
|
8
|
+
* it. `outfitter sync` reuses this against its temporary checkout so both agree on the payload root.
|
|
9
|
+
*/
|
|
10
|
+
export const remoteSourceLayer = (repositoryPath, source) => ({
|
|
11
|
+
root: source.path === undefined ? repositoryPath : resolveRemoteRepositorySubpath(repositoryPath, source.path),
|
|
12
|
+
origin: 'source',
|
|
13
|
+
label: formatRemoteSourceDisplay(source),
|
|
14
|
+
});
|
|
15
|
+
const sourceLayer = (input, source) => isRemoteSource(source)
|
|
16
|
+
? remoteSourceLayer(createRemoteRepositoryCachePath(input.homeDirectory, source, input.settings.cacheDirectory), source)
|
|
17
|
+
: { root: source.path, origin: 'source', label: source.path };
|
|
18
18
|
/**
|
|
19
19
|
* Orders layers highest precedence first: workspace `.agents`, then global `~/.agents`,
|
|
20
20
|
* then configured sources in order. Only layers whose root exists on disk are included.
|
|
@@ -23,8 +23,16 @@ export const discoverLayers = (input) => {
|
|
|
23
23
|
const candidates = [
|
|
24
24
|
{ root: agentsRoot(input.projectDirectory), origin: 'workspace', label: 'workspace' },
|
|
25
25
|
{ root: agentsRoot(input.homeDirectory), origin: 'global', label: 'global' },
|
|
26
|
-
...(input.settings.sources ?? []).map((source) => sourceLayer(input, source)),
|
|
27
26
|
];
|
|
28
|
-
|
|
27
|
+
const unsynchronized = [];
|
|
28
|
+
for (const source of input.settings.sources ?? []) {
|
|
29
|
+
const layer = sourceLayer(input, source);
|
|
30
|
+
if (isRemoteSource(source) && !existsSync(layer.root)) {
|
|
31
|
+
unsynchronized.push(`Configured remote source '${layer.label}' is not synchronized at '${layer.root}'. Run 'outfitter sync' to fetch it.`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
candidates.push(layer);
|
|
35
|
+
}
|
|
36
|
+
return { layers: candidates.filter((layer) => existsSync(layer.root)), unsynchronized };
|
|
29
37
|
};
|
|
30
38
|
//# sourceMappingURL=Layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","sourceRoot":"","sources":["../../src/resolver/Layer.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,
|
|
1
|
+
{"version":3,"file":"Layer.js","sourceRoot":"","sources":["../../src/resolver/Layer.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,cAAc,EACd,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AAWnC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAU,EAA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,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,cAAc,CAAC,IAAI,CACjB,6BAA6B,KAAK,CAAC,KAAK,6BAA6B,KAAK,CAAC,IAAI,sCAAsC,CACtH,CAAC;YACF,SAAS;QACX,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC;AAC1F,CAAC,CAAC"}
|
|
@@ -10,6 +10,8 @@ export interface ResolveResult {
|
|
|
10
10
|
/** The merged settings loaded during resolution, so callers need not reload them. */
|
|
11
11
|
readonly settings: Settings;
|
|
12
12
|
readonly settingsIssues: readonly SettingsLoadIssue[];
|
|
13
|
+
/** Non-fatal `outfitter sync` guidance for configured remote sources with no cache. */
|
|
14
|
+
readonly warnings: readonly string[];
|
|
13
15
|
}
|
|
14
16
|
/** The single shared resolution path used by list, validate, run, and dump. */
|
|
15
17
|
export declare const resolveEffectiveSet: (input: ResolveInput) => ResolveResult;
|
|
@@ -5,7 +5,12 @@ import { resolveResources } from './Resolver.js';
|
|
|
5
5
|
/** The single shared resolution path used by list, validate, run, and dump. */
|
|
6
6
|
export const resolveEffectiveSet = (input) => {
|
|
7
7
|
const loadedSettings = loadSettingsWithCachedRemoteSettings(input);
|
|
8
|
-
const
|
|
9
|
-
return {
|
|
8
|
+
const discovered = discoverLayers({ ...input, settings: loadedSettings.settings });
|
|
9
|
+
return {
|
|
10
|
+
set: resolveResources(discovered.layers),
|
|
11
|
+
settings: loadedSettings.settings,
|
|
12
|
+
settingsIssues: loadedSettings.issues,
|
|
13
|
+
warnings: discovered.unsynchronized,
|
|
14
|
+
};
|
|
10
15
|
};
|
|
11
16
|
//# sourceMappingURL=ResolverContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolverContext.js","sourceRoot":"","sources":["../../src/resolver/ResolverContext.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ResolverContext.js","sourceRoot":"","sources":["../../src/resolver/ResolverContext.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAgBjD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAmB,EAAiB,EAAE;IACxE,MAAM,cAAc,GAAG,oCAAoC,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,cAAc,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEnF,OAAO;QACL,GAAG,EAAE,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC;QACxC,QAAQ,EAAE,cAAc,CAAC,QAAQ;QACjC,cAAc,EAAE,cAAc,CAAC,MAAM;QACrC,QAAQ,EAAE,UAAU,CAAC,cAAc;KACpC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -26,9 +26,18 @@ export interface SettingsDiscoveryInput {
|
|
|
26
26
|
readonly projectDirectory: string;
|
|
27
27
|
}
|
|
28
28
|
export declare const createSettingsLoadPlan: (locations: readonly SettingsLocation[]) => SettingsLoadPlan;
|
|
29
|
+
/** The one rendering of a settings issue every command reports. */
|
|
30
|
+
export declare const formatSettingsIssue: (issue: SettingsLoadIssue) => string;
|
|
29
31
|
export declare const discoverSettingsLoadPlan: (input: SettingsDiscoveryInput) => SettingsLoadPlan;
|
|
30
|
-
export declare const discoverRemoteSettingsLoadPlan: (homeDirectory: string, remoteSettings: readonly RemoteSettingsReference[]) => SettingsLoadPlan;
|
|
31
|
-
export declare const resolveCachedRemoteSettingsPath: (homeDirectory: string, source: RemoteSettingsReference) => string;
|
|
32
|
+
export declare const discoverRemoteSettingsLoadPlan: (homeDirectory: string, remoteSettings: readonly RemoteSettingsReference[], cacheDirectory?: string) => SettingsLoadPlan;
|
|
33
|
+
export declare const resolveCachedRemoteSettingsPath: (homeDirectory: string, source: RemoteSettingsReference, cacheDirectory?: string) => string;
|
|
34
|
+
export declare const resolveRemoteSettingsPath: (repositoryPath: string, path: string) => string;
|
|
32
35
|
export declare const loadSettingsFiles: (plan: SettingsLoadPlan) => SettingsLoadResult;
|
|
33
36
|
export declare const loadSettings: (plan: SettingsLoadPlan) => LoadedSettings;
|
|
34
|
-
export
|
|
37
|
+
export interface CachedRemoteSettingsOptions {
|
|
38
|
+
/** Remote settings to fold in instead of the ones the local settings declare. */
|
|
39
|
+
readonly remoteSettingsReferences?: readonly RemoteSettingsReference[];
|
|
40
|
+
/** An already-loaded local stack, so callers that just read it do not parse every file twice. */
|
|
41
|
+
readonly localSettings?: LoadedSettings;
|
|
42
|
+
}
|
|
43
|
+
export declare const loadSettingsWithCachedRemoteSettings: (input: SettingsDiscoveryInput, options?: CachedRemoteSettingsOptions) => LoadedSettings;
|
|
@@ -8,6 +8,8 @@ import { mergeSettingsStack } from './SettingsMerger.js';
|
|
|
8
8
|
export const createSettingsLoadPlan = (locations) => ({
|
|
9
9
|
locations,
|
|
10
10
|
});
|
|
11
|
+
/** The one rendering of a settings issue every command reports. */
|
|
12
|
+
export const formatSettingsIssue = (issue) => `${issue.filePath}#${issue.path} ${issue.message}`;
|
|
11
13
|
const agentsSettings = (directory, ...rest) => join(directory, '.agents', ...rest);
|
|
12
14
|
// Ordered lowest-to-highest precedence so later files fold over earlier ones during merge.
|
|
13
15
|
export const discoverSettingsLoadPlan = (input) => createSettingsLoadPlan([
|
|
@@ -16,11 +18,14 @@ export const discoverSettingsLoadPlan = (input) => createSettingsLoadPlan([
|
|
|
16
18
|
{ scope: 'project', path: agentsSettings(input.projectDirectory, 'settings.yml') },
|
|
17
19
|
{ scope: 'project-local', path: agentsSettings(input.projectDirectory, 'settings.local.yml') },
|
|
18
20
|
]);
|
|
19
|
-
export const discoverRemoteSettingsLoadPlan = (homeDirectory, remoteSettings) => discoverRemoteSettingsLocations(homeDirectory, remoteSettings).plan;
|
|
20
|
-
export const resolveCachedRemoteSettingsPath = (homeDirectory, source) => {
|
|
21
|
-
const repositoryPath = createRemoteRepositoryCachePath(homeDirectory, source);
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export const discoverRemoteSettingsLoadPlan = (homeDirectory, remoteSettings, cacheDirectory) => discoverRemoteSettingsLocations(homeDirectory, remoteSettings, cacheDirectory).plan;
|
|
22
|
+
export const resolveCachedRemoteSettingsPath = (homeDirectory, source, cacheDirectory) => {
|
|
23
|
+
const repositoryPath = createRemoteRepositoryCachePath(homeDirectory, source, cacheDirectory);
|
|
24
|
+
return resolveRemoteSettingsPath(repositoryPath, source.path);
|
|
25
|
+
};
|
|
26
|
+
export const resolveRemoteSettingsPath = (repositoryPath, path) => {
|
|
27
|
+
const configuredPath = resolveRemoteRepositorySubpath(repositoryPath, path);
|
|
28
|
+
if (existsSync(configuredPath) || path !== 'settings.yml') {
|
|
24
29
|
return configuredPath;
|
|
25
30
|
}
|
|
26
31
|
const nestedAgentsSettingsPath = resolveRemoteRepositorySubpath(repositoryPath, '.agents/settings.yml');
|
|
@@ -43,13 +48,13 @@ export const loadSettings = (plan) => {
|
|
|
43
48
|
settings: mergeSettingsStack(result.files.map((file) => file.settings)),
|
|
44
49
|
};
|
|
45
50
|
};
|
|
46
|
-
export const loadSettingsWithCachedRemoteSettings = (input,
|
|
47
|
-
const localSettings = loadSettings(discoverSettingsLoadPlan(input));
|
|
48
|
-
const remoteSettingsReferences =
|
|
51
|
+
export const loadSettingsWithCachedRemoteSettings = (input, options = {}) => {
|
|
52
|
+
const localSettings = options.localSettings ?? loadSettings(discoverSettingsLoadPlan(input));
|
|
53
|
+
const remoteSettingsReferences = options.remoteSettingsReferences ?? localSettings.settings.remoteSettings;
|
|
49
54
|
if (localSettings.issues.length > 0 || remoteSettingsReferences.length === 0) {
|
|
50
55
|
return localSettings;
|
|
51
56
|
}
|
|
52
|
-
const remoteSettingsLocations = discoverRemoteSettingsLocations(input.homeDirectory, remoteSettingsReferences);
|
|
57
|
+
const remoteSettingsLocations = discoverRemoteSettingsLocations(input.homeDirectory, remoteSettingsReferences, localSettings.settings.cacheDirectory);
|
|
53
58
|
const remoteSettings = loadSettings(remoteSettingsLocations.plan);
|
|
54
59
|
const files = [...remoteSettings.files, ...localSettings.files];
|
|
55
60
|
const issues = [...remoteSettingsLocations.issues, ...remoteSettings.issues, ...localSettings.issues];
|
|
@@ -59,14 +64,23 @@ export const loadSettingsWithCachedRemoteSettings = (input, remoteSettingsRefere
|
|
|
59
64
|
settings: mergeSettingsStack(files.map((file) => file.settings)),
|
|
60
65
|
};
|
|
61
66
|
};
|
|
62
|
-
const discoverRemoteSettingsLocations = (homeDirectory, remoteSettings) => {
|
|
67
|
+
const discoverRemoteSettingsLocations = (homeDirectory, remoteSettings, cacheDirectory) => {
|
|
63
68
|
const locations = [];
|
|
64
69
|
const issues = [];
|
|
65
70
|
for (const [index, source] of remoteSettings.entries()) {
|
|
66
71
|
try {
|
|
72
|
+
const path = resolveCachedRemoteSettingsPath(homeDirectory, source, cacheDirectory);
|
|
73
|
+
if (!existsSync(path)) {
|
|
74
|
+
issues.push({
|
|
75
|
+
filePath: `remote_settings[${index}]`,
|
|
76
|
+
path: `/remote_settings/${index}`,
|
|
77
|
+
message: `Cached remote settings '${path}' are missing. Run 'outfitter sync' to fetch configured remote settings.`,
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
67
81
|
locations.push({
|
|
68
82
|
scope: 'remote',
|
|
69
|
-
path
|
|
83
|
+
path,
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
86
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsLoader.js","sourceRoot":"","sources":["../../src/settings/SettingsLoader.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAoEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAsC,EAAoB,EAAE,CAAC,CAAC;IACnG,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,SAAiB,EAAE,GAAG,IAAc,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;AAE7G,2FAA2F;AAC3F,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAA6B,EAAoB,EAAE,CAC1F,sBAAsB,CAAC;IACrB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE;IAC5E,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,aAA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AAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACvE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,IAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC;AAC3E,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,cAAsB,EAAE,iBAAyB,EAAU,EAAE;IAC3F,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC/B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@ export declare const defaultCatalogSource: {
|
|
|
5
5
|
};
|
|
6
6
|
export interface PinnedCatalogBootstrapInput {
|
|
7
7
|
readonly homeDirectory: string;
|
|
8
|
+
readonly cacheDirectory?: string;
|
|
8
9
|
readonly source: RemoteSourceReference & {
|
|
9
10
|
readonly ref: string;
|
|
10
11
|
};
|
|
@@ -17,4 +18,4 @@ export interface PinnedCatalogBootstrapResult {
|
|
|
17
18
|
}
|
|
18
19
|
/** Fetches one immutable catalog revision into the same cache path used by normal source resolution. */
|
|
19
20
|
export declare const bootstrapPinnedCatalog: (input: PinnedCatalogBootstrapInput) => PinnedCatalogBootstrapResult;
|
|
20
|
-
export declare const bootstrapDefaultCatalog: (homeDirectory: string) => PinnedCatalogBootstrapResult;
|
|
21
|
+
export declare const bootstrapDefaultCatalog: (homeDirectory: string, cacheDirectory?: string) => PinnedCatalogBootstrapResult;
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
// Bootstraps the one canonical default catalog at the immutable revision shipped by Outfitter.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createRemoteRepositoryCachePath,
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { runGit, syncRemoteRepositoryAtomically, tryReadCleanHead } from '../sources/GitRepository.js';
|
|
5
|
+
import { createRemoteRepositoryCachePath, redactEmbeddedSourceCredentials } from '../sources/SourceCache.js';
|
|
6
6
|
export const defaultCatalogSource = {
|
|
7
7
|
github: 'ai-outfitter/default-profiles',
|
|
8
8
|
// TODO(release-automation): when default-profiles publishes a new Release Please tag, open a
|
|
9
9
|
// conventional dependency-bump commit in Outfitter so its next Release Please release ships it.
|
|
10
10
|
ref: 'v1.0.0',
|
|
11
11
|
};
|
|
12
|
-
const runGit = (arguments_) => {
|
|
13
|
-
try {
|
|
14
|
-
return execFileSync('git', [...arguments_], {
|
|
15
|
-
encoding: 'utf8',
|
|
16
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
17
|
-
}).trim();
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new Error(`git ${arguments_.join(' ')} failed: ${String(error)}`, { cause: error });
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
12
|
const fullCommitPattern = /^[a-f0-9]{40}$/u;
|
|
24
13
|
const versionTagPattern = /^v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;
|
|
25
14
|
const assertImmutableRef = (ref) => {
|
|
@@ -32,8 +21,7 @@ const isPinnedCatalogCheckout = (root, ref) => {
|
|
|
32
21
|
if (!existsSync(join(root, 'agents')))
|
|
33
22
|
return false;
|
|
34
23
|
try {
|
|
35
|
-
return (
|
|
36
|
-
runGit(['-C', root, 'status', '--porcelain']) === '');
|
|
24
|
+
return tryReadCleanHead(root) === resolveExpectedCommit(root, ref);
|
|
37
25
|
}
|
|
38
26
|
catch {
|
|
39
27
|
return false;
|
|
@@ -42,48 +30,35 @@ const isPinnedCatalogCheckout = (root, ref) => {
|
|
|
42
30
|
/** Fetches one immutable catalog revision into the same cache path used by normal source resolution. */
|
|
43
31
|
export const bootstrapPinnedCatalog = (input) => {
|
|
44
32
|
assertImmutableRef(input.source.ref);
|
|
45
|
-
const root = createRemoteRepositoryCachePath(input.homeDirectory, input.source);
|
|
33
|
+
const root = createRemoteRepositoryCachePath(input.homeDirectory, input.source, input.cacheDirectory);
|
|
46
34
|
if (isPinnedCatalogCheckout(root, input.source.ref))
|
|
47
35
|
return { root, source: input.source };
|
|
48
|
-
mkdirSync(dirname(root), { recursive: true });
|
|
49
|
-
const nonce = `${process.pid}-${Math.random().toString(16).slice(2)}`;
|
|
50
|
-
const temporaryRoot = `${root}.outfitter-${nonce}.tmp`;
|
|
51
|
-
const staleRoot = `${root}.outfitter-${nonce}.stale`;
|
|
52
|
-
const remote = normalizeGitUri(normalizeRemoteSourceUri(input.source));
|
|
53
|
-
let movedStaleCache = false;
|
|
54
36
|
try {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
37
|
+
syncRemoteRepositoryAtomically({
|
|
38
|
+
cachePath: root,
|
|
39
|
+
fetchRef: versionTagPattern.test(input.source.ref)
|
|
40
|
+
? `refs/tags/${input.source.ref}:refs/tags/${input.source.ref}`
|
|
41
|
+
: input.source.ref,
|
|
42
|
+
source: input.source,
|
|
43
|
+
// Validated with the same predicate the read path uses. A fresh checkout is not clean by
|
|
44
|
+
// construction — autocrlf, an LFS smudge, or a fileMode difference can leave it dirty — and
|
|
45
|
+
// accepting a dirty tree here would cache one that `tryReadCleanHead` rejects on every
|
|
46
|
+
// subsequent read, re-fetching forever.
|
|
47
|
+
validate: (temporaryRoot) => {
|
|
48
|
+
if (!isPinnedCatalogCheckout(temporaryRoot, input.source.ref)) {
|
|
49
|
+
throw new Error(`Fetched default catalog did not resolve to ${input.source.ref}.`);
|
|
50
|
+
}
|
|
51
|
+
return 0;
|
|
52
|
+
},
|
|
53
|
+
});
|
|
72
54
|
return { root, source: input.source };
|
|
73
55
|
}
|
|
74
56
|
catch (error) {
|
|
75
|
-
|
|
76
|
-
if (movedStaleCache && !existsSync(root) && existsSync(staleRoot))
|
|
77
|
-
renameSync(staleRoot, root);
|
|
78
|
-
const detail = String(error);
|
|
57
|
+
const detail = redactEmbeddedSourceCredentials(String(error));
|
|
79
58
|
throw new Error(`Could not fetch the default Outfitter catalog at pinned revision ${input.source.ref}. ${detail}`, {
|
|
80
59
|
cause: error,
|
|
81
60
|
});
|
|
82
61
|
}
|
|
83
|
-
finally {
|
|
84
|
-
rmSync(temporaryRoot, { recursive: true, force: true });
|
|
85
|
-
rmSync(staleRoot, { recursive: true, force: true });
|
|
86
|
-
}
|
|
87
62
|
};
|
|
88
|
-
export const bootstrapDefaultCatalog = (homeDirectory) => bootstrapPinnedCatalog({ homeDirectory, source: defaultCatalogSource });
|
|
63
|
+
export const bootstrapDefaultCatalog = (homeDirectory, cacheDirectory) => bootstrapPinnedCatalog({ homeDirectory, cacheDirectory, source: defaultCatalogSource });
|
|
89
64
|
//# sourceMappingURL=DefaultCatalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCatalog.js","sourceRoot":"","sources":["../../src/setup/DefaultCatalog.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultCatalog.js","sourceRoot":"","sources":["../../src/setup/DefaultCatalog.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAG7G,MAAM,CAAC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,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,aAAqB,EAAE,cAAuB,EAAgC,EAAE,CACtH,sBAAsB,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RemoteSourceReference } from './SourceCache.js';
|
|
2
|
+
export interface AtomicRepositorySyncInput {
|
|
3
|
+
readonly cachePath: string;
|
|
4
|
+
/** Optional fetch refspec used when verification needs a local ref (for example an immutable tag). */
|
|
5
|
+
readonly fetchRef?: string;
|
|
6
|
+
readonly source: RemoteSourceReference;
|
|
7
|
+
/**
|
|
8
|
+
* Inspects the fetched checkout before it is swapped in; throwing rejects the fetch. Returns the
|
|
9
|
+
* number of non-fatal warnings the checkout produced.
|
|
10
|
+
*/
|
|
11
|
+
readonly validate?: (repositoryPath: string, commit: string) => number;
|
|
12
|
+
}
|
|
13
|
+
export interface AtomicRepositorySyncResult {
|
|
14
|
+
readonly commit: string;
|
|
15
|
+
readonly status: 'updated' | 'unchanged';
|
|
16
|
+
readonly warnings: number;
|
|
17
|
+
}
|
|
18
|
+
/** Guards against a `ref` that git would parse as an option (`--upload-pack=…` is code execution). */
|
|
19
|
+
export declare const assertFetchableRef: (ref: string) => void;
|
|
20
|
+
/** Runs one git invocation, raising captured stderr as a credential-redacted Error. */
|
|
21
|
+
export declare const runGit: (arguments_: readonly string[]) => string;
|
|
22
|
+
/** Reads the HEAD commit of a checkout, or undefined when it is missing, dirty, or unreadable. */
|
|
23
|
+
export declare const tryReadCleanHead: (root: string) => string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Fetches into a temporary sibling and swaps only a validated checkout into place. A failed fetch,
|
|
26
|
+
* checkout, validation, or rename leaves an existing cache intact.
|
|
27
|
+
*/
|
|
28
|
+
export declare const syncRemoteRepositoryAtomically: (input: AtomicRepositorySyncInput) => AtomicRepositorySyncResult;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Atomically fetches Git repositories while preserving the last known-good cache on failure.
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, mkdirSync, renameSync, rmSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { normalizeGitUri, normalizeRemoteSourceUri, redactEmbeddedSourceCredentials } from './SourceCache.js';
|
|
6
|
+
// Repository-context variables must never leak in: with GIT_DIR/GIT_WORK_TREE exported (a git hook,
|
|
7
|
+
// `rebase --exec`, `bisect run`), `git -C <temporaryRoot> …` would operate on the *outer*
|
|
8
|
+
// repository, adding remotes to it and detaching its HEAD. Transport variables are left alone so a
|
|
9
|
+
// user's custom GIT_SSH_COMMAND still applies.
|
|
10
|
+
const repositoryContextVariables = new Set([
|
|
11
|
+
'GIT_DIR',
|
|
12
|
+
'GIT_WORK_TREE',
|
|
13
|
+
'GIT_INDEX_FILE',
|
|
14
|
+
'GIT_OBJECT_DIRECTORY',
|
|
15
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
|
|
16
|
+
'GIT_COMMON_DIR',
|
|
17
|
+
'GIT_NAMESPACE',
|
|
18
|
+
'GIT_CEILING_DIRECTORIES',
|
|
19
|
+
]);
|
|
20
|
+
const gitEnvironment = () => {
|
|
21
|
+
const environment = {};
|
|
22
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
23
|
+
if (!repositoryContextVariables.has(key))
|
|
24
|
+
environment[key] = value;
|
|
25
|
+
}
|
|
26
|
+
// Git reads interactive credential prompts from /dev/tty, so piping stdio does not suppress them:
|
|
27
|
+
// an auth-required or unknown-host remote would hang the CLI forever without these.
|
|
28
|
+
environment.GIT_TERMINAL_PROMPT = '0';
|
|
29
|
+
environment.GIT_SSH_COMMAND = process.env.GIT_SSH_COMMAND ?? 'ssh -o BatchMode=yes';
|
|
30
|
+
return environment;
|
|
31
|
+
};
|
|
32
|
+
/** Guards against a `ref` that git would parse as an option (`--upload-pack=…` is code execution). */
|
|
33
|
+
export const assertFetchableRef = (ref) => {
|
|
34
|
+
if (!/^[A-Za-z0-9_.][A-Za-z0-9_./-]*$/u.test(ref) || ref.includes('..')) {
|
|
35
|
+
throw new Error(`Source ref '${ref}' is not a valid git ref.`);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/** Runs one git invocation, raising captured stderr as a credential-redacted Error. */
|
|
39
|
+
export const runGit = (arguments_) => {
|
|
40
|
+
const result = spawnSync('git', [...arguments_], {
|
|
41
|
+
encoding: 'utf8',
|
|
42
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
43
|
+
env: gitEnvironment(),
|
|
44
|
+
timeout: 300_000,
|
|
45
|
+
});
|
|
46
|
+
if (result.error === undefined && result.status === 0) {
|
|
47
|
+
return result.stdout.trim();
|
|
48
|
+
}
|
|
49
|
+
const detail = [result.error?.message, result.stderr, result.stdout]
|
|
50
|
+
.filter((value) => value !== undefined && value.trim() !== '')
|
|
51
|
+
.join('\n');
|
|
52
|
+
const command = `git ${arguments_.join(' ')}`;
|
|
53
|
+
let suffix = `: ${detail.trim()}`;
|
|
54
|
+
/* v8 ignore else -- spawn failures always provide an Error or captured process output. */
|
|
55
|
+
if (detail === '')
|
|
56
|
+
suffix = '';
|
|
57
|
+
throw new Error(redactEmbeddedSourceCredentials(`${command} failed${suffix}`));
|
|
58
|
+
};
|
|
59
|
+
/** Reads the HEAD commit of a checkout, or undefined when it is missing, dirty, or unreadable. */
|
|
60
|
+
export const tryReadCleanHead = (root) => {
|
|
61
|
+
if (!existsSync(join(root, '.git')))
|
|
62
|
+
return undefined;
|
|
63
|
+
try {
|
|
64
|
+
if (runGit(['-C', root, 'status', '--porcelain']) !== '')
|
|
65
|
+
return undefined;
|
|
66
|
+
return runGit(['-C', root, 'rev-parse', 'HEAD']);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Rejects a remote or ref that git would parse as an option. Runs before any filesystem work so a
|
|
74
|
+
* hostile ref always reports as an invalid ref, rather than as whatever incidental error the cache
|
|
75
|
+
* path happens to raise first (a long encoded name exceeds the macOS filename limit, for example).
|
|
76
|
+
*/
|
|
77
|
+
const assertFetchableSource = (source, fetchRef) => {
|
|
78
|
+
// Both the remote and the ref are positional arguments to `git fetch`; either one starting with
|
|
79
|
+
// `-` is parsed as an option, and `--upload-pack=<cmd>` is arbitrary command execution.
|
|
80
|
+
const remote = normalizeGitUri(normalizeRemoteSourceUri(source));
|
|
81
|
+
if (remote.startsWith('-'))
|
|
82
|
+
throw new Error(`Source URI '${remote}' must not begin with '-'.`);
|
|
83
|
+
// A refspec (`refs/tags/x:refs/tags/x`) is two refs; validate each side.
|
|
84
|
+
const ref = fetchRef ?? source.ref;
|
|
85
|
+
if (ref !== undefined)
|
|
86
|
+
for (const part of ref.split(':'))
|
|
87
|
+
assertFetchableRef(part);
|
|
88
|
+
};
|
|
89
|
+
const fetchSource = (temporaryRoot, source, fetchRef) => {
|
|
90
|
+
const remote = normalizeGitUri(normalizeRemoteSourceUri(source));
|
|
91
|
+
const ref = fetchRef ?? source.ref;
|
|
92
|
+
runGit(['init', '--quiet', temporaryRoot]);
|
|
93
|
+
// Fetch by URL rather than `remote add origin <url>`: a credential-bearing URL written into
|
|
94
|
+
// .git/config would be renamed into the long-lived cache and persist there in plaintext.
|
|
95
|
+
// An omitted ref must resolve the remote's default branch — with no refspec at all, FETCH_HEAD
|
|
96
|
+
// holds every branch tip and `rev-parse FETCH_HEAD` would take whichever sorts first.
|
|
97
|
+
runGit(['-C', temporaryRoot, 'fetch', '--quiet', '--depth=1', remote, ref ?? 'HEAD']);
|
|
98
|
+
runGit(['-C', temporaryRoot, 'checkout', '--quiet', '--detach', 'FETCH_HEAD']);
|
|
99
|
+
return runGit(['-C', temporaryRoot, 'rev-parse', 'HEAD']);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Fetches into a temporary sibling and swaps only a validated checkout into place. A failed fetch,
|
|
103
|
+
* checkout, validation, or rename leaves an existing cache intact.
|
|
104
|
+
*/
|
|
105
|
+
export const syncRemoteRepositoryAtomically = (input) => {
|
|
106
|
+
assertFetchableSource(input.source, input.fetchRef);
|
|
107
|
+
mkdirSync(dirname(input.cachePath), { recursive: true });
|
|
108
|
+
const nonce = `${process.pid}-${Math.random().toString(16).slice(2)}`;
|
|
109
|
+
const temporaryRoot = `${input.cachePath}.outfitter-${nonce}.tmp`;
|
|
110
|
+
const staleRoot = `${input.cachePath}.outfitter-${nonce}.stale`;
|
|
111
|
+
let movedStaleCache = false;
|
|
112
|
+
try {
|
|
113
|
+
const commit = fetchSource(temporaryRoot, input.source, input.fetchRef);
|
|
114
|
+
const warnings = input.validate?.(temporaryRoot, commit) ?? 0;
|
|
115
|
+
if (tryReadCleanHead(input.cachePath) === commit) {
|
|
116
|
+
return { commit, status: 'unchanged', warnings };
|
|
117
|
+
}
|
|
118
|
+
if (existsSync(input.cachePath)) {
|
|
119
|
+
renameSync(input.cachePath, staleRoot);
|
|
120
|
+
movedStaleCache = true;
|
|
121
|
+
}
|
|
122
|
+
renameSync(temporaryRoot, input.cachePath);
|
|
123
|
+
if (movedStaleCache)
|
|
124
|
+
rmSync(staleRoot, { recursive: true, force: true });
|
|
125
|
+
return { commit, status: 'updated', warnings };
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
/* v8 ignore next -- only an OS-level failure during the atomic rename needs restoration. */
|
|
129
|
+
if (movedStaleCache && !existsSync(input.cachePath) && existsSync(staleRoot)) {
|
|
130
|
+
renameSync(staleRoot, input.cachePath);
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
rmSync(temporaryRoot, { recursive: true, force: true });
|
|
136
|
+
rmSync(staleRoot, { recursive: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=GitRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitRepository.js","sourceRoot":"","sources":["../../src/sources/GitRepository.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAqB9G,oGAAoG;AACpG,0FAA0F;AAC1F,mGAAmG;AACnG,+CAA+C;AAC/C,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC;IACzC,SAAS;IACT,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,kCAAkC;IAClC,gBAAgB;IAChB,eAAe;IACf,yBAAyB;CAC1B,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,GAAsB,EAAE;IAC7C,MAAM,WAAW,GAAsB,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACrE,CAAC;IAED,kGAAkG;IAClG,oFAAoF;IACpF,WAAW,CAAC,mBAAmB,GAAG,GAAG,CAAC;IACtC,WAAW,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,sBAAsB,CAAC;IACpF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAQ,EAAE;IAC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ceCache.js';
|
|
2
|
+
export interface GitHubRepositoryVisibilityClassifier {
|
|
3
|
+
classify(repository: string): 'private' | 'public' | 'unknown';
|
|
4
|
+
}
|
|
5
|
+
export interface PrivateCatalogPrompt {
|
|
6
|
+
readonly interactive: boolean;
|
|
7
|
+
confirm(repository: string): boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PrivateCatalogSkippedResult {
|
|
10
|
+
readonly uri: string;
|
|
11
|
+
readonly cachePath: string;
|
|
12
|
+
readonly status: 'skipped';
|
|
13
|
+
readonly message: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PrivateCatalogGateResult<T extends RemoteSourceReference> {
|
|
16
|
+
readonly allowedSources: readonly T[];
|
|
17
|
+
readonly skippedResults: readonly PrivateCatalogSkippedResult[];
|
|
18
|
+
readonly messages: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
export interface PrivateCatalogSourceGate {
|
|
21
|
+
filter<T extends RemoteSourceReference>(sources: readonly T[], cacheDirectory?: string): PrivateCatalogGateResult<T>;
|
|
22
|
+
}
|
|
23
|
+
export declare const createEnterprisePrivateCatalogGate: (input: {
|
|
24
|
+
readonly homeDirectory: string;
|
|
25
|
+
readonly classifier?: GitHubRepositoryVisibilityClassifier;
|
|
26
|
+
readonly prompt?: PrivateCatalogPrompt;
|
|
27
|
+
}) => PrivateCatalogSourceGate;
|