Skip to content

feat(pi-fff): expose enableHomeDirScanning / enableFsRootScanning (#588) - #589

Merged
dmtrKovalenko merged 3 commits into
mainfrom
triage-bot/issue-588
Jun 11, 2026
Merged

dmtrKovalenko merged 3 commits into
mainfrom
triage-bot/issue-588

Conversation

@gustav-fff

Copy link
Copy Markdown
Collaborator

Closes #588

Root cause

packages/pi-fff/src/index.ts:331 calls FileFinder.create({ basePath: cwd, frecencyDbPath, historyDbPath, aiMode: true }) and never forwards enableHomeDirScanning / enableFsRootScanning. Both default to false in @ff-labs/fff-node (packages/fff-node/src/finder.ts:128-129), so launching pi from ~ or / makes FileFinder.create fail with the home/root guard error and the extension is unusable from those directories.

Fix

Add two pi flags and matching env vars and pipe both booleans into FileFinder.create:

  • --fff-enable-home-scan / FFF_ENABLE_HOME_SCAN=1
  • --fff-enable-root-scan / FFF_ENABLE_ROOT_SCAN=1

Precedence matches the existing fff-frecency-db / fff-history-db pattern: flag > env > default (false). Off by default — opt-in only, same shape as fff-node itself.

Steps to reproduce

cd ~
pi -e /path/to/fff.nvim/packages/pi-fff/src/index.ts

Expected: pi loads, fffind / ffgrep work.
Actual (pre-fix): notification FFF init failed: Can not run certain FFF features in a file system root or home directories. Consider smaller per-project directories. Tools unusable.

Post-fix:

cd ~
FFF_ENABLE_HOME_SCAN=1 pi -e /path/to/fff.nvim/packages/pi-fff/src/index.ts
# or
pi --fff-enable-home-scan -e /path/to/fff.nvim/packages/pi-fff/src/index.ts

fffind / ffgrep work; without the opt-in, behavior is unchanged (still refuses to init in ~ or /).

How verified

$ cd packages/pi-fff && bun test test/
 19 pass
 0 fail
 56 expect() calls
Ran 19 tests across 2 files.

Added two unit tests asserting FFF_ENABLE_HOME_SCAN=1 and FFF_ENABLE_ROOT_SCAN=true propagate as true to FileFinder.create, and updated the existing session-start test to assert both fields default to false.

Automated triage via Gustav. Honk-Honk 🪿

Pipe the two FileFinder.create opt-ins through pi flags and env vars so
pi-fff can be used when launched from $HOME or /. Without these, FFF
refuses to init and the extension is unusable from those directories.

- --fff-enable-home-scan / FFF_ENABLE_HOME_SCAN
- --fff-enable-root-scan / FFF_ENABLE_ROOT_SCAN

Closes #588
Comment thread packages/pi-fff/src/index.ts Outdated
const env = process.env[envName];
return env === "1" || env === "true";
}
const enableHomeDirScanning = resolveBoolOpt(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gustav-fff let's make the home search allowed by default, and expose the flag only for the fs root scanning.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triage-bot] DIRECTED: pushed d1fac1a. Forced enableHomeDirScanning: true and removed the --fff-enable-home-scan flag / FFF_ENABLE_HOME_SCAN env. Only --fff-enable-root-scan (and FFF_ENABLE_ROOT_SCAN) remains as opt-in. README + tests updated; 19 pass / 0 fail.

Honk-Honk 🪿

Per maintainer feedback on PR #589: launching pi from $HOME is a normal
flow; force enableHomeDirScanning=true and remove the --fff-enable-home-scan
flag/env. Root scanning remains opt-in via --fff-enable-root-scan.
Comment thread packages/pi-fff/test/extension.test.ts Outdated
delete process.env.FFF_ENABLE_ROOT_SCAN;
});

describe("pi-fff scanning opt-in flags", () => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this useless test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gustav-fff work on this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triage-bot] DIRECTED: removed the scanning opt-in flags describe block in 8d2cb60. 17 pass / 0 fail.

Honk-Honk 🪿

@dmtrKovalenko
dmtrKovalenko merged commit ec57eb0 into main Jun 11, 2026
45 checks passed
@dmtrKovalenko
dmtrKovalenko deleted the triage-bot/issue-588 branch June 11, 2026 05:07
wpenistone pushed a commit to wpenistone/fffork that referenced this pull request Sep 28, 2026
…mtrKovalenko#589)

* feat(pi-fff): expose enableHomeDirScanning / enableFsRootScanning (dmtrKovalenko#588)

Pipe the two FileFinder.create opt-ins through pi flags and env vars so
pi-fff can be used when launched from $HOME or /. Without these, FFF
refuses to init and the extension is unusable from those directories.

- --fff-enable-home-scan / FFF_ENABLE_HOME_SCAN
- --fff-enable-root-scan / FFF_ENABLE_ROOT_SCAN

Closes dmtrKovalenko#588

* feat(pi-fff): enable home dir scanning by default, drop opt-in flag

Per maintainer feedback on PR dmtrKovalenko#589: launching pi from $HOME is a normal
flow; force enableHomeDirScanning=true and remove the --fff-enable-home-scan
flag/env. Root scanning remains opt-in via --fff-enable-root-scan.

* test(pi-fff): drop scanning opt-in flag tests

---------

Co-authored-by: gustav-fff <286169375+gustav-fff@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pi-fff: Support enableHomeDirScanning / enableFsRootScanning to allow indexing home and root directories

2 participants