npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

feihong-code

v8.9.0

Published

fhcode(飞虹 Code)— 终端 AI 编程智能体:多模型路由(DeepSeek/通义/Ollama/OpenAI)、企业级 RBAC 审计、全自动 SWE Agent、支持离线私有化。源代码 Apache-2.0 开源自托管,企业版增值能力(激活码、完全私有化部署与商业支持)采用商业授权双轨模式。

Readme

飞虹 Code - 自我迭代升级系统

让 AI 编程助手能够自我学习、持续进化

🎯 系统概述

Self-Evolve 是飞虹 Code 的元技能系统,让它能够:

  1. 自动记录失败 - 每次任务失败都会被记录并分析
  2. 提取错误模式 - 识别重复出现的错误类型
  3. 创建解决技能 - 当遇到无解问题时,自动生成新技能
  4. 定期复盘优化 - 每日/每周回顾,持续改进

📦 包含内容

核心系统

  • skills/self-evolve/SKILL.md - Self-Evolve 技能定义
  • src/self-evolve/manager.js - 核心管理器
  • src/self-evolve/hook.ts - 集成钩子
  • src/cli/self-evolve-cli.js - 命令行接口(自包含、零外部依赖)
  • src/agent/self-improver.ts - 新一代闭环自我改进(与 orchestrator 共用 experiences 经验库,实现真正的回流闭环)

文档

  • docs/self-evolve.md - 用户文档
  • docs/self-evolve-implementation.md - 实现指南

测试

  • tests/unit/self-evolve.test.js - 单元测试
  • tests/demo/self-evolve-demo.js - 演示脚本

🚀 快速开始

无需安装脚本:self-evolve 已接入主 CLI(fhcode self-evolve),首次调用即自动初始化数据目录。

1. 查看系统状态

# 查看统计(自动初始化)
fhcode self-evolve status

# 或设置别名(可选)
alias fe='fhcode self-evolve'
fe status

2. 开始使用

# 列出失败记录
fe failures list

# 查看技能库
fe skills list

# 每日复盘
fe review --daily

# 分析错误模式
fe analyze

📊 核心功能

失败记录

自动记录所有失败的执行,包括:

  • 错误类型(编译、运行时、路径、权限、API等)
  • 完整的错误信息
  • 尝试的解决方案
  • 根本原因分析

错误模式识别

  • 按类型统计失败频率
  • 识别重复出现的错误
  • 建议创建针对性技能

技能自动生成

当遇到无法解决的新问题时:

# 系统会提示创建技能
fe create-skill \
  --name my-error-handler \
  --description "处理我的特定错误" \
  --pattern error-type \
  --solution "具体解决步骤" \
  --triggers "触发关键词"

定期复盘

# 每日复盘
fhcode self-evolve review --daily

# 错误模式分析(建议创建技能)
fhcode self-evolve analyze --days 7

说明:fe status --week(周统计)尚未实现;如需查看跨任务学习沉淀,请用 fhcode self-improve(新一代闭环系统,读写 ~/.feihong-code/experiences/)。

🔄 工作流程

任务执行
    ↓
成功? → 记录成功
    ↓ 失败
自动记录失败
    ↓
搜索已知解决方案
    ↓ 找到 → 应用方案
    ↓ 未找到
分析根因
    ↓
创建新技能? → 是 → 保存到 ~/.feihong-code/skills/
    ↓ 否
标记待人工处理
    ↓
每日复盘 → 优化系统

📁 数据结构

所有数据存储在 ~/.feihong-code/self-evolve/:

~/.feihong-code/
├── self-evolve/
│   ├── config.json          # 配置
│   ├── failures.json        # 失败记录(运维视图)
│   ├── skills-index.json    # 技能索引
│   ├── history.json         # 操作历史
│   └── report-YYYY-MM-DD.json  # 每日报告
├── skills/
│   └── <skill-name>/
│       └── SKILL.md
├── experiences/             # ★ 统一经验库(self-evolve 与 self-improve 共用)
│   └── experiences.jsonl    #   失败/反思/技能 全部回流至此,供 orchestrator 检索
└── ...

统一经验库(双系统已收敛):本系统与新一代 self-improve(src/agent/experience.ts)共用同一经验库 ~/.feihong-code/experiences/experiences.jsonl。

  • 本系统记录的失败 → 自动写入 error-pattern 经验;解决问题/沉淀技能 → 写入 success-pattern 经验
  • 新一代系统的任务反思也写入同一文件,二者以「稳定 id + upsert」合并(同一模式重复出现只累加权重,不无限膨胀)
  • orchestrator 在后续任务启动时检索注入这批经验,形成「执行 → 反思 → 回流 → 更强执行」的闭环
  • 查询学习沉淀统一用 fhcode self-improve;本系统的 fhcode self-evolve 聚焦「失败记录/技能/复盘」的运维视图

🔧 集成开发

在工具中记录失败

import { selfEvolveHook } from './self-evolve/hook.ts';

try {
  await someToolCall(input);
} catch (error) {
  selfEvolveHook.onToolFailure({
    tool: 'tool-name',
    input: input,
    error: error.message,
    attemptedSolutions: []
  });
  throw error;
}

定期复盘

// 每天运行
const report = await selfEvolveHook.dailyReview();
console.log(`今日失败: ${report.total_failures}`);

📚 与现有系统集成

Self-Evolve 可以与以下技能配合:

| 技能 | 集成点 | 作用 | |------|--------|------| | /self-heal | 自动创建修复技能 | 解决技术错误 | | /plan | 计划时参考历史 | 避免重复失败 | | /goal | 目标设定参考 | 追踪迭代进度 |

🎯 使用示例

示例1:处理编译错误

# 分析最近7天的编译错误
fe analyze --days 7 --type compile-error

# 创建通用编译错误处理技能
fe create-skill \
  --name compile-error-handler \
  --description "处理TypeScript编译错误" \
  --pattern compile-error \
  --solution "1. 检查导入路径\n2. 验证类型定义\n3. 安装缺失依赖" \
  --triggers "error TS, syntax error, cannot find module"

示例2:处理路径穿越

# 创建路径安全技能
fe create-skill \
  --name path-security-handler \
  --description "处理路径穿越安全问题" \
  --pattern path-error \
  --solution "1. 验证路径在workspace内\n2. 使用相对路径\n3. 规范化路径" \
  --triggers "path traversal, outside workspace, EACCES"

示例3:查看每日复盘

fe review --daily

输出:

📅 每日复盘报告
========================================
日期: 2026-08-16
失败任务: 5
已解决: 3
待处理: 2
新技能: 1

今日失败详情:
  ✅ [a1b2c3d4] compile-error: error TS2307...
  ⏳ [e5f6g7h8] path-error: Path traversal...

🛡️ 纪律与原则

  1. 诚实记录 - 失败就是失败,不伪造成功
  2. 及时复盘 - 每日至少一次复盘分析
  3. 渐进改进 - 每次迭代只优化一个方面
  4. 验证优先 - 新技能必须经过测试验证
  5. 可追溯 - 所有变更记录保存历史版本

📈 版本历史

  • v1.1.0 (2026-08-28) - 修复与接入
    • 移除未安装的 uuid 依赖(修复 CLI 崩溃)
    • CLI 重写为自包含零依赖解析(移除未声明的 commander)
    • self-evolve 正式接入主 CLI(fhcode self-evolve ... 可直接使用)
    • 消除文档中不存在的脚本引用,标注新旧两套系统差异
  • v1.0.0 (2026-08-16) - 初始版本
    • 基础失败记录功能
    • 技能自动生成
    • 每日复盘
    • CLI 接口

🔮 未来规划

  • [ ] 自动检测技能冲突
  • [ ] 技能效果追踪
  • [ ] 团队共享技能库
  • [ ] AI 辅助技能创建
  • [ ] 失败预测模型

🤝 贡献指南

欢迎贡献!请遵循以下步骤:

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

📄 许可证

源代码基于 Apache-2.0 开源自托管,企业版增值能力(激活码、完全私有化部署与商业支持)采用商业授权双轨模式,详见 LICENSE 与 NOTICE


让飞虹 Code 越来越聪明! 🚀