Skip to content

Implement Phase 1 items and Phase 2 task 8 from plan.md#45

Open
RafsanNeloy wants to merge 5 commits into
aces:mainfrom
RafsanNeloy:Phase_one
Open

Implement Phase 1 items and Phase 2 task 8 from plan.md#45
RafsanNeloy wants to merge 5 commits into
aces:mainfrom
RafsanNeloy:Phase_one

Conversation

@RafsanNeloy

@RafsanNeloy RafsanNeloy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR completes Tasks 2–7 of Phase 1 and Task 8 of Phase 2 as outlined in plan.md.

Task Coverages from Plan.md

This PR addresses the following Phase 1 & Phase 2 tasks:

  • 2.Stop execution after invalid pagination
  • 3.Fix tool show lookup
  • 4.Allow logout to clean up invalid credentials
  • 5.Remove import-time config directory creation
  • 6.Print empty list results consistently
  • 7.Implement or remove project unswitch
  • 8.Add CI enforcement for Ruff linting and formatting

Steps to switch a project-

./cbrain project list
./cbrain project switch 14
./cbrain project show
./cbrain project unswitch
./cbrain project show
./cbrain --json project unswitch

I'm not sure about the project unswitch, I was reading comment on the switch_group_helpers.rb code.

    orig_active_group_id = cbrain_session[:active_group_id].presence

    if group_id.blank? # FIXME I am not sure what that means. Pierre May 2022
      cbrain_session[:active_group_id] = nil
      return orig_active_group_id.present?  # say if it was changed or not
    end
    

Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
@dlq

dlq commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This is a really solid Phase 1 update. Nice work getting the credential handling, JSON output, pagination validation, logout cleanup, and tool show behavior moving in the right direction. The capture tests being green is also great to see.

I found one small behavior gap to tighten before merging: project unswitch should be fully idempotent when no current project is set. Right now it still tries to call /groups/switch even if the local credentials do not contain a current_group_id, so the command can fail on network/server access instead of simply reporting that no project is currently selected.

Could you update unswitch_project() so it skips the server call when there is no local current group, and add capture coverage for:

  • cbrain project unswitch
  • cbrain --json project unswitch
  • cbrain --jsonl project unswitch

Once that is covered, this looks like a very nice Phase 1 improvement and I will have no problem merging this PR!

Darcy

…h command

Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
@RafsanNeloy RafsanNeloy changed the title Implement Phase 1 items from plan.md Implement Phase 1 items and Phase 2 task 8 from plan.md Jun 18, 2026
@RafsanNeloy

Copy link
Copy Markdown
Contributor Author

@dlq I have updated the PR and also try to implement CI enforcement for Ruff linting and formatting from Phase 2. Please have a look when you have a chance.

Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
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.

2 participants