
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
needware-cli
Advanced tools
一个功能强大的 Node.js 命令行工具
使用以下命令快速安装:
curl -fsSL https://raw.githubusercontent.com/needware/needware-cli/main/install.sh | sh
或使用 wget:
wget -qO- https://raw.githubusercontent.com/needware/needware-cli/main/install.sh | sh
安装脚本会自动:
npm install -g needware-cli
npm install --save-dev needware-cli
npx needware-cli <command>
查看 完整安装指南 了解更多安装方式和故障排查。
# 交互式初始化
needware-cli init
# 使用默认配置
needware-cli init --default
# 查看所有配置
needware-cli config list
# 获取配置项
needware-cli config get logging.level
# 设置配置项
needware-cli config set logging.level debug
# 设置 API Key
needware-cli config set sdks.example.apiKey YOUR_API_KEY
# 重置配置
needware-cli config reset
# 查看配置文件路径
needware-cli config path
# 配置 API Key(必需)
export ANTHROPIC_API_KEY=your_api_key_here
# 1. 简单文本 prompt(最常用)
needware-cli agent "创建一个待办事项应用"
# 2. 从文件读取 prompt
needware-cli agent ./requirements.txt
needware-cli agent ./prompts/feature.md
# 3. 使用 JSON 格式的消息
needware-cli agent '{"role":"user","content":"修复登录页面"}'
# 4. 使用消息历史(多轮对话上下文)
needware-cli agent ./conversation.json
# 5. 使用带元数据的 JSON(包含 sessionId)
needware-cli agent '{"prompt":"添加功能","sessionId":"my-session"}'
# 单次对话 - 指定工作目录
needware-cli agent "修复登录页面的样式问题" --working-dir ./my-project
# 多轮对话 - 交互式模式(推荐用于复杂任务)
needware-cli agent --interactive
# 或使用简写
needware-cli agent -i
# 多轮对话 - 带初始提示
needware-cli agent -i "创建一个待办事项应用"
# 指定额外目录
needware-cli agent "优化性能" --additional-dirs ./shared,./utils
# 使用数据库配置(如 Supabase)🆕
needware-cli agent "创建待办事项" --db-config '{"hasSelectedProject":true,"projectId":"your-project-id","publishableKey":"your-key","url":"https://your-project.supabase.co"}'
# 从文件读取数据库配置
needware-cli agent "创建待办事项" --db-config "$(cat db-config.json)"
# 使用 Agent Tools 🔥 **新增**
needware-cli agent "启用 Supabase 集成,项目 ID 是 my-project-123"
needware-cli agent "用 example-tool 把 'hello world' 转换为大写"
Prompt 输入格式(自动识别) ⭐ 新增:
"创建组件"./prompt.txt'{"role":"user","content":"..."}''[{"role":"user",...}]''{"prompt":"...","sessionId":"..."}''{"user":{"content":[{"type":"text",...},{"type":"image",...}]}}' 🆕多模态消息示例 🆕:
# 从图片生成代码
needware-cli agent '{
"user": {
"content": [
{"type": "text", "text": "根据这张图片一比一还原应用"},
{"type": "image", "source": {"type": "url", "media_type": "image/png", "url": "https://example.com/design.png"}}
]
}
}' --api-key YOUR_API_KEY
# 从文件读取多模态消息
needware-cli agent examples/multimodal-message-example.json --api-key YOUR_API_KEY
图片转换功能 🆕: needware-cli 现在提供了强大的图片转换功能,支持本地文件和远程URL:
🔥 自动转换 - 使用 URL 图片时自动转换为 base64:
# 直接使用图片 URL,系统自动下载并转换为 base64
needware-cli agent '{
"user": {
"content": [
{"type": "text", "text": "分析这张图片"},
{"type": "image", "source": {"type": "url", "url": "https://example.com/photo.jpg"}}
]
}
}'
📦 手动转换 API:
import {
convertImageToBase64, // 转换本地图片
convertRemoteImageToBase64, // 转换远程URL图片
convertImageToBase64Smart, // 智能检测并转换
isImageFile
} from 'needware-cli/utils/prompt-parser';
// 转换本地图片
const local = await convertImageToBase64('./photo.jpg');
// 转换远程图片
const remote = await convertRemoteImageToBase64('https://example.com/photo.jpg');
// 智能转换(自动检测本地或远程)
const smart = await convertImageToBase64Smart('./photo.jpg');
// 或
const smart2 = await convertImageToBase64Smart('https://example.com/photo.jpg');
// 返回格式:
// {
// "type": "image",
// "source": {
// "type": "base64",
// "media_type": "image/jpeg",
// "data": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
// }
// }
支持的图片格式:JPEG, PNG, GIF, WebP
支持的图片源:本地文件、远程URL(HTTP/HTTPS)
详细文档:
交互式模式特性:
exit 或 quit 退出对话查看文档:
# 查看 needware-cli 自带的所有可用技能
needware-cli skill
# 将指定技能复制到当前项目的 .claude/skills/<skill-name>/
needware-cli skill ai-integration
# 强制覆盖已存在的技能
needware-cli skill ai-integration --force
# 使用别名
needware-cli sk ai-integration
生成的目录结构:
your-project/
└── .claude/
└── skills/
├── ai-integration/
│ └── SKILL.md
└── other-skill/
└── SKILL.md
功能说明:
@skills).claude/skills/<skill-name>/SKILL.md--force 覆盖).claude/skills 已是文件)needware-cli 自带的技能:
ai-integration - AI 服务集成技能(支持图片分析、文本生成、智能识别等)# 获取数据
needware-cli example fetch 123
# 创建数据
needware-cli example create '{"name":"test"}'
# 健康检查
needware-cli example health
| 命令 | 别名 | 描述 | 示例 |
|---|---|---|---|
init | i | 初始化项目配置 | needware-cli init |
config | cfg | 配置管理 | needware-cli config list |
agent | ag | AI 智能助手 | needware-cli agent "创建应用" |
code-snapshot | snapshot | 生成代码快照 | needware-cli code-snapshot |
skill | sk | 管理和添加技能 | needware-cli skill ai-integration |
example | ex | 示例命令 | needware-cli example health |
| 选项 | 简写 | 描述 | 默认值 |
|---|---|---|---|
--verbose | -V | 详细输出模式 | false |
--quiet | -q | 静默模式 | false |
--config <path> | -c | 指定配置文件路径 | ~/.needware/config.json |
--version | -v | 显示版本信息 | - |
--help | -h | 显示帮助信息 | - |
默认配置文件位于 ~/.needware/config.json
{
"version": "1.0.0",
"logging": {
"level": "info",
"file": "~/.needware/logs/cli.log"
},
"sdks": {
"example": {
"apiKey": "",
"endpoint": "https://api.example.com",
"timeout": 30000,
"retries": 3
}
},
"preferences": {
"colorOutput": true,
"interactive": true
}
}
你可以使用环境变量覆盖配置:
# 日志级别
export NEEDWARE_LOG_LEVEL=debug
# API 配置
export NEEDWARE_API_KEY=your-api-key
export NEEDWARE_ENDPOINT=https://api.example.com
# Anthropic API 配置(Agent 命令需要)
export ANTHROPIC_API_KEY=your_anthropic_api_key
export ANTHROPIC_BASE_URL=https://api.anthropic.com # 可选
# 偏好设置
export NEEDWARE_COLOR_OUTPUT=true
export NEEDWARE_INTERACTIVE=true
npm install
npm run dev
npm run build
# 运行所有测试
npm test
# 单元测试
npm run test:unit
# 集成测试
npm run test:integration
# 覆盖率报告
npm run test:coverage
# 监听模式
npm run test:watch
# 运行 ESLint
npm run lint
# 自动修复
npm run lint:fix
# 格式化代码
npm run format
项目使用 Jest 进行测试,目标覆盖率为 80%。
npm test
欢迎贡献!请查看 贡献指南。
本项目遵循 Conventional Commits 规范:
feat: 新功能
fix: 修复问题
docs: 文档更新
style: 代码格式调整
refactor: 代码重构
test: 测试相关
chore: 构建工具或辅助工具
查看 CHANGELOG.md 了解版本变更详情。
MIT © Needware Team
感谢以下开源项目:
Made with ❤️ by Needware Team
FAQs
一个功能强大的 Node.js 命令行工具
We found that needware-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.