@mdream/action 2.0.0-beta.1 → 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.
- package/README.md +71 -38
- package/dist/index.js +1 -1
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -2,17 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
GitHub Action that processes prerendered HTML files into `llms.txt` artifacts for CI/CD workflows.
|
|
4
4
|
|
|
5
|
+
## Migrating from v1
|
|
6
|
+
|
|
7
|
+
The repository no longer provides `action.yml`.
|
|
8
|
+
Replace `uses: harlan-zw/mdream@...` with the [npm step](#setup) below.
|
|
9
|
+
Set up Node.js 24, then run the step after your site build.
|
|
10
|
+
Keep the step's `id` so later `steps.<id>.outputs` references still work.
|
|
11
|
+
Move each `with` input to an `INPUT_` environment variable.
|
|
12
|
+
For example, `site-name` becomes `INPUT_SITE-NAME`.
|
|
13
|
+
Remove `chunk-size` or `INPUT_CHUNK-SIZE`; it had no effect.
|
|
14
|
+
The [output names](#outputs) remain the same.
|
|
15
|
+
|
|
16
|
+
These docs cover v2.
|
|
17
|
+
For an earlier release, read the README at its release tag.
|
|
18
|
+
|
|
5
19
|
## Setup
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
Run the v2 package after your site build completes. Use Node.js 24 on the runner.
|
|
22
|
+
These examples run the npm distribution directly with `@mdream/action`.
|
|
23
|
+
Inputs use `INPUT_` environment variables. Output names stay the same.
|
|
8
24
|
|
|
9
25
|
```yaml
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
- name: Generate llms.txt artifacts
|
|
27
|
+
run: |
|
|
28
|
+
npm install --prefix "$RUNNER_TEMP/mdream-action" @mdream/action
|
|
29
|
+
node "$RUNNER_TEMP/mdream-action/node_modules/@mdream/action/dist/index.js"
|
|
30
|
+
env:
|
|
31
|
+
INPUT_GLOB: 'dist/**/*.html'
|
|
32
|
+
INPUT_SITE-NAME: My Documentation
|
|
33
|
+
INPUT_DESCRIPTION: Technical documentation and guides
|
|
34
|
+
INPUT_ORIGIN: 'https://mydocs.com'
|
|
16
35
|
```
|
|
17
36
|
|
|
18
37
|
## Usage
|
|
@@ -21,12 +40,14 @@ Add the action to any workflow step after your site build completes. Requires No
|
|
|
21
40
|
|
|
22
41
|
```yaml
|
|
23
42
|
- name: Generate llms.txt artifacts
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
run: |
|
|
44
|
+
npm install --prefix "$RUNNER_TEMP/mdream-action" @mdream/action
|
|
45
|
+
node "$RUNNER_TEMP/mdream-action/node_modules/@mdream/action/dist/index.js"
|
|
46
|
+
env:
|
|
47
|
+
INPUT_GLOB: 'dist/**/*.html'
|
|
48
|
+
INPUT_SITE-NAME: My Documentation
|
|
49
|
+
INPUT_DESCRIPTION: Technical documentation and guides
|
|
50
|
+
INPUT_ORIGIN: 'https://mydocs.com'
|
|
30
51
|
```
|
|
31
52
|
|
|
32
53
|
Generates `llms.txt`, `llms-full.txt`, and a `md/` directory in the current working directory.
|
|
@@ -45,10 +66,14 @@ on:
|
|
|
45
66
|
jobs:
|
|
46
67
|
generate-llms-txt:
|
|
47
68
|
runs-on: ubuntu-latest
|
|
69
|
+
permissions:
|
|
70
|
+
contents: write
|
|
48
71
|
|
|
49
72
|
steps:
|
|
50
73
|
- name: Checkout repository
|
|
51
74
|
uses: actions/checkout@v4
|
|
75
|
+
with:
|
|
76
|
+
persist-credentials: false
|
|
52
77
|
|
|
53
78
|
- name: Setup Node.js
|
|
54
79
|
uses: actions/setup-node@v4
|
|
@@ -63,13 +88,15 @@ jobs:
|
|
|
63
88
|
|
|
64
89
|
- name: Generate llms.txt artifacts
|
|
65
90
|
id: llms
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
run: |
|
|
92
|
+
npm install --prefix "$RUNNER_TEMP/mdream-action" @mdream/action
|
|
93
|
+
node "$RUNNER_TEMP/mdream-action/node_modules/@mdream/action/dist/index.js"
|
|
94
|
+
env:
|
|
95
|
+
INPUT_GLOB: 'dist/**/*.html'
|
|
96
|
+
INPUT_SITE-NAME: My Documentation
|
|
97
|
+
INPUT_DESCRIPTION: Technical documentation and guides
|
|
98
|
+
INPUT_ORIGIN: 'https://mydocs.com'
|
|
99
|
+
INPUT_OUTPUT: dist
|
|
73
100
|
|
|
74
101
|
- name: Upload llms.txt artifacts
|
|
75
102
|
uses: actions/upload-artifact@v4
|
|
@@ -90,18 +117,20 @@ jobs:
|
|
|
90
117
|
|
|
91
118
|
### Using Outputs
|
|
92
119
|
|
|
93
|
-
|
|
120
|
+
Use the action outputs in later steps:
|
|
94
121
|
|
|
95
122
|
```yaml
|
|
96
123
|
- name: Generate llms.txt artifacts
|
|
97
124
|
id: llms
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
125
|
+
run: |
|
|
126
|
+
npm install --prefix "$RUNNER_TEMP/mdream-action" @mdream/action
|
|
127
|
+
node "$RUNNER_TEMP/mdream-action/node_modules/@mdream/action/dist/index.js"
|
|
128
|
+
env:
|
|
129
|
+
INPUT_GLOB: 'dist/**/*.html'
|
|
130
|
+
INPUT_SITE-NAME: My Docs
|
|
131
|
+
INPUT_DESCRIPTION: My documentation site
|
|
132
|
+
INPUT_ORIGIN: 'https://mydocs.com'
|
|
133
|
+
INPUT_OUTPUT: dist
|
|
105
134
|
|
|
106
135
|
- name: Print generated file paths
|
|
107
136
|
run: |
|
|
@@ -114,13 +143,15 @@ Reference the action outputs in subsequent steps:
|
|
|
114
143
|
|
|
115
144
|
```yaml
|
|
116
145
|
- name: Generate llms.txt artifacts
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
146
|
+
run: |
|
|
147
|
+
npm install --prefix "$RUNNER_TEMP/mdream-action" @mdream/action
|
|
148
|
+
node "$RUNNER_TEMP/mdream-action/node_modules/@mdream/action/dist/index.js"
|
|
149
|
+
env:
|
|
150
|
+
INPUT_GLOB: 'dist/**/*.html'
|
|
151
|
+
INPUT_SITE-NAME: My Docs
|
|
152
|
+
INPUT_DESCRIPTION: My documentation site
|
|
153
|
+
INPUT_ORIGIN: 'https://mydocs.com'
|
|
154
|
+
INPUT_VERBOSE: 'true'
|
|
124
155
|
```
|
|
125
156
|
|
|
126
157
|
## API Reference
|
|
@@ -134,7 +165,6 @@ Reference the action outputs in subsequent steps:
|
|
|
134
165
|
| `description` | Yes | | Description of your site content. Rendered as a blockquote below the site name. |
|
|
135
166
|
| `origin` | Yes | | Base URL of your site (e.g., `https://mysite.com`). Used to construct full page URLs. |
|
|
136
167
|
| `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
168
|
| `verbose` | No | `false` | Enable verbose logging. Prints configuration values to the action log. |
|
|
139
169
|
|
|
140
170
|
### Outputs
|
|
@@ -164,7 +194,9 @@ HTML file paths are converted to URL paths automatically:
|
|
|
164
194
|
| `dist/docs/getting-started.html` | `/docs/getting-started` |
|
|
165
195
|
| `dist/blog/2024/post.html` | `/blog/2024/post` |
|
|
166
196
|
|
|
167
|
-
The
|
|
197
|
+
The action removes the `.html` extension.
|
|
198
|
+
It maps `index.html` files to their parent directory path.
|
|
199
|
+
It adds the `origin` input before each path to form a full URL.
|
|
168
200
|
|
|
169
201
|
### Metadata Extraction
|
|
170
202
|
|
|
@@ -173,7 +205,8 @@ Metadata is extracted from each HTML file in the following priority order:
|
|
|
173
205
|
**Title:** `<title>` tag, then `<meta property="og:title">`.
|
|
174
206
|
**Description:** `<meta name="description">`, then `<meta property="og:description">`.
|
|
175
207
|
|
|
176
|
-
|
|
208
|
+
The `llms.txt` listing limits descriptions to 100 characters.
|
|
209
|
+
The `llms-full.txt` file includes full metadata as YAML frontmatter.
|
|
177
210
|
|
|
178
211
|
## License
|
|
179
212
|
|