Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d30acd8
feat: build example page
digoarthur Oct 25, 2025
ddfc3ae
feat (page): build example page ( WIP)
digoarthur Oct 26, 2025
0e934f9
feat(page): add structions cards: icons, topics, explain (WIP)
digoarthur Oct 27, 2025
cf0f438
chore: add chalk for colored output and commander for command handlin…
digoarthur Nov 10, 2025
f98370a
refactor: change name example file page
digoarthur Nov 12, 2025
104b7fd
feat(page): implement page vitejs example
digoarthur Nov 15, 2025
58505ef
chore(script): add shortcut localTest script
digoarthur Nov 15, 2025
66d498f
refactor(files): clean CLI structure and isolate responsibilities
digoarthur Nov 18, 2025
2234519
feat: implement an interactive command to enter GitHub Username and K…
digoarthur Nov 22, 2025
0a63dc0
refactor(files): clean CLI structure and isolate responsibilities
digoarthur Nov 22, 2025
a755a4e
refactor(interactive): use inquirer instead of readline for init ques…
digoarthur Nov 22, 2025
8d04b83
refactor(files): clean CLI structure and isolate responsibilities
digoarthur Nov 23, 2025
0beafbe
docs: add JSDoc comments to functions files: utils, interactive...
digoarthur Nov 23, 2025
52780d8
feat(cli): integrate ora loading spinner for setup steps
digoarthur Nov 24, 2025
b4870e1
fix(vite-template): replace static username and keyword with dynamic …
digoarthur Nov 25, 2025
c6e6047
feat(cli): add prompts-based overwrite options and support for creati…
digoarthur Nov 28, 2025
79037e3
refactor(files): clean CLI structure and isolate responsibilities, fo…
digoarthur Dec 15, 2025
ed9f164
refactor(init): adopt function-call → variable → decision pattern
digoarthur Dec 22, 2025
94c04fb
chore(changelog): setup changelog generation
digoarthur Dec 22, 2025
46a35bf
chore(github-actions): add automatic changelog generation on push
digoarthur Dec 22, 2025
4ad5ba3
chore(changelog): add more scopes names and show only feat and fix
digoarthur Dec 22, 2025
f6bcf76
chore(github-actions): adjustment run Install dependencies
digoarthur Dec 22, 2025
5915642
chore(github-actions): fix changelog workflow permissions
digoarthur Dec 22, 2025
97f6ca2
chore(changelog): update changelog
invalid-email-address Dec 22, 2025
6bf840b
chore(changelog): limit changelog to user-facing features and fixes
digoarthur Dec 22, 2025
17f807b
chore(package): add local dev setup script to ignore changelog changes
digoarthur Dec 22, 2025
7b06291
chore(changelog): update changelog
invalid-email-address Dec 22, 2025
8d627d3
chore(github-actions): add automated release workflow
digoarthur Dec 22, 2025
af4dbe3
chore(github-actions): add automated release workflow
digoarthur Dec 22, 2025
58f56f3
chore(test): trigger release workflow
digoarthur Dec 22, 2025
7561dd7
chore(test): trigger release workflow
digoarthur Dec 22, 2025
830edab
chore(test): trigger release workflow
digoarthur Dec 22, 2025
ecf862d
chore(test): trigger release workflow
digoarthur Dec 22, 2025
725cfd6
chore(github-actions): improve release workflow stability
digoarthur Dec 22, 2025
f726ad4
chore(github-actions): add version validation on pull requests
digoarthur Dec 22, 2025
5c810b8
chore(package): test release and version validation
digoarthur Dec 22, 2025
c7f7553
chore(changelog): update changelog
invalid-email-address Dec 22, 2025
ad91d24
chore(github-actions): add version validation for pull requests
digoarthur Dec 23, 2025
f141b34
chore(github-actions): add version validation for pull requests
digoarthur Dec 23, 2025
6b9f0c7
chore(changelog): update changelog
invalid-email-address Dec 23, 2025
c194b54
chore(github-actions): improviment version validation for pull requests
digoarthur Dec 23, 2025
00c615c
chore(github-actions): add version validation for pull requests
digoarthur Dec 23, 2025
0f3d39c
chore(dev): add setup script to skip changelog tracking
digoarthur Dec 23, 2025
626a7f1
chore(pageExample): add just comments
digoarthur Dec 23, 2025
e156815
chore(package): change to correct version 1.0.0
digoarthur Dec 23, 2025
6aab09c
chore(changelog): update changelog
invalid-email-address Dec 23, 2025
7733c9a
chore(github-actions): validate versions on PRs for all .x branches
digoarthur Dec 23, 2025
a9bd1c6
docs(changelog): pull refresh changelog
digoarthur Dec 23, 2025
ff220ea
chore(npm): restrict npm publish to main branch only
digoarthur Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Generate Changelog

permissions:
contents: write

on:
push:
branches-ignore:
- main

jobs:
changelog:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Generate CHANGELOG.md
run: npm run changelog

- name: Commit CHANGELOG.md
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"

git add CHANGELOG.md
git diff --cached --quiet || git commit -m "chore(changelog): update changelog"

git push
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Read version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Check if tag already exists
id: tag
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi

- name: Stop if release already exists
if: steps.tag.outputs.exists == 'true'
run: |
echo "Release v${{ steps.version.outputs.version }} already exists. Skipping."
exit 0

- name: Generate CHANGELOG
run: npm run changelog

- name: Commit CHANGELOG
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add CHANGELOG.md
git commit -m "chore(changelog): release v${{ steps.version.outputs.version }}" || echo "No changes"

- name: Push changelog commit
run: git push

- name: Create tag
run: |
git tag v${{ steps.version.outputs.version }}
git push origin v${{ steps.version.outputs.version }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
generate_release_notes: true
54 changes: 54 additions & 0 deletions .github/workflows/validate-version-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Validate version

on:
pull_request:
branches:
- main
push:
branches:
- '**.x'
jobs:
validate-version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Validate package.json version against branch
run: |
SOURCE_BRANCH="${{ github.head_ref }}"
PACKAGE_VERSION=$(node -p "require('./package.json').version")

echo ""
echo "🔍 Version validation"
echo "----------------------"
echo "Source branch: $SOURCE_BRANCH"
echo "package.json version: $PACKAGE_VERSION"
echo ""

# Extract expected major.minor from branch (e.g. 1.2.x -> 1.2)
EXPECTED_PREFIX=$(echo "$SOURCE_BRANCH" | sed 's/\.x//')

if [[ "$PACKAGE_VERSION" != "$EXPECTED_PREFIX"* ]]; then
echo "❌ Version validation failed"
echo ""
echo "Expected package.json version to start with:"
echo " - $EXPECTED_PREFIX."
echo ""
echo "Found:"
echo " - version: $PACKAGE_VERSION"
echo ""
echo "🛠️ Please fix the following:"
echo " - Update the version in package.json to match the current branch version you are working on"
echo ""
echo "💡 As well as the package and branch version, be sure to check the code version published in NPM to follow a correct sequence."
exit 1
fi

echo "✅ Version validation passed"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
package-lock.json
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<a name="1.0.0"></a>
# 1.0.0 (2025-12-22)

### cli
| Commit | Type | Description |
|--------|------|-------------|
| [c6e6047](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/c6e60477c5eca20e009e4c052afa6b90bbf08e21) | feat | add prompts-based overwrite options and support for creating alternative project files |
| [52780d8](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/52780d83456d14506e87d6517203c085afa68a52) | feat | integrate ora loading spinner for setup steps |


### page
| Commit | Type | Description |
|--------|------|-------------|
| [0e934f9](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/0e934f945abafc55d5c2fd97996dd8a6e26cbeba) | feat | add structions cards: icons, topics, explain (WIP) |
| [104b7fd](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/104b7fd867a1590d6e1a49dfa3a5542c7012e4a6) | feat | implement page vitejs example |


### vite-template
| Commit | Type | Description |
|--------|------|-------------|
| [b4870e1](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/b4870e1cddadc9fbc23edd14bf848fb42f6454dc) | fix | replace static username and keyword with dynamic placeholders |


### general
| Commit | Type | Description |
|--------|------|-------------|
| [d30acd8](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/d30acd832144816168a914a5c36d61e11bb101c6) | feat | build example page |
| [2234519](https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/223451939421eb7185d48f99fe5890e817697221) | feat | implement an interactive command to enter GitHub Username and Keyword |


68 changes: 28 additions & 40 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
#!/usr/bin/env node
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const args = process.argv.slice(2);
const framework = args[0] || "next";

if (!["next", "react", "vite"].includes(framework)) {
console.log("Uso: npx github-automated-repos-example [next|react|vite]");
process.exit(1);
}

console.log(`🚀 Gerando exemplo para ${framework}...`);

let sourceDir;
let targetDir;

switch (framework) {
case "next":
sourceDir = path.join(__dirname, "../examples/nextjs/page.tsx");
targetDir = path.join(process.cwd(), "src/app/projects/page.tsx");
break;
case "react":
sourceDir = path.join(__dirname, "../examples/react/Project.jsx");
targetDir = path.join(process.cwd(), "src/components/Project.jsx");
break;
case "vite":
sourceDir = path.join(__dirname, "../examples/vite/Project.tsx");
targetDir = path.join(process.cwd(), "src/components/Project.tsx");
break;
}

fs.mkdirSync(path.dirname(targetDir), { recursive: true });

fs.copyFileSync(sourceDir, targetDir);
console.log(`✅ Exemplo criado em: ${targetDir}`);
console.log("💡 Agora você pode acessar a página no seu projeto Next.js em /projects");
import { Command } from "commander";
import chalk from "chalk";
import initCommand from "../commands/init.js";

const program = new Command();

program
.name("github-automated-repos-cli")
.description("CLI oficial do github-automated-repos (only init)")
.version("1.0.0");

program
.command("init")
.description("Initialize the project: ensure dependency, install if needed and add example page/component")
.option("-y, --yes", "auto-confirm prompts (non-interactive)")
.action((opts) => {
initCommand
.run(opts)
.then(() => {
console.log(chalk.green("Init finished successfully."));
})
.catch((err) => {
console.error(chalk.red("Init failed:"), err.message || err);
process.exit(1);
});
});

program.parse(process.argv);
107 changes: 107 additions & 0 deletions changelog-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module.exports = {
preset: "angular",
writerOpts: {
transform: (commit) => {
if (!commit.hash) return null;

// 🔑 Only user-relevant changes
const allowedTypes = ["feat", "fix"];

const knownScopes = [
"cli",
"init",
"commands",
"interactive",
"utils",
"projectFile",
"pkgManager",
"framework",
"bin",
"pageExample",
"page",
"vite-template",
"next-template",
"github-actions",
"general",
];


if (!allowedTypes.includes(commit.type)) {
return null;
}

const shortHash = commit.hash.substring(0, 7);
const hashLink =
`https://github.com/DIGOARTHUR/github-automated-repos-cli/commit/${commit.hash}`;

let normalizedScope = commit.scope;

if (normalizedScope) {
normalizedScope = normalizedScope
.replace(/files?/i, "projectFile")
.replace(/project[-_]?file/i, "projectFile")
.replace(/pkg[-_]?manager/i, "pkgManager")
.replace(/framework/i, "framework")
.replace(/interactive/i, "interactive")
.replace(/commands?/i, "commands")
.replace(/utils?/i, "utils")
.replace(/bin/i, "bin")
.replace(/init/i, "init")
.replace(/cli/i, "cli")
.replace(/page[-_]?example/i, "pageExample")
.replace(/vite[-_]?template/i, "vite-template")
.replace(/next[-_]?template/i, "next-template")
.replace(/github[-_]?actions?/i, "github-actions");
}

if (!normalizedScope || !knownScopes.includes(normalizedScope)) {
normalizedScope = "general";
}

return {
...commit,
scope: normalizedScope,
shortHash,
hashLink,
};
},

groupBy: "scope",

commitGroupsSort: (a, b) => {
const order = [
"cli",
"init",
"commands",
"interactive",
"projectFile",
"utils",
"pkgManager",
"framework",
"pageExample",
"page",
"vite-template",
"next-template",
"general",
];
return order.indexOf(a.title) - order.indexOf(b.title);
},

commitsSort: ["type", "subject"],

headerPartial:
'<a name="{{version}}"></a>\n# {{version}} ({{date}})\n\n',

commitPartial:
"| [{{shortHash}}]({{hashLink}}) | {{type}} | {{subject}} |\n",

mainTemplate: `{{> header}}
{{#each commitGroups}}
### {{title}}
| Commit | Type | Description |
|--------|------|-------------|
{{#each commits}}{{> commit}}{{/each}}

{{/each}}`,
},
};
Loading