@webiny/mcp 6.0.0-rc.7 → 6.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/claude.d.ts +2 -2
- package/agents/claude.js.map +1 -1
- package/agents/cline.d.ts +2 -2
- package/agents/cline.js.map +1 -1
- package/agents/copilot.d.ts +2 -2
- package/agents/copilot.js +1 -1
- package/agents/copilot.js.map +1 -1
- package/agents/cursor.d.ts +2 -2
- package/agents/cursor.js.map +1 -1
- package/agents/instructions.js +1 -1
- package/agents/instructions.js.map +1 -1
- package/agents/kiro.d.ts +15 -0
- package/agents/kiro.js +33 -0
- package/agents/kiro.js.map +1 -0
- package/agents/opencode.d.ts +22 -0
- package/agents/opencode.js +76 -0
- package/agents/opencode.js.map +1 -0
- package/agents/shared.d.ts +5 -5
- package/agents/shared.js +3 -3
- package/agents/shared.js.map +1 -1
- package/agents/windsurf.d.ts +2 -2
- package/agents/windsurf.js.map +1 -1
- package/bin.d.ts +2 -0
- package/bin.js +4 -0
- package/bin.js.map +1 -0
- package/cli/ConfigureMcp.d.ts +7 -14
- package/cli/ConfigureMcp.js +24 -52
- package/cli/ConfigureMcp.js.map +1 -1
- package/cli/McpServer.d.ts +3 -10
- package/cli/McpServer.js +83 -109
- package/cli/McpServer.js.map +1 -1
- package/cli.d.ts +1 -0
- package/cli.js +60 -0
- package/cli.js.map +1 -0
- package/index.d.ts +6 -1
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/package.json +11 -23
- package/skills/admin/admin-architect/SKILL.md +389 -0
- package/skills/admin/ui-extensions/SKILL.md +268 -0
- package/skills/api/api-architect/SKILL.md +189 -0
- package/skills/api/custom-field-type/SKILL.md +263 -0
- package/skills/api/event-handler-pattern/SKILL.md +131 -0
- package/skills/{custom-graphql-api → api/graphql-api}/SKILL.md +3 -3
- package/skills/api/use-case-pattern/SKILL.md +102 -0
- package/skills/cli-extensions/SKILL.md +45 -47
- package/skills/configure-auth0/SKILL.md +4 -4
- package/skills/configure-okta/SKILL.md +3 -3
- package/skills/content-models/SKILL.md +197 -196
- package/skills/dependency-injection/SKILL.md +9 -219
- package/skills/full-stack-architect/SKILL.md +195 -0
- package/skills/generated/admin/SKILL.md +119 -0
- package/skills/generated/admin/aco/SKILL.md +28 -0
- package/skills/generated/admin/build-params/SKILL.md +33 -0
- package/skills/generated/admin/cms/SKILL.md +342 -0
- package/skills/generated/admin/configs/SKILL.md +23 -0
- package/skills/generated/admin/env-config/SKILL.md +30 -0
- package/skills/generated/admin/form/SKILL.md +88 -0
- package/skills/generated/admin/graphql-client/SKILL.md +23 -0
- package/skills/generated/admin/lexical/SKILL.md +105 -0
- package/skills/generated/admin/local-storage/SKILL.md +42 -0
- package/skills/generated/admin/router/SKILL.md +48 -0
- package/skills/generated/admin/security/SKILL.md +63 -0
- package/skills/generated/admin/tenancy/SKILL.md +64 -0
- package/skills/generated/admin/ui/SKILL.md +468 -0
- package/skills/generated/admin/website-builder/SKILL.md +318 -0
- package/skills/generated/api/SKILL.md +40 -0
- package/skills/generated/api/aco/SKILL.md +202 -0
- package/skills/generated/api/build-params/SKILL.md +31 -0
- package/skills/generated/api/cms/SKILL.md +646 -0
- package/skills/generated/api/event-publisher/SKILL.md +31 -0
- package/skills/generated/api/file-manager/SKILL.md +189 -0
- package/skills/generated/api/graphql/SKILL.md +61 -0
- package/skills/generated/api/key-value-store/SKILL.md +31 -0
- package/skills/generated/api/logger/SKILL.md +25 -0
- package/skills/generated/api/opensearch/SKILL.md +39 -0
- package/skills/generated/api/scheduler/SKILL.md +112 -0
- package/skills/generated/api/security/SKILL.md +317 -0
- package/skills/generated/api/system/SKILL.md +34 -0
- package/skills/generated/api/tasks/SKILL.md +31 -0
- package/skills/generated/api/tenancy/SKILL.md +124 -0
- package/skills/generated/api/tenant-manager/SKILL.md +34 -0
- package/skills/generated/api/website-builder/SKILL.md +356 -0
- package/skills/generated/cli/SKILL.md +28 -0
- package/skills/generated/cli/command/SKILL.md +24 -0
- package/skills/generated/extensions/SKILL.md +43 -0
- package/skills/generated/infra/SKILL.md +190 -0
- package/skills/infrastructure-extensions/SKILL.md +3 -2
- package/skills/local-development/SKILL.md +2 -28
- package/skills/project-structure/SKILL.md +78 -56
- package/skills/webiny-sdk/SKILL.md +77 -76
- package/skills/website-builder/SKILL.md +143 -149
- package/ui.d.ts +24 -0
- package/ui.js +31 -0
- package/ui.js.map +1 -0
- package/Extension.d.ts +0 -2
- package/Extension.js +0 -11
- package/Extension.js.map +0 -1
- package/skills/admin-ui-extensions/SKILL.md +0 -267
- package/skills/api-custom-feature/SKILL.md +0 -195
- package/skills/lifecycle-events/SKILL.md +0 -348
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webiny-use-case-pattern
|
|
3
|
+
context: webiny-api
|
|
4
|
+
description: >
|
|
5
|
+
Generic UseCase implementation pattern — DI, Result handling, extension registration.
|
|
6
|
+
Use this skill to understand how to implement, inject, or override any Webiny UseCase.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# UseCase Pattern
|
|
10
|
+
|
|
11
|
+
## What It Is
|
|
12
|
+
|
|
13
|
+
A **UseCase** is a named operation that encapsulates business logic (e.g., `CreateTenantUseCase`, `PublishEntryUseCase`). Each UseCase is a DI abstraction with a single `execute` method.
|
|
14
|
+
|
|
15
|
+
## Interface Shape
|
|
16
|
+
|
|
17
|
+
Every UseCase follows this pattern:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
interface SomeUseCase.Interface {
|
|
21
|
+
execute(input: Input): Promise<Result<ReturnType, ErrorType>>;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **Input** — a typed object specific to the use case
|
|
26
|
+
- **Result** — always returns `Result<T, E>` from `@webiny/feature/api`
|
|
27
|
+
- **Error** — extends `BaseError` with a unique `code`
|
|
28
|
+
|
|
29
|
+
## How to Use a UseCase
|
|
30
|
+
|
|
31
|
+
UseCases are injected as dependencies into EventHandlers or other UseCases via DI.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { SomeUseCase } from "webiny/api/<category>";
|
|
35
|
+
import { SomeEventHandler } from "webiny/api/<category>";
|
|
36
|
+
|
|
37
|
+
class MyHandler implements SomeEventHandler.Interface {
|
|
38
|
+
constructor(private someUseCase: SomeUseCase.Interface) {}
|
|
39
|
+
|
|
40
|
+
async handle(event: SomeEventHandler.Event) {
|
|
41
|
+
const result = await this.someUseCase.execute({ /* input */ });
|
|
42
|
+
|
|
43
|
+
if (result.isFail()) {
|
|
44
|
+
console.error(result.error.message);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const value = result.value;
|
|
49
|
+
// ... use value
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default SomeEventHandler.createImplementation({
|
|
54
|
+
implementation: MyHandler,
|
|
55
|
+
dependencies: [SomeUseCase]
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## How to Override a UseCase
|
|
60
|
+
|
|
61
|
+
To replace the default implementation, register your own:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { SomeUseCase } from "webiny/api/<category>";
|
|
65
|
+
|
|
66
|
+
class CustomImplementation implements SomeUseCase.Interface {
|
|
67
|
+
async execute(input) {
|
|
68
|
+
// Custom logic
|
|
69
|
+
return Result.ok(/* ... */);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default SomeUseCase.createImplementation({
|
|
74
|
+
implementation: CustomImplementation,
|
|
75
|
+
dependencies: []
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Registration
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
// In your app's configuration
|
|
83
|
+
<Api.Extension src={"@/extensions/my-extension.ts"} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Deploy with: `yarn webiny deploy api --env=dev`
|
|
87
|
+
|
|
88
|
+
## Resolving Types (MANDATORY)
|
|
89
|
+
|
|
90
|
+
**Before writing any code that calls a UseCase or accesses its return types, you MUST read the source file listed in the catalog's `Source` field to verify the exact method signatures, input parameters, return types, and error types. Do not assume or guess property names from memory.**
|
|
91
|
+
|
|
92
|
+
To see the exact types for a specific UseCase:
|
|
93
|
+
|
|
94
|
+
1. Read the `abstractions.ts` file from the catalog `Source` path — it contains the `Interface` with the full method signature, input types, and error union.
|
|
95
|
+
2. If the interface references domain types (e.g., `CmsEntry`, `CmsModel`), follow the import and read that type declaration too.
|
|
96
|
+
3. Only use properties and method signatures that are confirmed to exist in the source type declarations.
|
|
97
|
+
|
|
98
|
+
## Key Rules
|
|
99
|
+
|
|
100
|
+
- Always check `result.isOk()` or `result.isFail()` before accessing `.value` or `.error`
|
|
101
|
+
- DI constructor parameter order must match the `dependencies` array order exactly
|
|
102
|
+
- Use `.js` extensions in import paths (ES modules)
|
|
@@ -23,39 +23,36 @@ import { Ui } from "webiny/cli";
|
|
|
23
23
|
import { CliCommandFactory } from "webiny/cli/command";
|
|
24
24
|
|
|
25
25
|
export interface IMyCustomCommandParams {
|
|
26
|
-
|
|
26
|
+
name: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
class MyCustomCommandImpl implements CliCommandFactory.Interface<IMyCustomCommandParams> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
30
|
+
constructor(private ui: Ui.Interface) {}
|
|
31
|
+
|
|
32
|
+
execute(): CliCommandFactory.CommandDefinition<IMyCustomCommandParams> {
|
|
33
|
+
return {
|
|
34
|
+
name: "my-custom-command",
|
|
35
|
+
description: "This is my custom command",
|
|
36
|
+
examples: ["$0 my-custom-command test1", "$0 my-custom-command test2"],
|
|
37
|
+
params: [
|
|
38
|
+
{
|
|
39
|
+
name: "name",
|
|
40
|
+
description: "Your name",
|
|
41
|
+
type: "string"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
handler: async params => {
|
|
45
|
+
this.ui.info("Starting my custom command...");
|
|
46
|
+
this.ui.emptyLine();
|
|
47
|
+
this.ui.success(`Hello, ${params.name}! This is my custom command.`);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
export default CliCommandFactory.createImplementation({
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
implementation: MyCustomCommandImpl,
|
|
55
|
+
dependencies: [Ui]
|
|
59
56
|
});
|
|
60
57
|
```
|
|
61
58
|
|
|
@@ -73,23 +70,23 @@ yarn webiny my-custom-command "World"
|
|
|
73
70
|
|
|
74
71
|
## Command Definition Properties
|
|
75
72
|
|
|
76
|
-
| Property
|
|
77
|
-
|
|
78
|
-
| `name`
|
|
79
|
-
| `description` | `string`
|
|
80
|
-
| `examples`
|
|
81
|
-
| `params`
|
|
82
|
-
| `handler`
|
|
73
|
+
| Property | Type | Description |
|
|
74
|
+
| ------------- | ------------------------------------ | -------------------------------------------------------------- |
|
|
75
|
+
| `name` | `string` | The command name used on the CLI (e.g., `"my-custom-command"`) |
|
|
76
|
+
| `description` | `string` | Help text shown when listing commands |
|
|
77
|
+
| `examples` | `string[]` | Usage examples (`$0` is replaced with the CLI binary name) |
|
|
78
|
+
| `params` | `ParamDefinition[]` | Positional parameters and options |
|
|
79
|
+
| `handler` | `(params: TParams) => Promise<void>` | The function that executes the command |
|
|
83
80
|
|
|
84
81
|
## Parameter Definition
|
|
85
82
|
|
|
86
83
|
Each param in the `params` array:
|
|
87
84
|
|
|
88
|
-
| Property
|
|
89
|
-
|
|
90
|
-
| `name`
|
|
91
|
-
| `description` | `string`
|
|
92
|
-
| `type`
|
|
85
|
+
| Property | Type | Description |
|
|
86
|
+
| ------------- | ----------------------------------- | ------------------------------------------------------------ |
|
|
87
|
+
| `name` | `string` | Parameter name (matches the key in your `TParams` interface) |
|
|
88
|
+
| `description` | `string` | Help text for this parameter |
|
|
89
|
+
| `type` | `"string" \| "number" \| "boolean"` | Parameter value type |
|
|
93
90
|
|
|
94
91
|
## The `Ui` Service
|
|
95
92
|
|
|
@@ -99,13 +96,13 @@ Inject `Ui` for formatted terminal output:
|
|
|
99
96
|
import { Ui } from "webiny/cli";
|
|
100
97
|
```
|
|
101
98
|
|
|
102
|
-
| Method
|
|
103
|
-
|
|
104
|
-
| `this.ui.info("message")`
|
|
105
|
-
| `this.ui.success("message")` | Print a success message (green)
|
|
99
|
+
| Method | Description |
|
|
100
|
+
| ---------------------------- | -------------------------------- |
|
|
101
|
+
| `this.ui.info("message")` | Print an info message (blue) |
|
|
102
|
+
| `this.ui.success("message")` | Print a success message (green) |
|
|
106
103
|
| `this.ui.warning("message")` | Print a warning message (yellow) |
|
|
107
|
-
| `this.ui.error("message")`
|
|
108
|
-
| `this.ui.emptyLine()`
|
|
104
|
+
| `this.ui.error("message")` | Print an error message (red) |
|
|
105
|
+
| `this.ui.emptyLine()` | Print a blank line for spacing |
|
|
109
106
|
|
|
110
107
|
## Use Cases
|
|
111
108
|
|
|
@@ -129,5 +126,6 @@ Run: yarn webiny <command-name> [args]
|
|
|
129
126
|
|
|
130
127
|
## Related Skills
|
|
131
128
|
|
|
132
|
-
- `dependency-injection` -- The `createImplementation` pattern and available injectable services
|
|
133
|
-
- `project-structure` -- How to register CLI commands in `webiny.config.tsx`
|
|
129
|
+
- `webiny-dependency-injection` -- The `createImplementation` pattern and available injectable services
|
|
130
|
+
- `webiny-project-structure` -- How to register CLI commands in `webiny.config.tsx`
|
|
131
|
+
- `webiny-full-stack-architect` -- Full-stack extensions that may include CLI commands alongside API and Admin
|
|
@@ -296,7 +296,7 @@ Both API and Admin need to be redeployed since Auth0 affects both the backend (t
|
|
|
296
296
|
|
|
297
297
|
## Related Skills
|
|
298
298
|
|
|
299
|
-
- **configure-okta** — Alternative IDP: configuring Okta authentication
|
|
300
|
-
- **dependency-injection** — The universal DI pattern used by `Auth0IdpConfig.createImplementation()`
|
|
301
|
-
- **project-structure** — How `webiny.config.tsx` and extensions are organized
|
|
302
|
-
- **local-development** — Deploying and testing your Auth0 configuration
|
|
299
|
+
- **webiny-configure-okta** — Alternative IDP: configuring Okta authentication
|
|
300
|
+
- **webiny-dependency-injection** — The universal DI pattern used by `Auth0IdpConfig.createImplementation()`
|
|
301
|
+
- **webiny-project-structure** — How `webiny.config.tsx` and extensions are organized
|
|
302
|
+
- **webiny-local-development** — Deploying and testing your Auth0 configuration
|
|
@@ -298,6 +298,6 @@ Both API and Admin need to be redeployed since Okta affects both the backend (to
|
|
|
298
298
|
|
|
299
299
|
## Related Skills
|
|
300
300
|
|
|
301
|
-
- **dependency-injection** — The universal DI pattern used by `OktaIdpConfig.createImplementation()`
|
|
302
|
-
- **project-structure** — How `webiny.config.tsx` and extensions are organized
|
|
303
|
-
- **local-development** — Deploying and testing your Okta configuration
|
|
301
|
+
- **webiny-dependency-injection** — The universal DI pattern used by `OktaIdpConfig.createImplementation()`
|
|
302
|
+
- **webiny-project-structure** — How `webiny.config.tsx` and extensions are organized
|
|
303
|
+
- **webiny-local-development** — Deploying and testing your Okta configuration
|