Skip to content

Profiles#14

Merged
gabe-l-hart merged 31 commits intomainfrom
Profiles-13
Dec 19, 2025
Merged

Profiles#14
gabe-l-hart merged 31 commits intomainfrom
Profiles-13

Conversation

@gabe-l-hart
Copy link
Collaborator

@gabe-l-hart gabe-l-hart commented Dec 19, 2025

## DRAFT STATUS

There are issues in the core package that make it difficult to add additional profiles due to the password change requirement. Until a workaround is solved, this will stay in draft.

We've solved this issue by adding the ability to create profiles via the CLI and managing a virtual default profile corresponding to the old default behavior.

Description

This PR introduces the ability to manage separate profiles, matching the corresponding functionality in the Desktop App. It relies on the functionality in contextforge-org/contextforge-desktop#4 which places the profile data into the CONTESTFORGE_HOME directory. This allows the CLI and the Desktop App to interoperate on profile settings without tightly coupling the two (the CLI will still work seamlessly without configured profiles).

Changes

  • Add a collection of tools for working with profiles in cforge/profile_utils.py
  • Add a collection of tools for working with encrypted saved credentials in cforge/credential_store.py
  • Add a new set of commands in cforge/commands/settings/profiles.py
  • Update all existing commands to use a common utility for fetching the server URL that is profile-aware
  • Add profile information to cforge whoami
  • Perform auto-login when possible with saved credentials

Testing

  • Full unit test coverage with minimal mocking

Definition Of Done

  • This PR contains documentation
    • Yes
    • NO (explain): The only docs we really have right now are in --help and this is covered there. More thorough docs to come!
    • N/A
  • This PR contains unit tests
    • Yes
    • NO (explain)
    • N/A
  • This PR has been tested for backwards compatibility
    • Yes
    • NO (explain)
    • N/A

This is the unedited Bob output that will be cleaned up in later commits

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
This is needed so you can actually use the `get` by ID

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Since we validate only a single active profile earlier and we short-circuit
for no active profile, we can't possibly have other active profiles that
aren't the active profile.

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
This profile will not be saved in the profiles file but will show up when
profiles are listed and will allow users to switch to the default profile.

We still need to figure out how to disable this if there is a local profile
from the desktop app.

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
There are several methods in conftest that invoke get_settings and we need
them to hit the mocked settings if used.

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
:
#13
Branch: Profiles-13
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
@gabe-l-hart gabe-l-hart marked this pull request as ready for review December 19, 2025 21:26
This is redundant with cforge whoami

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
This is handled during schema validation on load

#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
#13
Branch: Profiles-13

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
@gabe-l-hart gabe-l-hart merged commit c309171 into main Dec 19, 2025
4 checks passed
@gabe-l-hart gabe-l-hart deleted the Profiles-13 branch December 19, 2025 23:00
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.

1 participant