原子提交
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Atomic Commit Skill
Atomic workflow: validate → commit → push → PR → verify. All changes committed as single unit with **zero warnings** policy.
## Overview
Orchestrates complete code submission as state machine with 7 phases:
1. PRE_COMMIT - Validation (quality gate, secrets scan)
2. COMMIT - Atomic commit creation (conventional format)
3. PRE_PUSH - Remote sync check
4. PUSH - Upload to origin
5. PR_CREATE - Open pull request
6. VERIFY - Wait for CI checks
7. REPORT - Success summary
**Zero warnings policy**: Any warning fails the workflow and triggers rollback.
## Usage
```bash
# Full workflow
/atomic-commit
# With custom message
/atomic-commit --message "feat(auth): add OAuth2 flow"
# Dry run (validate only)
/atomic-commit --dry-run
# Skip CI verification (emergency)
/atomic-commit --skip-ci
```
## Arguments
| Argument | Description | Default |
|----------|-------------|---------|
| `--message, -m` | Commit message (auto-detect if omitted) | auto |
| `--dry-run` | Validate only, no commits/pushes | false |
| `--skip-ci` | Skip CI verification | false |
| `--timeout` | CI wait timeout in seconds | 1800 |
| `--base-branch` | Target branch for PR | main |
## State Machine
```
[Start] → PRE_COMMIT → COMMIT → PRE_PUSH → PUSH → PR_CREATE → VERIFY → REPORT → [Success]
↓ ↓ ↓ ↓ ↓ ↓
[Fail] Rollback Rollback Rollback Rollback Rollback
```
## Quality Gates
| Phase | Check | Failure Action |
|-------|-------|----------------|
| PRE_COMMIT | Quality gate zero warnings | Abort |
| PRE_COMMIT | No secrets in diff | Abort |
| PRE_COMMIT | Not on protected branch | Abort |
| COMMIT | Valid conventional format | Rollback |
| PRE_PUSH | Remote accessible | Rollback |
| PUSH | SHA verification | Rollback |
| PR_CREATE | gh CLI authenticated | Rollback |
| VERIFY | All CI checks green | Rollback |
| VERIFY | Zero warnings in checks | Rollback |
## Rollback Actions
On failure, automatically:
1. Close PR (if created)
2. Remove remote commit (best effort)
3. Reset local commit
4. Unstage changes
## Error Codes
| Code | Meaning |
|------|---------|
| 0 | Success |
| 2 | Quality gate failed |
| 3 | Commit failed |
| 4 | Push failed |
| 5 | PR creation failed |
| 6 | Checks failed/warnings found |
| 7 | Timeout |
| 8 | Rollback failed |
## Prerequisites
- `gh` CLI installed and authenticated
- Working on feature branch (not main/master)
- `./scripts/quality_gate.sh` exists
## Configuration
Environment variables:
```bash
ATOMIC_COMMIT_TIMEOUT=1800 # Check wait timeout
ATOMIC_COMMIT_BASE_BRANCH=main # Target branch for PR
ATOMIC_COMMIT_NO_ROLLBACK=0 # Set 1 to disable rollback
```
## Commit Format
```
type(scope): Brief description (50 chars max)
- Why (not what) - user perspective
- Reference issues: Fixes #123
```
**Types:** feat, fix, docs, style, refactor, perf, test, ci, chore
## Implementation
This skill uses sub-agents for each phase:
- `validate` - Phase 1: PRE_COMMIT
- `commit` - Phase 2: COMMIT
- `push` - Phases 3-4: PRE_PUSH & PUSH
- `create-pr` - Phase 5: PR_CREATE
- `verify` - Phase 6: VERIFY
## Success Criteria
Command succeeds only when:
1. ✓ All local validation passes (zero warnings)
2. ✓ Commit created with valid SHA
3. ✓ Pushed to remote successfully
4. ✓ PR created with valid URL
5. ✓ All GitHub Actions pass
6. ✓ Zero warnings in all checks
## See Also
- `.opencode/commands/commit.md` - Basic commit guidelines
- `.github/PULL_REQUEST_TEMPLATE.md` - PR template
- `references/IMPLEMENTATION.md` - Technical details
# Test change
---
> Source: [d-oit/do-knowledge-studio](https://github.com/d-oit/do-knowledge-studio) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
章节与文件索引
按说明文件中的顺序排列。
概述
论点
质量门
回滚操作
错误代码
文件/命令 -> --message, -m · --dry-run · --skip-ci · --timeout · --base-branch · ./scripts/quality_gate.sh · validate · commit
内容校验值 -> ae4d62d291a3
当前原文的自动摘译,尚未人工审校。
概述
将完整的代码提交编排为状态机,分为 7 个阶段: PRE_COMMIT - 验证(质量门、秘密扫描) COMMIT - 原子提交创建(传统格式) PRE_PUSH - 远程同步检查 PUSH - 上传到源
论点
参数 · 描述 · 默认值
--message, -m· 提交消息(如果省略则自动检测) · 自动--dry-run· 仅验证,无提交/推送 · false--skip-ci· 跳过 CI 验证 · false--timeout· CI 等待超时(以秒为单位) · 1800质量门
阶段 · 检查 · 失败操作 PRE_COMMIT · 质量门零警告 · 中止 PRE_COMMIT · 差异中没有秘密 · 中止 PRE_COMMIT · 不在受保护分支上 · 中止 COMMIT · 有效的常规格式 · 回滚
回滚操作
失败时,自动: 关闭 PR(如果已创建) 删除远程提交(尽力而为) 重置本地提交 取消暂存更改
错误代码
代码 · 含义 0 · 成功 2 · 质量门失败 3 · 提交失败 4 · 推送失败