Skip to content

Commit 5feaf4d

Browse files
Merge pull request #19 from alexraputa/prettier
Add Prettier setup and format repository sources
2 parents a990401 + 8757db0 commit 5feaf4d

File tree

60 files changed

+1623
-1492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1623
-1492
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.{diff,md}]
16+
trim_trailing_whitespace = false

.github/workflows/ember-best-practices-ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: pnpm/action-setup@v2
17-
with:
18-
version: 10.24.0
1917
- uses: actions/setup-node@v4
2018
with:
21-
node-version: '20'
22-
cache: 'pnpm'
19+
node-version-file: package.json
20+
cache: pnpm
2321
cache-dependency-path: pnpm-lock.yaml
2422
- run: pnpm install
2523
- run: pnpm --filter ember-best-practices-build validate

.github/workflows/skills-lint.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ on:
77
branches: [main]
88

99
jobs:
10+
format:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: pnpm/action-setup@v4
17+
- uses: actions/setup-node@v6
18+
with:
19+
node-version-file: package.json
20+
cache: pnpm
21+
cache-dependency-path: pnpm-lock.yaml
22+
- run: pnpm install
23+
- run: pnpm lint:format
24+
1025
lint:
1126
runs-on: ubuntu-latest
1227
permissions:
@@ -16,8 +31,8 @@ jobs:
1631
- uses: pnpm/action-setup@v4
1732
- uses: actions/setup-node@v6
1833
with:
19-
node-version: '24'
20-
cache: 'pnpm'
34+
node-version-file: package.json
35+
cache: pnpm
2136
cache-dependency-path: pnpm-lock.yaml
2237
- run: pnpm install
2338
- run: pnpm --filter skills-lint test

.prettierignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Generated skill artifacts
2+
skills/*/AGENTS.md
3+
skills/*.zip
4+
5+
# Generated package artifacts
6+
packages/ember-best-practices-build/test-cases.json
7+
packages/ember-best-practices-agents-md-codemod/best-practices/
8+
9+
# Temporary output
10+
**/tmp/
11+
12+
# Lockfiles
13+
pnpm-lock.yaml

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,13 @@
77
"disabled": false
88
}
99
}
10+
},
11+
// ============================================================================
12+
// Save and formatting behavior
13+
// ============================================================================
14+
"editor.formatOnSave": true,
15+
"editor.defaultFormatter": "esbenp.prettier-vscode",
16+
"[jsonc]": {
17+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1018
}
1119
}

AGENTS.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ skills/
3030

3131
````markdown
3232
---
33-
name: {skill-name}
34-
description: {One sentence describing when to use this skill. Include trigger phrases like "Deploy my app", "Check logs", etc.}
33+
name: { skill-name }
34+
description:
35+
{
36+
One sentence describing when to use this skill. Include trigger phrases like "Deploy my app",
37+
'Check logs',
38+
etc.,
39+
}
3540
---
3641

3742
# {Skill Title}

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
{
22
"name": "agent-skills",
33
"private": true,
4-
"packageManager": "pnpm@10.24.0",
4+
"type": "module",
5+
"packageManager": "pnpm@10.32.1",
56
"engines": {
67
"node": "24.x"
8+
},
9+
"scripts": {
10+
"format": "prettier --write .",
11+
"lint:format": "prettier --check ."
12+
},
13+
"devDependencies": {
14+
"prettier": "^3.8.1",
15+
"prettier-plugin-ember-template-tag": "^2.1.3"
716
}
817
}

packages/ember-best-practices-agents-md-codemod/bin/cli.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
* npx ember-best-practices-agents-md --output AGENTS.md
88
*/
99

10-
import fs from "fs";
11-
import path from "path";
10+
import fs from 'fs';
11+
import path from 'path';
1212
import {
1313
DOCS_DIR_NAME,
1414
collectDocFiles,
1515
copyBestPractices,
1616
ensureGitignoreEntry,
1717
generateIndex,
1818
injectIntoAgentsMd,
19-
} from "../lib/agents-md.js";
19+
} from '../lib/agents-md.js';
2020

2121
function formatSize(bytes) {
2222
if (bytes < 1024) return `${bytes} B`;
@@ -38,18 +38,18 @@ function bold(s) {
3838

3939
async function run(options = {}) {
4040
const cwd = process.cwd();
41-
const targetFile = options.output || "AGENTS.md";
41+
const targetFile = options.output || 'AGENTS.md';
4242
const claudeMdPath = path.join(cwd, targetFile);
4343
const docsPath = path.join(cwd, DOCS_DIR_NAME);
4444
const docsLinkPath = `./${DOCS_DIR_NAME}`;
4545

4646
let sizeBefore = 0;
4747
let isNewFile = true;
48-
let existingContent = "";
48+
let existingContent = '';
4949

5050
if (fs.existsSync(claudeMdPath)) {
51-
existingContent = fs.readFileSync(claudeMdPath, "utf-8");
52-
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
51+
existingContent = fs.readFileSync(claudeMdPath, 'utf-8');
52+
sizeBefore = Buffer.byteLength(existingContent, 'utf-8');
5353
isNewFile = false;
5454
}
5555

@@ -58,11 +58,11 @@ async function run(options = {}) {
5858
try {
5959
copyBestPractices(docsPath);
6060
} catch (err) {
61-
console.error("Error:", err.message);
61+
console.error('Error:', err.message);
6262
process.exit(1);
6363
}
6464

65-
const docFiles = collectDocFiles(path.join(docsPath, "rules"));
65+
const docFiles = collectDocFiles(path.join(docsPath, 'rules'));
6666
const filePaths = docFiles.map((f) => `rules/${f.relativePath}`);
6767

6868
const indexContent = generateIndex({
@@ -72,30 +72,29 @@ async function run(options = {}) {
7272
});
7373

7474
const newContent = injectIntoAgentsMd(existingContent, indexContent);
75-
fs.writeFileSync(claudeMdPath, newContent, "utf-8");
75+
fs.writeFileSync(claudeMdPath, newContent, 'utf-8');
7676

77-
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
77+
const sizeAfter = Buffer.byteLength(newContent, 'utf-8');
7878
const gitignoreResult = ensureGitignoreEntry(cwd);
7979

80-
const action = isNewFile ? "Created" : "Updated";
80+
const action = isNewFile ? 'Created' : 'Updated';
8181
const sizeInfo = isNewFile
8282
? formatSize(sizeAfter)
8383
: `${formatSize(sizeBefore)}${formatSize(sizeAfter)}`;
8484

85-
console.log(`${green("✓")} ${action} ${bold(targetFile)} (${sizeInfo})`);
85+
console.log(`${green('✓')} ${action} ${bold(targetFile)} (${sizeInfo})`);
8686
if (gitignoreResult.updated) {
87-
console.log(`${green("✓")} Added ${bold(DOCS_DIR_NAME)} to .gitignore`);
87+
console.log(`${green('✓')} Added ${bold(DOCS_DIR_NAME)} to .gitignore`);
8888
}
89-
console.log("");
89+
console.log('');
9090
}
9191

9292
// Parse args (minimal: --output)
9393
const args = process.argv.slice(2);
94-
const outputIdx = args.indexOf("--output");
95-
const output =
96-
outputIdx >= 0 && args[outputIdx + 1] ? args[outputIdx + 1] : null;
94+
const outputIdx = args.indexOf('--output');
95+
const output = outputIdx >= 0 && args[outputIdx + 1] ? args[outputIdx + 1] : null;
9796

98-
if (args.includes("--help") || args.includes("-h")) {
97+
if (args.includes('--help') || args.includes('-h')) {
9998
console.log(`
10099
ember-best-practices-agents-md - Ember.js best practices for AI coding agents
101100

0 commit comments

Comments
 (0)