@ai-composer/plugin-command 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deepak Chopkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # @ai-composer/plugin-command
2
+
3
+ /slash command trigger plugin.
4
+
5
+ See [`docs/`](../../docs/README.md) for guides and API reference.
6
+
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @ai-composer/plugin-command — `/slash` commands.
3
+ *
4
+ * ```ts
5
+ * import { createAIComposer } from '@ai-composer/core';
6
+ * import { commandPlugin } from '@ai-composer/plugin-command';
7
+ *
8
+ * const editor = createAIComposer({
9
+ * plugins: [
10
+ * commandPlugin({
11
+ * commands: [
12
+ * { id: 'summarize', label: 'Summarize', description: 'Summarize the thread' },
13
+ * { id: 'translate', label: 'Translate', run: (editor) => { … } },
14
+ * ],
15
+ * }),
16
+ * ],
17
+ * });
18
+ * ```
19
+ *
20
+ * Commands WITHOUT `run` insert a command node into the document; commands WITH
21
+ * `run` execute immediately and the trigger run is simply removed.
22
+ */
23
+ import { type AIComposer, type AIComposerPlugin, type TriggerSearchContext } from '@ai-composer/core';
24
+ export interface SlashCommandDefinition {
25
+ id: string;
26
+ label: string;
27
+ description?: string;
28
+ /** Immediate action; when omitted the command is inserted as a node. */
29
+ run?: (editor: AIComposer) => void | Promise<void>;
30
+ /** Extra payload stored on the node metadata / suggestion data. */
31
+ data?: Record<string, unknown>;
32
+ }
33
+ export interface CommandPluginOptions {
34
+ /** Trigger character (default '/'). */
35
+ trigger?: string;
36
+ /** Trigger id (default 'command'). */
37
+ id?: string;
38
+ /** Available commands. */
39
+ commands: SlashCommandDefinition[];
40
+ /** Dynamic command source; overrides `commands`. */
41
+ search?: (context: TriggerSearchContext) => SlashCommandDefinition[] | Promise<SlashCommandDefinition[]>;
42
+ }
43
+ export declare function commandPlugin(options: CommandPluginOptions): AIComposerPlugin;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAE1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,sBAAsB,EAAE,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;CAC1G;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,CAqE7E"}
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @ai-composer/plugin-command — `/slash` commands.
3
+ *
4
+ * ```ts
5
+ * import { createAIComposer } from '@ai-composer/core';
6
+ * import { commandPlugin } from '@ai-composer/plugin-command';
7
+ *
8
+ * const editor = createAIComposer({
9
+ * plugins: [
10
+ * commandPlugin({
11
+ * commands: [
12
+ * { id: 'summarize', label: 'Summarize', description: 'Summarize the thread' },
13
+ * { id: 'translate', label: 'Translate', run: (editor) => { … } },
14
+ * ],
15
+ * }),
16
+ * ],
17
+ * });
18
+ * ```
19
+ *
20
+ * Commands WITHOUT `run` insert a command node into the document; commands WITH
21
+ * `run` execute immediately and the trigger run is simply removed.
22
+ */
23
+ import { createCommandNode, defineTrigger, } from '@ai-composer/core';
24
+ export function commandPlugin(options) {
25
+ const character = options.trigger ?? '/';
26
+ const definitions = options.commands ?? [];
27
+ const toSuggestion = (definition) => ({
28
+ id: definition.id,
29
+ label: definition.label,
30
+ description: definition.description,
31
+ data: definition.data,
32
+ });
33
+ const defaultSearch = (context) => {
34
+ const query = context.query.trim().toLowerCase().replace(/^\//, '');
35
+ const matches = definitions.filter((definition) => !query ||
36
+ definition.label.toLowerCase().includes(query) ||
37
+ definition.id.toLowerCase().includes(query));
38
+ return matches.map(toSuggestion);
39
+ };
40
+ const select = (item, context) => {
41
+ const definition = definitions.find((candidate) => candidate.id === item.id);
42
+ const range = {
43
+ start: { nodeIndex: context.nodeIndex, offset: context.triggerOffset },
44
+ end: { nodeIndex: context.nodeIndex, offset: context.endOffset },
45
+ };
46
+ if (definition?.run) {
47
+ // Immediate action: strip the trigger run and run the handler.
48
+ context.editor.replaceRange(range, []);
49
+ void definition.run(context.editor);
50
+ return;
51
+ }
52
+ // Command nodes replace the trigger run in the document.
53
+ context.editor.replaceRange(range, [
54
+ createCommandNode({
55
+ id: definition?.id ?? item.id,
56
+ label: definition?.label ?? item.label,
57
+ ...(definition?.data ? { metadata: definition.data } : {}),
58
+ }),
59
+ ], { trailingSpace: true });
60
+ };
61
+ const trigger = defineTrigger({
62
+ id: options.id ?? 'command',
63
+ character,
64
+ type: 'command',
65
+ search: async (context) => {
66
+ if (options.search) {
67
+ const found = await options.search(context);
68
+ return found.map(toSuggestion);
69
+ }
70
+ return defaultSearch(context);
71
+ },
72
+ select,
73
+ });
74
+ return {
75
+ name: options.id ?? 'command',
76
+ version: '0.1.0',
77
+ triggers: [trigger],
78
+ };
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@ai-composer/plugin-command",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "peerDependencies": {
17
+ "@ai-composer/core": "^0.1.0"
18
+ },
19
+ "devDependencies": {
20
+ "@ai-composer/core": "workspace:*",
21
+ "vitest": "^2.1.8"
22
+ },
23
+ "module": "./index.js"
24
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@ai-composer/plugin-command",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "peerDependencies": {
17
+ "@ai-composer/core": "^0.1.0"
18
+ },
19
+ "devDependencies": {
20
+ "vitest": "^2.1.8",
21
+ "@ai-composer/core": "0.1.0"
22
+ }
23
+ }
package/project.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "plugin-command",
3
+ "$schema": "../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "plugins/command/src",
5
+ "projectType": "library",
6
+ "tags": [
7
+ "scope:plugin",
8
+ "type:lib"
9
+ ],
10
+ "targets": {
11
+ "build": {
12
+ "executor": "@nx/js:tsc",
13
+ "outputs": [
14
+ "{options.outputPath}"
15
+ ],
16
+ "options": {
17
+ "outputPath": "plugins/command/dist",
18
+ "main": "plugins/command/src/index.ts",
19
+ "tsConfig": "plugins/command/tsconfig.lib.json",
20
+ "rootDir": "plugins/command/src",
21
+ "assets": [
22
+ {
23
+ "input": "../plugins/command",
24
+ "glob": "*.md",
25
+ "output": "."
26
+ }
27
+ ],
28
+ "generateExportsIfAbsent": false
29
+ }
30
+ },
31
+ "test": {
32
+ "executor": "nx:run-commands",
33
+ "options": {
34
+ "command": "vitest run --project plugin-command"
35
+ }
36
+ },
37
+ "lint": {
38
+ "executor": "@nx/eslint:lint",
39
+ "outputs": [
40
+ "{options.outputFile}"
41
+ ],
42
+ "options": {
43
+ "lintFilePatterns": [
44
+ "plugins/command/**/*.ts",
45
+ "plugins/command/**/*.tsx"
46
+ ]
47
+ }
48
+ },
49
+ "typecheck": {
50
+ "executor": "nx:run-commands",
51
+ "options": {
52
+ "command": "tsc -p plugins/command/tsconfig.spec.json --noEmit"
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,62 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { createAIComposer, createPosition, createSelection } from '@ai-composer/core';
3
+ import { commandPlugin } from './index';
4
+
5
+ function type(editor: ReturnType<typeof createAIComposer>, text: string): void {
6
+ const current = editor.serialize('text') as string;
7
+ editor.applyViewUpdate({ nodes: [{ type: 'text', key: 't', text: current + text }] });
8
+ editor.setSelection(createSelection(createPosition(0, (current + text).length)));
9
+ }
10
+
11
+ describe('commandPlugin', () => {
12
+ it('inserts a command node for commands without run()', async () => {
13
+ const editor = createAIComposer({
14
+ plugins: [
15
+ commandPlugin({
16
+ commands: [
17
+ { id: 'summarize', label: 'Summarize', description: 'Summarize the thread' },
18
+ ],
19
+ }),
20
+ ],
21
+ });
22
+
23
+ type(editor, '/sum');
24
+ await vi.waitFor(() => expect(editor.getState().suggestions.length).toBe(1));
25
+ await editor.acceptSuggestion();
26
+
27
+ expect(editor.serialize('text')).toBe('/Summarize ');
28
+ expect(editor.getValue().nodes).toEqual(
29
+ expect.arrayContaining([expect.objectContaining({ type: 'command', id: 'summarize' })]),
30
+ );
31
+ });
32
+
33
+ it('executes run() immediately and removes the trigger run', async () => {
34
+ const run = vi.fn();
35
+ const editor = createAIComposer({
36
+ plugins: [
37
+ commandPlugin({
38
+ commands: [{ id: 'clear', label: 'Clear all', run }],
39
+ }),
40
+ ],
41
+ });
42
+
43
+ type(editor, 'keep /cl');
44
+ await vi.waitFor(() => expect(editor.getState().suggestions.length).toBe(1));
45
+ await editor.acceptSuggestion();
46
+
47
+ expect(run).toHaveBeenCalledTimes(1);
48
+ expect(editor.serialize('text')).toBe('keep ');
49
+ });
50
+
51
+ it('matches on id as well as label', async () => {
52
+ const editor = createAIComposer({
53
+ plugins: [
54
+ commandPlugin({
55
+ commands: [{ id: 'translate', label: 'Translate to French' }],
56
+ }),
57
+ ],
58
+ });
59
+ type(editor, '/trans');
60
+ await vi.waitFor(() => expect(editor.getState().suggestions.length).toBe(1));
61
+ });
62
+ });
package/src/index.ts ADDED
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @ai-composer/plugin-command — `/slash` commands.
3
+ *
4
+ * ```ts
5
+ * import { createAIComposer } from '@ai-composer/core';
6
+ * import { commandPlugin } from '@ai-composer/plugin-command';
7
+ *
8
+ * const editor = createAIComposer({
9
+ * plugins: [
10
+ * commandPlugin({
11
+ * commands: [
12
+ * { id: 'summarize', label: 'Summarize', description: 'Summarize the thread' },
13
+ * { id: 'translate', label: 'Translate', run: (editor) => { … } },
14
+ * ],
15
+ * }),
16
+ * ],
17
+ * });
18
+ * ```
19
+ *
20
+ * Commands WITHOUT `run` insert a command node into the document; commands WITH
21
+ * `run` execute immediately and the trigger run is simply removed.
22
+ */
23
+
24
+ import {
25
+ createCommandNode,
26
+ defineTrigger,
27
+ type DocumentRange,
28
+
29
+ type AIComposer,
30
+ type AIComposerPlugin,
31
+ type AIComposerTrigger,
32
+ type SuggestionItem,
33
+ type TriggerSearchContext,
34
+ type TriggerSelectContext,
35
+ } from '@ai-composer/core';
36
+
37
+ export interface SlashCommandDefinition {
38
+ id: string;
39
+ label: string;
40
+ description?: string;
41
+ /** Immediate action; when omitted the command is inserted as a node. */
42
+ run?: (editor: AIComposer) => void | Promise<void>;
43
+ /** Extra payload stored on the node metadata / suggestion data. */
44
+ data?: Record<string, unknown>;
45
+ }
46
+
47
+ export interface CommandPluginOptions {
48
+ /** Trigger character (default '/'). */
49
+ trigger?: string;
50
+ /** Trigger id (default 'command'). */
51
+ id?: string;
52
+ /** Available commands. */
53
+ commands: SlashCommandDefinition[];
54
+ /** Dynamic command source; overrides `commands`. */
55
+ search?: (context: TriggerSearchContext) => SlashCommandDefinition[] | Promise<SlashCommandDefinition[]>;
56
+ }
57
+
58
+ export function commandPlugin(options: CommandPluginOptions): AIComposerPlugin {
59
+ const character = options.trigger ?? '/';
60
+ const definitions = options.commands ?? [];
61
+
62
+ const toSuggestion = (definition: SlashCommandDefinition): SuggestionItem => ({
63
+ id: definition.id,
64
+ label: definition.label,
65
+ description: definition.description,
66
+ data: definition.data,
67
+ });
68
+
69
+ const defaultSearch = (context: TriggerSearchContext): SuggestionItem[] => {
70
+ const query = context.query.trim().toLowerCase().replace(/^\//, '');
71
+ const matches = definitions.filter(
72
+ (definition) =>
73
+ !query ||
74
+ definition.label.toLowerCase().includes(query) ||
75
+ definition.id.toLowerCase().includes(query),
76
+ );
77
+ return matches.map(toSuggestion);
78
+ };
79
+
80
+ const select = (item: SuggestionItem, context: TriggerSelectContext): void => {
81
+ const definition = definitions.find((candidate) => candidate.id === item.id);
82
+ const range: DocumentRange = {
83
+ start: { nodeIndex: context.nodeIndex, offset: context.triggerOffset },
84
+ end: { nodeIndex: context.nodeIndex, offset: context.endOffset },
85
+ };
86
+
87
+ if (definition?.run) {
88
+ // Immediate action: strip the trigger run and run the handler.
89
+ context.editor.replaceRange(range, []);
90
+ void definition.run(context.editor);
91
+ return;
92
+ }
93
+
94
+ // Command nodes replace the trigger run in the document.
95
+ context.editor.replaceRange(
96
+ range,
97
+ [
98
+ createCommandNode({
99
+ id: definition?.id ?? item.id,
100
+ label: definition?.label ?? item.label,
101
+ ...(definition?.data ? { metadata: definition.data } : {}),
102
+ }),
103
+ ],
104
+ { trailingSpace: true },
105
+ );
106
+ };
107
+
108
+ const trigger: AIComposerTrigger = defineTrigger({
109
+ id: options.id ?? 'command',
110
+ character,
111
+ type: 'command',
112
+ search: async (context) => {
113
+ if (options.search) {
114
+ const found = await options.search(context);
115
+ return found.map(toSuggestion);
116
+ }
117
+ return defaultSearch(context);
118
+ },
119
+ select,
120
+ });
121
+
122
+ return {
123
+ name: options.id ?? 'command',
124
+ version: '0.1.0',
125
+ triggers: [trigger],
126
+ };
127
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": []
5
+ },
6
+ "include": [
7
+ "src/**/*.ts",
8
+ "src/**/*.tsx",
9
+ "vitest.config.ts"
10
+ ],
11
+ "exclude": [
12
+ "node_modules",
13
+ "dist"
14
+ ]
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "stripInternal": true,
7
+ "outDir": "../../dist/plugins/command"
8
+ },
9
+ "exclude": [
10
+ "**/*.test.ts",
11
+ "**/*.test.tsx",
12
+ "vitest.config.ts",
13
+ "src/test-setup.ts"
14
+ ]
15
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": [
6
+ "vitest"
7
+ ]
8
+ },
9
+ "include": [
10
+ "src/**/*.ts",
11
+ "src/**/*.tsx"
12
+ ],
13
+ "exclude": [
14
+ "vitest.config.ts"
15
+ ]
16
+ }
@@ -0,0 +1,16 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { resolve } from 'node:path';
3
+
4
+ export default defineConfig({
5
+ resolve: {
6
+ alias: {
7
+ '@ai-composer/core': resolve(__dirname, '../../packages/core/src/index.ts'),
8
+ },
9
+ },
10
+ test: {
11
+ name: 'plugin-command',
12
+ environment: 'node',
13
+ include: ['src/**/*.test.{ts,tsx}'],
14
+ },
15
+ });
16
+