mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 22:05:50 +00:00
feat: 添加 autonomy 自主模式命令系统
- 新增 autonomy CLI handler 和交互式面板 - 新增 autonomyCommandSpec 命令规范定义 - 新增 autonomyAuthority 权限控制 - 新增 autonomyStatus 状态管理 - 注册 CLI 子命令 (claude autonomy status/runs/flows/flow) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
42
src/utils/__tests__/autonomyCommandSpec.test.ts
Normal file
42
src/utils/__tests__/autonomyCommandSpec.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import {
|
||||
AUTONOMY_ARGUMENT_HINT,
|
||||
parseAutonomyArgs,
|
||||
} from '../autonomyCommandSpec'
|
||||
|
||||
describe('autonomy command spec', () => {
|
||||
test('provides a command-panel argument hint', () => {
|
||||
expect(AUTONOMY_ARGUMENT_HINT).toContain('status [--deep]')
|
||||
expect(AUTONOMY_ARGUMENT_HINT).toContain('flow resume <id>')
|
||||
})
|
||||
|
||||
test('parses shared slash/CLI autonomy routes', () => {
|
||||
expect(parseAutonomyArgs('')).toEqual({ type: 'status', deep: false })
|
||||
expect(parseAutonomyArgs('status --deep')).toEqual({
|
||||
type: 'status',
|
||||
deep: true,
|
||||
})
|
||||
expect(parseAutonomyArgs('runs 5')).toEqual({
|
||||
type: 'runs',
|
||||
limit: '5',
|
||||
})
|
||||
expect(parseAutonomyArgs('flows 7')).toEqual({
|
||||
type: 'flows',
|
||||
limit: '7',
|
||||
})
|
||||
expect(parseAutonomyArgs('flow flow-1')).toEqual({
|
||||
type: 'flow-detail',
|
||||
flowId: 'flow-1',
|
||||
})
|
||||
expect(parseAutonomyArgs('flow cancel flow-1')).toEqual({
|
||||
type: 'flow-cancel',
|
||||
flowId: 'flow-1',
|
||||
})
|
||||
expect(parseAutonomyArgs('flow resume flow-1')).toEqual({
|
||||
type: 'flow-resume',
|
||||
flowId: 'flow-1',
|
||||
})
|
||||
expect(parseAutonomyArgs('flow cancel')).toEqual({ type: 'usage' })
|
||||
expect(parseAutonomyArgs('unknown')).toEqual({ type: 'usage' })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user