Open-source SEO, GEO, and marketing skills for AI agents.
fix(cli): resolve relative --data-dir before it reaches the server — release 0.9.1
Yuting Zhong306cbba6cae2
diff --git a/notfair/CHANGELOG.md b/notfair/CHANGELOG.mdindex ca3c1ac8..6cf0677d 100644--- a/notfair/CHANGELOG.md+++ b/notfair/CHANGELOG.md@@ -1,6 +1,12 @@# NotFair-## Unreleased+## 0.9.1 — 2026-07-20++**Confirming the plan in chat starts the loop — the START button is gone.** Intake used to double-confirm: agree the plan in chat, then press START on the Goal tab. Now your confirmation in chat IS the consent moment — the moment the agent records the agreed target (`propose_target`), the goal goes active and the first check runs immediately.++**Check diary rows show what changed.** Each check on the Checks rail now carries write badges — MCP writes classified from the check's own tool calls ("Campaign budget updated"), plus agent-labeled action badges for logged mutations. The "Action taken" filter keys off real writes, so read-only checks stay out of the way.++**CLI: relative `--data-dir` no longer strands your database in the npm cache.** The path is resolved to absolute before it reaches the server; previously `--data-dir ./data` validated one directory and wrote `db.sqlite` into another (inside the npx cache, for `npx notfair` runs). The `pnpm cli` script now points at the real CLI entry, and the `--help` text no longer references a long-dead runtime.**Codex account and model state now match the local CLI.** The sidebar reads authentication independently from usage availability, shows the correct ChatGPT Pro label, keeps authenticated users signed in when a rate-limit window is absent, and offers a working manual sign-in button when Codex is actually logged out. The chat model selector now names the configured Codex model instead of showing an opaque “Default” label.@@ -8,8 +14,6 @@**Code changes go through pull requests — and the loop tracks them natively.** Goals whose levers live in your website's code (SEO above all) now have a sanctioned, governed channel: the agent may change code only inside the workspace's **Codebase folder** (new Settings card, validated + editable any time), only on a `notfair/…` branch, and only via a PR it registers with the new `register_pull_request` tool — never a direct push, never merging its own PR. You review and merge on GitHub, exactly like any teammate's PR. PR state syncs through your authenticated `gh` CLI via a centralized freshness sweep on the 30-second scheduler: every open PR carries its own adaptive `next_sync_at` (checks every 2 minutes right after activity, decaying to hourly for long-quiet PRs, resetting on any observed change; merged/closed PRs leave the schedule forever), with tick-time and goal-page-view syncs kept as correctness/UX guarantees and a single-flight guard so triggers coalesce. Each tick brief therefore carries the live truth: changes requested → the agent addresses your review comments that tick; awaiting review → your Goal tab and the goals index show a "PR needs your review" badge; merged → the observation window measures from there; closed unmerged → the agent scores the action as rejected and learns. Open PRs also pin the heartbeat to its normal cadence (no smart-sleep past a pending review). Without a codebase folder set, code stays off-limits and agents log recommendations instead.-**Fix: the START button now appears without a manual reload.** The goal page only auto-refreshed during `intake` and `active`, so once the metric verified (→ `proposed`) the page went static — the agent would say "press START" but the button never rendered until you reloaded. `proposed` goals now poll too, so the target recording and the START card surface live.-**Goal creation gets a platform focus — dynamic per workspace.** The goal form (goals index and a new onboarding step 3, "First goal") shows one focus chip per connected platform — Google Ads, Meta Ads, SEO (Search Console), X Ads, Analytics — plus "Other". Picking a focus swaps in platform-appropriate placeholder text and tap-to-fill example statements, and the choice rides along to the agent's intake kickoff so it explores the right platform even when the statement is ambiguous. Connect Search Console and SEO goals are one tap away — without auto-flooding the index with machine-proposed goals (the audited X Ads suggestions remain the only auto-generated ones). Onboarding now ends by minting that first goal instead of dropping you on an empty index; skippable, and the workspace form is identical.**Pick which account each connection targets — right where you connect.** Multi-account MCPs (Google Ads, Meta Ads, Search Console) now resolve their workspace account/property on the Connections page, not just in onboarding. Finishing OAuth auto-keeps a still-valid selection, silently persists the only reachable account, and otherwise opens a picker dialog listing what the new token can reach. Each card carries one action tracking its setup state — **Connect** → **Choose account/property** → a quiet **Switch account/property** — with the persisted selection shown on the card (`Search Console property: sc-domain:example.com`) and Disconnect / Remove tucked into the ⋯ menu, so switching accounts never requires reconnecting. Selections persist on the workspace row and feed every goal agent's identity, keeping each workspace's agents on exactly one account per platform. Onboarding's connect step now renders the same `McpCard` rows and picker dialog as the Connections page — its bespoke connector tiles and three full-page picker steps are gone, so the Connect → Choose → Switch lifecycle is identical on both surfaces, and the picker's rows use the design system's elevated surfaces instead of borders. The account-selection layer is covered by the repo's first vitest suite (`pnpm test`).diff --git a/notfair/bin/cli.mjs b/notfair/bin/cli.mjsindex feff0013..ac3e1f22 100755--- a/notfair/bin/cli.mjs+++ b/notfair/bin/cli.mjs@@ -13,7 +13,7 @@ import {unlinkSync,} from "node:fs";import { homedir } from "node:os";-import { dirname, join } from "node:path";+import { dirname, join, resolve } from "node:path";import { fileURLToPath } from "node:url";import { createServer } from "node:net";import { Command } from "commander";@@ -21,12 +21,15 @@ import open from "open";const __dirname = dirname(fileURLToPath(import.meta.url));const PKG_ROOT = dirname(__dirname);-const DATA_DIR = process.env.NOTFAIR_DATA_DIR ?? join(homedir(), ".notfair");+// Resolved to absolute: the value is forwarded as NOTFAIR_DATA_DIR to the+// standalone server, whose cwd is the package dir — a relative path would+// silently land the database inside the npm/npx cache.+const DATA_DIR = resolve(process.env.NOTFAIR_DATA_DIR ?? join(homedir(), ".notfair"));const program = new Command();program.name("notfair")- .description("Local AI marketing CMO portal. Orchestrates OpenClaw marketing agents.")+ .description("Goal-driven marketing agents on your machine, on top of Claude Code or Codex.").version(readPackageVersion());program@@ -34,7 +37,7 @@ program.description("Start the local server and open the UI in your browser.").option("-p, --port <port>", "Port to bind", "3327").option("--no-open", "Do not auto-open the browser")- .option("--data-dir <dir>", "Override data directory", DATA_DIR)+ .option("--data-dir <dir>", "Override data directory", (dir) => resolve(dir), DATA_DIR).action(async (opts) => {const desired = Number.parseInt(opts.port, 10);const port = await findFreePort(desired);@@ -87,7 +90,7 @@ programprogram.command("doctor").description("Verify this machine is ready to run NotFair.")- .option("--data-dir <dir>", "Override data directory", DATA_DIR)+ .option("--data-dir <dir>", "Override data directory", (dir) => resolve(dir), DATA_DIR).option("-p, --port <port>", "Preferred port for the server", "3327").action(async (opts) => {const results = [];diff --git a/notfair/package.json b/notfair/package.jsonindex 39ad4bf5..54bd3ecc 100644--- a/notfair/package.json+++ b/notfair/package.json@@ -1,6 +1,6 @@{"name": "notfair",- "version": "0.9.0",+ "version": "0.9.1","description": "Open-source AI marketing CMO portal. Run locally; orchestrates marketing agents (Google Ads, SEO, and more) on top of Claude Code, Codex, or other local AI coding agents.","license": "MIT","bin": {@@ -16,7 +16,7 @@"dev": "next dev --turbopack -p 3326","build": "next build && node scripts/copy-standalone-assets.mjs","start": "next start",- "cli": "tsx bin/cli.ts",+ "cli": "node bin/cli.mjs","typecheck": "tsc --noEmit","test": "vitest run","test:watch": "vitest"