Files
Elydora-Node-SDK/src/plugins/augment-installation.ts
T
雷电芽衣 db4a6ffb62 chore(node-sdk): audit providers copilot droid augment cline
Providers use plugins/common.ts, shell-command.ts, and managed-runtime-status; isNodeExecutable recognizes the running executable or a node-named binary.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
2026-09-02 22:00:34 -04:00

78 lines
2.4 KiB
TypeScript

import type { InstallConfig } from './base.js';
import {
AGENT_KEY,
AUDIT_SCRIPT,
AUDIT_WRAPPER,
GUARD_SCRIPT,
GUARD_WRAPPER,
buildWrapper,
type RenderedAugmentDocument,
} from './augment-contract.js';
import {
commitManagedInstallation,
managedRuntimePaths,
preflightManagedInstallation,
prepareManagedInstallation,
type ManagedRuntimePaths,
type PreparedManagedInstallation,
type RenameFile,
} from './managed-installation.js';
const DISPLAY_NAME = 'Augment Code CLI';
const SETTINGS_DIRECTORY_LABEL = 'Auggie configuration directory';
const SETTINGS_LABEL = 'Auggie user settings';
export async function preflightAugmentInstallation(
config: InstallConfig,
settingsPath: string,
): Promise<ManagedRuntimePaths> {
return preflightManagedInstallation({
agentKey: AGENT_KEY,
hookLocations: [{ directoryLabel: SETTINGS_DIRECTORY_LABEL, filePath: settingsPath }],
config,
}, GUARD_SCRIPT, AUDIT_SCRIPT);
}
export async function prepareAugmentInstallation(
config: InstallConfig,
rendered: RenderedAugmentDocument,
): Promise<PreparedManagedInstallation> {
if (!rendered.changed && rendered.document.raw === undefined) {
throw new Error('Auggie hook installation did not produce a settings document');
}
const settingsSource = rendered.next ?? rendered.document.raw;
if (settingsSource === undefined) throw new Error('Auggie hook settings are missing');
const paths = managedRuntimePaths(config, AGENT_KEY, GUARD_SCRIPT, AUDIT_SCRIPT);
return prepareManagedInstallation({
agentKey: AGENT_KEY,
displayName: DISPLAY_NAME,
hookSources: [{
directoryLabel: SETTINGS_DIRECTORY_LABEL,
label: SETTINGS_LABEL,
filePath: rendered.document.configPath,
expectedSource: rendered.document.raw,
source: settingsSource,
}],
runtimeFiles: [{
fileName: GUARD_WRAPPER,
label: 'Auggie guard wrapper',
source: buildWrapper(paths.guardPath),
mode: 0o700,
}, {
fileName: AUDIT_WRAPPER,
label: 'Auggie audit wrapper',
source: buildWrapper(paths.auditPath),
mode: 0o700,
}],
config,
auditOptions: { nativePayload: true },
}, GUARD_SCRIPT, AUDIT_SCRIPT);
}
export async function commitAugmentInstallation(
prepared: PreparedManagedInstallation,
renameFile?: RenameFile,
): Promise<void> {
await commitManagedInstallation(prepared, renameFile);
}