clawsouls 0.3.0 → 0.3.1

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.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawsouls",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI for ClawSouls — AI agent persona sharing platform",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,24 +0,0 @@
1
- export interface SoulMeta {
2
- name: string;
3
- owner?: string;
4
- fullName?: string;
5
- displayName: string;
6
- version: string;
7
- description: string;
8
- category: string;
9
- tags: string[];
10
- }
11
- export declare class RegistryClient {
12
- private cdn;
13
- private api;
14
- private isLocal;
15
- private _apiCache;
16
- constructor();
17
- private soulApiPath;
18
- getSoulMeta(name: string, owner?: string, version?: string): Promise<SoulMeta>;
19
- private filenameToKey;
20
- downloadFile(name: string, filename: string, owner?: string, version?: string): Promise<string>;
21
- private keyToFilename;
22
- getSoulFiles(name: string, owner?: string, version?: string): Promise<string[]>;
23
- private readFile;
24
- }
@@ -1,143 +0,0 @@
1
- import { existsSync, readFileSync } from 'fs';
2
- import { join } from 'path';
3
- import { getConfig } from '../utils/config.js';
4
- export class RegistryClient {
5
- cdn;
6
- api;
7
- isLocal;
8
- _apiCache = new Map();
9
- constructor() {
10
- const config = getConfig();
11
- this.cdn = config.cdn;
12
- this.api = 'https://clawsouls.ai/api/v1';
13
- this.isLocal = !this.cdn.startsWith('http');
14
- }
15
- soulApiPath(name, owner) {
16
- return owner ? `${this.api}/souls/${owner}/${name}` : `${this.api}/souls/${name}`;
17
- }
18
- async getSoulMeta(name, owner, version) {
19
- try {
20
- const vq = version ? `&version=${version}` : '';
21
- const res = await fetch(`${this.soulApiPath(name, owner)}?files=true${vq}`);
22
- if (res.ok) {
23
- const data = await res.json();
24
- if (data.fileContents?.['soul.json']) {
25
- return JSON.parse(data.fileContents['soul.json']);
26
- }
27
- return {
28
- name: data.name,
29
- owner: data.owner,
30
- fullName: data.fullName,
31
- displayName: data.displayName || data.name,
32
- version: data.version || '1.0.0',
33
- description: data.description || '',
34
- category: data.category || '',
35
- tags: data.tags || [],
36
- };
37
- }
38
- if (version && res.status === 404) {
39
- throw new Error(`Version "${version}" not found for soul "${owner ? `${owner}/` : ''}${name}"`);
40
- }
41
- }
42
- catch (err) {
43
- if (err.message?.includes('not found'))
44
- throw err;
45
- }
46
- const content = await this.readFile(name, 'soul.json');
47
- return JSON.parse(content);
48
- }
49
- filenameToKey(filename) {
50
- const map = {
51
- 'SOUL.md': 'soul',
52
- 'IDENTITY.md': 'identity',
53
- 'AGENTS.md': 'agents',
54
- 'HEARTBEAT.md': 'heartbeat',
55
- 'STYLE.md': 'style',
56
- 'README.md': 'readme',
57
- };
58
- return map[filename] || filename;
59
- }
60
- async downloadFile(name, filename, owner, version) {
61
- const cacheKey = owner ? `${owner}/${name}` : name;
62
- const cached = this._apiCache.get(cacheKey);
63
- if (cached) {
64
- const key = this.filenameToKey(filename);
65
- if (cached[key])
66
- return cached[key];
67
- if (cached[filename])
68
- return cached[filename];
69
- }
70
- try {
71
- const vq = version ? `&version=${version}` : '';
72
- const res = await fetch(`${this.soulApiPath(name, owner)}?files=true${vq}`);
73
- if (res.ok) {
74
- const data = await res.json();
75
- if (data.fileContents) {
76
- const key = this.filenameToKey(filename);
77
- if (data.fileContents[key])
78
- return data.fileContents[key];
79
- if (data.fileContents[filename])
80
- return data.fileContents[filename];
81
- }
82
- }
83
- }
84
- catch { }
85
- return this.readFile(name, filename);
86
- }
87
- keyToFilename(key) {
88
- const map = {
89
- soul: 'SOUL.md',
90
- identity: 'IDENTITY.md',
91
- agents: 'AGENTS.md',
92
- heartbeat: 'HEARTBEAT.md',
93
- style: 'STYLE.md',
94
- readme: 'README.md',
95
- };
96
- return map[key] || key;
97
- }
98
- async getSoulFiles(name, owner, version) {
99
- try {
100
- const vq = version ? `&version=${version}` : '';
101
- const res = await fetch(`${this.soulApiPath(name, owner)}?files=true${vq}`);
102
- if (version && res.status === 404) {
103
- throw new Error(`Version "${version}" not found for soul "${owner ? `${owner}/` : ''}${name}"`);
104
- }
105
- if (res.ok) {
106
- const data = await res.json();
107
- if (data.fileContents) {
108
- const cacheKey = owner ? `${owner}/${name}` : name;
109
- this._apiCache.set(cacheKey, data.fileContents);
110
- return Object.keys(data.fileContents).map(k => this.keyToFilename(k));
111
- }
112
- }
113
- }
114
- catch { }
115
- const meta = await this.getSoulMeta(name, owner);
116
- const files = ['soul.json', 'README.md'];
117
- const fileMap = meta.files || {};
118
- for (const path of Object.values(fileMap)) {
119
- if (typeof path === 'string')
120
- files.push(path);
121
- }
122
- return [...new Set(files)];
123
- }
124
- async readFile(name, filename) {
125
- if (this.isLocal) {
126
- const filePath = join(this.cdn, name, filename);
127
- if (!existsSync(filePath)) {
128
- throw new Error(`Soul "${name}" not found in registry`);
129
- }
130
- return readFileSync(filePath, 'utf-8');
131
- }
132
- const url = `${this.cdn}/${name}/${filename}`;
133
- const res = await fetch(url);
134
- if (!res.ok) {
135
- if (res.status === 404) {
136
- throw new Error(`Soul "${name}" not found in registry`);
137
- }
138
- throw new Error(`Registry error: ${res.status} ${res.statusText}`);
139
- }
140
- return res.text();
141
- }
142
- }
143
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/registry/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAa/C,MAAM,OAAO,cAAc;IACjB,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,OAAO,CAAU;IACjB,SAAS,GAAwC,IAAI,GAAG,EAAE,CAAC;IAEnE;QACE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,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D,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -1,272 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ALLOWED_LICENSES: readonly ["Apache-2.0", "MIT", "BSD-2-Clause", "BSD-3-Clause", "CC-BY-4.0", "CC0-1.0", "ISC", "Unlicense"];
3
- export interface LicenseCheckResult {
4
- ok: boolean;
5
- error?: string;
6
- warning?: string;
7
- }
8
- export declare function checkLicense(license: string): LicenseCheckResult;
9
- export declare const ClawSoulSchemaV01: z.ZodObject<{
10
- name: z.ZodString;
11
- displayName: z.ZodString;
12
- version: z.ZodString;
13
- description: z.ZodString;
14
- author: z.ZodObject<{
15
- name: z.ZodString;
16
- github: z.ZodOptional<z.ZodString>;
17
- }, z.core.$strip>;
18
- license: z.ZodString;
19
- tags: z.ZodArray<z.ZodString>;
20
- category: z.ZodString;
21
- compatibility: z.ZodOptional<z.ZodObject<{
22
- openclaw: z.ZodOptional<z.ZodString>;
23
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
- }, z.core.$strip>>;
25
- files: z.ZodObject<{
26
- soul: z.ZodString;
27
- identity: z.ZodOptional<z.ZodString>;
28
- agents: z.ZodOptional<z.ZodString>;
29
- heartbeat: z.ZodOptional<z.ZodString>;
30
- userTemplate: z.ZodOptional<z.ZodString>;
31
- avatar: z.ZodOptional<z.ZodString>;
32
- }, z.core.$strip>;
33
- repository: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>;
35
- export declare const ClawSoulSchemaV02: z.ZodObject<{
36
- name: z.ZodString;
37
- displayName: z.ZodString;
38
- version: z.ZodString;
39
- description: z.ZodString;
40
- author: z.ZodObject<{
41
- name: z.ZodString;
42
- github: z.ZodOptional<z.ZodString>;
43
- }, z.core.$strip>;
44
- license: z.ZodString;
45
- tags: z.ZodArray<z.ZodString>;
46
- category: z.ZodString;
47
- compatibility: z.ZodOptional<z.ZodObject<{
48
- openclaw: z.ZodOptional<z.ZodString>;
49
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
- }, z.core.$strip>>;
51
- repository: z.ZodOptional<z.ZodString>;
52
- files: z.ZodObject<{
53
- soul: z.ZodString;
54
- identity: z.ZodOptional<z.ZodString>;
55
- agents: z.ZodOptional<z.ZodString>;
56
- heartbeat: z.ZodOptional<z.ZodString>;
57
- style: z.ZodOptional<z.ZodString>;
58
- userTemplate: z.ZodOptional<z.ZodString>;
59
- avatar: z.ZodOptional<z.ZodString>;
60
- }, z.core.$strip>;
61
- examples: z.ZodOptional<z.ZodObject<{
62
- good: z.ZodOptional<z.ZodString>;
63
- bad: z.ZodOptional<z.ZodString>;
64
- }, z.core.$strip>>;
65
- modes: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
- interpolation: z.ZodOptional<z.ZodEnum<{
67
- bold: "bold";
68
- cautious: "cautious";
69
- strict: "strict";
70
- }>>;
71
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
- }, z.core.$strip>;
73
- export declare const ClawSoulSchemaV03: z.ZodObject<{
74
- name: z.ZodString;
75
- displayName: z.ZodString;
76
- version: z.ZodString;
77
- description: z.ZodString;
78
- author: z.ZodObject<{
79
- name: z.ZodString;
80
- github: z.ZodOptional<z.ZodString>;
81
- }, z.core.$strip>;
82
- license: z.ZodString;
83
- tags: z.ZodArray<z.ZodString>;
84
- category: z.ZodString;
85
- compatibility: z.ZodOptional<z.ZodObject<{
86
- openclaw: z.ZodOptional<z.ZodString>;
87
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
- }, z.core.$strip>>;
89
- repository: z.ZodOptional<z.ZodString>;
90
- files: z.ZodObject<{
91
- soul: z.ZodString;
92
- identity: z.ZodOptional<z.ZodString>;
93
- agents: z.ZodOptional<z.ZodString>;
94
- heartbeat: z.ZodOptional<z.ZodString>;
95
- style: z.ZodOptional<z.ZodString>;
96
- userTemplate: z.ZodOptional<z.ZodString>;
97
- avatar: z.ZodOptional<z.ZodString>;
98
- }, z.core.$strip>;
99
- examples: z.ZodOptional<z.ZodObject<{
100
- good: z.ZodOptional<z.ZodString>;
101
- bad: z.ZodOptional<z.ZodString>;
102
- }, z.core.$strip>>;
103
- modes: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
- interpolation: z.ZodOptional<z.ZodEnum<{
105
- bold: "bold";
106
- cautious: "cautious";
107
- strict: "strict";
108
- }>>;
109
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
- specVersion: z.ZodOptional<z.ZodEnum<{
111
- 0.1: "0.1";
112
- 0.2: "0.2";
113
- 0.3: "0.3";
114
- }>>;
115
- }, z.core.$strip>;
116
- export declare const SPEC_VERSIONS: {
117
- readonly '0.1': z.ZodObject<{
118
- name: z.ZodString;
119
- displayName: z.ZodString;
120
- version: z.ZodString;
121
- description: z.ZodString;
122
- author: z.ZodObject<{
123
- name: z.ZodString;
124
- github: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strip>;
126
- license: z.ZodString;
127
- tags: z.ZodArray<z.ZodString>;
128
- category: z.ZodString;
129
- compatibility: z.ZodOptional<z.ZodObject<{
130
- openclaw: z.ZodOptional<z.ZodString>;
131
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
- }, z.core.$strip>>;
133
- files: z.ZodObject<{
134
- soul: z.ZodString;
135
- identity: z.ZodOptional<z.ZodString>;
136
- agents: z.ZodOptional<z.ZodString>;
137
- heartbeat: z.ZodOptional<z.ZodString>;
138
- userTemplate: z.ZodOptional<z.ZodString>;
139
- avatar: z.ZodOptional<z.ZodString>;
140
- }, z.core.$strip>;
141
- repository: z.ZodOptional<z.ZodString>;
142
- }, z.core.$strip>;
143
- readonly '0.2': z.ZodObject<{
144
- name: z.ZodString;
145
- displayName: z.ZodString;
146
- version: z.ZodString;
147
- description: z.ZodString;
148
- author: z.ZodObject<{
149
- name: z.ZodString;
150
- github: z.ZodOptional<z.ZodString>;
151
- }, z.core.$strip>;
152
- license: z.ZodString;
153
- tags: z.ZodArray<z.ZodString>;
154
- category: z.ZodString;
155
- compatibility: z.ZodOptional<z.ZodObject<{
156
- openclaw: z.ZodOptional<z.ZodString>;
157
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
158
- }, z.core.$strip>>;
159
- repository: z.ZodOptional<z.ZodString>;
160
- files: z.ZodObject<{
161
- soul: z.ZodString;
162
- identity: z.ZodOptional<z.ZodString>;
163
- agents: z.ZodOptional<z.ZodString>;
164
- heartbeat: z.ZodOptional<z.ZodString>;
165
- style: z.ZodOptional<z.ZodString>;
166
- userTemplate: z.ZodOptional<z.ZodString>;
167
- avatar: z.ZodOptional<z.ZodString>;
168
- }, z.core.$strip>;
169
- examples: z.ZodOptional<z.ZodObject<{
170
- good: z.ZodOptional<z.ZodString>;
171
- bad: z.ZodOptional<z.ZodString>;
172
- }, z.core.$strip>>;
173
- modes: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
- interpolation: z.ZodOptional<z.ZodEnum<{
175
- bold: "bold";
176
- cautious: "cautious";
177
- strict: "strict";
178
- }>>;
179
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
- }, z.core.$strip>;
181
- readonly '0.3': z.ZodObject<{
182
- name: z.ZodString;
183
- displayName: z.ZodString;
184
- version: z.ZodString;
185
- description: z.ZodString;
186
- author: z.ZodObject<{
187
- name: z.ZodString;
188
- github: z.ZodOptional<z.ZodString>;
189
- }, z.core.$strip>;
190
- license: z.ZodString;
191
- tags: z.ZodArray<z.ZodString>;
192
- category: z.ZodString;
193
- compatibility: z.ZodOptional<z.ZodObject<{
194
- openclaw: z.ZodOptional<z.ZodString>;
195
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
196
- }, z.core.$strip>>;
197
- repository: z.ZodOptional<z.ZodString>;
198
- files: z.ZodObject<{
199
- soul: z.ZodString;
200
- identity: z.ZodOptional<z.ZodString>;
201
- agents: z.ZodOptional<z.ZodString>;
202
- heartbeat: z.ZodOptional<z.ZodString>;
203
- style: z.ZodOptional<z.ZodString>;
204
- userTemplate: z.ZodOptional<z.ZodString>;
205
- avatar: z.ZodOptional<z.ZodString>;
206
- }, z.core.$strip>;
207
- examples: z.ZodOptional<z.ZodObject<{
208
- good: z.ZodOptional<z.ZodString>;
209
- bad: z.ZodOptional<z.ZodString>;
210
- }, z.core.$strip>>;
211
- modes: z.ZodOptional<z.ZodArray<z.ZodString>>;
212
- interpolation: z.ZodOptional<z.ZodEnum<{
213
- bold: "bold";
214
- cautious: "cautious";
215
- strict: "strict";
216
- }>>;
217
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
218
- specVersion: z.ZodOptional<z.ZodEnum<{
219
- 0.1: "0.1";
220
- 0.2: "0.2";
221
- 0.3: "0.3";
222
- }>>;
223
- }, z.core.$strip>;
224
- };
225
- export type SpecVersion = keyof typeof SPEC_VERSIONS;
226
- export declare const LATEST_SPEC: SpecVersion;
227
- export declare const ClawSoulSchema: z.ZodObject<{
228
- name: z.ZodString;
229
- displayName: z.ZodString;
230
- version: z.ZodString;
231
- description: z.ZodString;
232
- author: z.ZodObject<{
233
- name: z.ZodString;
234
- github: z.ZodOptional<z.ZodString>;
235
- }, z.core.$strip>;
236
- license: z.ZodString;
237
- tags: z.ZodArray<z.ZodString>;
238
- category: z.ZodString;
239
- compatibility: z.ZodOptional<z.ZodObject<{
240
- openclaw: z.ZodOptional<z.ZodString>;
241
- models: z.ZodOptional<z.ZodArray<z.ZodString>>;
242
- }, z.core.$strip>>;
243
- repository: z.ZodOptional<z.ZodString>;
244
- files: z.ZodObject<{
245
- soul: z.ZodString;
246
- identity: z.ZodOptional<z.ZodString>;
247
- agents: z.ZodOptional<z.ZodString>;
248
- heartbeat: z.ZodOptional<z.ZodString>;
249
- style: z.ZodOptional<z.ZodString>;
250
- userTemplate: z.ZodOptional<z.ZodString>;
251
- avatar: z.ZodOptional<z.ZodString>;
252
- }, z.core.$strip>;
253
- examples: z.ZodOptional<z.ZodObject<{
254
- good: z.ZodOptional<z.ZodString>;
255
- bad: z.ZodOptional<z.ZodString>;
256
- }, z.core.$strip>>;
257
- modes: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
- interpolation: z.ZodOptional<z.ZodEnum<{
259
- bold: "bold";
260
- cautious: "cautious";
261
- strict: "strict";
262
- }>>;
263
- skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
264
- specVersion: z.ZodOptional<z.ZodEnum<{
265
- 0.1: "0.1";
266
- 0.2: "0.2";
267
- 0.3: "0.3";
268
- }>>;
269
- }, z.core.$strip>;
270
- export type ClawSoul = z.infer<typeof ClawSoulSchemaV03>;
271
- export declare function getSchema(version?: string): z.ZodType;
272
- export declare function validateClawSoul(data: unknown, version?: string): ClawSoul;
@@ -1,115 +0,0 @@
1
- import { z } from 'zod';
2
- // ─── License Allowlist ─────────────────────────────────────
3
- export const ALLOWED_LICENSES = [
4
- 'Apache-2.0', 'MIT', 'BSD-2-Clause', 'BSD-3-Clause',
5
- 'CC-BY-4.0', 'CC0-1.0', 'ISC', 'Unlicense',
6
- ];
7
- const BLOCKED_LICENSE_PATTERNS = [
8
- /^GPL-/i, /^AGPL-/i, /^LGPL-/i,
9
- /^CC-BY-NC/i, /^CC-BY-ND/i,
10
- ];
11
- export function checkLicense(license) {
12
- if (ALLOWED_LICENSES.includes(license)) {
13
- return { ok: true };
14
- }
15
- for (const pattern of BLOCKED_LICENSE_PATTERNS) {
16
- if (pattern.test(license)) {
17
- return {
18
- ok: false,
19
- error: `License "${license}" is not allowed. GPL/AGPL/copyleft licenses are not permitted on ClawSouls. Soul files are meant to be freely installed, modified, and used. Please use a permissive license (Apache-2.0, MIT, etc.)`,
20
- };
21
- }
22
- }
23
- return {
24
- ok: true,
25
- warning: `License "${license}" is not in the known allowlist. Allowed: ${ALLOWED_LICENSES.join(', ')}. Proceeding with warning.`,
26
- };
27
- }
28
- // ─── v0.1 Schema ───────────────────────────────────────────
29
- export const ClawSoulSchemaV01 = z.object({
30
- name: z.string().regex(/^[a-z0-9-]+$/, 'Must be kebab-case'),
31
- displayName: z.string().min(1),
32
- version: z.string().regex(/^\d+\.\d+\.\d+$/, 'Must be semver'),
33
- description: z.string().max(160),
34
- author: z.object({
35
- name: z.string(),
36
- github: z.string().optional(),
37
- }),
38
- license: z.string(),
39
- tags: z.array(z.string()).max(10),
40
- category: z.string(),
41
- compatibility: z.object({
42
- openclaw: z.string().optional(),
43
- models: z.array(z.string()).optional(),
44
- }).optional(),
45
- files: z.object({
46
- soul: z.string(),
47
- identity: z.string().optional(),
48
- agents: z.string().optional(),
49
- heartbeat: z.string().optional(),
50
- userTemplate: z.string().optional(),
51
- avatar: z.string().optional(),
52
- }),
53
- repository: z.string().url().optional(),
54
- });
55
- // ─── v0.2 Schema (extends v0.1 with STYLE.md, modes, interpolation, examples, skills) ───
56
- export const ClawSoulSchemaV02 = ClawSoulSchemaV01.extend({
57
- files: z.object({
58
- soul: z.string(),
59
- identity: z.string().optional(),
60
- agents: z.string().optional(),
61
- heartbeat: z.string().optional(),
62
- style: z.string().optional(),
63
- userTemplate: z.string().optional(),
64
- avatar: z.string().optional(),
65
- }),
66
- examples: z.object({
67
- good: z.string().optional(),
68
- bad: z.string().optional(),
69
- }).optional(),
70
- modes: z.array(z.string()).optional(),
71
- interpolation: z.enum(['bold', 'cautious', 'strict']).optional(),
72
- skills: z.array(z.string()).optional(),
73
- });
74
- // ─── v0.3 Schema (extends v0.2 with specVersion) ───
75
- export const ClawSoulSchemaV03 = ClawSoulSchemaV02.extend({
76
- specVersion: z.enum(['0.1', '0.2', '0.3']).optional(),
77
- });
78
- // ─── Version Registry ──────────────────────────────────────
79
- export const SPEC_VERSIONS = {
80
- '0.1': ClawSoulSchemaV01,
81
- '0.2': ClawSoulSchemaV02,
82
- '0.3': ClawSoulSchemaV03,
83
- };
84
- export const LATEST_SPEC = '0.3';
85
- // Default export = latest
86
- export const ClawSoulSchema = SPEC_VERSIONS[LATEST_SPEC];
87
- export function getSchema(version) {
88
- if (!version)
89
- return ClawSoulSchema;
90
- const v = version.replace(/^v/, '');
91
- const schema = SPEC_VERSIONS[v];
92
- if (!schema) {
93
- const available = Object.keys(SPEC_VERSIONS).join(', ');
94
- throw new Error(`Unknown spec version "${version}". Available: ${available}`);
95
- }
96
- return schema;
97
- }
98
- export function validateClawSoul(data, version) {
99
- const schema = getSchema(version);
100
- const result = schema.parse(data);
101
- // Warn if specVersion is missing (backward compat — not an error)
102
- if (!data?.specVersion) {
103
- console.warn('⚠️ Warning: "specVersion" field is missing from soul.json. Consider adding "specVersion": "0.3"');
104
- }
105
- // License allowlist check
106
- const licenseCheck = checkLicense(result.license);
107
- if (!licenseCheck.ok) {
108
- throw new Error(licenseCheck.error);
109
- }
110
- if (licenseCheck.warning) {
111
- console.warn(`⚠️ Warning: ${licenseCheck.warning}`);
112
- }
113
- return result;
114
- }
115
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc;IACnD,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW;CAClC,CAAC;AAEX,MAAM,wBAAwB,GAAG;IAC/B,QAAQ,EAAE,SAAS,EAAE,SAAS;IAC9B,YAAY,EAAE,YAAY;CAC3B,CAAC;AAQF,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,gBAAgB,CAAC,QAAQ,CAAC,OAAc,CAAC,EAAE,CAAC;QAC9C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,wBAAwB,EAAE,CAAC;QAC/C,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,YAAY,OAAO,uMAAuM;aAClO,CA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