@enactprotocol/cli 2.1.6 → 2.1.7
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/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +82 -54
- package/dist/commands/init/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/init/index.ts +94 -58
- package/src/index.ts +1 -1
- package/tests/commands/init.test.ts +199 -12
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAynBzC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB3D"}
|
|
@@ -408,6 +408,26 @@ function loadTemplate(templateName, replacements = {}) {
|
|
|
408
408
|
}
|
|
409
409
|
return content;
|
|
410
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Create .enact/tools.json for project tool tracking
|
|
413
|
+
*/
|
|
414
|
+
function createEnactProjectDir(targetDir, force) {
|
|
415
|
+
const enactDir = join(targetDir, ".enact");
|
|
416
|
+
const toolsJsonPath = join(enactDir, "tools.json");
|
|
417
|
+
// Check if tools.json already exists
|
|
418
|
+
if (existsSync(toolsJsonPath) && !force) {
|
|
419
|
+
info(".enact/tools.json already exists, skipping");
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
// Create .enact directory if it doesn't exist
|
|
423
|
+
if (!existsSync(enactDir)) {
|
|
424
|
+
mkdirSync(enactDir, { recursive: true });
|
|
425
|
+
}
|
|
426
|
+
// Write empty tools.json
|
|
427
|
+
const toolsJson = { tools: {} };
|
|
428
|
+
writeFileSync(toolsJsonPath, `${JSON.stringify(toolsJson, null, 2)}\n`, "utf-8");
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
411
431
|
/**
|
|
412
432
|
* Get the current logged-in username
|
|
413
433
|
*/
|
|
@@ -471,23 +491,57 @@ async function getCurrentUsername() {
|
|
|
471
491
|
*/
|
|
472
492
|
async function initHandler(options, ctx) {
|
|
473
493
|
const targetDir = ctx.cwd;
|
|
474
|
-
// Determine mode: --
|
|
475
|
-
const
|
|
494
|
+
// Determine mode: --tool, --claude, or --agent (default)
|
|
495
|
+
const isToolMode = options.tool;
|
|
476
496
|
const isClaudeMode = options.claude;
|
|
477
|
-
// Default to
|
|
478
|
-
// Handle --
|
|
479
|
-
if (
|
|
497
|
+
// Default to agent mode if no flag specified
|
|
498
|
+
// Handle --tool mode: create enact.md + AGENTS.md for tool development
|
|
499
|
+
if (isToolMode) {
|
|
500
|
+
const manifestPath = join(targetDir, "enact.md");
|
|
480
501
|
const agentsPath = join(targetDir, "AGENTS.md");
|
|
481
|
-
if (existsSync(
|
|
482
|
-
warning(`
|
|
502
|
+
if (existsSync(manifestPath) && !options.force) {
|
|
503
|
+
warning(`Tool manifest already exists at: ${manifestPath}`);
|
|
483
504
|
info("Use --force to overwrite");
|
|
484
505
|
return;
|
|
485
506
|
}
|
|
486
|
-
|
|
487
|
-
|
|
507
|
+
// Get username for the tool name
|
|
508
|
+
let toolName = options.name;
|
|
509
|
+
if (!toolName) {
|
|
510
|
+
const username = await getCurrentUsername();
|
|
511
|
+
if (username) {
|
|
512
|
+
toolName = `${username}/my-tool`;
|
|
513
|
+
info(`Using logged-in username: ${username}`);
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
toolName = "my-tool";
|
|
517
|
+
info("Not logged in - using generic tool name");
|
|
518
|
+
info("Run 'enact auth login' to use your username in tool names");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Load templates with placeholder replacement
|
|
522
|
+
const replacements = { TOOL_NAME: toolName };
|
|
523
|
+
const manifestContent = loadTemplate("tool-enact.md", replacements);
|
|
524
|
+
const agentsContent = loadTemplate("tool-agents.md", replacements);
|
|
525
|
+
// Ensure directory exists
|
|
526
|
+
if (!existsSync(targetDir)) {
|
|
527
|
+
mkdirSync(targetDir, { recursive: true });
|
|
528
|
+
}
|
|
529
|
+
// Write enact.md
|
|
530
|
+
writeFileSync(manifestPath, manifestContent, "utf-8");
|
|
531
|
+
success(`Created tool manifest: ${manifestPath}`);
|
|
532
|
+
// Write AGENTS.md (only if it doesn't exist or --force is used)
|
|
533
|
+
if (!existsSync(agentsPath) || options.force) {
|
|
534
|
+
writeFileSync(agentsPath, agentsContent, "utf-8");
|
|
535
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
info("AGENTS.md already exists, skipping (use --force to overwrite)");
|
|
539
|
+
}
|
|
488
540
|
info("");
|
|
489
|
-
info("
|
|
490
|
-
info("
|
|
541
|
+
info("Next steps:");
|
|
542
|
+
info(" 1. Edit enact.md to customize your tool");
|
|
543
|
+
info(" 2. Run 'enact run ./' to test your tool");
|
|
544
|
+
info(" 3. Run 'enact publish' to share your tool");
|
|
491
545
|
return;
|
|
492
546
|
}
|
|
493
547
|
// Handle --claude mode: create CLAUDE.md
|
|
@@ -500,56 +554,30 @@ async function initHandler(options, ctx) {
|
|
|
500
554
|
}
|
|
501
555
|
writeFileSync(claudePath, loadTemplate("claude.md"), "utf-8");
|
|
502
556
|
success(`Created CLAUDE.md: ${claudePath}`);
|
|
557
|
+
// Create .enact/tools.json
|
|
558
|
+
if (createEnactProjectDir(targetDir, options.force ?? false)) {
|
|
559
|
+
success("Created .enact/tools.json");
|
|
560
|
+
}
|
|
503
561
|
info("");
|
|
504
562
|
info("This file helps Claude understand how to use Enact tools in your project.");
|
|
505
563
|
return;
|
|
506
564
|
}
|
|
507
|
-
// Handle
|
|
508
|
-
const manifestPath = join(targetDir, "enact.md");
|
|
565
|
+
// Handle default (agent) mode: create AGENTS.md for projects using Enact tools
|
|
509
566
|
const agentsPath = join(targetDir, "AGENTS.md");
|
|
510
|
-
if (existsSync(
|
|
511
|
-
warning(`
|
|
567
|
+
if (existsSync(agentsPath) && !options.force) {
|
|
568
|
+
warning(`AGENTS.md already exists at: ${agentsPath}`);
|
|
512
569
|
info("Use --force to overwrite");
|
|
513
570
|
return;
|
|
514
571
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
toolName = `${username}/my-tool`;
|
|
521
|
-
info(`Using logged-in username: ${username}`);
|
|
522
|
-
}
|
|
523
|
-
else {
|
|
524
|
-
toolName = "my-tool";
|
|
525
|
-
info("Not logged in - using generic tool name");
|
|
526
|
-
info("Run 'enact auth login' to use your username in tool names");
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
// Load templates with placeholder replacement
|
|
530
|
-
const replacements = { TOOL_NAME: toolName };
|
|
531
|
-
const manifestContent = loadTemplate("tool-enact.md", replacements);
|
|
532
|
-
const agentsContent = loadTemplate("tool-agents.md", replacements);
|
|
533
|
-
// Ensure directory exists
|
|
534
|
-
if (!existsSync(targetDir)) {
|
|
535
|
-
mkdirSync(targetDir, { recursive: true });
|
|
536
|
-
}
|
|
537
|
-
// Write enact.md
|
|
538
|
-
writeFileSync(manifestPath, manifestContent, "utf-8");
|
|
539
|
-
success(`Created tool manifest: ${manifestPath}`);
|
|
540
|
-
// Write AGENTS.md (only if it doesn't exist or --force is used)
|
|
541
|
-
if (!existsSync(agentsPath) || options.force) {
|
|
542
|
-
writeFileSync(agentsPath, agentsContent, "utf-8");
|
|
543
|
-
success(`Created AGENTS.md: ${agentsPath}`);
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
info("AGENTS.md already exists, skipping (use --force to overwrite)");
|
|
572
|
+
writeFileSync(agentsPath, loadTemplate("agent-agents.md"), "utf-8");
|
|
573
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
574
|
+
// Create .enact/tools.json
|
|
575
|
+
if (createEnactProjectDir(targetDir, options.force ?? false)) {
|
|
576
|
+
success("Created .enact/tools.json");
|
|
547
577
|
}
|
|
548
578
|
info("");
|
|
549
|
-
info("
|
|
550
|
-
info("
|
|
551
|
-
info(" 2. Run 'enact run ./' to test your tool");
|
|
552
|
-
info(" 3. Run 'enact publish' to share your tool");
|
|
579
|
+
info("This file helps AI agents understand how to use Enact tools in your project.");
|
|
580
|
+
info("Run 'enact search <query>' to find tools, 'enact install <tool>' to add them.");
|
|
553
581
|
}
|
|
554
582
|
/**
|
|
555
583
|
* Configure the init command
|
|
@@ -560,9 +588,9 @@ export function configureInitCommand(program) {
|
|
|
560
588
|
.description("Initialize Enact in the current directory")
|
|
561
589
|
.option("-n, --name <name>", "Tool name (default: username/my-tool)")
|
|
562
590
|
.option("-f, --force", "Overwrite existing files")
|
|
563
|
-
.option("--tool", "Create a new Enact tool (
|
|
564
|
-
.option("--agent", "Create AGENTS.md
|
|
565
|
-
.option("--claude", "Create CLAUDE.md
|
|
591
|
+
.option("--tool", "Create a new Enact tool (enact.md + AGENTS.md)")
|
|
592
|
+
.option("--agent", "Create AGENTS.md + .enact/tools.json (default)")
|
|
593
|
+
.option("--claude", "Create CLAUDE.md + .enact/tools.json")
|
|
566
594
|
.option("-v, --verbose", "Show detailed output")
|
|
567
595
|
.action(async (options) => {
|
|
568
596
|
const ctx = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAA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AC;IAED,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,8EAA8E,CAAC,CAAC;IACrF,IAAI,CAAC,+EAA+E,CAAC,CAAC;AACxF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,mBAAmB,EAAE,uCAAuC,CAAC;SACpE,MAAM,CAAC,aAAa,EAAE,0BAA0B,CAAC;SACjD,MAAM,CAAC,QAAQ,EAAE,gDAAgD,CAAC;SAClE,MAAM,CAAC,SAAS,EAAE,gDAAgD,CAAC;SACnE,MAAM,CAAC,UAAU,EAAE,sCAAsC,CAAC;SAC1D,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC;SAC/C,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;QACrC,MAAM,GAAG,GAAmB;YAC1B,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK;SAC7C,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Command-line interface for Enact.
|
|
6
6
|
* User-facing commands for tool execution, discovery, and management.
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "2.1.
|
|
8
|
+
export declare const version = "2.1.7";
|
|
9
9
|
export type { GlobalOptions, CommandContext } from "./types";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ensureGlobalSetup } from "@enactprotocol/shared";
|
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
import { configureAuthCommand, configureCacheCommand, configureConfigCommand, configureEnvCommand, configureExecCommand, configureGetCommand, configureInitCommand, configureInspectCommand, configureInstallCommand, configureLearnCommand, configureListCommand, configurePublishCommand, configureReportCommand, configureRunCommand, configureSearchCommand, configureSetupCommand, configureSignCommand, configureTrustCommand, configureUnyankCommand, configureYankCommand, } from "./commands";
|
|
11
11
|
import { error, formatError } from "./utils";
|
|
12
|
-
export const version = "2.1.
|
|
12
|
+
export const version = "2.1.7";
|
|
13
13
|
// Main CLI entry point
|
|
14
14
|
async function main() {
|
|
15
15
|
// Ensure global setup is complete on first run
|
|
@@ -18,7 +18,7 @@ async function main() {
|
|
|
18
18
|
program
|
|
19
19
|
.name("enact")
|
|
20
20
|
.description("Enact - Verified, portable protocol for AI-executable tools")
|
|
21
|
-
.version(version, "-v,
|
|
21
|
+
.version(version, "-v, --version", "output the version number");
|
|
22
22
|
// Configure all commands
|
|
23
23
|
configureSetupCommand(program);
|
|
24
24
|
configureInitCommand(program);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACv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AAI,KAAK,kCAAkC;YAC/C,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EACnC,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,iEAAiE;QACjE,MAAM,MAAM,GAAG,GAA0C,CAAC;QAC1D,IAAI,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,IAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enactprotocol/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Command-line interface for Enact - the npm for AI tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^0.11.0",
|
|
37
|
-
"@enactprotocol/api": "2.1.
|
|
38
|
-
"@enactprotocol/execution": "2.1.
|
|
39
|
-
"@enactprotocol/secrets": "2.1.
|
|
40
|
-
"@enactprotocol/shared": "2.1.
|
|
37
|
+
"@enactprotocol/api": "2.1.7",
|
|
38
|
+
"@enactprotocol/execution": "2.1.7",
|
|
39
|
+
"@enactprotocol/secrets": "2.1.7",
|
|
40
|
+
"@enactprotocol/shared": "2.1.7",
|
|
41
41
|
"commander": "^12.1.0",
|
|
42
42
|
"picocolors": "^1.1.1"
|
|
43
43
|
},
|
|
@@ -430,6 +430,30 @@ function loadTemplate(templateName: string, replacements: Record<string, string>
|
|
|
430
430
|
return content;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Create .enact/tools.json for project tool tracking
|
|
435
|
+
*/
|
|
436
|
+
function createEnactProjectDir(targetDir: string, force: boolean): boolean {
|
|
437
|
+
const enactDir = join(targetDir, ".enact");
|
|
438
|
+
const toolsJsonPath = join(enactDir, "tools.json");
|
|
439
|
+
|
|
440
|
+
// Check if tools.json already exists
|
|
441
|
+
if (existsSync(toolsJsonPath) && !force) {
|
|
442
|
+
info(".enact/tools.json already exists, skipping");
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Create .enact directory if it doesn't exist
|
|
447
|
+
if (!existsSync(enactDir)) {
|
|
448
|
+
mkdirSync(enactDir, { recursive: true });
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Write empty tools.json
|
|
452
|
+
const toolsJson = { tools: {} };
|
|
453
|
+
writeFileSync(toolsJsonPath, `${JSON.stringify(toolsJson, null, 2)}\n`, "utf-8");
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
|
|
433
457
|
/**
|
|
434
458
|
* Get the current logged-in username
|
|
435
459
|
*/
|
|
@@ -514,24 +538,64 @@ async function getCurrentUsername(): Promise<string | null> {
|
|
|
514
538
|
async function initHandler(options: InitOptions, ctx: CommandContext): Promise<void> {
|
|
515
539
|
const targetDir = ctx.cwd;
|
|
516
540
|
|
|
517
|
-
// Determine mode: --
|
|
518
|
-
const
|
|
541
|
+
// Determine mode: --tool, --claude, or --agent (default)
|
|
542
|
+
const isToolMode = options.tool;
|
|
519
543
|
const isClaudeMode = options.claude;
|
|
520
|
-
// Default to
|
|
544
|
+
// Default to agent mode if no flag specified
|
|
521
545
|
|
|
522
|
-
// Handle --
|
|
523
|
-
if (
|
|
546
|
+
// Handle --tool mode: create enact.md + AGENTS.md for tool development
|
|
547
|
+
if (isToolMode) {
|
|
548
|
+
const manifestPath = join(targetDir, "enact.md");
|
|
524
549
|
const agentsPath = join(targetDir, "AGENTS.md");
|
|
525
|
-
|
|
526
|
-
|
|
550
|
+
|
|
551
|
+
if (existsSync(manifestPath) && !options.force) {
|
|
552
|
+
warning(`Tool manifest already exists at: ${manifestPath}`);
|
|
527
553
|
info("Use --force to overwrite");
|
|
528
554
|
return;
|
|
529
555
|
}
|
|
530
|
-
|
|
531
|
-
|
|
556
|
+
|
|
557
|
+
// Get username for the tool name
|
|
558
|
+
let toolName = options.name;
|
|
559
|
+
|
|
560
|
+
if (!toolName) {
|
|
561
|
+
const username = await getCurrentUsername();
|
|
562
|
+
if (username) {
|
|
563
|
+
toolName = `${username}/my-tool`;
|
|
564
|
+
info(`Using logged-in username: ${username}`);
|
|
565
|
+
} else {
|
|
566
|
+
toolName = "my-tool";
|
|
567
|
+
info("Not logged in - using generic tool name");
|
|
568
|
+
info("Run 'enact auth login' to use your username in tool names");
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Load templates with placeholder replacement
|
|
573
|
+
const replacements = { TOOL_NAME: toolName };
|
|
574
|
+
const manifestContent = loadTemplate("tool-enact.md", replacements);
|
|
575
|
+
const agentsContent = loadTemplate("tool-agents.md", replacements);
|
|
576
|
+
|
|
577
|
+
// Ensure directory exists
|
|
578
|
+
if (!existsSync(targetDir)) {
|
|
579
|
+
mkdirSync(targetDir, { recursive: true });
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Write enact.md
|
|
583
|
+
writeFileSync(manifestPath, manifestContent, "utf-8");
|
|
584
|
+
success(`Created tool manifest: ${manifestPath}`);
|
|
585
|
+
|
|
586
|
+
// Write AGENTS.md (only if it doesn't exist or --force is used)
|
|
587
|
+
if (!existsSync(agentsPath) || options.force) {
|
|
588
|
+
writeFileSync(agentsPath, agentsContent, "utf-8");
|
|
589
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
590
|
+
} else {
|
|
591
|
+
info("AGENTS.md already exists, skipping (use --force to overwrite)");
|
|
592
|
+
}
|
|
593
|
+
|
|
532
594
|
info("");
|
|
533
|
-
info("
|
|
534
|
-
info("
|
|
595
|
+
info("Next steps:");
|
|
596
|
+
info(" 1. Edit enact.md to customize your tool");
|
|
597
|
+
info(" 2. Run 'enact run ./' to test your tool");
|
|
598
|
+
info(" 3. Run 'enact publish' to share your tool");
|
|
535
599
|
return;
|
|
536
600
|
}
|
|
537
601
|
|
|
@@ -545,63 +609,35 @@ async function initHandler(options: InitOptions, ctx: CommandContext): Promise<v
|
|
|
545
609
|
}
|
|
546
610
|
writeFileSync(claudePath, loadTemplate("claude.md"), "utf-8");
|
|
547
611
|
success(`Created CLAUDE.md: ${claudePath}`);
|
|
612
|
+
|
|
613
|
+
// Create .enact/tools.json
|
|
614
|
+
if (createEnactProjectDir(targetDir, options.force ?? false)) {
|
|
615
|
+
success("Created .enact/tools.json");
|
|
616
|
+
}
|
|
617
|
+
|
|
548
618
|
info("");
|
|
549
619
|
info("This file helps Claude understand how to use Enact tools in your project.");
|
|
550
620
|
return;
|
|
551
621
|
}
|
|
552
622
|
|
|
553
|
-
// Handle
|
|
554
|
-
const manifestPath = join(targetDir, "enact.md");
|
|
623
|
+
// Handle default (agent) mode: create AGENTS.md for projects using Enact tools
|
|
555
624
|
const agentsPath = join(targetDir, "AGENTS.md");
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
warning(`Tool manifest already exists at: ${manifestPath}`);
|
|
625
|
+
if (existsSync(agentsPath) && !options.force) {
|
|
626
|
+
warning(`AGENTS.md already exists at: ${agentsPath}`);
|
|
559
627
|
info("Use --force to overwrite");
|
|
560
628
|
return;
|
|
561
629
|
}
|
|
630
|
+
writeFileSync(agentsPath, loadTemplate("agent-agents.md"), "utf-8");
|
|
631
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
562
632
|
|
|
563
|
-
//
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
if (!toolName) {
|
|
567
|
-
const username = await getCurrentUsername();
|
|
568
|
-
if (username) {
|
|
569
|
-
toolName = `${username}/my-tool`;
|
|
570
|
-
info(`Using logged-in username: ${username}`);
|
|
571
|
-
} else {
|
|
572
|
-
toolName = "my-tool";
|
|
573
|
-
info("Not logged in - using generic tool name");
|
|
574
|
-
info("Run 'enact auth login' to use your username in tool names");
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// Load templates with placeholder replacement
|
|
579
|
-
const replacements = { TOOL_NAME: toolName };
|
|
580
|
-
const manifestContent = loadTemplate("tool-enact.md", replacements);
|
|
581
|
-
const agentsContent = loadTemplate("tool-agents.md", replacements);
|
|
582
|
-
|
|
583
|
-
// Ensure directory exists
|
|
584
|
-
if (!existsSync(targetDir)) {
|
|
585
|
-
mkdirSync(targetDir, { recursive: true });
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// Write enact.md
|
|
589
|
-
writeFileSync(manifestPath, manifestContent, "utf-8");
|
|
590
|
-
success(`Created tool manifest: ${manifestPath}`);
|
|
591
|
-
|
|
592
|
-
// Write AGENTS.md (only if it doesn't exist or --force is used)
|
|
593
|
-
if (!existsSync(agentsPath) || options.force) {
|
|
594
|
-
writeFileSync(agentsPath, agentsContent, "utf-8");
|
|
595
|
-
success(`Created AGENTS.md: ${agentsPath}`);
|
|
596
|
-
} else {
|
|
597
|
-
info("AGENTS.md already exists, skipping (use --force to overwrite)");
|
|
633
|
+
// Create .enact/tools.json
|
|
634
|
+
if (createEnactProjectDir(targetDir, options.force ?? false)) {
|
|
635
|
+
success("Created .enact/tools.json");
|
|
598
636
|
}
|
|
599
637
|
|
|
600
638
|
info("");
|
|
601
|
-
info("
|
|
602
|
-
info("
|
|
603
|
-
info(" 2. Run 'enact run ./' to test your tool");
|
|
604
|
-
info(" 3. Run 'enact publish' to share your tool");
|
|
639
|
+
info("This file helps AI agents understand how to use Enact tools in your project.");
|
|
640
|
+
info("Run 'enact search <query>' to find tools, 'enact install <tool>' to add them.");
|
|
605
641
|
}
|
|
606
642
|
|
|
607
643
|
/**
|
|
@@ -613,9 +649,9 @@ export function configureInitCommand(program: Command): void {
|
|
|
613
649
|
.description("Initialize Enact in the current directory")
|
|
614
650
|
.option("-n, --name <name>", "Tool name (default: username/my-tool)")
|
|
615
651
|
.option("-f, --force", "Overwrite existing files")
|
|
616
|
-
.option("--tool", "Create a new Enact tool (
|
|
617
|
-
.option("--agent", "Create AGENTS.md
|
|
618
|
-
.option("--claude", "Create CLAUDE.md
|
|
652
|
+
.option("--tool", "Create a new Enact tool (enact.md + AGENTS.md)")
|
|
653
|
+
.option("--agent", "Create AGENTS.md + .enact/tools.json (default)")
|
|
654
|
+
.option("--claude", "Create CLAUDE.md + .enact/tools.json")
|
|
619
655
|
.option("-v, --verbose", "Show detailed output")
|
|
620
656
|
.action(async (options: InitOptions) => {
|
|
621
657
|
const ctx: CommandContext = {
|
package/src/index.ts
CHANGED