Skip to content

Feat: Add support for creating git prototypes to cli. #12

Open
dlabaj wants to merge 7 commits intomainfrom
git-updates
Open

Feat: Add support for creating git prototypes to cli. #12
dlabaj wants to merge 7 commits intomainfrom
git-updates

Conversation

@dlabaj
Copy link
Contributor

@dlabaj dlabaj commented Feb 10, 2026

Closes issue #7 :

  • Create projects and push initial project to prototype
  • Push updates to prototype
  • Retrieve latest updates from github.

@dlabaj dlabaj self-assigned this Feb 10, 2026
@dlabaj dlabaj added the enhancement New feature or request label Feb 10, 2026
@github-project-automation github-project-automation bot moved this to Needs triage in PatternFly Issues Feb 10, 2026
@dlabaj dlabaj changed the title WIP: Add support for creating git prototypes to cli. Feat: Add support for creating git prototypes to cli. Feb 12, 2026
@dlabaj dlabaj requested review from cdcabrera and jpuzz0 and removed request for cdcabrera and jpuzz0 February 12, 2026 14:20
'repo',
'create',
options.repoName,
'--public',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to provide an option to make a private project?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have a default...and maybe the default is public, but I would think maybe the opposite actually.

}

try {
await execa('git', ['add', '.'], { cwd, stdio: 'inherit' });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no selective adding ability? What if they only want to push a particular file or directory within the project?

]);

const commitMessage = (message as string).trim();
if (!commitMessage) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this condition won't even be reached due to the validate function for the commit message above requiring a string, right? I think it can be removed, but maybe I'm misunderstanding.

Comment on lines +22 to +36
if (err && typeof err === 'object' && 'exitCode' in err) {
const code = (err as { exitCode?: number }).exitCode;
if (code === 128) {
console.error(
'\n❌ Pull failed. You may need to set a remote (e.g. "git remote add origin <url>") or run "gh auth login".\n',
);
} else {
console.error('\n❌ Pull failed. See the output above for details.\n');
}
} else {
console.error('\n❌ An error occurred:');
if (err instanceof Error) console.error(` ${err.message}\n`);
else console.error(` ${String(err)}\n`);
}
throw err;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this is duplicated in the save.ts file...instead of repeating the code here, maybe make a helper called something like handleGitError?

console.log('\n✅ Changes saved and pushed to GitHub successfully.\n');
} catch (err) {
if (err && typeof err === 'object' && 'exitCode' in err) {
const code = (err as { exitCode?: number }).exitCode;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this casting if you update the condition above to something like if (err instanceof ExecaError) instead of if (err && typeof err === 'object' && 'exitCode' in err)

{
type: 'confirm',
name: 'useSSH',
message: 'Use SSH URL for cloning?',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will non-devs understand this question and how to answer it?

src/cli.ts Outdated
},
]);

if (createGitHub) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the create logic could be separated into its own function to make the CLI more readable here, and could be unit tested separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants