Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please note that this project is released with a [Code of Conduct](RULES_OF_COND

## How Can I Contribute?

### Reporting Bugs
### Reporting Bugs

If you find a bug, please open an issue on our [GitHub Issues page](https://github.com/IonGireada/repo-description/issues). When reporting a bug, please include:

Expand Down
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,43 +179,49 @@ Options:

<!-- doc-gen COMMANDS format=list -->

- `describe` — Generates AI-powered descriptions for repository files and outputs them in various formats. (line [85](./package.json#L85))
- `describe` — Update repository descriptions in md.config.js transformDefaults for fileTreeExtended. (line [92](./package.json#L92))

```bash
node src/cli.js . descriptions.json && node src/cli.js . descriptions.md --format markdown && node src/cli.js . descriptions-table.md --format markdown --table && node src/cli.js . descriptions-summary.md --format markdown --summary && node src/cli.js . descriptions-table-summary.md --format markdown --table --summary
node src/cli.js . --update-config md.config.js --transform-name fileTreeExtended
```
Comment on lines +182 to 186

Choose a reason for hiding this comment

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

high

The new describe command and its workflow could be improved for efficiency and clarity. As it stands, both npm run describe:file and npm run describe call the AI to generate descriptions, which is redundant if a user wants to both save descriptions to a file and update the md.config.js. This is inefficient as it results in extra API calls.

A more efficient workflow would be to separate generation from updating:

  1. describe:file generates descriptions from the AI and saves them to a file (e.g., descriptions.json).
  2. describe reads this generated file to update md.config.js, without making new AI calls.

This could be achieved by adding an option to the CLI (e.g., --input <file>) to allow the update command to read descriptions from a file instead of generating them on the fly.


- `docs` — Generates documentation by processing Markdown files with markdown-magic. (line [90](./package.json#L90))
- `describe:file` — Generates AI-powered descriptions for repository files and outputs them in various formats. (line [86](./package.json#L86))

```bash
node src/cli.js . --output descriptions.json
```

- `docs` — Generates documentation by processing Markdown files with markdown-magic. (line [91](./package.json#L91))

```bash
npx markdown-magic@3.7.0 **/*.md -c md.config.js
```

- `format` — Formats the codebase using Prettier. (line [88](./package.json#L88))
- `format` — Formats the codebase using Prettier. (line [89](./package.json#L89))

```bash
prettier --write .
```

- `lint` — Lints the codebase for potential errors and style violations. (line [86](./package.json#L86))
- `lint` — Lints the codebase for potential errors and style violations. (line [87](./package.json#L87))

```bash
eslint src/ **/*.js **/*.json
```

- `lint:fix` — Lints the codebase and automatically fixes fixable issues. (line [87](./package.json#L87))
- `lint:fix` — Lints the codebase and automatically fixes fixable issues. (line [88](./package.json#L88))

```bash
eslint --fix src/ **/*.js **/*.json
```

- `prep` — Prepares the codebase by generating documentation, linting, and formatting. (line [89](./package.json#L89))
- `prep` — Prepares the codebase by generating documentation, linting, and formatting. (line [90](./package.json#L90))

```bash
npm run docs && npm run lint:fix && npm run format
```

- `test` — Runs the test suite using Jest. (line [84](./package.json#L84))
- `test` — Runs the test suite using Jest. (line [85](./package.json#L85))

```bash
jest --passWithNoTests
Expand Down Expand Up @@ -276,18 +282,18 @@ repo-description/
│ ├── index.js
│ ├── refactor-package.js
│ └── utils.js
├── .env
├── .env # Description unavailable.
├── .gitignore
├── .prettierrc.json
├── babel.config.js
├── CONTRIBUTING.md
├── eslint.config.js
├── LICENSE
├── md.config.js
├── package-lock.json
├── package.json
├── README.md
└── RULES_OF_CONDUCT.md
├── .prettierrc.json # Description unavailable.
├── babel.config.js # Description unavailable.
├── CONTRIBUTING.md # Description unavailable.
├── eslint.config.js # Description unavailable.
├── LICENSE # Description unavailable.
├── md.config.js # Description unavailable.
├── package-lock.json # Description unavailable.
├── package.json # Description unavailable.
├── README.md # Description unavailable.
└── RULES_OF_CONDUCT.md # Description unavailable.
Comment on lines +285 to +296

Choose a reason for hiding this comment

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

medium

There's an inconsistency in the generated file tree under "Project Structure". The .gitignore file is listed without a description, while other root-level files have "# Description unavailable." This suggests a potential bug in the file discovery or description generation logic. All files included in the tree should be handled consistently.

```

<!-- end-doc-gen -->
29 changes: 25 additions & 4 deletions md.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
module.exports = {
transformDefaults: {
fileTreeExtended: {},
fileTreeExtended: {
descriptions: {
'.env': 'Description unavailable.',
'.prettierrc.json': 'Description unavailable.',
'.vscode\\launch.json': 'Description unavailable.',
'babel.config.js': 'Description unavailable.',
'CONTRIBUTING.md': 'Description unavailable.',
'eslint.config.js': 'Description unavailable.',
LICENSE: 'Description unavailable.',
'md.config.js': 'Description unavailable.',
'package-lock.json': 'Description unavailable.',
'package.json': 'Description unavailable.',
'README.md': 'Description unavailable.',
'RULES_OF_CONDUCT.md': 'Description unavailable.',
'src\\cli.js': 'Description unavailable.',
'src\\describe.js': 'Description unavailable.',
'src\\index.js': 'Description unavailable.',
'src\\refactor-package.js': 'Description unavailable.',
'src\\utils.js': 'Description unavailable.',
'__tests__\\cli.test.js': 'Description unavailable.',
Comment on lines +7 to +22

Choose a reason for hiding this comment

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

high

The file paths in the descriptions object use backslashes (\) as separators (e.g., '.vscode\\launch.json', 'src\\cli.js'). This is not cross-platform compatible and will cause issues for users on non-Windows systems. Path separators in configuration files should always be forward slashes (/). This should be fixed in the script that generates this configuration to normalize path separators before writing to the file.

},
},
BADGES: {
style: 'for-the-badge',
},
},
transforms: {
INSTALL: require('markdown-magic-install-extended'),
COMMANDS: require('markdown-magic-scripts'),
BADGES: require('markdown-magic-transform-badges'),
fileTreeExtended: require('markdown-magic-transform-treefile-extended'),
BADGES: require('markdown-magic-transform-badges'),
INSTALL: require('markdown-magic-install-extended'),
ACKNOWLEDGEMENTS: require('markdown-magic-transform-acknowledgements'),
COMMANDS: require('markdown-magic-scripts'),
},
};
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"README.md"
],
"scripts": {
"describe": "node src/cli.js . descriptions.json && node src/cli.js . descriptions.md --format markdown && node src/cli.js . descriptions-table.md --format markdown --table && node src/cli.js . descriptions-summary.md --format markdown --summary && node src/cli.js . descriptions-table-summary.md --format markdown --table --summary",
"describe": "node src/cli.js . --update-config md.config.js --transform-name fileTreeExtended",
"describe:file": "node src/cli.js . --output descriptions.json",
"docs": "npx markdown-magic@3.7.0 **/*.md -c md.config.js",
"format": "prettier --write .",
"lint": "eslint src/ **/*.js **/*.json",
Expand Down Expand Up @@ -82,11 +83,12 @@
},
"scriptsMeta": {
"test": "Runs the test suite using Jest.",
"describe": "Generates AI-powered descriptions for repository files and outputs them in various formats.",
"describe:file": "Generates AI-powered descriptions for repository files and outputs them in various formats.",
"lint": "Lints the codebase for potential errors and style violations.",
"lint:fix": "Lints the codebase and automatically fixes fixable issues.",
"format": "Formats the codebase using Prettier.",
"prep": "Prepares the codebase by generating documentation, linting, and formatting.",
"docs": "Generates documentation by processing Markdown files with markdown-magic."
"docs": "Generates documentation by processing Markdown files with markdown-magic.",
"describe": "Update repository descriptions in md.config.js transformDefaults for fileTreeExtended."
}
Comment on lines 85 to 93

Choose a reason for hiding this comment

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

medium

For better readability and easier maintenance of the scripts section, it's good practice to group related script metadata together. The new describe metadata has been added at the end, while describe:file (which was renamed from describe) is at the beginning. Consider reordering these to be adjacent.

Suggested change
"test": "Runs the test suite using Jest.",
"describe": "Generates AI-powered descriptions for repository files and outputs them in various formats.",
"describe:file": "Generates AI-powered descriptions for repository files and outputs them in various formats.",
"lint": "Lints the codebase for potential errors and style violations.",
"lint:fix": "Lints the codebase and automatically fixes fixable issues.",
"format": "Formats the codebase using Prettier.",
"prep": "Prepares the codebase by generating documentation, linting, and formatting.",
"docs": "Generates documentation by processing Markdown files with markdown-magic."
"docs": "Generates documentation by processing Markdown files with markdown-magic.",
"describe": "Update repository descriptions in md.config.js transformDefaults for fileTreeExtended."
}
"test": "Runs the test suite using Jest.",
"describe": "Update repository descriptions in md.config.js transformDefaults for fileTreeExtended.",
"describe:file": "Generates AI-powered descriptions for repository files and outputs them in various formats.",
"lint": "Lints the codebase for potential errors and style violations.",
"lint:fix": "Lints the codebase and automatically fixes fixable issues.",
"format": "Formats the codebase using Prettier.",
"prep": "Prepares the codebase by generating documentation, linting, and formatting.",
"docs": "Generates documentation by processing Markdown files with markdown-magic."

}