@hasna/files 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/cli/index.js +6 -4
- package/dist/index.js +2 -2
- package/dist/mcp/index.js +2 -2
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,10 +35,13 @@ files sources sync-google-drive --dry-run
|
|
|
35
35
|
files sources sync-google-drive
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
The production default is `s3://hasna-xyz-prod-emails/drive/<profile>/...`
|
|
39
|
+
using the `hasna-xyz-infra` AWS profile.
|
|
40
|
+
|
|
38
41
|
For a custom S3 destination, pass the shared AWS profile explicitly:
|
|
39
42
|
|
|
40
43
|
```bash
|
|
41
|
-
files sources add s3://my-files-bucket/
|
|
44
|
+
files sources add s3://my-files-bucket/drive --region us-west-2 --aws-profile hasna-xyz-infra
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
To sync into local storage instead, add a local source and pass it as the
|
package/dist/cli/index.js
CHANGED
|
@@ -168100,12 +168100,12 @@ function shouldImport(config9, item, existing, destinationSourceId, storageType)
|
|
|
168100
168100
|
}
|
|
168101
168101
|
function buildImportedPath(config9, item, importedName) {
|
|
168102
168102
|
if (config9.path_mode === "id_based") {
|
|
168103
|
-
return posix.join(
|
|
168103
|
+
return posix.join(safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
168104
168104
|
}
|
|
168105
168105
|
const storageName = appendDriveFileId(importedName, item.id);
|
|
168106
168106
|
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
168107
168107
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
168108
|
-
return posix.join(
|
|
168108
|
+
return posix.join(safePathSegment(config9.profile), driveSegment, itemPath);
|
|
168109
168109
|
}
|
|
168110
168110
|
function safePathSegment(value) {
|
|
168111
168111
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
|
@@ -168335,10 +168335,12 @@ sources.command("add-google-drive").description("Add a Google Drive source that
|
|
|
168335
168335
|
process.exit(1);
|
|
168336
168336
|
});
|
|
168337
168337
|
});
|
|
168338
|
-
sources.command("bootstrap-prod-files").description("Create or update the production S3 source for Google Drive
|
|
168338
|
+
sources.command("bootstrap-prod-files").description("Create or update the production S3 source for Google Drive archive sync").option("--bucket <bucket>", "Production archive bucket", "hasna-xyz-prod-emails").option("--region <region>", "AWS region", "us-west-2").option("--aws-profile <profile>", "AWS shared config profile", "hasna-xyz-infra").option("--prefix <prefix>", "S3 key prefix for Drive objects", "drive").option("-n, --name <name>", "Source name", "prod-emails-drive").option("--no-google-drive-default", "Do not set this source as the default Google Drive destination").option("--json", "Output as JSON").action((opts) => {
|
|
168339
168339
|
const machine = getCurrentMachine();
|
|
168340
168340
|
const config9 = { profile: opts.awsProfile };
|
|
168341
|
-
const
|
|
168341
|
+
const legacyProductionNames = new Set([opts.name, "prod-files"]);
|
|
168342
|
+
const legacyProductionBuckets = new Set([opts.bucket, "hasna-xyz-prod-files", "hasna-prod-files"]);
|
|
168343
|
+
const existing = listSources().find((source2) => source2.type === "s3" && (legacyProductionNames.has(source2.name) || legacyProductionBuckets.has(source2.bucket ?? "")));
|
|
168342
168344
|
const source = existing ? updateSource(existing.id, {
|
|
168343
168345
|
name: opts.name,
|
|
168344
168346
|
bucket: opts.bucket,
|
package/dist/index.js
CHANGED
|
@@ -164693,12 +164693,12 @@ function shouldImport(config9, item, existing, destinationSourceId, storageType)
|
|
|
164693
164693
|
}
|
|
164694
164694
|
function buildImportedPath(config9, item, importedName) {
|
|
164695
164695
|
if (config9.path_mode === "id_based") {
|
|
164696
|
-
return posix.join(
|
|
164696
|
+
return posix.join(safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
164697
164697
|
}
|
|
164698
164698
|
const storageName = appendDriveFileId(importedName, item.id);
|
|
164699
164699
|
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
164700
164700
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
164701
|
-
return posix.join(
|
|
164701
|
+
return posix.join(safePathSegment(config9.profile), driveSegment, itemPath);
|
|
164702
164702
|
}
|
|
164703
164703
|
function safePathSegment(value) {
|
|
164704
164704
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
package/dist/mcp/index.js
CHANGED
|
@@ -183624,12 +183624,12 @@ function shouldImport(config9, item, existing, destinationSourceId, storageType)
|
|
|
183624
183624
|
}
|
|
183625
183625
|
function buildImportedPath(config9, item, importedName) {
|
|
183626
183626
|
if (config9.path_mode === "id_based") {
|
|
183627
|
-
return posix.join(
|
|
183627
|
+
return posix.join(safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
183628
183628
|
}
|
|
183629
183629
|
const storageName = appendDriveFileId(importedName, item.id);
|
|
183630
183630
|
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
183631
183631
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
183632
|
-
return posix.join(
|
|
183632
|
+
return posix.join(safePathSegment(config9.profile), driveSegment, itemPath);
|
|
183633
183633
|
}
|
|
183634
183634
|
function safePathSegment(value) {
|
|
183635
183635
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
package/dist/server/index.js
CHANGED
|
@@ -164363,12 +164363,12 @@ function shouldImport(config9, item, existing, destinationSourceId, storageType)
|
|
|
164363
164363
|
}
|
|
164364
164364
|
function buildImportedPath(config9, item, importedName) {
|
|
164365
164365
|
if (config9.path_mode === "id_based") {
|
|
164366
|
-
return posix.join(
|
|
164366
|
+
return posix.join(safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
164367
164367
|
}
|
|
164368
164368
|
const storageName = appendDriveFileId(importedName, item.id);
|
|
164369
164369
|
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
164370
164370
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
164371
|
-
return posix.join(
|
|
164371
|
+
return posix.join(safePathSegment(config9.profile), driveSegment, itemPath);
|
|
164372
164372
|
}
|
|
164373
164373
|
function safePathSegment(value) {
|
|
164374
164374
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/files",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
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",
|