@hasna/files 0.2.13 → 0.2.14
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 +7 -1
- package/dist/index.js +7 -1
- package/dist/mcp/index.js +7 -1
- package/dist/server/index.js +7 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -167875,13 +167875,19 @@ function buildImportedPath(config9, item, importedName) {
|
|
|
167875
167875
|
if (config9.path_mode === "id_based") {
|
|
167876
167876
|
return posix.join("google-drive", safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
167877
167877
|
}
|
|
167878
|
-
const
|
|
167878
|
+
const storageName = appendDriveFileId(importedName, item.id);
|
|
167879
|
+
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
167879
167880
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
167880
167881
|
return posix.join("google-drive", safePathSegment(config9.profile), driveSegment, itemPath);
|
|
167881
167882
|
}
|
|
167882
167883
|
function safePathSegment(value) {
|
|
167883
167884
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
|
167884
167885
|
}
|
|
167886
|
+
function appendDriveFileId(filename, fileId) {
|
|
167887
|
+
const ext = extname5(filename);
|
|
167888
|
+
const base = ext ? filename.slice(0, -ext.length) : filename;
|
|
167889
|
+
return `${base} (${safePathSegment(fileId)})${ext}`;
|
|
167890
|
+
}
|
|
167885
167891
|
function toApiFile(item) {
|
|
167886
167892
|
return {
|
|
167887
167893
|
id: item.id,
|
package/dist/index.js
CHANGED
|
@@ -164468,13 +164468,19 @@ function buildImportedPath(config9, item, importedName) {
|
|
|
164468
164468
|
if (config9.path_mode === "id_based") {
|
|
164469
164469
|
return posix.join("google-drive", safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
164470
164470
|
}
|
|
164471
|
-
const
|
|
164471
|
+
const storageName = appendDriveFileId(importedName, item.id);
|
|
164472
|
+
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
164472
164473
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
164473
164474
|
return posix.join("google-drive", safePathSegment(config9.profile), driveSegment, itemPath);
|
|
164474
164475
|
}
|
|
164475
164476
|
function safePathSegment(value) {
|
|
164476
164477
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
|
164477
164478
|
}
|
|
164479
|
+
function appendDriveFileId(filename, fileId) {
|
|
164480
|
+
const ext = extname5(filename);
|
|
164481
|
+
const base = ext ? filename.slice(0, -ext.length) : filename;
|
|
164482
|
+
return `${base} (${safePathSegment(fileId)})${ext}`;
|
|
164483
|
+
}
|
|
164478
164484
|
function toApiFile(item) {
|
|
164479
164485
|
return {
|
|
164480
164486
|
id: item.id,
|
package/dist/mcp/index.js
CHANGED
|
@@ -183399,13 +183399,19 @@ function buildImportedPath(config9, item, importedName) {
|
|
|
183399
183399
|
if (config9.path_mode === "id_based") {
|
|
183400
183400
|
return posix.join("google-drive", safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
183401
183401
|
}
|
|
183402
|
-
const
|
|
183402
|
+
const storageName = appendDriveFileId(importedName, item.id);
|
|
183403
|
+
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
183403
183404
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
183404
183405
|
return posix.join("google-drive", safePathSegment(config9.profile), driveSegment, itemPath);
|
|
183405
183406
|
}
|
|
183406
183407
|
function safePathSegment(value) {
|
|
183407
183408
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
|
183408
183409
|
}
|
|
183410
|
+
function appendDriveFileId(filename, fileId) {
|
|
183411
|
+
const ext = extname5(filename);
|
|
183412
|
+
const base = ext ? filename.slice(0, -ext.length) : filename;
|
|
183413
|
+
return `${base} (${safePathSegment(fileId)})${ext}`;
|
|
183414
|
+
}
|
|
183409
183415
|
function toApiFile(item) {
|
|
183410
183416
|
return {
|
|
183411
183417
|
id: item.id,
|
package/dist/server/index.js
CHANGED
|
@@ -164138,13 +164138,19 @@ function buildImportedPath(config9, item, importedName) {
|
|
|
164138
164138
|
if (config9.path_mode === "id_based") {
|
|
164139
164139
|
return posix.join("google-drive", safePathSegment(config9.profile), safePathSegment(item.drive_id), item.id, importedName);
|
|
164140
164140
|
}
|
|
164141
|
-
const
|
|
164141
|
+
const storageName = appendDriveFileId(importedName, item.id);
|
|
164142
|
+
const itemPath = item.path === item.name ? storageName : posix.join(dirname5(item.path), storageName);
|
|
164142
164143
|
const driveSegment = item.drive_id === "my-drive" ? "my-drive" : safePathSegment(item.drive_name || item.drive_id);
|
|
164143
164144
|
return posix.join("google-drive", safePathSegment(config9.profile), driveSegment, itemPath);
|
|
164144
164145
|
}
|
|
164145
164146
|
function safePathSegment(value) {
|
|
164146
164147
|
return value.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").replace(/\s+/g, " ").trim() || "unnamed";
|
|
164147
164148
|
}
|
|
164149
|
+
function appendDriveFileId(filename, fileId) {
|
|
164150
|
+
const ext = extname5(filename);
|
|
164151
|
+
const base = ext ? filename.slice(0, -ext.length) : filename;
|
|
164152
|
+
return `${base} (${safePathSegment(fileId)})${ext}`;
|
|
164153
|
+
}
|
|
164148
164154
|
function toApiFile(item) {
|
|
164149
164155
|
return {
|
|
164150
164156
|
id: item.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/files",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
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",
|