@davidwoods/skylight-mcp 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/lib.d.ts +142 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +245 -0
- package/dist/lib.js.map +1 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -590,6 +590,26 @@ Needs Skylight Plus. Local server only.
|
|
|
590
590
|
|------|--------|-------------|
|
|
591
591
|
| `get_albums` | read | Photo albums |
|
|
592
592
|
|
|
593
|
+
## Use as a library (experimental)
|
|
594
|
+
|
|
595
|
+
The package root is a small read-only library for apps such as a family display. It is **experimental**: breaking changes are allowed in minor versions, and are documented in the changelog, until a real app has used it for a while. The CLI and the MCP servers are unchanged (`skylight-mcp` runs `dist/index.js`).
|
|
596
|
+
|
|
597
|
+
```ts
|
|
598
|
+
import { createSkylight } from "@davidwoods/skylight-mcp";
|
|
599
|
+
|
|
600
|
+
const skylight = createSkylight({
|
|
601
|
+
frameId: "your_frame_id",
|
|
602
|
+
timezone: "America/Los_Angeles",
|
|
603
|
+
credential: yourCredentialStore, // or { token: "..." } for a fixed token that does not refresh
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
const events = await skylight.calendar.events({ from: "2026-11-09", to: "2026-11-15" });
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
Read methods only: `calendar.events`, `calendar.sources`, `profiles.list`, `chores.list`, `meals.sittings`, `meals.recipes`, `meals.categories`, `lists.list`, `lists.items`. They return plain objects, never raw Skylight records: no emails, event uids, calendar or account ids, or subscription feed addresses (a feed shows only its host; an email-shaped calendar label is replaced). Event ids are opaque: a repeating event's occurrence ids change after a time edit, so do not store or compare them.
|
|
610
|
+
|
|
611
|
+
What is not there, on purpose: writes, deletes, messages, source-calendar and feed management, login, and any function that takes a URL or a feed address. There is no host or fetch option; the API host is fixed in code and an unknown option is refused. Only the package root is importable (deep imports such as `dist/api/client.js` fail). The library holds a live sign-in, so it stops accidents and token leaks, not a malicious importer. Not verified against the live API yet.
|
|
612
|
+
|
|
593
613
|
## Skylight API calls used
|
|
594
614
|
|
|
595
615
|
All calls go to `https://app.ourskylight.com/api` (pinned in code). `{f}` is the frame ID. "Live" means run against a real frame by this project; everything else came from upstream and has not been re-run. Messages and meal edit/delete send `Skylight-Api-Version: 2026-10-15`, the version the web app sends; other calls use the client default.
|
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library entry point (experimental). The only module an importer may load:
|
|
3
|
+
* package.json `exports` lists this file and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* import { createSkylight } from "@davidwoods/skylight-mcp";
|
|
6
|
+
*
|
|
7
|
+
* Guarantees, each covered by tests/library-*.test.ts from the importer's side:
|
|
8
|
+
* - The API host is pinned in code. There is no host, base URL or fetch option; an
|
|
9
|
+
* unknown option is refused, not ignored.
|
|
10
|
+
* - Returned objects are plain JSON-safe DTOs. They never carry emails, event uids,
|
|
11
|
+
* calendar or account ids, or a subscription feed address.
|
|
12
|
+
* - No function takes a URL or a feed address (so the feed-address helper is not exported either).
|
|
13
|
+
* - Importing this module starts nothing and reads nothing from process.argv.
|
|
14
|
+
*
|
|
15
|
+
* Phase 1 is read-only. Writes, deletes, messages, source-calendar management and
|
|
16
|
+
* login are deliberately not exported.
|
|
17
|
+
*
|
|
18
|
+
* Honest limit: an importer holds a live bearer token and can do whatever the token
|
|
19
|
+
* allows. These guards stop accidents and token leakage, not a malicious importer.
|
|
20
|
+
*/
|
|
21
|
+
import type { CredentialStore } from "./api/credential-types.js";
|
|
22
|
+
export type { CredentialStore };
|
|
23
|
+
/** Where the sign-in comes from: a store that refreshes it, or a fixed token that does not. */
|
|
24
|
+
export type SkylightCredential = CredentialStore | {
|
|
25
|
+
token: string;
|
|
26
|
+
};
|
|
27
|
+
export interface CreateSkylightOptions {
|
|
28
|
+
/** Household id: digits, from the Skylight web app's URLs. */
|
|
29
|
+
frameId: string;
|
|
30
|
+
/** IANA zone, for example "America/Los_Angeles". */
|
|
31
|
+
timezone: string;
|
|
32
|
+
credential: SkylightCredential;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An event. `id` is opaque: a repeating event's occurrence ids embed the start time and
|
|
36
|
+
* CHANGE after a time edit, so never store or compare ids across edits. `seriesId` is the
|
|
37
|
+
* series number for occurrences of a repeating event, else null.
|
|
38
|
+
*/
|
|
39
|
+
export interface EventDto {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
/** ISO 8601 with offset, or a local-midnight stamp for all-day events. */
|
|
43
|
+
start: string | null;
|
|
44
|
+
end: string | null;
|
|
45
|
+
allDay: boolean;
|
|
46
|
+
location: string | null;
|
|
47
|
+
profiles: string[];
|
|
48
|
+
labels: string[];
|
|
49
|
+
recurring: boolean;
|
|
50
|
+
seriesId: string | null;
|
|
51
|
+
editable: boolean;
|
|
52
|
+
source: "skylight" | "google" | "feed" | "other";
|
|
53
|
+
}
|
|
54
|
+
export interface SourceDto {
|
|
55
|
+
id: string;
|
|
56
|
+
/** An email-shaped label is replaced, so no address leaves the library. */
|
|
57
|
+
label: string;
|
|
58
|
+
kind: "google" | "feed" | "other";
|
|
59
|
+
role: string | null;
|
|
60
|
+
editable: boolean;
|
|
61
|
+
/** Scheme and host of a subscription feed only; null otherwise. */
|
|
62
|
+
host: string | null;
|
|
63
|
+
}
|
|
64
|
+
export interface ProfileDto {
|
|
65
|
+
id: string;
|
|
66
|
+
label: string;
|
|
67
|
+
color: string | null;
|
|
68
|
+
}
|
|
69
|
+
export interface ChoreDto {
|
|
70
|
+
id: string;
|
|
71
|
+
title: string;
|
|
72
|
+
date: string | null;
|
|
73
|
+
time: string | null;
|
|
74
|
+
status: string;
|
|
75
|
+
done: boolean;
|
|
76
|
+
profile: string | null;
|
|
77
|
+
upForGrabs: boolean;
|
|
78
|
+
routine: boolean;
|
|
79
|
+
recurring: boolean;
|
|
80
|
+
points: number | null;
|
|
81
|
+
}
|
|
82
|
+
export interface MealSittingDto {
|
|
83
|
+
id: string;
|
|
84
|
+
dates: string[];
|
|
85
|
+
title: string | null;
|
|
86
|
+
category: string | null;
|
|
87
|
+
recipeId: string | null;
|
|
88
|
+
recurring: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface RecipeDto {
|
|
91
|
+
id: string;
|
|
92
|
+
title: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface MealCategoryDto {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ListDto {
|
|
99
|
+
id: string;
|
|
100
|
+
label: string;
|
|
101
|
+
kind: string;
|
|
102
|
+
color: string | null;
|
|
103
|
+
}
|
|
104
|
+
export interface ListItemDto {
|
|
105
|
+
id: string;
|
|
106
|
+
label: string;
|
|
107
|
+
done: boolean;
|
|
108
|
+
section: string | null;
|
|
109
|
+
}
|
|
110
|
+
export interface Skylight {
|
|
111
|
+
calendar: {
|
|
112
|
+
/** Events from `from` to `to`, both YYYY-MM-DD, both days included. */
|
|
113
|
+
events(range: {
|
|
114
|
+
from: string;
|
|
115
|
+
to: string;
|
|
116
|
+
}): Promise<EventDto[]>;
|
|
117
|
+
sources(): Promise<SourceDto[]>;
|
|
118
|
+
};
|
|
119
|
+
profiles: {
|
|
120
|
+
list(): Promise<ProfileDto[]>;
|
|
121
|
+
};
|
|
122
|
+
chores: {
|
|
123
|
+
list(options: {
|
|
124
|
+
date: string;
|
|
125
|
+
profile?: string;
|
|
126
|
+
}): Promise<ChoreDto[]>;
|
|
127
|
+
};
|
|
128
|
+
meals: {
|
|
129
|
+
sittings(range: {
|
|
130
|
+
from: string;
|
|
131
|
+
to: string;
|
|
132
|
+
}): Promise<MealSittingDto[]>;
|
|
133
|
+
recipes(): Promise<RecipeDto[]>;
|
|
134
|
+
categories(): Promise<MealCategoryDto[]>;
|
|
135
|
+
};
|
|
136
|
+
lists: {
|
|
137
|
+
list(): Promise<ListDto[]>;
|
|
138
|
+
items(listId: string): Promise<ListItemDto[]>;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export declare function createSkylight(options: CreateSkylightOptions): Skylight;
|
|
142
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAYjE,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,+FAA+F;AAC/F,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,kBAAkB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CAClD;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,M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AAW,EAAE,CAAC,CAAC;KAC/C,CAAC;CACH;AAoID,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CA8FvE"}
|
package/dist/lib.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library entry point (experimental). The only module an importer may load:
|
|
3
|
+
* package.json `exports` lists this file and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* import { createSkylight } from "@davidwoods/skylight-mcp";
|
|
6
|
+
*
|
|
7
|
+
* Guarantees, each covered by tests/library-*.test.ts from the importer's side:
|
|
8
|
+
* - The API host is pinned in code. There is no host, base URL or fetch option; an
|
|
9
|
+
* unknown option is refused, not ignored.
|
|
10
|
+
* - Returned objects are plain JSON-safe DTOs. They never carry emails, event uids,
|
|
11
|
+
* calendar or account ids, or a subscription feed address.
|
|
12
|
+
* - No function takes a URL or a feed address (so the feed-address helper is not exported either).
|
|
13
|
+
* - Importing this module starts nothing and reads nothing from process.argv.
|
|
14
|
+
*
|
|
15
|
+
* Phase 1 is read-only. Writes, deletes, messages, source-calendar management and
|
|
16
|
+
* login are deliberately not exported.
|
|
17
|
+
*
|
|
18
|
+
* Honest limit: an importer holds a live bearer token and can do whatever the token
|
|
19
|
+
* allows. These guards stop accidents and token leakage, not a malicious importer.
|
|
20
|
+
*/
|
|
21
|
+
import { SkylightClient } from "./api/client.js";
|
|
22
|
+
import { runWithContext } from "./context.js";
|
|
23
|
+
import { getCalendarEvents, getSourceCalendars } from "./api/endpoints/calendar.js";
|
|
24
|
+
import { getCategories } from "./api/endpoints/categories.js";
|
|
25
|
+
import { getChores } from "./api/endpoints/chores.js";
|
|
26
|
+
import { getListWithItems, getLists } from "./api/endpoints/lists.js";
|
|
27
|
+
import { getMealCategories, getMealSittings, getRecipes, mealCategoryName } from "./api/endpoints/meals.js";
|
|
28
|
+
import { isChoreDone } from "./api/endpoints/chores.js";
|
|
29
|
+
import { addDays } from "./utils/schedule.js";
|
|
30
|
+
import { redactFeedUrl } from "./utils/redact.js";
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Validation: refuse, never ignore.
|
|
33
|
+
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
34
|
+
const EMAIL = /[^\s@<>()"',;:]+@[^\s@<>()"',;:]+\.[^\s@<>()"',;:]+/;
|
|
35
|
+
const OPTION_KEYS = new Set(["frameId", "timezone", "credential"]);
|
|
36
|
+
function assertDate(value, name) {
|
|
37
|
+
if (typeof value !== "string" || !DATE.test(value) || Number.isNaN(Date.parse(`${value}T00:00:00Z`))) {
|
|
38
|
+
throw new Error(`${name} must be a date, YYYY-MM-DD.`);
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function assertRange(range) {
|
|
43
|
+
const from = assertDate(range?.from, "from");
|
|
44
|
+
const to = assertDate(range?.to, "to");
|
|
45
|
+
if (to < from)
|
|
46
|
+
throw new Error("to is before from.");
|
|
47
|
+
return { from, to };
|
|
48
|
+
}
|
|
49
|
+
function isStore(value) {
|
|
50
|
+
const v = value;
|
|
51
|
+
return !!v && typeof v === "object" && typeof v.read === "function" && typeof v.write === "function" && typeof v.delete === "function";
|
|
52
|
+
}
|
|
53
|
+
function validateOptions(options) {
|
|
54
|
+
if (!options || typeof options !== "object")
|
|
55
|
+
throw new Error("createSkylight needs an options object.");
|
|
56
|
+
for (const key of Object.keys(options)) {
|
|
57
|
+
if (!OPTION_KEYS.has(key))
|
|
58
|
+
throw new Error(`Unknown option "${key}". The API host is fixed and cannot be configured.`);
|
|
59
|
+
}
|
|
60
|
+
const { frameId, timezone, credential } = options;
|
|
61
|
+
if (typeof frameId !== "string" || !/^\d+$/.test(frameId))
|
|
62
|
+
throw new Error("frameId must be the household's numeric id.");
|
|
63
|
+
if (typeof timezone !== "string")
|
|
64
|
+
throw new Error("timezone must be an IANA zone name.");
|
|
65
|
+
try {
|
|
66
|
+
new Intl.DateTimeFormat("en-US", { timeZone: timezone });
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new Error("timezone must be an IANA zone name.");
|
|
70
|
+
}
|
|
71
|
+
if (isStore(credential)) {
|
|
72
|
+
return { config: { frameId, timezone, authType: "bearer" }, store: credential };
|
|
73
|
+
}
|
|
74
|
+
const keys = credential && typeof credential === "object" ? Object.keys(credential) : [];
|
|
75
|
+
if (keys.length === 1 && keys[0] === "token" && typeof credential.token === "string" && credential.token) {
|
|
76
|
+
return { config: { frameId, timezone, authType: "bearer", token: credential.token }, store: null };
|
|
77
|
+
}
|
|
78
|
+
throw new Error("credential must be a credential store or { token }.");
|
|
79
|
+
}
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Projection: raw JSON:API in, DTOs out. Every field is named here; nothing is spread.
|
|
82
|
+
function categoryIds(event) {
|
|
83
|
+
const ids = new Set();
|
|
84
|
+
for (const ref of event.relationships?.categories?.data ?? [])
|
|
85
|
+
if (ref?.id)
|
|
86
|
+
ids.add(String(ref.id));
|
|
87
|
+
const single = event.relationships?.category?.data?.id;
|
|
88
|
+
if (single)
|
|
89
|
+
ids.add(String(single));
|
|
90
|
+
const fromAttrs = event.attributes.category_ids;
|
|
91
|
+
if (Array.isArray(fromAttrs))
|
|
92
|
+
for (const id of fromAttrs)
|
|
93
|
+
ids.add(String(id));
|
|
94
|
+
return [...ids];
|
|
95
|
+
}
|
|
96
|
+
const str = (v) => (typeof v === "string" && v !== "" ? v : null);
|
|
97
|
+
function toEvent(event, categories) {
|
|
98
|
+
const a = event.attributes;
|
|
99
|
+
const profiles = [];
|
|
100
|
+
const labels = [];
|
|
101
|
+
for (const id of categoryIds(event)) {
|
|
102
|
+
const c = categories.get(id);
|
|
103
|
+
const label = str(c?.attributes.label);
|
|
104
|
+
if (!c || !label)
|
|
105
|
+
continue;
|
|
106
|
+
(c.attributes.linked_to_profile === true ? profiles : labels).push(label);
|
|
107
|
+
}
|
|
108
|
+
const id = String(event.id);
|
|
109
|
+
const composite = /^(\d+)-\d+$/.exec(id);
|
|
110
|
+
const source = a.source === "skylight" ? "skylight" : a.source === "google" ? "google" : a.source === "ics_link" ? "feed" : "other";
|
|
111
|
+
return {
|
|
112
|
+
id,
|
|
113
|
+
title: str(a.summary) ?? "",
|
|
114
|
+
start: str(a.starts_at),
|
|
115
|
+
end: str(a.ends_at),
|
|
116
|
+
allDay: a.all_day === true,
|
|
117
|
+
location: str(a.location),
|
|
118
|
+
profiles,
|
|
119
|
+
labels,
|
|
120
|
+
recurring: a.recurring === true || a.recurring_config === true,
|
|
121
|
+
seriesId: composite ? composite[1] : null,
|
|
122
|
+
editable: a.editable !== false,
|
|
123
|
+
source,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function toSource(cal) {
|
|
127
|
+
const a = cal.attributes;
|
|
128
|
+
const kind = a.kind === "gmail" ? "google" : a.kind === "webcal" ? "feed" : "other";
|
|
129
|
+
let label = str(a.label) ?? "";
|
|
130
|
+
if (EMAIL.test(label))
|
|
131
|
+
label = kind === "google" ? "Google calendar" : "Calendar";
|
|
132
|
+
const sourceId = str(a.source_id);
|
|
133
|
+
const hostMatch = kind === "feed" && sourceId ? /^([a-z]+:\/\/[^/]+)/i.exec(redactFeedUrl(sourceId)) : null;
|
|
134
|
+
return {
|
|
135
|
+
id: String(cal.id),
|
|
136
|
+
label,
|
|
137
|
+
kind,
|
|
138
|
+
role: str(a.role),
|
|
139
|
+
editable: a.editable === true,
|
|
140
|
+
host: hostMatch ? hostMatch[1] : null,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function toChore(chore, names) {
|
|
144
|
+
const a = chore.attributes;
|
|
145
|
+
const cid = chore.relationships?.category?.data?.id;
|
|
146
|
+
return {
|
|
147
|
+
id: String(chore.id),
|
|
148
|
+
title: str(a.summary) ?? "",
|
|
149
|
+
date: str(a.start),
|
|
150
|
+
time: str(a.start_time),
|
|
151
|
+
status: str(a.status) ?? "",
|
|
152
|
+
done: isChoreDone(a.status),
|
|
153
|
+
profile: cid ? (names.get(String(cid)) ?? null) : null,
|
|
154
|
+
upForGrabs: a.up_for_grabs === true,
|
|
155
|
+
routine: a.routine === true,
|
|
156
|
+
recurring: a.recurring === true,
|
|
157
|
+
points: typeof a.reward_points === "number" ? a.reward_points : null,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
export function createSkylight(options) {
|
|
162
|
+
const { config, store } = validateOptions(options);
|
|
163
|
+
const client = new SkylightClient(config, store);
|
|
164
|
+
const run = (fn) => runWithContext({ client, config }, fn);
|
|
165
|
+
return {
|
|
166
|
+
calendar: {
|
|
167
|
+
events: (range) => run(async () => {
|
|
168
|
+
const { from, to } = assertRange(range);
|
|
169
|
+
const [events, categories] = await Promise.all([
|
|
170
|
+
getCalendarEvents({ dateMin: from, dateMax: to, timezone: config.timezone }),
|
|
171
|
+
getCategories(),
|
|
172
|
+
]);
|
|
173
|
+
const byId = new Map(categories.map((c) => [String(c.id), c]));
|
|
174
|
+
return events.map((e) => toEvent(e, byId));
|
|
175
|
+
}),
|
|
176
|
+
sources: () => run(async () => (await getSourceCalendars()).map(toSource)),
|
|
177
|
+
},
|
|
178
|
+
profiles: {
|
|
179
|
+
list: () => run(async () => (await getCategories())
|
|
180
|
+
.filter((c) => c.attributes.linked_to_profile === true && str(c.attributes.label))
|
|
181
|
+
.map((c) => ({ id: String(c.id), label: c.attributes.label, color: str(c.attributes.color) }))),
|
|
182
|
+
},
|
|
183
|
+
chores: {
|
|
184
|
+
list: (opts) => run(async () => {
|
|
185
|
+
const date = assertDate(opts?.date, "date");
|
|
186
|
+
const result = await getChores({ after: date, before: date, includeLate: false, includeUpForGrabs: true });
|
|
187
|
+
const names = new Map(result.categories.map((c) => [String(c.id), c.attributes.label ?? ""]));
|
|
188
|
+
let chores = result.chores.map((c) => toChore(c, names));
|
|
189
|
+
if (opts.profile !== undefined) {
|
|
190
|
+
if (typeof opts.profile !== "string")
|
|
191
|
+
throw new Error("profile must be a profile name.");
|
|
192
|
+
const wanted = opts.profile.trim().toLowerCase();
|
|
193
|
+
chores = chores.filter((c) => c.profile?.toLowerCase() === wanted);
|
|
194
|
+
}
|
|
195
|
+
return chores;
|
|
196
|
+
}),
|
|
197
|
+
},
|
|
198
|
+
meals: {
|
|
199
|
+
sittings: (range) => run(async () => {
|
|
200
|
+
const { from, to } = assertRange(range);
|
|
201
|
+
const [sittings, categories] = await Promise.all([
|
|
202
|
+
getMealSittings({ dateMin: from, dateMax: addDays(to, 1) }),
|
|
203
|
+
getMealCategories(),
|
|
204
|
+
]);
|
|
205
|
+
const names = new Map(categories.map((c) => [String(c.id), mealCategoryName(c)]));
|
|
206
|
+
return sittings.map((s) => {
|
|
207
|
+
const a = s.attributes;
|
|
208
|
+
const dates = a.instances?.length ? a.instances : a.date ? [a.date] : [];
|
|
209
|
+
const cid = s.relationships?.meal_category?.data?.id;
|
|
210
|
+
const rid = s.relationships?.meal_recipe?.data?.id;
|
|
211
|
+
return {
|
|
212
|
+
id: String(s.id),
|
|
213
|
+
dates: dates.filter((d) => DATE.test(d) && d >= from && d <= to),
|
|
214
|
+
title: str(a.summary),
|
|
215
|
+
category: cid ? (names.get(String(cid)) ?? null) : null,
|
|
216
|
+
recipeId: rid ? String(rid) : null,
|
|
217
|
+
recurring: a.recurring === true || Boolean(a.rrule),
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
}),
|
|
221
|
+
recipes: () => run(async () => (await getRecipes()).map((r) => ({ id: String(r.id), title: str(r.attributes.summary) }))),
|
|
222
|
+
categories: () => run(async () => (await getMealCategories()).map((c) => ({ id: String(c.id), name: mealCategoryName(c) }))),
|
|
223
|
+
},
|
|
224
|
+
lists: {
|
|
225
|
+
list: () => run(async () => (await getLists()).map((l) => ({
|
|
226
|
+
id: String(l.id),
|
|
227
|
+
label: str(l.attributes.label) ?? "",
|
|
228
|
+
kind: str(l.attributes.kind) ?? "",
|
|
229
|
+
color: str(l.attributes.color),
|
|
230
|
+
}))),
|
|
231
|
+
items: (listId) => run(async () => {
|
|
232
|
+
if (typeof listId !== "string" || !/^\d+$/.test(listId))
|
|
233
|
+
throw new Error("listId must be a numeric list id.");
|
|
234
|
+
const { items } = await getListWithItems(listId);
|
|
235
|
+
return items.map((i) => ({
|
|
236
|
+
id: String(i.id),
|
|
237
|
+
label: str(i.attributes.label) ?? "",
|
|
238
|
+
done: i.attributes.status === "completed",
|
|
239
|
+
section: str(i.attributes.section),
|
|
240
|
+
}));
|
|
241
|
+
}),
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=lib.js.map
|
package/dist/lib.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAwHlD,8EAA8E;AAC9E,oCAAoC;AAEpC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,KAAK,GAAG,qDAAqD,CAA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|
{
|
|
2
2
|
"name": "@davidwoods/skylight-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Unofficial MCP server for Skylight Calendar: local (stdio) and hosted (Cloudflare Workers), with browser-paste OAuth sign-in and an encrypted credential store",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/lib.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"skylight-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
@@ -74,5 +74,13 @@
|
|
|
74
74
|
"homepage": "https://github.com/dwooods/skylight-mcp#readme",
|
|
75
75
|
"bugs": {
|
|
76
76
|
"url": "https://github.com/dwooods/skylight-mcp/issues"
|
|
77
|
+
},
|
|
78
|
+
"types": "dist/lib.d.ts",
|
|
79
|
+
"exports": {
|
|
80
|
+
".": {
|
|
81
|
+
"types": "./dist/lib.d.ts",
|
|
82
|
+
"default": "./dist/lib.js"
|
|
83
|
+
},
|
|
84
|
+
"./package.json": "./package.json"
|
|
77
85
|
}
|
|
78
86
|
}
|