Skip to content

Commit 1422393

Browse files
Document singular metadata type naming convention
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/4b4cd0a2-3590-43af-8b11-0e6b59c0e99a Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 256383d commit 1422393

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
3. **Naming Convention:**
1616
- **Configuration Keys (TS Props):** `camelCase` — e.g., `maxLength`, `referenceFilters`, `defaultValue`.
1717
- **Machine Names (Data Values):** `snake_case` — e.g., `name: 'first_name'`, `object: 'project_task'`.
18+
- **Metadata Type Names:** `singular` — e.g., `'agent'`, `'tool'`, `'view'`, `'flow'` (NOT `'agents'`, `'tools'`, `'views'`, `'flows'`). This aligns with the canonical `MetadataTypeSchema` enum in `packages/spec/src/kernel/metadata-plugin.zod.ts`.
19+
- **REST API Endpoints:** `plural` — e.g., `/api/v1/ai/agents`, `/api/v1/ai/conversations` (per REST convention for resource collections).
1820
4. **Namespace Imports:** Use `import { Data, UI, System } from '@objectstack/spec'` or subpath `import { Field } from '@objectstack/spec/data'`. Never use relative paths like `../../packages/spec`.
1921
5. **Best Practice Mandate:**
2022
- Benchmark against industry leaders (Salesforce, ServiceNow, Kubernetes) for structural decisions.

packages/spec/src/kernel/metadata-plugin.zod.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ import { MergeStrategyConfigSchema, CustomizationPolicySchema } from './metadata
5252
* The canonical list of all metadata types managed by the platform.
5353
* Each type maps to a specific Zod schema (e.g., ObjectSchema, ViewSchema).
5454
* Plugins can extend this registry via `contributes.kinds` in the manifest.
55+
*
56+
* ## Naming Convention
57+
* **IMPORTANT:** All metadata type names are in **SINGULAR** form:
58+
* - ✅ Use: `'agent'`, `'tool'`, `'skill'`, `'view'`, `'flow'`, `'action'`
59+
* - ❌ NOT: `'agents'`, `'tools'`, `'skills'`, `'views'`, `'flows'`, `'actions'`
60+
*
61+
* This convention applies to:
62+
* - Protocol definitions (this enum)
63+
* - UI plugin registrations (`metadataTypes`, `metadataIcons`)
64+
* - Metadata service operations
65+
* - File patterns (`*.agent.ts`, `*.tool.ts`)
66+
*
67+
* REST API endpoints continue to use plural forms per REST conventions:
68+
* - `/api/v1/ai/agents`, `/api/v1/ai/conversations`
5569
*/
5670
export const MetadataTypeSchema = z.enum([
5771
// Data Protocol

0 commit comments

Comments
 (0)