Skip to content

Commit 77f0105

Browse files
author
StackMemory Bot (CLI)
committed
feat(skill-packs): add content licenses (CC-BY-4.0) to registry metadata
Skills are often prompt text (content) not code — content licenses like CC-BY-4.0 fit better than MIT for these. Adds KnownLicenseSchema enum with both code (MIT, Apache-2.0, ISC, BSD) and content (CC-BY-4.0, CC-BY-SA-4.0, CC0-1.0) licenses while keeping the field open for custom SPDX identifiers.
1 parent 1831488 commit 77f0105

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

src/core/skill-packs/__tests__/parser.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,30 @@ describe('parsePackYaml', () => {
112112
expect(() => parsePackYaml(yaml.dump(bad))).toThrow();
113113
});
114114

115+
it('should accept content licenses like CC-BY-4.0', () => {
116+
const manifest = {
117+
name: 'learning/opportunities',
118+
version: '1.0.0',
119+
description: 'Learning exercises for AI-assisted coding',
120+
author: 'drcathicks',
121+
license: 'CC-BY-4.0',
122+
};
123+
const pack = parsePackYaml(yaml.dump(manifest));
124+
expect(pack.manifest.license).toBe('CC-BY-4.0');
125+
});
126+
127+
it('should accept custom license strings', () => {
128+
const manifest = {
129+
name: 'test/custom',
130+
version: '1.0.0',
131+
description: 'Custom license pack',
132+
author: 'test',
133+
license: 'Proprietary',
134+
};
135+
const pack = parsePackYaml(yaml.dump(manifest));
136+
expect(pack.manifest.license).toBe('Proprietary');
137+
});
138+
115139
it('should accept all valid runtime types', () => {
116140
for (const type of ['local', 'e2b', 'cua', 'modal']) {
117141
const manifest = {

src/core/skill-packs/types.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,32 @@ export const SkillPackExampleSchema = z.object({
9090

9191
export type SkillPackExample = z.infer<typeof SkillPackExampleSchema>;
9292

93+
// ============================================================
94+
// LICENSE
95+
// ============================================================
96+
97+
/**
98+
* Known licenses for skill packs.
99+
* Code licenses (MIT, Apache-2.0, ISC) and content licenses (CC-BY-4.0, CC-BY-SA-4.0)
100+
* are both valid — skills are often prompt text (content) rather than executable code.
101+
*/
102+
export const KnownLicenseSchema = z.enum([
103+
'MIT',
104+
'Apache-2.0',
105+
'ISC',
106+
'BSD-2-Clause',
107+
'BSD-3-Clause',
108+
'CC-BY-4.0',
109+
'CC-BY-SA-4.0',
110+
'CC0-1.0',
111+
'UNLICENSED',
112+
]);
113+
114+
export type KnownLicense = z.infer<typeof KnownLicenseSchema>;
115+
116+
/** Accepts known SPDX identifiers or any custom string */
117+
const LicenseSchema = KnownLicenseSchema.or(z.string().min(1));
118+
93119
// ============================================================
94120
// PACK NAME (namespace/pack-name)
95121
// ============================================================
@@ -111,7 +137,7 @@ export const SkillPackManifestSchema = z.object({
111137
version: SemverSchema,
112138
description: z.string().min(1),
113139
author: z.string().min(1),
114-
license: z.string().default('MIT'),
140+
license: LicenseSchema.default('MIT'),
115141
runtime: SkillPackRuntimeSchema.optional(),
116142
ingestion: SkillPackIngestionSchema.optional(),
117143
ontology: SkillPackOntologySchema.optional(),

0 commit comments

Comments
 (0)