@enactprotocol/shared 1.2.13 → 2.0.0

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.
Files changed (134) hide show
  1. package/README.md +44 -0
  2. package/package.json +16 -58
  3. package/src/config.ts +476 -0
  4. package/src/constants.ts +36 -0
  5. package/src/execution/command.ts +314 -0
  6. package/src/execution/index.ts +73 -0
  7. package/src/execution/runtime.ts +308 -0
  8. package/src/execution/types.ts +379 -0
  9. package/src/execution/validation.ts +508 -0
  10. package/src/index.ts +237 -30
  11. package/src/manifest/index.ts +36 -0
  12. package/src/manifest/loader.ts +187 -0
  13. package/src/manifest/parser.ts +173 -0
  14. package/src/manifest/validator.ts +309 -0
  15. package/src/paths.ts +108 -0
  16. package/src/registry.ts +219 -0
  17. package/src/resolver.ts +345 -0
  18. package/src/types/index.ts +30 -0
  19. package/src/types/manifest.ts +255 -0
  20. package/src/types.ts +5 -188
  21. package/src/utils/fs.ts +281 -0
  22. package/src/utils/logger.ts +270 -59
  23. package/src/utils/version.ts +304 -36
  24. package/tests/config.test.ts +515 -0
  25. package/tests/execution/command.test.ts +317 -0
  26. package/tests/execution/validation.test.ts +384 -0
  27. package/tests/fixtures/invalid-tool.yaml +4 -0
  28. package/tests/fixtures/valid-tool.md +62 -0
  29. package/tests/fixtures/valid-tool.yaml +40 -0
  30. package/tests/index.test.ts +8 -0
  31. package/tests/manifest/loader.test.ts +291 -0
  32. package/tests/manifest/parser.test.ts +345 -0
  33. package/tests/manifest/validator.test.ts +394 -0
  34. package/tests/manifest-types.test.ts +358 -0
  35. package/tests/paths.test.ts +153 -0
  36. package/tests/registry.test.ts +231 -0
  37. package/tests/resolver.test.ts +272 -0
  38. package/tests/utils/fs.test.ts +388 -0
  39. package/tests/utils/logger.test.ts +480 -0
  40. package/tests/utils/version.test.ts +390 -0
  41. package/tsconfig.json +12 -0
  42. package/tsconfig.tsbuildinfo +1 -0
  43. package/dist/LocalToolResolver.d.ts +0 -84
  44. package/dist/LocalToolResolver.js +0 -353
  45. package/dist/api/enact-api.d.ts +0 -130
  46. package/dist/api/enact-api.js +0 -428
  47. package/dist/api/index.d.ts +0 -2
  48. package/dist/api/index.js +0 -2
  49. package/dist/api/types.d.ts +0 -103
  50. package/dist/api/types.js +0 -1
  51. package/dist/constants.d.ts +0 -7
  52. package/dist/constants.js +0 -10
  53. package/dist/core/DaggerExecutionProvider.d.ts +0 -169
  54. package/dist/core/DaggerExecutionProvider.js +0 -1029
  55. package/dist/core/DirectExecutionProvider.d.ts +0 -23
  56. package/dist/core/DirectExecutionProvider.js +0 -406
  57. package/dist/core/EnactCore.d.ts +0 -162
  58. package/dist/core/EnactCore.js +0 -597
  59. package/dist/core/NativeExecutionProvider.d.ts +0 -9
  60. package/dist/core/NativeExecutionProvider.js +0 -16
  61. package/dist/core/index.d.ts +0 -3
  62. package/dist/core/index.js +0 -3
  63. package/dist/exec/index.d.ts +0 -3
  64. package/dist/exec/index.js +0 -3
  65. package/dist/exec/logger.d.ts +0 -11
  66. package/dist/exec/logger.js +0 -57
  67. package/dist/exec/validate.d.ts +0 -5
  68. package/dist/exec/validate.js +0 -167
  69. package/dist/index.d.ts +0 -21
  70. package/dist/index.js +0 -25
  71. package/dist/lib/enact-direct.d.ts +0 -150
  72. package/dist/lib/enact-direct.js +0 -159
  73. package/dist/lib/index.d.ts +0 -1
  74. package/dist/lib/index.js +0 -1
  75. package/dist/security/index.d.ts +0 -3
  76. package/dist/security/index.js +0 -3
  77. package/dist/security/security.d.ts +0 -23
  78. package/dist/security/security.js +0 -137
  79. package/dist/security/sign.d.ts +0 -103
  80. package/dist/security/sign.js +0 -666
  81. package/dist/security/verification-enforcer.d.ts +0 -53
  82. package/dist/security/verification-enforcer.js +0 -204
  83. package/dist/services/McpCoreService.d.ts +0 -98
  84. package/dist/services/McpCoreService.js +0 -124
  85. package/dist/services/index.d.ts +0 -1
  86. package/dist/services/index.js +0 -1
  87. package/dist/types.d.ts +0 -132
  88. package/dist/types.js +0 -3
  89. package/dist/utils/config.d.ts +0 -111
  90. package/dist/utils/config.js +0 -342
  91. package/dist/utils/env-loader.d.ts +0 -54
  92. package/dist/utils/env-loader.js +0 -270
  93. package/dist/utils/help.d.ts +0 -36
  94. package/dist/utils/help.js +0 -248
  95. package/dist/utils/index.d.ts +0 -7
  96. package/dist/utils/index.js +0 -7
  97. package/dist/utils/logger.d.ts +0 -35
  98. package/dist/utils/logger.js +0 -75
  99. package/dist/utils/silent-monitor.d.ts +0 -67
  100. package/dist/utils/silent-monitor.js +0 -242
  101. package/dist/utils/timeout.d.ts +0 -5
  102. package/dist/utils/timeout.js +0 -23
  103. package/dist/utils/version.d.ts +0 -4
  104. package/dist/utils/version.js +0 -35
  105. package/dist/web/env-manager-server.d.ts +0 -29
  106. package/dist/web/env-manager-server.js +0 -367
  107. package/dist/web/index.d.ts +0 -1
  108. package/dist/web/index.js +0 -1
  109. package/src/LocalToolResolver.ts +0 -424
  110. package/src/api/enact-api.ts +0 -604
  111. package/src/api/index.ts +0 -2
  112. package/src/api/types.ts +0 -114
  113. package/src/core/DaggerExecutionProvider.ts +0 -1357
  114. package/src/core/DirectExecutionProvider.ts +0 -484
  115. package/src/core/EnactCore.ts +0 -847
  116. package/src/core/index.ts +0 -3
  117. package/src/exec/index.ts +0 -3
  118. package/src/exec/logger.ts +0 -63
  119. package/src/exec/validate.ts +0 -238
  120. package/src/lib/enact-direct.ts +0 -254
  121. package/src/lib/index.ts +0 -1
  122. package/src/services/McpCoreService.ts +0 -201
  123. package/src/services/index.ts +0 -1
  124. package/src/utils/config.ts +0 -438
  125. package/src/utils/env-loader.ts +0 -370
  126. package/src/utils/help.ts +0 -257
  127. package/src/utils/index.ts +0 -7
  128. package/src/utils/silent-monitor.ts +0 -328
  129. package/src/utils/timeout.ts +0 -26
  130. package/src/web/env-manager-server.ts +0 -465
  131. package/src/web/index.ts +0 -1
  132. package/src/web/static/app.js +0 -663
  133. package/src/web/static/index.html +0 -117
  134. package/src/web/static/style.css +0 -291
@@ -1,370 +0,0 @@
1
- // src/utils/env-loader.ts - Environment variable loader for Enact tools with package namespace support
2
- import { join } from "path";
3
- import { homedir } from "os";
4
- import { existsSync } from "fs";
5
- import { readFile } from "fs/promises";
6
- import { config as loadDotenv } from "dotenv";
7
-
8
- interface EnvVariable {
9
- value: string;
10
- description?: string;
11
- source?: string;
12
- required?: boolean;
13
- encrypted?: boolean;
14
- createdAt: string;
15
- updatedAt: string;
16
- }
17
-
18
- interface PackageEnvConfig {
19
- variables: Record<string, EnvVariable>;
20
- }
21
-
22
- // Configuration paths
23
- const CONFIG_DIR = join(homedir(), ".enact");
24
-
25
- /**
26
- * Extract package namespace from tool name (excluding tool name)
27
- * e.g., "kgroves88/dagger/social/bluesky-poster" -> "kgroves88/dagger/social"
28
- */
29
- function extractPackageNamespace(toolName: string): string {
30
- const parts = toolName.split("/");
31
- if (parts.length < 2) {
32
- throw new Error(
33
- 'Tool name must be in format "org/package" or "org/package/tool"',
34
- );
35
- }
36
-
37
- // Use all path parts except the last one (tool name)
38
- // For tools like "kgroves88/dagger/social/bluesky-poster",
39
- // we want the package path "kgroves88/dagger/social"
40
- if (parts.length >= 2) {
41
- return parts.slice(0, -1).join("/");
42
- }
43
-
44
- return parts[0]; // fallback for edge cases
45
- }
46
-
47
- /**
48
- * Get the environment file path for a package namespace
49
- */
50
- function getPackageEnvPath(packageNamespace: string): string {
51
- return join(CONFIG_DIR, "env", packageNamespace, ".env");
52
- }
53
-
54
- /**
55
- * Simple decryption for encrypted values
56
- */
57
- function decryptValue(encryptedValue: string): string {
58
- try {
59
- return Buffer.from(encryptedValue, "base64").toString("utf8");
60
- } catch {
61
- return encryptedValue; // Return as-is if decryption fails
62
- }
63
- }
64
-
65
- /**
66
- * Read environment configuration for a package namespace
67
- */
68
- async function readPackageEnvConfig(
69
- packageNamespace: string,
70
- ): Promise<PackageEnvConfig> {
71
- const envFile = getPackageEnvPath(packageNamespace);
72
-
73
- if (!existsSync(envFile)) {
74
- return { variables: {} };
75
- }
76
-
77
- try {
78
- const data = await readFile(envFile, "utf8");
79
-
80
- // Check if it's a simple .env file (KEY=value format) or JSON
81
- if (data.trim().startsWith("{")) {
82
- // It's JSON format (legacy package-managed variables)
83
- return JSON.parse(data) as PackageEnvConfig;
84
- } else {
85
- // It's simple .env format (project mode), return empty since these are handled separately
86
- return { variables: {} };
87
- }
88
- } catch (error) {
89
- // Only warn if it's not a simple .env file parsing issue
90
- if (!(error as Error).message.includes("Unexpected token")) {
91
- console.warn(
92
- `Failed to read env config from ${envFile}: ${(error as Error).message}`,
93
- );
94
- }
95
- return { variables: {} };
96
- }
97
- }
98
-
99
- /**
100
- * Load environment variables from Enact configuration for a specific package namespace
101
- */
102
- export async function loadPackageEnvironmentVariables(
103
- packageNamespace: string,
104
- ): Promise<Record<string, string>> {
105
- const config = await readPackageEnvConfig(packageNamespace);
106
- const envVars: Record<string, string> = {};
107
-
108
- // Load variables from the package namespace
109
- for (const [name, envVar] of Object.entries(config.variables)) {
110
- const value = envVar.encrypted ? decryptValue(envVar.value) : envVar.value;
111
- envVars[name] = value;
112
- }
113
-
114
- return envVars;
115
- }
116
-
117
- /**
118
- * Load environment variables from a package-based .env file
119
- */
120
- function loadPackageEnvFile(toolName: string): Record<string, string> {
121
- if (!toolName) {
122
- return {};
123
- }
124
-
125
- try {
126
- const packageNamespace = extractPackageNamespace(toolName);
127
- const packageEnvPath = getPackageEnvPath(packageNamespace);
128
-
129
- if (!existsSync(packageEnvPath)) {
130
- return {};
131
- }
132
-
133
- // Load .env file and return the parsed variables
134
- const result = loadDotenv({ path: packageEnvPath });
135
- return result.parsed || {};
136
- } catch (error) {
137
- console.warn(
138
- `Warning: Failed to load package .env file: ${(error as Error).message}`,
139
- );
140
- return {};
141
- }
142
- }
143
-
144
- /**
145
- * Resolve environment variables for a tool definition with package namespace support
146
- * Combines system environment, Enact package configuration, and tool-specific requirements
147
- * Following the Enact protocol format:
148
- * env:
149
- * VARIABLE_NAME:
150
- * description: string
151
- * source: string
152
- * required: boolean
153
- * default: string (optional)
154
- */
155
- export async function resolveToolEnvironmentVariables(
156
- toolName: string,
157
- toolEnvConfig?: Record<string, any>,
158
- ): Promise<{
159
- resolved: Record<string, string>;
160
- missing: string[];
161
- configLink?: string;
162
- }> {
163
- // Start with system environment variables
164
- const resolved: Record<string, string> = { ...process.env } as Record<
165
- string,
166
- string
167
- >;
168
-
169
- // Load package .env file (if it exists) - priority 2
170
- const packageEnvVars = loadPackageEnvFile(toolName);
171
- Object.assign(resolved, packageEnvVars);
172
-
173
- // Load package-specific environment variables if we have a tool name - priority 3 (highest)
174
- if (toolName) {
175
- try {
176
- const packageNamespace = extractPackageNamespace(toolName);
177
- const packageJsonEnvVars =
178
- await loadPackageEnvironmentVariables(packageNamespace);
179
-
180
- // Override with package-managed JSON variables (highest priority)
181
- Object.assign(resolved, packageJsonEnvVars);
182
- } catch (error) {
183
- // If we can't extract package namespace, continue without package env vars
184
- console.warn(
185
- `Warning: Could not load package environment variables: ${(error as Error).message}`,
186
- );
187
- }
188
- }
189
-
190
- const missing: string[] = [];
191
-
192
- // Check tool-specific environment requirements following Enact protocol
193
- if (toolEnvConfig) {
194
- for (const [varName, config] of Object.entries(toolEnvConfig)) {
195
- if (typeof config === "object" && config !== null) {
196
- // Enact protocol: each env var has description, source, required, and optional default
197
- const isRequired = config.required === true;
198
- const defaultValue = config.default;
199
- const source = config.source;
200
-
201
- // Check if variable is already resolved
202
- if (!(varName in resolved) || resolved[varName] === "") {
203
- if (defaultValue !== undefined) {
204
- resolved[varName] = String(defaultValue);
205
- } else if (isRequired) {
206
- missing.push(varName);
207
- }
208
- }
209
-
210
- // Handle different sources as specified in the Enact protocol
211
- if (source && resolved[varName]) {
212
- // The source field tells us where the value should come from
213
- // For now, we'll just ensure the variable is available
214
- // In the future, this could be extended to support different sources
215
- // like "user", "system", "config", etc.
216
- }
217
- }
218
- }
219
- }
220
-
221
- // Generate and show configuration link if there are missing variables
222
- let configLink: string | undefined;
223
- if (missing.length > 0) {
224
- configLink = generateConfigLink(missing, toolName) || undefined;
225
- if (configLink) {
226
- console.log(`\n🔧 Missing environment variables: ${missing.join(", ")}`);
227
- console.log(`📋 Configure them here: ${configLink}\n`);
228
- } else {
229
- console.log(
230
- `\n⚠️ Missing required environment variables: ${missing.join(", ")}`,
231
- );
232
- console.log(
233
- `💡 Set them using the 'enact env set' command or your system environment\n`,
234
- );
235
- }
236
- }
237
-
238
- return { resolved, missing, configLink };
239
- }
240
-
241
- /**
242
- * Get available environment variables for a package namespace
243
- */
244
- export async function getPackageEnvironmentVariables(
245
- packageNamespace: string,
246
- ): Promise<{
247
- package: Record<
248
- string,
249
- { value: string; encrypted: boolean; description?: string }
250
- >;
251
- system: Record<string, string>;
252
- }> {
253
- const packageConfig = await readPackageEnvConfig(packageNamespace);
254
-
255
- const packageVars: Record<
256
- string,
257
- { value: string; encrypted: boolean; description?: string }
258
- > = {};
259
-
260
- // Process package variables
261
- for (const [name, envVar] of Object.entries(packageConfig.variables)) {
262
- packageVars[name] = {
263
- value: envVar.encrypted ? "[encrypted]" : envVar.value,
264
- encrypted: envVar.encrypted || false,
265
- description: envVar.description,
266
- };
267
- }
268
-
269
- // System environment variables (filtered to avoid exposing sensitive data)
270
- const system = Object.fromEntries(
271
- Object.entries(process.env)
272
- .filter(
273
- ([key]) =>
274
- // Only include environment variables that look like they might be relevant for tools
275
- key.includes("API") ||
276
- key.includes("TOKEN") ||
277
- key.includes("KEY") ||
278
- key.includes("URL") ||
279
- key.includes("HOST") ||
280
- key.includes("PORT") ||
281
- key.startsWith("ENACT_") ||
282
- key.startsWith("NODE_") ||
283
- key.startsWith("NPM_"),
284
- )
285
- .map(([key, value]) => [key, value || ""]),
286
- );
287
-
288
- return { package: packageVars, system };
289
- }
290
-
291
- /**
292
- * Validate that all required environment variables are available
293
- * Following the Enact protocol format for environment variables
294
- */
295
- export function validateRequiredEnvironmentVariables(
296
- toolEnvConfig: Record<string, any> | undefined,
297
- availableVars: Record<string, string>,
298
- ): { valid: boolean; missing: string[]; errors: string[] } {
299
- const missing: string[] = [];
300
- const errors: string[] = [];
301
-
302
- if (!toolEnvConfig) {
303
- return { valid: true, missing, errors };
304
- }
305
-
306
- for (const [varName, config] of Object.entries(toolEnvConfig)) {
307
- if (typeof config === "object" && config !== null) {
308
- // Enact protocol: description, source, required are all required fields
309
- // default is optional
310
- const isRequired = config.required === true;
311
- const hasDefault = config.default !== undefined;
312
- const description = config.description || "";
313
- const source = config.source || "";
314
-
315
- if (
316
- isRequired &&
317
- !hasDefault &&
318
- (!(varName in availableVars) || availableVars[varName] === "")
319
- ) {
320
- missing.push(varName);
321
- const errorMsg = `Required environment variable '${varName}' is not set`;
322
- const detailMsg = description ? ` - ${description}` : "";
323
- const sourceMsg = source ? ` (source: ${source})` : "";
324
- errors.push(`${errorMsg}${detailMsg}${sourceMsg}`);
325
- }
326
- }
327
- }
328
-
329
- return {
330
- valid: missing.length === 0,
331
- missing,
332
- errors,
333
- };
334
- }
335
-
336
- // Export the package namespace extraction function for use in other modules
337
- export { extractPackageNamespace };
338
-
339
- // Load .env file if it exists
340
- loadDotenv();
341
-
342
- /**
343
- * Get the web server URL if it's running
344
- */
345
- export function getWebServerUrl(): string | null {
346
- // For now, default to localhost:5555 as that's the standard port
347
- // When running via MCP (npx -p @enactprotocol/cli enact-mcp), the web server is automatically started
348
- // TODO: In the future, we could check if the server is actually responding or get the port dynamically
349
- return "http://localhost:5555";
350
- }
351
-
352
- /**
353
- * Generate a configuration link for missing environment variables
354
- */
355
- export function generateConfigLink(
356
- missingVars: string[],
357
- toolName: string,
358
- ): string | null {
359
- const webUrl = getWebServerUrl();
360
- if (!webUrl) {
361
- return null;
362
- }
363
-
364
- // Extract package namespace from tool name (exclude tool name itself)
365
- const packageNamespace = extractPackageNamespace(toolName);
366
-
367
- const encodedVars = encodeURIComponent(JSON.stringify(missingVars));
368
- const encodedPackage = encodeURIComponent(packageNamespace);
369
- return `${webUrl}/?vars=${encodedVars}&package=${encodedPackage}`;
370
- }
package/src/utils/help.ts DELETED
@@ -1,257 +0,0 @@
1
- // src/utils/help.ts
2
- import pc from "picocolors";
3
- import { readFileSync } from "fs";
4
- import { join } from "path";
5
-
6
- /**
7
- * Get the package version from package.json
8
- */
9
- function getVersion(): string {
10
- try {
11
- const packageJsonPath = join(__dirname, "../../package.json");
12
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
13
- return packageJson.version || "0.1.0";
14
- } catch (error) {
15
- // Fallback version if package.json can't be read
16
- return "0.1.0";
17
- }
18
- }
19
-
20
- /**
21
- * Show the main help message
22
- */
23
- export function showHelp(): void {
24
- const version = getVersion();
25
- console.error(`
26
- ${pc.bold("Enact CLI")} ${pc.dim(`v${version}`)}
27
- ${pc.dim("A CLI tool for managing and publishing Enact tools")}
28
-
29
- ${pc.bold("Usage:")}
30
- ${pc.cyan("enact")} ${pc.green("<command>")} [options]
31
-
32
- ${pc.bold("Commands:")}
33
- ${pc.green("auth")} Manage authentication (login, logout, status, token)
34
- ${pc.green("env")} Manage environment variables (set, get, list, delete)
35
- ${pc.green("exec")} Execute a tool by fetching and running it
36
- ${pc.green("init")} Create a new tool definition
37
- ${pc.green("mcp")} MCP client integration (install, list, status)
38
- ${pc.green("publish")} Publish a tool to the registry
39
- ${pc.green("search")} Search for tools in the registry
40
- ${pc.green("sign")} Sign and verify tools with cryptographic signatures
41
- ${pc.green("remote")} Manage remote servers (add, list, remove)
42
- ${pc.green("user")} User operations (get public key)
43
-
44
- ${pc.bold("Global Options:")}
45
- ${pc.yellow("--help, -h")} Show help message
46
- ${pc.yellow("--version, -v")} Show version information
47
-
48
- ${pc.bold("Examples:")}
49
- ${pc.cyan("enact")} ${pc.dim("# Interactive mode")}
50
- ${pc.cyan("enact")} ${pc.green("search")} ${pc.yellow("--tags")} web,api ${pc.dim("# Search tools by tags")}
51
- ${pc.cyan("enact")} ${pc.green("exec")} enact/text/slugify ${pc.dim("# Execute a tool")}
52
- ${pc.cyan("enact")} ${pc.green("mcp")} install ${pc.yellow("--client")} claude-desktop ${pc.dim("# Install MCP server")}
53
- ${pc.cyan("enact")} ${pc.green("mcp")} install ${pc.yellow("--client")} goose ${pc.dim("# Install for Goose AI")}
54
- ${pc.cyan("enact")} ${pc.green("env")} set API_KEY --encrypt ${pc.dim("# Set encrypted env var")}
55
- ${pc.cyan("enact")} ${pc.green("sign")} verify my-tool.yaml ${pc.dim("# Verify tool signatures")}
56
- ${pc.cyan("enact")} ${pc.green("publish")} my-tool.yaml ${pc.dim("# Publish a tool")}
57
- ${pc.cyan("enact")} ${pc.green("auth")} login ${pc.dim("# Login with OAuth")}
58
- ${pc.cyan("enact")} ${pc.green("init")} ${pc.yellow("--minimal")} ${pc.dim("# Create minimal tool template")}
59
-
60
- ${pc.bold("More Help:")}
61
- ${pc.cyan("enact")} ${pc.green("<command>")} ${pc.yellow("--help")} ${pc.dim("# Show command-specific help")}
62
- `);
63
- }
64
-
65
- /**
66
- * Show version information
67
- */
68
- export function showVersion(): void {
69
- const version = getVersion();
70
- console.error(`@enactprotocol/cli v${version}`);
71
- }
72
-
73
- /**
74
- * Show help for the auth command
75
- */
76
- export function showAuthHelp(): void {
77
- console.error(`
78
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("auth")} ${pc.blue("<subcommand>")} [options]
79
-
80
- ${pc.bold("Manage authentication for Enact registry")}
81
-
82
- ${pc.bold("Subcommands:")}
83
- ${pc.blue("login")} Login using OAuth
84
- ${pc.blue("logout")} Logout and clear stored credentials
85
- ${pc.blue("status")} Check authentication status
86
- ${pc.blue("token")} Display current authentication token
87
-
88
- ${pc.bold("Options:")}
89
- ${pc.yellow("--help, -h")} Show this help message
90
- ${pc.yellow("--server, -s")} Specify server URL
91
- ${pc.yellow("--port, -p")} Specify port for OAuth callback
92
-
93
- ${pc.bold("Examples:")}
94
- ${pc.cyan("enact")} ${pc.green("auth")} ${pc.blue("login")}
95
- ${pc.cyan("enact")} ${pc.green("auth")} ${pc.blue("status")}
96
- ${pc.cyan("enact")} ${pc.green("auth")} ${pc.blue("login")} ${pc.yellow("--server")} https://api.example.com
97
- `);
98
- }
99
-
100
- /**
101
- * Show help for the init command
102
- */
103
- export function showInitHelp(): void {
104
- console.error(`
105
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("init")} [options] [name]
106
-
107
- ${pc.bold("Create a new tool definition file")}
108
-
109
- ${pc.bold("Arguments:")}
110
- ${pc.blue("name")} Name for the new tool (optional)
111
-
112
- ${pc.bold("Options:")}
113
- ${pc.yellow("--help, -h")} Show this help message
114
- ${pc.yellow("--minimal, -m")} Create a minimal tool template
115
-
116
- ${pc.bold("Examples:")}
117
- ${pc.cyan("enact")} ${pc.green("init")}
118
- ${pc.cyan("enact")} ${pc.green("init")} my-awesome-tool
119
- ${pc.cyan("enact")} ${pc.green("init")} ${pc.yellow("--minimal")} simple-tool
120
- `);
121
- }
122
-
123
- /**
124
- * Show help for the publish command
125
- */
126
- export function showPublishHelp(): void {
127
- console.error(`
128
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("publish")} [options] [file]
129
-
130
- ${pc.bold("Publish a tool to the Enact registry")}
131
-
132
- ${pc.bold("Arguments:")}
133
- ${pc.blue("file")} The tool definition file to publish (YAML format)
134
-
135
- ${pc.bold("Options:")}
136
- ${pc.yellow("--help, -h")} Show this help message
137
- ${pc.yellow("--url")} Specify the registry URL
138
- ${pc.yellow("--token, -t")} Specify authentication token
139
-
140
- ${pc.bold("Examples:")}
141
- ${pc.cyan("enact")} ${pc.green("publish")} my-tool.yaml
142
- ${pc.cyan("enact")} ${pc.green("publish")} ${pc.yellow("--url")} https://registry.example.com my-tool.yaml
143
- ${pc.cyan("enact")} ${pc.green("publish")} ${pc.yellow("--token")} abc123 my-tool.yaml
144
- `);
145
- }
146
-
147
- /**
148
- * Show help for the search command
149
- */
150
- export function showSearchHelp(): void {
151
- console.error(`
152
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("search")} [options] [query]
153
-
154
- ${pc.bold("Search for tools in the Enact registry")}
155
-
156
- ${pc.bold("Arguments:")}
157
- ${pc.blue("query")} Search query (optional)
158
-
159
- ${pc.bold("Options:")}
160
- ${pc.yellow("--help, -h")} Show this help message
161
- ${pc.yellow("--limit, -l")} Limit number of results (default: 20)
162
- ${pc.yellow("--tags")} Filter by tags (comma-separated)
163
- ${pc.yellow("--author, -a")} Filter by author
164
- ${pc.yellow("--format, -f")} Output format (table, json, minimal)
165
-
166
- ${pc.bold("Examples:")}
167
- ${pc.cyan("enact")} ${pc.green("search")}
168
- ${pc.cyan("enact")} ${pc.green("search")} "web scraper"
169
- ${pc.cyan("enact")} ${pc.green("search")} ${pc.yellow("--tags")} web,api ${pc.yellow("--limit")} 10
170
- ${pc.cyan("enact")} ${pc.green("search")} ${pc.yellow("--author")} johndoe ${pc.yellow("--format")} json
171
- `);
172
- }
173
-
174
- /**
175
- * Show help for the remote command
176
- */
177
- export function showRemoteHelp(): void {
178
- console.error(`
179
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("remote")} ${pc.blue("<subcommand>")} [options]
180
-
181
- ${pc.bold("Manage remote Enact registry servers")}
182
-
183
- ${pc.bold("Subcommands:")}
184
- ${pc.blue("add")} Add a new remote server
185
- ${pc.blue("list")} List all configured remote servers
186
- ${pc.blue("remove")} Remove a remote server
187
-
188
- ${pc.bold("Options:")}
189
- ${pc.yellow("--help, -h")} Show this help message
190
-
191
- ${pc.bold("Examples:")}
192
- ${pc.cyan("enact")} ${pc.green("remote")} ${pc.blue("add")}
193
- ${pc.cyan("enact")} ${pc.green("remote")} ${pc.blue("list")}
194
- ${pc.cyan("enact")} ${pc.green("remote")} ${pc.blue("remove")} origin
195
- `);
196
- }
197
-
198
- /**
199
- * Show help for the user command
200
- */
201
- export function showUserHelp(): void {
202
- console.error(`
203
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("user")} ${pc.blue("<subcommand>")} [options]
204
-
205
- ${pc.bold("User operations for Enact registry")}
206
-
207
- ${pc.bold("Subcommands:")}
208
- ${pc.blue("public-key")} Get user's public key
209
-
210
- ${pc.bold("Options:")}
211
- ${pc.yellow("--help, -h")} Show this help message
212
- ${pc.yellow("--server, -s")} Specify server URL
213
- ${pc.yellow("--token, -t")} Specify authentication token
214
- ${pc.yellow("--format, -f")} Output format (default, json)
215
-
216
- ${pc.bold("Examples:")}
217
- ${pc.cyan("enact")} ${pc.green("user")} ${pc.blue("public-key")}
218
- ${pc.cyan("enact")} ${pc.green("user")} ${pc.blue("public-key")} ${pc.yellow("--format")} json
219
- ${pc.cyan("enact")} ${pc.green("user")} ${pc.blue("public-key")} ${pc.yellow("--server")} https://api.example.com
220
- `);
221
- }
222
-
223
- /**
224
- * Show help for the env command
225
- */
226
- export function showEnvHelp(): void {
227
- console.error(`
228
- ${pc.bold("Usage:")} ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("<subcommand>")} [options]
229
-
230
- ${pc.bold("Environment variable management for Enact CLI")}
231
-
232
- ${pc.bold("Subcommands:")}
233
- ${pc.blue("set")} ${pc.magenta("<name>")} [value] Set an environment variable
234
- ${pc.blue("get")} ${pc.magenta("<name>")} Get an environment variable
235
- ${pc.blue("list")} List all environment variables
236
- ${pc.blue("delete")} ${pc.magenta("<name>")} Delete an environment variable
237
- ${pc.blue("copy")} ${pc.magenta("<from>")} ${pc.magenta("<to>")} Copy variables between scopes
238
- ${pc.blue("export")} [format] Export variables (env|json|yaml)
239
- ${pc.blue("clear")} Clear all environment variables
240
-
241
- ${pc.bold("Options:")}
242
- ${pc.yellow("--help, -h")} Show this help message
243
- ${pc.yellow("--global")} Use global scope (default)
244
- ${pc.yellow("--project")} Use project scope
245
- ${pc.yellow("--encrypt")} Encrypt sensitive values
246
- ${pc.yellow("--format")} Output format (table|json)
247
- ${pc.yellow("--show")} Show actual values (default: hidden)
248
-
249
- ${pc.bold("Examples:")}
250
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("set")} OPENAI_API_KEY ${pc.yellow("--encrypt")}
251
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("set")} DATABASE_URL postgres://... ${pc.yellow("--project")}
252
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("get")} OPENAI_API_KEY ${pc.yellow("--show")}
253
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("list")} ${pc.yellow("--project")} ${pc.yellow("--format")} json
254
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("copy")} global project
255
- ${pc.cyan("enact")} ${pc.green("env")} ${pc.blue("export")} env > .env
256
- `);
257
- }
@@ -1,7 +0,0 @@
1
- export * from './config';
2
- export * from './env-loader';
3
- export { showHelp } from './help';
4
- export * from './logger';
5
- export * from './silent-monitor';
6
- export * from './timeout';
7
- export { showVersion } from './version';