mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 08:41:18 +00:00
refactor(deadcode): trim mid-size src exports (#105888)
* refactor(deadcode): trim auto-reply and CLI exports * refactor(deadcode): trim cron and task exports * refactor(deadcode): trim fleet and process exports * test(deadcode): exercise live task and process seams * test(fleet): cover stream redaction through owner module * refactor(security): trim dead internal exports * refactor(secrets): trim dead internal exports * refactor(deadcode): trim remaining src exports * refactor(deadcode): remove test-only runtime exports * refactor(deadcode): trim pairing test exports * refactor(deadcode): reconcile refreshed baseline * test(auto-reply): deduplicate queue state imports
This commit is contained in:
committed by
GitHub
parent
0ab7e2569b
commit
e2ec8283c4
@@ -4,12 +4,12 @@ import { sanitizeForLog } from "../../../packages/terminal-core/src/ansi.js";
|
||||
import type { NamedCommandDescriptor } from "./command-group-descriptors.js";
|
||||
|
||||
/** Minimal descriptor shape used before a command is fully registered. */
|
||||
export type CommandDescriptorLike = Pick<NamedCommandDescriptor, "name" | "description">;
|
||||
type CommandDescriptorLike = Pick<NamedCommandDescriptor, "name" | "description">;
|
||||
|
||||
const SAFE_COMMAND_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
||||
|
||||
/** Descriptor catalog plus derived name lists used by lazy command registration. */
|
||||
export type CommandDescriptorCatalog<TDescriptor extends NamedCommandDescriptor> = {
|
||||
type CommandDescriptorCatalog<TDescriptor extends NamedCommandDescriptor> = {
|
||||
descriptors: readonly TDescriptor[];
|
||||
getDescriptors: () => readonly TDescriptor[];
|
||||
getNames: () => string[];
|
||||
|
||||
@@ -16,7 +16,7 @@ export type CommandGroupDescriptorSpec<TRegister> = {
|
||||
};
|
||||
|
||||
/** Resolved group entry after descriptor lookup. */
|
||||
export type ResolvedCommandGroupEntry<TDescriptor extends NamedCommandDescriptor, TRegister> = {
|
||||
type ResolvedCommandGroupEntry<TDescriptor extends NamedCommandDescriptor, TRegister> = {
|
||||
placeholders: TDescriptor[];
|
||||
register: TRegister;
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
type CommandGroupEntry,
|
||||
} from "./register-command-groups.js";
|
||||
|
||||
export { getCoreCliCommandDescriptors, getCoreCliCommandsWithSubcommands };
|
||||
export { getCoreCliCommandsWithSubcommands };
|
||||
|
||||
type CommandRegisterParams = {
|
||||
program: Command;
|
||||
@@ -28,11 +28,6 @@ type CommandRegisterParams = {
|
||||
argv: string[];
|
||||
};
|
||||
|
||||
export type CommandRegistration = {
|
||||
id: string;
|
||||
register: (params: CommandRegisterParams) => void;
|
||||
};
|
||||
|
||||
function withProgramOnlySpecs(
|
||||
specs: readonly CommandGroupDescriptorSpec<(program: Command) => Promise<void> | void>[],
|
||||
): CommandGroupDescriptorSpec<(params: CommandRegisterParams) => Promise<void>>[] {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
// Program command registry facade: exports core descriptors and registers core plus sub-CLIs.
|
||||
import type { Command } from "commander";
|
||||
import {
|
||||
getCoreCliCommandDescriptors,
|
||||
getCoreCliCommandNames,
|
||||
getCoreCliCommandsWithSubcommands,
|
||||
type CommandRegistration,
|
||||
registerCoreCliByName,
|
||||
registerCoreCliCommands,
|
||||
} from "./command-registry-core.js";
|
||||
@@ -12,16 +10,12 @@ import type { ProgramContext } from "./context.js";
|
||||
import { registerSubCliCommands } from "./register.subclis.js";
|
||||
|
||||
export {
|
||||
getCoreCliCommandDescriptors,
|
||||
getCoreCliCommandNames,
|
||||
getCoreCliCommandsWithSubcommands,
|
||||
registerCoreCliByName,
|
||||
registerCoreCliCommands,
|
||||
};
|
||||
|
||||
/** Core command registration contract re-exported for program builders and tests. */
|
||||
export type { CommandRegistration };
|
||||
|
||||
/** Register all root-program commands for the current argv shape. */
|
||||
export function registerProgramCommands(
|
||||
program: Command,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineCommandDescriptorCatalog } from "./command-descriptor-utils.js";
|
||||
import type { NamedCommandDescriptor } from "./command-group-descriptors.js";
|
||||
|
||||
/** Descriptor shape for root commands owned by the core CLI. */
|
||||
export type CoreCliCommandDescriptor = NamedCommandDescriptor;
|
||||
type CoreCliCommandDescriptor = NamedCommandDescriptor;
|
||||
|
||||
const coreCliCommandCatalog = defineCommandDescriptorCatalog([
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ export type CommandGroupPlaceholder = {
|
||||
};
|
||||
|
||||
/** Commander option metadata attached to a lazy placeholder. */
|
||||
export type CommandGroupPlaceholderOption = {
|
||||
type CommandGroupPlaceholderOption = {
|
||||
flags: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
@@ -20,13 +20,10 @@ import {
|
||||
type CommandGroupEntry,
|
||||
} from "./register-command-groups.js";
|
||||
import {
|
||||
getSubCliCommandsWithSubcommands,
|
||||
getSubCliEntries as getSubCliEntryDescriptors,
|
||||
type SubCliDescriptor,
|
||||
} from "./subcli-descriptors.js";
|
||||
|
||||
export { getSubCliCommandsWithSubcommands };
|
||||
|
||||
export type SubCliRegistrationContext = {
|
||||
purpose?: "runtime" | "completion";
|
||||
};
|
||||
|
||||
@@ -21,13 +21,10 @@ import {
|
||||
type SubCliRegistrationContext,
|
||||
} from "./register.subclis-core.js";
|
||||
import {
|
||||
getSubCliCommandsWithSubcommands,
|
||||
getSubCliEntries as getSubCliEntryDescriptors,
|
||||
type SubCliDescriptor,
|
||||
} from "./subcli-descriptors.js";
|
||||
|
||||
export { getSubCliCommandsWithSubcommands };
|
||||
|
||||
type SubCliRegistrar = (
|
||||
program: Command,
|
||||
argv: string[],
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
// registered Commander commands. Keep those user-facing descriptions aligned.
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
getCoreCliCommandDescriptors,
|
||||
getCoreCliCommandNames,
|
||||
registerCoreCliByName,
|
||||
} from "./command-registry-core.js";
|
||||
import { getCoreCliCommandNames, registerCoreCliByName } from "./command-registry-core.js";
|
||||
import { createProgramContext } from "./context.js";
|
||||
import { getCoreCliCommandDescriptors } from "./core-command-descriptors.js";
|
||||
import { getSubCliEntries, registerSubCliByName } from "./register.subclis.js";
|
||||
|
||||
describe("root command descriptions", () => {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { routedCommands, type RouteSpec } from "./route-specs.js";
|
||||
|
||||
/** Routed command contract re-exported for callers that only need route lookup. */
|
||||
export type { RouteSpec } from "./route-specs.js";
|
||||
|
||||
/** Find the first route matching a command path and parseable argv. */
|
||||
export function findRoutedCommand(path: string[], argv?: string[]): RouteSpec | null {
|
||||
|
||||
Reference in New Issue
Block a user