-
Notifications
You must be signed in to change notification settings - Fork 0
Reconcile with hosted features + BACK2BASE_DATA_DIR mount #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cc1de66
feat(model): pin OSS default to claude-opus-4-8[1m]
ramseymcgrath 820bc79
feat(statusline): vendor claude-hud, retire hand-rolled statusline
ramseymcgrath 7eb1c8e
test(migrate): update bats for schema 5 + claude-hud migration
ramseymcgrath a23ee5a
feat(compose): BACK2BASE_DATA_DIR mounts local plans + memories
ramseymcgrath e9b4467
test(compose): assert data-dir mounts are rw + cover env-file fallback
ramseymcgrath 705b9b1
fix(compose): use bare paths in data-dir override (Go %q broke compos…
ramseymcgrath 1be4111
style: trim verbose doc comments on data-dir + statusline helpers
ramseymcgrath f426add
fix(compose): quote whole volume item in managed-settings override
ramseymcgrath 2e6e3b2
feat(data-dir): mount plans+memories under ~/.back2base/ not ~/.claude/
ramseymcgrath 5beafcc
feat(entrypoint): wire ~/.back2base/memories as persistent memory store
ramseymcgrath 5c50f72
refactor(entrypoint): hoist memory-path alignment out of both branche…
ramseymcgrath fd46c7b
test(entrypoint): extract memory alignment to lib + bats coverage
ramseymcgrath 31b5ef1
test(firewall): drop stale cloud OTel-collector allow-list assertion
ramseymcgrath 7513847
ci+test: gate bats on macOS; harden prelaunch-overview timing tests
ramseymcgrath 13cc74a
fix: address Copilot review (sanitize ns, reject newline data-dir, te…
ramseymcgrath 4c495f2
docs: overhaul README
ramseymcgrath 1e37803
docs: drop phantom --model flag, add --namespace to root-flags line
ramseymcgrath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "_back2base_schema": 4, | ||
| "_back2base_schema": 5, | ||
| "statusLine": { | ||
| "type": "command", | ||
| "command": "/opt/back2base/statusline.sh", | ||
| "command": "bash -c 'export COLUMNS=\"${COLUMNS:-120}\"; exec node /opt/back2base/claude-hud/index.js --extra-cmd /opt/back2base/statusline-extra.sh'", | ||
| "padding": 0 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| # Memory-path alignment for the back2base container entrypoint. | ||
| # | ||
| # Sourced by entrypoint.sh and by test/memory-align.bats. Defines one function, | ||
| # b2b_align_memory_dir, which selects the canonical memory store and points | ||
| # Claude Code's auto-memory path at it. Reads HOME, PWD, MEMORY_NAMESPACE; | ||
| # exports CLAUDE_PROJECT_DIR and (when the bind mount is present) | ||
| # BACK2BASE_PLANS_DIR. | ||
|
|
||
| # b2b_align_memory_dir picks the canonical memory store and symlinks Claude | ||
| # Code's auto-memory path (PWD with '/' -> '-') to it: | ||
| # - BACK2BASE_DATA_DIR mounted ~/.back2base/memories -> use it, never wiped. | ||
| # - else MEMORY_NAMESPACE set -> ~/.claude/projects/<ns>/memory, wiped each | ||
| # session to prevent bleed. | ||
| # - else -> no-op. | ||
| b2b_align_memory_dir() { | ||
| local ns_memory_dir="" | ||
| if [ -d "$HOME/.back2base/memories" ]; then | ||
| ns_memory_dir="$HOME/.back2base/memories" | ||
| mkdir -p "$HOME/.back2base/plans" | ||
| export BACK2BASE_PLANS_DIR="$HOME/.back2base/plans" | ||
| elif [ -n "${MEMORY_NAMESPACE:-}" ]; then | ||
| ns_memory_dir="$HOME/.claude/projects/${MEMORY_NAMESPACE}/memory" | ||
| mkdir -p "$ns_memory_dir" | ||
| # Start blank so old session memory doesn't bleed via MEMORY.md autoload. | ||
| if [ -n "$(ls -A "$ns_memory_dir" 2>/dev/null)" ]; then | ||
| rm -rf "${ns_memory_dir:?}"/* "${ns_memory_dir:?}"/.[!.]* 2>/dev/null || true | ||
| fi | ||
| fi | ||
|
|
||
| [ -n "$ns_memory_dir" ] || return 0 | ||
|
|
||
| local cwd_dir_name cc_memory_dir | ||
| cwd_dir_name="${PWD//\//-}" | ||
| cc_memory_dir="$HOME/.claude/projects/${cwd_dir_name}/memory" | ||
| export CLAUDE_PROJECT_DIR="$HOME/.claude/projects/${cwd_dir_name}" | ||
| [ "$cc_memory_dir" != "$ns_memory_dir" ] || return 0 | ||
|
|
||
| mkdir -p "$(dirname "$cc_memory_dir")" | ||
| if [ -L "$cc_memory_dir" ]; then | ||
| if [ "$(readlink "$cc_memory_dir")" != "$ns_memory_dir" ]; then | ||
| ln -sfn "$ns_memory_dir" "$cc_memory_dir" | ||
| fi | ||
| elif [ -d "$cc_memory_dir" ]; then | ||
| if [ -n "$(ls -A "$cc_memory_dir" 2>/dev/null)" ]; then | ||
| cp -an "$cc_memory_dir"/. "$ns_memory_dir"/ 2>/dev/null || true | ||
| fi | ||
| rm -rf "$cc_memory_dir" | ||
| ln -sfn "$ns_memory_dir" "$cc_memory_dir" | ||
| else | ||
| ln -sfn "$ns_memory_dir" "$cc_memory_dir" | ||
| fi | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
| # claude-hud --extra-cmd helper for oss-back2base. | ||
| # | ||
| # claude-hud (vendored at /opt/back2base/claude-hud) renders the HUD; this adds | ||
| # the one segment it can't know — the memory namespace — as a JSON object on | ||
| # stdout: {"label":"ns:<namespace>"}. Omitted when no namespace is set. (The | ||
| # hosted build's auth/pwr segments don't exist in OSS.) | ||
|
|
||
| set +e | ||
|
|
||
| label="" | ||
| # Strip control chars (newlines etc.) from the namespace so a pathological | ||
| # value can't emit invalid JSON or leak terminal-control sequences into the HUD. | ||
| ns=$(printf '%s' "${MEMORY_NAMESPACE:-}" | tr -d '[:cntrl:]') | ||
| if [ -n "$ns" ]; then | ||
| label="ns:${ns}" | ||
| fi | ||
|
|
||
| # claude-hud truncates past 50 chars anyway; cap here to keep this self-contained. | ||
| if [ "${#label}" -gt 50 ]; then | ||
| label="${label:0:49}…" | ||
| fi | ||
|
|
||
| label=${label//\\/\\\\} | ||
| label=${label//\"/\\\"} | ||
| printf '{"label":"%s"}\n' "$label" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 13cc74a. statusline-extra.sh now strips control chars from the namespace (
ns=$(printf '%s' "$MEMORY_NAMESPACE" | tr -d '[:cntrl:]')) and only emits thens:label when the sanitized value is non-empty. Verified a namespace with an embedded newline + control char now yields valid single-line JSON. Same fix applied to the hosted build's statusline-extra.sh.