opencode-onboard 0.4.2 → 0.4.4
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/LICENSE +21 -0
- package/README.md +304 -301
- package/content/.agents/agents/basic-engineer.md +4 -2
- package/content/.agents/agents/devops-manager.md +123 -123
- package/content/.agents/skills/ob-default/SKILL.md +25 -21
- package/content/.agents/skills/ob-generic-guardrails/SKILL.md +36 -32
- package/content/.agents/skills/ob-global/SKILL.md +92 -49
- package/content/.agents/skills/ob-pullrequest-az/SKILL.md +168 -160
- package/content/.agents/skills/ob-pullrequest-gh/SKILL.md +140 -136
- package/content/.opencode/commands/create-engineer.md +109 -0
- package/content/.opencode/commands/init.md +1 -1
- package/content/.opencode/commands/main.md +1 -1
- package/content/.opencode/commands/opsx-apply.md +131 -70
- package/content/.opencode/commands/plan.md +1 -1
- package/content/.opencode/plugins/session-log.js +523 -519
- package/content/.opencode/skills/openspec-apply-change/SKILL.md +86 -64
- package/content/AGENTS.md +67 -39
- package/package.json +1 -1
- package/src/commands/join.js +3 -3
- package/src/commands/single.js +2 -0
- package/src/commands/wizard.js +124 -99
- package/src/presets/browser.json +22 -18
- package/src/presets/optimization.json +27 -22
- package/src/presets/source.json +7 -1
- package/src/steps/browser/browser.test.js +115 -81
- package/src/steps/browser/index.js +62 -54
- package/src/steps/clean/index.js +108 -107
- package/src/steps/copy/agents.js +28 -0
- package/src/steps/copy/copy.test.js +1 -0
- package/src/steps/copy/index.js +2 -1
- package/src/steps/metadata/index.js +63 -61
- package/src/steps/models/format.js +61 -60
- package/src/steps/models/write.test.js +117 -117
- package/src/steps/openspec/ensemble.js +30 -7
- package/src/steps/openspec/ensemble.test.js +79 -79
- package/src/steps/openspec/index.js +121 -32
- package/src/steps/openspec/index.test.js +63 -0
- package/src/steps/optimization/caveman.js +34 -29
- package/src/steps/optimization/codegraph.js +52 -0
- package/src/steps/optimization/global.js +88 -64
- package/src/steps/optimization/global.test.js +99 -0
- package/src/steps/optimization/index.js +109 -101
- package/src/steps/optimization/optimization.test.js +101 -93
- package/src/steps/optimization/quota.js +84 -84
- package/src/steps/source/index.js +48 -0
- package/src/steps/source/source.test.js +124 -91
- package/src/utils/__tests__/copy.test.js +117 -117
- package/src/utils/exec-spinner.js +47 -47
- package/src/utils/exec.js +134 -131
- package/src/utils/terminal.js +6 -0
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { confirm } from '@inquirer/prompts'
|
|
2
|
-
import fse from 'fs-extra'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { fileURLToPath } from 'url'
|
|
5
|
-
import { error, header, info, loading, success, warn } from '../../utils/exec.js'
|
|
6
|
-
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
-
const QUOTA_PRESET_PATH = path.resolve(__dirname, '../../presets/quota.json')
|
|
9
|
-
const quotaPreset = await fse.readJson(QUOTA_PRESET_PATH)
|
|
10
|
-
const PLUGIN = quotaPreset.plugin
|
|
11
|
-
|
|
12
|
-
function ensurePlugin(config) {
|
|
13
|
-
if (!Array.isArray(config.plugin)) config.plugin = []
|
|
14
|
-
if (!config.plugin.includes(PLUGIN)) config.plugin.push(PLUGIN)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function addIfMissing(target, key, value) {
|
|
18
|
-
if (!(key in target)) target[key] = value
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function installQuota(options = {}) {
|
|
22
|
-
if (!options.skipHeader) header('Installing opencode-quota')
|
|
23
|
-
|
|
24
|
-
let shouldInstall = true
|
|
25
|
-
if (!options.skipPrompt && process.stdin.isTTY) {
|
|
26
|
-
const timeoutMs = quotaPreset.prompt.timeoutMs
|
|
27
|
-
const choice = await Promise.race([
|
|
28
|
-
confirm({
|
|
29
|
-
message: quotaPreset.prompt.message,
|
|
30
|
-
default: quotaPreset.prompt.default,
|
|
31
|
-
}),
|
|
32
|
-
new Promise(resolve => setTimeout(() => resolve(true), timeoutMs)),
|
|
33
|
-
])
|
|
34
|
-
shouldInstall = choice !== false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!shouldInstall) {
|
|
38
|
-
warn('Skipped opencode-quota installation')
|
|
39
|
-
return { optedIn: false, installed: false }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
loading('configuring opencode-quota...')
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const opencodeDir = path.join(process.cwd(), '.opencode')
|
|
46
|
-
const opencodePath = path.join(opencodeDir, 'opencode.json')
|
|
47
|
-
const tuiPath = path.join(opencodeDir, 'tui.json')
|
|
48
|
-
const quotaDir = path.join(opencodeDir, 'opencode-quota')
|
|
49
|
-
const quotaPath = path.join(quotaDir, 'quota-toast.json')
|
|
50
|
-
|
|
51
|
-
const opencode = await fse.pathExists(opencodePath)
|
|
52
|
-
? await fse.readJson(opencodePath)
|
|
53
|
-
: { $schema: 'https://opencode.ai/config.json' }
|
|
54
|
-
|
|
55
|
-
const tui = await fse.pathExists(tuiPath)
|
|
56
|
-
? await fse.readJson(tuiPath)
|
|
57
|
-
: { $schema: 'https://opencode.ai/tui.json' }
|
|
58
|
-
|
|
59
|
-
ensurePlugin(opencode)
|
|
60
|
-
ensurePlugin(tui)
|
|
61
|
-
|
|
62
|
-
await fse.ensureDir(opencodeDir)
|
|
63
|
-
await fse.writeJson(opencodePath, opencode, { spaces: 2 })
|
|
64
|
-
await fse.writeJson(tuiPath, tui, { spaces: 2 })
|
|
65
|
-
|
|
66
|
-
const quotaConfig = await fse.pathExists(quotaPath)
|
|
67
|
-
? await fse.readJson(quotaPath)
|
|
68
|
-
: {}
|
|
69
|
-
|
|
70
|
-
for (const [key, value] of Object.entries(quotaPreset.defaults)) {
|
|
71
|
-
addIfMissing(quotaConfig, key, value)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
await fse.ensureDir(quotaDir)
|
|
75
|
-
await fse.writeJson(quotaPath, quotaConfig, { spaces: 2 })
|
|
76
|
-
|
|
77
|
-
success('opencode-quota configured (manual setup)')
|
|
78
|
-
info('Restart OpenCode and run /quota to verify')
|
|
79
|
-
return { optedIn: true, installed: true }
|
|
80
|
-
} catch (err) {
|
|
81
|
-
error(`Failed to configure opencode-quota: ${err.message}`)
|
|
82
|
-
return { optedIn: true, installed: false }
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
import { confirm } from '@inquirer/prompts'
|
|
2
|
+
import fse from 'fs-extra'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
import { error, header, info, loading, success, warn } from '../../utils/exec.js'
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
+
const QUOTA_PRESET_PATH = path.resolve(__dirname, '../../presets/quota.json')
|
|
9
|
+
const quotaPreset = await fse.readJson(QUOTA_PRESET_PATH)
|
|
10
|
+
const PLUGIN = quotaPreset.plugin
|
|
11
|
+
|
|
12
|
+
function ensurePlugin(config) {
|
|
13
|
+
if (!Array.isArray(config.plugin)) config.plugin = []
|
|
14
|
+
if (!config.plugin.includes(PLUGIN)) config.plugin.push(PLUGIN)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function addIfMissing(target, key, value) {
|
|
18
|
+
if (!(key in target)) target[key] = value
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function installQuota(options = {}) {
|
|
22
|
+
if (!options.skipHeader) header('Installing opencode-quota')
|
|
23
|
+
|
|
24
|
+
let shouldInstall = true
|
|
25
|
+
if (!options.skipPrompt && process.stdin.isTTY) {
|
|
26
|
+
const timeoutMs = quotaPreset.prompt.timeoutMs
|
|
27
|
+
const choice = await Promise.race([
|
|
28
|
+
confirm({
|
|
29
|
+
message: quotaPreset.prompt.message,
|
|
30
|
+
default: quotaPreset.prompt.default,
|
|
31
|
+
}),
|
|
32
|
+
new Promise(resolve => { setTimeout(() => resolve(true), timeoutMs) }),
|
|
33
|
+
])
|
|
34
|
+
shouldInstall = choice !== false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!shouldInstall) {
|
|
38
|
+
warn('Skipped opencode-quota installation')
|
|
39
|
+
return { optedIn: false, installed: false }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
loading('configuring opencode-quota...')
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const opencodeDir = path.join(process.cwd(), '.opencode')
|
|
46
|
+
const opencodePath = path.join(opencodeDir, 'opencode.json')
|
|
47
|
+
const tuiPath = path.join(opencodeDir, 'tui.json')
|
|
48
|
+
const quotaDir = path.join(opencodeDir, 'opencode-quota')
|
|
49
|
+
const quotaPath = path.join(quotaDir, 'quota-toast.json')
|
|
50
|
+
|
|
51
|
+
const opencode = await fse.pathExists(opencodePath)
|
|
52
|
+
? await fse.readJson(opencodePath)
|
|
53
|
+
: { $schema: 'https://opencode.ai/config.json' }
|
|
54
|
+
|
|
55
|
+
const tui = await fse.pathExists(tuiPath)
|
|
56
|
+
? await fse.readJson(tuiPath)
|
|
57
|
+
: { $schema: 'https://opencode.ai/tui.json' }
|
|
58
|
+
|
|
59
|
+
ensurePlugin(opencode)
|
|
60
|
+
ensurePlugin(tui)
|
|
61
|
+
|
|
62
|
+
await fse.ensureDir(opencodeDir)
|
|
63
|
+
await fse.writeJson(opencodePath, opencode, { spaces: 2 })
|
|
64
|
+
await fse.writeJson(tuiPath, tui, { spaces: 2 })
|
|
65
|
+
|
|
66
|
+
const quotaConfig = await fse.pathExists(quotaPath)
|
|
67
|
+
? await fse.readJson(quotaPath)
|
|
68
|
+
: {}
|
|
69
|
+
|
|
70
|
+
for (const [key, value] of Object.entries(quotaPreset.defaults)) {
|
|
71
|
+
addIfMissing(quotaConfig, key, value)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await fse.ensureDir(quotaDir)
|
|
75
|
+
await fse.writeJson(quotaPath, quotaConfig, { spaces: 2 })
|
|
76
|
+
|
|
77
|
+
success('opencode-quota configured (manual setup)')
|
|
78
|
+
info('Restart OpenCode and run /quota to verify')
|
|
79
|
+
return { optedIn: true, installed: true }
|
|
80
|
+
} catch (err) {
|
|
81
|
+
error(`Failed to configure opencode-quota: ${err.message}`)
|
|
82
|
+
return { optedIn: true, installed: false }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -8,6 +8,26 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
8
8
|
const SOURCE_PRESET_PATH = path.resolve(__dirname, '../../presets/source.json')
|
|
9
9
|
const sourcePreset = await fse.readJson(SOURCE_PRESET_PATH)
|
|
10
10
|
|
|
11
|
+
async function listChildFolders(cwd) {
|
|
12
|
+
const entries = await fse.readdir(cwd)
|
|
13
|
+
const dirs = []
|
|
14
|
+
|
|
15
|
+
for (const name of entries) {
|
|
16
|
+
if (name.startsWith('.')) continue
|
|
17
|
+
const abs = path.join(cwd, name)
|
|
18
|
+
try {
|
|
19
|
+
const stat = await fse.stat(abs)
|
|
20
|
+
if (!stat.isDirectory()) continue
|
|
21
|
+
dirs.push({ name, abs })
|
|
22
|
+
} catch {
|
|
23
|
+
// ignore invalid entries
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dirs.sort((a, b) => a.name.localeCompare(b.name))
|
|
28
|
+
return dirs
|
|
29
|
+
}
|
|
30
|
+
|
|
11
31
|
async function listParentFolders(cwd) {
|
|
12
32
|
const parent = path.resolve(cwd, '..')
|
|
13
33
|
const entries = await fse.readdir(parent)
|
|
@@ -47,6 +67,34 @@ export async function chooseSourceScope() {
|
|
|
47
67
|
return { sourceMode: 'current', sourceRoots: [cwd] }
|
|
48
68
|
}
|
|
49
69
|
|
|
70
|
+
if (mode === 'children') {
|
|
71
|
+
const childFolders = await listChildFolders(cwd)
|
|
72
|
+
if (childFolders.length === 0) {
|
|
73
|
+
warn('No child folders found in current directory. Falling back to current folder.')
|
|
74
|
+
success(`Source scope: ${cwd}`)
|
|
75
|
+
return { sourceMode: 'current', sourceRoots: [cwd] }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const selected = await checkbox({
|
|
79
|
+
message: sourcePreset.childrenSelectionMessage,
|
|
80
|
+
choices: childFolders.map(d => ({
|
|
81
|
+
name: `./${d.name}`,
|
|
82
|
+
value: d.abs,
|
|
83
|
+
checked: true,
|
|
84
|
+
})),
|
|
85
|
+
required: true,
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
if (!selected || selected.length === 0) {
|
|
89
|
+
warn('No folders selected. Falling back to current folder.')
|
|
90
|
+
success(`Source scope: ${cwd}`)
|
|
91
|
+
return { sourceMode: 'current', sourceRoots: [cwd] }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
success(`Source scope: ${selected.map(p => path.basename(p)).join(', ')}`)
|
|
95
|
+
return { sourceMode: 'children-selected', sourceRoots: selected }
|
|
96
|
+
}
|
|
97
|
+
|
|
50
98
|
const parentFolders = await listParentFolders(cwd)
|
|
51
99
|
if (parentFolders.length === 0) {
|
|
52
100
|
warn('No sibling folders found in parent directory. Falling back to current folder.')
|
|
@@ -1,91 +1,124 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
|
2
|
-
import fs from 'node:fs'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import os from 'node:os'
|
|
5
|
-
|
|
6
|
-
vi.mock('../../utils/exec.js', () => ({
|
|
7
|
-
header: vi.fn(),
|
|
8
|
-
info: vi.fn(),
|
|
9
|
-
success: vi.fn(),
|
|
10
|
-
warn: vi.fn(),
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
|
-
vi.mock('@inquirer/prompts', () => ({
|
|
14
|
-
select: vi.fn(),
|
|
15
|
-
checkbox: vi.fn(),
|
|
16
|
-
}))
|
|
17
|
-
|
|
18
|
-
vi.mock('fs-extra', () => ({
|
|
19
|
-
default: {
|
|
20
|
-
readJson: vi.fn().mockResolvedValue({
|
|
21
|
-
message: 'Select source scope',
|
|
22
|
-
default: 'current',
|
|
23
|
-
choices: [
|
|
24
|
-
{ name: 'Current folder', value: 'current' },
|
|
25
|
-
{ name: 'Parent folder', value: 'parent' },
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import os from 'node:os'
|
|
5
|
+
|
|
6
|
+
vi.mock('../../utils/exec.js', () => ({
|
|
7
|
+
header: vi.fn(),
|
|
8
|
+
info: vi.fn(),
|
|
9
|
+
success: vi.fn(),
|
|
10
|
+
warn: vi.fn(),
|
|
11
|
+
}))
|
|
12
|
+
|
|
13
|
+
vi.mock('@inquirer/prompts', () => ({
|
|
14
|
+
select: vi.fn(),
|
|
15
|
+
checkbox: vi.fn(),
|
|
16
|
+
}))
|
|
17
|
+
|
|
18
|
+
vi.mock('fs-extra', () => ({
|
|
19
|
+
default: {
|
|
20
|
+
readJson: vi.fn().mockResolvedValue({
|
|
21
|
+
message: 'Select source scope',
|
|
22
|
+
default: 'current',
|
|
23
|
+
choices: [
|
|
24
|
+
{ name: 'Current folder', value: 'current' },
|
|
25
|
+
{ name: 'Parent folder', value: 'parent' },
|
|
26
|
+
{ name: 'Child folders', value: 'children' },
|
|
27
|
+
],
|
|
28
|
+
parentSelectionMessage: 'Select sibling folders',
|
|
29
|
+
childrenSelectionMessage: 'Select child folders',
|
|
30
|
+
}),
|
|
31
|
+
readdir: vi.fn(),
|
|
32
|
+
stat: vi.fn().mockResolvedValue({ isDirectory: () => true }),
|
|
33
|
+
},
|
|
34
|
+
}))
|
|
35
|
+
|
|
36
|
+
import { select, checkbox } from '@inquirer/prompts'
|
|
37
|
+
import fse from 'fs-extra'
|
|
38
|
+
import { chooseSourceScope } from './index.js'
|
|
39
|
+
|
|
40
|
+
describe('chooseSourceScope()', () => {
|
|
41
|
+
let tmpDir, originalCwd
|
|
42
|
+
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
tmpDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'source-test-')))
|
|
45
|
+
originalCwd = process.cwd()
|
|
46
|
+
process.chdir(tmpDir)
|
|
47
|
+
vi.clearAllMocks()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
process.chdir(originalCwd)
|
|
52
|
+
fs.rmSync(tmpDir, { recursive: true, force: true })
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('returns current folder when user selects current mode', async () => {
|
|
56
|
+
select.mockResolvedValue('current')
|
|
57
|
+
|
|
58
|
+
const result = await chooseSourceScope()
|
|
59
|
+
|
|
60
|
+
expect(result.sourceMode).toBe('current')
|
|
61
|
+
expect(result.sourceRoots).toContain(tmpDir)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('lists parent folders when user selects parent mode', async () => {
|
|
65
|
+
select.mockResolvedValue('parent')
|
|
66
|
+
const parentDir = path.dirname(tmpDir)
|
|
67
|
+
const siblingDir = path.join(parentDir, 'sibling-project')
|
|
68
|
+
fs.mkdirSync(siblingDir, { recursive: true })
|
|
69
|
+
fse.readdir.mockResolvedValue(['sibling-project'])
|
|
70
|
+
|
|
71
|
+
await chooseSourceScope()
|
|
72
|
+
|
|
73
|
+
expect(checkbox).toHaveBeenCalled()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('falls back to current when no siblings found', async () => {
|
|
77
|
+
select.mockResolvedValue('parent')
|
|
78
|
+
fse.readdir.mockResolvedValue([])
|
|
79
|
+
|
|
80
|
+
const result = await chooseSourceScope()
|
|
81
|
+
|
|
82
|
+
expect(result.sourceMode).toBe('current')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('falls back to current when no folders selected', async () => {
|
|
86
|
+
select.mockResolvedValue('parent')
|
|
87
|
+
checkbox.mockResolvedValue([])
|
|
88
|
+
|
|
89
|
+
const result = await chooseSourceScope()
|
|
90
|
+
|
|
91
|
+
expect(result.sourceMode).toBe('current')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('lists child folders when user selects children mode', async () => {
|
|
95
|
+
select.mockResolvedValue('children')
|
|
96
|
+
fse.readdir.mockResolvedValue(['packages', 'apps'])
|
|
97
|
+
checkbox.mockResolvedValue([path.join(tmpDir, 'packages')])
|
|
98
|
+
|
|
99
|
+
const result = await chooseSourceScope()
|
|
100
|
+
|
|
101
|
+
expect(checkbox).toHaveBeenCalled()
|
|
102
|
+
expect(result.sourceMode).toBe('children-selected')
|
|
103
|
+
expect(result.sourceRoots).toContain(path.join(tmpDir, 'packages'))
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('falls back to current when no child folders found', async () => {
|
|
107
|
+
select.mockResolvedValue('children')
|
|
108
|
+
fse.readdir.mockResolvedValue([])
|
|
109
|
+
|
|
110
|
+
const result = await chooseSourceScope()
|
|
111
|
+
|
|
112
|
+
expect(result.sourceMode).toBe('current')
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('falls back to current when no child folders selected', async () => {
|
|
116
|
+
select.mockResolvedValue('children')
|
|
117
|
+
fse.readdir.mockResolvedValue(['packages'])
|
|
118
|
+
checkbox.mockResolvedValue([])
|
|
119
|
+
|
|
120
|
+
const result = await chooseSourceScope()
|
|
121
|
+
|
|
122
|
+
expect(result.sourceMode).toBe('current')
|
|
123
|
+
})
|
|
124
|
+
})
|