mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
chore(deadcode): remove unused CLI helper exports
This commit is contained in:
parent
6fa05685ea
commit
e02e3d6971
3 changed files with 38 additions and 47 deletions
|
|
@ -131,7 +131,6 @@ const config = {
|
|||
"src/shared/text/assistant-visible-text.ts",
|
||||
bundledPluginFile("telegram", "src/bot/reply-threading.ts"),
|
||||
bundledPluginFile("telegram", "src/draft-chunking.ts"),
|
||||
bundledPluginFile("voice-call", "src/providers/index.ts"),
|
||||
],
|
||||
ignore: ["packages/*/dist/**"],
|
||||
workspaces: {
|
||||
|
|
|
|||
|
|
@ -14,22 +14,6 @@ function mapAgentSessionDirs(agentsDir: string, entries: Dirent[]): string[] {
|
|||
.toSorted((a, b) => a.localeCompare(b));
|
||||
}
|
||||
|
||||
/** Lists per-agent session directories under an agents state directory. */
|
||||
export async function resolveAgentSessionDirsFromAgentsDir(agentsDir: string): Promise<string[]> {
|
||||
let entries: Dirent[];
|
||||
try {
|
||||
entries = await fs.readdir(agentsDir, { withFileTypes: true });
|
||||
} catch (err) {
|
||||
const code = (err as { code?: string }).code;
|
||||
if (code === "ENOENT") {
|
||||
return [];
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
return mapAgentSessionDirs(agentsDir, entries);
|
||||
}
|
||||
|
||||
/** Synchronous variant of per-agent session directory discovery. */
|
||||
export function resolveAgentSessionDirsFromAgentsDirSync(agentsDir: string): string[] {
|
||||
let entries: Dirent[];
|
||||
|
|
@ -48,5 +32,17 @@ export function resolveAgentSessionDirsFromAgentsDirSync(agentsDir: string): str
|
|||
|
||||
/** Lists per-agent session directories under a state directory. */
|
||||
export async function resolveAgentSessionDirs(stateDir: string): Promise<string[]> {
|
||||
return await resolveAgentSessionDirsFromAgentsDir(path.join(stateDir, "agents"));
|
||||
const agentsDir = path.join(stateDir, "agents");
|
||||
let entries: Dirent[];
|
||||
try {
|
||||
entries = await fs.readdir(agentsDir, { withFileTypes: true });
|
||||
} catch (err) {
|
||||
const code = (err as { code?: string }).code;
|
||||
if (code === "ENOENT") {
|
||||
return [];
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
return mapAgentSessionDirs(agentsDir, entries);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,31 +42,7 @@ function loadPrecomputedHelpText(
|
|||
return null;
|
||||
}
|
||||
|
||||
export function loadPrecomputedRootHelpText(): string | null {
|
||||
return loadPrecomputedHelpText("rootHelpText", precomputedRootHelpText, (value) => {
|
||||
precomputedRootHelpText = value;
|
||||
});
|
||||
}
|
||||
|
||||
export function loadPrecomputedBrowserHelpText(): string | null {
|
||||
return loadPrecomputedHelpText("browserHelpText", precomputedBrowserHelpText, (value) => {
|
||||
precomputedBrowserHelpText = value;
|
||||
});
|
||||
}
|
||||
|
||||
export function loadPrecomputedSecretsHelpText(): string | null {
|
||||
return loadPrecomputedHelpText("secretsHelpText", precomputedSecretsHelpText, (value) => {
|
||||
precomputedSecretsHelpText = value;
|
||||
});
|
||||
}
|
||||
|
||||
export function loadPrecomputedNodesHelpText(): string | null {
|
||||
return loadPrecomputedHelpText("nodesHelpText", precomputedNodesHelpText, (value) => {
|
||||
precomputedNodesHelpText = value;
|
||||
});
|
||||
}
|
||||
|
||||
export function loadPrecomputedSubcommandHelpText(commandName: string): string | null {
|
||||
function loadPrecomputedSubcommandHelpText(commandName: string): string | null {
|
||||
if (!isPrecomputedSubcommandHelpName(commandName)) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -92,7 +68,9 @@ export function loadPrecomputedSubcommandHelpText(commandName: string): string |
|
|||
}
|
||||
|
||||
export function outputPrecomputedRootHelpText(): boolean {
|
||||
const rootHelpText = loadPrecomputedRootHelpText();
|
||||
const rootHelpText = loadPrecomputedHelpText("rootHelpText", precomputedRootHelpText, (value) => {
|
||||
precomputedRootHelpText = value;
|
||||
});
|
||||
if (!rootHelpText) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -101,7 +79,13 @@ export function outputPrecomputedRootHelpText(): boolean {
|
|||
}
|
||||
|
||||
export function outputPrecomputedBrowserHelpText(): boolean {
|
||||
const browserHelpText = loadPrecomputedBrowserHelpText();
|
||||
const browserHelpText = loadPrecomputedHelpText(
|
||||
"browserHelpText",
|
||||
precomputedBrowserHelpText,
|
||||
(value) => {
|
||||
precomputedBrowserHelpText = value;
|
||||
},
|
||||
);
|
||||
if (!browserHelpText) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -110,7 +94,13 @@ export function outputPrecomputedBrowserHelpText(): boolean {
|
|||
}
|
||||
|
||||
export function outputPrecomputedSecretsHelpText(): boolean {
|
||||
const secretsHelpText = loadPrecomputedSecretsHelpText();
|
||||
const secretsHelpText = loadPrecomputedHelpText(
|
||||
"secretsHelpText",
|
||||
precomputedSecretsHelpText,
|
||||
(value) => {
|
||||
precomputedSecretsHelpText = value;
|
||||
},
|
||||
);
|
||||
if (!secretsHelpText) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -119,7 +109,13 @@ export function outputPrecomputedSecretsHelpText(): boolean {
|
|||
}
|
||||
|
||||
export function outputPrecomputedNodesHelpText(): boolean {
|
||||
const nodesHelpText = loadPrecomputedNodesHelpText();
|
||||
const nodesHelpText = loadPrecomputedHelpText(
|
||||
"nodesHelpText",
|
||||
precomputedNodesHelpText,
|
||||
(value) => {
|
||||
precomputedNodesHelpText = value;
|
||||
},
|
||||
);
|
||||
if (!nodesHelpText) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue