@superdoc-dev/sdk 1.21.0 → 1.21.1-next.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.
package/README.md
CHANGED
|
@@ -133,8 +133,8 @@ const doc = await client.open({ doc: './contract.docx' });
|
|
|
133
133
|
const result = await dispatchSuperDocTool(doc, toolName, args);
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
The current catalog contains
|
|
137
|
-
`superdoc_get_content`, `superdoc_edit`, `superdoc_format`, `superdoc_create`, `superdoc_list`, `superdoc_comment`, `superdoc_track_changes`, `superdoc_search`, and `superdoc_mutations`.
|
|
136
|
+
The current catalog contains 10 grouped tools:
|
|
137
|
+
`superdoc_get_content`, `superdoc_edit`, `superdoc_format`, `superdoc_create`, `superdoc_list`, `superdoc_table`, `superdoc_comment`, `superdoc_track_changes`, `superdoc_search`, and `superdoc_mutations`.
|
|
138
138
|
|
|
139
139
|
Multi-action tools use an `action` field to select the underlying operation. Single-action tools like `superdoc_search` do not require `action`.
|
|
140
140
|
|
package/dist/skills.cjs
CHANGED
|
@@ -24,6 +24,12 @@ function resolveSkillFilePath(skillName) {
|
|
|
24
24
|
return filePath;
|
|
25
25
|
}
|
|
26
26
|
function normalizeSkillName(name) {
|
|
27
|
+
if (typeof name !== 'string') {
|
|
28
|
+
throw new errors.SuperDocCliError('Skill name is required.', {
|
|
29
|
+
code: 'INVALID_ARGUMENT',
|
|
30
|
+
details: { name },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
27
33
|
const normalized = name.trim();
|
|
28
34
|
if (!normalized || !SKILL_NAME_RE.test(normalized)) {
|
|
29
35
|
throw new errors.SuperDocCliError('Skill name is required.', {
|
|
@@ -33,6 +39,15 @@ function normalizeSkillName(name) {
|
|
|
33
39
|
}
|
|
34
40
|
return normalized;
|
|
35
41
|
}
|
|
42
|
+
function normalizeInstallSkillOptions(options) {
|
|
43
|
+
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
|
|
44
|
+
throw new errors.SuperDocCliError('Skill install options must be an object.', {
|
|
45
|
+
code: 'INVALID_ARGUMENT',
|
|
46
|
+
details: { options },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return options;
|
|
50
|
+
}
|
|
36
51
|
function listSkills() {
|
|
37
52
|
try {
|
|
38
53
|
return node_fs.readdirSync(skillsDir)
|
|
@@ -82,33 +97,34 @@ function getSkill(name) {
|
|
|
82
97
|
}
|
|
83
98
|
function installSkill(name, options = {}) {
|
|
84
99
|
const normalizedName = normalizeSkillName(name);
|
|
85
|
-
const
|
|
100
|
+
const normalizedOptions = normalizeInstallSkillOptions(options);
|
|
101
|
+
const runtime = normalizedOptions.runtime ?? 'claude';
|
|
86
102
|
if (!SUPPORTED_SKILL_RUNTIMES.includes(runtime)) {
|
|
87
103
|
throw new errors.SuperDocCliError('Unsupported skill runtime.', {
|
|
88
104
|
code: 'INVALID_ARGUMENT',
|
|
89
105
|
details: { runtime, supportedRuntimes: [...SUPPORTED_SKILL_RUNTIMES] },
|
|
90
106
|
});
|
|
91
107
|
}
|
|
92
|
-
const scope =
|
|
108
|
+
const scope = normalizedOptions.scope ?? 'project';
|
|
93
109
|
if (!SUPPORTED_INSTALL_SCOPES.includes(scope)) {
|
|
94
110
|
throw new errors.SuperDocCliError('Unsupported skill install scope.', {
|
|
95
111
|
code: 'INVALID_ARGUMENT',
|
|
96
112
|
details: { scope, supportedScopes: [...SUPPORTED_INSTALL_SCOPES] },
|
|
97
113
|
});
|
|
98
114
|
}
|
|
99
|
-
const skillsRoot =
|
|
100
|
-
? path.resolve(
|
|
115
|
+
const skillsRoot = normalizedOptions.targetDir !== undefined
|
|
116
|
+
? path.resolve(normalizedOptions.targetDir)
|
|
101
117
|
: scope === 'user'
|
|
102
|
-
? path.resolve(
|
|
103
|
-
: path.resolve(
|
|
118
|
+
? path.resolve(normalizedOptions.homeDir ?? os.homedir(), '.claude', 'skills')
|
|
119
|
+
: path.resolve(normalizedOptions.cwd ?? process.cwd(), '.claude', 'skills');
|
|
104
120
|
const skillFile = path.join(skillsRoot, normalizedName, 'SKILL.md');
|
|
105
|
-
const overwrite =
|
|
121
|
+
const overwrite = normalizedOptions.overwrite ?? true;
|
|
106
122
|
const alreadyExists = node_fs.existsSync(skillFile);
|
|
107
123
|
if (!overwrite && alreadyExists) {
|
|
108
124
|
return {
|
|
109
125
|
name: normalizedName,
|
|
110
126
|
runtime,
|
|
111
|
-
scope:
|
|
127
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
112
128
|
path: skillFile,
|
|
113
129
|
written: false,
|
|
114
130
|
overwritten: false,
|
|
@@ -127,7 +143,7 @@ function installSkill(name, options = {}) {
|
|
|
127
143
|
details: {
|
|
128
144
|
name: normalizedName,
|
|
129
145
|
runtime,
|
|
130
|
-
scope:
|
|
146
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
131
147
|
path: skillFile,
|
|
132
148
|
message: error instanceof Error ? error.message : String(error),
|
|
133
149
|
},
|
|
@@ -136,7 +152,7 @@ function installSkill(name, options = {}) {
|
|
|
136
152
|
return {
|
|
137
153
|
name: normalizedName,
|
|
138
154
|
runtime,
|
|
139
|
-
scope:
|
|
155
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
140
156
|
path: skillFile,
|
|
141
157
|
written: true,
|
|
142
158
|
overwritten: alreadyExists,
|
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,wBAAwB,qBAAsB,CAAC;AACrD,QAAA,MAAM,wBAAwB,8BAA+B,CAAC;AAE9D,KAAK,YAAY,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,KAAK,iBAAiB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE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AW,EAAE,OAAO,CAAC;CACtB;AA2CD,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAerC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4B7C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,oBAAoB,CAoElG"}
|
package/dist/skills.js
CHANGED
|
@@ -20,6 +20,12 @@ function resolveSkillFilePath(skillName) {
|
|
|
20
20
|
return filePath;
|
|
21
21
|
}
|
|
22
22
|
function normalizeSkillName(name) {
|
|
23
|
+
if (typeof name !== 'string') {
|
|
24
|
+
throw new SuperDocCliError('Skill name is required.', {
|
|
25
|
+
code: 'INVALID_ARGUMENT',
|
|
26
|
+
details: { name },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
const normalized = name.trim();
|
|
24
30
|
if (!normalized || !SKILL_NAME_RE.test(normalized)) {
|
|
25
31
|
throw new SuperDocCliError('Skill name is required.', {
|
|
@@ -29,6 +35,15 @@ function normalizeSkillName(name) {
|
|
|
29
35
|
}
|
|
30
36
|
return normalized;
|
|
31
37
|
}
|
|
38
|
+
function normalizeInstallSkillOptions(options) {
|
|
39
|
+
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
|
|
40
|
+
throw new SuperDocCliError('Skill install options must be an object.', {
|
|
41
|
+
code: 'INVALID_ARGUMENT',
|
|
42
|
+
details: { options },
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return options;
|
|
46
|
+
}
|
|
32
47
|
export function listSkills() {
|
|
33
48
|
try {
|
|
34
49
|
return readdirSync(skillsDir)
|
|
@@ -78,33 +93,34 @@ export function getSkill(name) {
|
|
|
78
93
|
}
|
|
79
94
|
export function installSkill(name, options = {}) {
|
|
80
95
|
const normalizedName = normalizeSkillName(name);
|
|
81
|
-
const
|
|
96
|
+
const normalizedOptions = normalizeInstallSkillOptions(options);
|
|
97
|
+
const runtime = normalizedOptions.runtime ?? 'claude';
|
|
82
98
|
if (!SUPPORTED_SKILL_RUNTIMES.includes(runtime)) {
|
|
83
99
|
throw new SuperDocCliError('Unsupported skill runtime.', {
|
|
84
100
|
code: 'INVALID_ARGUMENT',
|
|
85
101
|
details: { runtime, supportedRuntimes: [...SUPPORTED_SKILL_RUNTIMES] },
|
|
86
102
|
});
|
|
87
103
|
}
|
|
88
|
-
const scope =
|
|
104
|
+
const scope = normalizedOptions.scope ?? 'project';
|
|
89
105
|
if (!SUPPORTED_INSTALL_SCOPES.includes(scope)) {
|
|
90
106
|
throw new SuperDocCliError('Unsupported skill install scope.', {
|
|
91
107
|
code: 'INVALID_ARGUMENT',
|
|
92
108
|
details: { scope, supportedScopes: [...SUPPORTED_INSTALL_SCOPES] },
|
|
93
109
|
});
|
|
94
110
|
}
|
|
95
|
-
const skillsRoot =
|
|
96
|
-
? path.resolve(
|
|
111
|
+
const skillsRoot = normalizedOptions.targetDir !== undefined
|
|
112
|
+
? path.resolve(normalizedOptions.targetDir)
|
|
97
113
|
: scope === 'user'
|
|
98
|
-
? path.resolve(
|
|
99
|
-
: path.resolve(
|
|
114
|
+
? path.resolve(normalizedOptions.homeDir ?? os.homedir(), '.claude', 'skills')
|
|
115
|
+
: path.resolve(normalizedOptions.cwd ?? process.cwd(), '.claude', 'skills');
|
|
100
116
|
const skillFile = path.join(skillsRoot, normalizedName, 'SKILL.md');
|
|
101
|
-
const overwrite =
|
|
117
|
+
const overwrite = normalizedOptions.overwrite ?? true;
|
|
102
118
|
const alreadyExists = existsSync(skillFile);
|
|
103
119
|
if (!overwrite && alreadyExists) {
|
|
104
120
|
return {
|
|
105
121
|
name: normalizedName,
|
|
106
122
|
runtime,
|
|
107
|
-
scope:
|
|
123
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
108
124
|
path: skillFile,
|
|
109
125
|
written: false,
|
|
110
126
|
overwritten: false,
|
|
@@ -123,7 +139,7 @@ export function installSkill(name, options = {}) {
|
|
|
123
139
|
details: {
|
|
124
140
|
name: normalizedName,
|
|
125
141
|
runtime,
|
|
126
|
-
scope:
|
|
142
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
127
143
|
path: skillFile,
|
|
128
144
|
message: error instanceof Error ? error.message : String(error),
|
|
129
145
|
},
|
|
@@ -132,7 +148,7 @@ export function installSkill(name, options = {}) {
|
|
|
132
148
|
return {
|
|
133
149
|
name: normalizedName,
|
|
134
150
|
runtime,
|
|
135
|
-
scope:
|
|
151
|
+
scope: normalizedOptions.targetDir !== undefined ? 'custom' : scope,
|
|
136
152
|
path: skillFile,
|
|
137
153
|
written: true,
|
|
138
154
|
overwritten: alreadyExists,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/sdk",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.1-next.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"typescript": "^5.9.2"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@superdoc-dev/sdk-darwin-
|
|
30
|
-
"@superdoc-dev/sdk-darwin-
|
|
31
|
-
"@superdoc-dev/sdk-linux-arm64": "1.21.
|
|
32
|
-
"@superdoc-dev/sdk-linux-x64": "1.21.
|
|
33
|
-
"@superdoc-dev/sdk-windows-x64": "1.21.
|
|
29
|
+
"@superdoc-dev/sdk-darwin-x64": "1.21.1-next.1",
|
|
30
|
+
"@superdoc-dev/sdk-darwin-arm64": "1.21.1-next.1",
|
|
31
|
+
"@superdoc-dev/sdk-linux-arm64": "1.21.1-next.1",
|
|
32
|
+
"@superdoc-dev/sdk-linux-x64": "1.21.1-next.1",
|
|
33
|
+
"@superdoc-dev/sdk-windows-x64": "1.21.1-next.1"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
Binary file
|
|
Binary file
|