feat(sdk): add developer project tooling
docs(rfc): propose SDK developer project tooling feat: rename / docs ci: fix windows gates docs: revert
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* dsh config command composition.
|
||||
*
|
||||
* @module @deepseek-ai/dsh-scripts/config
|
||||
*/
|
||||
|
||||
import {
|
||||
ClackPromptPort,
|
||||
SdkProject,
|
||||
createBuiltinRegistry,
|
||||
type PromptPort,
|
||||
} from '@deepseek-ai/dsh-helper'
|
||||
import { ConfigWorkflow, type ConfigWorkflowResult } from './config/config-workflow.ts'
|
||||
|
||||
/** Process stream slice required by dsh config. */
|
||||
export interface ConfigCommandContext {
|
||||
cwd: string
|
||||
stdin: NodeJS.ReadStream
|
||||
stdout: NodeJS.WriteStream
|
||||
port?: PromptPort
|
||||
install?: (project: SdkProject) => Promise<void>
|
||||
}
|
||||
|
||||
/** Open and interactively edit one existing SDK project. */
|
||||
export async function runConfigCommand(context: ConfigCommandContext): Promise<ConfigWorkflowResult> {
|
||||
if (!context.port && (!context.stdin.isTTY || !context.stdout.isTTY)) {
|
||||
throw new Error('dsh config requires an interactive TTY')
|
||||
}
|
||||
const project = await SdkProject.open(context.cwd)
|
||||
const registry = createBuiltinRegistry(project.profile)
|
||||
return new ConfigWorkflow(
|
||||
/* v8 ignore next -- production TTY wiring is exercised by the built-bin smoke */
|
||||
context.port ?? new ClackPromptPort(context.stdin, context.stdout),
|
||||
context.stdout,
|
||||
context.install,
|
||||
).run(project, registry)
|
||||
}
|
||||
Reference in New Issue
Block a user