Skip to content

fix: improve GitHub Actions workflows and add comprehensive AI development guidelines #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
- name: Run unit tests and generate report
run: npm run test:ci

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v4
- name: SonarQube Cloud Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: publish

# Run when a new Github publish is released
# Run when a new GitHub release is published
on:
release:
types: [released]
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
name: create a release

# TODO: remove trigger
on:
push:
branches:
- main
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Run the release script
env:
PAT_TOKEN: ${{ secrets.RELEASE_PAT_TOKEN }}
GIT_EMAIL: ${{ vars.RELEASE_GIT_EMAIL }}
run: ../scripts/release.sh
run: ./scripts/release.sh
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,20 @@
"search.exclude": {
"**/node_modules": true,
"**/lib": true
}
},
"github.copilot.chat.codeGeneration.instructions": [
{
"file": "./prettier.config.js",
"text": "This is a configuration file for Prettier, a code formatter. It specifies the formatting rules to be applied to the code."
},
{
"file": "./LLM_INSTRUCTIONS.md",
"text": "This file contains instructions that coding agents (e.g., Copilot) should follow when generating code."
}
],
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "start the commit message with a list of the file paths in the staged changes separated by commas and ending with a colon. each file in the list should include only the parent folder and not the full path to the file, the linux path separator, the file name and the file's extension."
}
]
}
37 changes: 37 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CLAUDE.md

@./LLM_INSTRUCTIONS.md

## Remote Repository Configuration

- Organization: https://github.com/MFB-Technologies-Inc
- Project: react-async-renderer
- Repository: react-async-renderer
- Default target branch for PRs: main

## Claude Commit Messages

- start the commit message with a list of the file paths in the staged changes separated by commas and ending with a colon
- each file in the list should include only the parent folder and not the full path to the file, the linux path separator, the file name and the file's extension.

## Pull Requests

- Use the Github CLI tool if you are asked to do tasks related to PRs
- When creating a PR:

1. **Title Format**: Use conventional commit format (e.g., `feat: add new feature`, `fix: resolve bug`)
2. **Reviewers**: Set to `MFB-Technologies-Inc/web-app-devs` team
3. **Assignment**: Assign to the PR creator
4. **Body Structure**: Include a "Summary" section with bullet points of changes
5. **GitHub CLI Command Example**:

```bash
gh pr create --title "fix: describe the change" --body "$(cat <<'EOF'
## Summary

- Change 1 description
- Change 2 description
- Change 3 description
EOF
)" --reviewer "MFB-Technologies-Inc/web-app-devs" --assignee "@me"
```
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
FROM debian:bookworm
ARG USERNAME=vscode
RUN apt-get update
RUN apt-get -y install git fzf ripgrep curl python3 ssh sudo locales gnupg lsb-release libnss3-tools gstreamer1.0-gl gstreamer1.0-plugins-ugly
# Add GitHub CLI repo and update, then install all packages in one RUN
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list \
&& apt-get update \
&& apt-get -y install git fzf ripgrep curl python3 ssh sudo locales gnupg lsb-release libnss3-tools gstreamer1.0-gl gstreamer1.0-plugins-ugly gh
# set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
Expand Down
99 changes: 99 additions & 0 deletions LLM_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Code Generation Instructions

## User Interactions

- If the user asks for a plan, proposal, explanation, or guidance, respond ONLY with a proposed plan; do NOT start implementing
- When answering questions, don't write code unless explicitly asked

## Remote Repository Configuration

- Organization: https://github.com/MFB-Technologies-Inc
- Project: react-async-renderer
- Repository: react-async-renderer
- Default target branch for PRs: main
- If the user is not logged in remind them to login using `gh auth login`

## Pull Requests

1. **Title Format**: Use conventional commit format (e.g., `feat: add new feature`, `fix: resolve bug`)
2. **Reviewers**: Set to `MFB-Technologies-Inc/web-app-devs` team
3. **Assignment**: Assign to the PR creator
4. **Body Structure**: Include a "Summary" section with bullet points of changes
5. **GitHub CLI Command Example**:

```bash
gh pr create --title "fix: describe the change" --body "$(cat <<'EOF'
## Summary

- Change 1 description
- Change 2 description
- Change 3 description
EOF
)" --reviewer "MFB-Technologies-Inc/web-app-devs" --assignee "@me"
```

## Repository Overview

### Project Structure

- `src/` - Main library source code
- `example-app/` - Demo application showing library usage
- `scripts/` - Build and release automation scripts
- `.github/workflows/` - CI/CD pipelines
- Test files are in `__tests__/` directories

### Coding Standards

- Define constants/variables; no "magic" string or numbers
- Avoid excessive nesting
- Be declarative
- Prefer array methods over imperative loops
- Run `npm run lint` regularly to check for lint errors

### Typescript

- Use strict, strong typing
- Explicitly type function returns unless unusually complex
- Do not use classes; use function builder patterns
- Use types, not interfaces
- Use explicit type imports
- Avoid enums, use constants and string literal types
- Run `npm run typecheck` to check typing whenever you finish editing a typescript file

### React

- When creating React components:
- Create them using the function keyword
- Type their props explicitly
- Type the return type explicitly using React.JSX.Element and, if appropriate, null
- Put display text in a `text: Record<string,string>` object outside of component scope
- Do not destructure props; this makes it clear when values come from props
- Do not use React.FC
- Do not use ReactNode
- Example:

```typescript
const text = {
enabled: "Enabled"
}

export function MyComponent(props:{ isEnabled: boolean }):React.JSX.Element {
return (
<div>
{props.isEnabled && <p>{text.enabled}</p>}
</div>
)
}
```

### CSS

- Use SASS (.scss)
- Use variables to define colors
- Use rgba() not hexcodes for colors

### Testing

- Use `npm run test:once` to run tests, if it exists.
- If it does not exist, suggest creating it to the developer.
- Do not run `npm run test`; it runs in watch mode and will block you.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ These other utility functions can be used to simplify the logic around `createAs
- `getCascadedAsyncState`: Reduces a chain of asynchronous request objects down one asynchronous request object.
- `getOptimisticAsyncLoadState`: Converts its arguments into an optimistic asynchronous request object such that if the arguments indicate a pending asynchronous request and a fulfilled asynchronous request, then the result is a fulfilled asynchronous request object.

Checkout the [example application](./example/README.md).
Checkout the [example application](./example-app/README.md).

## License

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"changes": [
{
"packageName": "@mfbtech/react-async-renderer",
"comment": "Fixed release script path in release action and updated action and package dependencies",
"type": "PATCH"
}
]
}
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
"lint": "eslint './src/**/*.{ts,tsx}'",
"test:ci": "jest --reporters=jest-standard-reporter --coverage",
"test": "jest --watch",
"test:once": "jest",
"fix-formatting": "prettier --write --config ./prettier.config.js ./src/",
"check-formatting": "prettier --check --config ./prettier.config.js ./src/",
"package": "node ./scripts/package.js"
"package": "node ./scripts/package.js",
"typecheck": "tsc --noEmit --project ./tsconfig.prod.json"
},
"devDependencies": {
"@testing-library/react": "12.1.5",
Expand Down