Open gemanor opened 3 weeks ago
/bounty 250
/attempt #18
with your implementation plan/claim #18
in the PR body to claim the bountyThank you for contributing to permitio/permit-cli!
Add a bounty • Share on socials
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟢 @35C4n0r | Oct 28, 2024, 4:09:08 PM | WIP |
🔴 @Rutik7066 | Nov 6, 2024, 3:26:01 PM | WIP |
🟢 @vishwamartur | Nov 15, 2024, 6:50:58 AM | WIP |
/attempt #18
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@35C4n0r | 30 bounties from 5 projects | Python, TypeScript, HTML & more |
﹟6 |
Cancel attempt |
@35C4n0r can we collaborate on this issue
@35C4n0r can we collaborate on this issue
Sorry @Abiji-2020, I prefer working solo :)
@35C4n0r In order to assign you to the issue, I would kindly ask that you share your progress on the issue and the design of your components/lib files for review. I will assign you after the design review.
@gemanor Since this issue depends on https://github.com/permitio/permit-cli/issues/13, I'll finish #13 first, then write a proposal for this. Let me know if that works! :)
Works, but please try to write a proposal ASAP so I can assign you to it
@gemanor here is my proposal for this one =)
We'll create a new file env
in the source/commands
dir.
We will use the existing component built here in #28 https://github.com/permitio/permit-cli/pull/28/files#diff-de1a6861d1b4be5affe427a2fd0fd23ef364b77026866476f93ac87a2a56cdd6 for the permit env select
command.
For the permit env copy
command we'll take user input via a component and flags: --project
and --env
For the above command we'll also create new methods to copy and switch the environment in the hooks here https://github.com/permitio/permit-cli/pull/28/files#diff-5fa375664b9f3623c65bd1c2b8e57435ee00a65b29b8545b7b94ef5202fed6dd
We'll create a new useUserApi
hook to add the users with roles, interactively or via flags for the permit env member
command.
@gemanor I have one proposal for Login, sign-up, Environment management, separate error handling, testing including unit and e2e and for the overall app.
src/
The working directory for the entire application, containing all the source code files.
cli.tsx
: The main entry point of the CLI app, responsible for initializing the app and parsing commands.
cmd/
: Contains the components for handling specific commands, including parsing and business logic. Each command has its own file, such as login.tsx
and environment.tsx
.
hooks/
: Stores custom hooks, which can be reused for various functions like managing state, API calls, or UI updates.
services/
: Includes files for API communication and business logic. This folder contains modules like login.ts
, environment.ts
, and keychain.ts
to handle relevant app functionalities.
utils/
: Holds helper functions for common tasks, such as logging, data formatting, or file manipulation.
errors/
: Contains custom error handling classes to standardize error management across the app, such as AppError.ts
, ApiCallError.ts
, and others for specific use cases like authentication or validation.
types/
: Contains TypeScript types used across the app for APIs, commands, and other logic to ensure consistency and type safety.
config/
: Stores configuration files, including environment and app-specific settings, allowing easy configuration management.
testing/
: Contains unit and integration tests to ensure that individual modules and services are working as expected.
e2e/
: Includes end-to-end tests for simulating real-world use cases and validating the CLI app's overall functionality.
components/
: Holds global React components (if any are used for a Node.js CLI) that are shared across different parts of the app.
constants.ts
: Defines app-wide constants used across multiple modules to avoid duplication and maintain consistency.
This structure follows best practices for organizing a Node.js CLI app, ensuring clear separation of concerns, ease of maintenance, and scalability.
/attempt #18
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@Rutik7066 | 10 bounties from 7 projects | Go, Rust, MDX & more |
Cancel attempt |
Hey @Rutik7066, as you saw, @35C4n0r already submitted a proposal for this one and PR for the other login flow. We are currently working on a first-come, first-serve model, so we will continue with him at this point.
Also, we have already based our structure on the Pastel structure recommendation, so there is no need for extra best practices for organizing the Node.js CLI app.
I'm more than inviting you to submit bounties on other PRs in this repo, or get back to that in a week in case @35C4n0r will have to cancel his attempt.
@35C4n0r The proposal looks good, and you've approved continuing with it.
Two comments:
user
is a different term in Permit (the end user who gets authorized)--project
because the environment can be copied only inside projects. Please take a look at the following API doc and propose the command arguments. https://api.permit.io/v2/redoc#tag/Environments/operation/copy_environmentAs usual, please try to bring it ASAP so I can assign it to you.
@gemanor no problem. I just want to ask one thing that I have also raised the pr for the login and sign up flow https://github.com/permitio/permit-cli/pull/27. Will that be accepted. In that pr I have not changed the structure just solved the issue.
@35C4n0r can we collaborate?
@gemanor, thanks for the feedback, here is the revised proposal:
We'll create a new file env
in the source/commands
dir.
We will use the existing component built here in #28 https://github.com/permitio/permit-cli/pull/28/files#diff-de1a6861d1b4be5affe427a2fd0fd23ef364b77026866476f93ac87a2a56cdd6 for the permit env select
command.
For the permit env copy
command we'll take user input via a component and flag: --target
, --conflictStrategy
and --scope
, which will copy the existing environment to the target
environment.
We will create a hook to get a project level access token with write permissions to copy the environment.
For the above command we'll also create new methods to copy and switch the environment in the hooks here https://github.com/permitio/permit-cli/pull/28/files#diff-5fa375664b9f3623c65bd1c2b8e57435ee00a65b29b8545b7b94ef5202fed6dd
We'll create a new *useMemberApi
hook to add the users with roles, interactively or via flags for the permit env member
command.
@35C4n0r sounds good to me
Thanks @gemanor, I'll start working on it right away, my work will be based of the branch here https://github.com/permitio/permit-cli/pull/28.
/attempt #18
We want to create a set of commands that will help users manage their Permit environments. The following is the skeleton of the commands required in this issue:
permit env select
- selecting a different environment and storing the relevant key. This should incorporate with the following issue and use the same components: https://github.com/permitio/permit-cli/issues/13permit env copy
- will allow users to copy their existing logged-in environment to a new environment and change their active environment to itpermit env member
will allow users to add more members to their environment with proper rolesAcceptance criteria: