fix: resolve arrow function boundary detection in React components

- Fix tree-sitter parser to correctly identify nested arrow functions
- Modified collectNodesByTypes to recursively traverse function nodes
- Arrow functions inside React components now correctly identified with accurate line counts and nesting depths
- Update version to 2.2.1
- Add auto-release workflow for GitHub Release automation (with overwrite support)
- Remove old manual release workflow
- Add value-realization project to README (all language versions)
This commit is contained in:
Done-0
2026-02-27 11:28:31 +08:00
parent cd55ca0935
commit acff024c68
9 changed files with 104 additions and 64 deletions

92
.github/workflows/auto-release.yml vendored Normal file
View File

@@ -0,0 +1,92 @@
name: Auto Release
on:
push:
branches:
- main
paths:
- 'package.json'
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version-changed: ${{ steps.check.outputs.changed }}
new-version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check if version changed
id: check
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
git checkout HEAD~1 -- package.json 2>/dev/null || echo "First commit"
PREVIOUS_VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "0.0.0")
git checkout HEAD -- package.json
echo "Current version: $CURRENT_VERSION"
echo "Previous version: $PREVIOUS_VERSION"
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
ci:
needs: check-version
if: needs.check-version.outputs.version-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Lint
run: npm run lint
- name: Format check
run: npm run format:check
- name: Build
run: npm run build
- name: Test
run: npx vitest --run
create-release:
needs: [check-version, ci]
if: needs.check-version.outputs.version-changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version.outputs.new-version }}
name: Release v${{ needs.check-version.outputs.new-version }}
body: |
## Changes in v${{ needs.check-version.outputs.new-version }}
See [commits](https://github.com/${{ github.repository }}/commits/v${{ needs.check-version.outputs.new-version }}) for details.
## Installation
```bash
npm install -g eff-u-code@${{ needs.check-version.outputs.new-version }}
```
draft: false
prerelease: false
generate_release_notes: true
make_latest: true

View File

@@ -1,58 +0,0 @@
name: Release
on:
release:
types: [published]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Lint
run: npm run lint
- name: Format check
run: npm run format:check
- name: Build
run: npm run build
- name: Test
run: npx vitest --run
publish:
needs: ci
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: npm
- name: Sync version from release tag
run: npm pkg set version="${GITHUB_REF_NAME#v}"
- run: npm ci
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -277,6 +277,7 @@ MIT
## More Projects
- [Value Realization](https://github.com/Done-0/value-realization) — AI skill for analyzing product value discovery (100K+ views in 24h, 100+ stars on day 1)
- [FateSpiral](https://fatespiral.com/) — AI-driven multiplayer RPG, infinite worlds, evolving stories
- [DestinyTeller](https://destinyteller.com/) — AI-powered destiny reading website
- [Jank](https://github.com/Done-0/Jank) — Open-source blog system in Go

View File

@@ -280,6 +280,7 @@ MIT
## Другие проекты
- [Value Realization](https://github.com/Done-0/value-realization) — AI-навык для анализа ценности продукта (100K+ просмотров за 24ч, 100+ звезд в первый день)
- [FateSpiral](https://fatespiral.com/) — AI-мультиплеерная RPG, бесконечные миры, развивающиеся истории
- [DestinyTeller](https://destinyteller.com/) — AI-сайт предсказаний судьбы
- [Jank](https://github.com/Done-0/Jank) — Блог-система с открытым исходным кодом на Go

View File

@@ -277,6 +277,7 @@ MIT
## 安利一下
- [Value Realization](https://github.com/Done-0/value-realization) — 产品价值发现分析 AI 技能24小时内10万+浏览首日100+星)
- [FateSpiral](https://fatespiral.com/) — AI 驱动的多人 RPG无限世界无限剧情
- [玄学工坊](https://destinyteller.com/) — AI 赛博算命网站
- [Jank](https://github.com/Done-0/Jank) — Go 语言开源博客

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "eff-u-code",
"version": "2.2.0",
"version": "2.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "eff-u-code",
"version": "2.2.0",
"version": "2.2.1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "eff-u-code",
"version": "2.2.0",
"version": "2.2.1",
"description": "Production-grade code quality analyzer with AST parsing and AI integration",
"type": "module",
"main": "dist/index.js",

View File

@@ -913,10 +913,13 @@ export class TreeSitterParser implements IParser {
const walk = (node: Parser.SyntaxNode): void => {
if (typeSet.has(node.type)) {
callback(node);
// For comments, continue recursing; for functions/classes, don't
// For comments and imports, continue recursing
// For functions, also continue recursing to find nested functions (e.g., arrow functions in React components)
// For classes, don't recurse (methods will be found separately)
if (
this.config.commentNodeTypes.includes(node.type) ||
this.config.importNodeTypes.includes(node.type)
this.config.importNodeTypes.includes(node.type) ||
this.config.functionNodeTypes.includes(node.type)
) {
for (const child of node.namedChildren) walk(child);
}

View File

@@ -2,4 +2,4 @@
* Application version - single source of truth
* This value is automatically synced from package.json during build
*/
export const VERSION = '2.2.0';
export const VERSION = '2.2.1';