@gehlich/calicomp-mcp 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +23 -0
  2. package/dist/index.js +32 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -94,6 +94,29 @@ exclusive JSON-RPC channel.
94
94
  }
95
95
  ```
96
96
 
97
+ ## Exercise Catalog: Curated Entries and Custom Exercises (since 1.1.0)
98
+
99
+ `get_exercise_catalog` — and every training-state calculation that resolves an exercise id —
100
+ returns two kinds of entries, distinguished by the `origin` field:
101
+
102
+ - **`"CATALOG"`** — the curated, admin-maintained catalog (`GET /api/exercises`). These carry
103
+ muscle-group, equipment and capability-axis ratings.
104
+ - **`"CUSTOM"`** — a user's own exercise, created because they cannot write to the curated
105
+ catalog at all. For the closed test circle this is the normal case, not an exception: a custom
106
+ exercise is real training data, but it carries **no** muscle, equipment or capability rating —
107
+ there is nothing to invent, so those fields are always empty. Treat an empty rating as "not
108
+ rated", never as a measured zero.
109
+
110
+ **This does not replace curating the catalog.** If you have admin access and can run the
111
+ catalog round trip (`tools/exercise.mjs` in the super-repo), your own exercises still belong in
112
+ the curated catalog — cleanly, with real ratings. The `CUSTOM` read path exists for everyone who
113
+ cannot do that, so their training data is not silently invisible to the coach. Two user groups,
114
+ two answers; this section covers the one that has no other option.
115
+
116
+ `propose_new_exercise`'s duplicate check only ever matches against `"CATALOG"` entries — a
117
+ proposal for a new catalog exercise can never be blocked by someone else's same-named custom
118
+ exercise.
119
+
97
120
  ## Building
98
121
 
99
122
  ```bash
package/dist/index.js CHANGED
@@ -848,9 +848,34 @@ function normalizeCatalog(wireCatalog) {
848
848
  ...ex,
849
849
  capabilities: ex.capabilities ?? [],
850
850
  equipment: ex.equipment ?? [],
851
- isSkill: ex.isSkill ?? false
851
+ isSkill: ex.isSkill ?? false,
852
+ origin: "CATALOG"
852
853
  }));
853
854
  }
855
+ function projectUserExerciseToCatalog(ex, allTranslations) {
856
+ const translations = allTranslations.filter((t) => t.exerciseId === ex.id).map((t) => ({
857
+ languageCode: t.languageCode,
858
+ name: t.name,
859
+ description: t.description
860
+ }));
861
+ return {
862
+ id: ex.id,
863
+ key: `user_exercise:${ex.id}`,
864
+ nameEn: ex.name,
865
+ mode: ex.mode,
866
+ usesWeight: ex.usesWeight,
867
+ description: ex.description,
868
+ lastModifiedAt: ex.updatedAt,
869
+ translations,
870
+ // Never invented — an unrated exercise contributes nothing to a weighted evaluation, and a
871
+ // fabricated non-empty value here would look like a real measurement (T-141-80).
872
+ muscleGroups: [],
873
+ equipment: [],
874
+ isSkill: false,
875
+ capabilities: [],
876
+ origin: "CUSTOM"
877
+ };
878
+ }
854
879
  async function doFetch(pat2, keyB642, serverUrl2) {
855
880
  const [rawSnapshot, profile, rawCatalog] = await Promise.all([
856
881
  fetchSnapshot(pat2, serverUrl2),
@@ -858,7 +883,10 @@ async function doFetch(pat2, keyB642, serverUrl2) {
858
883
  fetchCatalog(serverUrl2)
859
884
  ]);
860
885
  const snapshot = decryptMerge(rawSnapshot, keyB642);
861
- const catalog = normalizeCatalog(rawCatalog);
886
+ const curatedCatalog = normalizeCatalog(rawCatalog);
887
+ const curatedIds = new Set(curatedCatalog.map((ex) => ex.id));
888
+ const projectedUserExercises = snapshot.exercises.filter((ex) => !ex.deletedAt && !curatedIds.has(ex.id)).map((ex) => projectUserExerciseToCatalog(ex, snapshot.exerciseTranslations));
889
+ const catalog = [...curatedCatalog, ...projectedUserExercises];
862
890
  return { snapshot, catalog, profile, fetchedAt: Date.now() };
863
891
  }
864
892
  async function getSnapshot(pat2, keyB642, serverUrl2) {
@@ -1437,7 +1465,7 @@ function registerToolGetExerciseCatalog(server2, cfg) {
1437
1465
  "get_exercise_catalog",
1438
1466
  {
1439
1467
  title: "Get Exercise Catalog",
1440
- description: 'Return the full exercise catalog with muscle groups, equipment, and optional localized names. Provide `lang` (e.g. "de", "fr") to add a `localizedName` field (falls back to `nameEn` when no translation exists). Use `muscleGroups[].key` with `get_stats { by: "muscle" }` to query aggregates by muscle group.',
1468
+ description: 'Return the full exercise catalog with muscle groups, equipment, and optional localized names. Provide `lang` (e.g. "de", "fr") to add a `localizedName` field (falls back to `nameEn` when no translation exists). Use `muscleGroups[].key` with `get_stats { by: "muscle" }` to query aggregates by muscle group. The result includes both curated catalog entries AND the user\'s own custom exercises \u2014 check `origin` ("CATALOG" vs "CUSTOM") to tell them apart. A "CUSTOM" entry carries no muscle-group, equipment or capability-axis rating, so it never contributes to a weighted evaluation (muscle balance, capability balance) \u2014 treat that absence as "not rated", never as a real zero.',
1441
1469
  inputSchema: GetExerciseCatalogSchema,
1442
1470
  annotations: { readOnlyHint: true }
1443
1471
  },
@@ -2534,7 +2562,7 @@ function findCatalogMatch(proposedName, catalog) {
2534
2562
  const key = normalizeExerciseName(proposedName);
2535
2563
  if (!key) return void 0;
2536
2564
  return catalog.find(
2537
- (ex) => normalizeExerciseName(ex.nameEn) === key || ex.translations.some((t) => normalizeExerciseName(t.name) === key)
2565
+ (ex) => ex.origin === "CATALOG" && (normalizeExerciseName(ex.nameEn) === key || ex.translations.some((t) => normalizeExerciseName(t.name) === key))
2538
2566
  );
2539
2567
  }
2540
2568
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gehlich/calicomp-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Local stdio MCP for CalisthenicsCompanion",
5
5
  "type": "module",
6
6
  "license": "MIT",