@hasna/files 0.2.21 → 0.2.22
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/cli/index.js +32 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -168344,7 +168344,8 @@ sources.command("bootstrap-prod-files").description("Create or update the produc
|
|
|
168344
168344
|
const activeDriveDestinationIds = new Set(allSources.filter((source2) => source2.enabled && source2.type === "google_drive").map((source2) => source2.config.destination_source_id).filter((id) => Boolean(id)));
|
|
168345
168345
|
const configuredDefaultId = loadConfig().google_drive_default_destination_source_id;
|
|
168346
168346
|
const candidates = allSources.filter((source2) => source2.type === "s3" && (legacyProductionNames.has(source2.name) || legacyProductionBuckets.has(source2.bucket ?? "")));
|
|
168347
|
-
const existing = candidates.find((source2) => activeDriveDestinationIds.has(source2.id)) ?? candidates.find((source2) => configuredDefaultId === source2.id) ?? candidates.find((source2) => source2.enabled) ?? candidates[0];
|
|
168347
|
+
const existing = candidates.find((source2) => activeDriveDestinationIds.has(source2.id) && source2.enabled) ?? candidates.find((source2) => configuredDefaultId === source2.id && source2.enabled) ?? candidates.find((source2) => source2.enabled && source2.bucket === opts.bucket) ?? candidates.find((source2) => source2.enabled) ?? candidates.find((source2) => configuredDefaultId === source2.id) ?? candidates.find((source2) => activeDriveDestinationIds.has(source2.id)) ?? candidates[0];
|
|
168348
|
+
const candidateIds = new Set(candidates.map((source2) => source2.id));
|
|
168348
168349
|
const source = existing ? updateSource(existing.id, {
|
|
168349
168350
|
name: opts.name,
|
|
168350
168351
|
bucket: opts.bucket,
|
|
@@ -168361,13 +168362,36 @@ sources.command("bootstrap-prod-files").description("Create or update the produc
|
|
|
168361
168362
|
config: config9,
|
|
168362
168363
|
machine_id: machine.id
|
|
168363
168364
|
});
|
|
168365
|
+
const updatedGoogleDriveSourceIds = [];
|
|
168366
|
+
for (const driveSource of allSources.filter((source2) => source2.type === "google_drive")) {
|
|
168367
|
+
const driveConfig = driveSource.config;
|
|
168368
|
+
const shouldRepairDestination = !driveConfig.destination_source_id || candidateIds.has(driveConfig.destination_source_id);
|
|
168369
|
+
if (!shouldRepairDestination || driveConfig.destination_source_id === source.id)
|
|
168370
|
+
continue;
|
|
168371
|
+
updateSource(driveSource.id, {
|
|
168372
|
+
config: {
|
|
168373
|
+
...driveConfig,
|
|
168374
|
+
destination_source_id: source.id
|
|
168375
|
+
}
|
|
168376
|
+
});
|
|
168377
|
+
updatedGoogleDriveSourceIds.push(driveSource.id);
|
|
168378
|
+
}
|
|
168379
|
+
const disabledLegacySourceIds = [];
|
|
168380
|
+
for (const candidate of candidates) {
|
|
168381
|
+
if (candidate.id === source.id || !candidate.enabled)
|
|
168382
|
+
continue;
|
|
168383
|
+
updateSource(candidate.id, { enabled: false });
|
|
168384
|
+
disabledLegacySourceIds.push(candidate.id);
|
|
168385
|
+
}
|
|
168364
168386
|
if (opts.googleDriveDefault !== false) {
|
|
168365
168387
|
setConfigValue("google_drive_default_destination_source_id", source.id);
|
|
168366
168388
|
}
|
|
168367
168389
|
if (opts.json) {
|
|
168368
168390
|
console.log(JSON.stringify({
|
|
168369
168391
|
source,
|
|
168370
|
-
google_drive_default_destination_source_id: opts.googleDriveDefault === false ? undefined : source.id
|
|
168392
|
+
google_drive_default_destination_source_id: opts.googleDriveDefault === false ? undefined : source.id,
|
|
168393
|
+
updated_google_drive_source_ids: updatedGoogleDriveSourceIds,
|
|
168394
|
+
disabled_legacy_source_ids: disabledLegacySourceIds
|
|
168371
168395
|
}, null, 2));
|
|
168372
168396
|
return;
|
|
168373
168397
|
}
|
|
@@ -168377,6 +168401,12 @@ sources.command("bootstrap-prod-files").description("Create or update the produc
|
|
|
168377
168401
|
if (opts.googleDriveDefault !== false) {
|
|
168378
168402
|
console.log(chalk.dim(" Google Drive default destination: set"));
|
|
168379
168403
|
}
|
|
168404
|
+
if (updatedGoogleDriveSourceIds.length) {
|
|
168405
|
+
console.log(chalk.dim(` Google Drive sources repaired: ${updatedGoogleDriveSourceIds.join(", ")}`));
|
|
168406
|
+
}
|
|
168407
|
+
if (disabledLegacySourceIds.length) {
|
|
168408
|
+
console.log(chalk.dim(` Legacy S3 sources disabled: ${disabledLegacySourceIds.join(", ")}`));
|
|
168409
|
+
}
|
|
168380
168410
|
});
|
|
168381
168411
|
sources.command("google-drive-profiles").description("List Google Drive profiles available through connectors auth").option("--json", "Output as JSON").action(async (opts) => {
|
|
168382
168412
|
const profiles = await listGoogleDriveProfiles();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/files",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "Agent-first file management — index local folders and S3 buckets, sync Google Drive, tag, search, and retrieve files via CLI + MCP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|