runcc 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/npm-publish/SKILL.md +209 -0
- package/.claude/skills/npm-publish.skill +0 -0
- package/CHANGELOG.md +27 -0
- package/dist/index.js +21 -22
- package/package.json +1 -1
- package/test-install.sh +28 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: npm-publish
|
|
3
|
+
description: Automate npm package version bumping and publishing with comprehensive safety checks. Use when user requests "发布新版本", "publish to npm", "bump version", "release a new version", or similar package publishing tasks. Supports semantic versioning (patch/minor/major), git tagging, CHANGELOG updates, and pre-publish validation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NPM Publish
|
|
7
|
+
|
|
8
|
+
Automate the complete npm package release workflow with safety checks, version management, and changelog updates.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
Follow this sequential workflow for publishing npm packages. Each step includes validation and confirmation points to ensure safe releases.
|
|
13
|
+
|
|
14
|
+
### Step 1: Pre-flight Checks
|
|
15
|
+
|
|
16
|
+
Before starting the release process, create a todo list with these items and verify the environment:
|
|
17
|
+
|
|
18
|
+
1. **检查 git 工作区状态**
|
|
19
|
+
- Run `git status` to ensure working directory is clean
|
|
20
|
+
- If there are uncommitted changes, ask user whether to commit them or abort
|
|
21
|
+
|
|
22
|
+
2. **确认当前分支**
|
|
23
|
+
- Check current branch with `git branch --show-current`
|
|
24
|
+
- Verify it's `main` or `master` (or other release branch)
|
|
25
|
+
- If not on release branch, warn user and ask to confirm or switch
|
|
26
|
+
|
|
27
|
+
3. **检查 npm 登录状态**
|
|
28
|
+
- Run `npm whoami` to verify npm authentication
|
|
29
|
+
- If not logged in, instruct user to run `npm login`
|
|
30
|
+
|
|
31
|
+
4. **拉取最新代码**
|
|
32
|
+
- Run `git pull` to ensure working with latest code
|
|
33
|
+
- Check for any conflicts
|
|
34
|
+
|
|
35
|
+
### Step 2: Determine Version Bump Type
|
|
36
|
+
|
|
37
|
+
Ask the user which type of version bump to perform, unless they've already specified:
|
|
38
|
+
|
|
39
|
+
- **patch**: Bug fixes, minor changes (1.0.0 → 1.0.1)
|
|
40
|
+
- **minor**: New features, backward compatible (1.0.0 → 1.1.0)
|
|
41
|
+
- **major**: Breaking changes (1.0.0 → 2.0.0)
|
|
42
|
+
- **custom**: Specify exact version number
|
|
43
|
+
|
|
44
|
+
Use the `AskUserQuestion` tool if the version type wasn't specified in the initial request.
|
|
45
|
+
|
|
46
|
+
### Step 3: Run Tests and Build
|
|
47
|
+
|
|
48
|
+
Execute the project's quality checks:
|
|
49
|
+
|
|
50
|
+
1. **运行测试**
|
|
51
|
+
- Check if `package.json` has a `test` script
|
|
52
|
+
- Run `npm test` or equivalent command
|
|
53
|
+
- If tests fail, abort the release and report errors
|
|
54
|
+
|
|
55
|
+
2. **运行构建**
|
|
56
|
+
- Check if `package.json` has a `build` script
|
|
57
|
+
- Run `npm run build` or equivalent command
|
|
58
|
+
- If build fails, abort the release and report errors
|
|
59
|
+
|
|
60
|
+
### Step 4: Update CHANGELOG
|
|
61
|
+
|
|
62
|
+
If CHANGELOG.md exists in the project:
|
|
63
|
+
|
|
64
|
+
1. **Read recent commits**
|
|
65
|
+
- Run `git log` to see commits since last release
|
|
66
|
+
- Look for previous version tags with `git tag -l`
|
|
67
|
+
|
|
68
|
+
2. **Generate changelog entry**
|
|
69
|
+
- Create a new section for the new version
|
|
70
|
+
- List key changes based on commit messages
|
|
71
|
+
- Format: `## [Version] - YYYY-MM-DD`
|
|
72
|
+
- Group changes by type: Features, Bug Fixes, Breaking Changes, etc.
|
|
73
|
+
|
|
74
|
+
3. **Let user review and edit**
|
|
75
|
+
- Show the generated changelog entry
|
|
76
|
+
- Use `AskUserQuestion` to confirm or request modifications
|
|
77
|
+
- Update CHANGELOG.md with the approved content
|
|
78
|
+
|
|
79
|
+
If no CHANGELOG.md exists, ask user if they want to create one.
|
|
80
|
+
|
|
81
|
+
### Step 5: Bump Version
|
|
82
|
+
|
|
83
|
+
Use npm's built-in version command:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm version <patch|minor|major|x.y.z> -m "chore: release v%s"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This command will:
|
|
90
|
+
- Update version in `package.json` and `package-lock.json`
|
|
91
|
+
- Create a git commit with the specified message
|
|
92
|
+
- Create a git tag with the new version
|
|
93
|
+
|
|
94
|
+
### Step 6: User Confirmation
|
|
95
|
+
|
|
96
|
+
Before publishing, display a summary and ask for final confirmation:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Ready to publish:
|
|
100
|
+
- Package: <package-name>
|
|
101
|
+
- Current version: <old-version>
|
|
102
|
+
- New version: <new-version>
|
|
103
|
+
- Branch: <branch-name>
|
|
104
|
+
- Changes: <summary from changelog>
|
|
105
|
+
|
|
106
|
+
Proceed with publishing? (yes/no)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Use `AskUserQuestion` for this confirmation.
|
|
110
|
+
|
|
111
|
+
### Step 7: Publish to NPM
|
|
112
|
+
|
|
113
|
+
If user confirms, publish the package:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm publish
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Options to consider:
|
|
120
|
+
- `--access public` for scoped public packages
|
|
121
|
+
- `--tag <tag>` for pre-release versions (e.g., `beta`, `next`)
|
|
122
|
+
- `--dry-run` to test without actually publishing (useful for first-time testing)
|
|
123
|
+
|
|
124
|
+
### Step 8: Push to Git Remote
|
|
125
|
+
|
|
126
|
+
After successful npm publish:
|
|
127
|
+
|
|
128
|
+
1. **推送代码和标签**
|
|
129
|
+
```bash
|
|
130
|
+
git push && git push --tags
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. **验证发布**
|
|
134
|
+
- Confirm the new version appears on npmjs.com
|
|
135
|
+
- Confirm the git tag appears on the remote repository
|
|
136
|
+
|
|
137
|
+
### Step 9: Summary
|
|
138
|
+
|
|
139
|
+
Report the successful release:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
✅ Successfully published <package-name>@<new-version>
|
|
143
|
+
|
|
144
|
+
- NPM: https://www.npmjs.com/package/<package-name>
|
|
145
|
+
- Git tag: <tag-name>
|
|
146
|
+
- Changelog updated: Yes/No
|
|
147
|
+
|
|
148
|
+
Next steps:
|
|
149
|
+
- Create GitHub release (if applicable)
|
|
150
|
+
- Announce to team
|
|
151
|
+
- Update dependent projects
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Error Handling
|
|
155
|
+
|
|
156
|
+
If any step fails:
|
|
157
|
+
|
|
158
|
+
1. **Clearly state which step failed and why**
|
|
159
|
+
2. **Do not proceed to next steps**
|
|
160
|
+
3. **Provide actionable recovery steps**
|
|
161
|
+
4. **If version was bumped but publish failed:**
|
|
162
|
+
- The version commit and tag already exist
|
|
163
|
+
- User can either: fix the issue and run `npm publish` manually, or reset with `git reset --hard HEAD~1 && git tag -d v<version>`
|
|
164
|
+
|
|
165
|
+
## Rollback
|
|
166
|
+
|
|
167
|
+
If user needs to undo a release:
|
|
168
|
+
|
|
169
|
+
1. **Unpublish from npm** (only within 72 hours):
|
|
170
|
+
```bash
|
|
171
|
+
npm unpublish <package-name>@<version>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
2. **Delete git tag**:
|
|
175
|
+
```bash
|
|
176
|
+
git tag -d v<version>
|
|
177
|
+
git push origin :refs/tags/v<version>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. **Revert version commit**:
|
|
181
|
+
```bash
|
|
182
|
+
git reset --hard HEAD~1
|
|
183
|
+
git push --force
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Warning**: Unpublishing is discouraged by npm. Prefer deprecating instead:
|
|
187
|
+
```bash
|
|
188
|
+
npm deprecate <package-name>@<version> "Reason for deprecation"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Customization
|
|
192
|
+
|
|
193
|
+
Different projects may need adaptations:
|
|
194
|
+
|
|
195
|
+
- **Monorepo**: Use tools like `lerna` or `nx` for versioning multiple packages
|
|
196
|
+
- **Pre-release versions**: Use `npm version prerelease --preid=beta`
|
|
197
|
+
- **CI/CD**: This workflow is for manual releases; adapt for automated pipelines
|
|
198
|
+
- **Private registry**: Use `--registry` flag or `.npmrc` configuration
|
|
199
|
+
- **2FA**: npm may require OTP code during publish, prompt user to enter it
|
|
200
|
+
|
|
201
|
+
## Best Practices
|
|
202
|
+
|
|
203
|
+
1. **Always run tests before publishing**
|
|
204
|
+
2. **Keep CHANGELOG.md up to date**
|
|
205
|
+
3. **Use semantic versioning correctly**
|
|
206
|
+
4. **Review changes one final time before confirming**
|
|
207
|
+
5. **Never publish with uncommitted changes**
|
|
208
|
+
6. **Tag releases for easy reference**
|
|
209
|
+
7. **Announce breaking changes clearly**
|
|
Binary file
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.2] - 2026-01-19
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Renamed CLI command from `cc-run` to `runcc` for better naming consistency
|
|
12
|
+
- Improved output formatting with UTF-8 support for better Chinese character display in list command
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- Added `.npmignore` configuration for cleaner package distribution
|
|
16
|
+
- Added Claude Code skills configuration for enhanced development workflow
|
|
17
|
+
- Added local testing script (`test-install.sh`) for installation verification
|
|
18
|
+
|
|
19
|
+
## [0.1.1] - 2026-01-19
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Initial release with multi-endpoint support
|
|
23
|
+
- Support for official Claude API and third-party providers (GLM, DeepSeek, Minimax)
|
|
24
|
+
- Custom endpoint management (add/remove)
|
|
25
|
+
- Proxy configuration support
|
|
26
|
+
- Configuration persistence in `~/.cc-run/config.json`
|
|
27
|
+
- Integration with Claude CLI settings (`~/.claude/settings.json`)
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
// @bun
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
var __create = Object.create;
|
|
5
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -2020,7 +2019,7 @@ function safeLog(message) {
|
|
|
2020
2019
|
const encoder = new TextEncoder;
|
|
2021
2020
|
const data = encoder.encode(message + `
|
|
2022
2021
|
`);
|
|
2023
|
-
|
|
2022
|
+
process.stdout.write(data);
|
|
2024
2023
|
}
|
|
2025
2024
|
function formatEndpoint(name, endpoint, hasToken) {
|
|
2026
2025
|
const tokenStatus = hasToken ? "已配置 token" : "未配置 token";
|
|
@@ -2465,12 +2464,12 @@ function validateDashPosition(argv) {
|
|
|
2465
2464
|
// src/index.ts
|
|
2466
2465
|
function safeLog2(message) {
|
|
2467
2466
|
const encoder = new TextEncoder;
|
|
2468
|
-
|
|
2467
|
+
process.stdout.write(encoder.encode(message + `
|
|
2469
2468
|
`));
|
|
2470
2469
|
}
|
|
2471
2470
|
function safeError(message) {
|
|
2472
2471
|
const encoder = new TextEncoder;
|
|
2473
|
-
|
|
2472
|
+
process.stderr.write(encoder.encode(message + `
|
|
2474
2473
|
`));
|
|
2475
2474
|
}
|
|
2476
2475
|
var isBunCompiled = typeof Bun !== "undefined" && !import.meta.dir;
|
|
@@ -2483,17 +2482,17 @@ if (isBunCompiled) {
|
|
|
2483
2482
|
};
|
|
2484
2483
|
}
|
|
2485
2484
|
var program2 = new Command;
|
|
2486
|
-
program2.name("cc-run").description("Claude
|
|
2487
|
-
program2.command("list").description("
|
|
2488
|
-
program2.command("add").description("
|
|
2489
|
-
program2.command("remove").description("
|
|
2490
|
-
var proxyCmd = program2.command("proxy").description("
|
|
2491
|
-
proxyCmd.command("on").description("
|
|
2492
|
-
proxyCmd.command("off").description("
|
|
2493
|
-
proxyCmd.command("reset").description("
|
|
2494
|
-
proxyCmd.command("status").description("
|
|
2495
|
-
proxyCmd.command("help").description("
|
|
2496
|
-
program2.argument("[provider]", "provider
|
|
2485
|
+
program2.name("cc-run").description("Claude 启动器 - 支持切换不同的 API endpoint").version("0.1.0");
|
|
2486
|
+
program2.command("list").description("列出所有可用的 endpoints").action(list);
|
|
2487
|
+
program2.command("add").description("添加自定义 endpoint").argument("<name>", "endpoint 名称").argument("<endpoint>", "API 地址").action(add);
|
|
2488
|
+
program2.command("remove").description("删除自定义 endpoint").argument("<name>", "endpoint 名称").action(remove);
|
|
2489
|
+
var proxyCmd = program2.command("proxy").description("代理管理");
|
|
2490
|
+
proxyCmd.command("on").description("开启代理").action(proxyOn);
|
|
2491
|
+
proxyCmd.command("off").description("关闭代理").action(proxyOff);
|
|
2492
|
+
proxyCmd.command("reset").description("重置代理配置").action(proxyReset);
|
|
2493
|
+
proxyCmd.command("status").description("查看代理状态").action(proxyStatus);
|
|
2494
|
+
proxyCmd.command("help").description("代理帮助信息").action(proxyHelp);
|
|
2495
|
+
program2.argument("[provider]", "provider 名称 (glm, deepseek, minimax 或自定义)").option("--claude", "配置原生 claude 命令").allowExcessArguments(true).action(async (provider, options) => {
|
|
2497
2496
|
try {
|
|
2498
2497
|
validateDashPosition(process.argv);
|
|
2499
2498
|
const passthroughArgs = extractPassthroughArgs(process.argv);
|
|
@@ -2508,14 +2507,14 @@ program2.argument("[provider]", "provider \u540D\u79F0 (glm, deepseek, minimax \
|
|
|
2508
2507
|
}
|
|
2509
2508
|
} catch (error) {
|
|
2510
2509
|
if (error instanceof PassthroughArgsError) {
|
|
2511
|
-
console.error("
|
|
2510
|
+
console.error("❌ 参数位置不正确");
|
|
2512
2511
|
console.error("");
|
|
2513
|
-
console.error("
|
|
2514
|
-
console.error(" cc-run glm -- <claude
|
|
2515
|
-
console.error(" cc-run --claude --
|
|
2516
|
-
console.error(" cc-run glm --claude --
|
|
2512
|
+
console.error("正确的用法示例:");
|
|
2513
|
+
console.error(" cc-run glm -- <claude参数> # 使用 glm provider 并透传参数");
|
|
2514
|
+
console.error(" cc-run --claude -- <参数> # 恢复官方配置并透传参数");
|
|
2515
|
+
console.error(" cc-run glm --claude -- <参数> # 配置原生 claude 命令使用 glm");
|
|
2517
2516
|
console.error("");
|
|
2518
|
-
console.error("
|
|
2517
|
+
console.error("说明: -- 分隔符用于将后续参数透传给 Claude CLI");
|
|
2519
2518
|
process.exit(1);
|
|
2520
2519
|
}
|
|
2521
2520
|
throw error;
|
package/package.json
CHANGED
package/test-install.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# 本地安装测试脚本
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "🔨 构建项目..."
|
|
7
|
+
bun run build
|
|
8
|
+
|
|
9
|
+
echo ""
|
|
10
|
+
echo "📦 打包..."
|
|
11
|
+
npm pack
|
|
12
|
+
|
|
13
|
+
echo ""
|
|
14
|
+
echo "🌍 全局安装..."
|
|
15
|
+
PKG=$(ls runcc-*.tgz)
|
|
16
|
+
npm install -g ./$PKG
|
|
17
|
+
|
|
18
|
+
echo ""
|
|
19
|
+
echo "✅ 测试中文输出..."
|
|
20
|
+
runcc list
|
|
21
|
+
|
|
22
|
+
echo ""
|
|
23
|
+
echo "🧹 清理..."
|
|
24
|
+
npm uninstall -g runcc
|
|
25
|
+
rm $PKG
|
|
26
|
+
|
|
27
|
+
echo ""
|
|
28
|
+
echo "✨ 测试完成!"
|