@impetik/xeer-mcp 0.2.10 → 0.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impetik/xeer-mcp",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server for Xeer: the scaffold, check, dev, build, and deploy loop as agent tools.",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@modelcontextprotocol/sdk": "^1.29.0",
49
49
  "zod": "^4.0.10",
50
- "@impetik/xeer": "0.2.10"
50
+ "@impetik/xeer": "0.2.12"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^24.1.0"
@@ -18,3 +18,4 @@ export * from './admin.js';
18
18
  export * from './admin-sql.js';
19
19
  export * from './network-policy.js';
20
20
  export * from './review.js';
21
+ export * from './template.js';
@@ -18,3 +18,4 @@ export * from './admin.js';
18
18
  export * from './admin-sql.js';
19
19
  export * from './network-policy.js';
20
20
  export * from './review.js';
21
+ export * from './template.js';
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ export declare const TEMPLATE_FORMAT: "xeer.template.v0";
3
+ export declare const TEMPLATE_MANIFEST_SCHEMA_URL: "https://docs.xeer.run/template-v0.schema.json";
4
+ export declare const templateManifestSchema: z.ZodObject<{
5
+ $schema: z.ZodOptional<z.ZodString>;
6
+ format: z.ZodLiteral<"xeer.template.v0">;
7
+ title: z.ZodString;
8
+ description: z.ZodString;
9
+ category: z.ZodString;
10
+ tags: z.ZodArray<z.ZodString>;
11
+ keyHighlights: z.ZodArray<z.ZodString>;
12
+ screenshots: z.ZodArray<z.ZodObject<{
13
+ path: z.ZodString;
14
+ alt: z.ZodString;
15
+ }, z.core.$strict>>;
16
+ author: z.ZodObject<{
17
+ name: z.ZodString;
18
+ url: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strict>;
20
+ capabilities: z.ZodArray<z.ZodEnum<{
21
+ database: "database";
22
+ storage: "storage";
23
+ }>>;
24
+ requiredSecrets: z.ZodArray<z.ZodObject<{
25
+ name: z.ZodString;
26
+ description: z.ZodString;
27
+ }, z.core.$strict>>;
28
+ previewAppId: z.ZodString;
29
+ }, z.core.$strict>;
30
+ export type TemplateManifestV0 = z.infer<typeof templateManifestSchema>;
31
+ export declare const templateManifestJsonSchema: Readonly<Record<string, unknown>>;
32
+ export declare function parseTemplateManifest(value: unknown): TemplateManifestV0;
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ import { CAPABILITIES } from './types.js';
3
+ export const TEMPLATE_FORMAT = 'xeer.template.v0';
4
+ export const TEMPLATE_MANIFEST_SCHEMA_URL = 'https://docs.xeer.run/template-v0.schema.json';
5
+ const trimmed = (maximum) => z.string().min(1).max(maximum)
6
+ .refine((value) => value === value.trim(), 'must not have leading or trailing whitespace')
7
+ .refine((value) => !/[\u0000-\u001f\u007f]/u.test(value), 'must not contain control characters');
8
+ const slug = z.string().regex(/^[a-z][a-z0-9-]{1,62}$/u, 'must be a lowercase slug between 2 and 63 characters');
9
+ const environmentName = z.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/u, 'must be an uppercase environment variable name');
10
+ const appId = z.string().regex(/^app_[A-Za-z0-9_-]{8,96}$/u, 'must be a valid Xeer appId');
11
+ const screenshotPath = z.string().regex(/^screenshots\/(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*[A-Za-z0-9][A-Za-z0-9._-]*\.(?:avif|jpe?g|png|webp)$/u, 'must be a repository-local AVIF, JPEG, PNG, or WebP path under screenshots/');
12
+ const authorSchema = z.strictObject({
13
+ name: trimmed(80),
14
+ url: z.string().url().optional(),
15
+ });
16
+ const requiredSecretSchema = z.strictObject({
17
+ name: environmentName,
18
+ description: trimmed(200),
19
+ });
20
+ const screenshotSchema = z.strictObject({
21
+ path: screenshotPath,
22
+ alt: trimmed(200),
23
+ });
24
+ export const templateManifestSchema = z.strictObject({
25
+ $schema: z.string().url().optional(),
26
+ format: z.literal(TEMPLATE_FORMAT),
27
+ title: trimmed(120),
28
+ description: trimmed(300),
29
+ category: slug,
30
+ tags: z.array(trimmed(40)).min(1).max(16),
31
+ keyHighlights: z.array(trimmed(120)).min(1).max(8),
32
+ screenshots: z.array(screenshotSchema).min(1).max(8),
33
+ author: authorSchema,
34
+ capabilities: z.array(z.enum(CAPABILITIES)).max(CAPABILITIES.length),
35
+ requiredSecrets: z.array(requiredSecretSchema).max(16),
36
+ previewAppId: appId,
37
+ }).superRefine((manifest, ctx) => {
38
+ const unique = (values, path, label) => {
39
+ const seen = new Set();
40
+ for (const [index, value] of values.entries()) {
41
+ const normalized = value.toLocaleLowerCase('en-US');
42
+ if (seen.has(normalized)) {
43
+ ctx.addIssue({ code: 'custom', path: [path, index], message: `${label} is declared twice` });
44
+ }
45
+ seen.add(normalized);
46
+ }
47
+ };
48
+ unique(manifest.tags, 'tags', 'tag');
49
+ unique(manifest.keyHighlights, 'keyHighlights', 'highlight');
50
+ unique(manifest.screenshots.map((screenshot) => screenshot.path), 'screenshots', 'screenshot');
51
+ unique(manifest.capabilities, 'capabilities', 'capability');
52
+ unique(manifest.requiredSecrets.map((secret) => secret.name), 'requiredSecrets', 'secret');
53
+ });
54
+ const generatedTemplateManifestJsonSchema = z.toJSONSchema(templateManifestSchema);
55
+ const generatedProperties = generatedTemplateManifestJsonSchema.properties;
56
+ export const templateManifestJsonSchema = Object.freeze({
57
+ ...generatedTemplateManifestJsonSchema,
58
+ $id: TEMPLATE_MANIFEST_SCHEMA_URL,
59
+ title: 'Xeer template manifest v0',
60
+ description: 'Authored metadata for one application in the Xeer template catalog.',
61
+ properties: {
62
+ ...generatedProperties,
63
+ $schema: {
64
+ ...generatedProperties.$schema,
65
+ description: 'Editor schema hint. Xeer does not fetch this URL during validation.',
66
+ },
67
+ format: {
68
+ ...generatedProperties.format,
69
+ description: `Template metadata protocol discriminator; exactly ${TEMPLATE_FORMAT}.`,
70
+ },
71
+ tags: {
72
+ ...generatedProperties.tags,
73
+ uniqueItems: true,
74
+ },
75
+ keyHighlights: {
76
+ ...generatedProperties.keyHighlights,
77
+ uniqueItems: true,
78
+ },
79
+ screenshots: {
80
+ ...generatedProperties.screenshots,
81
+ description: 'Repository-local raster images used by template galleries.',
82
+ uniqueItems: true,
83
+ },
84
+ capabilities: {
85
+ ...generatedProperties.capabilities,
86
+ description: 'Application capabilities, verified against xeer.app.json when the catalog is generated.',
87
+ uniqueItems: true,
88
+ },
89
+ previewAppId: {
90
+ ...generatedProperties.previewAppId,
91
+ description: 'Stable first-party application identity used only for the public live preview.',
92
+ },
93
+ requiredSecrets: {
94
+ ...generatedProperties.requiredSecrets,
95
+ description: 'Secrets a template copy needs before it is usable.',
96
+ },
97
+ },
98
+ });
99
+ export function parseTemplateManifest(value) {
100
+ return templateManifestSchema.parse(value);
101
+ }