@patternfly/patternfly-cli 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.github/workflows/build.yml +21 -0
  2. package/.github/workflows/lint.yml +24 -0
  3. package/.github/workflows/release.yml +42 -0
  4. package/.github/workflows/test.yml +24 -0
  5. package/.releaserc.json +14 -0
  6. package/LICENSE +21 -0
  7. package/README.md +110 -0
  8. package/__mocks__/execa.js +5 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +272 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/github.d.ts +33 -0
  14. package/dist/github.d.ts.map +1 -0
  15. package/dist/github.js +180 -0
  16. package/dist/github.js.map +1 -0
  17. package/dist/load.d.ts +6 -0
  18. package/dist/load.d.ts.map +1 -0
  19. package/dist/load.js +40 -0
  20. package/dist/load.js.map +1 -0
  21. package/dist/save.d.ts +6 -0
  22. package/dist/save.d.ts.map +1 -0
  23. package/dist/save.js +97 -0
  24. package/dist/save.js.map +1 -0
  25. package/dist/template-loader.d.ts +6 -0
  26. package/dist/template-loader.d.ts.map +1 -0
  27. package/dist/template-loader.js +83 -0
  28. package/dist/template-loader.js.map +1 -0
  29. package/dist/templates.d.ts +17 -0
  30. package/dist/templates.d.ts.map +1 -0
  31. package/dist/templates.js +33 -0
  32. package/dist/templates.js.map +1 -0
  33. package/eslint.config.js +19 -0
  34. package/package.json +80 -0
  35. package/src/__tests__/cli.test.ts +171 -0
  36. package/src/__tests__/fixtures/invalid-template-bad-options.json +1 -0
  37. package/src/__tests__/fixtures/invalid-template-missing-name.json +1 -0
  38. package/src/__tests__/fixtures/not-array.json +1 -0
  39. package/src/__tests__/fixtures/valid-templates.json +14 -0
  40. package/src/__tests__/github.test.ts +214 -0
  41. package/src/__tests__/load.test.ts +106 -0
  42. package/src/__tests__/save.test.ts +272 -0
  43. package/src/cli.ts +307 -0
  44. package/src/github.ts +193 -0
  45. package/src/load.ts +38 -0
  46. package/src/save.ts +103 -0
  47. package/src/template-loader.ts +84 -0
  48. package/src/templates.ts +48 -0
  49. package/tsconfig.json +50 -0
@@ -0,0 +1,21 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: '20'
18
+ cache: 'npm'
19
+
20
+ - run: npm ci
21
+ - run: npm run build
@@ -0,0 +1,24 @@
1
+ name: Lint
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [Build]
6
+ types: [completed]
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ if: github.event.workflow_run.conclusion == 'success'
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ ref: ${{ github.event.workflow_run.head_sha }}
17
+
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: '20'
21
+ cache: 'npm'
22
+
23
+ - run: npm ci
24
+ - run: npm run lint
@@ -0,0 +1,42 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ issues: write
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ release:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+ persist-credentials: false
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: "20"
27
+ cache: "npm"
28
+
29
+ - name: Install dependencies
30
+ run: npm ci
31
+
32
+ - name: Build
33
+ run: npm run build
34
+
35
+ - name: Run tests
36
+ run: npm test
37
+
38
+ - name: Release
39
+ env:
40
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42
+ run: npm run semantic-release
@@ -0,0 +1,24 @@
1
+ name: Test
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [Build]
6
+ types: [completed]
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ if: github.event.workflow_run.conclusion == 'success'
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ ref: ${{ github.event.workflow_run.head_sha }}
17
+
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: '20'
21
+ cache: 'npm'
22
+
23
+ - run: npm ci
24
+ - run: npm test
@@ -0,0 +1,14 @@
1
+ {
2
+ "branches": ["main"],
3
+ "plugins": [
4
+ ["@semantic-release/commit-analyzer",
5
+ { "preset": "angular",
6
+ "parserOpts" : {
7
+ "noteKeywords": [ "BREAKING-CHANGE" ]
8
+ }
9
+ }],
10
+ "@semantic-release/release-notes-generator",
11
+ "@semantic-release/npm",
12
+ "@semantic-release/github"
13
+ ]
14
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Red Hat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # Patternfly CLI
2
+
3
+ Patternfly CLI is a command-line tool designed for scaffolding projects, performing code modifications, and running project-related tasks. It aims to streamline development workflows and improve productivity.
4
+
5
+ ## Features
6
+
7
+ - **Project Scaffolding**: Quickly set up new projects with predefined templates.
8
+ - **Code Modifications**: Automate repetitive code changes.
9
+ - **Task Runner**: Execute project-related tasks efficiently.
10
+
11
+ ## Installation
12
+
13
+ To install the CLI globally, use npm:
14
+
15
+ ```sh
16
+ npm install -g patternfly-cli
17
+ ```
18
+
19
+ ## Prerequisites
20
+
21
+ Before using the Patternfly CLI, install the following:
22
+
23
+ - **Node.js and npm** (v20–24) — [npm](https://www.npmjs.com/) · [Node.js downloads](https://nodejs.org/)
24
+ - **Corepack** — enable with `corepack enable` (included with Node.js). Run the command after installing npm.
25
+ - **GitHub CLI** — [Install GitHub CLI](https://cli.github.com/)
26
+
27
+ ## Usage
28
+
29
+ After installation, you can use the CLI by running:
30
+
31
+ ```sh
32
+ patternfly-cli [command]
33
+ ```
34
+
35
+ ### Available Commands
36
+
37
+ - **`create`**: Create a new project from the available templates.
38
+ - **`list`**: List all available templates (built-in and optional custom).
39
+ - **`update`**: Update your project to a newer version.
40
+
41
+ ### Custom templates
42
+
43
+ You can add your own templates in addition to the built-in ones by passing a JSON file with the `--template-file` (or `-t`) option. Custom templates are merged with the built-in list; if a custom template has the same `name` as a built-in one, the custom definition is used.
44
+
45
+ **Create with custom templates:**
46
+
47
+ ```sh
48
+ patternfly-cli create my-app --template-file ./my-templates.json
49
+ ```
50
+
51
+ **List templates including custom file:**
52
+
53
+ ```sh
54
+ patternfly-cli list --template-file ./my-templates.json
55
+ ```
56
+
57
+ **JSON format** (array of template objects, same shape as the built-in templates):
58
+
59
+ ```json
60
+ [
61
+ {
62
+ "name": "my-template",
63
+ "description": "My custom project template",
64
+ "repo": "https://github.com/org/repo.git",
65
+ "options": ["--single-branch", "--branch", "main"],
66
+ "packageManager": "npm"
67
+ }
68
+ ]
69
+ ```
70
+
71
+ - **`name`** (required): Template identifier.
72
+ - **`description`** (required): Short description shown in prompts and `list`.
73
+ - **`repo`** (required): Git clone URL.
74
+ - **`options`** (optional): Array of extra arguments for `git clone` (e.g. `["--single-branch", "--branch", "main"]`).
75
+ - **`packageManager`** (optional): `npm`, `yarn`, or `pnpm`; defaults to `npm` if omitted.
76
+
77
+
78
+ ## Development / Installation
79
+
80
+ ### Install Dependencies
81
+
82
+ ```sh
83
+ npm install
84
+ ```
85
+
86
+ ### Build
87
+
88
+ To build the project, run:
89
+
90
+ ```sh
91
+ npm run build
92
+ ```
93
+
94
+ ### Installing the cli
95
+
96
+ After building the cli you can install the cli globally by running the following command:
97
+
98
+ ```sh
99
+ npm install -g
100
+ ```
101
+
102
+ After that you can now execute the cli via ```patternfly-cli``` command in the terminal.
103
+
104
+ ### Releasing
105
+
106
+ This project uses [semantic-release](https://semantic-release.gitbook.io/) to automate versioning and releases based on [Conventional Commits](https://www.conventionalcommits.org/).
107
+
108
+ - **CI**: Pushing to `main` runs the release workflow. If there are commits that warrant a release (e.g. `feat:`, `fix:`, `BREAKING CHANGE:`), it will create a GitHub release, update `CHANGELOG.md`, and bump the version in `package.json`.
109
+ - **Local dry run**: `npx semantic-release --dry-run` (no push or publish).
110
+ - **npm publish**: By default only GitHub releases are created. To publish to npm, set the `NPM_TOKEN` secret in the repo and set `"npmPublish": true` for the `@semantic-release/npm` plugin in `.releaserc.json`.
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ execa: jest.fn(),
5
+ };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import { execa } from 'execa';
4
+ import inquirer from 'inquirer';
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import { defaultTemplates } from './templates.js';
8
+ import { mergeTemplates } from './template-loader.js';
9
+ import { offerAndCreateGitHubRepo } from './github.js';
10
+ import { runSave } from './save.js';
11
+ import { runLoad } from './load.js';
12
+ /** Command to create a new project */
13
+ program
14
+ .version('1.0.0')
15
+ .command('create')
16
+ .description('Create a new project from a git template')
17
+ .argument('[project-directory]', 'The directory to create the project in')
18
+ .argument('[template-name]', 'The name of the template to use')
19
+ .option('-t, --template-file <path>', 'Path to a JSON file with custom templates (same format as built-in)')
20
+ .option('--ssh', 'Use SSH URL for cloning the template repository')
21
+ .action(async (projectDirectory, templateName, options) => {
22
+ const templatesToUse = mergeTemplates(defaultTemplates, options?.templateFile);
23
+ // If project directory is not provided, prompt for it
24
+ if (!projectDirectory) {
25
+ const projectDirAnswer = await inquirer.prompt([
26
+ {
27
+ type: 'input',
28
+ name: 'projectDirectory',
29
+ message: 'Please provide the directory where you want to create the project?',
30
+ default: 'my-app',
31
+ },
32
+ ]);
33
+ projectDirectory = projectDirAnswer.projectDirectory;
34
+ }
35
+ // If template name is not provided, show available templates and let user select
36
+ if (!templateName) {
37
+ console.log('\n📋 Available templates:\n');
38
+ templatesToUse.forEach(t => {
39
+ console.log(` ${t.name.padEnd(12)} - ${t.description}`);
40
+ });
41
+ console.log('');
42
+ const templateQuestion = [
43
+ {
44
+ type: 'list',
45
+ name: 'templateName',
46
+ message: 'Select a template:',
47
+ choices: templatesToUse.map(t => ({
48
+ name: `${t.name} - ${t.description}`,
49
+ value: t.name
50
+ }))
51
+ }
52
+ ];
53
+ const templateAnswer = await inquirer.prompt(templateQuestion);
54
+ templateName = templateAnswer.templateName;
55
+ }
56
+ // Look up the template by name
57
+ const template = templatesToUse.find(t => t.name === templateName);
58
+ if (!template) {
59
+ console.error(`❌ Template "${templateName}" not found.\n`);
60
+ console.log('📋 Available templates:\n');
61
+ templatesToUse.forEach(t => {
62
+ console.log(` ${t.name.padEnd(12)} - ${t.description}`);
63
+ });
64
+ console.log('');
65
+ process.exit(1);
66
+ }
67
+ // If --ssh was not passed, prompt whether to use SSH
68
+ let useSSH = options?.ssh;
69
+ if (useSSH === undefined && template.repoSSH) {
70
+ const sshAnswer = await inquirer.prompt([
71
+ {
72
+ type: 'confirm',
73
+ name: 'useSSH',
74
+ message: 'Use SSH URL for cloning?',
75
+ default: false,
76
+ },
77
+ ]);
78
+ useSSH = sshAnswer.useSSH;
79
+ }
80
+ const templateRepoUrl = useSSH && template.repoSSH ? template.repoSSH : template.repo;
81
+ // Define the full path for the new project
82
+ const projectPath = path.resolve(projectDirectory);
83
+ console.log(`Cloning template "${templateName}" from ${templateRepoUrl} into ${projectPath}...`);
84
+ try {
85
+ // Clone the repository
86
+ const cloneArgs = ['clone'];
87
+ if (template.options && Array.isArray(template.options)) {
88
+ cloneArgs.push(...template.options);
89
+ }
90
+ cloneArgs.push(templateRepoUrl, projectPath);
91
+ await execa('git', cloneArgs, { stdio: 'inherit' });
92
+ console.log('✅ Template cloned successfully.');
93
+ // Remove the .git folder from the *new* project
94
+ await fs.remove(path.join(projectPath, '.git'));
95
+ console.log('🧹 Cleaned up template .git directory.');
96
+ // Ask user for customization details
97
+ const questions = [
98
+ {
99
+ type: 'input',
100
+ name: 'name',
101
+ message: 'What is the project name?',
102
+ default: path.basename(projectPath),
103
+ },
104
+ {
105
+ type: 'input',
106
+ name: 'version',
107
+ message: 'What version number would you like to use?',
108
+ default: '1.0.0',
109
+ },
110
+ {
111
+ type: 'input',
112
+ name: 'description',
113
+ message: 'What is the project description?',
114
+ default: '',
115
+ },
116
+ {
117
+ type: 'input',
118
+ name: 'author',
119
+ message: 'Who is the author of the project?',
120
+ default: '',
121
+ },
122
+ ];
123
+ const answers = await inquirer.prompt(questions);
124
+ // Update the package.json in the new project
125
+ const pkgJsonPath = path.join(projectPath, 'package.json');
126
+ if (await fs.pathExists(pkgJsonPath)) {
127
+ const pkgJson = await fs.readJson(pkgJsonPath);
128
+ // Overwrite fields with user's answers
129
+ pkgJson.name = answers.name;
130
+ pkgJson.version = answers.version;
131
+ pkgJson.description = answers.description;
132
+ pkgJson.author = answers.author;
133
+ // Write the updated package.json back
134
+ await fs.writeJson(pkgJsonPath, pkgJson, { spaces: 2 });
135
+ console.log('📝 Customized package.json.');
136
+ }
137
+ else {
138
+ console.log('ℹ️ No package.json found in template, skipping customization.');
139
+ }
140
+ const packageManager = template.packageManager || "npm";
141
+ // Install dependencies
142
+ console.log('📦 Installing dependencies... (This may take a moment)');
143
+ await execa(packageManager, ['install'], { cwd: projectPath, stdio: 'inherit' });
144
+ console.log('✅ Dependencies installed.');
145
+ // Optional: Create GitHub repository
146
+ await offerAndCreateGitHubRepo(projectPath);
147
+ // Let the user know the project was created successfully
148
+ console.log('\n✨ Project created successfully! ✨\n');
149
+ console.log(`To get started:`);
150
+ console.log(` cd ${projectDirectory}`);
151
+ console.log(' Happy coding! 🚀');
152
+ }
153
+ catch (error) {
154
+ console.error('❌ An error occurred:');
155
+ if (error instanceof Error) {
156
+ console.error(error.message);
157
+ }
158
+ else if (error && typeof error === 'object' && 'stderr' in error) {
159
+ console.error(error.stderr || String(error));
160
+ }
161
+ else {
162
+ console.error(String(error));
163
+ }
164
+ // Clean up the created directory if an error occurred
165
+ if (await fs.pathExists(projectPath)) {
166
+ await fs.remove(projectPath);
167
+ console.log('🧹 Cleaned up failed project directory.');
168
+ }
169
+ }
170
+ });
171
+ /** Command to initialize a project and optionally create a GitHub repository */
172
+ program
173
+ .command('init')
174
+ .description('Initialize the current directory (or path) as a git repo and optionally create a GitHub repository')
175
+ .argument('[path]', 'Path to the project directory (defaults to current directory)')
176
+ .action(async (dirPath) => {
177
+ const cwd = dirPath ? path.resolve(dirPath) : process.cwd();
178
+ const gitDir = path.join(cwd, '.git');
179
+ if (!(await fs.pathExists(gitDir))) {
180
+ await execa('git', ['init'], { stdio: 'inherit', cwd });
181
+ console.log('✅ Git repository initialized.\n');
182
+ }
183
+ await offerAndCreateGitHubRepo(cwd);
184
+ });
185
+ /** Command to list all available templates */
186
+ program
187
+ .command('list')
188
+ .description('List all available templates')
189
+ .option('--verbose', 'List all available templates with verbose information')
190
+ .option('-t, --template-file <path>', 'Include templates from a JSON file (same format as built-in)')
191
+ .action((options) => {
192
+ const templatesToUse = mergeTemplates(defaultTemplates, options?.templateFile);
193
+ console.log('\n📋 Available templates:\n');
194
+ templatesToUse.forEach(template => {
195
+ console.log(` ${template.name.padEnd(20)} - ${template.description}`);
196
+ if (options.verbose) {
197
+ console.log(` Repo URL: ${template.repo}`);
198
+ if (template.options && Array.isArray(template.options)) {
199
+ console.log(` Checkout Options: ${template.options.join(', ')}`);
200
+ }
201
+ }
202
+ });
203
+ console.log('');
204
+ });
205
+ /** Command to run PatternFly codemods on a directory */
206
+ program
207
+ .command('update')
208
+ .description('Run PatternFly codemods on a directory to transform code to the latest PatternFly patterns')
209
+ .argument('[path]', 'The path to the source directory to run codemods on (defaults to "src")')
210
+ .option('--fix', 'Automatically apply fixes to files instead of just showing what would be changed')
211
+ .action(async (srcPath, options) => {
212
+ const targetPath = srcPath || 'src';
213
+ const resolvedPath = path.resolve(targetPath);
214
+ const commands = ['@patternfly/pf-codemods', '@patternfly/class-name-updater'];
215
+ console.log(`Running PatternFly updates on ${resolvedPath}...`);
216
+ for (const command of commands) {
217
+ try {
218
+ console.log(`\n📦 Running ${command}...`);
219
+ const args = [command];
220
+ if (options.fix) {
221
+ args.push('--fix');
222
+ }
223
+ args.push(resolvedPath);
224
+ await execa('npx', args, { stdio: 'inherit' });
225
+ console.log(`✅ ${command} completed successfully.`);
226
+ }
227
+ catch (error) {
228
+ console.error(`❌ An error occurred while running ${command}:`);
229
+ if (error instanceof Error) {
230
+ console.error(error.message);
231
+ }
232
+ else if (error && typeof error === 'object' && 'stderr' in error) {
233
+ console.error(error.stderr || String(error));
234
+ }
235
+ else {
236
+ console.error(String(error));
237
+ }
238
+ process.exit(1);
239
+ }
240
+ }
241
+ console.log('\n✨ All updates completed successfully! ✨');
242
+ });
243
+ /** Command to save changes: check for changes, prompt to commit, and push */
244
+ program
245
+ .command('save')
246
+ .description('Check for changes, optionally commit them with a message, and push to the current branch')
247
+ .argument('[path]', 'Path to the repository (defaults to current directory)')
248
+ .action(async (repoPath) => {
249
+ const cwd = repoPath ? path.resolve(repoPath) : process.cwd();
250
+ try {
251
+ await runSave(cwd);
252
+ }
253
+ catch {
254
+ process.exit(1);
255
+ }
256
+ });
257
+ /** Command to load latest updates from the remote */
258
+ program
259
+ .command('load')
260
+ .description('Pull the latest updates from GitHub')
261
+ .argument('[path]', 'Path to the repository (defaults to current directory)')
262
+ .action(async (repoPath) => {
263
+ const cwd = repoPath ? path.resolve(repoPath) : process.cwd();
264
+ try {
265
+ await runLoad(cwd);
266
+ }
267
+ catch {
268
+ process.exit(1);
269
+ }
270
+ });
271
+ program.parse(process.argv);
272
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa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AAG,EAAE,CAAC;IAC9D,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,qDAAqD;AACrD,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,QAAQ,CAAC,QAAQ,EAAE,wDAAwD,CAAC;KAC5E,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;IACzB,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9D,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sanitize a package name for use as a GitHub repository name (alphanumeric, hyphens, underscores)
3
+ */
4
+ export declare function sanitizeRepoName(name: string): string;
5
+ /**
6
+ * Check if GitHub CLI is installed and the user is authenticated
7
+ */
8
+ export declare function checkGhAuth(): Promise<{
9
+ ok: true;
10
+ username: string;
11
+ } | {
12
+ ok: false;
13
+ message: string;
14
+ }>;
15
+ /**
16
+ * Check if a repository already exists for the given owner and repo name
17
+ */
18
+ export declare function repoExists(owner: string, repoName: string): Promise<boolean>;
19
+ /**
20
+ * Create a new GitHub repository and return its URL. Does not push.
21
+ */
22
+ export declare function createRepo(options: {
23
+ repoName: string;
24
+ projectPath: string;
25
+ username: string;
26
+ description?: string;
27
+ }): Promise<string>;
28
+ /**
29
+ * Interactive flow: prompt to create a GitHub repo under the current user, then create it and set origin.
30
+ * Returns true if a repo was created (or already had origin), false if skipped or failed.
31
+ */
32
+ export declare function offerAndCreateGitHubRepo(projectPath: string): Promise<boolean>;
33
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASrD;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB5G;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlF;AAoBD;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAuFpF"}