Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2a661e3
feat(cli): replace Docker-based get-sync-token with native Obsidian A…
aliasunder Aug 24, 2026
d939c87
fix(review): update stale Docker references in comments
aliasunder Aug 24, 2026
d920916
test: add MFA retry failure coverage and tighten assertion
aliasunder Aug 24, 2026
7ce7b17
fix(cli): classify retry errors in MFA flow instead of blaming the 2F…
aliasunder Aug 24, 2026
d9b07b6
fix(cli): tighten retry error hint + non-object JSON guard; lead guid…
aliasunder Aug 24, 2026
33b0ee5
docs: add Node.js version check step before npx in one-click guides
aliasunder Aug 24, 2026
23189b3
docs: remove confusing Docker fallback reference from Node.js check step
aliasunder Aug 24, 2026
36ee413
Merge branch 'main' into worktree-get-sync-token-native
aliasunder Aug 24, 2026
99803e0
feat(cli): remove paste prompt, add orientation text for token capture
aliasunder Aug 24, 2026
1ae3ec6
docs: remove "No Docker needed" from token capture steps
aliasunder Aug 24, 2026
343b05c
docs(cli): simplify init's get-sync-token reference
aliasunder Aug 24, 2026
2b7ef96
Merge branch 'main' into worktree-get-sync-token-native
aliasunder Aug 24, 2026
bbdbbc6
refactor(cli): rename isRecord to isJsonObject for clarity
aliasunder Aug 24, 2026
a15e4da
refactor(cli): improve get-sync-token readability
aliasunder Aug 24, 2026
d7f499b
refactor(cli): flatten callSigninApi response parsing
aliasunder Aug 24, 2026
4c94e68
refactor(cli): wrap response parsing in try/catch
aliasunder Aug 24, 2026
c81c0a0
refactor(cli): simplify callSigninApi to return token string
aliasunder Aug 25, 2026
2c4ba10
fix(cli): preserve existing token on re-init; simplify API return type
aliasunder Aug 25, 2026
3674881
refactor(cli): use undefined for missing token instead of empty string
aliasunder Aug 25, 2026
4e7ba9e
fix(cli): update PTY test for removed paste prompt + type obsidianAut…
aliasunder Aug 25, 2026
10282b7
fix(cli): add missing tests, fix comment, make signin URL configurable
aliasunder Aug 25, 2026
071e2c1
test(cli): add PTY happy-path tests for get-sync-token
aliasunder Aug 25, 2026
f2c5bc5
fix(cli): correct stale paste-prompt reference in offerSyncTokenCaptu…
aliasunder Aug 25, 2026
acf2e46
feat(cli): show start command after get-sync-token --dir writes token
aliasunder Aug 25, 2026
c90e598
fix(cli): remove redundant orientation text and merge start hint into…
aliasunder Aug 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ cli/ # npx vault-cortex CLI (published as vaul
docker.ts # Container management (docker run, health-check wait)
upgrade.ts # Upgrade command (pull + re-create + health check)
lifecycle.ts # Down/logs/restart commands + shared deployment resolution and re-create plumbing
get-sync-token.ts # Get-sync-token subcommand (Sync token auto-capture via volume mount)
get-sync-token.ts # Get-sync-token subcommand (Sync token capture via Obsidian API)
Comment thread
aliasunder marked this conversation as resolved.
env.ts # Environment file handling (.env generation)
token.ts # Secure token generation (openssl rand)
vault.ts # Vault path validation
Expand Down
14 changes: 6 additions & 8 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ What it does:
Re-running init where a setup already exists asks first — declining leaves
everything unchanged and points you at [`configure`](#configure), the right
tool for changing settings in place. Existing files are never overwritten
without asking. During a remote setup, init offers to run
[`get-sync-token`](#get-sync-token) for you when Docker is available.
without asking. During a remote setup, init offers to generate your
[Obsidian Sync token](#get-sync-token) as part of the flow.

Flags:

Expand Down Expand Up @@ -194,17 +194,15 @@ remote setups — without leaving the CLI:
npx vault-cortex@latest get-sync-token
```

The command opens the Obsidian login inside Docker. Once you've signed in, it
captures your token and prints it — nothing to dig out of the login output.
Use `--dir <path>` to write the token straight into an existing `.env`
instead:
The command prompts for your Obsidian account email, password, and MFA code
(if enabled), signs in via the Obsidian API, and prints the token. Use
`--dir <path>` to write the token straight into an existing `.env` instead:

```bash
npx vault-cortex@latest get-sync-token --dir ./vault-cortex
```

During `init --mode remote`, this flow is offered automatically when Docker
is available.
During `init --mode remote`, this flow is offered automatically.

## Requirements

Expand Down
2 changes: 0 additions & 2 deletions cli/src/__tests__/command-stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export const dockerReady: DockerRunner = {
stopAndRemoveContainer: () => true,
containerExists: () => true,
streamLogs: async () => 0,
runObsidianLogin: () => false,
}

/** Daemon installed but not running — every operation fails. */
Expand All @@ -185,7 +184,6 @@ export const dockerDown: DockerRunner = {
stopAndRemoveContainer: () => false,
containerExists: () => false,
streamLogs: async () => 1,
runObsidianLogin: () => false,
}

/** Docker binary absent entirely — every operation fails. */
Expand Down
66 changes: 0 additions & 66 deletions cli/src/__tests__/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { describe, expect, it } from "vitest"
import {
buildDockerLogsArgs,
buildDockerRunArgs,
buildObsidianLoginArgs,
classifyDaemonStatus,
CONTAINER_NAME,
healthPollTimeoutMs,
Expand Down Expand Up @@ -193,71 +192,6 @@ describe("buildDockerRunArgs", () => {
})
})

describe("buildObsidianLoginArgs", () => {
it("produces the correct args on macOS (no --user flag)", () => {
const args = buildObsidianLoginArgs({
configMountPath: "/tmp/vault-cortex-sync-token-abc",
platform: "darwin",
uid: 501,
gid: 20,
})

expect(args).toEqual([
"run",
"--rm",
"-it",
"--entrypoint",
"ob",
"-v",
"/tmp/vault-cortex-sync-token-abc:/home/obsidian/.config",
REMOTE_IMAGE,
"login",
])
})

it("includes --user uid:gid on Linux", () => {
const args = buildObsidianLoginArgs({
configMountPath: "/tmp/vault-cortex-sync-token-abc",
platform: "linux",
uid: 1000,
gid: 1000,
})

expect(args).toEqual([
"run",
"--rm",
"-it",
"--entrypoint",
"ob",
"-v",
"/tmp/vault-cortex-sync-token-abc:/home/obsidian/.config",
"--user",
"1000:1000",
REMOTE_IMAGE,
"login",
])
})

it("omits --user on Linux when uid/gid are not provided", () => {
const args = buildObsidianLoginArgs({
configMountPath: "/tmp/test",
platform: "linux",
})

expect(args).toEqual([
"run",
"--rm",
"-it",
"--entrypoint",
"ob",
"-v",
"/tmp/test:/home/obsidian/.config",
REMOTE_IMAGE,
"login",
])
})
})

describe("healthPollTimeoutMs", () => {
it("gives remote mode a 4-minute budget for the first-sync gate", () => {
expect(healthPollTimeoutMs("remote")).toBe(240_000)
Expand Down
Loading
Loading