fmind 2.0.5__tar.gz → 2.1.0__tar.gz
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.
- {fmind-2.0.5 → fmind-2.1.0}/PKG-INFO +40 -26
- {fmind-2.0.5 → fmind-2.1.0}/README.md +37 -23
- {fmind-2.0.5 → fmind-2.1.0}/pyproject.toml +4 -2
- {fmind-2.0.5 → fmind-2.1.0}/pyproject.toml.orig +3 -3
- fmind-2.1.0/src/fmind/__init__.py +11 -0
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/api.py +58 -11
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/cli.py +43 -6
- fmind-2.1.0/src/fmind/news.py +38 -0
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/render.py +42 -6
- fmind-2.0.5/src/fmind/__init__.py +0 -11
- {fmind-2.0.5 → fmind-2.1.0}/LICENSE +0 -0
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/__main__.py +0 -0
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/articles.py +0 -0
- {fmind-2.0.5 → fmind-2.1.0}/src/fmind/mcp.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmind
|
|
3
|
-
Version: 2.0
|
|
4
|
-
Summary: Read Médéric Hurier's (Fmind) portfolio from the terminal.
|
|
5
|
-
Keywords: portfolio,cli,fmind,resume,articles
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Read Médéric Hurier's (Fmind) portfolio and daily news from the terminal.
|
|
5
|
+
Keywords: portfolio,cli,fmind,resume,articles,news,mcp
|
|
6
6
|
Author: Médéric Hurier
|
|
7
7
|
Author-email: Médéric Hurier <contact@fmind.dev>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
|
|
|
25
25
|
|
|
26
26
|
# fmind
|
|
27
27
|
|
|
28
|
-
Read [Médéric Hurier's (Fmind)](https://www.fmind.dev/) portfolio from the terminal.
|
|
28
|
+
Read [Médéric Hurier's (Fmind)](https://www.fmind.dev/) portfolio and daily tech news from the terminal.
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
uvx fmind whoami
|
|
@@ -33,26 +33,28 @@ uvx fmind whoami
|
|
|
33
33
|
|
|
34
34
|
## Commands
|
|
35
35
|
|
|
36
|
-
| Command | Shows
|
|
37
|
-
| ---------------------------------------------- |
|
|
38
|
-
| `fmind` | The `whoami` card and a pointer to `--help`
|
|
39
|
-
| `fmind whoami` | Name,
|
|
40
|
-
| `fmind about` | The biography
|
|
41
|
-
| `fmind skills` | Core expertise, as published on the site
|
|
42
|
-
| `fmind experiences` | Engagements in website order
|
|
43
|
-
| `fmind
|
|
44
|
-
| `fmind
|
|
45
|
-
| `fmind papers` | The doctorate and the peer-reviewed
|
|
46
|
-
| `fmind projects [--limit 6]` | Open-source repositories and video series
|
|
47
|
-
| `fmind sites` | Interactive tools published alongside the writing
|
|
48
|
-
| `fmind articles [--limit 6]` | The most recent writing
|
|
49
|
-
| `fmind search [query...] [--tag] [--limit 10]` | Articles matching every term, newest first
|
|
50
|
-
| `fmind read <slug> [--raw]` | One article, rendered in the terminal
|
|
51
|
-
| `fmind
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
| Command | Shows |
|
|
37
|
+
| ---------------------------------------------- | --------------------------------------------------------- |
|
|
38
|
+
| `fmind` | The `whoami` card and a pointer to `--help` |
|
|
39
|
+
| `fmind whoami` | Name, headline, location, experience, availability, links |
|
|
40
|
+
| `fmind about` | The biography |
|
|
41
|
+
| `fmind skills` | Core expertise, as published on the site |
|
|
42
|
+
| `fmind experiences` | Engagements in website order |
|
|
43
|
+
| `fmind certifications` | Certifications, the PhD, specializations |
|
|
44
|
+
| `fmind community` | Ambassador and advisory roles |
|
|
45
|
+
| `fmind papers` | The doctorate and the peer-reviewed papers, with code |
|
|
46
|
+
| `fmind projects [--limit 6]` | Open-source repositories and video series |
|
|
47
|
+
| `fmind sites` | Interactive tools published alongside the writing |
|
|
48
|
+
| `fmind articles [--limit 6]` | The most recent writing |
|
|
49
|
+
| `fmind search [query...] [--tag] [--limit 10]` | Articles matching every term, newest first |
|
|
50
|
+
| `fmind read <slug> [--raw]` | One article, rendered in the terminal |
|
|
51
|
+
| `fmind tags` | The article tags, with counts and their `search --tag` |
|
|
52
|
+
| `fmind news [query...] [--limit]` | Daily curated links, newest edition first |
|
|
53
|
+
| `fmind hire` | What can be booked right now |
|
|
54
|
+
|
|
55
|
+
The commands group sections of the website's profile and news APIs. Their names stay stable when the website's navigation or visual design changes.
|
|
56
|
+
|
|
57
|
+
`--limit` bounds articles, search results, news editions, and each project list (repositories and video series); `--json` prints a command's data instead of prose; `--raw` prints an article's Markdown source. Search also accepts `--tag`. Use `--json` and `jq` for other filtering.
|
|
56
58
|
|
|
57
59
|
`--json` works before or after the command: both `fmind --json experiences` and `fmind experiences --json` print the raw website section. Global `--color` / `--no-color` and `--version` go before the command. Colour is detected automatically, including `NO_COLOR` and redirected output. Use `fmind --help` or `fmind <command> --help` for options.
|
|
58
60
|
|
|
@@ -75,6 +77,17 @@ fmind read "$slug"
|
|
|
75
77
|
fmind read "$slug" --raw | glow -
|
|
76
78
|
```
|
|
77
79
|
|
|
80
|
+
### News
|
|
81
|
+
|
|
82
|
+
`fmind news` prints the latest daily edition of curated links on AI agents, Python, security, and cloud engineering. Search terms keep only the links that contain all of them, matched against titles, domains, summaries, and URLs; an edition date such as `2026-11-06` or `2026-11` selects every link of those editions. `--limit` counts editions: 1 by default, 10 when searching.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
fmind news # the latest edition
|
|
86
|
+
fmind news --limit 7 # the past week
|
|
87
|
+
fmind news agent security # matching links, newest edition first
|
|
88
|
+
fmind news 2026-11-06 # one edition
|
|
89
|
+
```
|
|
90
|
+
|
|
78
91
|
### Piping
|
|
79
92
|
|
|
80
93
|
`--json` turns every command into a data source, so the portfolio composes with the rest of the shell. JSON goes to stdout without colour or prose; errors go to stderr. With `read --raw --json`, JSON takes precedence and includes the Markdown in its `markdown` field.
|
|
@@ -83,9 +96,10 @@ fmind read "$slug" --raw | glow -
|
|
|
83
96
|
fmind articles --limit 20 --json | jq -r '.[] | "\(.date[:10]) \(.title)"'
|
|
84
97
|
fmind search agent --json | jq -r '.[].url'
|
|
85
98
|
fmind certifications --json | jq -r '.certifications[] | select(.active) | .title'
|
|
99
|
+
fmind news --limit 7 --json | jq -r '.[].items[] | "\(.domain) \(.title)"'
|
|
86
100
|
```
|
|
87
101
|
|
|
88
|
-
`whoami --json` includes `metadata`, `experience` (a list containing the featured engagement, or an empty list), and `services`. `certifications --json` includes `certifications`, `thesis`, and `specializations`. `projects --json` includes `open_source` and `youtube_series`, each keeping the website's fields and bounded by `--limit`.
|
|
102
|
+
`whoami --json` includes `metadata`, `experience` (a list containing the featured engagement, or an empty list), and `services`. `certifications --json` includes `certifications`, `thesis`, and `specializations`. `projects --json` includes `open_source` and `youtube_series`, each keeping the website's fields and bounded by `--limit`. `news --json` is a list of editions with the website's fields; a search keeps only the matching `items`.
|
|
89
103
|
|
|
90
104
|
**Migration to 2.0.0:** `projects --json` now returns an object instead of one mixed array; change filters from `.[]` to `.open_source[]` or `.youtube_series[]`. `--limit` now bounds each list, so video series are no longer crowded out by repositories.
|
|
91
105
|
|
|
@@ -105,7 +119,7 @@ Point it at another origin with `FMIND_PROFILE_URL` — useful against a local `
|
|
|
105
119
|
FMIND_PROFILE_URL=http://127.0.0.1:8080/api/profile fmind whoami
|
|
106
120
|
```
|
|
107
121
|
|
|
108
|
-
|
|
122
|
+
News and article reads and the MCP bridge follow the same origin, so one variable moves the whole CLI.
|
|
109
123
|
|
|
110
124
|
## MCP over stdio
|
|
111
125
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# fmind
|
|
2
2
|
|
|
3
|
-
Read [Médéric Hurier's (Fmind)](https://www.fmind.dev/) portfolio from the terminal.
|
|
3
|
+
Read [Médéric Hurier's (Fmind)](https://www.fmind.dev/) portfolio and daily tech news from the terminal.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
uvx fmind whoami
|
|
@@ -8,26 +8,28 @@ uvx fmind whoami
|
|
|
8
8
|
|
|
9
9
|
## Commands
|
|
10
10
|
|
|
11
|
-
| Command | Shows
|
|
12
|
-
| ---------------------------------------------- |
|
|
13
|
-
| `fmind` | The `whoami` card and a pointer to `--help`
|
|
14
|
-
| `fmind whoami` | Name,
|
|
15
|
-
| `fmind about` | The biography
|
|
16
|
-
| `fmind skills` | Core expertise, as published on the site
|
|
17
|
-
| `fmind experiences` | Engagements in website order
|
|
18
|
-
| `fmind
|
|
19
|
-
| `fmind
|
|
20
|
-
| `fmind papers` | The doctorate and the peer-reviewed
|
|
21
|
-
| `fmind projects [--limit 6]` | Open-source repositories and video series
|
|
22
|
-
| `fmind sites` | Interactive tools published alongside the writing
|
|
23
|
-
| `fmind articles [--limit 6]` | The most recent writing
|
|
24
|
-
| `fmind search [query...] [--tag] [--limit 10]` | Articles matching every term, newest first
|
|
25
|
-
| `fmind read <slug> [--raw]` | One article, rendered in the terminal
|
|
26
|
-
| `fmind
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
| Command | Shows |
|
|
12
|
+
| ---------------------------------------------- | --------------------------------------------------------- |
|
|
13
|
+
| `fmind` | The `whoami` card and a pointer to `--help` |
|
|
14
|
+
| `fmind whoami` | Name, headline, location, experience, availability, links |
|
|
15
|
+
| `fmind about` | The biography |
|
|
16
|
+
| `fmind skills` | Core expertise, as published on the site |
|
|
17
|
+
| `fmind experiences` | Engagements in website order |
|
|
18
|
+
| `fmind certifications` | Certifications, the PhD, specializations |
|
|
19
|
+
| `fmind community` | Ambassador and advisory roles |
|
|
20
|
+
| `fmind papers` | The doctorate and the peer-reviewed papers, with code |
|
|
21
|
+
| `fmind projects [--limit 6]` | Open-source repositories and video series |
|
|
22
|
+
| `fmind sites` | Interactive tools published alongside the writing |
|
|
23
|
+
| `fmind articles [--limit 6]` | The most recent writing |
|
|
24
|
+
| `fmind search [query...] [--tag] [--limit 10]` | Articles matching every term, newest first |
|
|
25
|
+
| `fmind read <slug> [--raw]` | One article, rendered in the terminal |
|
|
26
|
+
| `fmind tags` | The article tags, with counts and their `search --tag` |
|
|
27
|
+
| `fmind news [query...] [--limit]` | Daily curated links, newest edition first |
|
|
28
|
+
| `fmind hire` | What can be booked right now |
|
|
29
|
+
|
|
30
|
+
The commands group sections of the website's profile and news APIs. Their names stay stable when the website's navigation or visual design changes.
|
|
31
|
+
|
|
32
|
+
`--limit` bounds articles, search results, news editions, and each project list (repositories and video series); `--json` prints a command's data instead of prose; `--raw` prints an article's Markdown source. Search also accepts `--tag`. Use `--json` and `jq` for other filtering.
|
|
31
33
|
|
|
32
34
|
`--json` works before or after the command: both `fmind --json experiences` and `fmind experiences --json` print the raw website section. Global `--color` / `--no-color` and `--version` go before the command. Colour is detected automatically, including `NO_COLOR` and redirected output. Use `fmind --help` or `fmind <command> --help` for options.
|
|
33
35
|
|
|
@@ -50,6 +52,17 @@ fmind read "$slug"
|
|
|
50
52
|
fmind read "$slug" --raw | glow -
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
### News
|
|
56
|
+
|
|
57
|
+
`fmind news` prints the latest daily edition of curated links on AI agents, Python, security, and cloud engineering. Search terms keep only the links that contain all of them, matched against titles, domains, summaries, and URLs; an edition date such as `2026-11-06` or `2026-11` selects every link of those editions. `--limit` counts editions: 1 by default, 10 when searching.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
fmind news # the latest edition
|
|
61
|
+
fmind news --limit 7 # the past week
|
|
62
|
+
fmind news agent security # matching links, newest edition first
|
|
63
|
+
fmind news 2026-11-06 # one edition
|
|
64
|
+
```
|
|
65
|
+
|
|
53
66
|
### Piping
|
|
54
67
|
|
|
55
68
|
`--json` turns every command into a data source, so the portfolio composes with the rest of the shell. JSON goes to stdout without colour or prose; errors go to stderr. With `read --raw --json`, JSON takes precedence and includes the Markdown in its `markdown` field.
|
|
@@ -58,9 +71,10 @@ fmind read "$slug" --raw | glow -
|
|
|
58
71
|
fmind articles --limit 20 --json | jq -r '.[] | "\(.date[:10]) \(.title)"'
|
|
59
72
|
fmind search agent --json | jq -r '.[].url'
|
|
60
73
|
fmind certifications --json | jq -r '.certifications[] | select(.active) | .title'
|
|
74
|
+
fmind news --limit 7 --json | jq -r '.[].items[] | "\(.domain) \(.title)"'
|
|
61
75
|
```
|
|
62
76
|
|
|
63
|
-
`whoami --json` includes `metadata`, `experience` (a list containing the featured engagement, or an empty list), and `services`. `certifications --json` includes `certifications`, `thesis`, and `specializations`. `projects --json` includes `open_source` and `youtube_series`, each keeping the website's fields and bounded by `--limit`.
|
|
77
|
+
`whoami --json` includes `metadata`, `experience` (a list containing the featured engagement, or an empty list), and `services`. `certifications --json` includes `certifications`, `thesis`, and `specializations`. `projects --json` includes `open_source` and `youtube_series`, each keeping the website's fields and bounded by `--limit`. `news --json` is a list of editions with the website's fields; a search keeps only the matching `items`.
|
|
64
78
|
|
|
65
79
|
**Migration to 2.0.0:** `projects --json` now returns an object instead of one mixed array; change filters from `.[]` to `.open_source[]` or `.youtube_series[]`. `--limit` now bounds each list, so video series are no longer crowded out by repositories.
|
|
66
80
|
|
|
@@ -80,7 +94,7 @@ Point it at another origin with `FMIND_PROFILE_URL` — useful against a local `
|
|
|
80
94
|
FMIND_PROFILE_URL=http://127.0.0.1:8080/api/profile fmind whoami
|
|
81
95
|
```
|
|
82
96
|
|
|
83
|
-
|
|
97
|
+
News and article reads and the MCP bridge follow the same origin, so one variable moves the whole CLI.
|
|
84
98
|
|
|
85
99
|
## MCP over stdio
|
|
86
100
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fmind"
|
|
3
|
-
version = "2.0
|
|
4
|
-
description = "Read Médéric Hurier's (Fmind) portfolio from the terminal."
|
|
3
|
+
version = "2.1.0"
|
|
4
|
+
description = "Read Médéric Hurier's (Fmind) portfolio and daily news from the terminal."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
7
7
|
license-files = ["LICENSE"]
|
|
@@ -12,6 +12,8 @@ keywords = [
|
|
|
12
12
|
"fmind",
|
|
13
13
|
"resume",
|
|
14
14
|
"articles",
|
|
15
|
+
"news",
|
|
16
|
+
"mcp",
|
|
15
17
|
]
|
|
16
18
|
classifiers = [
|
|
17
19
|
"Environment :: Console",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
2
2
|
[project]
|
|
3
3
|
name = "fmind"
|
|
4
|
-
version = "2.0
|
|
5
|
-
description = "Read Médéric Hurier's (Fmind) portfolio from the terminal."
|
|
4
|
+
version = "2.1.0"
|
|
5
|
+
description = "Read Médéric Hurier's (Fmind) portfolio and daily news from the terminal."
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
9
|
authors = [{ name = "Médéric Hurier", email = "contact@fmind.dev" }]
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
|
-
keywords = ["portfolio", "cli", "fmind", "resume", "articles"]
|
|
11
|
+
keywords = ["portfolio", "cli", "fmind", "resume", "articles", "news", "mcp"]
|
|
12
12
|
classifiers = [
|
|
13
13
|
"Environment :: Console",
|
|
14
14
|
"Intended Audience :: Developers",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Read Médéric Hurier's (Fmind) portfolio and daily news from the terminal.
|
|
2
|
+
|
|
3
|
+
Every command renders live documents published by https://www.fmind.dev, so this
|
|
4
|
+
package carries no copy of its own and needs no release when the content changes.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
|
|
9
|
+
__all__ = ["__version__"]
|
|
10
|
+
|
|
11
|
+
__version__ = version("fmind")
|
|
@@ -18,6 +18,7 @@ from typing import Any
|
|
|
18
18
|
from fmind import __version__
|
|
19
19
|
|
|
20
20
|
PROFILE_URL = "https://www.fmind.dev/api/profile"
|
|
21
|
+
NEWS_PATH = "/api/news"
|
|
21
22
|
TIMEOUT_SECONDS = 15.0
|
|
22
23
|
# Bound memory use even when the origin serves an unexpected document.
|
|
23
24
|
MAX_BYTES = 8 * 1024 * 1024
|
|
@@ -32,7 +33,22 @@ CONTROL_PATTERN = re.compile(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]")
|
|
|
32
33
|
|
|
33
34
|
# Only fields consumed by this CLI are required; new website fields pass through.
|
|
34
35
|
PROFILE_SHAPE = {
|
|
35
|
-
"metadata":
|
|
36
|
+
"metadata": {
|
|
37
|
+
**dict.fromkeys(
|
|
38
|
+
(
|
|
39
|
+
"name",
|
|
40
|
+
"alternate_name",
|
|
41
|
+
"job_title",
|
|
42
|
+
"headline_primary",
|
|
43
|
+
"headline_secondary",
|
|
44
|
+
"work_location",
|
|
45
|
+
"email",
|
|
46
|
+
"site_url",
|
|
47
|
+
),
|
|
48
|
+
str,
|
|
49
|
+
),
|
|
50
|
+
"socials": [{"name": str, "url": str}],
|
|
51
|
+
},
|
|
36
52
|
"biography": [str],
|
|
37
53
|
"expertise": [{"title": str, "description": str}],
|
|
38
54
|
"experience": [{"company": str, "title": str, "description": str, "tags": [str]}],
|
|
@@ -40,13 +56,26 @@ PROFILE_SHAPE = {
|
|
|
40
56
|
"certifications": [{"title": str, "issuer": str, "active": bool, "url": str}],
|
|
41
57
|
"specializations": [{"title": str, "issuer_details": str, "url": str}],
|
|
42
58
|
"thesis": {"title": str, "institution_details": str, "description": str, "url": str},
|
|
43
|
-
"papers": [{"title": str, "venue": str, "url": str}],
|
|
59
|
+
"papers": [{"title": str, "venue": str, "url": str, "code": str, "code_label": str}],
|
|
44
60
|
"open_source": [{"title": str, "description": str, "href": str}],
|
|
45
61
|
"youtube_series": [{"title": str, "description": str, "url": str}],
|
|
46
62
|
"site_pages": [{"title": str, "description": str, "audience": str, "url": str}],
|
|
47
63
|
"articles": [{"title": str, "description": str, "slug": str, "date": str, "tags": [str], "reading_minutes": int}],
|
|
48
64
|
"services": [{"title": str, "description": str, "badge": str, "cta_url": str}],
|
|
49
|
-
"tags": [{"name": str}],
|
|
65
|
+
"tags": [{"name": str, "description": str}],
|
|
66
|
+
}
|
|
67
|
+
# The same rule for the daily news archive at /api/news.
|
|
68
|
+
NEWS_SHAPE = {
|
|
69
|
+
"url": str,
|
|
70
|
+
"editions": [
|
|
71
|
+
{
|
|
72
|
+
"slug": str,
|
|
73
|
+
"date": str,
|
|
74
|
+
"title": str,
|
|
75
|
+
"url": str,
|
|
76
|
+
"items": [{"title": str, "url": str, "domain": str, "description": str}],
|
|
77
|
+
}
|
|
78
|
+
],
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
|
|
@@ -151,6 +180,10 @@ def _fetch(url: str, accept: str, deadline: float) -> bytes:
|
|
|
151
180
|
return bytes(payload)
|
|
152
181
|
|
|
153
182
|
|
|
183
|
+
# Each JSON endpoint by the name used in its error messages and the document it serves.
|
|
184
|
+
_DOCUMENTS = {"profile": "portfolio document", "news": "news archive"}
|
|
185
|
+
|
|
186
|
+
|
|
154
187
|
def _validate(value: object, shape: object, path: str) -> None:
|
|
155
188
|
"""Check the few nested JSON shapes needed for rendering, without a dependency."""
|
|
156
189
|
if isinstance(shape, dict) and isinstance(value, dict):
|
|
@@ -164,7 +197,9 @@ def _validate(value: object, shape: object, path: str) -> None:
|
|
|
164
197
|
raise FmindError(f"the website returned terminal control characters at {path}")
|
|
165
198
|
return
|
|
166
199
|
else:
|
|
167
|
-
|
|
200
|
+
# The path starts with the endpoint name, such as `profile.metadata`.
|
|
201
|
+
name = path.split(".", 1)[0].split("[", 1)[0]
|
|
202
|
+
raise FmindError(f"the {name} endpoint returned an invalid {_DOCUMENTS[name]} at {path}")
|
|
168
203
|
|
|
169
204
|
|
|
170
205
|
def _reject_constant(name: str) -> None:
|
|
@@ -172,12 +207,13 @@ def _reject_constant(name: str) -> None:
|
|
|
172
207
|
raise ValueError(name)
|
|
173
208
|
|
|
174
209
|
|
|
175
|
-
def
|
|
176
|
-
"""Decode the
|
|
210
|
+
def _parse_json(payload: bytes, shape: object, name: str) -> dict[str, Any]:
|
|
211
|
+
"""Decode one of the website's JSON documents, rejecting anything that is not one."""
|
|
212
|
+
noun = _DOCUMENTS[name]
|
|
177
213
|
try:
|
|
178
214
|
document = json.loads(payload, parse_constant=_reject_constant)
|
|
179
215
|
except (ValueError, RecursionError) as error:
|
|
180
|
-
raise FmindError("the
|
|
216
|
+
raise FmindError(f"the {name} endpoint did not return JSON") from error
|
|
181
217
|
# Check keys and future fields too: JSON output forwards them even when the
|
|
182
218
|
# renderer does not consume them. The decoder accepts surrogates and can turn
|
|
183
219
|
# finite JSON literals such as 1e999 into infinity.
|
|
@@ -185,19 +221,25 @@ def _parse_profile(payload: bytes) -> dict[str, Any]:
|
|
|
185
221
|
while pending:
|
|
186
222
|
value, depth = pending.pop()
|
|
187
223
|
if depth > MAX_DEPTH:
|
|
188
|
-
raise FmindError(f"the
|
|
224
|
+
raise FmindError(f"the {name} endpoint returned a {noun} nested over {MAX_DEPTH} levels")
|
|
189
225
|
if isinstance(value, float) and not math.isfinite(value):
|
|
190
|
-
raise FmindError("the
|
|
226
|
+
raise FmindError(f"the {name} endpoint returned a non-finite number")
|
|
191
227
|
if isinstance(value, str):
|
|
192
228
|
try:
|
|
193
229
|
value.encode("utf-8")
|
|
194
230
|
except UnicodeEncodeError as error:
|
|
195
|
-
raise FmindError("the
|
|
231
|
+
raise FmindError(f"the {name} endpoint returned invalid Unicode") from error
|
|
196
232
|
elif isinstance(value, dict):
|
|
197
233
|
pending.extend((item, depth + 1) for item in (*value, *value.values()))
|
|
198
234
|
elif isinstance(value, list):
|
|
199
235
|
pending.extend((item, depth + 1) for item in value)
|
|
200
|
-
_validate(document,
|
|
236
|
+
_validate(document, shape, name)
|
|
237
|
+
return document
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def _parse_profile(payload: bytes) -> dict[str, Any]:
|
|
241
|
+
"""Decode the portfolio document behind every section command."""
|
|
242
|
+
document = _parse_json(payload, PROFILE_SHAPE, "profile")
|
|
201
243
|
links = document["thesis"].get("links")
|
|
202
244
|
if links is not None:
|
|
203
245
|
_validate(links, [{"label": str, "url": str}], "profile.thesis.links")
|
|
@@ -222,6 +264,11 @@ def load_profile(*, url: str | None = None) -> dict[str, Any]:
|
|
|
222
264
|
return _parse_profile(_download(url if url is not None else _profile_url()))
|
|
223
265
|
|
|
224
266
|
|
|
267
|
+
def load_news() -> dict[str, Any]:
|
|
268
|
+
"""Return the daily news archive, on the same origin as the profile."""
|
|
269
|
+
return _parse_json(_download(origin_url(NEWS_PATH)), NEWS_SHAPE, "news")
|
|
270
|
+
|
|
271
|
+
|
|
225
272
|
def load_article(slug: str, *, profile_url: str | None = None) -> str:
|
|
226
273
|
"""Return the Markdown source of one published article."""
|
|
227
274
|
url = article_url(slug, profile_url=profile_url)
|
|
@@ -16,13 +16,13 @@ import typer
|
|
|
16
16
|
from rich.console import Console, RenderableType
|
|
17
17
|
from rich.pager import Pager
|
|
18
18
|
|
|
19
|
-
from fmind import __version__, articles, render
|
|
20
|
-
from fmind.api import CONTROL_PATTERN, FmindError, load_article, load_profile
|
|
19
|
+
from fmind import __version__, articles, news, render
|
|
20
|
+
from fmind.api import CONTROL_PATTERN, FmindError, load_article, load_news, load_profile
|
|
21
21
|
|
|
22
22
|
app = typer.Typer(
|
|
23
23
|
name="fmind",
|
|
24
|
-
help="Read Médéric Hurier's (Fmind) portfolio from the terminal. Every command renders
|
|
25
|
-
"
|
|
24
|
+
help="Read Médéric Hurier's (Fmind) portfolio and daily news from the terminal. Every command renders "
|
|
25
|
+
"live documents published by https://www.fmind.dev. Without a command, show the whoami card. "
|
|
26
26
|
"Use mcp for the stdio MCP bridge.",
|
|
27
27
|
add_completion=False,
|
|
28
28
|
rich_markup_mode="rich",
|
|
@@ -73,6 +73,14 @@ def _doc() -> dict[str, Any]:
|
|
|
73
73
|
raise _fail(str(error)) from error
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
def _news() -> dict[str, Any]:
|
|
77
|
+
"""Load the news archive, reporting a clear error instead of a traceback."""
|
|
78
|
+
try:
|
|
79
|
+
return load_news()
|
|
80
|
+
except FmindError as error:
|
|
81
|
+
raise _fail(str(error)) from error
|
|
82
|
+
|
|
83
|
+
|
|
76
84
|
class _SystemPager(Pager):
|
|
77
85
|
"""Page through the user's pager with colour, quitting at once when the text fits one screen."""
|
|
78
86
|
|
|
@@ -174,7 +182,7 @@ def _emit(ctx: typer.Context, body: RenderableType, payload: Any, *, as_json: bo
|
|
|
174
182
|
|
|
175
183
|
@app.command()
|
|
176
184
|
def whoami(ctx: typer.Context, as_json: JsonOption = False) -> None:
|
|
177
|
-
"""Name, featured experience, availability, and contact."""
|
|
185
|
+
"""Name, headline, location, featured experience, availability, and contact."""
|
|
178
186
|
doc = _doc()
|
|
179
187
|
_emit(
|
|
180
188
|
ctx,
|
|
@@ -228,7 +236,7 @@ def community(ctx: typer.Context, as_json: JsonOption = False) -> None:
|
|
|
228
236
|
|
|
229
237
|
@app.command()
|
|
230
238
|
def papers(ctx: typer.Context, as_json: JsonOption = False) -> None:
|
|
231
|
-
"""The doctorate and the peer-reviewed publications."""
|
|
239
|
+
"""The doctorate and the peer-reviewed publications, with their code."""
|
|
232
240
|
doc = _doc()
|
|
233
241
|
_emit(ctx, render.papers(doc), {"thesis": doc["thesis"], "papers": doc["papers"]}, as_json=as_json)
|
|
234
242
|
|
|
@@ -312,6 +320,35 @@ def read(
|
|
|
312
320
|
_emit(ctx, render.article_body(markdown), payload, as_json=as_json, page=True)
|
|
313
321
|
|
|
314
322
|
|
|
323
|
+
@app.command("tags")
|
|
324
|
+
def list_tags(ctx: typer.Context, as_json: JsonOption = False) -> None:
|
|
325
|
+
"""The article tags that search --tag accepts."""
|
|
326
|
+
doc = _doc()
|
|
327
|
+
_emit(ctx, render.tags(doc), doc["tags"], as_json=as_json)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
@app.command("news")
|
|
331
|
+
def list_news(
|
|
332
|
+
ctx: typer.Context,
|
|
333
|
+
query: Annotated[
|
|
334
|
+
list[str] | None,
|
|
335
|
+
typer.Argument(help="Terms to match against link titles, domains, summaries, URLs, and edition dates."),
|
|
336
|
+
] = None,
|
|
337
|
+
limit: Annotated[
|
|
338
|
+
int | None,
|
|
339
|
+
typer.Option("--limit", min=1, max=200, help="How many editions to show: 1 by default, 10 with terms."),
|
|
340
|
+
] = None,
|
|
341
|
+
as_json: JsonOption = False,
|
|
342
|
+
) -> None:
|
|
343
|
+
"""Daily curated links, newest edition first; terms keep only matching links."""
|
|
344
|
+
archive = _news()
|
|
345
|
+
terms = " ".join(query or [])
|
|
346
|
+
# Today's edition is the common read; a search looks further back by default.
|
|
347
|
+
found = news.search(archive["editions"], terms, limit=limit or (10 if terms.strip() else 1))
|
|
348
|
+
footer = f"{len(found)} shown · {len(archive['editions'])} editions · {archive['url']}"
|
|
349
|
+
_emit(ctx, render.news(found, footer=footer), found, as_json=as_json)
|
|
350
|
+
|
|
351
|
+
|
|
315
352
|
@app.command()
|
|
316
353
|
def hire(ctx: typer.Context, as_json: JsonOption = False) -> None:
|
|
317
354
|
"""What can be booked right now."""
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Select daily news editions from the news archive: newest, or matching."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
Edition = dict[str, Any]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _edition_text(edition: Edition) -> str:
|
|
11
|
+
"""Return the searchable header of one edition, lower-cased: its date slug and title."""
|
|
12
|
+
return f"{edition['slug']} {edition['title']}".lower()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _item_text(item: dict[str, Any]) -> str:
|
|
16
|
+
"""Return the searchable text of one link, lower-cased."""
|
|
17
|
+
return " ".join((item["title"], item["domain"], item["description"], item["url"])).lower()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def search(editions: list[Edition], query: str, *, limit: int) -> list[Edition]:
|
|
21
|
+
"""Return newest-first editions, keeping only the links that contain every term of `query`.
|
|
22
|
+
|
|
23
|
+
Terms are ANDed, case-insensitively, against the edition header and each link,
|
|
24
|
+
so `2026-11-06` selects that whole edition and `agent 2026-11` keeps November's
|
|
25
|
+
agent links. Without terms, return the latest editions unchanged.
|
|
26
|
+
"""
|
|
27
|
+
terms = query.lower().split()
|
|
28
|
+
found: list[Edition] = []
|
|
29
|
+
if limit <= 0:
|
|
30
|
+
return found
|
|
31
|
+
for edition in sorted(editions, key=lambda e: e["date"], reverse=True):
|
|
32
|
+
header = _edition_text(edition)
|
|
33
|
+
items = [item for item in edition["items"] if all(t in f"{header} {_item_text(item)}" for t in terms)]
|
|
34
|
+
if items:
|
|
35
|
+
found.append(edition if len(items) == len(edition["items"]) else {**edition, "items": items})
|
|
36
|
+
if len(found) >= limit:
|
|
37
|
+
break
|
|
38
|
+
return found
|
|
@@ -78,7 +78,7 @@ def _rows(pairs: list[tuple[str, RenderableType]]) -> Table:
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def whoami(doc: dict[str, Any]) -> RenderableType:
|
|
81
|
-
"""Identity, featured experience, availability, and
|
|
81
|
+
"""Identity, location, featured experience, availability, contact, and social profiles."""
|
|
82
82
|
meta = doc["metadata"]
|
|
83
83
|
experience = doc.get("experience") or []
|
|
84
84
|
mission = Text("—")
|
|
@@ -97,7 +97,8 @@ def whoami(doc: dict[str, Any]) -> RenderableType:
|
|
|
97
97
|
[
|
|
98
98
|
("Name", Text(f"{meta['name']} ({meta['alternate_name']})", style="bold")),
|
|
99
99
|
("Role", Text(meta["job_title"])),
|
|
100
|
-
("Headline", Text(meta["headline_primary"])),
|
|
100
|
+
("Headline", Text("\n".join(filter(None, (meta["headline_primary"], meta["headline_secondary"]))))),
|
|
101
|
+
("Location", Text(meta["work_location"])),
|
|
101
102
|
("Experience", mission),
|
|
102
103
|
("Status", status),
|
|
103
104
|
]
|
|
@@ -106,7 +107,11 @@ def whoami(doc: dict[str, Any]) -> RenderableType:
|
|
|
106
107
|
# with the same 11-character label and two-space gap.
|
|
107
108
|
*(
|
|
108
109
|
Text.assemble((f"{label:<13}", ACCENT), _link(value), no_wrap=True, overflow="ignore")
|
|
109
|
-
for label, value in (
|
|
110
|
+
for label, value in (
|
|
111
|
+
("Contact", meta["email"]),
|
|
112
|
+
("Website", meta["site_url"]),
|
|
113
|
+
*((social["name"], social["url"]) for social in meta["socials"]),
|
|
114
|
+
)
|
|
110
115
|
),
|
|
111
116
|
)
|
|
112
117
|
|
|
@@ -202,6 +207,33 @@ def articles(posts: list[dict[str, Any]], *, footer: str = "") -> RenderableType
|
|
|
202
207
|
return Group(*blocks, Text(footer)) if footer else Group(*blocks)
|
|
203
208
|
|
|
204
209
|
|
|
210
|
+
def tags(doc: dict[str, Any]) -> RenderableType:
|
|
211
|
+
"""The site's article tags, each with its article count and the search that lists them."""
|
|
212
|
+
blocks: list[RenderableType] = []
|
|
213
|
+
for tag in doc["tags"]:
|
|
214
|
+
# Case-insensitive, like `fmind search --tag`.
|
|
215
|
+
name = tag["name"].lower()
|
|
216
|
+
count = sum(name in {t.lower() for t in post["tags"]} for post in doc["articles"])
|
|
217
|
+
hint = Text(f"{count} article{'' if count == 1 else 's'} · fmind search --tag ")
|
|
218
|
+
hint.append(tag["name"], style="bold")
|
|
219
|
+
blocks.append(_entry(Text(tag["name"], style=ACCENT), Text(tag["description"]), hint))
|
|
220
|
+
return _listing(blocks, "no tag published")
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def news(editions: list[dict[str, Any]], *, footer: str = "") -> RenderableType:
|
|
224
|
+
"""Daily news editions, each with its curated links."""
|
|
225
|
+
blocks: list[RenderableType] = []
|
|
226
|
+
for edition in editions:
|
|
227
|
+
blocks += [Text(edition["title"], style=ACCENT), _link(edition["url"]), Text()]
|
|
228
|
+
blocks += [
|
|
229
|
+
_entry(Text(item["title"], style="bold"), Text(item["description"]), _link(item["url"]))
|
|
230
|
+
for item in edition["items"]
|
|
231
|
+
]
|
|
232
|
+
if not blocks:
|
|
233
|
+
return Text("no news edition matches")
|
|
234
|
+
return Group(*blocks, Text(footer)) if footer else Group(*blocks)
|
|
235
|
+
|
|
236
|
+
|
|
205
237
|
def article_body(markdown: str) -> RenderableType:
|
|
206
238
|
"""One article, rendered from its published Markdown source.
|
|
207
239
|
|
|
@@ -229,9 +261,13 @@ def papers(doc: dict[str, Any]) -> RenderableType:
|
|
|
229
261
|
if thesis.get("links"):
|
|
230
262
|
parts.append(Text())
|
|
231
263
|
parts += [Text("PUBLICATIONS", style=ACCENT), Text()]
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
264
|
+
for paper in doc["papers"]:
|
|
265
|
+
lines: list[RenderableType] = [Text(paper["title"], style="bold"), Text(paper["venue"]), _link(paper["url"])]
|
|
266
|
+
if paper["code"]:
|
|
267
|
+
code = Text(f" {paper['code_label'] or 'Code'} ", no_wrap=True, overflow="ignore")
|
|
268
|
+
code.append_text(_link(paper["code"]))
|
|
269
|
+
lines.append(code)
|
|
270
|
+
parts.append(_entry(*lines))
|
|
235
271
|
return Group(*parts)
|
|
236
272
|
|
|
237
273
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"""Read Médéric Hurier's (Fmind) portfolio from the terminal.
|
|
2
|
-
|
|
3
|
-
Every command renders https://www.fmind.dev/api/profile, so this package carries
|
|
4
|
-
no copy of its own and needs no release when the website changes.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from importlib.metadata import version
|
|
8
|
-
|
|
9
|
-
__all__ = ["__version__"]
|
|
10
|
-
|
|
11
|
-
__version__ = version("fmind")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|