feat(core): add SSH data access proxy CLI and core managers

This commit is contained in:
2026-05-30 10:02:08 +00:00
commit 47d9846c93
23 changed files with 10399 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { SshConfig } from './classes.sshconfig.js';
import { SshConfigWriter } from './classes.sshconfigwriter.js';
import type {
IHostDefinition,
IHostUpdatePreview,
IHostWriteResult,
ISshConfigHost,
ISshConfigOptions,
} from './types.js';
export class HostManager {
private sshConfig: SshConfig;
private sshConfigWriter: SshConfigWriter;
constructor(options: ISshConfigOptions = {}) {
this.sshConfig = new SshConfig(options);
this.sshConfigWriter = new SshConfigWriter(options);
}
public async listHosts(): Promise<ISshConfigHost[]> {
const result = await this.sshConfig.read();
return this.sshConfig.getDisplayHosts(result);
}
public async getHost(alias: string): Promise<ISshConfigHost | undefined> {
return this.sshConfig.getHost(alias);
}
public async addHost(hostDefinition: IHostDefinition): Promise<IHostWriteResult> {
return this.sshConfigWriter.addOrReplaceManagedHost(hostDefinition);
}
public async previewEditHost(
alias: string,
changes: Partial<IHostDefinition>
): Promise<IHostUpdatePreview> {
return this.sshConfigWriter.previewUpdateHost(alias, changes);
}
public async editHost(alias: string, changes: Partial<IHostDefinition>): Promise<IHostWriteResult> {
return this.sshConfigWriter.updateHost(alias, changes);
}
}