Skip to content

fix(cli): show configured project in list when uncredentialed (#1003)#1010

Open
rudi193-cmd wants to merge 1 commit into
basicmachines-co:mainfrom
rudi193-cmd:fix/issue-1003-config-project-list
Open

fix(cli): show configured project in list when uncredentialed (#1003)#1010
rudi193-cmd wants to merge 1 commit into
basicmachines-co:mainfrom
rudi193-cmd:fix/issue-1003-config-project-list

Conversation

@rudi193-cmd

Copy link
Copy Markdown
Contributor

Summary

bm project list renders an empty table even when a project exists in config.json and the local DB, while bm project add reports the same project already exists — the two commands disagree about whether the project exists (#1003).

Root cause

In src/basic_memory/cli/commands/project.py, list_projects() seeds its table rows (row_names_by_key) exclusively from live query results:

  • the cloud branch, which is guarded by _has_cloud_credentials(config) and skipped when no credentials are present, and
  • the local query, which does not surface a mode: cloud project.

config.projects is consulted only to enrich rows that already exist (configured_names_by_permalink), never to create one. So a cloud-mode project with no cloud credentials on the machine is surfaced by neither query → empty table. Meanwhile bm project add reads the DB, finds the project, and reports "already exists".

Fix

Seed a local-keyed row from config.projects for any configured project not already surfaced by a query. The existing row-building logic already derives the correct display (cloud CLI route, https MCP) from the config entry.

The fallback is scoped to the local-inclusive view — it is skipped for a pure --cloud listing (no local_result) and for a --workspace-filtered view, since those are deliberately narrowed and configured local projects must not leak into them.

Test

Adds test_project_list_shows_configured_project_without_cloud_credentials to tests/cli/test_project_list_and_ls.py: a cloud-mode project in config with _has_cloud_credentials false and an empty local list now renders the project instead of an empty table. Verified the test fails on main (empty table → StopIteration) and passes with the fix.

Verification

  • tests/cli/test_project_list_and_ls.py — 14 passed
  • tests/cli (full) — 414 passed
  • ruff check + ruff format --check — clean
  • ty check on the changed file — clean

Fixes #1003

…achines-co#1003)

`bm project list` seeded its table rows only from live query results — the
cloud query (skipped when no credentials are present) and the local query.
`config.projects` was used only to enrich existing rows, never to create one,
so a cloud-mode project with no cloud credentials on the machine was surfaced
by neither query and rendered an empty table. Meanwhile `bm project add` reads
the DB and reports the same project already exists, so the two commands
disagreed about whether the project existed.

Seed a local-keyed row from `config.projects` for any configured project not
already surfaced, scoped to the local-inclusive view so a `--cloud` or
`--workspace`-filtered listing stays deliberately narrow. Adds a regression
test covering the cloud-mode-without-credentials case.

Fixes basicmachines-co#1003

Signed-off-by: rudi193-cmd <rudi193@gmail.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

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.

[BUG] bm project list shows empty table while bm project add reports the project already exists (configured/cloud-mode project never rendered)

1 participant