@ff-labs/pi-fff 0.9.4 → 0.9.5-nightly.60df2fc

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 CHANGED
@@ -134,6 +134,7 @@ Mode precedence:
134
134
  - `--fff-mode <mode>` — set mode (see above)
135
135
  - `--fff-frecency-db <path>` — path to frecency database (also: `FFF_FRECENCY_DB` env)
136
136
  - `--fff-history-db <path>` — path to query history database (also: `FFF_HISTORY_DB` env)
137
+ - `--fff-enable-root-scan` — allow indexing when launched from `/` (also: `FFF_ENABLE_ROOT_SCAN=1` env). FFF refuses to init at the filesystem root by default. Home directory scanning is always enabled for pi.
137
138
 
138
139
  ## Data
139
140
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ff-labs/pi-fff",
3
3
  "public": true,
4
- "version": "0.9.4",
4
+ "version": "0.9.5-nightly.60df2fc",
5
5
  "description": "pi extension: FFF-powered fuzzy file and content search",
6
6
  "type": "module",
7
7
  "license": "MIT",
package/src/index.ts CHANGED
@@ -304,6 +304,21 @@ export default function fffExtension(pi: ExtensionAPI) {
304
304
  process.env.FFF_HISTORY_DB ??
305
305
  undefined;
306
306
 
307
+ // Root scanning opt-in: flag (boolean) > env ("1"/"true") > false.
308
+ // FFF refuses to init at / unless this is set. Home dir scanning is on by
309
+ // default for pi — launching pi from $HOME is a normal flow.
310
+ function resolveBoolOpt(flagName: string, envName: string): boolean {
311
+ const flag = pi.getFlag(flagName);
312
+ if (typeof flag === "boolean") return flag;
313
+ if (typeof flag === "string") return flag === "true" || flag === "1";
314
+ const env = process.env[envName];
315
+ return env === "1" || env === "true";
316
+ }
317
+ const enableFsRootScanning = resolveBoolOpt(
318
+ "fff-enable-root-scan",
319
+ "FFF_ENABLE_ROOT_SCAN",
320
+ );
321
+
307
322
  function getMode(): FffMode {
308
323
  return currentMode;
309
324
  }
@@ -333,6 +348,8 @@ export default function fffExtension(pi: ExtensionAPI) {
333
348
  frecencyDbPath,
334
349
  historyDbPath,
335
350
  aiMode: true,
351
+ enableHomeDirScanning: true,
352
+ enableFsRootScanning,
336
353
  });
337
354
 
338
355
  if (!result.ok)
@@ -441,6 +458,12 @@ export default function fffExtension(pi: ExtensionAPI) {
441
458
  type: "string",
442
459
  });
443
460
 
461
+ pi.registerFlag("fff-enable-root-scan", {
462
+ description:
463
+ "Allow indexing when launched from the filesystem root (also: FFF_ENABLE_ROOT_SCAN env)",
464
+ type: "boolean",
465
+ });
466
+
444
467
  pi.on("session_start", async (_event, ctx) => {
445
468
  try {
446
469
  activeCwd = ctx.cwd;