@superdoc-dev/sdk 1.0.0-alpha.2 → 1.0.0-alpha.20
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/README.md +126 -0
- package/dist/generated/client.cjs +236 -0
- package/dist/generated/client.d.ts +6318 -0
- package/dist/generated/client.d.ts.map +1 -0
- package/dist/generated/client.js +231 -0
- package/dist/generated/contract.cjs +62387 -0
- package/dist/generated/contract.d.ts +45999 -0
- package/dist/generated/contract.d.ts.map +1 -0
- package/dist/generated/contract.js +62402 -0
- package/dist/helpers/format.d.ts +79 -0
- package/dist/helpers/format.d.ts.map +1 -0
- package/dist/helpers/format.js +121 -0
- package/dist/index.cjs +45 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/runtime/embedded-cli.cjs +100 -0
- package/dist/runtime/embedded-cli.d.ts +5 -0
- package/dist/runtime/embedded-cli.d.ts.map +1 -0
- package/dist/runtime/embedded-cli.js +94 -0
- package/dist/runtime/errors.cjs +22 -0
- package/dist/runtime/errors.d.ts +17 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +18 -0
- package/dist/runtime/host.cjs +352 -0
- package/dist/runtime/host.d.ts +37 -0
- package/dist/runtime/host.d.ts.map +1 -0
- package/dist/runtime/host.js +347 -0
- package/dist/runtime/process.cjs +32 -0
- package/dist/runtime/process.d.ts +16 -0
- package/dist/runtime/process.d.ts.map +1 -0
- package/dist/runtime/process.js +27 -0
- package/dist/runtime/transport-common.cjs +77 -0
- package/dist/runtime/transport-common.d.ts +49 -0
- package/dist/runtime/transport-common.d.ts.map +1 -0
- package/dist/runtime/transport-common.js +72 -0
- package/dist/skills.cjs +148 -0
- package/dist/skills.d.ts +25 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +140 -0
- package/dist/tools.cjs +371 -0
- package/dist/tools.d.ts +113 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +360 -0
- package/package.json +31 -18
- package/skills/editing-docx.md +24 -146
- package/tools/catalog.json +66563 -0
- package/tools/tool-name-map.json +382 -0
- package/tools/tools-policy.json +100 -0
- package/tools/tools.anthropic.json +27979 -0
- package/tools/tools.generic.json +64075 -0
- package/tools/tools.openai.json +29119 -0
- package/tools/tools.vercel.json +29119 -0
- package/LICENSE +0 -661
- package/skills/.gitkeep +0 -0
- package/src/__tests__/skills.test.ts +0 -93
- package/src/generated/DO_NOT_EDIT +0 -2
- package/src/generated/client.ts +0 -3151
- package/src/generated/contract.ts +0 -13396
- package/src/index.ts +0 -72
- package/src/runtime/__tests__/transport-common.test.ts +0 -151
- package/src/runtime/embedded-cli.ts +0 -109
- package/src/runtime/errors.ts +0 -30
- package/src/runtime/host.ts +0 -465
- package/src/runtime/process.ts +0 -45
- package/src/runtime/transport-common.ts +0 -159
- package/src/skills.ts +0 -91
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { SuperDocCliError } from '../runtime/errors';
|
|
3
|
-
import { getSkill, listSkills } from '../skills';
|
|
4
|
-
|
|
5
|
-
describe('listSkills', () => {
|
|
6
|
-
test('returns an array of skill names', () => {
|
|
7
|
-
const skills = listSkills();
|
|
8
|
-
expect(Array.isArray(skills)).toBe(true);
|
|
9
|
-
expect(skills.length).toBeGreaterThan(0);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('includes the editing-docx skill', () => {
|
|
13
|
-
const skills = listSkills();
|
|
14
|
-
expect(skills).toContain('editing-docx');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('returns sorted results', () => {
|
|
18
|
-
const skills = listSkills();
|
|
19
|
-
const sorted = [...skills].sort();
|
|
20
|
-
expect(skills).toEqual(sorted);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('does not include file extensions', () => {
|
|
24
|
-
const skills = listSkills();
|
|
25
|
-
for (const name of skills) {
|
|
26
|
-
expect(name).not.toContain('.md');
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('getSkill', () => {
|
|
32
|
-
test('returns content for a valid skill name', () => {
|
|
33
|
-
const content = getSkill('editing-docx');
|
|
34
|
-
expect(typeof content).toBe('string');
|
|
35
|
-
expect(content.length).toBeGreaterThan(0);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('throws INVALID_ARGUMENT for empty name', () => {
|
|
39
|
-
expect(() => getSkill('')).toThrow(SuperDocCliError);
|
|
40
|
-
try {
|
|
41
|
-
getSkill('');
|
|
42
|
-
} catch (error) {
|
|
43
|
-
expect((error as SuperDocCliError).code).toBe('INVALID_ARGUMENT');
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('throws INVALID_ARGUMENT for whitespace-only name', () => {
|
|
48
|
-
expect(() => getSkill(' ')).toThrow(SuperDocCliError);
|
|
49
|
-
try {
|
|
50
|
-
getSkill(' ');
|
|
51
|
-
} catch (error) {
|
|
52
|
-
expect((error as SuperDocCliError).code).toBe('INVALID_ARGUMENT');
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('throws INVALID_ARGUMENT for names with path traversal characters', () => {
|
|
57
|
-
const maliciousNames = ['../etc/passwd', './local', 'foo/bar', 'a b c', 'skill.md'];
|
|
58
|
-
|
|
59
|
-
for (const name of maliciousNames) {
|
|
60
|
-
expect(() => getSkill(name)).toThrow(SuperDocCliError);
|
|
61
|
-
try {
|
|
62
|
-
getSkill(name);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
expect((error as SuperDocCliError).code).toBe('INVALID_ARGUMENT');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('throws SKILL_NOT_FOUND for nonexistent skill', () => {
|
|
70
|
-
expect(() => getSkill('nonexistent-skill-name-xyz')).toThrow(SuperDocCliError);
|
|
71
|
-
try {
|
|
72
|
-
getSkill('nonexistent-skill-name-xyz');
|
|
73
|
-
} catch (error) {
|
|
74
|
-
const sdError = error as SuperDocCliError;
|
|
75
|
-
expect(sdError.code).toBe('SKILL_NOT_FOUND');
|
|
76
|
-
expect((sdError.details as { available: string[] }).available).toContain('editing-docx');
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('accepts valid skill names with hyphens and underscores', () => {
|
|
81
|
-
// These should not throw INVALID_ARGUMENT (they may throw SKILL_NOT_FOUND)
|
|
82
|
-
const validNames = ['a', 'my-skill', 'my_skill', 'Skill1', '1skill'];
|
|
83
|
-
|
|
84
|
-
for (const name of validNames) {
|
|
85
|
-
try {
|
|
86
|
-
getSkill(name);
|
|
87
|
-
} catch (error) {
|
|
88
|
-
// SKILL_NOT_FOUND is expected; INVALID_ARGUMENT means the regex is wrong
|
|
89
|
-
expect((error as SuperDocCliError).code).not.toBe('INVALID_ARGUMENT');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|