Skip to content

armgit / janas

Public Imported from GitHub
0

37 tok/s from Qwen3-Next-80B (48 GB) on a 32 GB laptop, 24 without drafts vs 2.8 for llama.cpp; reading 62 vs 16 tok/s. Faster than llama.cpp on all 13 models compared in Q4_K_M. LLMs bigger than your RAM, pure C, CPU or GPU.

Release 2026-10-02: the MCP services under src/services/, what they share in src/services/common/

camaurif1ea26910b07
diff --git a/ChangeLog.md b/ChangeLog.md
index 5e5e126..d751ef6 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -2,6 +2,10 @@
> Curated, user-facing summary of completed work, newest first.
+## [2026-10-02] - The services under one directory
+
+- **The MCP services in `src/services/`**: each in `src/services/<service>/` (flights, git, github, maps, prices, weather, wiki), what they share in `src/services/common/` (the geography's tables, the GET over HTTPS, where the user is, the layouts of the answers). The programs keep their names.
+
## [2026-10-02] - janas-prices: prices and finance, for information
- **janas-prices**, an MCP service for information only: an amount in other currencies at the ECB's reference rates (Frankfurter; the ECB's file when it does not answer), a crypto-asset's price (CoinGecko's keyless API; Coinbase when it does not answer), a share's (Alpha Vantage, with a free key of the user's: the only tool that needs one), inflation (Eurostat monthly for the EU, Iceland and Norway, the World Bank yearly for every other country), the rates of the ECB, the Fed, the Bank of England and the SNB, the wholesale price of electricity hour by hour (energy-charts, only the bidding zones it gives under CC BY: northern Italy yes, Sicily no), the cheapest fuel near a place (Italy's MIMIT, France's live flow, Spain's ministry, Austria's E-Control; another country is said not to be covered; a price not told for over eight days is left out and counted: a station's of two months before had come first in Palermo). Every answer says its source, its date, and "for information only, not advice". Layouts for every answer; `tests/test_prices_parse.c` on answers of 2 October.
diff --git a/build.sh b/build.sh
index b7d2d38..3f65c5b 100755
--- a/build.sh
+++ b/build.sh
@@ -55,7 +55,8 @@ Actions
Output
Objects and the static library go to lib/<cpu>-<os>-<variant>/,
programs to bin/<cpu>-<os>/, with a -<variant> suffix for every
- variant but release. Each src/<tool>/main.c becomes janas-<tool>, with
+ variant but release. Each src/<tool>/main.c and each
+ src/services/<tool>/main.c becomes janas-<tool>, with
the other .c files of its directory; the libraries of others in
src/third_party/ go into the programs that use them; every other .c
under src/ goes into the library. The release build
@@ -312,7 +313,7 @@ MBEDTLS_INC=($(tp_flags mbedtls))
# A directory with a main.c is a program: its other .c files are its own.
# Every other .c under src/ goes into the library.
-tool_dirs=$(for m in src/*/main.c; do dirname "$m"; done)
+tool_dirs=$(for m in src/*/main.c src/services/*/main.c; do dirname "$m"; done)
objs=()
while IFS= read -r src; do
grep -qx "$(dirname "$src")" <<<"$tool_dirs" && continue
@@ -336,10 +337,8 @@ if [ "$VARIANT" = release ]; then
case "$o" in
*/common_mcp_*.o) mcp_objs+=("$o") ;;
*/common_hf_*.o) ;; # for the tools, with libjanas.a only
- # the services': the geography's tables, the GET over HTTPS,
- # where the user is and the layouts of their answers
- */common_geo.o | */common_https_get.o | */common_locate.o | \
- */common_template.o) ;;
+ # what the services share (src/services/common/): theirs only
+ */services_*.o) ;;
*/llm_json.o) mcp_objs+=("$o") llm_objs+=("$o") ;;
*) llm_objs+=("$o") ;;
esac
@@ -356,7 +355,7 @@ THIRD=()
[ -f "$OBJ/libjanas_third.a" ] && THIRD=("$OBJ/libjanas_third.a")
# test and benchmark programs, and the C tools
-for src in tests/*.c tools/*.c src/*/main.c; do
+for src in tests/*.c tools/*.c src/*/main.c src/services/*/main.c; do
exe="$BIN/$(basename "${src%.c}")$SUFFIX"
own=()
if [ "$(basename "$src")" = main.c ]; then
diff --git a/docs/services/weather.md b/docs/services/weather.md
index a33d2ce..2495922 100644
--- a/docs/services/weather.md
+++ b/docs/services/weather.md
@@ -19,7 +19,7 @@ A place is a name in Italian or English ("Trapani", "Firenze", "Florence"), with
2. **The internet connection's position**, from [GeoJS](https://www.geojs.io), or [ipwho.is](https://ipwho.is) when it does not answer: free and with no key, but the address seen is the connection's, so the town can be the provider's rather than yours (a town nearby, more often than not). Asked once an hour at most.
3. **The city of the computer's time zone** (`Europe/Rome`: Rome), a rough guess, when neither answers.
-The same applies to `janas-flights`' `flights_nearby`; the code is shared (`src/common/locate.c`), for the services to come. `janas-chat` passes its environment to the services it starts, so `JANAS_LOCATION` set for the chat reaches them.
+The same applies to `janas-flights`' `flights_nearby`; the code is shared (`src/services/common/locate.c`), for the services to come. `janas-chat` passes its environment to the services it starts, so `JANAS_LOCATION` set for the chat reaches them.
## Where the data comes from
diff --git a/src/chat/layout.c b/src/chat/layout.c
index e216298..7983c80 100644
--- a/src/chat/layout.c
+++ b/src/chat/layout.c
@@ -14,7 +14,7 @@
#include <string.h>
#include <sys/stat.h>
-#include "common/template.h"
+#include "services/common/template.h"
#include "glossary.h"
#define META "dev.prabanta.janas/layout"
diff --git a/src/chat/layout.h b/src/chat/layout.h
index 33c5949..61c80b6 100644
--- a/src/chat/layout.h
+++ b/src/chat/layout.h
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layout.h - the layouts of the services' answers in janas-chat
- * (common/template.h): an answer that brings its data and an English
+ * (services/common/template.h): an answer that brings its data and an English
* layout is shown to the user filled in the user's language, and the model
* reads only its brief. The layout in another language is asked of the
* model once, checked against the English one and kept in
diff --git a/src/common/mcp_server.c b/src/common/mcp_server.c
index a19906e..98b75f9 100644
--- a/src/common/mcp_server.c
+++ b/src/common/mcp_server.c
@@ -34,7 +34,7 @@ static void result(struct janas_mcps *s, const struct janas_json *id,
janas_json_write(&b, id);
janas_buf_puts(&b, ",\"result\":{");
/* the server's own _meta, and the tool's when it gave one (a layout,
- common/template.h): one object, a key may not come twice */
+ services/common/template.h): one object, a key may not come twice */
struct janas_buf all = {0};
janas_buf_puts(&all, "{");
janas_buf_put(&all, members, n);
diff --git a/src/common/geo.c b/src/services/common/geo.c
similarity index 100%
rename from src/common/geo.c
rename to src/services/common/geo.c
diff --git a/src/common/geo.h b/src/services/common/geo.h
similarity index 96%
rename from src/common/geo.h
rename to src/services/common/geo.h
index 04b8a5b..275773e 100644
--- a/src/common/geo.h
+++ b/src/services/common/geo.h
@@ -99,8 +99,8 @@ int geo_area_has(const struct geo_area *a, double lat, double lon);
/* The position in words, appended to b. */
void geo_describe(double lat, double lon, struct janas_buf *b);
-/* The same as a JSON object, for a layout (common/template.h): "sea" when
- over one, "region" ("Sicily, Italy": the region over, or the first of
+/* The same as a JSON object, for a layout (services/common/template.h): "sea"
+ when over one, "region" ("Sicily, Italy": the region over, or the first of
the two a sea lies between), "and" (the second), "city", and "km" and
"dir" from it when 3 km or more away. */
void geo_describe_json(double lat, double lon, struct janas_buf *b);
diff --git a/src/common/geo_data.h b/src/services/common/geo_data.h
similarity index 100%
rename from src/common/geo_data.h
rename to src/services/common/geo_data.h
diff --git a/src/common/https_get.c b/src/services/common/https_get.c
similarity index 100%
rename from src/common/https_get.c
rename to src/services/common/https_get.c
diff --git a/src/common/https_get.h b/src/services/common/https_get.h
similarity index 100%
rename from src/common/https_get.h
rename to src/services/common/https_get.h
diff --git a/src/common/locate.c b/src/services/common/locate.c
similarity index 98%
rename from src/common/locate.c
rename to src/services/common/locate.c
index fc56756..17acab9 100644
--- a/src/common/locate.c
+++ b/src/services/common/locate.c
@@ -13,9 +13,9 @@
#include <time.h>
#include <unistd.h>
-#include "common/geo.h"
-#include "common/https_get.h"
-#include "common/locate.h"
+#include "services/common/geo.h"
+#include "services/common/https_get.h"
+#include "services/common/locate.h"
#define DEG(x) ((x) * 1e-5)
#define KEEP_S 3600 /* a connection seldom moves within the hour */
diff --git a/src/common/locate.h b/src/services/common/locate.h
similarity index 100%
rename from src/common/locate.h
rename to src/services/common/locate.h
diff --git a/src/common/template.c b/src/services/common/template.c
similarity index 99%
rename from src/common/template.c
rename to src/services/common/template.c
index f83ddbc..c65b226 100644
--- a/src/common/template.c
+++ b/src/services/common/template.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
-#include "common/template.h"
+#include "services/common/template.h"
#define DEPTH 32
diff --git a/src/common/template.h b/src/services/common/template.h
similarity index 100%
rename from src/common/template.h
rename to src/services/common/template.h
diff --git a/src/flights/adsb.c b/src/services/flights/adsb.c
similarity index 100%
rename from src/flights/adsb.c
rename to src/services/flights/adsb.c
diff --git a/src/flights/flights.h b/src/services/flights/flights.h
similarity index 93%
rename from src/flights/flights.h
rename to src/services/flights/flights.h
index 86aeb07..f64a0d2 100644
--- a/src/flights/flights.h
+++ b/src/services/flights/flights.h
@@ -2,8 +2,8 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* flights.h - janas-flights, flights as an MCP service: what its parts
- * share. common/https_get.c fetches, adsb.c reads the community ADS-B networks
- * (adsb.lol, adsb.fi as the fallback), route.c asks adsbdb for a
+ * share. services/common/https_get.c fetches, adsb.c reads the community ADS-B
+ * networks (adsb.lol, adsb.fi as the fallback), route.c asks adsbdb for a
* callsign's route and an airline's codes, schedule.c asks AviationStack
* for the times (with a key of the user's), tools.c offers the tools.
*/
@@ -13,7 +13,7 @@
#include <stddef.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "llm/json.h"
/* ---- adsb.c ---- */
@@ -100,7 +100,7 @@ void fl_sched_free(void);
/* ---- layouts.c ---- */
-/* flights_over's layout and brief (common/template.h). */
+/* flights_over's layout and brief (services/common/template.h). */
extern const char FL_OVER_LAYOUT[], FL_OVER_BRIEF[];
/* flights_nearby's */
extern const char FL_NEAR_LAYOUT[], FL_NEAR_BRIEF[];
diff --git a/src/flights/layouts.c b/src/services/flights/layouts.c
similarity index 98%
rename from src/flights/layouts.c
rename to src/services/flights/layouts.c
index 538c6b6..ccd878d 100644
--- a/src/flights/layouts.c
+++ b/src/services/flights/layouts.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-flights' answers (see flights.h and
- * common/template.h): the text the user reads, filled with the data in
+ * services/common/template.h): the text the user reads, filled with the data in
* English here and in the user's language by a client that translates the
* layout once (janas-chat), and the brief, all the model reads of it.
*/
diff --git a/src/flights/main.c b/src/services/flights/main.c
similarity index 100%
rename from src/flights/main.c
rename to src/services/flights/main.c
diff --git a/src/flights/route.c b/src/services/flights/route.c
similarity index 100%
rename from src/flights/route.c
rename to src/services/flights/route.c
diff --git a/src/flights/schedule.c b/src/services/flights/schedule.c
similarity index 100%
rename from src/flights/schedule.c
rename to src/services/flights/schedule.c
diff --git a/src/flights/tools.c b/src/services/flights/tools.c
similarity index 99%
rename from src/flights/tools.c
rename to src/services/flights/tools.c
index d4dd116..a31a214 100644
--- a/src/flights/tools.c
+++ b/src/services/flights/tools.c
@@ -21,11 +21,11 @@
#include <time.h>
#include <unistd.h>
-#include "common/locate.h"
+#include "services/common/locate.h"
#include "common/mcp_server.h"
#include "flights.h"
-#include "common/geo.h"
-#include "common/template.h"
+#include "services/common/geo.h"
+#include "services/common/template.h"
#define DEG(x) ((x) * 1e-5)
#define KM_PER_NM 1.852
diff --git a/src/git/data.c b/src/services/git/data.c
similarity index 97%
rename from src/git/data.c
rename to src/services/git/data.c
index 346fae7..4f68dac 100644
--- a/src/git/data.c
+++ b/src/services/git/data.c
@@ -2,8 +2,8 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* data.c - what janas-git read, as the data of its layouts (see git.h,
- * layouts.c and common/template.h). Every field is written, even empty: a
- * layout looks a name up in the item, then in what holds it.
+ * layouts.c and services/common/template.h). Every field is written, even
+ * empty: a layout looks a name up in the item, then in what holds it.
*/
#include <stdio.h>
#include <string.h>
diff --git a/src/git/git.h b/src/services/git/git.h
similarity index 100%
rename from src/git/git.h
rename to src/services/git/git.h
diff --git a/src/git/layouts.c b/src/services/git/layouts.c
similarity index 98%
rename from src/git/layouts.c
rename to src/services/git/layouts.c
index 2dec7c6..c2b2165 100644
--- a/src/git/layouts.c
+++ b/src/services/git/layouts.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-git's answers (see git.h and
- * common/template.h): the text the user reads, filled with the data in
+ * services/common/template.h): the text the user reads, filled with the data in
* English here and in the user's language by a client that translates the
* layout once (janas-chat), and the brief, all the model reads of it.
* Paths, messages and diffs stay as they are; git's own output, after a
diff --git a/src/git/main.c b/src/services/git/main.c
similarity index 100%
rename from src/git/main.c
rename to src/services/git/main.c
diff --git a/src/git/read.c b/src/services/git/read.c
similarity index 100%
rename from src/git/read.c
rename to src/services/git/read.c
diff --git a/src/git/repo.c b/src/services/git/repo.c
similarity index 100%
rename from src/git/repo.c
rename to src/services/git/repo.c
diff --git a/src/git/run.c b/src/services/git/run.c
similarity index 100%
rename from src/git/run.c
rename to src/services/git/run.c
diff --git a/src/git/tools.c b/src/services/git/tools.c
similarity index 99%
rename from src/git/tools.c
rename to src/services/git/tools.c
index cbf7a91..4efada4 100644
--- a/src/git/tools.c
+++ b/src/services/git/tools.c
@@ -12,7 +12,7 @@
#include <string.h>
#include "common/mcp_server.h"
-#include "common/template.h"
+#include "services/common/template.h"
#include "git.h"
#define LOCAL_MS 15000
diff --git a/src/git/write.c b/src/services/git/write.c
similarity index 100%
rename from src/git/write.c
rename to src/services/git/write.c
diff --git a/src/github/data.c b/src/services/github/data.c
similarity index 97%
rename from src/github/data.c
rename to src/services/github/data.c
index b4bda77..c490e37 100644
--- a/src/github/data.c
+++ b/src/services/github/data.c
@@ -2,8 +2,8 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* data.c - what janas-github read, as the data of its layouts (see
- * github.h, layouts.c and common/template.h). Every field is written, even
- * empty: a layout looks a name up in the item, then in what holds it, and
+ * github.h, layouts.c and services/common/template.h). Every field is written,
+ * even empty: a layout looks a name up in the item, then in what holds it, and
* an issue without labels would show another's.
*/
#include <stdio.h>
diff --git a/src/github/fetch.c b/src/services/github/fetch.c
similarity index 99%
rename from src/github/fetch.c
rename to src/services/github/fetch.c
index 858cceb..face1ff 100644
--- a/src/github/fetch.c
+++ b/src/services/github/fetch.c
@@ -14,7 +14,7 @@
#include <string.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "github.h"
#ifndef JANAS_VERSION
diff --git a/src/github/github.h b/src/services/github/github.h
similarity index 100%
rename from src/github/github.h
rename to src/services/github/github.h
diff --git a/src/github/layouts.c b/src/services/github/layouts.c
similarity index 98%
rename from src/github/layouts.c
rename to src/services/github/layouts.c
index 15b29fe..ffa9297 100644
--- a/src/github/layouts.c
+++ b/src/services/github/layouts.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-github's answers (see github.h and
- * common/template.h): the text the user reads, filled with the data in
+ * services/common/template.h): the text the user reads, filled with the data in
* English here and in the user's language by a client that translates the
* layout once (janas-chat), and the brief, all the model reads of it.
* Titles, messages and notes stay as their authors wrote them.
diff --git a/src/github/main.c b/src/services/github/main.c
similarity index 100%
rename from src/github/main.c
rename to src/services/github/main.c
diff --git a/src/github/read.c b/src/services/github/read.c
similarity index 100%
rename from src/github/read.c
rename to src/services/github/read.c
diff --git a/src/github/repo.c b/src/services/github/repo.c
similarity index 100%
rename from src/github/repo.c
rename to src/services/github/repo.c
diff --git a/src/github/seen.c b/src/services/github/seen.c
similarity index 100%
rename from src/github/seen.c
rename to src/services/github/seen.c
diff --git a/src/github/tools.c b/src/services/github/tools.c
similarity index 99%
rename from src/github/tools.c
rename to src/services/github/tools.c
index af0bf84..bda14d3 100644
--- a/src/github/tools.c
+++ b/src/services/github/tools.c
@@ -10,7 +10,7 @@
#include <time.h>
#include "common/mcp_server.h"
-#include "common/template.h"
+#include "services/common/template.h"
#include "github.h"
#define DAY 86400
diff --git a/src/maps/data.c b/src/services/maps/data.c
similarity index 96%
rename from src/maps/data.c
rename to src/services/maps/data.c
index e08fdc2..f127d39 100644
--- a/src/maps/data.c
+++ b/src/services/maps/data.c
@@ -2,8 +2,8 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* data.c - what janas-maps read, as the data of its layouts (see maps.h,
- * layouts.c and common/template.h): JSON objects whose fields the layouts
- * name. Distances and times are numbers, the words around them the
+ * layouts.c and services/common/template.h): JSON objects whose fields the
+ * layouts name. Distances and times are numbers, the words around them the
* layout's, so that a client shows them in the user's language.
*/
#include <math.h>
@@ -12,12 +12,12 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "maps.h"
/* A field is written even when empty: a layout looks a name up in the
- item, then in what holds it (common/template.h), and a step without its
- own distance would show the whole route's. */
+ item, then in what holds it (services/common/template.h), and a step without
+ its own distance would show the whole route's. */
void mp_jstr(struct janas_buf *b, const char *key, const char *v)
{
if (!v)
diff --git a/src/maps/fetch.c b/src/services/maps/fetch.c
similarity index 99%
rename from src/maps/fetch.c
rename to src/services/maps/fetch.c
index 44a2831..1f2bf97 100644
--- a/src/maps/fetch.c
+++ b/src/services/maps/fetch.c
@@ -13,7 +13,7 @@
#include <string.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "maps.h"
#ifndef JANAS_VERSION
diff --git a/src/maps/layouts.c b/src/services/maps/layouts.c
similarity index 99%
rename from src/maps/layouts.c
rename to src/services/maps/layouts.c
index f7c9e84..dc1367b 100644
--- a/src/maps/layouts.c
+++ b/src/services/maps/layouts.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-maps' answers (see maps.h and
- * common/template.h): the text the user reads, filled with the data in
+ * services/common/template.h): the text the user reads, filled with the data in
* English here and in the user's language by a client that translates the
* layout once (janas-chat), and the brief, all the model reads of it. A
* route's steps come from Valhalla already in the computer's language.
diff --git a/src/maps/main.c b/src/services/maps/main.c
similarity index 100%
rename from src/maps/main.c
rename to src/services/maps/main.c
diff --git a/src/maps/maps.h b/src/services/maps/maps.h
similarity index 100%
rename from src/maps/maps.h
rename to src/services/maps/maps.h
diff --git a/src/maps/nearby.c b/src/services/maps/nearby.c
similarity index 100%
rename from src/maps/nearby.c
rename to src/services/maps/nearby.c
diff --git a/src/maps/place.c b/src/services/maps/place.c
similarity index 99%
rename from src/maps/place.c
rename to src/services/maps/place.c
index 116e38f..2d072b9 100644
--- a/src/maps/place.c
+++ b/src/services/maps/place.c
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "maps.h"
#define DEG(x) ((x) * 1e-5)
diff --git a/src/maps/read.c b/src/services/maps/read.c
similarity index 99%
rename from src/maps/read.c
rename to src/services/maps/read.c
index 6639f93..89e9af2 100644
--- a/src/maps/read.c
+++ b/src/services/maps/read.c
@@ -13,7 +13,7 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "maps.h"
static void copy(char *to, size_t cap, const char *s)
diff --git a/src/maps/route.c b/src/services/maps/route.c
similarity index 100%
rename from src/maps/route.c
rename to src/services/maps/route.c
diff --git a/src/maps/tools.c b/src/services/maps/tools.c
similarity index 99%
rename from src/maps/tools.c
rename to src/services/maps/tools.c
index a00941d..ac81b2f 100644
--- a/src/maps/tools.c
+++ b/src/services/maps/tools.c
@@ -10,9 +10,9 @@
#include <stdio.h>
#include <string.h>
-#include "common/locate.h"
+#include "services/common/locate.h"
#include "common/mcp_server.h"
-#include "common/template.h"
+#include "services/common/template.h"
#include "maps.h"
/* The model reads all of it before it can use a tool: every word costs. */
diff --git a/src/maps/transit.c b/src/services/maps/transit.c
similarity index 99%
rename from src/maps/transit.c
rename to src/services/maps/transit.c
index 3a6984f..13574f2 100644
--- a/src/maps/transit.c
+++ b/src/services/maps/transit.c
@@ -13,7 +13,7 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "maps.h"
#define TRANSIT_KEEP_S 120
diff --git a/src/prices/data.c b/src/services/prices/data.c
similarity index 98%
rename from src/prices/data.c
rename to src/services/prices/data.c
index 1bb1737..69f11e2 100644
--- a/src/prices/data.c
+++ b/src/services/prices/data.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* data.c - what janas-prices read, as the data of its layouts (see
- * prices.h, layouts.c and common/template.h). Every field is written,
+ * prices.h, layouts.c and services/common/template.h). Every field is written,
* even empty: a layout looks a name up in the item, then in what holds it.
* Numbers keep the decimals a price of their size needs.
*/
@@ -11,7 +11,7 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "prices.h"
void pr_jstr(struct janas_buf *b, const char *key, const char *v)
diff --git a/src/prices/fetch.c b/src/services/prices/fetch.c
similarity index 99%
rename from src/prices/fetch.c
rename to src/services/prices/fetch.c
index 5c6a106..581bd8f 100644
--- a/src/prices/fetch.c
+++ b/src/services/prices/fetch.c
@@ -14,7 +14,7 @@
#include <string.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "prices.h"
#ifndef JANAS_VERSION
diff --git a/src/prices/fuel.c b/src/services/prices/fuel.c
similarity index 100%
rename from src/prices/fuel.c
rename to src/services/prices/fuel.c
diff --git a/src/prices/layouts.c b/src/services/prices/layouts.c
similarity index 99%
rename from src/prices/layouts.c
rename to src/services/prices/layouts.c
index a1873ce..01a3297 100644
--- a/src/prices/layouts.c
+++ b/src/services/prices/layouts.c
@@ -2,7 +2,7 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-prices' answers (see prices.h and
- * common/template.h): the text the user reads, filled with the data in
+ * services/common/template.h): the text the user reads, filled with the data in
* English here and in the user's language by a client that translates the
* layout once (janas-chat), and the brief, all the model reads of it.
* Every answer says where its figures come from, how old they are, and
diff --git a/src/prices/macro.c b/src/services/prices/macro.c
similarity index 99%
rename from src/prices/macro.c
rename to src/services/prices/macro.c
index c1bee2f..ba871ad 100644
--- a/src/prices/macro.c
+++ b/src/services/prices/macro.c
@@ -15,8 +15,8 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
-#include "common/locate.h"
+#include "services/common/geo.h"
+#include "services/common/locate.h"
#include "prices.h"
#define DAY_KEEP_S 3600
diff --git a/src/prices/main.c b/src/services/prices/main.c
similarity index 100%
rename from src/prices/main.c
rename to src/services/prices/main.c
diff --git a/src/prices/money.c b/src/services/prices/money.c
similarity index 100%
rename from src/prices/money.c
rename to src/services/prices/money.c
diff --git a/src/prices/place.c b/src/services/prices/place.c
similarity index 98%
rename from src/prices/place.c
rename to src/services/prices/place.c
index 51442c7..3e82408 100644
--- a/src/prices/place.c
+++ b/src/services/prices/place.c
@@ -13,8 +13,8 @@
#include <stdlib.h>
#include <string.h>
-#include "common/geo.h"
-#include "common/locate.h"
+#include "services/common/geo.h"
+#include "services/common/locate.h"
#include "prices.h"
#define GEO_KEEP_S (7 * 86400)
diff --git a/src/prices/prices.h b/src/services/prices/prices.h
similarity index 100%
rename from src/prices/prices.h
rename to src/services/prices/prices.h
diff --git a/src/prices/read.c b/src/services/prices/read.c
similarity index 100%
rename from src/prices/read.c
rename to src/services/prices/read.c
diff --git a/src/prices/read_fuel.c b/src/services/prices/read_fuel.c
similarity index 99%
rename from src/prices/read_fuel.c
rename to src/services/prices/read_fuel.c
index f4b48d0..60c8de0 100644
--- a/src/prices/read_fuel.c
+++ b/src/services/prices/read_fuel.c
@@ -17,7 +17,7 @@
#include <strings.h>
#include <time.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "prices.h"
#define ALL_MAX 4096 /* stations within a radius, at most */
diff --git a/src/prices/tools.c b/src/services/prices/tools.c
similarity index 99%
rename from src/prices/tools.c
rename to src/services/prices/tools.c
index e67cc74..e91cb1c 100644
--- a/src/prices/tools.c
+++ b/src/services/prices/tools.c
@@ -11,7 +11,7 @@
#include <string.h>
#include "common/mcp_server.h"
-#include "common/template.h"
+#include "services/common/template.h"
#include "prices.h"
#define READS \
diff --git a/src/weather/alerts.c b/src/services/weather/alerts.c
similarity index 100%
rename from src/weather/alerts.c
rename to src/services/weather/alerts.c
diff --git a/src/weather/fetch.c b/src/services/weather/fetch.c
similarity index 98%
rename from src/weather/fetch.c
rename to src/services/weather/fetch.c
index c578c21..d5303bf 100644
--- a/src/weather/fetch.c
+++ b/src/services/weather/fetch.c
@@ -12,7 +12,7 @@
#include <string.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "weather.h"
#ifndef JANAS_VERSION
diff --git a/src/weather/layouts.c b/src/services/weather/layouts.c
similarity index 99%
rename from src/weather/layouts.c
rename to src/services/weather/layouts.c
index 4dc414c..d966e98 100644
--- a/src/weather/layouts.c
+++ b/src/services/weather/layouts.c
@@ -2,8 +2,8 @@
Copyright (C) 2026 Maurizio Cammalleri */
/*
* layouts.c - the layouts of janas-weather's answers (see weather.h and
- * common/template.h): the report the user reads, filled in English here
- * and in the user's language by a client that translates the layout once
+ * services/common/template.h): the report the user reads, filled in English
+ * here and in the user's language by a client that translates the layout once
* (janas-chat), and the brief, the figures the model reads to answer.
*/
#include "weather.h"
diff --git a/src/weather/main.c b/src/services/weather/main.c
similarity index 100%
rename from src/weather/main.c
rename to src/services/weather/main.c
diff --git a/src/weather/metar.c b/src/services/weather/metar.c
similarity index 99%
rename from src/weather/metar.c
rename to src/services/weather/metar.c
index 5835013..4be8985 100644
--- a/src/weather/metar.c
+++ b/src/services/weather/metar.c
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <string.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "weather.h"
#define METAR_KEEP_S 600 /* a METAR comes every half hour or hour */
diff --git a/src/weather/metno.c b/src/services/weather/metno.c
similarity index 100%
rename from src/weather/metno.c
rename to src/services/weather/metno.c
diff --git a/src/weather/openmeteo.c b/src/services/weather/openmeteo.c
similarity index 100%
rename from src/weather/openmeteo.c
rename to src/services/weather/openmeteo.c
diff --git a/src/weather/place.c b/src/services/weather/place.c
similarity index 99%
rename from src/weather/place.c
rename to src/services/weather/place.c
index 127c4e2..41df270 100644
--- a/src/weather/place.c
+++ b/src/services/weather/place.c
@@ -16,7 +16,7 @@
#include <string.h>
#include <strings.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "weather.h"
#define DEG(x) ((x) * 1e-5)
diff --git a/src/weather/report.c b/src/services/weather/report.c
similarity index 98%
rename from src/weather/report.c
rename to src/services/weather/report.c
index fe84772..6df028c 100644
--- a/src/weather/report.c
+++ b/src/services/weather/report.c
@@ -7,7 +7,7 @@
* a cell of its grid and a station's is a measure at a known place and
* minute: both are given, said for what they are, and when they disagree
* it is said too, so that the model telling them need not guess which.
- * The answers are data with a layout (layouts.c, common/template.h).
+ * The answers are data with a layout (layouts.c, services/common/template.h).
*/
#define _GNU_SOURCE /* timegm */
#include <math.h>
@@ -16,8 +16,8 @@
#include <string.h>
#include <time.h>
-#include "common/geo.h"
-#include "common/template.h"
+#include "services/common/geo.h"
+#include "services/common/template.h"
#include "weather.h"
#define STATION_KM 40 /* the nearest station, within this */
diff --git a/src/weather/sea.c b/src/services/weather/sea.c
similarity index 99%
rename from src/weather/sea.c
rename to src/services/weather/sea.c
index f0d2bd9..ccc17ba 100644
--- a/src/weather/sea.c
+++ b/src/services/weather/sea.c
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <string.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "weather.h"
#define DEG(x) ((x) * 1e-5)
diff --git a/src/weather/tools.c b/src/services/weather/tools.c
similarity index 99%
rename from src/weather/tools.c
rename to src/services/weather/tools.c
index 302f6b0..5b6b45b 100644
--- a/src/weather/tools.c
+++ b/src/services/weather/tools.c
@@ -13,7 +13,7 @@
#include <string.h>
#include <time.h>
-#include "common/locate.h"
+#include "services/common/locate.h"
#include "common/mcp_server.h"
#include "weather.h"
diff --git a/src/weather/warn.c b/src/services/weather/warn.c
similarity index 100%
rename from src/weather/warn.c
rename to src/services/weather/warn.c
diff --git a/src/weather/weather.h b/src/services/weather/weather.h
similarity index 99%
rename from src/weather/weather.h
rename to src/services/weather/weather.h
index 99918c9..30af341 100644
--- a/src/weather/weather.h
+++ b/src/services/weather/weather.h
@@ -257,7 +257,7 @@ int wx_tool_forecast(const struct janas_json *args, struct janas_buf *b);
int wx_tool_sea(const struct janas_json *args, struct janas_buf *b);
int wx_tool_alerts(const struct janas_json *args, struct janas_buf *b);
-/* ---- report.c: data for a layout (common/template.h) ---- */
+/* ---- report.c: data for a layout (services/common/template.h) ---- */
/* , "key": value, as JSON: a text; a number with that many decimals,
nothing when NAN; the wind's force and where it blows from; a date's
@@ -275,7 +275,7 @@ int wx_answer(struct janas_buf *b, const char *name, struct janas_buf *d,
/* ---- layouts.c ---- */
/* The layouts and briefs of weather_now and weather_forecast
- (common/template.h). */
+ (services/common/template.h). */
extern const char WX_NOW_LAYOUT[], WX_NOW_BRIEF[];
extern const char WX_FORECAST_LAYOUT[], WX_FORECAST_BRIEF[];
extern const char WX_SEA_LAYOUT[], WX_SEA_BRIEF[];
diff --git a/src/weather/words.c b/src/services/weather/words.c
similarity index 99%
rename from src/weather/words.c
rename to src/services/weather/words.c
index fcce53a..37ed4c0 100644
--- a/src/weather/words.c
+++ b/src/services/weather/words.c
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
-#include "common/geo.h"
+#include "services/common/geo.h"
#include "weather.h"
const char *wx_code_text(int code)
diff --git a/src/wiki/fetch.c b/src/services/wiki/fetch.c
similarity index 98%
rename from src/wiki/fetch.c
rename to src/services/wiki/fetch.c
index 246d798..eaca2d4 100644
--- a/src/wiki/fetch.c
+++ b/src/services/wiki/fetch.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <time.h>
-#include "common/https_get.h"
+#include "services/common/https_get.h"
#include "wiki.h"
#ifndef JANAS_VERSION
diff --git a/src/wiki/main.c b/src/services/wiki/main.c
similarity index 100%
rename from src/wiki/main.c
rename to src/services/wiki/main.c
diff --git a/src/wiki/read.c b/src/services/wiki/read.c
similarity index 100%
rename from src/wiki/read.c
rename to src/services/wiki/read.c
diff --git a/src/wiki/tools.c b/src/services/wiki/tools.c
similarity index 99%
rename from src/wiki/tools.c
rename to src/services/wiki/tools.c
index 3609801..9c6bd57 100644
--- a/src/wiki/tools.c
+++ b/src/services/wiki/tools.c
@@ -11,8 +11,8 @@
#include <stdlib.h>
#include <string.h>
-#include "common/geo.h"
-#include "common/locate.h"
+#include "services/common/geo.h"
+#include "services/common/locate.h"
#include "common/mcp_server.h"
#include "wiki.h"
diff --git a/src/wiki/wiki.h b/src/services/wiki/wiki.h
similarity index 100%
rename from src/wiki/wiki.h
rename to src/services/wiki/wiki.h
diff --git a/tests/test_flights_parse.c b/tests/test_flights_parse.c
index fc4f25f..dabda3a 100644
--- a/tests/test_flights_parse.c
+++ b/tests/test_flights_parse.c
@@ -12,7 +12,7 @@
#include <string.h>
#include <unistd.h>
-#include "flights/schedule.c"
+#include "services/flights/schedule.c"
int janas_https_get(const char *url, const char *const *headers,
size_t n_headers, struct janas_buf *out, char *err,
diff --git a/tests/test_geo.c b/tests/test_geo.c
index f04ce8c..c73db5a 100644
--- a/tests/test_geo.c
+++ b/tests/test_geo.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <unistd.h>
-#include "common/geo.c"
+#include "services/common/geo.c"
static int failures;
diff --git a/tests/test_git_parse.c b/tests/test_git_parse.c
index f4c378a..ae30e93 100644
--- a/tests/test_git_parse.c
+++ b/tests/test_git_parse.c
@@ -14,12 +14,12 @@
#include <stdlib.h>
#include <string.h>
-#include "common/template.h"
-#include "git/data.c"
-#include "git/layouts.c"
-#include "git/read.c"
-#include "git/repo.c"
-#include "git/run.c"
+#include "services/common/template.h"
+#include "services/git/data.c"
+#include "services/git/layouts.c"
+#include "services/git/read.c"
+#include "services/git/repo.c"
+#include "services/git/run.c"
static int failures;
diff --git a/tests/test_github_parse.c b/tests/test_github_parse.c
index 7504a57..286bc07 100644
--- a/tests/test_github_parse.c
+++ b/tests/test_github_parse.c
@@ -15,11 +15,11 @@
#include <string.h>
#include <unistd.h>
-#include "common/template.h"
-#include "github/data.c"
-#include "github/layouts.c"
-#include "github/read.c"
-#include "github/seen.c"
+#include "services/common/template.h"
+#include "services/github/data.c"
+#include "services/github/layouts.c"
+#include "services/github/read.c"
+#include "services/github/seen.c"
static int failures;
diff --git a/tests/test_locate.c b/tests/test_locate.c
index d8d1a3f..9fc32f5 100644
--- a/tests/test_locate.c
+++ b/tests/test_locate.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2026 Maurizio Cammalleri */
/*
- * test_locate.c - where the user is (src/common/locate.c), without the
+ * test_locate.c - where the user is (src/services/common/locate.c), without the
* network: the answers of GeoJS and ipwho.is as they come (numbers as
* strings in the first, a nested zone in the second), the broken ones, and
* JANAS_LOCATION as a city, a point, "off" and nonsense.
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
-#include "common/locate.h"
+#include "services/common/locate.h"
static int failures;
diff --git a/tests/test_maps_parse.c b/tests/test_maps_parse.c
index 1f28751..79583df 100644
--- a/tests/test_maps_parse.c
+++ b/tests/test_maps_parse.c
@@ -13,11 +13,11 @@
#include <stdio.h>
#include <string.h>
-#include "common/template.h"
-#include "maps/data.c"
-#include "maps/layouts.c"
-#include "maps/nearby.c"
-#include "maps/read.c"
+#include "services/common/template.h"
+#include "services/maps/data.c"
+#include "services/maps/layouts.c"
+#include "services/maps/nearby.c"
+#include "services/maps/read.c"
static int failures;
diff --git a/tests/test_prices_parse.c b/tests/test_prices_parse.c
index eed248f..dfd95fc 100644
--- a/tests/test_prices_parse.c
+++ b/tests/test_prices_parse.c
@@ -16,11 +16,11 @@
#include <stdlib.h>
#include <string.h>
-#include "common/template.h"
-#include "prices/data.c"
-#include "prices/layouts.c"
-#include "prices/read.c"
-#include "prices/read_fuel.c"
+#include "services/common/template.h"
+#include "services/prices/data.c"
+#include "services/prices/layouts.c"
+#include "services/prices/read.c"
+#include "services/prices/read_fuel.c"
static int failures;
diff --git a/tests/test_template.c b/tests/test_template.c
index 101d481..36eeb31 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2026 Maurizio Cammalleri */
/*
- * test_template.c - layouts filled with data (src/common/template.c):
+ * test_template.c - layouts filled with data (src/services/common/template.c):
* fields, words, lists and their numbers, parts shown or not, lines of a
* part's tag left out, the decimal point of the words, what is wrong in a
* layout, and a translation's shape against its original.
@@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
-#include "common/template.h"
+#include "services/common/template.h"
static int failures;
diff --git a/tests/test_weather_parse.c b/tests/test_weather_parse.c
index 87cd6c7..81a430e 100644
--- a/tests/test_weather_parse.c
+++ b/tests/test_weather_parse.c
@@ -17,12 +17,12 @@
#include <time.h>
#include <unistd.h>
-#include "weather/alerts.c"
-#include "weather/fetch.c"
-#include "weather/metar.c"
-#include "weather/metno.c"
-#include "weather/openmeteo.c"
-#include "weather/words.c"
+#include "services/weather/alerts.c"
+#include "services/weather/fetch.c"
+#include "services/weather/metar.c"
+#include "services/weather/metno.c"
+#include "services/weather/openmeteo.c"
+#include "services/weather/words.c"
static int failures;
diff --git a/tests/test_wiki_parse.c b/tests/test_wiki_parse.c
index 26bdbd7..6490a77 100644
--- a/tests/test_wiki_parse.c
+++ b/tests/test_wiki_parse.c
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <string.h>
-#include "wiki/read.c"
+#include "services/wiki/read.c"
static int failures;
diff --git a/tools/gen_geo.c b/tools/gen_geo.c
index 6e014d2..d6a1b87 100644
--- a/tools/gen_geo.c
+++ b/tools/gen_geo.c
@@ -1,10 +1,10 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2026 Maurizio Cammalleri */
/*
- * gen_geo.c - generates src/common/geo_data.h, the tables of Janas's
- * services' geography (src/common/geo.h): countries, first-level regions, time
- * zones, cities of 30,000 people or more and every capital, the airports
- * with an IATA code and scheduled flights, and the seas as polygons.
+ * gen_geo.c - generates src/services/common/geo_data.h, the tables of Janas's
+ * services' geography (src/services/common/geo.h): countries, first-level
+ * regions, time zones, cities of 30,000 people or more and every capital, the
+ * airports with an IATA code and scheduled flights, and the seas as polygons.
*
* It reads, from one directory:
* airports.csv OurAirports, public domain
@@ -19,7 +19,7 @@
* An airport's time zone is that of the nearest city. The seas' outlines
* are simplified to about a kilometre (Douglas-Peucker, 0.01 degree).
*
- * Usage: gen_geo <data-directory> > src/common/geo_data.h
+ * Usage: gen_geo <data-directory> > src/services/common/geo_data.h
*/
#include <math.h>
#include <stdint.h>
@@ -482,8 +482,9 @@ static int read_seas(void)
int main(int argc, char **argv)
{
if (argc != 2) {
- fprintf(stderr,
- "usage: gen_geo <data-directory> > src/common/geo_data.h\n");
+ fprintf(
+ stderr,
+ "usage: gen_geo <data-directory> > src/services/common/geo_data.h\n");
return 2;
}
snprintf(dir, sizeof dir, "%s", argv[1]);