Skip to content

Commit d099543

Browse files
committed
refactor: Regroup src/tools by domain
src/tools/ was grouped by three inconsistent axes: common/ (mode-independence), core/ (shared logic — the opposite meaning under a synonym), and default/+apps/ (a mode split that, post-#975, only exists for the 4 *-widget tools). Helper names misled too: build.ts fetches Actor definitions; *_common.ts double-marked "shared". Regroup into domain directories matching the toolCategories vocabulary — actors/ runs/ storage/ docs/ widgets/ — dissolving common/, core/, default/, apps/. Rename categories.ts -> registry.ts and build.ts -> actors/actor_definition.ts. Pure git mv plus import-path fixes; no logic, export, or schema changes. utils.ts and structured_output_schemas.ts stay top-level. The *_common.ts shared-logic files keep their suffix inside the new domain dirs: dropping it collides with the sibling tool-entry file (e.g. search_actors.ts), and merging the two would be a logic change, not a move. Export/file-name normalization and any _common merge are left to the follow-up naming PR (#977). Anchor the .gitignore "storage" rule to "/storage" so it ignores only the repo-root Apify local-storage dir, not the new src/tools/storage/ source directory. Closes #978. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HbBNrt49Pp92M9ebUwoWu4
1 parent aff38f4 commit d099543

72 files changed

Lines changed: 120 additions & 115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.vscode/*
55
!.vscode/extensions.json
66
!.vscode/settings.json
7-
storage
7+
/storage
88
apify_storage
99
crawlee_storage
1010
node_modules

src/index_internals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { processParamsGetTools } from './mcp/utils.js';
88
import { resolvePaymentProvider } from './payments/index.js';
99
import type { PaymentProvider } from './payments/types.js';
1010
import { getServerCard } from './server_card.js';
11-
import { addTool } from './tools/common/add_actor.js';
11+
import { addTool } from './tools/actors/add_actor.js';
1212
import {
1313
getActorsAsTools,
1414
getCategoryTools,

src/mcp/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ import type { AvailableWidget } from '../resources/widgets.js';
6363
import { resolveAvailableWidgets } from '../resources/widgets.js';
6464
import { getServerInfo } from '../server_card.js';
6565
import { getTelemetryEnv, trackToolCall } from '../telemetry.js';
66-
import { actorExecutor } from '../tools/actor_executor.js';
66+
import { actorExecutor } from '../tools/actors/actor_executor.js';
6767
import {
6868
buildPermissionApprovalResponse,
6969
checkPaymentProviderStandbyConflict,
70-
} from '../tools/core/call_actor_common.js';
70+
} from '../tools/actors/call_actor_common.js';
7171
import { getActorsAsTools } from '../tools/index.js';
7272
import type { ActorsAsToolsResult } from '../tools/index.js';
7373
import { decodeDotPropertyNames, legacyToolNameToNew } from '../tools/utils.js';

src/tools/AGENTS.md

Lines changed: 10 additions & 5 deletions
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { ApifyClient } from '../apify_client.js';
2-
import { ACTOR_README_MAX_LENGTH } from '../const.js';
1+
import type { ApifyClient } from '../../apify_client.js';
2+
import { ACTOR_README_MAX_LENGTH } from '../../const.js';
33
import type {
44
ActorDefinitionPruned,
55
ActorDefinitionWithDesc,
66
ActorDefinitionWithInfo,
77
SchemaProperties,
8-
} from '../types.js';
8+
} from '../../types.js';
99

1010
/**
1111
* Get Actor input schema by Actor name.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import log from '@apify/log';
22

3-
import type { ActorExecutionParams, ActorExecutionResult, ActorExecutor } from '../types.js';
4-
import { getConsoleLinkContext } from '../utils/console_link.js';
5-
import { redactSkyfirePayId } from '../utils/logging.js';
6-
import { abortRunOnSignal, CALL_ACTOR_WAIT_SECS_DEFAULT, fetchActorRunData } from './core/actor_run_response.js';
7-
import { buildGetActorRunSuccessResponse } from './core/get_actor_run_common.js';
3+
import type { ActorExecutionParams, ActorExecutionResult, ActorExecutor } from '../../types.js';
4+
import { getConsoleLinkContext } from '../../utils/console_link.js';
5+
import { redactSkyfirePayId } from '../../utils/logging.js';
6+
import { buildGetActorRunSuccessResponse } from '../runs/get_actor_run_common.js';
7+
import { abortRunOnSignal, CALL_ACTOR_WAIT_SECS_DEFAULT, fetchActorRunData } from './actor_run_response.js';
88

99
/**
1010
* Direct actor tool executor. Mode-agnostic — used in both default and apps modes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { HelperTools } from '../../const.js';
22
import type { InternalToolArgs, ToolEntry } from '../../types.js';
33
import { TOOL_TYPE } from '../../types.js';
4+
import { actorRunOutputSchema } from '../structured_output_schemas.js';
45
import {
56
buildCallActorAppsDescription,
67
buildCallActorDescription,
78
callActorAjvValidate,
89
callActorInputSchema,
910
executeCallActor,
10-
} from '../core/call_actor_common.js';
11-
import { actorRunOutputSchema } from '../structured_output_schemas.js';
11+
} from './call_actor_common.js';
1212

1313
/**
1414
* Single call-actor definition shared by both modes — only the description differs

0 commit comments

Comments
 (0)