@airongrong/capability 1.0.0-beta.0 → 1.0.0-beta.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.
@@ -147,12 +147,15 @@ function generateSdkTypes(manifest) {
147
147
  '',
148
148
  ];
149
149
  for (const [name, action] of Object.entries(manifest.actions)) {
150
- const pascal = name.charAt(0).toUpperCase() + name.slice(1);
150
+ const pascal = pascalCase(name);
151
151
  lines.push(`export interface ${pascal}Input {`);
152
152
  for (const [field, input] of Object.entries(action.inputs)) {
153
- lines.push(` ${field}${input.default === undefined || input.hidden ? '?' : ''}: ${tsTypeOf(input)}`);
153
+ const optional = input.default !== undefined || input.hidden === true;
154
+ lines.push(` ${field}${optional ? '?' : ''}: ${tsTypeOf(input)}`);
155
+ }
156
+ if (!('dryRun' in action.inputs)) {
157
+ lines.push(' dryRun?: boolean');
154
158
  }
155
- lines.push(' dryRun?: boolean');
156
159
  lines.push(' confirmToken?: string');
157
160
  lines.push('}');
158
161
  lines.push(`export interface ${pascal}Result extends Record<string, unknown> {}`);
@@ -160,13 +163,19 @@ function generateSdkTypes(manifest) {
160
163
  }
161
164
  lines.push('export interface CapabilityClient {');
162
165
  for (const name of Object.keys(manifest.actions)) {
163
- const pascal = name.charAt(0).toUpperCase() + name.slice(1);
166
+ const pascal = pascalCase(name);
164
167
  lines.push(` ${name}(input: ${pascal}Input): Promise<${pascal}Result>`);
165
168
  }
166
169
  lines.push('}');
167
170
  lines.push('');
168
171
  return lines.join('\n');
169
172
  }
173
+ function pascalCase(name) {
174
+ return name
175
+ .split('_')
176
+ .map(part => part.charAt(0).toUpperCase() + part.slice(1))
177
+ .join('');
178
+ }
170
179
  function tsTypeOf(input) {
171
180
  switch (input.type) {
172
181
  case 'boolean':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airongrong/capability",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "AiToEarn capability manifest: single source of truth and generators for MCP tools, GUI forms, SDK clients, OpenAPI and validation rules",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",