Skip to content

Commit bb37b9e

Browse files
authored
Merge pull request #732 from dahlia/docs/install/editors
Document editor setup, mise install, and Agentic Skill
2 parents e289acb + ffa09c8 commit bb37b9e

2 files changed

Lines changed: 268 additions & 2 deletions

File tree

docs/cli.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ command above.
9999

100100
[Deno]: https://deno.com/
101101

102+
### Using mise
103+
104+
If you have [mise] installed, you can install `fedify` by running the following
105+
command:
106+
107+
~~~~ sh
108+
mise use -g github:fedify-dev/fedify
109+
~~~~
110+
111+
[mise]: https://mise.jdx.dev/
112+
102113
### Downloading the executable
103114

104115
You can download the pre-built executables from the [releases] page. Download
@@ -216,7 +227,7 @@ precedence over configuration file values.
216227

217228
*This command is available since Fedify 0.12.0.*
218229

219-
[![The “fedify init” command demo](https://asciinema.org/a/671658.svg)](https://asciinema.org/a/671658)
230+
[![The “fedify init” command demo](https://asciinema.org/a/979416.svg)](https://asciinema.org/a/979416)
220231

221232
The `fedify init` command is used to initialize a new Fedify project.
222233
It creates a new directory with the necessary files and directories for a

docs/install.md

Lines changed: 256 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ For more information about the `fedify init` command, please refer to the
6666
[*`fedify init`* section](./cli.md#fedify-init-initializing-a-fedify-project)
6767
in the *CLI toolchain* docs.
6868

69-
[![The “fedify init” command demo](https://asciinema.org/a/671658.svg)](https://asciinema.org/a/671658)
69+
[![The “fedify init” command demo](https://asciinema.org/a/979416.svg)](https://asciinema.org/a/979416)
7070

7171
### Alternative: Using `@fedify/create`
7272

@@ -185,3 +185,258 @@ compatibility, ESM is the preferred approach:
185185

186186
[ESM]: https://nodejs.org/api/esm.html
187187
[CommonJS]: https://nodejs.org/docs/latest/api/modules.html
188+
189+
190+
Editor setup
191+
------------
192+
193+
`fedify init` configures Visual Studio Code for you out of the box. Setting
194+
up [Zed] takes a few extra steps because `fedify init` does not generate
195+
*.zed/* files yet.
196+
197+
[Zed]: https://zed.dev/
198+
199+
### Visual Studio Code
200+
201+
*For Deno projects*, `fedify init` writes a *.vscode/extensions.json* that
202+
recommends the [Deno extension]:
203+
204+
~~~~ json [.vscode/extensions.json]
205+
{ "recommendations": ["denoland.vscode-deno"] }
206+
~~~~
207+
208+
The matching *.vscode/settings.json* turns on Deno's language server and sets
209+
it as the default formatter for JavaScript and TypeScript:
210+
211+
~~~~ jsonc [.vscode/settings.json]
212+
{
213+
"deno.enable": true,
214+
"deno.unstable": true,
215+
"editor.detectIndentation": false,
216+
"editor.indentSize": 2,
217+
"editor.insertSpaces": true,
218+
"[typescript]": {
219+
"editor.defaultFormatter": "denoland.vscode-deno",
220+
"editor.formatOnSave": true,
221+
"editor.codeActionsOnSave": {
222+
"source.sortImports": "always"
223+
}
224+
}
225+
// The same block applies to [javascript], [javascriptreact], and
226+
// [typescriptreact]; [json] and [jsonc] use "vscode.json-language-features".
227+
}
228+
~~~~
229+
230+
Deno's [*Set up your environment*] guide covers other editors and shells.
231+
232+
*For Node.js/Bun projects*, `fedify init` writes a *.vscode/extensions.json*
233+
that recommends the [Biome extension] and the [ESLint extension]:
234+
235+
~~~~ json [.vscode/extensions.json]
236+
{ "recommendations": ["biomejs.biome", "dbaeumer.vscode-eslint"] }
237+
~~~~
238+
239+
The matching *.vscode/settings.json* sets Biome as the default formatter and
240+
runs Biome's import organiser on save:
241+
242+
~~~~ jsonc [.vscode/settings.json]
243+
{
244+
"editor.detectIndentation": false,
245+
"editor.indentSize": 2,
246+
"editor.insertSpaces": true,
247+
"[typescript]": {
248+
"editor.defaultFormatter": "biomejs.biome",
249+
"editor.formatOnSave": true,
250+
"editor.codeActionsOnSave": {
251+
"source.organizeImports.biome": "always"
252+
}
253+
}
254+
// The same block applies to [javascript], [javascriptreact],
255+
// [typescriptreact], [json], and [jsonc].
256+
}
257+
~~~~
258+
259+
If you prefer [Oxc] over Biome and ESLint, install the [oxc-vscode]
260+
extension and swap the formatter:
261+
262+
~~~~ jsonc [.vscode/settings.json]
263+
{
264+
"[typescript]": {
265+
"editor.defaultFormatter": "oxc.oxc-vscode",
266+
"editor.formatOnSave": true,
267+
"editor.codeActionsOnSave": {
268+
"source.fixAll.oxc": "always"
269+
}
270+
}
271+
}
272+
~~~~
273+
274+
[Deno extension]: https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
275+
[*Set up your environment*]: https://docs.deno.com/runtime/getting_started/setup_your_environment/
276+
[Biome extension]: https://marketplace.visualstudio.com/items?itemName=biomejs.biome
277+
[ESLint extension]: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
278+
[Oxc]: https://oxc.rs/
279+
[oxc-vscode]: https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode
280+
281+
### Zed
282+
283+
> [!TIP]
284+
> `fedify init` does not generate *.zed/* configuration; the snippets below
285+
> need to be added by hand.
286+
287+
*For Deno projects*, create *.zed/settings.json* that enables the Deno
288+
language server and uses it as the formatter for TypeScript and JavaScript.
289+
The `!` prefix disables the bundled TypeScript and ESLint servers so they do
290+
not compete with Deno:
291+
292+
~~~~ jsonc [.zed/settings.json]
293+
{
294+
"lsp": {
295+
"deno": {
296+
"settings": { "deno": { "enable": true } }
297+
}
298+
},
299+
"languages": {
300+
"TypeScript": {
301+
"formatter": [
302+
{ "language_server": { "name": "deno" } }
303+
],
304+
"language_servers": [
305+
"deno",
306+
"!typescript-language-server",
307+
"!vtsls",
308+
"!eslint",
309+
"!biome",
310+
"..."
311+
]
312+
}
313+
// The same block applies to TSX and JavaScript.
314+
}
315+
}
316+
~~~~
317+
318+
Zed's [Deno language docs][zed-deno] cover the available options.
319+
[Hackers' Pub] is a real-world reference.
320+
321+
*For Node.js/Bun projects*, Zed enables its bundled TypeScript language
322+
server out of the box; the typical addition is wiring up Biome (or the
323+
formatter you chose) for `editor.formatOnSave`-style behaviour. See Zed's
324+
[TypeScript language docs][zed-ts] for setup. If you prefer [Oxc] instead,
325+
set Oxc as the language server and turn on its fix-all action on format:
326+
327+
~~~~ jsonc [.zed/settings.json]
328+
{
329+
"language_servers": ["oxc", "..."],
330+
"code_actions_on_format": {
331+
"source.fixAll.oxc": true
332+
}
333+
}
334+
~~~~
335+
336+
[zed-deno]: https://zed.dev/docs/languages/deno
337+
[Hackers' Pub]: https://github.com/hackers-pub/hackerspub/blob/main/.zed/settings.json
338+
[zed-ts]: https://zed.dev/docs/languages/typescript
339+
340+
341+
Linting
342+
-------
343+
344+
`fedify init` configures the [`@fedify/lint`] plugin automatically: Deno
345+
projects pick it up through `lint.plugins` in *deno.json*, and Node.js/Bun
346+
projects through a generated *eslint.config.ts*. For the full rule list,
347+
configuration options, and how to run the linter, see the
348+
[*Linting*](./manual/lint.md) chapter.
349+
350+
[`@fedify/lint`]: https://jsr.io/@fedify/lint
351+
352+
353+
Agentic skill
354+
-------------
355+
356+
_This skill is available since Fedify 2.2.0._
357+
358+
Fedify ships a [Markdown skill file][SKILL.md] that AI coding assistants such
359+
as [Claude Code], [Codex], or [OpenCode] can load to learn Fedify's APIs,
360+
common pitfalls, and recommended patterns. The file lives inside the
361+
`@fedify/fedify` package itself, so the only remaining step is exposing it
362+
to your agent's skills directory.
363+
364+
[SKILL.md]: https://github.com/fedify-dev/fedify/blob/main/packages/fedify/skills/fedify/SKILL.md
365+
[Claude Code]: https://claude.com/product/claude-code
366+
[Codex]: https://developers.openai.com/codex
367+
[OpenCode]: https://opencode.ai/
368+
369+
### Node.js/Bun
370+
371+
Use [`skills-npm`], a third-party tool by Anthony Fu (it is not a Fedify
372+
package), that scans *node\_modules* for packages exposing the `agents.skills`
373+
field in their *package.json* and links them into your agent's skills
374+
directory on every install.
375+
376+
1. Install `skills-npm` as a dev dependency:
377+
378+
::: code-group
379+
380+
~~~~ sh [npm]
381+
npm add -D skills-npm
382+
~~~~
383+
384+
385+
~~~~ sh [pnpm]
386+
pnpm add -D skills-npm
387+
~~~~
388+
389+
390+
~~~~ sh [Yarn]
391+
yarn add -D skills-npm
392+
~~~~
393+
394+
395+
~~~~ sh [Bun]
396+
bun add -D skills-npm
397+
~~~~
398+
399+
:::
400+
401+
2. Add a `prepare` script to your *package.json* so it runs after every
402+
install:
403+
404+
~~~~ json
405+
{
406+
"scripts": {
407+
"prepare": "skills-npm"
408+
}
409+
}
410+
~~~~
411+
412+
3. Reinstall once. The Fedify skill appears at *.claude/skills/fedify/*
413+
(and similar locations for other supported agents).
414+
415+
The same script picks up other Fedify packages and any third-party npm
416+
packages that adopt the convention.
417+
418+
[`skills-npm`]: https://github.com/antfu/skills-npm
419+
420+
### Deno
421+
422+
> [!NOTE]
423+
> Automated installation for Deno is not available yet, so the skill must be
424+
> installed by hand for the time being. Future automation through the
425+
> Claude Code plugin marketplace is tracked in
426+
> [issue #489].
427+
428+
1. Pick your agent's skills directory. For Claude Code, this is
429+
*.claude/skills/fedify/*.
430+
431+
2. Download *SKILL.md* from the Fedify repository:
432+
433+
~~~~ sh
434+
mkdir -p .claude/skills/fedify
435+
curl -L -o .claude/skills/fedify/SKILL.md \
436+
https://raw.githubusercontent.com/fedify-dev/fedify/main/packages/fedify/skills/fedify/SKILL.md
437+
~~~~
438+
439+
3. Either commit the file or add it to *.gitignore*, depending on your
440+
team's preference.
441+
442+
[issue #489]: https://github.com/fedify-dev/fedify/issues/489

0 commit comments

Comments
 (0)