import * as Effect from 'effect/Effect'; import * as FileSystem from 'effect/FileSystem'; import * as Option from 'effect/Option'; import * as Path from 'effect/Path'; import * as Schema from 'effect/Schema'; import { PluginWriteError } from '../Errors.js'; import { type CommandFrontmatterInput, type OutputStyleFrontmatterInput, type SkillFrontmatterInput, type SubagentFrontmatterInput, CommandFrontmatter, OutputStyleFrontmatter, SkillFrontmatter, SubagentFrontmatter } from '../Frontmatter.js'; import { McpJsonFile, type McpJsonFileInput } from '../Mcp.js'; import { HooksSection } from '../Settings/HooksSection.js'; import { PluginManifest } from './Manifest.js'; type HooksConfig = Schema.Schema.Type; /** * A typed slash-command entry to be written to `commands/.md`. * * @category Models * @since 0.1.0 */ export interface PluginCommandEntry { readonly name: string; readonly path?: string; readonly frontmatter: CommandFrontmatter; readonly body: string; } /** * A typed subagent entry to be written to `agents/.md`. * * @category Models * @since 0.1.0 */ export interface PluginAgentEntry { readonly name: string; readonly path?: string; readonly frontmatter: SubagentFrontmatter; readonly body: string; } /** * A typed skill entry to be written to `skills//SKILL.md`. * * @category Models * @since 0.1.0 */ export interface PluginSkillEntry { readonly name: string; readonly path?: string; readonly frontmatter: SkillFrontmatter; readonly body: string; } /** * A typed output-style entry to be written to `output-styles/.md`. * * @category Models * @since 0.1.0 */ export interface PluginOutputStyleEntry { readonly name: string; readonly path?: string; readonly frontmatter: OutputStyleFrontmatter; readonly body: string; } export type PluginManifestInput = ConstructorParameters[0]; export type PluginCommandConfig = CommandFrontmatterInput & { readonly name: string; readonly path?: string; readonly body: string; }; export type PluginAgentConfig = Omit & { readonly name: string; readonly path?: string; readonly body: string; }; export type PluginSkillConfig = Omit & { readonly name: string; readonly path?: string; readonly body: string; }; export type PluginOutputStyleConfig = Omit & { readonly name: string; readonly path?: string; readonly body: string; }; /** * Config passed to `Plugin.define`. The `manifest` field accepts * either a `PluginManifest` instance or a plain object that satisfies * its constructor; the latter is validated on entry. * * @category Models * @since 0.1.0 */ export interface PluginConfig { readonly manifest: PluginManifest | PluginManifestInput; readonly commands?: ReadonlyArray; readonly agents?: ReadonlyArray; readonly skills?: ReadonlyArray; readonly outputStyles?: ReadonlyArray; readonly hooksConfig?: HooksConfig; readonly mcpConfig?: McpJsonFile | McpJsonFileInput; } /** * The fully-formed plugin definition ready to be written. Components * default to empty arrays; optional config files default to `None`. * * @category Models * @since 0.1.0 */ export interface PluginDefinition { readonly manifest: PluginManifest; readonly commands: ReadonlyArray; readonly agents: ReadonlyArray; readonly skills: ReadonlyArray; readonly outputStyles: ReadonlyArray; readonly hooksConfig: Option.Option; readonly mcpConfig: Option.Option; } /** * Build a typed slash-command entry. * * @category Builders * @since 0.1.0 */ export declare const command: (config: PluginCommandConfig) => PluginCommandEntry; /** * Build a typed subagent entry. * * @category Builders * @since 0.1.0 */ export declare const agent: (config: PluginAgentConfig) => PluginAgentEntry; /** * Build a typed skill entry. * * @category Builders * @since 0.1.0 */ export declare const skill: (config: PluginSkillConfig) => PluginSkillEntry; /** * Build a typed output-style entry. * * @category Builders * @since 0.1.0 */ export declare const outputStyle: (config: PluginOutputStyleConfig) => PluginOutputStyleEntry; /** * Build a `PluginDefinition` from a plain config object. If * `config.manifest` is a raw object, it is passed through the * `PluginManifest` constructor (which enforces the schema) before * being stored. Component arrays default to empty; optional config * files become `Option.none()` when absent. * * @category Builders * @since 0.1.0 * @example * ```ts * import { Plugin } from 'effect-claudecode' * * const def = Plugin.define({ * manifest: { name: 'my-plugin', version: '0.1.0' }, * commands: [ * Plugin.command({ * name: 'greet', * description: 'Say hi', * body: '# /greet\n\nSay hi.\n' * }) * ] * }) * ``` */ export declare const define: (config: PluginConfig) => PluginDefinition; /** * Materialize a `PluginDefinition` to a destination directory. * * The write order is deterministic: manifest first, then component * directories in the order `commands`, `agents`, `skills`, * `outputStyles`, then (optionally) `hooks/hooks.json`, then * (optionally) `.mcp.json`. Any filesystem error is wrapped in a * `PluginWriteError` carrying the offending path. * * Requires `FileSystem` and `Path` services in the environment; pick * your preferred platform layer at the call site (for example * `NodeFileSystem.layer` + `NodePath.layer` under Node). * * @category Writers * @since 0.1.0 * @example * ```ts * import * as Effect from 'effect/Effect' * import * as Layer from 'effect/Layer' * import * as NodeFileSystem from '@effect/platform-node-shared/NodeFileSystem' * import * as NodePath from '@effect/platform-node-shared/NodePath' * import { Plugin } from 'effect-claudecode' * * const def = Plugin.define({ * manifest: { name: 'my-plugin' }, * commands: [ * Plugin.command({ name: 'hi', body: '# /hi\n' }) * ] * }) * * Effect.runPromise( * Plugin.write(def, '/tmp/my-plugin').pipe( * Effect.provide(Layer.mergeAll(NodeFileSystem.layer, NodePath.layer)) * ) * ) * ``` */ export declare const write: (definition: PluginDefinition, destDir: string) => Effect.Effect; export {}; //# sourceMappingURL=Define.d.ts.map