@mdream/action 1.0.0-beta.11 → 1.0.0-beta.12

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 (2) hide show
  1. package/README.md +116 -7
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,12 +1,37 @@
1
1
  # @mdream/action
2
2
 
3
- GitHub Action for generating `llms.txt` artifacts from HTML files.
3
+ GitHub Action that processes prerendered HTML files into `llms.txt` artifacts for CI/CD workflows.
4
4
 
5
- This action processes HTML files using glob patterns to generate LLM-ready artifacts in CI/CD workflows. Useful for prerendered sites, it creates both condensed and comprehensive LLM-ready files that can be uploaded as artifacts or deployed with your site whenever you make changes.
5
+ ## Setup
6
+
7
+ Add the action to any workflow step after your site build completes. Requires Node.js to be available in the runner environment.
8
+
9
+ ```yaml
10
+ - uses: harlan-zw/mdream@v1
11
+ with:
12
+ glob: 'dist/**/*.html'
13
+ site-name: My Documentation
14
+ description: Technical documentation and guides
15
+ origin: 'https://mydocs.com'
16
+ ```
6
17
 
7
18
  ## Usage
8
19
 
9
- ### Complete Workflow Example
20
+ ### Basic
21
+
22
+ ```yaml
23
+ - name: Generate llms.txt artifacts
24
+ uses: harlan-zw/mdream@v1
25
+ with:
26
+ glob: 'dist/**/*.html'
27
+ site-name: My Documentation
28
+ description: Technical documentation and guides
29
+ origin: 'https://mydocs.com'
30
+ ```
31
+
32
+ Generates `llms.txt`, `llms-full.txt`, and a `md/` directory in the current working directory.
33
+
34
+ ### Full Workflow
10
35
 
11
36
  ```yaml
12
37
  name: Generate LLMs.txt
@@ -37,11 +62,12 @@ jobs:
37
62
  run: npm run build
38
63
 
39
64
  - name: Generate llms.txt artifacts
65
+ id: llms
40
66
  uses: harlan-zw/mdream@v1
41
67
  with:
42
68
  glob: 'dist/**/*.html'
43
69
  site-name: My Documentation
44
- description: Comprehensive technical documentation and guides
70
+ description: Technical documentation and guides
45
71
  origin: 'https://mydocs.com'
46
72
  output: dist
47
73
 
@@ -54,7 +80,7 @@ jobs:
54
80
  dist/llms-full.txt
55
81
  dist/md/
56
82
 
57
- - name: Deploy to GitHub Pages (optional)
83
+ - name: Deploy to GitHub Pages
58
84
  if: github.ref == 'refs/heads/main'
59
85
  uses: peaceiris/actions-gh-pages@v3
60
86
  with:
@@ -62,9 +88,92 @@ jobs:
62
88
  publish_dir: ./dist
63
89
  ```
64
90
 
65
- ## Inputs
91
+ ### Using Outputs
92
+
93
+ Reference the action outputs in subsequent steps:
94
+
95
+ ```yaml
96
+ - name: Generate llms.txt artifacts
97
+ id: llms
98
+ uses: harlan-zw/mdream@v1
99
+ with:
100
+ glob: 'dist/**/*.html'
101
+ site-name: My Docs
102
+ description: My documentation site
103
+ origin: 'https://mydocs.com'
104
+ output: dist
105
+
106
+ - name: Print generated file paths
107
+ run: |
108
+ echo "llms.txt: ${{ steps.llms.outputs.llms-txt-path }}"
109
+ echo "llms-full.txt: ${{ steps.llms.outputs.llms-full-txt-path }}"
110
+ echo "Markdown files: ${{ steps.llms.outputs.markdown-files }}"
111
+ ```
112
+
113
+ ### Verbose Logging
114
+
115
+ ```yaml
116
+ - name: Generate llms.txt artifacts
117
+ uses: harlan-zw/mdream@v1
118
+ with:
119
+ glob: 'dist/**/*.html'
120
+ site-name: My Docs
121
+ description: My documentation site
122
+ origin: 'https://mydocs.com'
123
+ verbose: 'true'
124
+ ```
125
+
126
+ ## API Reference
127
+
128
+ ### Inputs
129
+
130
+ | Input | Required | Default | Description |
131
+ |-------|----------|---------|-------------|
132
+ | `glob` | Yes | | Glob pattern to match HTML files (e.g., `dist/**/*.html`). |
133
+ | `site-name` | Yes | | Name of your site. Used as the heading in generated files. |
134
+ | `description` | Yes | | Description of your site content. Rendered as a blockquote below the site name. |
135
+ | `origin` | Yes | | Base URL of your site (e.g., `https://mysite.com`). Used to construct full page URLs. |
136
+ | `output` | No | `.` | Output directory for generated files. Created recursively if it does not exist. |
137
+ | `chunk-size` | No | `4096` | Chunk size for streaming processing. |
138
+ | `verbose` | No | `false` | Enable verbose logging. Prints configuration values to the action log. |
139
+
140
+ ### Outputs
141
+
142
+ | Output | Description |
143
+ |--------|-------------|
144
+ | `llms-txt-path` | Path to the generated `llms.txt` file. |
145
+ | `llms-full-txt-path` | Path to the generated `llms-full.txt` file. |
146
+ | `markdown-files` | JSON array of paths to all generated individual Markdown files. |
147
+
148
+ ### Generated Files
149
+
150
+ | File | Description |
151
+ |------|-------------|
152
+ | `llms.txt` | Index listing all pages with titles, URLs, and descriptions. |
153
+ | `llms-full.txt` | Full Markdown content of every page with YAML frontmatter and a table of contents. |
154
+ | `md/<path>.md` | Individual Markdown files mirroring the site URL hierarchy. |
155
+
156
+ ### URL Path Resolution
157
+
158
+ HTML file paths are converted to URL paths automatically:
159
+
160
+ | File Path | Resolved URL |
161
+ |-----------|-------------|
162
+ | `dist/index.html` | `/` |
163
+ | `dist/about.html` | `/about` |
164
+ | `dist/docs/getting-started.html` | `/docs/getting-started` |
165
+ | `dist/blog/2024/post.html` | `/blog/2024/post` |
166
+
167
+ The `.html` extension is stripped. `index.html` files resolve to their parent directory path. The `origin` input is prepended to construct full URLs in the output.
168
+
169
+ ### Metadata Extraction
170
+
171
+ Metadata is extracted from each HTML file in the following priority order:
172
+
173
+ **Title:** `<title>` tag, then `<meta property="og:title">`.
174
+ **Description:** `<meta name="description">`, then `<meta property="og:description">`.
66
175
 
67
- See [action.yml](../../action.yml) for all available options and advanced configuration.
176
+ Descriptions are truncated to 100 characters in the `llms.txt` listing. Full metadata is embedded as YAML frontmatter in `llms-full.txt`.
68
177
 
69
178
  ## License
70
179
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mdream/action",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.11",
4
+ "version": "1.0.0-beta.12",
5
5
  "description": "GitHub Action for mdream llms.txt generation",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -18,8 +18,8 @@
18
18
  "@actions/core": "^3.0.0",
19
19
  "@actions/exec": "^3.0.0",
20
20
  "tinyglobby": "^0.2.15",
21
- "mdream": "1.0.0-beta.11",
22
- "@mdream/js": "1.0.0-beta.11"
21
+ "@mdream/js": "1.0.0-beta.12",
22
+ "mdream": "1.0.0-beta.12"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@vercel/ncc": "^0.38.4",