@h2nguyen/arc42-node-mcp-server 2.0.0 → 2.1.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.
- package/CHANGELOG.md +63 -0
- package/README.md +81 -5
- package/dist/templates/formats/asciidoc/index.d.ts +178 -0
- package/dist/templates/formats/asciidoc/index.d.ts.map +1 -0
- package/dist/templates/formats/asciidoc/index.js +225 -0
- package/dist/templates/formats/asciidoc/index.js.map +1 -0
- package/dist/templates/formats/index.d.ts +108 -0
- package/dist/templates/formats/index.d.ts.map +1 -0
- package/dist/templates/formats/index.js +149 -0
- package/dist/templates/formats/index.js.map +1 -0
- package/dist/templates/formats/markdown/index.d.ts +172 -0
- package/dist/templates/formats/markdown/index.d.ts.map +1 -0
- package/dist/templates/formats/markdown/index.js +211 -0
- package/dist/templates/formats/markdown/index.js.map +1 -0
- package/dist/templates/formats/output-format-factory.d.ts +125 -0
- package/dist/templates/formats/output-format-factory.d.ts.map +1 -0
- package/dist/templates/formats/output-format-factory.js +166 -0
- package/dist/templates/formats/output-format-factory.js.map +1 -0
- package/dist/templates/formats/output-format-registry.d.ts +114 -0
- package/dist/templates/formats/output-format-registry.d.ts.map +1 -0
- package/dist/templates/formats/output-format-registry.js +147 -0
- package/dist/templates/formats/output-format-registry.js.map +1 -0
- package/dist/templates/formats/output-format-strategy.d.ts +195 -0
- package/dist/templates/formats/output-format-strategy.d.ts.map +1 -0
- package/dist/templates/formats/output-format-strategy.js +69 -0
- package/dist/templates/formats/output-format-strategy.js.map +1 -0
- package/dist/templates/index.d.ts +9 -8
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +21 -10
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/locales/cz/index.d.ts +25 -3
- package/dist/templates/locales/cz/index.d.ts.map +1 -1
- package/dist/templates/locales/cz/index.js +34 -18
- package/dist/templates/locales/cz/index.js.map +1 -1
- package/dist/templates/locales/cz/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/cz/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/cz/templates-asciidoc.js +764 -0
- package/dist/templates/locales/cz/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/cz/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/cz/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/cz/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/cz/templates-markdown.js.map +1 -0
- package/dist/templates/locales/de/index.d.ts +14 -4
- package/dist/templates/locales/de/index.d.ts.map +1 -1
- package/dist/templates/locales/de/index.js +22 -25
- package/dist/templates/locales/de/index.js.map +1 -1
- package/dist/templates/locales/de/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/de/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/de/templates-asciidoc.js +814 -0
- package/dist/templates/locales/de/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/de/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/de/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/de/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/de/templates-markdown.js.map +1 -0
- package/dist/templates/locales/en/index.d.ts +14 -4
- package/dist/templates/locales/en/index.d.ts.map +1 -1
- package/dist/templates/locales/en/index.js +22 -25
- package/dist/templates/locales/en/index.js.map +1 -1
- package/dist/templates/locales/en/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/en/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/en/templates-asciidoc.js +764 -0
- package/dist/templates/locales/en/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/en/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/en/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/en/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/en/templates-markdown.js.map +1 -0
- package/dist/templates/locales/es/index.d.ts +15 -10
- package/dist/templates/locales/es/index.d.ts.map +1 -1
- package/dist/templates/locales/es/index.js +23 -31
- package/dist/templates/locales/es/index.js.map +1 -1
- package/dist/templates/locales/es/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/es/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/es/templates-asciidoc.js +764 -0
- package/dist/templates/locales/es/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/es/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/es/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/es/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/es/templates-markdown.js.map +1 -0
- package/dist/templates/locales/fr/index.d.ts +14 -9
- package/dist/templates/locales/fr/index.d.ts.map +1 -1
- package/dist/templates/locales/fr/index.js +22 -30
- package/dist/templates/locales/fr/index.js.map +1 -1
- package/dist/templates/locales/fr/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/fr/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/fr/templates-asciidoc.js +764 -0
- package/dist/templates/locales/fr/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/fr/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/fr/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/fr/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/fr/templates-markdown.js.map +1 -0
- package/dist/templates/locales/it/index.d.ts +14 -9
- package/dist/templates/locales/it/index.d.ts.map +1 -1
- package/dist/templates/locales/it/index.js +22 -30
- package/dist/templates/locales/it/index.js.map +1 -1
- package/dist/templates/locales/it/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/it/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/it/templates-asciidoc.js +764 -0
- package/dist/templates/locales/it/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/it/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/it/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/it/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/it/templates-markdown.js.map +1 -0
- package/dist/templates/locales/language-strategy-factory.d.ts +120 -0
- package/dist/templates/locales/language-strategy-factory.d.ts.map +1 -0
- package/dist/templates/locales/language-strategy-factory.js +127 -0
- package/dist/templates/locales/language-strategy-factory.js.map +1 -0
- package/dist/templates/locales/language-strategy.d.ts +16 -12
- package/dist/templates/locales/language-strategy.d.ts.map +1 -1
- package/dist/templates/locales/language-strategy.js.map +1 -1
- package/dist/templates/locales/nl/index.d.ts +14 -9
- package/dist/templates/locales/nl/index.d.ts.map +1 -1
- package/dist/templates/locales/nl/index.js +22 -30
- package/dist/templates/locales/nl/index.js.map +1 -1
- package/dist/templates/locales/nl/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/nl/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/nl/templates-asciidoc.js +764 -0
- package/dist/templates/locales/nl/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/nl/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/nl/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/nl/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/nl/templates-markdown.js.map +1 -0
- package/dist/templates/locales/pt/index.d.ts +14 -9
- package/dist/templates/locales/pt/index.d.ts.map +1 -1
- package/dist/templates/locales/pt/index.js +22 -30
- package/dist/templates/locales/pt/index.js.map +1 -1
- package/dist/templates/locales/pt/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/pt/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/pt/templates-asciidoc.js +764 -0
- package/dist/templates/locales/pt/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/pt/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/pt/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/pt/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/pt/templates-markdown.js.map +1 -0
- package/dist/templates/locales/ru/index.d.ts +19 -3
- package/dist/templates/locales/ru/index.d.ts.map +1 -1
- package/dist/templates/locales/ru/index.js +28 -24
- package/dist/templates/locales/ru/index.js.map +1 -1
- package/dist/templates/locales/ru/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/ru/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/ru/templates-asciidoc.js +996 -0
- package/dist/templates/locales/ru/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/ru/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/ru/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/ru/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/ru/templates-markdown.js.map +1 -0
- package/dist/templates/locales/template-provider.d.ts +22 -10
- package/dist/templates/locales/template-provider.d.ts.map +1 -1
- package/dist/templates/locales/template-provider.js +53 -14
- package/dist/templates/locales/template-provider.js.map +1 -1
- package/dist/templates/locales/ukr/index.d.ts +25 -3
- package/dist/templates/locales/ukr/index.d.ts.map +1 -1
- package/dist/templates/locales/ukr/index.js +34 -18
- package/dist/templates/locales/ukr/index.js.map +1 -1
- package/dist/templates/locales/ukr/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/ukr/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/ukr/templates-asciidoc.js +764 -0
- package/dist/templates/locales/ukr/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/ukr/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/ukr/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/ukr/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/ukr/templates-markdown.js.map +1 -0
- package/dist/templates/locales/zh/index.d.ts +25 -3
- package/dist/templates/locales/zh/index.d.ts.map +1 -1
- package/dist/templates/locales/zh/index.js +34 -18
- package/dist/templates/locales/zh/index.js.map +1 -1
- package/dist/templates/locales/zh/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/zh/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/zh/templates-asciidoc.js +764 -0
- package/dist/templates/locales/zh/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/zh/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/zh/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/zh/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/zh/templates-markdown.js.map +1 -0
- package/dist/tools/arc42-init.d.ts +2 -1
- package/dist/tools/arc42-init.d.ts.map +1 -1
- package/dist/tools/arc42-init.js +154 -24
- package/dist/tools/arc42-init.js.map +1 -1
- package/dist/tools/arc42-status.d.ts.map +1 -1
- package/dist/tools/arc42-status.js +66 -10
- package/dist/tools/arc42-status.js.map +1 -1
- package/dist/tools/arc42-workflow-guide.d.ts +1 -0
- package/dist/tools/arc42-workflow-guide.d.ts.map +1 -1
- package/dist/tools/arc42-workflow-guide.js +16 -14
- package/dist/tools/arc42-workflow-guide.js.map +1 -1
- package/dist/tools/generate-template.d.ts +1 -0
- package/dist/tools/generate-template.d.ts.map +1 -1
- package/dist/tools/generate-template.js +16 -5
- package/dist/tools/generate-template.js.map +1 -1
- package/dist/tools/get-section.d.ts.map +1 -1
- package/dist/tools/get-section.js +28 -7
- package/dist/tools/get-section.js.map +1 -1
- package/dist/tools/update-section.d.ts +1 -1
- package/dist/tools/update-section.d.ts.map +1 -1
- package/dist/tools/update-section.js +71 -8
- package/dist/tools/update-section.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/locales/cz/templates.d.ts.map +0 -1
- package/dist/templates/locales/cz/templates.js.map +0 -1
- package/dist/templates/locales/de/templates.d.ts.map +0 -1
- package/dist/templates/locales/de/templates.js.map +0 -1
- package/dist/templates/locales/en/templates.d.ts.map +0 -1
- package/dist/templates/locales/en/templates.js.map +0 -1
- package/dist/templates/locales/es/templates.d.ts.map +0 -1
- package/dist/templates/locales/es/templates.js.map +0 -1
- package/dist/templates/locales/fr/templates.d.ts.map +0 -1
- package/dist/templates/locales/fr/templates.js.map +0 -1
- package/dist/templates/locales/it/templates.d.ts.map +0 -1
- package/dist/templates/locales/it/templates.js.map +0 -1
- package/dist/templates/locales/nl/templates.d.ts.map +0 -1
- package/dist/templates/locales/nl/templates.js.map +0 -1
- package/dist/templates/locales/pt/templates.d.ts.map +0 -1
- package/dist/templates/locales/pt/templates.js.map +0 -1
- package/dist/templates/locales/ru/templates.d.ts.map +0 -1
- package/dist/templates/locales/ru/templates.js.map +0 -1
- package/dist/templates/locales/ukr/templates.d.ts.map +0 -1
- package/dist/templates/locales/ukr/templates.js.map +0 -1
- package/dist/templates/locales/zh/templates.d.ts.map +0 -1
- package/dist/templates/locales/zh/templates.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,69 @@ All notable changes to the arc42 MCP Server will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0] - 2026-02-14
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Multiple Output Format Support**: Documentation can now be generated in both Markdown and AsciiDoc formats
|
|
12
|
+
- Supported formats: `markdown` (aliases: md, mdown, mkd) and `asciidoc` (aliases: adoc, ascii, asciidoctor, asc)
|
|
13
|
+
- Format parameter added to `arc42-init`, `generate-template`, and `arc42-workflow-guide` tools
|
|
14
|
+
- Format configuration stored in `config.yaml` for project-level default
|
|
15
|
+
- AsciiDoc is now the **default format** for new projects (richer feature set for professional documentation)
|
|
16
|
+
- **Native AsciiDoc Templates**: All 11 languages now have native AsciiDoc templates sourced directly from the official arc42-template repository
|
|
17
|
+
- Templates preserve AsciiDoc-specific features (includes, admonitions, cross-references)
|
|
18
|
+
- No quality loss from format conversion - true native templates
|
|
19
|
+
- **Output Format Strategy Architecture**: Pluggable format system using Strategy Pattern
|
|
20
|
+
- `OutputFormatStrategy` interface for format-specific syntax generation
|
|
21
|
+
- `OutputFormatRegistry` for centralized format storage with O(1) lookup
|
|
22
|
+
- `OutputFormatFactory` for format creation with normalization and fallback
|
|
23
|
+
- `MarkdownFormatStrategy` and `AsciiDocFormatStrategy` implementations
|
|
24
|
+
- **Plugin Architecture for Language Templates**: New plugin-based template system
|
|
25
|
+
- `FormatTemplatePlugin` interface for format-specific template providers
|
|
26
|
+
- `createLanguageStrategy()` factory for composing strategies with format plugins
|
|
27
|
+
- `createFormatPlugin()` and `createFormatPluginsWithFallback()` helper functions
|
|
28
|
+
- Each language now uses plugin architecture for DRY template management
|
|
29
|
+
- **Format Detection Utilities**: New utility functions in `src/templates/formats/index.ts`
|
|
30
|
+
- `detectOutputFormatFromExtension()` - detect format from file extension
|
|
31
|
+
- `detectOutputFormatFromFilename()` - detect format from filename
|
|
32
|
+
- `isOutputFormatSupported()` - check if format code is supported
|
|
33
|
+
- `getSupportedOutputFormatCodes()` - list all available format codes
|
|
34
|
+
- **Comprehensive Test Coverage**: 1,279 tests with excellent coverage
|
|
35
|
+
- New test files for format module (`output-format-strategy.test.ts`, `output-format-registry.test.ts`, etc.)
|
|
36
|
+
- Integration tests for format-language combinations
|
|
37
|
+
- Coverage: 98.77% statements, 91.82% branches, 99.18% functions, 98.75% lines
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- **Breaking**: `LanguageStrategy` interface methods renamed for format awareness:
|
|
41
|
+
- `getTemplate(section)` → `getTemplateForFormat(section, format)`
|
|
42
|
+
- `getWorkflowGuide()` → `getWorkflowGuideForFormat(format)`
|
|
43
|
+
- `getReadmeContent(projectName?)` → `getReadmeContentForFormat(projectName, format)`
|
|
44
|
+
- **Breaking**: Default output format changed from Markdown to AsciiDoc for new projects
|
|
45
|
+
- `arc42-init` now accepts optional `format` parameter (defaults to asciidoc)
|
|
46
|
+
- `generate-template` now accepts optional `format` parameter (defaults to config.yaml setting or asciidoc)
|
|
47
|
+
- `arc42-workflow-guide` now accepts optional `format` parameter (defaults to asciidoc)
|
|
48
|
+
- `arc42-status` now displays configured format alongside language information
|
|
49
|
+
- `update-section` now detects and maintains existing file format based on extension
|
|
50
|
+
- `get-section` now reads files regardless of format (supports both `.md` and `.adoc`)
|
|
51
|
+
- Template files restructured: each language now has separate `templates-markdown.ts` and `templates-asciidoc.ts`
|
|
52
|
+
- Removed unified `templates.ts` files in favor of format-specific template files
|
|
53
|
+
|
|
54
|
+
### Architecture
|
|
55
|
+
- Added Strategy Pattern for output format implementations (`OutputFormatStrategy` interface)
|
|
56
|
+
- Added Registry Pattern for format storage (`OutputFormatRegistry` class)
|
|
57
|
+
- Added Factory Pattern for format creation (`OutputFormatFactory` class)
|
|
58
|
+
- Added Plugin Pattern for language template providers (`FormatTemplatePlugin` interface)
|
|
59
|
+
- New `src/templates/formats/` module with complete format infrastructure
|
|
60
|
+
- New `src/templates/locales/language-strategy-factory.ts` for plugin-based strategy creation
|
|
61
|
+
- All format strategies follow S.O.L.I.D principles with LSP-compliant substitutability
|
|
62
|
+
- Format constants defined in `output-format-strategy.ts`: `SUPPORTED_OUTPUT_FORMAT_CODES`, `OUTPUT_FORMAT_ALIASES`, `DEFAULT_OUTPUT_FORMAT`
|
|
63
|
+
|
|
64
|
+
### Documentation
|
|
65
|
+
- Architecture documentation converted from Markdown to AsciiDoc format
|
|
66
|
+
- Added PlantUML diagrams throughout arc42 documentation (business context, building blocks, runtime views, etc.)
|
|
67
|
+
- Updated ADR-011 through ADR-014 documenting format-related architectural decisions
|
|
68
|
+
- Updated glossary with output format terminology
|
|
69
|
+
- Spec documents in `.spec-workflow/specs/multiple-output-formats/` documenting feature requirements and design
|
|
70
|
+
|
|
8
71
|
## [2.0.0] - 2026-02-14
|
|
9
72
|
|
|
10
73
|
### Added
|
package/README.md
CHANGED
|
@@ -36,6 +36,10 @@ A Model Context Protocol (MCP) server that helps you create comprehensive archit
|
|
|
36
36
|
* [Supported Languages](#supported-languages)
|
|
37
37
|
* [Using Languages](#using-languages)
|
|
38
38
|
* [Language Configuration](#language-configuration)
|
|
39
|
+
* [📄 Multi-Format Support](#-multi-format-support)
|
|
40
|
+
* [Supported Formats](#supported-formats)
|
|
41
|
+
* [Using Formats](#using-formats)
|
|
42
|
+
* [Format Configuration](#format-configuration)
|
|
39
43
|
* [📚 The 12 arc42 Sections](#-the-12-arc42-sections)
|
|
40
44
|
* [📖 Usage Examples](#-usage-examples)
|
|
41
45
|
* [Example 1: Starting Fresh](#example-1-starting-fresh)
|
|
@@ -92,7 +96,7 @@ This MCP server dynamically reads version information from the **arc42 template
|
|
|
92
96
|
| Submodule Path | `vendor/arc42-template` |
|
|
93
97
|
| Version File | `vendor/arc42-template/EN/version.properties` |
|
|
94
98
|
|
|
95
|
-
> **Note**:
|
|
99
|
+
> **Note**: This server provides native templates in both **AsciiDoc** and **Markdown** formats for all 11 supported languages. AsciiDoc is the default format for new projects.
|
|
96
100
|
|
|
97
101
|
To display the current arc42 template version:
|
|
98
102
|
|
|
@@ -410,6 +414,7 @@ Load the complete arc42 documentation workflow guide with instructions for all 1
|
|
|
410
414
|
```typescript
|
|
411
415
|
arc42-workflow-guide {
|
|
412
416
|
language?: "EN" | "DE" | "ES" | ... // Optional: language code (default: EN)
|
|
417
|
+
format?: "asciidoc" | "markdown" // Optional: output format (default: asciidoc)
|
|
413
418
|
}
|
|
414
419
|
```
|
|
415
420
|
|
|
@@ -419,8 +424,9 @@ Initialize arc42 documentation workspace for your project.
|
|
|
419
424
|
```typescript
|
|
420
425
|
arc42-init {
|
|
421
426
|
projectName: "Your Project Name",
|
|
422
|
-
language?: "EN",
|
|
423
|
-
|
|
427
|
+
language?: "EN", // Optional: language for templates (default: EN)
|
|
428
|
+
format?: "asciidoc", // Optional: output format (default: asciidoc)
|
|
429
|
+
force?: false, // Re-initialize even if exists
|
|
424
430
|
targetFolder?: "/path/to/project" // Optional: specify target directory
|
|
425
431
|
}
|
|
426
432
|
```
|
|
@@ -432,7 +438,7 @@ Check the status of your documentation, including completion percentage and sect
|
|
|
432
438
|
arc42-status {
|
|
433
439
|
targetFolder?: "/path/to/project" // Optional: specify target directory
|
|
434
440
|
}
|
|
435
|
-
// Returns: language info, available languages, and localized section titles
|
|
441
|
+
// Returns: language info, format info, available languages/formats, and localized section titles
|
|
436
442
|
```
|
|
437
443
|
|
|
438
444
|
### generate-template
|
|
@@ -442,6 +448,7 @@ Generate a detailed template for any of the 12 arc42 sections.
|
|
|
442
448
|
generate-template {
|
|
443
449
|
section: "01_introduction_and_goals" | "02_architecture_constraints" | ...,
|
|
444
450
|
language?: "EN" | "DE" | "ES" | ... // Optional: language code (default: EN)
|
|
451
|
+
format?: "asciidoc" | "markdown" // Optional: output format (default: asciidoc)
|
|
445
452
|
}
|
|
446
453
|
```
|
|
447
454
|
|
|
@@ -451,10 +458,11 @@ Update content in a specific arc42 section.
|
|
|
451
458
|
```typescript
|
|
452
459
|
update-section {
|
|
453
460
|
section: "01_introduction_and_goals",
|
|
454
|
-
content: "
|
|
461
|
+
content: "= Your AsciiDoc or Markdown content here",
|
|
455
462
|
mode?: "replace" | "append",
|
|
456
463
|
targetFolder?: "/path/to/project" // Optional: specify target directory
|
|
457
464
|
}
|
|
465
|
+
// Note: Automatically detects format from existing file extension
|
|
458
466
|
```
|
|
459
467
|
|
|
460
468
|
### get-section
|
|
@@ -465,6 +473,7 @@ get-section {
|
|
|
465
473
|
section: "01_introduction_and_goals",
|
|
466
474
|
targetFolder?: "/path/to/project" // Optional: specify target directory
|
|
467
475
|
}
|
|
476
|
+
// Note: Supports both .md and .adoc file formats
|
|
468
477
|
```
|
|
469
478
|
|
|
470
479
|
## 🌍 Multi-Language Support
|
|
@@ -522,12 +531,79 @@ The language is stored in `config.yaml` when you initialize a workspace:
|
|
|
522
531
|
```yaml
|
|
523
532
|
projectName: My Project
|
|
524
533
|
language: DE
|
|
534
|
+
format: asciidoc
|
|
525
535
|
```
|
|
526
536
|
|
|
527
537
|
- `arc42-status` reads and displays the configured language
|
|
528
538
|
- Templates and section titles are localized based on this setting
|
|
529
539
|
- Language codes are case-insensitive (`de`, `DE`, `De` all work)
|
|
530
540
|
|
|
541
|
+
## 📄 Multi-Format Support
|
|
542
|
+
|
|
543
|
+
This MCP server supports documentation output in **2 formats**: Markdown and AsciiDoc.
|
|
544
|
+
|
|
545
|
+
### Supported Formats
|
|
546
|
+
|
|
547
|
+
| Code | Format | Extension | Aliases |
|
|
548
|
+
|------------|----------|-----------|------------------------------|
|
|
549
|
+
| `asciidoc` | AsciiDoc | `.adoc` | adoc, ascii, asciidoctor, asc |
|
|
550
|
+
| `markdown` | Markdown | `.md` | md, mdown, mkd |
|
|
551
|
+
|
|
552
|
+
> **Default**: AsciiDoc is the default format for new projects. AsciiDoc provides richer formatting features (includes, admonitions, cross-references) ideal for professional documentation.
|
|
553
|
+
|
|
554
|
+
### Using Formats
|
|
555
|
+
|
|
556
|
+
**Initialize with a specific format:**
|
|
557
|
+
|
|
558
|
+
```typescript
|
|
559
|
+
arc42-init {
|
|
560
|
+
projectName: "My Project",
|
|
561
|
+
format: "markdown" // Use Markdown instead of default AsciiDoc
|
|
562
|
+
}
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Generate templates in a specific format:**
|
|
566
|
+
|
|
567
|
+
```typescript
|
|
568
|
+
generate-template {
|
|
569
|
+
section: "01_introduction_and_goals",
|
|
570
|
+
format: "asciidoc" // AsciiDoc template
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
**Get workflow guide in a specific format:**
|
|
575
|
+
|
|
576
|
+
```typescript
|
|
577
|
+
arc42-workflow-guide {
|
|
578
|
+
format: "markdown" // Markdown guide
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Combine language and format:**
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
arc42-init {
|
|
586
|
+
projectName: "Mein Projekt",
|
|
587
|
+
language: "DE",
|
|
588
|
+
format: "asciidoc" // German AsciiDoc templates
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### Format Configuration
|
|
593
|
+
|
|
594
|
+
The format is stored in `config.yaml` when you initialize a workspace:
|
|
595
|
+
|
|
596
|
+
```yaml
|
|
597
|
+
projectName: My Project
|
|
598
|
+
language: EN
|
|
599
|
+
format: asciidoc
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
- `arc42-status` reads and displays the configured format
|
|
603
|
+
- `update-section` automatically detects file format from extension
|
|
604
|
+
- `get-section` supports both `.md` and `.adoc` files
|
|
605
|
+
- Format codes are case-insensitive and support aliases (`adoc`, `ASCIIDOC`, `md` all work)
|
|
606
|
+
|
|
531
607
|
## 📚 The 12 arc42 Sections
|
|
532
608
|
|
|
533
609
|
1. **Introduction and Goals** - Requirements, quality goals, stakeholders
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsciiDoc Format Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements the OutputFormatStrategy interface for AsciiDoc format.
|
|
5
|
+
* Generates valid AsciiDoc syntax compatible with Asciidoctor.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats/asciidoc
|
|
8
|
+
*
|
|
9
|
+
* S.O.L.I.D Principles:
|
|
10
|
+
* - SRP (Single Responsibility Principle): Only handles AsciiDoc syntax generation
|
|
11
|
+
* - LSP (Liskov Substitution Principle): Can replace any OutputFormatStrategy
|
|
12
|
+
*
|
|
13
|
+
* Design Patterns:
|
|
14
|
+
* - Strategy Pattern: Interchangeable format implementation
|
|
15
|
+
*/
|
|
16
|
+
import type { OutputFormatStrategy, OutputFormatCode } from '../output-format-strategy.js';
|
|
17
|
+
/**
|
|
18
|
+
* AsciiDoc Format Strategy
|
|
19
|
+
*
|
|
20
|
+
* Generates content in AsciiDoc format compatible with Asciidoctor.
|
|
21
|
+
* This is the default format for new arc42 documentation projects.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const asciidoc = new AsciiDocFormatStrategy();
|
|
26
|
+
*
|
|
27
|
+
* asciidoc.formatHeading('Hello', 1); // '= Hello'
|
|
28
|
+
* asciidoc.formatBold('text'); // '*text*'
|
|
29
|
+
* asciidoc.formatCode('const x = 1;', 'typescript');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class AsciiDocFormatStrategy implements OutputFormatStrategy {
|
|
33
|
+
/**
|
|
34
|
+
* Format code identifier
|
|
35
|
+
*/
|
|
36
|
+
readonly code: OutputFormatCode;
|
|
37
|
+
/**
|
|
38
|
+
* Human-readable format name
|
|
39
|
+
*/
|
|
40
|
+
readonly name: string;
|
|
41
|
+
/**
|
|
42
|
+
* File extension for AsciiDoc files
|
|
43
|
+
*/
|
|
44
|
+
readonly fileExtension: string;
|
|
45
|
+
/**
|
|
46
|
+
* Format a heading at the specified level
|
|
47
|
+
*
|
|
48
|
+
* Uses = prefix notation (= Title, == Section, === Subsection).
|
|
49
|
+
*
|
|
50
|
+
* @param text - The heading text
|
|
51
|
+
* @param level - Heading level (1-6)
|
|
52
|
+
* @returns AsciiDoc heading (e.g., '== Heading')
|
|
53
|
+
*/
|
|
54
|
+
formatHeading(text: string, level: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Format text as bold
|
|
57
|
+
*
|
|
58
|
+
* @param text - The text to make bold
|
|
59
|
+
* @returns Bold text with * wrapper
|
|
60
|
+
*/
|
|
61
|
+
formatBold(text: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Format text as italic
|
|
64
|
+
*
|
|
65
|
+
* @param text - The text to make italic
|
|
66
|
+
* @returns Italic text with _ wrapper
|
|
67
|
+
*/
|
|
68
|
+
formatItalic(text: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Format a code block with optional language
|
|
71
|
+
*
|
|
72
|
+
* Uses [source,language] attribute with ---- delimiters.
|
|
73
|
+
*
|
|
74
|
+
* @param code - The code content
|
|
75
|
+
* @param language - Optional language identifier for syntax highlighting
|
|
76
|
+
* @returns AsciiDoc source block
|
|
77
|
+
*/
|
|
78
|
+
formatCode(code: string, language?: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Format inline code
|
|
81
|
+
*
|
|
82
|
+
* Uses backtick wrapper (same as Markdown for compatibility).
|
|
83
|
+
*
|
|
84
|
+
* @param text - The code text
|
|
85
|
+
* @returns Inline code with backtick wrapper
|
|
86
|
+
*/
|
|
87
|
+
formatInlineCode(text: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Format an unordered (bulleted) list
|
|
90
|
+
*
|
|
91
|
+
* Uses * prefix for each item.
|
|
92
|
+
*
|
|
93
|
+
* @param items - Array of list items
|
|
94
|
+
* @returns Formatted unordered list
|
|
95
|
+
*/
|
|
96
|
+
formatUnorderedList(items: string[]): string;
|
|
97
|
+
/**
|
|
98
|
+
* Format an ordered (numbered) list
|
|
99
|
+
*
|
|
100
|
+
* Uses . prefix for each item (AsciiDoc auto-numbers).
|
|
101
|
+
*
|
|
102
|
+
* @param items - Array of list items
|
|
103
|
+
* @returns Formatted ordered list
|
|
104
|
+
*/
|
|
105
|
+
formatOrderedList(items: string[]): string;
|
|
106
|
+
/**
|
|
107
|
+
* Format a hyperlink
|
|
108
|
+
*
|
|
109
|
+
* Uses link:url[text] syntax.
|
|
110
|
+
*
|
|
111
|
+
* @param text - Link display text
|
|
112
|
+
* @param url - Link URL
|
|
113
|
+
* @returns AsciiDoc link
|
|
114
|
+
*/
|
|
115
|
+
formatLink(text: string, url: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Format an image
|
|
118
|
+
*
|
|
119
|
+
* Uses image::url[alt] syntax.
|
|
120
|
+
*
|
|
121
|
+
* @param alt - Alternative text for the image
|
|
122
|
+
* @param url - Image URL or path
|
|
123
|
+
* @returns AsciiDoc image macro
|
|
124
|
+
*/
|
|
125
|
+
formatImage(alt: string, url: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Format a table
|
|
128
|
+
*
|
|
129
|
+
* Creates an AsciiDoc table with |=== delimiters.
|
|
130
|
+
*
|
|
131
|
+
* @param headers - Array of column headers
|
|
132
|
+
* @param rows - 2D array of row data
|
|
133
|
+
* @returns Formatted AsciiDoc table
|
|
134
|
+
*/
|
|
135
|
+
formatTable(headers: string[], rows: string[][]): string;
|
|
136
|
+
/**
|
|
137
|
+
* Format a blockquote
|
|
138
|
+
*
|
|
139
|
+
* Uses ____ block delimiters for quote blocks.
|
|
140
|
+
*
|
|
141
|
+
* @param text - The quote text (may contain newlines)
|
|
142
|
+
* @returns Formatted blockquote
|
|
143
|
+
*/
|
|
144
|
+
formatBlockquote(text: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Format a horizontal rule/divider
|
|
147
|
+
*
|
|
148
|
+
* @returns AsciiDoc thematic break
|
|
149
|
+
*/
|
|
150
|
+
formatHorizontalRule(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Format an anchor/bookmark
|
|
153
|
+
*
|
|
154
|
+
* Uses [[id]] syntax for explicit anchors.
|
|
155
|
+
*
|
|
156
|
+
* @param id - The anchor identifier
|
|
157
|
+
* @returns AsciiDoc anchor
|
|
158
|
+
*/
|
|
159
|
+
formatAnchor(id: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Get the README filename for AsciiDoc
|
|
162
|
+
*
|
|
163
|
+
* @returns 'README.adoc'
|
|
164
|
+
*/
|
|
165
|
+
getReadmeFilename(): string;
|
|
166
|
+
/**
|
|
167
|
+
* Get the section filename with .adoc extension
|
|
168
|
+
*
|
|
169
|
+
* @param section - The section identifier
|
|
170
|
+
* @returns Section filename with .adoc extension
|
|
171
|
+
*/
|
|
172
|
+
getSectionFilename(section: string): string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Singleton instance of the AsciiDoc format strategy
|
|
176
|
+
*/
|
|
177
|
+
export declare const asciidocFormatStrategy: AsciiDocFormatStrategy;
|
|
178
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/formats/asciidoc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE3F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAc;IAE7C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAc;IAEnC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAW;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAKlD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAKnD;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAItC;;;;;;;OAOG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI5C;;;;;;;OAOG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI1C;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;;;;OAQG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM;IA0BxD;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAItC;;;;OAIG;IACH,oBAAoB,IAAI,MAAM;IAI9B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;OAIG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAG5C;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,wBAA+B,CAAC"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsciiDoc Format Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements the OutputFormatStrategy interface for AsciiDoc format.
|
|
5
|
+
* Generates valid AsciiDoc syntax compatible with Asciidoctor.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats/asciidoc
|
|
8
|
+
*
|
|
9
|
+
* S.O.L.I.D Principles:
|
|
10
|
+
* - SRP (Single Responsibility Principle): Only handles AsciiDoc syntax generation
|
|
11
|
+
* - LSP (Liskov Substitution Principle): Can replace any OutputFormatStrategy
|
|
12
|
+
*
|
|
13
|
+
* Design Patterns:
|
|
14
|
+
* - Strategy Pattern: Interchangeable format implementation
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* AsciiDoc Format Strategy
|
|
18
|
+
*
|
|
19
|
+
* Generates content in AsciiDoc format compatible with Asciidoctor.
|
|
20
|
+
* This is the default format for new arc42 documentation projects.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const asciidoc = new AsciiDocFormatStrategy();
|
|
25
|
+
*
|
|
26
|
+
* asciidoc.formatHeading('Hello', 1); // '= Hello'
|
|
27
|
+
* asciidoc.formatBold('text'); // '*text*'
|
|
28
|
+
* asciidoc.formatCode('const x = 1;', 'typescript');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class AsciiDocFormatStrategy {
|
|
32
|
+
/**
|
|
33
|
+
* Format code identifier
|
|
34
|
+
*/
|
|
35
|
+
code = 'asciidoc';
|
|
36
|
+
/**
|
|
37
|
+
* Human-readable format name
|
|
38
|
+
*/
|
|
39
|
+
name = 'AsciiDoc';
|
|
40
|
+
/**
|
|
41
|
+
* File extension for AsciiDoc files
|
|
42
|
+
*/
|
|
43
|
+
fileExtension = '.adoc';
|
|
44
|
+
/**
|
|
45
|
+
* Format a heading at the specified level
|
|
46
|
+
*
|
|
47
|
+
* Uses = prefix notation (= Title, == Section, === Subsection).
|
|
48
|
+
*
|
|
49
|
+
* @param text - The heading text
|
|
50
|
+
* @param level - Heading level (1-6)
|
|
51
|
+
* @returns AsciiDoc heading (e.g., '== Heading')
|
|
52
|
+
*/
|
|
53
|
+
formatHeading(text, level) {
|
|
54
|
+
const clampedLevel = Math.max(1, Math.min(6, level));
|
|
55
|
+
return '='.repeat(clampedLevel) + ' ' + text;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format text as bold
|
|
59
|
+
*
|
|
60
|
+
* @param text - The text to make bold
|
|
61
|
+
* @returns Bold text with * wrapper
|
|
62
|
+
*/
|
|
63
|
+
formatBold(text) {
|
|
64
|
+
return `*${text}*`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Format text as italic
|
|
68
|
+
*
|
|
69
|
+
* @param text - The text to make italic
|
|
70
|
+
* @returns Italic text with _ wrapper
|
|
71
|
+
*/
|
|
72
|
+
formatItalic(text) {
|
|
73
|
+
return `_${text}_`;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Format a code block with optional language
|
|
77
|
+
*
|
|
78
|
+
* Uses [source,language] attribute with ---- delimiters.
|
|
79
|
+
*
|
|
80
|
+
* @param code - The code content
|
|
81
|
+
* @param language - Optional language identifier for syntax highlighting
|
|
82
|
+
* @returns AsciiDoc source block
|
|
83
|
+
*/
|
|
84
|
+
formatCode(code, language) {
|
|
85
|
+
const sourceAttr = language ? `[source,${language}]` : '[source]';
|
|
86
|
+
return sourceAttr + '\n----\n' + code + '\n----';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Format inline code
|
|
90
|
+
*
|
|
91
|
+
* Uses backtick wrapper (same as Markdown for compatibility).
|
|
92
|
+
*
|
|
93
|
+
* @param text - The code text
|
|
94
|
+
* @returns Inline code with backtick wrapper
|
|
95
|
+
*/
|
|
96
|
+
formatInlineCode(text) {
|
|
97
|
+
return '`' + text + '`';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Format an unordered (bulleted) list
|
|
101
|
+
*
|
|
102
|
+
* Uses * prefix for each item.
|
|
103
|
+
*
|
|
104
|
+
* @param items - Array of list items
|
|
105
|
+
* @returns Formatted unordered list
|
|
106
|
+
*/
|
|
107
|
+
formatUnorderedList(items) {
|
|
108
|
+
return items.map(item => `* ${item}`).join('\n');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Format an ordered (numbered) list
|
|
112
|
+
*
|
|
113
|
+
* Uses . prefix for each item (AsciiDoc auto-numbers).
|
|
114
|
+
*
|
|
115
|
+
* @param items - Array of list items
|
|
116
|
+
* @returns Formatted ordered list
|
|
117
|
+
*/
|
|
118
|
+
formatOrderedList(items) {
|
|
119
|
+
return items.map(item => `. ${item}`).join('\n');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Format a hyperlink
|
|
123
|
+
*
|
|
124
|
+
* Uses link:url[text] syntax.
|
|
125
|
+
*
|
|
126
|
+
* @param text - Link display text
|
|
127
|
+
* @param url - Link URL
|
|
128
|
+
* @returns AsciiDoc link
|
|
129
|
+
*/
|
|
130
|
+
formatLink(text, url) {
|
|
131
|
+
return `link:${url}[${text}]`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Format an image
|
|
135
|
+
*
|
|
136
|
+
* Uses image::url[alt] syntax.
|
|
137
|
+
*
|
|
138
|
+
* @param alt - Alternative text for the image
|
|
139
|
+
* @param url - Image URL or path
|
|
140
|
+
* @returns AsciiDoc image macro
|
|
141
|
+
*/
|
|
142
|
+
formatImage(alt, url) {
|
|
143
|
+
return `image::${url}[${alt}]`;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Format a table
|
|
147
|
+
*
|
|
148
|
+
* Creates an AsciiDoc table with |=== delimiters.
|
|
149
|
+
*
|
|
150
|
+
* @param headers - Array of column headers
|
|
151
|
+
* @param rows - 2D array of row data
|
|
152
|
+
* @returns Formatted AsciiDoc table
|
|
153
|
+
*/
|
|
154
|
+
formatTable(headers, rows) {
|
|
155
|
+
if (headers.length === 0) {
|
|
156
|
+
return '';
|
|
157
|
+
}
|
|
158
|
+
const lines = [];
|
|
159
|
+
// Table start
|
|
160
|
+
lines.push('[cols="' + headers.map(() => '1').join(',') + '", options="header"]');
|
|
161
|
+
lines.push('|===');
|
|
162
|
+
// Header row
|
|
163
|
+
lines.push(headers.map(h => `| ${h}`).join(' '));
|
|
164
|
+
// Data rows
|
|
165
|
+
for (const row of rows) {
|
|
166
|
+
lines.push('');
|
|
167
|
+
lines.push(row.map(cell => `| ${cell}`).join(' '));
|
|
168
|
+
}
|
|
169
|
+
// Table end
|
|
170
|
+
lines.push('|===');
|
|
171
|
+
return lines.join('\n');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Format a blockquote
|
|
175
|
+
*
|
|
176
|
+
* Uses ____ block delimiters for quote blocks.
|
|
177
|
+
*
|
|
178
|
+
* @param text - The quote text (may contain newlines)
|
|
179
|
+
* @returns Formatted blockquote
|
|
180
|
+
*/
|
|
181
|
+
formatBlockquote(text) {
|
|
182
|
+
return '[quote]\n____\n' + text + '\n____';
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Format a horizontal rule/divider
|
|
186
|
+
*
|
|
187
|
+
* @returns AsciiDoc thematic break
|
|
188
|
+
*/
|
|
189
|
+
formatHorizontalRule() {
|
|
190
|
+
return "'''";
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Format an anchor/bookmark
|
|
194
|
+
*
|
|
195
|
+
* Uses [[id]] syntax for explicit anchors.
|
|
196
|
+
*
|
|
197
|
+
* @param id - The anchor identifier
|
|
198
|
+
* @returns AsciiDoc anchor
|
|
199
|
+
*/
|
|
200
|
+
formatAnchor(id) {
|
|
201
|
+
return `[[${id}]]`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get the README filename for AsciiDoc
|
|
205
|
+
*
|
|
206
|
+
* @returns 'README.adoc'
|
|
207
|
+
*/
|
|
208
|
+
getReadmeFilename() {
|
|
209
|
+
return 'README.adoc';
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get the section filename with .adoc extension
|
|
213
|
+
*
|
|
214
|
+
* @param section - The section identifier
|
|
215
|
+
* @returns Section filename with .adoc extension
|
|
216
|
+
*/
|
|
217
|
+
getSectionFilename(section) {
|
|
218
|
+
return `${section}.adoc`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Singleton instance of the AsciiDoc format strategy
|
|
223
|
+
*/
|
|
224
|
+
export const asciidocFormatStrategy = new AsciiDocFormatStrategy();
|
|
225
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/formats/asciidoc/index.ts"],"names":[],"mappings":"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"}
|