mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 06:04:40 +00:00
docs(coding-agent): improve extensions.md, add missing examples
- Add cross-links to session.md, keybindings.md, themes.md - Document truncateLine, highlightCode, getLanguageFromPath utilities - Add examples for previously undocumented APIs: - message-renderer.ts: registerMessageRenderer with Box styling - session-name.ts: setSessionName/getSessionName - event-bus.ts: pi.events for inter-extension communication - bookmark.ts: setLabel for entry bookmarking - Update examples table in extensions.md and README.md
This commit is contained in:
parent
c565fa9af8
commit
930207130b
6 changed files with 285 additions and 68 deletions
27
packages/coding-agent/examples/extensions/session-name.ts
Normal file
27
packages/coding-agent/examples/extensions/session-name.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Session naming example.
|
||||
*
|
||||
* Shows setSessionName/getSessionName to give sessions friendly names
|
||||
* that appear in the session selector instead of the first message.
|
||||
*
|
||||
* Usage: /session-name [name] - set or show session name
|
||||
*/
|
||||
|
||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.registerCommand("session-name", {
|
||||
description: "Set or show session name (usage: /session-name [new name])",
|
||||
handler: async (args, ctx) => {
|
||||
const name = args.trim();
|
||||
|
||||
if (name) {
|
||||
pi.setSessionName(name);
|
||||
ctx.ui.notify(`Session named: ${name}`, "info");
|
||||
} else {
|
||||
const current = pi.getSessionName();
|
||||
ctx.ui.notify(current ? `Session: ${current}` : "No session name set", "info");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue