Skip to content

Commit 0c22275

Browse files
authored
feat: new link checking method (#332)
* feat: adding Lychee link checking Signed-off-by: Aron Kerekes <arkereke@cisco.com> * fix: lint errors Signed-off-by: Aron Kerekes <arkereke@cisco.com> * fix: false negtive issues when lychee was running via task Signed-off-by: Aron Kerekes <arkereke@cisco.com> * fix: issues found by linter Signed-off-by: Aron Kerekes <arkereke@cisco.com> * fix: removing commited cache Signed-off-by: Aron Kerekes <arkereke@cisco.com> * chore: updating task build to check the generated htmls Signed-off-by: Aron Kerekes <arkereke@cisco.com> * chore: adding lychee to build action Signed-off-by: Aron Kerekes <arkereke@cisco.com> * feat: updating actions to check links once a day and changes in a PR Signed-off-by: Aron Kerekes <arkereke@cisco.com> * chore: adding timout exlusions Signed-off-by: Aron Kerekes <arkereke@cisco.com> * chore: removing html proofer Signed-off-by: Aron Kerekes <arkereke@cisco.com> * chore: updating contributing guide Signed-off-by: Aron Kerekes <arkereke@cisco.com> * fix: typos and formatting Signed-off-by: Aron Kerekes <arkereke@cisco.com> --------- Signed-off-by: Aron Kerekes <arkereke@cisco.com>
1 parent 75b5919 commit 0c22275

35 files changed

Lines changed: 341 additions & 154 deletions

.github/workflows/links.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Links
5+
6+
on:
7+
repository_dispatch:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: "00 06 * * *"
11+
12+
jobs:
13+
linkChecker:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
submodules: 'recursive'
23+
24+
- name: Setup Golang
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: '1.23.1'
28+
29+
- name: Setup Taskfile
30+
shell: bash
31+
run: |
32+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
33+
34+
- name: Setup UV
35+
shell: bash
36+
run: |
37+
curl -LsSf https://astral.sh/uv/install.sh | sh
38+
39+
- name: Update GITHUB_PATH
40+
shell: bash
41+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
42+
43+
- name: Build docs
44+
shell: bash
45+
run: |
46+
task build
47+
48+
- name: Link Checker
49+
id: lychee
50+
uses: lycheeverse/lychee-action@v2
51+
with:
52+
args: '--config lychee.toml .build/site'
53+
fail: false
54+

.github/workflows/pr-links.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: PR Links
5+
6+
on:
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
branches: [main, master]
10+
workflow_dispatch:
11+
12+
jobs:
13+
linkChecker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
submodules: 'recursive'
21+
22+
- name: Setup Golang
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.23.1'
26+
27+
- name: Setup Taskfile
28+
shell: bash
29+
run: |
30+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
31+
32+
- name: Setup UV
33+
shell: bash
34+
run: |
35+
curl -LsSf https://astral.sh/uv/install.sh | sh
36+
37+
- name: Update GITHUB_PATH
38+
shell: bash
39+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
40+
41+
- name: Build docs
42+
shell: bash
43+
run: |
44+
task build
45+
46+
- name: Check links in PR changes
47+
uses: lycheeverse/lychee-action@v2
48+
with:
49+
# Remap live URLs to build directory because the links are potentially not live yet
50+
args: |
51+
--config lychee.toml
52+
--root-dir $PWD/.build/site
53+
--exclude-all-private
54+
--remap 'https://docs\.agntcy\.org/(.*)/ file://'$PWD'/.build/site/$1/index.html'
55+
.build/site/
56+
fail: true
57+
output: lychee/out.md
58+
59+
- name: Comment Broken Links
60+
if: failure()
61+
uses: marocchino/sticky-pull-request-comment@v2
62+
with:
63+
path: lychee/out.md
64+
65+
- name: Suggestions
66+
if: failure()
67+
run: |
68+
echo -e "\nPlease review the links reported in the 'Check links in PR changes' step above."
69+
echo -e "If a link is valid but fails due to a CAPTCHA challenge, IP blocking, login requirements, etc.,"
70+
echo -e "consider adding such links to lychee.toml exclude list to bypass future checks.\n"
71+
exit 1
72+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ generated/
1717
# Python cache
1818
__pycache__/
1919
*.pyc
20+
21+
# Lychee cache
22+
.lycheecache

.pymarkdown

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ plugins:
88
enabled: true
99
siblings_only: true
1010
md030:
11-
enabled: true
11+
enabled: false
1212
md031:
1313
enabled: false
1414
md033:
15-
enabled: true
16-
allowed_elements: [details, summary, img, br, sub, sup]
15+
enabled: false
16+
allowed_elements: [details, summary, img, br, sub, sup, div]
1717
md041:
1818
enabled: false
1919
md046:
@@ -22,3 +22,7 @@ plugins:
2222
enabled: false
2323
md007:
2424
enabled: false
25+
md034:
26+
enabled: true
27+
md036:
28+
enabled: false

Taskfile.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ tasks:
5252
- echo "All documentation tests passed!"
5353

5454
lint:
55-
desc: Run all linting checks (spelling, markdown)
55+
desc: Run all linting checks (spelling, markdown, links)
5656
deps:
5757
- deps/patch
5858
cmds:
5959
- task: lint:spelling
6060
- task: lint:markdown
61+
- task: lint:links
6162

6263
lint:spelling:
6364
desc: Check spelling in documentation
@@ -77,6 +78,12 @@ tasks:
7778
cmds:
7879
- uv run pymarkdown --config ../.pymarkdown scan ../docs
7980

81+
lint:links:
82+
desc: Check for broken links in markdown documentation
83+
internal: true
84+
cmds:
85+
- lychee --config lychee.toml docs/
86+
8087
lint:fix:
8188
desc: Auto-fix spelling and markdown issues where possible
8289
deps:

docs/coffee-agntcy/get-started.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,4 @@ graph LR
9999
GC <--> TF[Tatooine Farm Agent]
100100
```
101101

102-
103102
Learn more on how to deploy Lungo locally by visiting the [Lungo Deployment Guide](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/README.md)

docs/coffee-agntcy/slim-coffee-agntcy.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ transport = factory.create_transport("SLIM", endpoint=SLIM_ENDPOINT, name="defau
2323

2424
Where:
2525

26-
* `AgntcyFactory` initializes the factory for the agent.
27-
* `create_transport("SLIM", ...)` provisions a SLIM transport instance connected to the configured endpoint.
26+
- `AgntcyFactory` initializes the factory for the agent.
27+
- `create_transport("SLIM", ...)` provisions a SLIM transport instance connected to the configured endpoint.
2828

2929
## Sending Messages
3030

3131
SLIM accommodates both targeted and broadcast messaging within the same API:
3232

33-
* **1-to-1 Message**
33+
- **1-to-1 Message**
3434

3535
Used when the supervisor agent needs to send a request to a single farm agent:
3636

3737
```python
3838
response = await client.send_message(request)
3939
```
4040

41-
* **Publisher/Subscriber Pattern**
41+
- **Publisher/Subscriber Pattern**
4242

4343
Used when the auction supervisor sends the same request to multiple farm agents and waits for all the responses:
4444

@@ -52,10 +52,10 @@ SLIM accommodates both targeted and broadcast messaging within the same API:
5252

5353
Where:
5454

55-
* `broadcast_topic` is the topic to which the message is broadcasted.
56-
* `recipients` is the list of agents to which the message is sent.
55+
- `broadcast_topic` is the topic to which the message is broadcasted.
56+
- `recipients` is the list of agents to which the message is sent.
5757

58-
### Streaming Publisher/Subscriber
58+
### Streaming Publisher/Subscriber
5959

6060
For real-time responses as farms reply, use the streaming variant:
6161

@@ -69,7 +69,7 @@ SLIM accommodates both targeted and broadcast messaging within the same API:
6969

7070
This returns a stream of data from the farms.
7171

72-
* **Group Communication Pattern**
72+
- **Group Communication Pattern**
7373

7474
Used when multiple agents participate in a group chat session, where all agents can send messages and listen to communications from other agents in the group:
7575

@@ -85,13 +85,13 @@ SLIM accommodates both targeted and broadcast messaging within the same API:
8585

8686
Where:
8787

88-
* `init_message` is the initial message to start the group chat.
89-
* `group_channel` is the unique channel ID for the group chat session.
90-
* `participants` is the list of agent topics participating in the group chat.
91-
* `end_message` is the message that signals the end of the group chat.
92-
* `timeout` is the timeout for the group chat session in seconds.
88+
- `init_message` is the initial message to start the group chat.
89+
- `group_channel` is the unique channel ID for the group chat session.
90+
- `participants` is the list of agent topics participating in the group chat.
91+
- `end_message` is the message that signals the end of the group chat.
92+
- `timeout` is the timeout for the group chat session in seconds.
9393

94-
### Streaming Group Communication
94+
### Streaming Group Communication
9595

9696
For real-time order state transitions as each agent processes the order:
9797

docs/contributing.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ reporting bugs that we ask you to review.
88
Before reporting a new issue, please ensure that the issue was not already reported or fixed by searching through our
99
[issues list](https://github.com/agntcy/docs/issues).
1010

11-
When creating a new issue, please be use the **New Issue** template, and provide as much relevant information as
12-
possible.
11+
When creating a new issue, use the **New Issue** template and provide as much relevant information as possible.
1312

1413
## Sending Pull Requests
1514

@@ -27,7 +26,7 @@ If you move or rename a documentation file, **you must add a redirect** to prese
2726

2827
To add a redirect:
2928

30-
1. Open `mkdocs/mkdocs.yml`
29+
1. Open `mkdocs/mkdocs.yml`.
3130
1. Add an entry to the `redirect_maps` under the `redirects` plugin:
3231

3332
```yaml
@@ -37,32 +36,48 @@ To add a redirect:
3736
'old/path/to/file.md': 'new/path/to/file.md'
3837
```
3938
40-
1. Test the redirect locally by running `task build` or `task run` and verifying the old URL redirects to the new location
39+
1. Test the redirect locally by running `task build` or `task run` and verifying the old URL redirects to the new location.
4140

4241
!!! warning
4342

4443
Failing to add redirects will result in broken links and a poor user experience. Always add redirects when moving content.
4544

45+
## Linting and Running the Documentation Site Locally
46+
47+
The documentation site is built using [MkDocs](https://www.mkdocs.org/) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). It also uses [Lychee](https://github.com/lycheeverse/lychee) to check for broken links and Taskfile to run the documentation site locally and lint the documentation.
48+
49+
To run the documentation site locally and lint the documentation, you need the following prerequisites:
50+
51+
- [Taskfile](https://taskfile.dev/)
52+
- [Uv](https://docs.astral.sh/uv/getting-started/installation/)
53+
- [Python version 3.13 or higher](https://www.python.org/)
54+
- [Lychee](https://github.com/lycheeverse/lychee)
55+
56+
To run the documentation site locally, use `task run`. This will start a live-reloading server at `http://localhost:8000`, allowing you to view the documentation site in your browser in real time.
57+
58+
To lint and check for errors in the documentation, use `task lint`. This checks for broken links, spelling errors, and markdown syntax errors.
59+
4660
## Markdown and Writing Style
4761

48-
Generic markdown intro (if needed):
49-
- [commonmark.org/help/tutorial](https://commonmark.org/help/tutorial/)
50-
- [www.markdownguide.org](https://www.markdownguide.org)
62+
For a general overview of Markdown, see the following resources:
63+
64+
- [commonmark.org/help/tutorial](https://commonmark.org/help/tutorial/)
65+
- [www.markdownguide.org](https://www.markdownguide.org)
5166

52-
Don't add hard line breaks at a certain line-length, enable line-wrapping in your editor instead. Otherwise searching for sentences in the code becomes a pain.
67+
Do not add hard line breaks at a certain line-length, enable line-wrapping in your editor instead. Otherwise searching for sentences in the code becomes a pain.
5368

5469
### Headings
5570

5671
- Start with level 1 heading (#).
5772
- Use hashmarks for headings.
58-
- Use title case (`# Start Every Word with Uppercase Except for Articles and Coordinating Conjunctions`)
59-
- Keep titles reasonably short (they show up in the right-hand toc)
73+
- Use title case (`# Start Every Word with Uppercase Except for Articles and Coordinating Conjunctions`).
74+
- Keep titles reasonably short (they show up in the right-hand toc).
6075
- Do not skip heading levels.
6176

6277
### Lists
6378

64-
- Use dash (`-`) for bulleted lists
65-
- Use only `1.` for ordered lists, they are automatically numbered in the output
79+
- Use dash (`-`) for bulleted lists.
80+
- Use only `1.` for ordered lists, they are automatically numbered in the output.
6681
- Indent additional stuff that belongs to a list element by 4 spaces, for example:
6782

6883
```md
@@ -81,9 +96,14 @@ Don't add hard line breaks at a certain line-length, enable line-wrapping in you
8196

8297
### Links
8398

84-
- When linking to an external URL, or to a static HTML file within the project, use normal markdown linking `[text](url)`
99+
- When linking to an external URL, or to a static HTML file within the project, use normal markdown linking `[text](url)`.
85100
- When linking to a file within the docs, use `[link text](/docs/path/to/file.md)`.
86-
- Use project-absolute paths in the links/refs: start with a /, then the path relative to the `content` directory, for example: `/docs/getting-started/example.md` (easier to update when a file is moved, and easier to recognize where it is pointing).
101+
- Use project-absolute paths in the links and references: start with a `/`, then the path relative to the `content` directory.
102+
103+
!!! example
104+
`/docs/getting-started/example.md` (easier to update when a file is moved, and easier to recognize where it is pointing).
105+
106+
- Always check for broken links by running `task lint` before submitting a pull request.
87107

88108
### Images
89109

@@ -134,4 +154,4 @@ Is displayed as:
134154

135155
This is a note.
136156

137-
For more information, see the [Material for MkDocs reference](https://squidfunk.github.io/mkdocs-material/reference/).
157+
For more information on formatting, see the [Material for MkDocs reference](https://squidfunk.github.io/mkdocs-material/reference/).

docs/dir/dir-api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ For detailed API reference, see the following pages:
44

55
* [Core API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.core.v1)
66
* [Events API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.events.v1)
7-
* [Routing API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.routing.v1)
7+
* [Routing API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.routing.v1)
88
* [Search API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.search.v1)
99
* [Sign API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.sign.v1)
1010
* [Store API Reference](https://buf.build/agntcy/dir/docs/main:agntcy.dir.store.v1)

docs/dir/hosted-agent-directory.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ To be useful, an agent, A2A card, or MCP server record should include at least t
215215
* Skills, following the [OASF skills schema](https://schema.oasf.outshift.com/skills?extensions=).
216216
* Previous Record CID: if this is a new or related version to another record, indicate the CID of the related record.
217217

218-
And it will look like this:
218+
And it will look like this:
219219

220220
```json
221221
{
@@ -388,7 +388,6 @@ dir hub verify <record CID>
388388

389389
For further details on signing, use the `dirctl hub sign --help` command.
390390

391-
392391
#### Pulling Agent Directory Records using `dirctl`
393392

394393
You can also pull an Agent Directory record via `dirctl` using the command listed on the agent details page.

0 commit comments

Comments
 (0)