@bendyline/docblocks-cli 1.1.2 → 2.0.0

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.
Files changed (110) hide show
  1. package/README.md +60 -88
  2. package/dist/commands/convert.d.ts +12 -2
  3. package/dist/commands/convert.d.ts.map +1 -1
  4. package/dist/commands/convert.js +272 -101
  5. package/dist/commands/convert.js.map +1 -1
  6. package/dist/commands/mcp.d.ts +1 -1
  7. package/dist/commands/mcp.d.ts.map +1 -1
  8. package/dist/commands/mcp.js +90 -4
  9. package/dist/commands/mcp.js.map +1 -1
  10. package/dist/commands/parse.js +1 -1
  11. package/dist/commands/parse.js.map +1 -1
  12. package/dist/commands/serve.d.ts +9 -1
  13. package/dist/commands/serve.d.ts.map +1 -1
  14. package/dist/commands/serve.js +209 -44
  15. package/dist/commands/serve.js.map +1 -1
  16. package/dist/commands/themes.js +1 -1
  17. package/dist/commands/themes.js.map +1 -1
  18. package/dist/commands/transforms.js +1 -1
  19. package/dist/commands/transforms.js.map +1 -1
  20. package/dist/commands/video.d.ts +8 -1
  21. package/dist/commands/video.d.ts.map +1 -1
  22. package/dist/commands/video.js +50 -30
  23. package/dist/commands/video.js.map +1 -1
  24. package/dist/contained-file.d.ts +8 -0
  25. package/dist/contained-file.d.ts.map +1 -0
  26. package/dist/contained-file.js +77 -0
  27. package/dist/contained-file.js.map +1 -0
  28. package/dist/index.js +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/mcp/agentic-tools.d.ts +16 -0
  31. package/dist/mcp/agentic-tools.d.ts.map +1 -0
  32. package/dist/mcp/agentic-tools.js +967 -0
  33. package/dist/mcp/agentic-tools.js.map +1 -0
  34. package/dist/mcp/artifact-store.d.ts +98 -0
  35. package/dist/mcp/artifact-store.d.ts.map +1 -0
  36. package/dist/mcp/artifact-store.js +542 -0
  37. package/dist/mcp/artifact-store.js.map +1 -0
  38. package/dist/mcp/authority.d.ts +53 -0
  39. package/dist/mcp/authority.d.ts.map +1 -0
  40. package/dist/mcp/authority.js +433 -0
  41. package/dist/mcp/authority.js.map +1 -0
  42. package/dist/mcp/conversion-service.d.ts +111 -0
  43. package/dist/mcp/conversion-service.d.ts.map +1 -0
  44. package/dist/mcp/conversion-service.js +512 -0
  45. package/dist/mcp/conversion-service.js.map +1 -0
  46. package/dist/mcp/discovery-tools.d.ts +4 -0
  47. package/dist/mcp/discovery-tools.d.ts.map +1 -0
  48. package/dist/mcp/discovery-tools.js +114 -0
  49. package/dist/mcp/discovery-tools.js.map +1 -0
  50. package/dist/mcp/document-service.d.ts +47 -0
  51. package/dist/mcp/document-service.d.ts.map +1 -0
  52. package/dist/mcp/document-service.js +424 -0
  53. package/dist/mcp/document-service.js.map +1 -0
  54. package/dist/mcp/error-result.d.ts +17 -0
  55. package/dist/mcp/error-result.d.ts.map +1 -0
  56. package/dist/mcp/error-result.js +82 -0
  57. package/dist/mcp/error-result.js.map +1 -0
  58. package/dist/mcp/intelligence.d.ts +15 -0
  59. package/dist/mcp/intelligence.d.ts.map +1 -0
  60. package/dist/mcp/intelligence.js +855 -0
  61. package/dist/mcp/intelligence.js.map +1 -0
  62. package/dist/mcp/output-bounds.d.ts +13 -0
  63. package/dist/mcp/output-bounds.d.ts.map +1 -0
  64. package/dist/mcp/output-bounds.js +61 -0
  65. package/dist/mcp/output-bounds.js.map +1 -0
  66. package/dist/mcp/preview-service.d.ts +54 -0
  67. package/dist/mcp/preview-service.d.ts.map +1 -0
  68. package/dist/mcp/preview-service.js +454 -0
  69. package/dist/mcp/preview-service.js.map +1 -0
  70. package/dist/mcp/progress.d.ts +18 -0
  71. package/dist/mcp/progress.d.ts.map +1 -0
  72. package/dist/mcp/progress.js +28 -0
  73. package/dist/mcp/progress.js.map +1 -0
  74. package/dist/mcp/prompts.d.ts +4 -0
  75. package/dist/mcp/prompts.d.ts.map +1 -0
  76. package/dist/mcp/prompts.js +124 -0
  77. package/dist/mcp/prompts.js.map +1 -0
  78. package/dist/mcp/rendered-conversion.d.ts +34 -0
  79. package/dist/mcp/rendered-conversion.d.ts.map +1 -0
  80. package/dist/mcp/rendered-conversion.js +364 -0
  81. package/dist/mcp/rendered-conversion.js.map +1 -0
  82. package/dist/mcp/server.d.ts +67 -10
  83. package/dist/mcp/server.d.ts.map +1 -1
  84. package/dist/mcp/server.js +227 -496
  85. package/dist/mcp/server.js.map +1 -1
  86. package/dist/preview-policy.d.ts +8 -0
  87. package/dist/preview-policy.d.ts.map +1 -0
  88. package/dist/preview-policy.js +85 -0
  89. package/dist/preview-policy.js.map +1 -0
  90. package/dist/render-html.d.ts +8 -0
  91. package/dist/render-html.d.ts.map +1 -1
  92. package/dist/render-html.js +32 -7
  93. package/dist/render-html.js.map +1 -1
  94. package/dist/version.d.ts +4 -0
  95. package/dist/version.d.ts.map +1 -1
  96. package/dist/version.js +95 -6
  97. package/dist/version.js.map +1 -1
  98. package/package.json +11 -11
  99. package/dist/converters/docx-to-md.d.ts +0 -10
  100. package/dist/converters/docx-to-md.d.ts.map +0 -1
  101. package/dist/converters/docx-to-md.js +0 -17
  102. package/dist/converters/docx-to-md.js.map +0 -1
  103. package/dist/converters/pdf-to-md.d.ts +0 -14
  104. package/dist/converters/pdf-to-md.d.ts.map +0 -1
  105. package/dist/converters/pdf-to-md.js +0 -51
  106. package/dist/converters/pdf-to-md.js.map +0 -1
  107. package/dist/converters/pptx-to-md.d.ts +0 -13
  108. package/dist/converters/pptx-to-md.d.ts.map +0 -1
  109. package/dist/converters/pptx-to-md.js +0 -67
  110. package/dist/converters/pptx-to-md.js.map +0 -1
package/README.md CHANGED
@@ -1,121 +1,93 @@
1
1
  # @bendyline/docblocks-cli
2
2
 
3
- DocBlocks CLI build, serve, convert, and manage markdown document projects from the command line.
3
+ The DocBlocks command-line surface for document build and preview, linked-Squisq
4
+ format conversion, MP4 rendering, document parsing, and a local MCP server for
5
+ agents.
4
6
 
5
7
  ## Installation
6
8
 
7
- ```bash
8
- npm install -g @bendyline/docblocks-cli
9
- ```
10
-
11
- ## Commands
12
-
13
- ### `docblocks init [dir]`
14
-
15
- Initialize a new DocBlocks workspace. Creates a `.docblocks` directory with configuration.
16
-
17
- ### `docblocks build`
18
-
19
- Build markdown files into HTML output.
9
+ Node.js 22.14 or newer is required.
20
10
 
21
11
  ```bash
22
- docblocks build -i ./docs -o ./dist
12
+ npm install -g @bendyline/docblocks-cli
13
+ docblocks --help
23
14
  ```
24
15
 
25
- **Options:**
26
-
27
- - `-i, --input <dir>` — Input directory (default: `.`)
28
- - `-o, --output <dir>` — Output directory (default: `dist`)
29
- - `-t, --theme <id>` — Visual theme to apply
16
+ ## Documentation
30
17
 
31
- ### `docblocks serve`
18
+ - [Authoritative CLI reference](https://github.com/bendyline/docblocks/blob/main/docs/cli.md)
19
+ - [MCP architecture and protocol guide](https://github.com/bendyline/docblocks/blob/main/docs/mcp.md)
32
20
 
33
- Start a local development server for previewing documents.
21
+ Those guides describe current input support, linked Squisq ownership, format
22
+ directions, overwrite behavior, MCP authority, artifact lifecycle, and assurance.
34
23
 
35
- **Options:**
24
+ ## Commands
36
25
 
37
- - `-p, --port <port>` — Port to listen on (default: `3000`)
38
- - `-d, --dir <dir>` — Directory to serve (default: `.`)
39
- - `-t, --theme <id>` Visual theme to apply
26
+ | Command | Purpose |
27
+ | ---------------------------------- | ----------------------------------------------------- |
28
+ | `docblocks init [dir]` | Create minimal `.docblocks/config.json` metadata. |
29
+ | `docblocks build` | Recursively build Markdown into standalone HTML. |
30
+ | `docblocks serve` | Run a constrained local preview server. |
31
+ | `docblocks convert <input>` | Convert through the linked Squisq registry. |
32
+ | `docblocks video <input> [output]` | Render a configurable MP4. |
33
+ | `docblocks mcp` | Start the artifact-first MCP server over local stdio. |
34
+ | `docblocks themes` | List linked Squisq theme IDs. |
35
+ | `docblocks transforms` | List linked Squisq transform IDs. |
36
+ | `docblocks parse <input>` | Parse UTF-8 Markdown into Squisq Markdown AST JSON. |
40
37
 
41
- ### `docblocks convert <input>`
38
+ Use `docblocks help <command>` for the installed option summary.
42
39
 
43
- Convert a markdown document to DOCX, PPTX, PDF, HTML, or DBK container format. `<input>` can be a `.md` file, a `.zip`/`.dbk` container, or a folder.
40
+ ## Examples
44
41
 
45
42
  ```bash
46
- # Convert to all formats
47
- docblocks convert story.md
48
-
49
- # Convert to specific formats with a theme
50
- docblocks convert story.md -f docx,pdf -t cinematic
51
-
52
- # Apply a transform style before exporting
53
- docblocks convert story.md --transform documentary -o ./output
54
- ```
55
-
56
- **Options:**
43
+ # Build and preview Markdown
44
+ docblocks build --input ./docs --output ./dist
45
+ docblocks serve --dir ./docs
57
46
 
58
- - `-o, --output-dir <dir>` Output directory
59
- - `-f, --formats <list>` — Comma-separated formats: docx, pptx, pdf, html, dbk
60
- - `-t, --theme <id>` — Visual theme (use `docblocks themes` to list)
61
- - `--transform <style>` — Transform style (use `docblocks transforms` to list)
62
-
63
- ### `docblocks video <input> [output]`
47
+ # The no-flag conversion set is exactly DOCX, PPTX, PDF, HTML, and DBK
48
+ docblocks convert story.md
64
49
 
65
- Render a document to MP4 video with synced animations. Requires ffmpeg and Playwright. `<input>` can be a `.md` file, a `.zip`/`.dbk` container, or a folder.
50
+ # Select any export-capable linked-registry formats
51
+ docblocks convert report.docx --formats md,pdf,pptx --output-dir ./exports
66
52
 
67
- ```bash
53
+ # Render MP4 with explicit media controls
68
54
  docblocks video story.md --quality high --orientation portrait
69
- ```
70
55
 
71
- **Options:**
56
+ # Discover authoring vocabulary from linked Squisq
57
+ docblocks themes
58
+ docblocks transforms
72
59
 
73
- - `-o, --output <path>` Output MP4 path
74
- - `--fps <number>` — Frames per second (1-120, default: 30)
75
- - `--quality <level>` — draft, normal, or high
76
- - `--orientation <orient>` — landscape or portrait
77
- - `--captions <style>` — off, standard, or social
78
- - `--width <pixels>` / `--height <pixels>` — Override dimensions
79
-
80
- ### `docblocks mcp`
81
-
82
- Start an MCP (Model Context Protocol) server over stdio for AI-assisted document operations.
83
-
84
- ```bash
60
+ # Start MCP with no filesystem authority
85
61
  docblocks mcp
86
- ```
87
-
88
- **MCP Tools exposed:**
89
-
90
- - `export_markdown_to_docx` / `_pdf` / `_pptx` / `_html` / `_video` — Export markdown to polished output formats
91
- - `analyze_markdown` — Extract content structure (stats, quotes, facts, dates)
92
- - `restyle_markdown` — Apply a transform style and return restyled markdown
93
- - `list_themes` / `list_transform_styles` / `list_export_formats` — Discovery tools
94
-
95
- All export tools accept raw markdown text directly — AI agents can write content and immediately export without temp files.
96
62
 
97
- **Claude Desktop / Copilot integration:**
98
-
99
- ```json
100
- {
101
- "mcpServers": {
102
- "docblocks": { "command": "npx", "args": ["docblocks", "mcp"] }
103
- }
104
- }
63
+ # Grant independent roots when an agent needs files or durable output
64
+ docblocks mcp --allow-read ./documents --allow-write ./exports
105
65
  ```
106
66
 
107
- ### `docblocks themes`
108
-
109
- List all available visual themes.
67
+ `convert` and `video` accept Markdown, Squisq JSON Doc, DBK/ZIP, folders, and
68
+ import-capable linked-registry formats. Direct `build`, `convert`, and `video`
69
+ outputs replace existing destination files. MCP conversions instead return
70
+ immutable session artifacts; only explicit `save_artifact` materializes one, using
71
+ no-replace or hash-conditional replacement semantics.
110
72
 
111
- ### `docblocks transforms`
73
+ The live linked registry currently covers Markdown, DOCX, PDF, PPTX, XLSX, CSV,
74
+ HTML, HTML ZIP, EPUB, DBK, MP4, and GIF. Direction varies by format, so use the
75
+ CLI reference or MCP `list_formats` rather than assuming every format imports.
112
76
 
113
- List all available transform styles.
77
+ MP4/GIF rendering requires Chromium and FFmpeg. Install Chromium with
78
+ `npx playwright install chromium`; Squisq resolves FFmpeg from `SQUISQ_FFMPEG`,
79
+ `PATH`, or `ffmpeg-static`, in that order.
114
80
 
115
- ### `docblocks parse <input>`
81
+ ## Development with linked Squisq
116
82
 
117
- Parse a markdown file and print its structure as JSON.
83
+ From the DocBlocks repository root:
118
84
 
119
- ## License
85
+ ```bash
86
+ npm run link:squisq
87
+ npm run check:squisq-linked
88
+ npm run test:mcp:linked
89
+ npm run all
90
+ ```
120
91
 
121
- MIT
92
+ The linked assurance commands use the sibling `..\squisq` source checkout, not the
93
+ npm package copy.
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * convert command
3
3
  *
4
- * Reads a markdown file, ZIP/DBK container, or folder and exports to
5
- * supported formats: DOCX, PPTX, PDF, HTML, and container ZIP (.dbk).
4
+ * Reads any input supported by the linked Squisq CLI and exports through its
5
+ * canonical format registry. The historical default set remains DOCX, PPTX,
6
+ * PDF, HTML, and DBK; callers may explicitly request any export-capable
7
+ * registry format.
6
8
  *
7
9
  * Wraps the same logic as squisq-cli's convert command, reusing the
8
10
  * underlying squisq libraries directly.
@@ -10,17 +12,25 @@
10
12
  import { Command } from 'commander';
11
13
  import type { MarkdownDocument } from '@bendyline/squisq/markdown';
12
14
  import type { ContentContainer } from '@bendyline/squisq/storage';
15
+ import type { FormatRegistry } from '@bendyline/squisq-cli/api';
13
16
  export interface ConvertOptions {
14
17
  outputDir?: string;
15
18
  formats?: string;
16
19
  theme?: string;
17
20
  transform?: string;
21
+ /** Cancel reading, transformation, conversion, or publication at a bounded boundary. */
22
+ signal?: AbortSignal;
23
+ /** Programmatic registry override; the CLI defaults to the linked Squisq registry. */
24
+ registry?: FormatRegistry;
18
25
  }
19
26
  export interface ConvertResult {
20
27
  outputFiles: {
21
28
  path: string;
22
29
  format: string;
23
30
  size: number;
31
+ mimeType: string;
32
+ suggestedFilename: string;
33
+ warnings: string[];
24
34
  }[];
25
35
  }
26
36
  export declare function runConvert(inputPath: string, opts: ConvertOptions): Promise<ConvertResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/commands/convert.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAqBlE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