-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin.config.ts
More file actions
74 lines (69 loc) · 2.42 KB
/
plugin.config.ts
File metadata and controls
74 lines (69 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
import type {PipelineConfig, RuntimeCommand} from '@truenine/memory-sync-sdk'
import process from 'node:process'
import {
AgentsOutputPlugin,
ClaudeCodeCLIOutputPlugin,
CodexCLIOutputPlugin,
CursorOutputPlugin,
defineConfig,
DroidCLIOutputPlugin,
GeminiCLIOutputPlugin,
GitExcludeOutputPlugin,
JetBrainsAIAssistantCodexOutputPlugin,
JetBrainsIDECodeStyleConfigOutputPlugin,
KiroCLIOutputPlugin,
OpencodeCLIOutputPlugin,
QoderIDEPluginOutputPlugin,
ReadmeMdConfigFileOutputPlugin,
TraeCNIDEOutputPlugin,
TraeIDEOutputPlugin,
VisualStudioCodeIDEConfigOutputPlugin,
WarpIDEOutputPlugin,
WindsurfOutputPlugin,
ZedIDEConfigOutputPlugin
} from '@truenine/memory-sync-sdk'
type DefineConfigWithOutputPlugins = Parameters<typeof defineConfig>[0] & {
readonly outputPlugins: PipelineConfig['outputPlugins']
}
export function resolveRuntimeCommandFromArgv(argv: readonly string[] = process.argv): RuntimeCommand {
const args = argv.filter((arg): arg is string => arg != null)
const userArgs = args.slice(2)
const subcommand = userArgs.find(arg => !arg.startsWith('-'))
if (subcommand === 'plugins') return 'plugins'
if (subcommand === 'clean') return 'clean'
if (subcommand === 'dry-run' || userArgs.includes('--dry-run') || userArgs.includes('-n')) return 'dry-run'
return 'execute'
}
export async function createDefaultPluginConfig(
argv: readonly string[] = process.argv,
runtimeCommand: RuntimeCommand = resolveRuntimeCommandFromArgv(argv),
executionCwd: string = process.cwd()
): Promise<PipelineConfig> {
const outputPlugins: PipelineConfig['outputPlugins'] = [
new AgentsOutputPlugin(),
new ClaudeCodeCLIOutputPlugin(),
new CodexCLIOutputPlugin(),
new JetBrainsAIAssistantCodexOutputPlugin(),
new DroidCLIOutputPlugin(),
new GeminiCLIOutputPlugin(),
new KiroCLIOutputPlugin(),
new OpencodeCLIOutputPlugin(),
new QoderIDEPluginOutputPlugin(),
new TraeIDEOutputPlugin(),
new TraeCNIDEOutputPlugin(),
new WarpIDEOutputPlugin(),
new WindsurfOutputPlugin(),
new CursorOutputPlugin(),
new GitExcludeOutputPlugin(),
new JetBrainsIDECodeStyleConfigOutputPlugin(),
new VisualStudioCodeIDEConfigOutputPlugin(),
new ZedIDEConfigOutputPlugin(),
new ReadmeMdConfigFileOutputPlugin()
]
return defineConfig({
executionCwd,
runtimeCommand,
outputPlugins
} as DefineConfigWithOutputPlugins)
}
export default createDefaultPluginConfig