chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.

This commit is contained in:
cpojer
2026-02-01 10:03:47 +09:00
parent ad943bd8cf
commit f06dd8df06
1778 changed files with 2949 additions and 4242 deletions

View File

@@ -1,8 +1,8 @@
import type { CliDeps } from "../../../cli/deps.js";
import { createDefaultDeps } from "../../../cli/deps.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { runBootOnce } from "../../../gateway/boot.js";
import type { HookHandler } from "../../hooks.js";
import { createDefaultDeps } from "../../../cli/deps.js";
import { runBootOnce } from "../../../gateway/boot.js";
type BootHookContext = {
cfg?: OpenClawConfig;

View File

@@ -24,8 +24,8 @@
*/
import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import path from "node:path";
import type { HookHandler } from "../../hooks.js";
/**

View File

@@ -1,12 +1,10 @@
import fs from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import handler from "./handler.js";
import { createHookEvent } from "../../hooks.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
import { createHookEvent } from "../../hooks.js";
import handler from "./handler.js";
/**
* Create a mock session JSONL file with various entry types

View File

@@ -6,14 +6,14 @@
*/
import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import type { OpenClawConfig } from "../../../config/config.js";
import type { HookHandler } from "../../hooks.js";
import { resolveAgentWorkspaceDir } from "../../../agents/agent-scope.js";
import { resolveAgentIdFromSessionKey } from "../../../routing/session-key.js";
import { resolveHookConfig } from "../../config.js";
import type { HookHandler } from "../../hooks.js";
/**
* Read recent messages from session file for slug generation

View File

@@ -1,12 +1,10 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import handler from "./handler.js";
import { createHookEvent } from "../../hooks.js";
import type { AgentBootstrapHookContext } from "../../hooks.js";
import type { OpenClawConfig } from "../../../config/config.js";
import type { AgentBootstrapHookContext } from "../../hooks.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
import { createHookEvent } from "../../hooks.js";
import handler from "./handler.js";
describe("soul-evil hook", () => {
it("skips subagent sessions", async () => {

View File

@@ -1,8 +1,8 @@
import fs from "node:fs";
import path from "node:path";
import type { OpenClawConfig, HookConfig } from "../config/config.js";
import { resolveHookKey } from "./frontmatter.js";
import type { HookEligibilityContext, HookEntry } from "./types.js";
import { resolveHookKey } from "./frontmatter.js";
const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
"browser.enabled": true,

View File

@@ -1,8 +1,4 @@
import JSON5 from "json5";
import { LEGACY_MANIFEST_KEYS, MANIFEST_KEY } from "../compat/legacy-names.js";
import { parseFrontmatterBlock } from "../markdown/frontmatter.js";
import { parseBooleanValue } from "../utils/boolean.js";
import type {
OpenClawHookMetadata,
HookEntry,
@@ -10,6 +6,9 @@ import type {
HookInvocationPolicy,
ParsedHookFrontmatter,
} from "./types.js";
import { LEGACY_MANIFEST_KEYS, MANIFEST_KEY } from "../compat/legacy-names.js";
import { parseFrontmatterBlock } from "../markdown/frontmatter.js";
import { parseBooleanValue } from "../utils/boolean.js";
export function parseFrontmatter(content: string): ParsedHookFrontmatter {
return parseFrontmatterBlock(content);

View File

@@ -1,5 +1,5 @@
import { spawn } from "node:child_process";
import { formatCliCommand } from "../cli/command-format.js";
import {
type OpenClawConfig,
CONFIG_PATH,
@@ -11,8 +11,16 @@ import {
} from "../config/config.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { defaultRuntime } from "../runtime.js";
import { formatCliCommand } from "../cli/command-format.js";
import { displayPath } from "../utils.js";
import {
ensureDependency,
ensureGcloudAuth,
ensureSubscription,
ensureTailscaleEndpoint,
ensureTopic,
resolveProjectIdFromGogCredentials,
runGcloud,
} from "./gmail-setup-utils.js";
import {
buildDefaultHookUrl,
buildGogWatchServeArgs,
@@ -35,15 +43,6 @@ import {
parseTopicPath,
resolveGmailHookRuntimeConfig,
} from "./gmail.js";
import {
ensureDependency,
ensureGcloudAuth,
ensureSubscription,
ensureTailscaleEndpoint,
ensureTopic,
resolveProjectIdFromGogCredentials,
runGcloud,
} from "./gmail-setup-utils.js";
export type GmailSetupOptions = {
account: string;

View File

@@ -1,7 +1,6 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { beforeEach, describe, expect, it, vi } from "vitest";
const itUnix = process.platform === "win32" ? it.skip : it;

View File

@@ -1,6 +1,5 @@
import fs from "node:fs";
import path from "node:path";
import { hasBinary } from "../agents/skills.js";
import { runCommandWithTimeout, type SpawnResult } from "../process/exec.js";
import { resolveUserPath } from "../utils.js";

View File

@@ -6,17 +6,17 @@
*/
import { type ChildProcess, spawn } from "node:child_process";
import { hasBinary } from "../agents/skills.js";
import type { OpenClawConfig } from "../config/config.js";
import { hasBinary } from "../agents/skills.js";
import { createSubsystemLogger } from "../logging/subsystem.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { ensureTailscaleEndpoint } from "./gmail-setup-utils.js";
import {
buildGogWatchServeArgs,
buildGogWatchStartArgs,
type GmailHookRuntimeConfig,
resolveGmailHookRuntimeConfig,
} from "./gmail.js";
import { ensureTailscaleEndpoint } from "./gmail-setup-utils.js";
const log = createSubsystemLogger("gmail-watcher");

View File

@@ -1,5 +1,4 @@
import { randomBytes } from "node:crypto";
import {
type OpenClawConfig,
DEFAULT_GATEWAY_PORT,

View File

@@ -1,9 +1,8 @@
import path from "node:path";
import type { OpenClawConfig } from "../config/config.js";
import type { HookEligibilityContext, HookEntry, HookInstallSpec } from "./types.js";
import { CONFIG_DIR } from "../utils.js";
import { hasBinary, isConfigPathTruthy, resolveConfigPath, resolveHookConfig } from "./config.js";
import type { HookEligibilityContext, HookEntry, HookInstallSpec } from "./types.js";
import { loadWorkspaceHookEntries } from "./workspace.js";
export type HookStatusConfigCheck = {

View File

@@ -1,8 +1,8 @@
import JSZip from "jszip";
import { randomUUID } from "node:crypto";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import JSZip from "jszip";
import * as tar from "tar";
import { afterEach, describe, expect, it } from "vitest";

View File

@@ -1,10 +1,7 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { MANIFEST_KEY } from "../compat/legacy-names.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
import {
extractArchive,
fileExists,
@@ -12,6 +9,8 @@ import {
resolveArchiveKind,
resolvePackedRootDir,
} from "../infra/archive.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
import { parseFrontmatter } from "./frontmatter.js";
export type HookInstallLogger = {

View File

@@ -5,13 +5,13 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import type { OpenClawConfig } from "../config/config.js";
import {
resolveDefaultAgentId,
resolveAgentWorkspaceDir,
resolveAgentDir,
} from "../agents/agent-scope.js";
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
/**
* Generate a short 1-2 word filename slug from session content using LLM

View File

@@ -2,14 +2,14 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { loadInternalHooks } from "./loader.js";
import type { OpenClawConfig } from "../config/config.js";
import {
clearInternalHooks,
getRegisteredEventKeys,
triggerInternalHook,
createInternalHookEvent,
} from "./internal-hooks.js";
import type { OpenClawConfig } from "../config/config.js";
import { loadInternalHooks } from "./loader.js";
describe("loader", () => {
let tmpDir: string;

View File

@@ -5,14 +5,14 @@
* and from directory-based discovery (bundled, managed, workspace)
*/
import { pathToFileURL } from "node:url";
import path from "node:path";
import { registerInternalHook } from "./internal-hooks.js";
import { pathToFileURL } from "node:url";
import type { OpenClawConfig } from "../config/config.js";
import type { InternalHookHandler } from "./internal-hooks.js";
import { loadWorkspaceHookEntries } from "./workspace.js";
import { resolveHookConfig } from "./config.js";
import { shouldIncludeHook } from "./config.js";
import { registerInternalHook } from "./internal-hooks.js";
import { loadWorkspaceHookEntries } from "./workspace.js";
/**
* Load and register all hook handlers

View File

@@ -1,11 +1,10 @@
import path from "node:path";
import { pathToFileURL } from "node:url";
import type { OpenClawPluginApi } from "../plugins/types.js";
import type { InternalHookHandler } from "./internal-hooks.js";
import type { HookEntry } from "./types.js";
import { shouldIncludeHook } from "./config.js";
import { loadHookEntriesFromDir } from "./workspace.js";
import type { InternalHookHandler } from "./internal-hooks.js";
export type PluginHookLoadResult = {
hooks: HookEntry[];

View File

@@ -1,15 +1,13 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import { DEFAULT_SOUL_FILENAME, type WorkspaceBootstrapFile } from "../agents/workspace.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../test-helpers/workspace.js";
import {
applySoulEvilOverride,
decideSoulEvil,
DEFAULT_SOUL_EVIL_FILENAME,
resolveSoulEvilConfigFromHook,
} from "./soul-evil.js";
import { DEFAULT_SOUL_FILENAME, type WorkspaceBootstrapFile } from "../agents/workspace.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../test-helpers/workspace.js";
const makeFiles = (overrides?: Partial<WorkspaceBootstrapFile>) => [
{

View File

@@ -1,8 +1,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { resolveUserTimezone } from "../agents/date-time.js";
import type { WorkspaceBootstrapFile } from "../agents/workspace.js";
import { resolveUserTimezone } from "../agents/date-time.js";
import { parseDurationMs } from "../cli/parse-duration.js";
import { resolveUserPath } from "../utils.js";

View File

@@ -1,16 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { MANIFEST_KEY } from "../compat/legacy-names.js";
import type { OpenClawConfig } from "../config/config.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
import { resolveBundledHooksDir } from "./bundled-dir.js";
import { shouldIncludeHook } from "./config.js";
import {
parseFrontmatter,
resolveOpenClawMetadata,
resolveHookInvocationPolicy,
} from "./frontmatter.js";
import type {
Hook,
HookEligibilityContext,
@@ -19,6 +9,15 @@ import type {
HookSource,
ParsedHookFrontmatter,
} from "./types.js";
import { MANIFEST_KEY } from "../compat/legacy-names.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
import { resolveBundledHooksDir } from "./bundled-dir.js";
import { shouldIncludeHook } from "./config.js";
import {
parseFrontmatter,
resolveOpenClawMetadata,
resolveHookInvocationPolicy,
} from "./frontmatter.js";
type HookPackageManifest = {
name?: string;