@docsector/docsector-reader 4.3.0 → 4.3.1

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/README.md CHANGED
@@ -51,6 +51,7 @@ Transform Markdown content into beautiful, navigable documentation sites — wit
51
51
  - 🚨 **GitHub-Style Alerts** — Native support for `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, and `[!CAUTION]`
52
52
  - 🌍 **Internationalization (i18n)** — Multi-language support with HJSON locale files and per-page translations
53
53
  - 🌗 **Dark/Light Mode** — Automatic theme switching with Quasar Dark Plugin
54
+ - 🧰 **Docsector CLI Skill Installer** — Install the built-in authoring skill into older scaffolds with `docsector install-skill`
54
55
  - 🔗 **Anchor Navigation** — Right-side Table of Contents tree with stable scroll tracking, auto-scroll to the active section, and active-heading resolution based on the last heading that crossed the content threshold
55
56
  - 🖱️ **Active Menu Item UX** — Active menu entries keep pointer cursor, clear URL hash without redundant navigation, and prevent accidental label text selection
56
57
  - 🔎 **Search** — Menu search across all documentation content and tags
@@ -535,6 +536,14 @@ This repository publishes the built-in Docsector authoring skill at:
535
536
 
536
537
  The skill teaches agents Docsector Markdown authoring, all documented blocks, page/source conventions, MCP lookup, and WebMCP browser tools.
537
538
 
539
+ For projects scaffolded before the built-in skill existed, run:
540
+
541
+ ```bash
542
+ npx docsector install-skill
543
+ ```
544
+
545
+ The helper copies the skill into `.github/skills/` for repository-local assistants and into `public/.well-known/agent-skills/` for published discovery. Existing folders are skipped unless `--force` is passed.
546
+
538
547
  When `digest` is omitted in config, Docsector computes it automatically from the referenced local artifact and writes it as:
539
548
 
540
549
  - `sha256:{hex}`
@@ -1087,6 +1096,8 @@ Notes:
1087
1096
 
1088
1097
  ```bash
1089
1098
  docsector init <name> # Scaffold a new consumer project
1099
+ docsector install-skill # Install the built-in authoring skill
1100
+ docsector install-skill --force # Refresh an existing installed authoring skill
1090
1101
  docsector dev # Start dev server (port 8181)
1091
1102
  docsector dev --port 3000 # Custom port
1092
1103
  docsector build # Build for production (dist/spa/)
package/bin/docsector.js CHANGED
@@ -8,11 +8,12 @@
8
8
  * docsector dev — Start development server with hot-reload
9
9
  * docsector build — Build optimized SPA for production
10
10
  * docsector serve — Serve the production build locally
11
+ * docsector install-skill — Install the built-in authoring skill into a project
11
12
  * docsector help — Show help information
12
13
  */
13
14
 
14
15
  import { spawn } from 'child_process'
15
- import { existsSync, mkdirSync, writeFileSync, copyFileSync } from 'fs'
16
+ import { existsSync, mkdirSync, writeFileSync, copyFileSync, cpSync } from 'fs'
16
17
  import { resolve, dirname } from 'path'
17
18
  import { fileURLToPath } from 'url'
18
19
 
@@ -23,7 +24,25 @@ const packageRoot = resolve(__dirname, '..')
23
24
  const args = process.argv.slice(2)
24
25
  const command = args[0]
25
26
 
26
- const VERSION = '4.3.0'
27
+ const VERSION = '4.3.1'
28
+ const AUTHORING_SKILL_NAME = 'docsector-documentation-authoring'
29
+ const AUTHORING_SKILL_DESCRIPTION = 'Author Docsector documentation with Markdown, custom blocks, MCP, and WebMCP.'
30
+ const AUTHORING_SKILL_PUBLIC_PATH = `/.well-known/agent-skills/${AUTHORING_SKILL_NAME}/SKILL.md`
31
+ const AUTHORING_SKILL_SOURCE_DIR = resolve(packageRoot, 'public', '.well-known', 'agent-skills', AUTHORING_SKILL_NAME)
32
+ const AUTHORING_SKILL_CONFIG_SNIPPET = `\
33
+ agentSkills: {
34
+ enabled: true,
35
+ path: '/.well-known/agent-skills/index.json',
36
+ schema: 'https://schemas.agentskills.io/discovery/0.2.0/schema.json',
37
+ skills: [
38
+ {
39
+ name: '${AUTHORING_SKILL_NAME}',
40
+ type: 'skill-md',
41
+ description: '${AUTHORING_SKILL_DESCRIPTION}',
42
+ url: '${AUTHORING_SKILL_PUBLIC_PATH}'
43
+ }
44
+ ]
45
+ }`
27
46
 
28
47
  const HELP = `
29
48
  Docsector Reader v${VERSION}
@@ -37,11 +56,14 @@ const HELP = `
37
56
  dev Start development server with hot-reload (port 8181)
38
57
  build Build optimized SPA for production (output: dist/spa/)
39
58
  serve Serve the production build locally
59
+ install-skill
60
+ Copy the built-in Docsector authoring skill into this project
40
61
  version Show version number
41
62
  help Show this help message
42
63
 
43
64
  Options:
44
65
  --port <number> Override dev server port (default: 8181)
66
+ --force Overwrite an existing installed authoring skill
45
67
 
46
68
  Examples:
47
69
  docsector init my-docs
@@ -49,6 +71,8 @@ const HELP = `
49
71
  docsector dev --port 3000
50
72
  docsector build
51
73
  docsector serve
74
+ docsector install-skill
75
+ docsector install-skill --force
52
76
 
53
77
  Documentation:
54
78
  https://github.com/docsector/docsector-reader
@@ -235,10 +259,10 @@ export default {
235
259
  // schema: 'https://schemas.agentskills.io/discovery/0.2.0/schema.json',
236
260
  // skills: [
237
261
  // {
238
- // name: 'my-docs-mcp',
262
+ // name: '${AUTHORING_SKILL_NAME}',
239
263
  // type: 'skill-md',
240
- // description: 'Search and read docs pages through MCP.',
241
- // url: '/.well-known/agent-skills/my-docs-mcp/SKILL.md'
264
+ // description: '${AUTHORING_SKILL_DESCRIPTION}',
265
+ // url: '${AUTHORING_SKILL_PUBLIC_PATH}'
242
266
  // }
243
267
  // ]
244
268
  // },
@@ -783,6 +807,75 @@ function run (cmd, cmdArgs = []) {
783
807
  })
784
808
  }
785
809
 
810
+ function copyAuthoringSkillTarget (targetDir, { force = false } = {}) {
811
+ if (!existsSync(AUTHORING_SKILL_SOURCE_DIR)) {
812
+ throw new Error(`Built-in authoring skill not found at ${AUTHORING_SKILL_SOURCE_DIR}`)
813
+ }
814
+
815
+ if (targetDir === AUTHORING_SKILL_SOURCE_DIR) {
816
+ return 'already-source'
817
+ }
818
+
819
+ if (existsSync(targetDir) && !force) {
820
+ return 'skipped'
821
+ }
822
+
823
+ mkdirSync(dirname(targetDir), { recursive: true })
824
+ cpSync(AUTHORING_SKILL_SOURCE_DIR, targetDir, {
825
+ recursive: true,
826
+ force: true
827
+ })
828
+
829
+ return existsSync(targetDir) ? 'installed' : 'failed'
830
+ }
831
+
832
+ function installAuthoringSkill ({ projectRoot = process.cwd(), force = false } = {}) {
833
+ const targets = [
834
+ {
835
+ label: 'Repository-local skill',
836
+ dir: resolve(projectRoot, '.github', 'skills', AUTHORING_SKILL_NAME)
837
+ },
838
+ {
839
+ label: 'Public skill artifact',
840
+ dir: resolve(projectRoot, 'public', '.well-known', 'agent-skills', AUTHORING_SKILL_NAME)
841
+ }
842
+ ]
843
+
844
+ console.log(`\n Installing ${AUTHORING_SKILL_NAME} into ${projectRoot}...\n`)
845
+
846
+ try {
847
+ for (const target of targets) {
848
+ const result = copyAuthoringSkillTarget(target.dir, { force })
849
+ if (result === 'installed') {
850
+ console.log(` created ${target.label}: ${target.dir}`)
851
+ } else if (result === 'already-source') {
852
+ console.log(` using package ${target.label}: ${target.dir}`)
853
+ } else if (result === 'skipped') {
854
+ console.log(` skipped ${target.label}: ${target.dir}`)
855
+ } else {
856
+ throw new Error(`Unable to install ${target.label} at ${target.dir}`)
857
+ }
858
+ }
859
+ } catch (err) {
860
+ console.error(`\n Error: ${err.message}\n`)
861
+ process.exit(1)
862
+ }
863
+
864
+ if (!force) {
865
+ console.log('\n Existing skill folders are left untouched. Use --force to refresh them.')
866
+ }
867
+
868
+ console.log('\n To publish the skill discovery index, add this to docsector.config.js:\n')
869
+ console.log(
870
+ AUTHORING_SKILL_CONFIG_SNIPPET.split('\n')
871
+ .map(line => ` ${line}`)
872
+ .join('\n')
873
+ )
874
+ console.log('\n Then run:')
875
+ console.log(' npx docsector build')
876
+ console.log('')
877
+ }
878
+
786
879
  /**
787
880
  * Scaffold a new Docsector documentation project.
788
881
  */
@@ -916,6 +1009,10 @@ switch (command) {
916
1009
  run('serve', ['dist/spa', '--history', ...args.slice(1)])
917
1010
  break
918
1011
 
1012
+ case 'install-skill':
1013
+ installAuthoringSkill({ force: args.includes('--force') })
1014
+ break
1015
+
919
1016
  case 'version':
920
1017
  case '-v':
921
1018
  case '--version':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsector/docsector-reader",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
5
5
  "productName": "Docsector Reader",
6
6
  "author": "Rodrigo de Araujo Vieira",
@@ -52,6 +52,45 @@ Docsector keeps two synchronized copies of the same skill:
52
52
 
53
53
  During build, Docsector copies the public artifact into `dist/spa/.well-known/agent-skills/` and generates the discovery index.
54
54
 
55
+ ## Retrofitting Older Scaffolds
56
+
57
+ Projects scaffolded before this skill existed can import it with the CLI helper:
58
+
59
+ ```bash
60
+ npx docsector install-skill
61
+ ```
62
+
63
+ The command copies the built-in skill into both expected locations:
64
+
65
+ - `.github/skills/docsector-documentation-authoring/`
66
+ - `public/.well-known/agent-skills/docsector-documentation-authoring/`
67
+
68
+ Existing folders are skipped so local edits are not overwritten. Use `--force` when you intentionally want to refresh the installed copy from the package:
69
+
70
+ ```bash
71
+ npx docsector install-skill --force
72
+ ```
73
+
74
+ The helper does not rewrite `docsector.config.js`. After installing the files, enable discovery with:
75
+
76
+ ```javascript
77
+ agentSkills: {
78
+ enabled: true,
79
+ path: '/.well-known/agent-skills/index.json',
80
+ schema: 'https://schemas.agentskills.io/discovery/0.2.0/schema.json',
81
+ skills: [
82
+ {
83
+ name: 'docsector-documentation-authoring',
84
+ type: 'skill-md',
85
+ description: 'Author Docsector documentation with Markdown, custom blocks, MCP, and WebMCP.',
86
+ url: '/.well-known/agent-skills/docsector-documentation-authoring/SKILL.md'
87
+ }
88
+ ]
89
+ }
90
+ ```
91
+
92
+ Then run `npx docsector build` to generate `/.well-known/agent-skills/index.json` with the computed digest.
93
+
55
94
  ## How Agents Should Use It
56
95
 
57
96
  Agents should load `SKILL.md` first, then open reference files only when a task needs more detail.
@@ -52,6 +52,45 @@ O Docsector mantém duas cópias sincronizadas da mesma skill:
52
52
 
53
53
  Durante o build, o Docsector copia o artefato público para `dist/spa/.well-known/agent-skills/` e gera o índice de descoberta.
54
54
 
55
+ ## Retrocompatibilidade Com Scaffolds Antigos
56
+
57
+ Projetos criados antes dessa skill existir podem importá-la com o helper da CLI:
58
+
59
+ ```bash
60
+ npx docsector install-skill
61
+ ```
62
+
63
+ O comando copia a skill embutida para os dois locais esperados:
64
+
65
+ - `.github/skills/docsector-documentation-authoring/`
66
+ - `public/.well-known/agent-skills/docsector-documentation-authoring/`
67
+
68
+ Pastas existentes são ignoradas para não sobrescrever edições locais. Use `--force` quando quiser atualizar a cópia instalada a partir do pacote:
69
+
70
+ ```bash
71
+ npx docsector install-skill --force
72
+ ```
73
+
74
+ O helper não reescreve `docsector.config.js`. Depois de instalar os arquivos, habilite a descoberta com:
75
+
76
+ ```javascript
77
+ agentSkills: {
78
+ enabled: true,
79
+ path: '/.well-known/agent-skills/index.json',
80
+ schema: 'https://schemas.agentskills.io/discovery/0.2.0/schema.json',
81
+ skills: [
82
+ {
83
+ name: 'docsector-documentation-authoring',
84
+ type: 'skill-md',
85
+ description: 'Author Docsector documentation with Markdown, custom blocks, MCP, and WebMCP.',
86
+ url: '/.well-known/agent-skills/docsector-documentation-authoring/SKILL.md'
87
+ }
88
+ ]
89
+ }
90
+ ```
91
+
92
+ Depois execute `npx docsector build` para gerar `/.well-known/agent-skills/index.json` com o digest calculado.
93
+
55
94
  ## Como Agentes Devem Usar
56
95
 
57
96
  Agentes devem carregar primeiro o `SKILL.md` e abrir os arquivos de referência apenas quando a tarefa precisar de mais detalhes.