@fabersep/memory 0.2.1 → 0.4.0
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/CHANGELOG.md +24 -1
- package/README.md +58 -32
- package/dist/src/bm25.d.ts +2 -0
- package/dist/src/bm25.js +6 -0
- package/dist/src/cli.js +221 -13
- package/dist/src/config.js +1 -0
- package/dist/src/doctor.js +98 -2
- package/dist/src/hygiene.js +10 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/mcp.d.ts +1 -0
- package/dist/src/mcp.js +27 -2
- package/dist/src/personal-remote.d.ts +48 -0
- package/dist/src/personal-remote.js +282 -0
- package/dist/src/proposals.d.ts +2 -0
- package/dist/src/proposals.js +11 -0
- package/dist/src/sync.js +3 -0
- package/dist/src/types.d.ts +8 -0
- package/dist/src/types.js +1 -0
- package/dist/src/web-assets.d.ts +4 -0
- package/dist/src/web-assets.js +1357 -0
- package/dist/src/web.d.ts +41 -0
- package/dist/src/web.js +959 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@fabersep/memory`. Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.4.0 (2026-12-02)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Local web UI (feature 04):** `faber-memory web` and `faber-memory review --web` open a zero-dependency UI in your browser, bound to `127.0.0.1` only. Review, edit, approve, reject or skip proposals and commit them in one batch; browse, search, edit or delete active memories across scopes; see a compact status, doctor and stats summary.
|
|
9
|
+
- Flags: `--port <n>`, `--no-open`, `--idle-timeout <min>` and `--read-only` (read-only hosts are always read-only).
|
|
10
|
+
- Security: a per-launch token exchanged for an `HttpOnly` `SameSite=Strict` cookie, CSRF and DNS-rebinding checks, a strict CSP, and shutdown on idle timeout or from the UI.
|
|
11
|
+
- Brand logo and favicon in the web UI.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- The README installs the package globally and uses `faber-memory`, with a how-it-works animation and a web UI screenshot.
|
|
15
|
+
|
|
16
|
+
## 0.3.0 (2026-11-29)
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Personal remote (feature 03):** `remote add <url>` / `remote remove`, `setup --remote`, `init --remote`. A public GitHub or GitLab repository is refused unless `--allow-public`.
|
|
20
|
+
- **Push after approve:** `pushMode` `ask` (default) / `auto` / `never` (`config set-push-mode`); `push` command; `--yes` on `review` and `approve` skips the question.
|
|
21
|
+
- **Unpushed reminder** in `status`, the first MCP answer of a session, and a new `doctor` check "Personal remote" (also `WARN` when the personal repo has no remote).
|
|
22
|
+
- **Two writing machines:** approve pulls with rebase before committing; a rejected push is rebased and retried once; a conflict keeps the local commit and is reported.
|
|
23
|
+
- **`memory_propose` says what the similarity check found:** a staged `create` carries `similar` (entries between `similarityHintFloor`, default `0.25`, and the threshold) and a short note when one is related.
|
|
24
|
+
- **Hygiene fix hints:** a blocked machine path says `write ~/ or $HOME instead of /Users/<name>/`; a blocked secret says to store a pointer instead.
|
|
25
|
+
- **`doctor` warns about a second memory index** loaded outside the managed block in `~/.claude/CLAUDE.md` or `~/.gemini/GEMINI.md`.
|
|
26
|
+
- **Read-only hosts:** `setup --read-only <url> [path]` for servers and CI; proposals, approvals and pushes are refused there.
|
|
27
|
+
|
|
28
|
+
## 0.2.1 (2026-11-28)
|
|
6
29
|
|
|
7
30
|
### Fixed
|
|
8
31
|
- Docs pointed to `~/.faber/memory-state/` for config and state; the real location is `~/.config/faber-memory/`.
|
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
<h1><img src="docs/assets/logo.svg" alt="" width="28" height="28" align="absmiddle"> FaberSEP Memory</h1>
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@fabersep/memory)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
|
|
6
|
-
**Your AI coding
|
|
6
|
+
**Your AI coding tools shouldn't each have their own siloed memory — and your team shouldn't repeat the same rules in every chat. FaberSEP Memory gives every tool and every teammate one shared memory you can read, approve and keep in Git.**
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="docs/assets/solo-memory.svg" alt="In the morning using Claude Code, you say we use pnpm not npm and approve the proposed memory into your local Git folder ~/.faber/memory. In the afternoon you switch to Antigravity and in the evening to Codex on the same machine — both read use-pnpm automatically and run pnpm commands without being told again." width="920">
|
|
10
|
+
</p>
|
|
9
11
|
|
|
10
12
|
---
|
|
11
13
|
|
|
@@ -13,27 +15,43 @@
|
|
|
13
15
|
|
|
14
16
|
It's Monday. You tell your AI assistant: *"We use pnpm here, not npm."* It says "Got it!" and does a great job.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Later the same day you open a new chat — or switch from Claude Code to Antigravity, Codex or Cursor — and it runs `npm install`. Meanwhile, your teammate hits the exact same mistake in their editor because every assistant's built-in memory stays trapped inside one tool on one machine.
|
|
17
19
|
|
|
18
|
-
So
|
|
20
|
+
So teams copy rules into long instruction files that grow to 300 lines nobody maintains, or let tools "remember" things silently until a wrong rule sneaks in.
|
|
19
21
|
|
|
20
22
|
## What changes with FaberSEP Memory
|
|
21
23
|
|
|
22
24
|
The same Monday, with FaberSEP Memory:
|
|
23
25
|
|
|
24
|
-
1. **Your assistant notices a lesson** ("
|
|
25
|
-
2. **You approve it
|
|
26
|
-
3. **
|
|
26
|
+
1. **Your assistant notices a lesson** ("we use pnpm") and *proposes* saving it. Nothing is saved silently.
|
|
27
|
+
2. **You approve it with one click** in the local Web UI (`faber-memory web`) — or with one key press in the terminal (`faber-memory review`).
|
|
28
|
+
3. **Every tool on your machine knows it**: switch from Claude Code to Antigravity, Codex, Cursor or Claude Desktop — every assistant reads the same local Git-backed memory.
|
|
27
29
|
|
|
28
|
-
Your memory is a folder of short notes
|
|
30
|
+
Your memory is a folder of short Markdown notes kept in Git so every change has history and can be undone. Nothing goes to a third-party cloud service, and you don't need an account, a database or an API key.
|
|
29
31
|
|
|
30
|
-
##
|
|
32
|
+
## Review and browse in the local Web UI
|
|
31
33
|
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
34
|
+
Run `faber-memory web` to open a clean, zero-dependency local UI in your browser (`127.0.0.1` only). Approve, edit, reject or batch-commit proposals in one click, search and edit active memories in **Browse**, and check setup health — all without touching raw files.
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="docs/assets/web-ui-review.png" alt="FaberSEP Memory local Web UI showing pending memory proposals with Approve, Edit, Reject, Skip and Commit Batch controls alongside Browse and Health tabs." width="920">
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
## Share one memory across your whole team
|
|
41
|
+
|
|
42
|
+
When you connect a private Git repository as a team memory, one approved rule syncs to every teammate — no matter which AI coding tool each person prefers.
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img src="docs/assets/team-memory.svg" alt="Maya tells Claude Code that the team uses pnpm. The assistant proposes a memory instead of saving silently. Maya approves it with one click in the local FaberSEP Memory Web UI, committing it to the shared team Git memory. Instantly, Maya in Cursor, Alex in Antigravity, and Sam in Codex all read use-pnpm and run pnpm install." width="920">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
## Why teams use it
|
|
49
|
+
|
|
50
|
+
- **Works across all your AI tools.** Claude Code, Antigravity, Codex, Cursor, Claude Desktop — switch tools anytime on the same machine without re-explaining your setup.
|
|
51
|
+
- **One memory for your whole team.** Share rules through a private Git repository so one approval keeps every teammate's assistant in sync.
|
|
52
|
+
- **Simple local Web UI.** Review proposals, browse and search active memories, edit or delete entries, and check health in your browser with `faber-memory web`.
|
|
53
|
+
- **Nothing gets in without your OK.** Assistants can only propose. You approve what stays, and secrets or machine-specific paths are blocked automatically.
|
|
54
|
+
- **Fast and cheap.** Assistants load a tiny startup index and look up details only when needed, keeping chats fast and prompt caches warm.
|
|
37
55
|
|
|
38
56
|
---
|
|
39
57
|
|
|
@@ -41,29 +59,37 @@ Your memory is a folder of short notes on your own computer, kept in Git so ever
|
|
|
41
59
|
|
|
42
60
|
You need **Node.js 20 or newer** and **Git**. To check, run `node -v` and `git --version` in a terminal.
|
|
43
61
|
|
|
44
|
-
**1.
|
|
62
|
+
**1. Install it once**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -g @fabersep/memory
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This gives you one short command, `faber-memory`, that you can run from any folder. Check it with `faber-memory --version`.
|
|
69
|
+
|
|
70
|
+
**2. Set it up**
|
|
45
71
|
|
|
46
72
|
```bash
|
|
47
|
-
|
|
73
|
+
faber-memory init
|
|
48
74
|
```
|
|
49
75
|
|
|
50
|
-
This creates your memory folder (`~/.faber/memory`, with its own Git history), finds the AI assistants on your computer and connects them. It keeps a backup of every file it touches, and you can undo it at any time with `
|
|
76
|
+
This creates your memory folder (`~/.faber/memory`, with its own Git history), finds the AI assistants on your computer and connects them. It keeps a backup of every file it touches, and you can undo it at any time with `faber-memory init --undo`.
|
|
51
77
|
|
|
52
78
|
Want your notes in another folder? Give its path:
|
|
53
79
|
|
|
54
80
|
```bash
|
|
55
|
-
|
|
81
|
+
faber-memory init ~/my-notes
|
|
56
82
|
```
|
|
57
83
|
|
|
58
|
-
**
|
|
84
|
+
**3. Check that everything is connected**
|
|
59
85
|
|
|
60
86
|
```bash
|
|
61
|
-
|
|
87
|
+
faber-memory doctor
|
|
62
88
|
```
|
|
63
89
|
|
|
64
90
|
You should see `PASS` lines. Each `WARN` or `FAIL` line comes with a one-line hint on how to fix it.
|
|
65
91
|
|
|
66
|
-
**
|
|
92
|
+
**4. Start a new chat in your assistant**
|
|
67
93
|
|
|
68
94
|
Tell it something about your project that it would otherwise get wrong, for example:
|
|
69
95
|
|
|
@@ -71,15 +97,15 @@ Tell it something about your project that it would otherwise get wrong, for exam
|
|
|
71
97
|
|
|
72
98
|
It should suggest saving this as a memory. (If it doesn't, ask it: *"Propose this as a memory."*)
|
|
73
99
|
|
|
74
|
-
**
|
|
100
|
+
**5. Approve what you want to keep**
|
|
75
101
|
|
|
76
102
|
```bash
|
|
77
|
-
|
|
103
|
+
faber-memory web
|
|
78
104
|
```
|
|
79
105
|
|
|
80
|
-
|
|
106
|
+
This opens a clean local Web UI in your browser (`127.0.0.1` only) where you can review, edit, approve, or reject proposals in one click — and browse or search your active memories. Prefer the terminal? Run `faber-memory review` instead (`a` to approve, `e` to edit, `r` to reject, `s` to skip, `q` to save and quit).
|
|
81
107
|
|
|
82
|
-
Now open a **new** chat and ask: *"How do I run the tests here?"* Your assistant answers `make test`, without you telling it again.
|
|
108
|
+
Now open a **new** chat (in the same tool or a different one) and ask: *"How do I run the tests here?"* Your assistant answers `make test`, without you telling it again.
|
|
83
109
|
|
|
84
110
|
> **Already have notes?** If you keep rules in an `AGENTS.md`, a `CLAUDE.md`, Cursor rules or a folder of Markdown files, you can bring them in. They go to the same review step first. See [Importing existing notes](docs/guide.md#importing-existing-notes).
|
|
85
111
|
|
|
@@ -87,10 +113,10 @@ Now open a **new** chat and ask: *"How do I run the tests here?"* Your assistant
|
|
|
87
113
|
|
|
88
114
|
## A normal day with it
|
|
89
115
|
|
|
90
|
-
- **While you work:** nothing to do.
|
|
91
|
-
- **When it learns something:** it
|
|
92
|
-
- **When you have a minute:** run `
|
|
93
|
-
- **Changed your mind?**
|
|
116
|
+
- **While you work:** nothing to do. Every connected assistant reads the same compact memory index at startup and searches details as needed.
|
|
117
|
+
- **When it learns something:** it proposes a memory. The proposal waits in a "to review" box (`pre-memory`) and changes nothing yet.
|
|
118
|
+
- **When you have a minute:** run `faber-memory web` (or `faber-memory review` in the terminal). All your approvals are saved together in one Git commit.
|
|
119
|
+
- **Changed your mind?** Edit or delete any memory right from the Web UI's Browse tab — or edit the Markdown file in `~/.faber/memory` and run `faber-memory compile`. Git keeps the full history.
|
|
94
120
|
|
|
95
121
|
A memory file looks like this:
|
|
96
122
|
|
|
@@ -118,10 +144,10 @@ No. It's free and open source (Apache-2.0), and it runs on your computer. Your n
|
|
|
118
144
|
Not directly yet. If you control a computer or server from your phone (for example with Claude Remote Control), memory works in that session.
|
|
119
145
|
|
|
120
146
|
**How do I update or remove it?**
|
|
121
|
-
`
|
|
147
|
+
`npm install -g @fabersep/memory@latest` installs the newest version; `faber-memory --version` shows which one you have. `faber-memory init --undo` disconnects your assistants and leaves your notes in place. `npm uninstall -g @fabersep/memory` removes the command. See [Updating and cleaning up](docs/guide.md#updating-and-cleaning-up).
|
|
122
148
|
|
|
123
149
|
**Something went wrong.**
|
|
124
|
-
Run `
|
|
150
|
+
Run `faber-memory doctor` first. Then check [Troubleshooting](docs/troubleshooting.md) or [open an issue](https://github.com/fabersep/memory/issues).
|
|
125
151
|
|
|
126
152
|
---
|
|
127
153
|
|
package/dist/src/bm25.d.ts
CHANGED
|
@@ -24,3 +24,5 @@ export interface NearDuplicateMatch {
|
|
|
24
24
|
}
|
|
25
25
|
export declare function computeSimilarity(textA: string, textB: string): number;
|
|
26
26
|
export declare function findNearDuplicates(candidateSummary: string, candidateBody: string, activeEntries: MemoryEntry[], pendingProposals: Proposal[], threshold: number): NearDuplicateMatch[];
|
|
27
|
+
/** Entries scoring in [floor, threshold): related but not blocking (01 FR-04 amendment). */
|
|
28
|
+
export declare function findRelatedEntries(candidateSummary: string, candidateBody: string, activeEntries: MemoryEntry[], pendingProposals: Proposal[], floor: number, threshold: number, limit?: number): NearDuplicateMatch[];
|
package/dist/src/bm25.js
CHANGED
|
@@ -181,3 +181,9 @@ export function findNearDuplicates(candidateSummary, candidateBody, activeEntrie
|
|
|
181
181
|
matches.sort((a, b) => b.similarity - a.similarity);
|
|
182
182
|
return matches;
|
|
183
183
|
}
|
|
184
|
+
/** Entries scoring in [floor, threshold): related but not blocking (01 FR-04 amendment). */
|
|
185
|
+
export function findRelatedEntries(candidateSummary, candidateBody, activeEntries, pendingProposals, floor, threshold, limit = 3) {
|
|
186
|
+
return findNearDuplicates(candidateSummary, candidateBody, activeEntries, pendingProposals, floor)
|
|
187
|
+
.filter((m) => m.similarity < threshold)
|
|
188
|
+
.slice(0, limit);
|
|
189
|
+
}
|
package/dist/src/cli.js
CHANGED
|
@@ -13,13 +13,15 @@ import { approveProposalsBatch, findProposalById, reconcileAwaitingCommitProposa
|
|
|
13
13
|
import { buildShareableBenchmark, computeStats, formatShareableMarkdown, formatStatsReport, validateDaysArg, } from './stats.js';
|
|
14
14
|
import { loadAllScopes, resolveProjectRoot } from './store.js';
|
|
15
15
|
import { syncAllRoots } from './sync.js';
|
|
16
|
+
import { addPersonalRemote, DEFAULT_READ_ONLY_PATH, getAheadInfo, getPushMode, getUnpushedReminder, isReadOnlyRoot, pushPersonalRoot, READ_ONLY_MESSAGE, removePersonalRemote, } from './personal-remote.js';
|
|
16
17
|
import { getPackageVersion } from './version.js';
|
|
17
18
|
import { c, hr, inferErrorAnchor, normalizeTeamUrl, troubleshootingLink, } from './ui.js';
|
|
19
|
+
import { openBrowserBestEffort, startWebServer, validateIdleTimeoutArg, validatePortArg, } from './web.js';
|
|
18
20
|
// Flags that never take a value, so `init --preview ~/notes` keeps ~/notes as a positional.
|
|
19
21
|
const BOOLEAN_FLAGS = new Set([
|
|
20
22
|
'apply', 'undo', 'preview', 'dry-run', 'check', 'json', 'strict', 'cache', 'share', 'yes',
|
|
21
23
|
'all', 'approve', 'approve-all', 'split-headings', 'normalize-paths', 'project-hint',
|
|
22
|
-
'include-personal-repo', 'help',
|
|
24
|
+
'include-personal-repo', 'help', 'allow-public', 'web', 'no-open',
|
|
23
25
|
]);
|
|
24
26
|
function parseFlags(args) {
|
|
25
27
|
const positional = [];
|
|
@@ -67,6 +69,36 @@ function printErrorWithHelp(errMsg) {
|
|
|
67
69
|
console.error(c.dim(` Details: ${troubleshootingLink(anchor)}`));
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
// Feature 03 FR-02: an interactive terminal (tests set FABER_MEMORY_ASSUME_TTY=1 to drive the prompt).
|
|
73
|
+
function isInteractive() {
|
|
74
|
+
return Boolean(process.stdin.isTTY) || process.env.FABER_MEMORY_ASSUME_TTY === '1';
|
|
75
|
+
}
|
|
76
|
+
// After an approve committed to the personal root: push per pushMode, or say what is left.
|
|
77
|
+
async function afterPersonalCommit(config, homeDir, ask) {
|
|
78
|
+
const root = config.roots.personal;
|
|
79
|
+
if (!root || isReadOnlyRoot(root))
|
|
80
|
+
return;
|
|
81
|
+
const info = getAheadInfo(root.path);
|
|
82
|
+
if (!info.hasRemote || info.ahead === 0)
|
|
83
|
+
return;
|
|
84
|
+
const mode = getPushMode(root);
|
|
85
|
+
if (mode === 'never')
|
|
86
|
+
return;
|
|
87
|
+
let push = mode === 'auto';
|
|
88
|
+
if (mode === 'ask' && ask) {
|
|
89
|
+
const answer = await ask(`Push ${info.ahead} commit(s) to origin now? [Y/n] `);
|
|
90
|
+
push = answer !== null && ['', 'y', 'yes'].includes(answer.trim().toLowerCase());
|
|
91
|
+
}
|
|
92
|
+
if (push) {
|
|
93
|
+
const res = await pushPersonalRoot(root, homeDir);
|
|
94
|
+
console.log(res.ok ? c.green(res.message) : c.red(res.message));
|
|
95
|
+
if (res.ok)
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const reminder = getUnpushedReminder(config, homeDir);
|
|
99
|
+
if (reminder)
|
|
100
|
+
console.log(c.yellow(reminder));
|
|
101
|
+
}
|
|
70
102
|
function createPersonalRoot(config, personalPath, homeDir) {
|
|
71
103
|
const existed = isGitRepo(personalPath);
|
|
72
104
|
gitInitSoloRepo(personalPath, 'main');
|
|
@@ -114,6 +146,28 @@ async function main() {
|
|
|
114
146
|
}
|
|
115
147
|
if (cmd === 'setup') {
|
|
116
148
|
const config = loadConfig(homeDir);
|
|
149
|
+
if (flags['read-only']) {
|
|
150
|
+
const url = String(flags['read-only']);
|
|
151
|
+
if (url === 'true') {
|
|
152
|
+
console.error('Usage: faber-memory setup --read-only <git-url> [path]');
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
const dest = typeof flags.path === 'string' ? path.resolve(flags.path) : positional[0] ? path.resolve(positional[0]) : DEFAULT_READ_ONLY_PATH;
|
|
156
|
+
const branch = isGitRepo(dest) ? getDefaultBranch(dest) : gitCloneTeamRepo(url, dest);
|
|
157
|
+
config.roots.personal = {
|
|
158
|
+
uuid: config.roots.personal?.uuid || generateUuid(),
|
|
159
|
+
path: dest,
|
|
160
|
+
scope: 'personal',
|
|
161
|
+
defaultBranch: branch,
|
|
162
|
+
readOnly: true,
|
|
163
|
+
};
|
|
164
|
+
saveConfig(config, homeDir);
|
|
165
|
+
const res = await syncAllRoots(config, { homeDir, recompile: true });
|
|
166
|
+
for (const e of res.errors)
|
|
167
|
+
printErrorWithHelp(e);
|
|
168
|
+
console.log(c.green(`Configured a read-only personal root at ${dest} (branch: ${branch}). This host only pulls; propose changes on a writing machine.`));
|
|
169
|
+
return res.ok ? 0 : 1;
|
|
170
|
+
}
|
|
117
171
|
if (flags.team) {
|
|
118
172
|
const rawUrl = String(flags.team);
|
|
119
173
|
const { url, normalized } = normalizeTeamUrl(rawUrl);
|
|
@@ -147,8 +201,56 @@ async function main() {
|
|
|
147
201
|
createPersonalRoot(config, personalPath, homeDir);
|
|
148
202
|
console.log(c.green(`Initialized personal memory root at ${personalPath} (uuid: ${config.roots.personal.uuid})`));
|
|
149
203
|
printUncommittedNotesHint(personalPath);
|
|
204
|
+
if (typeof flags.remote === 'string') {
|
|
205
|
+
const res = await addPersonalRemote(config, flags.remote, { allowPublic: Boolean(flags['allow-public']), homeDir });
|
|
206
|
+
for (const m of res.messages)
|
|
207
|
+
console.log(m);
|
|
208
|
+
for (const e of res.errors)
|
|
209
|
+
printErrorWithHelp(e);
|
|
210
|
+
saveConfig(config, homeDir);
|
|
211
|
+
return res.ok ? 0 : 1;
|
|
212
|
+
}
|
|
150
213
|
return 0;
|
|
151
214
|
}
|
|
215
|
+
if (cmd === 'remote') {
|
|
216
|
+
const config = loadConfig(homeDir);
|
|
217
|
+
const sub = positional[0];
|
|
218
|
+
if (sub === 'add' && positional[1]) {
|
|
219
|
+
const res = await addPersonalRemote(config, positional[1], { allowPublic: Boolean(flags['allow-public']), homeDir });
|
|
220
|
+
for (const m of res.messages)
|
|
221
|
+
console.log(m);
|
|
222
|
+
for (const e of res.errors)
|
|
223
|
+
printErrorWithHelp(e);
|
|
224
|
+
if (res.ok)
|
|
225
|
+
saveConfig(config, homeDir);
|
|
226
|
+
return res.ok ? 0 : 1;
|
|
227
|
+
}
|
|
228
|
+
if (sub === 'remove') {
|
|
229
|
+
const res = removePersonalRemote(config, homeDir);
|
|
230
|
+
for (const m of res.messages)
|
|
231
|
+
console.log(m);
|
|
232
|
+
for (const e of res.errors)
|
|
233
|
+
printErrorWithHelp(e);
|
|
234
|
+
return res.ok ? 0 : 1;
|
|
235
|
+
}
|
|
236
|
+
console.error('Usage: faber-memory remote add <git-url> [--allow-public] | faber-memory remote remove');
|
|
237
|
+
return 1;
|
|
238
|
+
}
|
|
239
|
+
if (cmd === 'push') {
|
|
240
|
+
const config = loadConfig(homeDir);
|
|
241
|
+
const root = config.roots.personal;
|
|
242
|
+
if (!root) {
|
|
243
|
+
printErrorWithHelp('Personal memory root is not configured.');
|
|
244
|
+
return 1;
|
|
245
|
+
}
|
|
246
|
+
const res = await pushPersonalRoot(root, homeDir);
|
|
247
|
+
if (res.ok) {
|
|
248
|
+
console.log(c.green(res.message));
|
|
249
|
+
return 0;
|
|
250
|
+
}
|
|
251
|
+
printErrorWithHelp(res.message);
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
152
254
|
if (cmd === 'config') {
|
|
153
255
|
const sub = positional[0];
|
|
154
256
|
const config = loadConfig(homeDir);
|
|
@@ -180,6 +282,17 @@ async function main() {
|
|
|
180
282
|
console.log(c.green(`Updated team submit mode to ${mode}`));
|
|
181
283
|
return 0;
|
|
182
284
|
}
|
|
285
|
+
if (sub === 'set-push-mode') {
|
|
286
|
+
const mode = positional[1];
|
|
287
|
+
if (!['ask', 'auto', 'never'].includes(mode) || !config.roots.personal) {
|
|
288
|
+
console.error('Usage: faber-memory config set-push-mode <ask|auto|never> (needs a personal root)');
|
|
289
|
+
return 1;
|
|
290
|
+
}
|
|
291
|
+
config.roots.personal.pushMode = mode;
|
|
292
|
+
saveConfig(config, homeDir);
|
|
293
|
+
console.log(c.green(`Updated personal push mode to ${mode}`));
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
183
296
|
if (sub === 'unset') {
|
|
184
297
|
const scope = positional[1];
|
|
185
298
|
if (!scope || !['personal', 'team'].includes(scope)) {
|
|
@@ -243,6 +356,10 @@ async function main() {
|
|
|
243
356
|
}
|
|
244
357
|
if (cmd === 'approve') {
|
|
245
358
|
const config = loadConfig(homeDir);
|
|
359
|
+
if (isReadOnlyRoot(config.roots.personal)) {
|
|
360
|
+
printErrorWithHelp(READ_ONLY_MESSAGE);
|
|
361
|
+
return 1;
|
|
362
|
+
}
|
|
246
363
|
const ids = positional;
|
|
247
364
|
if (ids.length === 0) {
|
|
248
365
|
console.error('Usage: faber-memory approve <proposal-id> [...]');
|
|
@@ -269,6 +386,10 @@ async function main() {
|
|
|
269
386
|
printErrorWithHelp(e);
|
|
270
387
|
return 1;
|
|
271
388
|
}
|
|
389
|
+
if (outcome.personalCommitted) {
|
|
390
|
+
const ask = isInteractive() && !flags.yes ? (q) => promptLine(q) : undefined;
|
|
391
|
+
await afterPersonalCommit(config, homeDir, ask);
|
|
392
|
+
}
|
|
272
393
|
return 0;
|
|
273
394
|
}
|
|
274
395
|
if (cmd === 'reject') {
|
|
@@ -342,34 +463,107 @@ async function main() {
|
|
|
342
463
|
console.log(c.green('Reset complete.'));
|
|
343
464
|
return 0;
|
|
344
465
|
}
|
|
466
|
+
async function runWebCommand(initialView) {
|
|
467
|
+
const portCheck = validatePortArg(flags.port);
|
|
468
|
+
if (!portCheck.ok) {
|
|
469
|
+
printErrorWithHelp(portCheck.error);
|
|
470
|
+
return 1;
|
|
471
|
+
}
|
|
472
|
+
const idleCheck = validateIdleTimeoutArg(flags['idle-timeout']);
|
|
473
|
+
if (!idleCheck.ok) {
|
|
474
|
+
printErrorWithHelp(idleCheck.error);
|
|
475
|
+
return 1;
|
|
476
|
+
}
|
|
477
|
+
let srv;
|
|
478
|
+
try {
|
|
479
|
+
srv = await startWebServer({
|
|
480
|
+
homeDir,
|
|
481
|
+
cwd: process.cwd(),
|
|
482
|
+
port: portCheck.port,
|
|
483
|
+
idleTimeoutMinutes: idleCheck.minutes,
|
|
484
|
+
readOnly: Boolean(flags['read-only']),
|
|
485
|
+
initialView,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
catch (err) {
|
|
489
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
490
|
+
printErrorWithHelp(`Failed to start local web UI: ${msg}`);
|
|
491
|
+
return 1;
|
|
492
|
+
}
|
|
493
|
+
const onSignal = () => {
|
|
494
|
+
void srv.close();
|
|
495
|
+
};
|
|
496
|
+
process.on('SIGINT', onSignal);
|
|
497
|
+
process.on('SIGTERM', onSignal);
|
|
498
|
+
try {
|
|
499
|
+
const modeLabel = srv.readOnly ? 'read-only' : 'writable';
|
|
500
|
+
const timeoutLabel = idleCheck.minutes > 0 ? `${idleCheck.minutes}m idle timeout` : 'idle timeout disabled';
|
|
501
|
+
console.log(c.bold('FaberSEP Memory Web UI'));
|
|
502
|
+
console.log(`URL: ${srv.authUrl}`);
|
|
503
|
+
console.log(c.dim(`Mode: ${modeLabel} | Loopback only (127.0.0.1) | ${timeoutLabel}`));
|
|
504
|
+
if (!flags['no-open'] && isInteractive()) {
|
|
505
|
+
const opened = openBrowserBestEffort(srv.authUrl);
|
|
506
|
+
if (!opened) {
|
|
507
|
+
console.log(c.dim('Could not launch browser automatically; open the URL above manually.'));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
const reason = await srv.waitForClose;
|
|
511
|
+
if (reason === 'idle') {
|
|
512
|
+
console.log(c.dim('Local web UI shut down after idle timeout.'));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
finally {
|
|
516
|
+
process.off('SIGINT', onSignal);
|
|
517
|
+
process.off('SIGTERM', onSignal);
|
|
518
|
+
}
|
|
519
|
+
return 0;
|
|
520
|
+
}
|
|
521
|
+
if (cmd === 'web') {
|
|
522
|
+
return runWebCommand('auto');
|
|
523
|
+
}
|
|
345
524
|
if (cmd === 'review') {
|
|
525
|
+
if (flags.web) {
|
|
526
|
+
return runWebCommand('review');
|
|
527
|
+
}
|
|
346
528
|
const config = loadConfig(homeDir);
|
|
529
|
+
if (isReadOnlyRoot(config.roots.personal)) {
|
|
530
|
+
printErrorWithHelp(READ_ONLY_MESSAGE);
|
|
531
|
+
return 1;
|
|
532
|
+
}
|
|
347
533
|
const proposals = reconcileAwaitingCommitProposals(homeDir).filter((p) => p.status !== 'awaiting_commit');
|
|
348
534
|
if (proposals.length === 0) {
|
|
349
535
|
console.log('No pending proposals to review.');
|
|
350
536
|
return 0;
|
|
351
537
|
}
|
|
352
538
|
const decisions = new Map();
|
|
539
|
+
// One readline for the whole review, so the push question (feature 03 FR-02) reads the same input.
|
|
540
|
+
let rl;
|
|
541
|
+
let askPush;
|
|
353
542
|
if (flags['approve-all']) {
|
|
354
543
|
for (const p of proposals)
|
|
355
544
|
decisions.set(p.id, 'approve');
|
|
356
545
|
}
|
|
357
546
|
else {
|
|
358
|
-
const
|
|
547
|
+
const reviewRl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
548
|
+
rl = reviewRl;
|
|
359
549
|
let interrupted = false;
|
|
360
|
-
|
|
550
|
+
reviewRl.on('SIGINT', () => {
|
|
361
551
|
interrupted = true;
|
|
362
552
|
console.log(c.yellow('\nInterrupted — saving decisions made so far...'));
|
|
363
|
-
|
|
553
|
+
reviewRl.close();
|
|
364
554
|
});
|
|
365
|
-
const lineIter =
|
|
555
|
+
const lineIter = reviewRl[Symbol.asyncIterator]();
|
|
366
556
|
const ask = async (q) => {
|
|
557
|
+
if (interrupted)
|
|
558
|
+
return null;
|
|
367
559
|
process.stdout.write(q);
|
|
368
560
|
const next = await lineIter.next();
|
|
369
561
|
if (next.done)
|
|
370
562
|
return null;
|
|
371
563
|
return String(next.value);
|
|
372
564
|
};
|
|
565
|
+
if (isInteractive() && !flags.yes)
|
|
566
|
+
askPush = ask;
|
|
373
567
|
const MAX_PREVIEW_LINES = 12;
|
|
374
568
|
try {
|
|
375
569
|
let idx = 0;
|
|
@@ -472,8 +666,9 @@ async function main() {
|
|
|
472
666
|
}
|
|
473
667
|
}
|
|
474
668
|
}
|
|
475
|
-
|
|
476
|
-
|
|
669
|
+
catch (err) {
|
|
670
|
+
reviewRl.close();
|
|
671
|
+
throw err;
|
|
477
672
|
}
|
|
478
673
|
}
|
|
479
674
|
const toApprove = [];
|
|
@@ -498,7 +693,11 @@ async function main() {
|
|
|
498
693
|
printErrorWithHelp(e);
|
|
499
694
|
exitCode = 1;
|
|
500
695
|
}
|
|
696
|
+
else if (outcome.personalCommitted) {
|
|
697
|
+
await afterPersonalCommit(config, homeDir, askPush);
|
|
698
|
+
}
|
|
501
699
|
}
|
|
700
|
+
rl?.close();
|
|
502
701
|
const remainingCount = proposals.length - toApprove.length - toReject.length;
|
|
503
702
|
console.log(`\n${c.bold('Review summary:')} ` +
|
|
504
703
|
`${c.green(`${toApprove.length} approved`)} | ` +
|
|
@@ -519,7 +718,12 @@ async function main() {
|
|
|
519
718
|
console.log(` Team root: ${config.roots.team.path} (HEAD: ${getHeadSha(config.roots.team.path)?.slice(0, 8) || 'none'}, mode: ${config.roots.team.submitMode || 'auto'})`);
|
|
520
719
|
}
|
|
521
720
|
if (config.roots.personal) {
|
|
522
|
-
|
|
721
|
+
const pr = config.roots.personal;
|
|
722
|
+
const mode = pr.readOnly ? 'read-only host' : `push: ${getPushMode(pr)}`;
|
|
723
|
+
console.log(` Personal root: ${pr.path} (HEAD: ${getHeadSha(pr.path)?.slice(0, 8) || 'none'}, ${mode})`);
|
|
724
|
+
const reminder = getUnpushedReminder(config, homeDir);
|
|
725
|
+
if (reminder)
|
|
726
|
+
console.log(c.yellow(` ${reminder}`));
|
|
523
727
|
}
|
|
524
728
|
console.log(` Project root: ${projectRes.projectRoot || 'none'} (source: ${projectRes.source})`);
|
|
525
729
|
if (loaded.uncommittedWarnings.length > 0) {
|
|
@@ -746,16 +950,20 @@ function printHelp() {
|
|
|
746
950
|
console.log(`@fabersep/memory (faber-memory)
|
|
747
951
|
|
|
748
952
|
Commands:
|
|
749
|
-
setup [path] [--team <git-url|org/repo> --path <dir> --submit-mode auto|pr]
|
|
750
|
-
|
|
751
|
-
|
|
953
|
+
setup [path] [--remote <git-url>] [--team <git-url|org/repo> --path <dir> --submit-mode auto|pr]
|
|
954
|
+
setup --read-only <git-url> [path] (a host that only reads, e.g. a server)
|
|
955
|
+
remote add <git-url> [--allow-public] | remote remove
|
|
956
|
+
push
|
|
957
|
+
config [set-path <personal|team> <new-path> | set-submit-mode <auto|pr> | set-push-mode <ask|auto|never> | unset <personal|team>]
|
|
958
|
+
init [folder] [--remote <git-url>] [--preview | --undo] [--engine claude-code,antigravity,claude-desktop,cursor,codex] [--project-hint]
|
|
752
959
|
compile [--check] [--repo <dir>]
|
|
753
960
|
sync [--timeout <ms>]
|
|
754
961
|
status
|
|
755
962
|
stats [--days 1..90] [--json] [--cache] [--engine claude-code|antigravity|all] [--log-dir <path>] [--share]
|
|
756
963
|
doctor [--json] [--strict]
|
|
757
|
-
review [--approve-all]
|
|
758
|
-
|
|
964
|
+
review [--approve-all] [--yes] [--web [--port <n>] [--no-open] [--idle-timeout <min>] [--read-only]]
|
|
965
|
+
web [--port <n>] [--no-open] [--idle-timeout <min>] [--read-only]
|
|
966
|
+
approve <proposal-id> [...] [--mode auto|pr] [--yes]
|
|
759
967
|
reject <proposal-id> | reject --all [--yes]
|
|
760
968
|
reset [--include-personal-repo] [--yes]
|
|
761
969
|
import --from <markdown-dir|claude-memory|agents-md|cursor-rules> <path> [--scope personal|team|project] [--split-headings] [--normalize-paths] [--approve]
|
package/dist/src/config.js
CHANGED
|
@@ -66,6 +66,7 @@ export function loadConfig(homeDir = getHomeDir()) {
|
|
|
66
66
|
similarityThreshold: typeof raw.similarityThreshold === 'number'
|
|
67
67
|
? raw.similarityThreshold
|
|
68
68
|
: DEFAULT_SIMILARITY_THRESHOLD,
|
|
69
|
+
...(typeof raw.similarityHintFloor === 'number' ? { similarityHintFloor: raw.similarityHintFloor } : {}),
|
|
69
70
|
roots: raw.roots || {},
|
|
70
71
|
};
|
|
71
72
|
}
|