Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Hello-World example plugin source.
|
||||
*
|
||||
* Plugin authors write TypeScript / AssemblyScript / Rust against the
|
||||
* `@toolctrl/plugin-sdk` types, then compile to a single `.wasm` binary
|
||||
* with their toolchain of choice (wasm-pack, AssemblyScript's `asc`,
|
||||
* etc.). The host runtime treats the .wasm as opaque — only its
|
||||
* exports (`handleHello` here) and the `plugin.toml` manifest matter.
|
||||
*
|
||||
* Building this file to WASM is intentionally outside the scope of
|
||||
* the foundation: the `toolctrl plugin build` CLI is deferred (see
|
||||
* `docs/improvement-plan/06-plugin-system/wasm-sandbox.md` Deviations).
|
||||
* Operators wanting a working hello-world today can hand-compile via
|
||||
* AssemblyScript or use any other WASM toolchain that produces a flat
|
||||
* function export — the runtime contract is just `(arg) -> result`.
|
||||
*/
|
||||
|
||||
import { defineHook } from "../../src/index.js";
|
||||
|
||||
export const handleHello = defineHook<{ name: string }, { greeting: string }>((input, ctx) => {
|
||||
ctx.log.info({ name: input.name }, "hello-plugin.invoked");
|
||||
return { greeting: `Hello, ${input.name}!` };
|
||||
});
|
||||
Reference in new issue
Block a user