Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@
"LICENSE"
],
"dependencies": {
"commander": "^12.0.0",
"chalk": "^5.3.0",
"ajv": "^8.12.0",
"js-yaml": "^4.1.0",
"ajv-formats": "^3.0.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"dotenv": "^16.4.0",
"glob": "^13.0.6"
"glob": "^13.0.6",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"typescript": "^5.4.0",
"@types/node": "^20.11.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.11.0",
"typescript": "^5.4.0",
"vitest": "^1.6.0"
}
}
4 changes: 2 additions & 2 deletions cli/schema/rep-manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"default": false
},
"default": {
"type": "string",
"description": "Default value if the environment variable is not set. Only valid for non-required variables."
"type": ["string", "number", "boolean"],
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
},
"description": {
"type": "string",
Expand Down
62 changes: 61 additions & 1 deletion cli/src/utils/__tests__/manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,38 @@ describe('manifest', () => {
expect(() => validateManifest(manifest)).not.toThrow();
});

it('should accept boolean default values', () => {
const manifest = {
version: '0.1.0',
variables: {
COMING_SOON: {
tier: 'public',
type: 'boolean',
required: false,
default: false,
},
},
};

expect(() => validateManifest(manifest)).not.toThrow();
});

it('should accept number default values', () => {
const manifest = {
version: '0.1.0',
variables: {
MAX_RETRIES: {
tier: 'public',
type: 'number',
required: false,
default: 3,
},
},
};

expect(() => validateManifest(manifest)).not.toThrow();
});

it('should accept settings object', () => {
const manifest = {
version: '0.1.0',
Expand All @@ -172,8 +204,36 @@ describe('manifest', () => {
session_key_ttl: '30s',
},
};

expect(() => validateManifest(manifest)).not.toThrow();
});

it('should validate allowed_origins as URIs', () => {
const manifest = {
version: '0.1.0',
variables: {
API_URL: { tier: 'public' },
},
settings: {
allowed_origins: ['https://app.example.com'],
},
};

expect(() => validateManifest(manifest)).not.toThrow();
});

it('should reject invalid URIs in allowed_origins', () => {
const manifest = {
version: '0.1.0',
variables: {
API_URL: { tier: 'public' },
},
settings: {
allowed_origins: ['not a uri'],
},
};

expect(() => validateManifest(manifest)).toThrow();
});
});
});
4 changes: 3 additions & 1 deletion cli/src/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import * as fs from 'fs';
import * as path from 'path';
import * as yaml from 'js-yaml';
import Ajv, { type ValidateFunction } from 'ajv';
import addFormats from 'ajv-formats';

export interface ManifestVariable {
tier: 'public' | 'sensitive' | 'server';
type?: 'string' | 'url' | 'number' | 'boolean' | 'csv' | 'json' | 'enum';
required?: boolean;
default?: string;
default?: string | number | boolean;
description?: string;
example?: string;
pattern?: string;
Expand Down Expand Up @@ -58,6 +59,7 @@ function getSchemaValidator(): ValidateFunction {
const schema = JSON.parse(schemaContent);

const ajv = new Ajv({ allErrors: true, strict: false });
addFormats(ajv);
schemaValidator = ajv.compile(schema);

return schemaValidator;
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions schema/rep-manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"default": false
},
"default": {
"type": "string",
"description": "Default value if the environment variable is not set. Only valid for non-required variables."
"type": ["string", "number", "boolean"],
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
Comment on lines +41 to +42

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are additional checked-in copies of this schema that still restrict variables.*.default to string (e.g. docs/public/schema/rep-manifest.schema.json and the docs table in docs/src/content/docs/reference/manifest-schema.mdx). As-is, the docs site will keep publishing/validating the old schema even though schema/ and cli/schema/ were updated. Please update/remove those copies or introduce a single-source sync step so all published schemas stay consistent.

Suggested change
"type": ["string", "number", "boolean"],
"description": "Default value if the environment variable is not set. Only valid for non-required variables. Non-string values are coerced to strings."
"type": "string",
"description": "Default value if the environment variable is not set. Only valid for non-required variables."

Copilot uses AI. Check for mistakes.
},
"description": {
"type": "string",
Expand Down
Loading