@lesliechan721/aw 0.1.0-beta.101 → 0.1.0-beta.103
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/dist/src/commands/catalog-generation.d.ts +2 -5
- package/dist/src/commands/catalog-generation.js +2 -4
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/lifecycle-command-package.d.ts +1 -1
- package/dist/src/commands/lifecycle-command-package.js +40 -2
- package/dist/src/commands/lifecycle-command-package.js.map +1 -1
- package/dist/src/commands/managed-commands.d.ts +2 -1
- package/dist/src/commands/managed-commands.js +4 -2
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +2 -8
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +16 -10
- package/dist/src/commands/public-config-confirmation.js +87 -52
- package/dist/src/commands/public-config-confirmation.js.map +1 -1
- package/dist/src/commands/public-lifecycle.d.ts +1 -1
- package/dist/src/commands/public-lifecycle.js +36 -8
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +6 -4
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +22 -6
- package/dist/src/commands/rebuild-command.js +273 -557
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +12 -39
- package/dist/src/commands/rebuild-integration.js +67 -303
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +0 -4
- package/dist/src/commands/rebuild-operations.js +9 -8
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +14 -6
- package/dist/src/commands/rebuild-platform-integration.js +310 -101
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +3 -117
- package/dist/src/commands/status-v6.js +0 -2886
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/write-commands.js +0 -3
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/index.js +44 -36
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/deployment-preferences.js +4 -3
- package/dist/src/intent/deployment-preferences.js.map +1 -1
- package/dist/src/intent/intent-store.js +3 -2
- package/dist/src/intent/intent-store.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +0 -6
- package/dist/src/output/command-receipt.js +0 -15
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/receipt-projection.js +2 -1
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/platforms/capabilities.js +8 -2
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +2 -0
- package/dist/src/platforms/discovery.d.ts +2 -0
- package/dist/src/platforms/discovery.js +95 -49
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-native.d.ts +7 -1
- package/dist/src/platforms/inspection-native.js +6 -3
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +28 -14
- package/dist/src/platforms/inspection-query.js +102 -8
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
- package/dist/src/platforms/lifecycle-native-services.js +7 -2
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.js +20 -3
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +5 -0
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/supplement-state.js +11 -2
- package/dist/src/platforms/supplement-state.js.map +1 -1
- package/dist/src/portable/commands.d.ts +1 -0
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +2 -0
- package/dist/src/portable/materializer.js +4 -4
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +1 -0
- package/dist/src/portable/recovery.js +3 -2
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +6 -1
- package/dist/src/recovery/coordinator.js +113 -108
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/demand.d.ts +1 -2
- package/dist/src/recovery/demand.js +4 -11
- package/dist/src/recovery/demand.js.map +1 -1
- package/dist/src/recovery/install-concurrency.d.ts +12 -0
- package/dist/src/recovery/install-concurrency.js +39 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.d.ts +3 -4
- package/dist/src/recovery/joint-coordinator.js +324 -188
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.js +4 -3
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/joint-install-execution.js +46 -2
- package/dist/src/recovery/joint-install-execution.js.map +1 -1
- package/dist/src/recovery/joint-install-native-rebase.js +5 -2
- package/dist/src/recovery/joint-install-native-rebase.js.map +1 -1
- package/dist/src/recovery/locked-prepared-execution.d.ts +32 -0
- package/dist/src/recovery/locked-prepared-execution.js +67 -0
- package/dist/src/recovery/locked-prepared-execution.js.map +1 -0
- package/dist/src/recovery/status.d.ts +20 -6
- package/dist/src/recovery/status.js +153 -98
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +4 -14
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +201 -57
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +8 -9
- package/dist/src/tui/controller.js +5 -6
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +14 -103
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/types.d.ts +5 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.js +1 -0
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +10 -0
- package/dist/src/utils/artifact-renderer.js +28 -2
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.d.ts +8 -0
- package/dist/src/utils/aw-home-mutation-lock.js +44 -8
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-integrity.js +126 -33
- package/dist/src/utils/bundle-integrity.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +4 -0
- package/dist/src/utils/catalog-generation-resolver.js +4 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +50 -11
- package/dist/src/utils/catalog-generation-service.js +276 -130
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.js +6 -1
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +5 -0
- package/dist/src/utils/catalog-generation-store.js +36 -13
- package/dist/src/utils/catalog-generation-store.js.map +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +17 -3
- package/dist/src/utils/catalog-operation-context.js +220 -22
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-performance.d.ts +3 -0
- package/dist/src/utils/catalog-performance.js +26 -0
- package/dist/src/utils/catalog-performance.js.map +1 -0
- package/dist/src/utils/catalog-snapshot.d.ts +5 -2
- package/dist/src/utils/catalog-snapshot.js +3 -2
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +2 -1
- package/dist/src/utils/catalog-source-impact.js +2 -2
- package/dist/src/utils/catalog-source-impact.js.map +1 -1
- package/dist/src/utils/catalog-source-references.d.ts +2 -0
- package/dist/src/utils/catalog-source-references.js +284 -148
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-executable-discovery.js +1 -0
- package/dist/src/utils/codex-executable-discovery.js.map +1 -1
- package/dist/src/utils/codex-manager.js +1 -0
- package/dist/src/utils/codex-manager.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +5 -2
- package/dist/src/utils/codex-native-observation.js +8 -4
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +1 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +38 -5
- package/dist/src/utils/git-catalog-provider.js +365 -156
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/managed-command-closure.d.ts +3 -1
- package/dist/src/utils/managed-command-closure.js +10 -5
- package/dist/src/utils/managed-command-closure.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +2 -0
- package/dist/src/utils/managed-command-materialization.js +4 -3
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-preparation.js +1 -1
- package/dist/src/utils/managed-command-preparation.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +1 -1
- package/dist/src/utils/multi-source-catalog.js +3 -3
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +6 -1
- package/dist/src/utils/native-cli.js +67 -32
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +2 -0
- package/dist/src/utils/platform-empty-state.js +5 -5
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.d.ts +14 -4
- package/dist/src/utils/plugin-config-command-apply.js +49 -5
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +42 -0
- package/dist/src/utils/plugin-config-impact.js +170 -14
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-references.d.ts +3 -1
- package/dist/src/utils/plugin-config-references.js +3 -5
- package/dist/src/utils/plugin-config-references.js.map +1 -1
- package/dist/src/utils/plugin-config-write.d.ts +14 -5
- package/dist/src/utils/plugin-config-write.js +213 -117
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +2 -0
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +2 -0
- package/dist/src/utils/plugin-scripts.js +102 -3
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/package.json +3 -5
- package/dist/src/utils/codex-reconciler.d.ts +0 -123
- package/dist/src/utils/codex-reconciler.js +0 -322
- package/dist/src/utils/codex-reconciler.js.map +0 -1
|
@@ -780,8 +780,68 @@ function sharedOwnerTokenReferences(filePath, tokens, errors, env, cwd) {
|
|
|
780
780
|
}
|
|
781
781
|
return output;
|
|
782
782
|
}
|
|
783
|
-
|
|
784
|
-
|
|
783
|
+
function createInventoryCallReadCache() {
|
|
784
|
+
return {
|
|
785
|
+
codexConfig: new Map(),
|
|
786
|
+
jsonFile: new Map(),
|
|
787
|
+
ownedHeaders: new Map(),
|
|
788
|
+
canonicalRoot: new Map(),
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
function readCachedCodexConfig(filePath, cache) {
|
|
792
|
+
if (!cache)
|
|
793
|
+
return readCodexConfigFile(filePath);
|
|
794
|
+
let pending = cache.codexConfig.get(filePath);
|
|
795
|
+
if (!pending) {
|
|
796
|
+
pending = readCodexConfigFile(filePath);
|
|
797
|
+
// Keep cached rejections handled so unused callers never trigger unhandledRejection.
|
|
798
|
+
pending.catch(() => undefined);
|
|
799
|
+
cache.codexConfig.set(filePath, pending);
|
|
800
|
+
}
|
|
801
|
+
return pending;
|
|
802
|
+
}
|
|
803
|
+
function readCachedJsonFile(filePath, cache) {
|
|
804
|
+
if (!cache)
|
|
805
|
+
return readJsonFileIfExists(filePath);
|
|
806
|
+
let pending = cache.jsonFile.get(filePath);
|
|
807
|
+
if (!pending) {
|
|
808
|
+
pending = readJsonFileIfExists(filePath);
|
|
809
|
+
pending.catch(() => undefined);
|
|
810
|
+
cache.jsonFile.set(filePath, pending);
|
|
811
|
+
}
|
|
812
|
+
return pending;
|
|
813
|
+
}
|
|
814
|
+
async function readCachedOwnedHeaders(directory, extensions, recursive, errors, env, cwd, cache) {
|
|
815
|
+
if (!cache)
|
|
816
|
+
return findOwnedHeadersInDirectory(directory, extensions, recursive, errors, env, cwd);
|
|
817
|
+
const key = JSON.stringify([directory, [...extensions].sort(), recursive]);
|
|
818
|
+
let pending = cache.ownedHeaders.get(key);
|
|
819
|
+
if (!pending) {
|
|
820
|
+
pending = (async () => {
|
|
821
|
+
const localErrors = [];
|
|
822
|
+
const localRefs = await findOwnedHeadersInDirectory(directory, extensions, recursive, localErrors, env, cwd);
|
|
823
|
+
return { references: localRefs, errors: localErrors };
|
|
824
|
+
})();
|
|
825
|
+
pending.catch(() => undefined);
|
|
826
|
+
cache.ownedHeaders.set(key, pending);
|
|
827
|
+
}
|
|
828
|
+
const result = await pending;
|
|
829
|
+
errors.push(...result.errors);
|
|
830
|
+
return result.references;
|
|
831
|
+
}
|
|
832
|
+
function readCachedCanonicalNamespaceRoot(root, cache) {
|
|
833
|
+
if (!cache)
|
|
834
|
+
return canonicalNamespaceRoot(root);
|
|
835
|
+
let pending = cache.canonicalRoot.get(root);
|
|
836
|
+
if (!pending) {
|
|
837
|
+
pending = canonicalNamespaceRoot(root);
|
|
838
|
+
pending.catch(() => undefined);
|
|
839
|
+
cache.canonicalRoot.set(root, pending);
|
|
840
|
+
}
|
|
841
|
+
return pending;
|
|
842
|
+
}
|
|
843
|
+
async function codexSharedOwnerReferences(filePath, scope, errors, env, cwd, cache) {
|
|
844
|
+
const config = await readCachedCodexConfig(filePath, cache);
|
|
785
845
|
const ownerValues = [
|
|
786
846
|
...Object.keys(config.snapshot.developerInstructions.managedBlocks).map((value) => ({
|
|
787
847
|
value,
|
|
@@ -805,8 +865,8 @@ async function codexSharedOwnerReferences(filePath, scope, errors, env, cwd) {
|
|
|
805
865
|
}
|
|
806
866
|
return references;
|
|
807
867
|
}
|
|
808
|
-
async function claudeSharedOwnerReferences(filePath, scope, errors, env, cwd) {
|
|
809
|
-
const settings = await
|
|
868
|
+
async function claudeSharedOwnerReferences(filePath, scope, errors, env, cwd, cache) {
|
|
869
|
+
const settings = await readCachedJsonFile(filePath, cache);
|
|
810
870
|
const generated = settings && isRecord(settings.awGenerated) ? settings.awGenerated : null;
|
|
811
871
|
const permissions = generated && isRecord(generated.permissions) ? generated.permissions : {};
|
|
812
872
|
const keys = Object.keys(permissions);
|
|
@@ -1073,7 +1133,7 @@ export async function offlineOwnedPathEvidence(location) {
|
|
|
1073
1133
|
return `sha256:${crypto.createHash('sha256').update(await fs.readFile(location)).digest('hex')}`;
|
|
1074
1134
|
}
|
|
1075
1135
|
async function observedProjectReference(options) {
|
|
1076
|
-
const { binding, layout, errors, env, cwd } = options;
|
|
1136
|
+
const { binding, layout, errors, env, cwd, cache } = options;
|
|
1077
1137
|
if (binding.scope.kind !== 'project')
|
|
1078
1138
|
return false;
|
|
1079
1139
|
const projectRoot = binding.scope.projectRoot;
|
|
@@ -1085,8 +1145,8 @@ async function observedProjectReference(options) {
|
|
|
1085
1145
|
const recorded = await inventoryRead({ errors, env, cwd, location: settingsPath, kind: 'nativeProjectActivationRead', absent: false,
|
|
1086
1146
|
operation: async () => {
|
|
1087
1147
|
if (binding.platform === 'codex')
|
|
1088
|
-
return Object.hasOwn((await
|
|
1089
|
-
const value = await
|
|
1148
|
+
return Object.hasOwn((await readCachedCodexConfig(settingsPath, cache)).snapshot.plugins, nativeId);
|
|
1149
|
+
const value = await readCachedJsonFile(settingsPath, cache);
|
|
1090
1150
|
if (value == null)
|
|
1091
1151
|
return false;
|
|
1092
1152
|
if (!isRecord(value) || value.enabledPlugins !== undefined && !isRecord(value.enabledPlugins))
|
|
@@ -1101,9 +1161,9 @@ async function observedProjectReference(options) {
|
|
|
1101
1161
|
const policyKey = await getInvocationPolicyPhysicalKey({ cwd, env }, binding);
|
|
1102
1162
|
const supplementKeys = new Set([policyKey, ...layout.renderUnits.filter((unit) => unit.output === 'supplement').map((unit) => unit.physicalKey)]);
|
|
1103
1163
|
const references = binding.platform === 'codex'
|
|
1104
|
-
? [...await
|
|
1105
|
-
...await
|
|
1106
|
-
: await claudeSharedOwnerReferences(path.join(projectRoot, '.claude/settings.local.json'), 'project', errors, env, cwd);
|
|
1164
|
+
? [...await readCachedOwnedHeaders(path.join(projectRoot, '.codex/agents'), new Set(['.toml']), false, errors, env, cwd, cache),
|
|
1165
|
+
...await readCachedOwnedHeaders(path.join(projectRoot, '.codex/rules'), new Set(['.rules']), false, errors, env, cwd, cache)]
|
|
1166
|
+
: await claudeSharedOwnerReferences(path.join(projectRoot, '.claude/settings.local.json'), 'project', errors, env, cwd, cache);
|
|
1107
1167
|
if (references.some((reference) => {
|
|
1108
1168
|
const identity = reference.ownedComponent?.identity;
|
|
1109
1169
|
return identity?.pluginId === binding.plugin.pluginId && identity.sourceIdentity === binding.plugin.sourceIdentity
|
|
@@ -1116,11 +1176,47 @@ async function observedProjectReference(options) {
|
|
|
1116
1176
|
const installedPath = path.join(resolvePlatformConfigRoot('claude', { cwd, env }), 'plugins/installed_plugins.json');
|
|
1117
1177
|
return inventoryRead({ errors, env, cwd, location: installedPath, kind: 'nativeProjectRegistrationRead', absent: false,
|
|
1118
1178
|
operation: async () => {
|
|
1119
|
-
const value = await
|
|
1179
|
+
const value = await readCachedJsonFile(installedPath, cache) ?? null;
|
|
1120
1180
|
return claudeConsumersFromInstalled(value, layout.marketplaceName, projectRoot).some((consumer) => consumer.scope === 'project' && consumer.pluginName === binding.plugin.pluginId.split('/').at(-1));
|
|
1121
1181
|
} });
|
|
1122
1182
|
}
|
|
1123
|
-
|
|
1183
|
+
/** Keep the global namespace/ownership gate without hashing unrelated bytes.
|
|
1184
|
+
* The selected paths still receive their full revision evidence. */
|
|
1185
|
+
async function verifyOrdinaryPackageTree(root) {
|
|
1186
|
+
const rootStat = await fs.lstat(root);
|
|
1187
|
+
if (!rootStat.isDirectory() || rootStat.isSymbolicLink())
|
|
1188
|
+
throw new Error('offlineCleanupPathUnsafe');
|
|
1189
|
+
const useDirentType = process.platform !== 'win32';
|
|
1190
|
+
const walk = async (directory) => {
|
|
1191
|
+
const entries = (await fs.readdir(directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));
|
|
1192
|
+
for (let start = 0; start < entries.length; start += 8) {
|
|
1193
|
+
await Promise.all(entries.slice(start, start + 8).map(async (entry) => {
|
|
1194
|
+
const location = path.join(directory, entry.name);
|
|
1195
|
+
if (useDirentType) {
|
|
1196
|
+
if (entry.isSymbolicLink())
|
|
1197
|
+
throw new Error('offlineCleanupPathUnsafe');
|
|
1198
|
+
if (entry.isDirectory()) {
|
|
1199
|
+
await walk(location);
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
if (entry.isFile()) {
|
|
1203
|
+
await fs.access(location, fs.constants.R_OK);
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
const node = await fs.lstat(location);
|
|
1208
|
+
if (node.isDirectory())
|
|
1209
|
+
await walk(location);
|
|
1210
|
+
else if (node.isFile())
|
|
1211
|
+
await fs.access(location, fs.constants.R_OK);
|
|
1212
|
+
else
|
|
1213
|
+
throw new Error('offlineCleanupPathUnsafe');
|
|
1214
|
+
}));
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
await walk(root);
|
|
1218
|
+
}
|
|
1219
|
+
async function nativeOwnedReferences(options, errors, cache) {
|
|
1124
1220
|
const references = [];
|
|
1125
1221
|
const ctx = { cwd: options.cwd, env: options.env };
|
|
1126
1222
|
const projectRoot = canonicalizePathThroughExistingAncestorSync(resolveRepoRootSync(options.cwd));
|
|
@@ -1147,7 +1243,7 @@ async function nativeOwnedReferences(options, errors) {
|
|
|
1147
1243
|
add(path.join(projectRoot, '.grok/plugins'), platform, 'project', 'grok-directory', hostRoot);
|
|
1148
1244
|
}
|
|
1149
1245
|
}
|
|
1150
|
-
const awRoot = await
|
|
1246
|
+
const awRoot = await readCachedCanonicalNamespaceRoot(resolveAwHome(options.env), cache);
|
|
1151
1247
|
const managed = path.join(awRoot, 'platforms');
|
|
1152
1248
|
for (const platform of NATIVE_PLATFORM_TARGETS) {
|
|
1153
1249
|
const namespaces = await inventoryCanonicalDirectoryEntries({ location: path.join(managed, platform),
|
|
@@ -1168,6 +1264,100 @@ async function nativeOwnedReferences(options, errors) {
|
|
|
1168
1264
|
}
|
|
1169
1265
|
}
|
|
1170
1266
|
}
|
|
1267
|
+
const inspectPackageEntry = async (root, descriptor, entryName) => {
|
|
1268
|
+
const localRefs = [];
|
|
1269
|
+
const localErrs = [];
|
|
1270
|
+
const packageRoot = path.join(root, entryName);
|
|
1271
|
+
const markerPath = path.join(packageRoot, SKILL_OWNER_MARKER);
|
|
1272
|
+
try {
|
|
1273
|
+
const marker = await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root });
|
|
1274
|
+
if (!marker)
|
|
1275
|
+
return { refs: localRefs, errs: localErrs };
|
|
1276
|
+
if (!marker.sourceId || !marker.sourceIdentity || !marker.physicalKey || !marker.pluginId
|
|
1277
|
+
|| marker.platform !== descriptor.platform || marker.scope !== descriptor.scope)
|
|
1278
|
+
return { refs: localRefs, errs: localErrs };
|
|
1279
|
+
const { schemaVersion: _schema, nativeProjection: projection, ...identity } = marker;
|
|
1280
|
+
let configRoot = descriptor.hostRoot;
|
|
1281
|
+
const physical = projection?.physicalIdentity;
|
|
1282
|
+
const antigravityCopy = !descriptor.managed && descriptor.platform === 'antigravity' && descriptor.scope === 'user'
|
|
1283
|
+
&& physical?.route === 'antigravity-cli';
|
|
1284
|
+
const route = antigravityCopy ? 'antigravity-cli' : descriptor.route;
|
|
1285
|
+
if (descriptor.managed && physical && physical.platform === descriptor.platform && physical.route === descriptor.route
|
|
1286
|
+
&& physical.sourceIdentity === marker.sourceIdentity && physical.pluginId === marker.pluginId
|
|
1287
|
+
&& getPhysicalKey(physical) === marker.physicalKey)
|
|
1288
|
+
configRoot = physical.namespaceRoot;
|
|
1289
|
+
const binding = { id: '', plugin: { sourceId: marker.sourceId, sourceIdentity: marker.sourceIdentity,
|
|
1290
|
+
pluginId: marker.pluginId, version: '0.0.0' }, platform: descriptor.platform,
|
|
1291
|
+
scope: descriptor.scope === 'user' ? { kind: 'user' } : { kind: 'project', projectRoot }, route,
|
|
1292
|
+
consumers: [{ id: identityDigest({ platform: descriptor.platform, route, configRoot }),
|
|
1293
|
+
product: 'cli', version: null, availability: 'missing', reasonCodes: ['client-missing'],
|
|
1294
|
+
entry: { kind: 'directory', configRoot } }], physicalKey: marker.physicalKey,
|
|
1295
|
+
activationKey: '', renderUnitIds: [] };
|
|
1296
|
+
const layout = await getDeploymentLayout(ctx, binding);
|
|
1297
|
+
const expectedPackageRoot = antigravityCopy
|
|
1298
|
+
? path.join(layout.physicalIdentity.namespaceRoot, 'plugins', layout.nativeIdentity.packageId) : layout.packageRoot;
|
|
1299
|
+
if (canonicalizePathThroughExistingAncestorSync(expectedPackageRoot) !== canonicalizePathThroughExistingAncestorSync(packageRoot)
|
|
1300
|
+
|| getPhysicalKey(layout.physicalIdentity) !== marker.physicalKey)
|
|
1301
|
+
throw new Error('nativeOwnerPlacementMismatch');
|
|
1302
|
+
const projectComponent = isAntigravityProjectDirectory(binding) ? deploymentPackageComponent(binding, layout) : undefined;
|
|
1303
|
+
if (projectComponent) {
|
|
1304
|
+
const owned = await inspectOwnedComponents({ components: [projectComponent] });
|
|
1305
|
+
if (owned.components[0]?.state !== 'present') {
|
|
1306
|
+
localErrs.push(inventoryError(new Error('The Antigravity project package has unconfirmed content.'), packageRoot, 'nativeOwnerContentUnconfirmed', options.env, options.cwd, { global: false, platform: descriptor.platform,
|
|
1307
|
+
scope: descriptor.scope, sourceId: marker.sourceId, pluginName: marker.plugin }));
|
|
1308
|
+
return { refs: localRefs, errs: localErrs };
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
const inspectCopy = !options.observationPlugins || options.observationPlugins.has(marker.pluginId)
|
|
1312
|
+
|| options.observationPlugins.has(marker.pluginId.slice(marker.pluginId.indexOf('/') + 1));
|
|
1313
|
+
if (antigravityCopy && inspectCopy) {
|
|
1314
|
+
await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root,
|
|
1315
|
+
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
1316
|
+
if (!projection || getPhysicalKey(projection.physicalIdentity) !== marker.physicalKey
|
|
1317
|
+
|| await readPlatformPackageContentDigest(packageRoot) !== projection.contentDigest)
|
|
1318
|
+
throw new Error('nativeCopyContentUnconfirmed');
|
|
1319
|
+
}
|
|
1320
|
+
const component = projectComponent ?? { kind: 'owned-directory', path: packageRoot, allowedRoot: root, identity };
|
|
1321
|
+
const scopes = descriptor.scope === 'user' && options.scope !== 'user'
|
|
1322
|
+
&& ['codex', 'claude', 'copilot'].includes(descriptor.platform) ? ['user', 'project'] : [descriptor.scope];
|
|
1323
|
+
let pathEvidence;
|
|
1324
|
+
if (options.collectPathEvidence !== false) {
|
|
1325
|
+
if (!options.nativePathEvidencePlugins || options.nativePathEvidencePlugins.has(marker.pluginId)) {
|
|
1326
|
+
pathEvidence = await offlineOwnedPathEvidence(packageRoot);
|
|
1327
|
+
}
|
|
1328
|
+
else
|
|
1329
|
+
await verifyOrdinaryPackageTree(packageRoot);
|
|
1330
|
+
}
|
|
1331
|
+
for (const scope of scopes) {
|
|
1332
|
+
const scopedBinding = { ...binding, scope: scope === 'user' ? { kind: 'user' }
|
|
1333
|
+
: { kind: 'project', projectRoot }, consumers: binding.consumers.map((consumer) => ({ ...consumer })) };
|
|
1334
|
+
const scopedLayout = await getDeploymentLayout(ctx, scopedBinding);
|
|
1335
|
+
if (scope === 'project' && descriptor.scope === 'user'
|
|
1336
|
+
&& !await observedProjectReference({ binding: scopedBinding, layout: scopedLayout, cwd: options.cwd, env: options.env, errors: localErrs, cache }))
|
|
1337
|
+
continue;
|
|
1338
|
+
scopedBinding.activationKey = identityDigest({ physicalKey: scopedBinding.physicalKey, scope: scopedBinding.scope,
|
|
1339
|
+
activationPath: scopedLayout.activationPath });
|
|
1340
|
+
scopedBinding.id = identityDigest({ sourceIdentity: marker.sourceIdentity, pluginId: marker.pluginId,
|
|
1341
|
+
platform: scopedBinding.platform, scope: scopedBinding.scope, route: scopedBinding.route, physicalKey: scopedBinding.physicalKey });
|
|
1342
|
+
scopedBinding.renderUnitIds = scopedLayout.renderUnits.map((unit) => unit.id);
|
|
1343
|
+
const recoveryCandidate = { binding: scopedBinding, physicalIdentity: scopedLayout.physicalIdentity,
|
|
1344
|
+
nativeIdentity: scopedLayout.nativeIdentity, evidence: antigravityCopy && !inspectCopy ? 'unknown' : 'verified' };
|
|
1345
|
+
// A copied marker is a native recovery clue, never direct filesystem
|
|
1346
|
+
// removal authority for the cache or ownership of the AW source path.
|
|
1347
|
+
const currentMarketplaceRoot = scopedLayout.marketplaceRoot && descriptor.managed
|
|
1348
|
+
? path.join(getManagedPlatformRoot(awRoot, descriptor.platform, descriptor.route, await readCachedCanonicalNamespaceRoot(descriptor.hostRoot, cache)), 'marketplaces', marker.sourceId) : null;
|
|
1349
|
+
localRefs.push({ kind: antigravityCopy ? 'namespacedMarketplace' : 'namespacedOwner', location: markerPath, sourceId: marker.sourceId,
|
|
1350
|
+
sourceIdentity: marker.sourceIdentity, pluginName: marker.plugin, platform: descriptor.platform, scope,
|
|
1351
|
+
...(!antigravityCopy ? { ownedComponent: component } : {}), recoveryCandidate, pathEvidence,
|
|
1352
|
+
...(currentMarketplaceRoot && scopedLayout.marketplaceRoot === currentMarketplaceRoot
|
|
1353
|
+
? { marketplaceRoot: currentMarketplaceRoot } : {}) });
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
catch (error) {
|
|
1357
|
+
localErrs.push(inventoryError(error, markerPath, 'nativeOwnerRead', options.env, options.cwd, { global: false, platform: descriptor.platform, scope: descriptor.scope }));
|
|
1358
|
+
}
|
|
1359
|
+
return { refs: localRefs, errs: localErrs };
|
|
1360
|
+
};
|
|
1171
1361
|
for (const [root, descriptor] of roots) {
|
|
1172
1362
|
if (canonicalizePathThroughExistingAncestorSync(root) !== path.resolve(root)) {
|
|
1173
1363
|
errors.push(inventoryError(new Error('Native namespace path contains a symbolic link.'), root, 'nativeNamespaceUnsafe', options.env, options.cwd, { global: false, platform: descriptor.platform, scope: descriptor.scope,
|
|
@@ -1175,90 +1365,12 @@ async function nativeOwnedReferences(options, errors) {
|
|
|
1175
1365
|
continue;
|
|
1176
1366
|
}
|
|
1177
1367
|
const entries = await inventoryCanonicalDirectoryEntries({ location: root, kind: 'nativePackageRead', errors, env: options.env, cwd: options.cwd });
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
const marker = await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root });
|
|
1185
|
-
if (!marker)
|
|
1186
|
-
continue;
|
|
1187
|
-
if (!marker.sourceId || !marker.sourceIdentity || !marker.physicalKey || !marker.pluginId
|
|
1188
|
-
|| marker.platform !== descriptor.platform || marker.scope !== descriptor.scope)
|
|
1189
|
-
continue;
|
|
1190
|
-
const { schemaVersion: _schema, nativeProjection: projection, ...identity } = marker;
|
|
1191
|
-
let configRoot = descriptor.hostRoot;
|
|
1192
|
-
const physical = projection?.physicalIdentity;
|
|
1193
|
-
const antigravityCopy = !descriptor.managed && descriptor.platform === 'antigravity' && descriptor.scope === 'user'
|
|
1194
|
-
&& physical?.route === 'antigravity-cli';
|
|
1195
|
-
const route = antigravityCopy ? 'antigravity-cli' : descriptor.route;
|
|
1196
|
-
if (descriptor.managed && physical && physical.platform === descriptor.platform && physical.route === descriptor.route
|
|
1197
|
-
&& physical.sourceIdentity === marker.sourceIdentity && physical.pluginId === marker.pluginId
|
|
1198
|
-
&& getPhysicalKey(physical) === marker.physicalKey)
|
|
1199
|
-
configRoot = physical.namespaceRoot;
|
|
1200
|
-
const binding = { id: '', plugin: { sourceId: marker.sourceId, sourceIdentity: marker.sourceIdentity,
|
|
1201
|
-
pluginId: marker.pluginId, version: '0.0.0' }, platform: descriptor.platform,
|
|
1202
|
-
scope: descriptor.scope === 'user' ? { kind: 'user' } : { kind: 'project', projectRoot }, route,
|
|
1203
|
-
consumers: [{ id: identityDigest({ platform: descriptor.platform, route, configRoot }),
|
|
1204
|
-
product: 'cli', version: null, availability: 'missing', reasonCodes: ['client-missing'],
|
|
1205
|
-
entry: { kind: 'directory', configRoot } }], physicalKey: marker.physicalKey,
|
|
1206
|
-
activationKey: '', renderUnitIds: [] };
|
|
1207
|
-
const layout = await getDeploymentLayout(ctx, binding);
|
|
1208
|
-
const expectedPackageRoot = antigravityCopy
|
|
1209
|
-
? path.join(layout.physicalIdentity.namespaceRoot, 'plugins', layout.nativeIdentity.packageId) : layout.packageRoot;
|
|
1210
|
-
if (canonicalizePathThroughExistingAncestorSync(expectedPackageRoot) !== canonicalizePathThroughExistingAncestorSync(packageRoot)
|
|
1211
|
-
|| getPhysicalKey(layout.physicalIdentity) !== marker.physicalKey)
|
|
1212
|
-
throw new Error('nativeOwnerPlacementMismatch');
|
|
1213
|
-
const projectComponent = isAntigravityProjectDirectory(binding) ? deploymentPackageComponent(binding, layout) : undefined;
|
|
1214
|
-
if (projectComponent) {
|
|
1215
|
-
const owned = await inspectOwnedComponents({ components: [projectComponent] });
|
|
1216
|
-
if (owned.components[0]?.state !== 'present') {
|
|
1217
|
-
errors.push(inventoryError(new Error('The Antigravity project package has unconfirmed content.'), packageRoot, 'nativeOwnerContentUnconfirmed', options.env, options.cwd, { global: false, platform: descriptor.platform,
|
|
1218
|
-
scope: descriptor.scope, sourceId: marker.sourceId, pluginName: marker.plugin }));
|
|
1219
|
-
continue;
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
const inspectCopy = !options.observationPlugins || options.observationPlugins.has(marker.pluginId)
|
|
1223
|
-
|| options.observationPlugins.has(marker.pluginId.slice(marker.pluginId.indexOf('/') + 1));
|
|
1224
|
-
if (antigravityCopy && inspectCopy) {
|
|
1225
|
-
await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root,
|
|
1226
|
-
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
1227
|
-
if (!projection || getPhysicalKey(projection.physicalIdentity) !== marker.physicalKey
|
|
1228
|
-
|| await readPlatformPackageContentDigest(packageRoot) !== projection.contentDigest)
|
|
1229
|
-
throw new Error('nativeCopyContentUnconfirmed');
|
|
1230
|
-
}
|
|
1231
|
-
const component = projectComponent ?? { kind: 'owned-directory', path: packageRoot, allowedRoot: root, identity };
|
|
1232
|
-
const scopes = descriptor.scope === 'user' && options.scope !== 'user'
|
|
1233
|
-
&& ['codex', 'claude', 'copilot'].includes(descriptor.platform) ? ['user', 'project'] : [descriptor.scope];
|
|
1234
|
-
const pathEvidence = options.collectPathEvidence === false ? undefined : await offlineOwnedPathEvidence(packageRoot);
|
|
1235
|
-
for (const scope of scopes) {
|
|
1236
|
-
const scopedBinding = { ...binding, scope: scope === 'user' ? { kind: 'user' }
|
|
1237
|
-
: { kind: 'project', projectRoot }, consumers: binding.consumers.map((consumer) => ({ ...consumer })) };
|
|
1238
|
-
const scopedLayout = await getDeploymentLayout(ctx, scopedBinding);
|
|
1239
|
-
if (scope === 'project' && descriptor.scope === 'user'
|
|
1240
|
-
&& !await observedProjectReference({ binding: scopedBinding, layout: scopedLayout, cwd: options.cwd, env: options.env, errors }))
|
|
1241
|
-
continue;
|
|
1242
|
-
scopedBinding.activationKey = identityDigest({ physicalKey: scopedBinding.physicalKey, scope: scopedBinding.scope,
|
|
1243
|
-
activationPath: scopedLayout.activationPath });
|
|
1244
|
-
scopedBinding.id = identityDigest({ sourceIdentity: marker.sourceIdentity, pluginId: marker.pluginId,
|
|
1245
|
-
platform: scopedBinding.platform, scope: scopedBinding.scope, route: scopedBinding.route, physicalKey: scopedBinding.physicalKey });
|
|
1246
|
-
scopedBinding.renderUnitIds = scopedLayout.renderUnits.map((unit) => unit.id);
|
|
1247
|
-
const recoveryCandidate = { binding: scopedBinding, physicalIdentity: scopedLayout.physicalIdentity,
|
|
1248
|
-
nativeIdentity: scopedLayout.nativeIdentity, evidence: antigravityCopy && !inspectCopy ? 'unknown' : 'verified' };
|
|
1249
|
-
// A copied marker is a native recovery clue, never direct filesystem
|
|
1250
|
-
// removal authority for the cache or ownership of the AW source path.
|
|
1251
|
-
const currentMarketplaceRoot = scopedLayout.marketplaceRoot && descriptor.managed
|
|
1252
|
-
? path.join(getManagedPlatformRoot(awRoot, descriptor.platform, descriptor.route, await canonicalNamespaceRoot(descriptor.hostRoot)), 'marketplaces', marker.sourceId) : null;
|
|
1253
|
-
references.push({ kind: antigravityCopy ? 'namespacedMarketplace' : 'namespacedOwner', location: markerPath, sourceId: marker.sourceId,
|
|
1254
|
-
sourceIdentity: marker.sourceIdentity, pluginName: marker.plugin, platform: descriptor.platform, scope,
|
|
1255
|
-
...(!antigravityCopy ? { ownedComponent: component } : {}), recoveryCandidate, pathEvidence,
|
|
1256
|
-
...(currentMarketplaceRoot && scopedLayout.marketplaceRoot === currentMarketplaceRoot
|
|
1257
|
-
? { marketplaceRoot: currentMarketplaceRoot } : {}) });
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
catch (error) {
|
|
1261
|
-
errors.push(inventoryError(error, markerPath, 'nativeOwnerRead', options.env, options.cwd, { global: false, platform: descriptor.platform, scope: descriptor.scope }));
|
|
1368
|
+
const directories = entries.filter((entry) => entry.isDirectory() && !entry.isSymbolicLink());
|
|
1369
|
+
for (let start = 0; start < directories.length; start += 8) {
|
|
1370
|
+
const batch = await Promise.all(directories.slice(start, start + 8).map((entry) => inspectPackageEntry(root, descriptor, entry.name)));
|
|
1371
|
+
for (const item of batch) {
|
|
1372
|
+
references.push(...item.refs);
|
|
1373
|
+
errors.push(...item.errs);
|
|
1262
1374
|
}
|
|
1263
1375
|
}
|
|
1264
1376
|
}
|
|
@@ -1281,6 +1393,7 @@ async function nativeOwnedReferences(options, errors) {
|
|
|
1281
1393
|
export async function inventoryCatalogSourceReferences(options) {
|
|
1282
1394
|
const env = options.env ?? process.env;
|
|
1283
1395
|
const awHome = resolveAwHome(env);
|
|
1396
|
+
const callCache = createInventoryCallReadCache();
|
|
1284
1397
|
const references = [];
|
|
1285
1398
|
const errors = [];
|
|
1286
1399
|
const canonicalProjectRoot = await inventoryRead({
|
|
@@ -1391,63 +1504,86 @@ export async function inventoryCatalogSourceReferences(options) {
|
|
|
1391
1504
|
}
|
|
1392
1505
|
}
|
|
1393
1506
|
}
|
|
1394
|
-
|
|
1395
|
-
const ownerInventory = await inventoryLegacyOwnerReferences(options);
|
|
1396
|
-
references.push(...ownerInventory.references);
|
|
1397
|
-
errors.push(...ownerInventory.errors);
|
|
1398
|
-
for (const [location, kind, operation] of [
|
|
1399
|
-
[path.join(getCodexHome(env), 'config.toml'), 'nativeStateRead', () => codexSharedOwnerReferences(path.join(getCodexHome(env), 'config.toml'), 'user', errors, env, options.cwd)],
|
|
1400
|
-
[path.join(getClaudeHome(env), 'settings.json'), 'nativeStateRead', () => claudeSharedOwnerReferences(path.join(getClaudeHome(env), 'settings.json'), 'user', errors, env, options.cwd)],
|
|
1401
|
-
[path.join(resolveRepoRootSync(options.cwd), '.codex', 'config.toml'), 'nativeStateRead', () => codexSharedOwnerReferences(path.join(resolveRepoRootSync(options.cwd), '.codex', 'config.toml'), 'project', errors, env, options.cwd)],
|
|
1402
|
-
[path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json'), 'nativeStateRead', () => claudeSharedOwnerReferences(path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json'), 'project', errors, env, options.cwd)],
|
|
1403
|
-
]) {
|
|
1404
|
-
references.push(...await inventoryRead({
|
|
1405
|
-
operation, absent: [], errors, location, kind, env, cwd: options.cwd,
|
|
1406
|
-
}));
|
|
1407
|
-
}
|
|
1408
|
-
references.push(...await oldMarketplaceReferences(env, options.cwd, errors, options.includePlatformHistoricalProjects === true));
|
|
1409
|
-
const marketplacesRoot = path.join(awHome, 'marketplaces');
|
|
1507
|
+
const repoRoot = resolveRepoRootSync(options.cwd);
|
|
1410
1508
|
const codexConfigPath = path.join(getCodexHome(env), 'config.toml');
|
|
1411
|
-
const
|
|
1412
|
-
operation: () => readCodexConfigFile(codexConfigPath), absent: null, errors,
|
|
1413
|
-
location: codexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1414
|
-
});
|
|
1415
|
-
const projectCodexConfigPath = path.join(resolveRepoRootSync(options.cwd), '.codex', 'config.toml');
|
|
1416
|
-
const projectCodexConfig = await inventoryRead({
|
|
1417
|
-
operation: () => readCodexConfigFile(projectCodexConfigPath), absent: null, errors,
|
|
1418
|
-
location: projectCodexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1419
|
-
});
|
|
1509
|
+
const projectCodexConfigPath = path.join(repoRoot, '.codex', 'config.toml');
|
|
1420
1510
|
const userClaudeSettingsPath = path.join(getClaudeHome(env), 'settings.json');
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
location: userClaudeSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1424
|
-
});
|
|
1425
|
-
const projectClaudeSettingsPath = path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.json');
|
|
1426
|
-
const projectClaudeSettings = await inventoryRead({
|
|
1427
|
-
operation: () => readJsonFileIfExists(projectClaudeSettingsPath), absent: null, errors,
|
|
1428
|
-
location: projectClaudeSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1429
|
-
});
|
|
1511
|
+
const projectClaudeSettingsPath = path.join(repoRoot, '.claude', 'settings.json');
|
|
1512
|
+
const projectClaudeLocalSettingsPath = path.join(repoRoot, '.claude', 'settings.local.json');
|
|
1430
1513
|
const claudeKnownPath = path.join(getClaudeHome(env), 'plugins', 'known_marketplaces.json');
|
|
1431
|
-
const claudeKnown = await inventoryRead({
|
|
1432
|
-
operation: () => readJsonFileIfExists(claudeKnownPath), absent: null, errors,
|
|
1433
|
-
location: claudeKnownPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1434
|
-
});
|
|
1435
1514
|
const claudeInstalledPath = path.join(getClaudeHome(env), 'plugins', 'installed_plugins.json');
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1515
|
+
const marketplacesRoot = path.join(awHome, 'marketplaces');
|
|
1516
|
+
const nativeErrors = [];
|
|
1517
|
+
const oldMarketplaceErrors = [];
|
|
1518
|
+
const sharedOwnerErrors = [];
|
|
1519
|
+
const hostStateErrors = [];
|
|
1520
|
+
const [nativeRefs, ownerInventory, sharedOwnerRefs, oldMarketplaceRefs, codexConfig, projectCodexConfig, userClaudeSettings, projectClaudeSettings, claudeKnown, claudeInstalled, marketplaceEntries, canonicalAwRoot, projectClaudeLocalSettings,] = await Promise.all([
|
|
1521
|
+
nativeOwnedReferences({ ...options, env }, nativeErrors, callCache),
|
|
1522
|
+
inventoryLegacyOwnerReferences(options),
|
|
1523
|
+
Promise.all([
|
|
1524
|
+
inventoryRead({
|
|
1525
|
+
operation: () => codexSharedOwnerReferences(codexConfigPath, 'user', sharedOwnerErrors, env, options.cwd, callCache),
|
|
1526
|
+
absent: [], errors: sharedOwnerErrors, location: codexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1527
|
+
}),
|
|
1528
|
+
inventoryRead({
|
|
1529
|
+
operation: () => claudeSharedOwnerReferences(userClaudeSettingsPath, 'user', sharedOwnerErrors, env, options.cwd, callCache),
|
|
1530
|
+
absent: [], errors: sharedOwnerErrors, location: userClaudeSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1531
|
+
}),
|
|
1532
|
+
inventoryRead({
|
|
1533
|
+
operation: () => codexSharedOwnerReferences(projectCodexConfigPath, 'project', sharedOwnerErrors, env, options.cwd, callCache),
|
|
1534
|
+
absent: [], errors: sharedOwnerErrors, location: projectCodexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1535
|
+
}),
|
|
1536
|
+
inventoryRead({
|
|
1537
|
+
operation: () => claudeSharedOwnerReferences(projectClaudeLocalSettingsPath, 'project', sharedOwnerErrors, env, options.cwd, callCache),
|
|
1538
|
+
absent: [], errors: sharedOwnerErrors, location: projectClaudeLocalSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1539
|
+
}),
|
|
1540
|
+
]),
|
|
1541
|
+
oldMarketplaceReferences(env, options.cwd, oldMarketplaceErrors, options.includePlatformHistoricalProjects === true),
|
|
1542
|
+
inventoryRead({
|
|
1543
|
+
operation: () => readCachedCodexConfig(codexConfigPath, callCache), absent: null, errors: hostStateErrors,
|
|
1544
|
+
location: codexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1545
|
+
}),
|
|
1546
|
+
inventoryRead({
|
|
1547
|
+
operation: () => readCachedCodexConfig(projectCodexConfigPath, callCache), absent: null, errors: hostStateErrors,
|
|
1548
|
+
location: projectCodexConfigPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1549
|
+
}),
|
|
1550
|
+
inventoryRead({
|
|
1551
|
+
operation: () => readCachedJsonFile(userClaudeSettingsPath, callCache), absent: null, errors: hostStateErrors,
|
|
1552
|
+
location: userClaudeSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1553
|
+
}),
|
|
1554
|
+
inventoryRead({
|
|
1555
|
+
operation: () => readCachedJsonFile(projectClaudeSettingsPath, callCache), absent: null, errors: hostStateErrors,
|
|
1556
|
+
location: projectClaudeSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1557
|
+
}),
|
|
1558
|
+
inventoryRead({
|
|
1559
|
+
operation: () => readCachedJsonFile(claudeKnownPath, callCache), absent: null, errors: hostStateErrors,
|
|
1560
|
+
location: claudeKnownPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1561
|
+
}),
|
|
1562
|
+
inventoryRead({
|
|
1563
|
+
operation: () => readCachedJsonFile(claudeInstalledPath, callCache), absent: null, errors: hostStateErrors,
|
|
1564
|
+
location: claudeInstalledPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1565
|
+
}),
|
|
1566
|
+
inventoryCanonicalDirectoryEntries({
|
|
1567
|
+
errors: hostStateErrors, location: marketplacesRoot, kind: 'marketplaceDirectoryRead', env, cwd: options.cwd,
|
|
1568
|
+
}),
|
|
1569
|
+
readCachedCanonicalNamespaceRoot(awHome, callCache),
|
|
1570
|
+
inventoryRead({
|
|
1571
|
+
operation: () => readCachedJsonFile(projectClaudeLocalSettingsPath, callCache), absent: null, errors: hostStateErrors,
|
|
1572
|
+
location: projectClaudeLocalSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1573
|
+
}),
|
|
1574
|
+
]);
|
|
1575
|
+
references.push(...nativeRefs);
|
|
1576
|
+
errors.push(...nativeErrors);
|
|
1577
|
+
references.push(...ownerInventory.references);
|
|
1578
|
+
errors.push(...ownerInventory.errors);
|
|
1579
|
+
for (const chunk of sharedOwnerRefs)
|
|
1580
|
+
references.push(...chunk);
|
|
1581
|
+
errors.push(...sharedOwnerErrors);
|
|
1582
|
+
references.push(...oldMarketplaceRefs);
|
|
1583
|
+
errors.push(...oldMarketplaceErrors);
|
|
1584
|
+
errors.push(...hostStateErrors);
|
|
1444
1585
|
const managedDirectories = await managedMarketplaceDirectories(canonicalAwRoot, options.cwd, env);
|
|
1445
1586
|
const canonicalLegacyRoot = path.join(canonicalAwRoot, 'marketplaces');
|
|
1446
|
-
const projectClaudeLocalSettingsPath = path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json');
|
|
1447
|
-
const projectClaudeLocalSettings = await inventoryRead({
|
|
1448
|
-
operation: () => readJsonFileIfExists(projectClaudeLocalSettingsPath), absent: null, errors,
|
|
1449
|
-
location: projectClaudeLocalSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
|
|
1450
|
-
});
|
|
1451
1587
|
const nativeConsumers = [];
|
|
1452
1588
|
const addConsumer = (location, marketplaceName, consumer) => {
|
|
1453
1589
|
nativeConsumers.push({ kind: 'namespacedMarketplace', location, marketplaceName, ...consumer });
|