ugcinc 4.1.124 → 4.1.126
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/dist/automations/nodes/index.d.ts +4 -4
- package/dist/automations/nodes/index.js +2 -2
- package/dist/automations/nodes/input.d.ts +18 -0
- package/dist/automations/nodes/{variable.js → input.js} +6 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -15
- package/package.json +4 -8
- package/dist/automations/nodes/variable.d.ts +0 -18
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -206
- package/dist/skills.d.ts +0 -1
- package/dist/skills.js +0 -391
- package/dist/tools/accounts.d.ts +0 -2
- package/dist/tools/accounts.js +0 -127
- package/dist/tools/automations.d.ts +0 -2
- package/dist/tools/automations.js +0 -123
- package/dist/tools/comments.d.ts +0 -2
- package/dist/tools/comments.js +0 -30
- package/dist/tools/index.d.ts +0 -13
- package/dist/tools/index.js +0 -33
- package/dist/tools/media.d.ts +0 -2
- package/dist/tools/media.js +0 -77
- package/dist/tools/org.d.ts +0 -2
- package/dist/tools/org.js +0 -33
- package/dist/tools/posts.d.ts +0 -2
- package/dist/tools/posts.js +0 -102
- package/dist/tools/stats.d.ts +0 -2
- package/dist/tools/stats.js +0 -82
- package/dist/tools/tasks.d.ts +0 -2
- package/dist/tools/tasks.js +0 -39
- package/dist/tools/types.d.ts +0 -8
- package/dist/tools/types.js +0 -2
|
@@ -324,13 +324,13 @@ export declare const nodeDefinitions: {
|
|
|
324
324
|
__TInputs: import("./transcript").TranscriptNodeInputs;
|
|
325
325
|
__TOutputs: import("./transcript").TranscriptNodeOutputs;
|
|
326
326
|
};
|
|
327
|
-
readonly
|
|
327
|
+
readonly input: NodeDefinition<"input", "source", {
|
|
328
328
|
outputs: import("../types").NodePort[];
|
|
329
329
|
outputMode: import("./types").OutputMode | null;
|
|
330
330
|
selectionMode: import("./types").SelectionMode | null;
|
|
331
|
-
}, import("./
|
|
332
|
-
__TInputs: import("./
|
|
333
|
-
__TOutputs: import("./
|
|
331
|
+
}, import("./input").InputNodeInputs, import("./input").InputNodeOutputs, false> & {
|
|
332
|
+
__TInputs: import("./input").InputNodeInputs;
|
|
333
|
+
__TOutputs: import("./input").InputNodeOutputs;
|
|
334
334
|
};
|
|
335
335
|
readonly 'video-composer': NodeDefinition<"video-composer", "generator", {
|
|
336
336
|
videoEditor: {
|
|
@@ -39,7 +39,7 @@ const screenshot_animation_1 = __importDefault(require("./screenshot-animation")
|
|
|
39
39
|
const social_audio_1 = __importDefault(require("./social-audio"));
|
|
40
40
|
const text_1 = __importDefault(require("./text"));
|
|
41
41
|
const transcript_1 = __importDefault(require("./transcript"));
|
|
42
|
-
const
|
|
42
|
+
const input_1 = __importDefault(require("./input"));
|
|
43
43
|
const video_composer_1 = __importDefault(require("./video-composer"));
|
|
44
44
|
const video_import_1 = __importDefault(require("./video-import"));
|
|
45
45
|
// =============================================================================
|
|
@@ -78,7 +78,7 @@ exports.nodeDefinitions = {
|
|
|
78
78
|
'social-audio': social_audio_1.default,
|
|
79
79
|
'text': text_1.default,
|
|
80
80
|
'transcript': transcript_1.default,
|
|
81
|
-
'
|
|
81
|
+
'input': input_1.default,
|
|
82
82
|
'video-composer': video_composer_1.default,
|
|
83
83
|
'video-import': video_import_1.default,
|
|
84
84
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NodePort, PortValue } from '../types';
|
|
2
|
+
import { type OutputMode, type SelectionMode } from './types';
|
|
3
|
+
/** Input node has no inputs (source node) */
|
|
4
|
+
export interface InputNodeInputs {
|
|
5
|
+
}
|
|
6
|
+
/** Input outputs are dynamic based on config. Output port IDs are user-defined. */
|
|
7
|
+
export type InputNodeOutputs = Record<string, PortValue | PortValue[]>;
|
|
8
|
+
declare const definition: import("./types").NodeDefinition<"input", "source", {
|
|
9
|
+
outputs: NodePort[];
|
|
10
|
+
outputMode: OutputMode | null;
|
|
11
|
+
selectionMode: SelectionMode | null;
|
|
12
|
+
}, InputNodeInputs, InputNodeOutputs, false>;
|
|
13
|
+
declare const _default: typeof definition & {
|
|
14
|
+
__TInputs: InputNodeInputs;
|
|
15
|
+
__TOutputs: InputNodeOutputs;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
export type InputNodeConfig = typeof definition.defaults;
|
|
@@ -5,8 +5,8 @@ const types_1 = require("./types");
|
|
|
5
5
|
// Node Definition
|
|
6
6
|
// =============================================================================
|
|
7
7
|
const definition = (0, types_1.defineNode)({
|
|
8
|
-
nodeId: '
|
|
9
|
-
label: '
|
|
8
|
+
nodeId: 'input',
|
|
9
|
+
label: 'Input',
|
|
10
10
|
description: 'Define runtime input variables',
|
|
11
11
|
type: 'source',
|
|
12
12
|
category: 'Sources',
|
|
@@ -24,7 +24,7 @@ const definition = (0, types_1.defineNode)({
|
|
|
24
24
|
};
|
|
25
25
|
},
|
|
26
26
|
generatePreview: (config, _ctx) => {
|
|
27
|
-
//
|
|
27
|
+
// Input outputs are provided at runtime, no preview available
|
|
28
28
|
const result = {};
|
|
29
29
|
for (const output of config.outputs) {
|
|
30
30
|
result[output.id] = null;
|
|
@@ -35,17 +35,17 @@ const definition = (0, types_1.defineNode)({
|
|
|
35
35
|
const errors = [];
|
|
36
36
|
const outputs = config.outputs;
|
|
37
37
|
if (!outputs?.length) {
|
|
38
|
-
errors.push('
|
|
38
|
+
errors.push('Input node requires at least one output to be configured');
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
const validTypes = ['image', 'video', 'audio', 'text', 'social_audio', 'account', 'boolean', 'object'];
|
|
42
42
|
for (const output of outputs) {
|
|
43
43
|
if (!output.id) {
|
|
44
|
-
errors.push('
|
|
44
|
+
errors.push('Input output requires an id');
|
|
45
45
|
}
|
|
46
46
|
const outputType = Array.isArray(output.type) ? output.type.join(' | ') : output.type;
|
|
47
47
|
if (!output.type || !validTypes.includes(outputType)) {
|
|
48
|
-
errors.push(`Invalid
|
|
48
|
+
errors.push(`Invalid Input output type: ${outputType}`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,6 @@ export { OrganizationClient } from './org';
|
|
|
12
12
|
export { AutomationsClient } from './automations';
|
|
13
13
|
export { MediaClient } from './media';
|
|
14
14
|
export { CommentsClient } from './comments';
|
|
15
|
-
export { allTools, toolRegistry, accountTools, postTools, mediaTools, automationTools, statsTools, taskTools, commentTools, orgTools } from './tools';
|
|
16
|
-
export type { ToolDefinition } from './tools';
|
|
17
15
|
export { submitImageRenderJob, submitVideoRenderJob, getRenderJobStatus, submitDeduplicationJob, submitScreenshotAnimationRenderJob, submitAutoCaptionRenderJob, submitInstagramDmRenderJob, submitIMessageDmRenderJob, } from './render';
|
|
18
16
|
export { areTypesCompatible, computePortsForNode, computePortsWithPreviews, computeAllNodePorts, computeAllNodePortsWithPreviews, getInputPreviewValue, getAllNodes, getNodeByType, getOutputSchema, createNode, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getConnectedSource, getForEachContext, checkCrossContextViolation, getDownstreamNodes, getNodesDownstreamOfSet, getCapturedNodes, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, getWorkflowOutputSchema, resolveNodePreview, computeAllNodePreviews, computePreviewMap, updatePreviewMapForConnection, removePreviewForConnection, getPreviewValue, shuffleNodePreview, type PreviewMap, type NodePreviewOutputs, type Connection, generateNodeName, extractWorkflowConfig, type WorkflowTemplateData, } from './automations/graph-controller';
|
|
19
17
|
export { nodeDefinitions, internalNodeTypes, isAsyncExecutor, formatPortType, isPortType } from './automations/types';
|
|
@@ -58,7 +56,7 @@ export { IfLogicOperators, applyLogicOperator } from './automations/nodes/if';
|
|
|
58
56
|
export type { LLMNodeConfig, LLMNodeOutputs, LLMProvider, } from './automations/nodes/llm';
|
|
59
57
|
export { LLMProviders, outputFieldToZod, outputFieldsToZod } from './automations/nodes/llm';
|
|
60
58
|
export type { ManualTriggerNodeConfig, ManualTriggerNodeOutputs } from './automations/nodes/manual-trigger';
|
|
61
|
-
export type {
|
|
59
|
+
export type { InputNodeConfig, InputNodeOutputs } from './automations/nodes/input';
|
|
62
60
|
export type { MediaNodeConfig, MediaNodeOutput } from './automations/nodes/media';
|
|
63
61
|
export type { NotNodeConfig } from './automations/nodes/not';
|
|
64
62
|
export type { OutputNodeConfig, OutputNodeOutputs } from './automations/nodes/output';
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* Official TypeScript/JavaScript client for the UGC Inc API
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
9
|
-
exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.prepareImageComposerInput = exports.substituteVariables = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getCapturedSourceNodeTypes = exports.getFlowControlNodeTypes = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview =
|
|
10
|
-
exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = void 0;
|
|
8
|
+
exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.getCapturedNodes = exports.getNodesDownstreamOfSet = exports.getDownstreamNodes = exports.checkCrossContextViolation = exports.getForEachContext = exports.getConnectedSource = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.getInputPreviewValue = exports.computeAllNodePortsWithPreviews = exports.computeAllNodePorts = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.submitIMessageDmRenderJob = exports.submitInstagramDmRenderJob = exports.submitAutoCaptionRenderJob = exports.submitScreenshotAnimationRenderJob = exports.submitDeduplicationJob = exports.getRenderJobStatus = exports.submitVideoRenderJob = exports.submitImageRenderJob = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
9
|
+
exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.prepareImageComposerInput = exports.substituteVariables = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getCapturedSourceNodeTypes = exports.getFlowControlNodeTypes = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = void 0;
|
|
11
10
|
// =============================================================================
|
|
12
11
|
// Client Exports
|
|
13
12
|
// =============================================================================
|
|
@@ -29,18 +28,6 @@ var media_1 = require("./media");
|
|
|
29
28
|
Object.defineProperty(exports, "MediaClient", { enumerable: true, get: function () { return media_1.MediaClient; } });
|
|
30
29
|
var comments_1 = require("./comments");
|
|
31
30
|
Object.defineProperty(exports, "CommentsClient", { enumerable: true, get: function () { return comments_1.CommentsClient; } });
|
|
32
|
-
// Tools (for AI agent integration)
|
|
33
|
-
var tools_1 = require("./tools");
|
|
34
|
-
Object.defineProperty(exports, "allTools", { enumerable: true, get: function () { return tools_1.allTools; } });
|
|
35
|
-
Object.defineProperty(exports, "toolRegistry", { enumerable: true, get: function () { return tools_1.toolRegistry; } });
|
|
36
|
-
Object.defineProperty(exports, "accountTools", { enumerable: true, get: function () { return tools_1.accountTools; } });
|
|
37
|
-
Object.defineProperty(exports, "postTools", { enumerable: true, get: function () { return tools_1.postTools; } });
|
|
38
|
-
Object.defineProperty(exports, "mediaTools", { enumerable: true, get: function () { return tools_1.mediaTools; } });
|
|
39
|
-
Object.defineProperty(exports, "automationTools", { enumerable: true, get: function () { return tools_1.automationTools; } });
|
|
40
|
-
Object.defineProperty(exports, "statsTools", { enumerable: true, get: function () { return tools_1.statsTools; } });
|
|
41
|
-
Object.defineProperty(exports, "taskTools", { enumerable: true, get: function () { return tools_1.taskTools; } });
|
|
42
|
-
Object.defineProperty(exports, "commentTools", { enumerable: true, get: function () { return tools_1.commentTools; } });
|
|
43
|
-
Object.defineProperty(exports, "orgTools", { enumerable: true, get: function () { return tools_1.orgTools; } });
|
|
44
31
|
// Render functions
|
|
45
32
|
var render_1 = require("./render");
|
|
46
33
|
Object.defineProperty(exports, "submitImageRenderJob", { enumerable: true, get: function () { return render_1.submitImageRenderJob; } });
|
package/package.json
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.126",
|
|
4
4
|
"description": "TypeScript/JavaScript client for the UGC Inc API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"ugcinc": "./dist/cli.js"
|
|
9
|
-
},
|
|
10
7
|
"exports": {
|
|
11
8
|
".": {
|
|
12
9
|
"types": "./dist/index.d.ts",
|
|
13
10
|
"default": "./dist/index.js"
|
|
14
11
|
},
|
|
15
|
-
"./tools": {
|
|
16
|
-
"types": "./dist/tools/index.d.ts",
|
|
17
|
-
"default": "./dist/tools/index.js"
|
|
18
|
-
},
|
|
19
12
|
"./render": {
|
|
20
13
|
"types": "./dist/render/index.d.ts",
|
|
21
14
|
"default": "./dist/render/index.js"
|
|
@@ -64,6 +57,9 @@
|
|
|
64
57
|
},
|
|
65
58
|
"files": [
|
|
66
59
|
"dist",
|
|
60
|
+
"!dist/cli.*",
|
|
61
|
+
"!dist/skills.*",
|
|
62
|
+
"!dist/tools/",
|
|
67
63
|
"README.md"
|
|
68
64
|
]
|
|
69
65
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { NodePort, PortValue } from '../types';
|
|
2
|
-
import { type OutputMode, type SelectionMode } from './types';
|
|
3
|
-
/** Variable node has no inputs (source node) */
|
|
4
|
-
export interface VariableNodeInputs {
|
|
5
|
-
}
|
|
6
|
-
/** Variable outputs are dynamic based on config. Output port IDs are user-defined. */
|
|
7
|
-
export type VariableNodeOutputs = Record<string, PortValue | PortValue[]>;
|
|
8
|
-
declare const definition: import("./types").NodeDefinition<"variable", "source", {
|
|
9
|
-
outputs: NodePort[];
|
|
10
|
-
outputMode: OutputMode | null;
|
|
11
|
-
selectionMode: SelectionMode | null;
|
|
12
|
-
}, VariableNodeInputs, VariableNodeOutputs, false>;
|
|
13
|
-
declare const _default: typeof definition & {
|
|
14
|
-
__TInputs: VariableNodeInputs;
|
|
15
|
-
__TOutputs: VariableNodeOutputs;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
export type VariableNodeConfig = typeof definition.defaults;
|
package/dist/cli.d.ts
DELETED
package/dist/cli.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const client_1 = require("./client");
|
|
38
|
-
const tools_1 = require("./tools");
|
|
39
|
-
const skills_1 = require("./skills");
|
|
40
|
-
const fs = __importStar(require("fs"));
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
function parseEnvValue(content, name) {
|
|
43
|
-
for (const line of content.split('\n')) {
|
|
44
|
-
const trimmed = line.trim();
|
|
45
|
-
if (trimmed.startsWith(`${name}=`)) {
|
|
46
|
-
let value = trimmed.slice(name.length + 1);
|
|
47
|
-
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
48
|
-
value = value.slice(1, -1);
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
function checkEnvFile(filePath, name) {
|
|
56
|
-
if (!fs.existsSync(filePath))
|
|
57
|
-
return undefined;
|
|
58
|
-
return parseEnvValue(fs.readFileSync(filePath, 'utf-8'), name);
|
|
59
|
-
}
|
|
60
|
-
function loadEnvVar(name) {
|
|
61
|
-
if (process.env[name])
|
|
62
|
-
return process.env[name];
|
|
63
|
-
let dir = process.cwd();
|
|
64
|
-
while (true) {
|
|
65
|
-
// Check .env in this directory
|
|
66
|
-
const value = checkEnvFile(path.join(dir, '.env'), name);
|
|
67
|
-
if (value)
|
|
68
|
-
return value;
|
|
69
|
-
// Check immediate child directories for .env files
|
|
70
|
-
if (fs.existsSync(dir)) {
|
|
71
|
-
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
72
|
-
if (entry.isDirectory() && !entry.name.startsWith('.') && !entry.name.startsWith('node_modules')) {
|
|
73
|
-
const childValue = checkEnvFile(path.join(dir, entry.name, '.env'), name);
|
|
74
|
-
if (childValue)
|
|
75
|
-
return childValue;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const parent = path.dirname(dir);
|
|
80
|
-
if (parent === dir)
|
|
81
|
-
break;
|
|
82
|
-
dir = parent;
|
|
83
|
-
}
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
function printUsage() {
|
|
87
|
-
console.log('Usage: ugcinc <command> [args]');
|
|
88
|
-
console.log('');
|
|
89
|
-
console.log('Commands:');
|
|
90
|
-
console.log(' init Set up Claude Code skills in your project');
|
|
91
|
-
console.log(' <tool_name> [json_params] Run an API tool');
|
|
92
|
-
console.log(' --list List all available tools as JSON');
|
|
93
|
-
console.log(' --help Show this help message');
|
|
94
|
-
console.log('');
|
|
95
|
-
console.log('Environment variables:');
|
|
96
|
-
console.log(' UGC_API_KEY (required for tools) Your UGC Inc API key');
|
|
97
|
-
console.log(' UGC_ORG_ID (optional) Organization ID to scope requests');
|
|
98
|
-
console.log('');
|
|
99
|
-
console.log('Available tools:');
|
|
100
|
-
for (const tool of tools_1.allTools) {
|
|
101
|
-
console.log(` ${tool.name.padEnd(30)} ${tool.description}`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function runInit() {
|
|
105
|
-
const cwd = process.cwd();
|
|
106
|
-
const skillsDir = path.join(cwd, '.claude', 'skills');
|
|
107
|
-
let created = 0;
|
|
108
|
-
let skipped = 0;
|
|
109
|
-
for (const [skillPath, content] of Object.entries(skills_1.skillFiles)) {
|
|
110
|
-
const fullPath = path.join(skillsDir, skillPath);
|
|
111
|
-
const dir = path.dirname(fullPath);
|
|
112
|
-
if (!fs.existsSync(dir)) {
|
|
113
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
114
|
-
}
|
|
115
|
-
if (fs.existsSync(fullPath)) {
|
|
116
|
-
skipped++;
|
|
117
|
-
console.log(` skip ${skillPath} (already exists)`);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
fs.writeFileSync(fullPath, content);
|
|
121
|
-
created++;
|
|
122
|
-
console.log(` create ${skillPath}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
console.log('');
|
|
126
|
-
console.log(`Done! Created ${created} skill files${skipped > 0 ? `, skipped ${skipped} existing` : ''}.`);
|
|
127
|
-
console.log('');
|
|
128
|
-
console.log('Next steps:');
|
|
129
|
-
console.log(' 1. Set your API key: export UGC_API_KEY="your-api-key"');
|
|
130
|
-
console.log(' 2. Try a command: /accounts list my accounts');
|
|
131
|
-
console.log('');
|
|
132
|
-
console.log('Available skills:');
|
|
133
|
-
console.log(' /accounts Manage accounts, warmup, and social profiles');
|
|
134
|
-
console.log(' /posts Schedule, update, and manage posts');
|
|
135
|
-
console.log(' /media Manage media library and social audio');
|
|
136
|
-
console.log(' /automations Run and manage automation workflows');
|
|
137
|
-
console.log(' /stats View account and post statistics');
|
|
138
|
-
}
|
|
139
|
-
async function runTool(toolName, rawParams) {
|
|
140
|
-
const tool = tools_1.toolRegistry[toolName];
|
|
141
|
-
if (!tool) {
|
|
142
|
-
console.error(JSON.stringify({
|
|
143
|
-
ok: false,
|
|
144
|
-
error: `Unknown tool: ${toolName}`,
|
|
145
|
-
available: tools_1.allTools.map(t => t.name),
|
|
146
|
-
}));
|
|
147
|
-
process.exit(1);
|
|
148
|
-
}
|
|
149
|
-
const apiKey = loadEnvVar('UGC_API_KEY');
|
|
150
|
-
if (!apiKey) {
|
|
151
|
-
console.error(JSON.stringify({
|
|
152
|
-
ok: false,
|
|
153
|
-
error: 'UGC_API_KEY not found in environment or any .env file in the directory tree',
|
|
154
|
-
}));
|
|
155
|
-
process.exit(1);
|
|
156
|
-
}
|
|
157
|
-
const orgId = loadEnvVar('UGC_ORG_ID');
|
|
158
|
-
const client = new client_1.UGCClient({ apiKey, orgId });
|
|
159
|
-
let params = undefined;
|
|
160
|
-
if (rawParams) {
|
|
161
|
-
const parseResult = tool.schema.safeParse(JSON.parse(rawParams));
|
|
162
|
-
if (!parseResult.success) {
|
|
163
|
-
console.error(JSON.stringify({
|
|
164
|
-
ok: false,
|
|
165
|
-
error: 'Invalid parameters',
|
|
166
|
-
details: parseResult.error.issues,
|
|
167
|
-
}));
|
|
168
|
-
process.exit(1);
|
|
169
|
-
}
|
|
170
|
-
params = parseResult.data;
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
const parseResult = tool.schema.safeParse(undefined);
|
|
174
|
-
if (!parseResult.success) {
|
|
175
|
-
console.error(JSON.stringify({
|
|
176
|
-
ok: false,
|
|
177
|
-
error: 'This tool requires parameters',
|
|
178
|
-
details: parseResult.error.issues,
|
|
179
|
-
}));
|
|
180
|
-
process.exit(1);
|
|
181
|
-
}
|
|
182
|
-
params = parseResult.data;
|
|
183
|
-
}
|
|
184
|
-
const result = await tool.execute(client, params);
|
|
185
|
-
console.log(JSON.stringify(result, null, 2));
|
|
186
|
-
}
|
|
187
|
-
async function main() {
|
|
188
|
-
const args = process.argv.slice(2);
|
|
189
|
-
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
190
|
-
printUsage();
|
|
191
|
-
process.exit(0);
|
|
192
|
-
}
|
|
193
|
-
if (args[0] === '--list') {
|
|
194
|
-
console.log(JSON.stringify(tools_1.allTools.map(t => ({
|
|
195
|
-
name: t.name,
|
|
196
|
-
description: t.description,
|
|
197
|
-
})), null, 2));
|
|
198
|
-
process.exit(0);
|
|
199
|
-
}
|
|
200
|
-
if (args[0] === 'init') {
|
|
201
|
-
runInit();
|
|
202
|
-
process.exit(0);
|
|
203
|
-
}
|
|
204
|
-
await runTool(args[0], args[1]);
|
|
205
|
-
}
|
|
206
|
-
main();
|
package/dist/skills.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const skillFiles: Record<string, string>;
|