sentinelayer-cli 0.36.5 → 0.37.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/commands/mcp.js +57 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sentinelayer-cli",
3
- "version": "0.36.5",
3
+ "version": "0.37.0",
4
4
  "description": "Scaffold Sentinelayer spec/prompt/guide artifacts with secure browser auth and token bootstrap.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -481,37 +481,64 @@ Docs: https://github.com/mrrCarter/create-sentinelayer/blob/main/docs/mcp.md`,
481
481
  console.log(pc.gray("Next: validate with registry cross-check before runtime wiring."));
482
482
  });
483
483
 
484
- registry
485
- .command("init-session")
486
- .description("Write the built-in SentinelLayer session MCP tool registry")
487
- .option("--path <path>", "Destination file path override")
488
- .option("--output-dir <path>", "Optional artifact output root override")
489
- .option("--force", "Overwrite destination file if it already exists")
490
- .option("--json", "Emit machine-readable output")
491
- .action(async (options, command) => {
492
- const defaultPath = await resolveDefaultMcpOutputPath({
493
- cwd: process.cwd(),
494
- outputDir: options.outputDir,
495
- env: process.env,
496
- });
497
- const outputPath = normalizeOutputPath(options.path, defaultPath.replace(".schema", ".session-tools"));
498
- const template = buildSentinelayerSessionRegistryTemplate();
499
- validateMcpToolRegistry(template);
500
- const writtenPath = await writeJsonFile(outputPath, template, { force: Boolean(options.force) });
501
- const payload = {
502
- command: "mcp registry init-session",
503
- outputPath: writtenPath,
504
- toolCount: template.tools.length,
505
- tools: template.tools.map((tool) => tool.name),
506
- };
484
+ const registerSessionRegistryInit = ({
485
+ commandName,
486
+ description,
487
+ outputSuffix,
488
+ payloadCommand,
489
+ successLabel,
490
+ nextMessage,
491
+ }) => {
492
+ registry
493
+ .command(commandName)
494
+ .description(description)
495
+ .option("--path <path>", "Destination file path override")
496
+ .option("--output-dir <path>", "Optional artifact output root override")
497
+ .option("--force", "Overwrite destination file if it already exists")
498
+ .option("--json", "Emit machine-readable output")
499
+ .action(async (options, command) => {
500
+ const defaultPath = await resolveDefaultMcpOutputPath({
501
+ cwd: process.cwd(),
502
+ outputDir: options.outputDir,
503
+ env: process.env,
504
+ });
505
+ const outputPath = normalizeOutputPath(options.path, defaultPath.replace(".schema", outputSuffix));
506
+ const template = buildSentinelayerSessionRegistryTemplate();
507
+ validateMcpToolRegistry(template);
508
+ const writtenPath = await writeJsonFile(outputPath, template, { force: Boolean(options.force) });
509
+ const payload = {
510
+ command: payloadCommand,
511
+ outputPath: writtenPath,
512
+ toolCount: template.tools.length,
513
+ tools: template.tools.map((tool) => tool.name),
514
+ };
507
515
 
508
- if (shouldEmitJson(options, command)) {
509
- console.log(JSON.stringify(payload, null, 2));
510
- return;
511
- }
512
- console.log(pc.green(`Wrote SentinelLayer session MCP registry template: ${writtenPath}`));
513
- console.log(pc.gray("Next: run 'sl mcp server init --id sentinelayer-session --registry-file <path>'."));
514
- });
516
+ if (shouldEmitJson(options, command)) {
517
+ console.log(JSON.stringify(payload, null, 2));
518
+ return;
519
+ }
520
+ console.log(pc.green(`Wrote ${successLabel}: ${writtenPath}`));
521
+ console.log(pc.gray(nextMessage));
522
+ });
523
+ };
524
+
525
+ registerSessionRegistryInit({
526
+ commandName: "init-session",
527
+ description: "Write the built-in SentinelLayer session MCP tool registry",
528
+ outputSuffix: ".session-tools",
529
+ payloadCommand: "mcp registry init-session",
530
+ successLabel: "SentinelLayer session MCP registry template",
531
+ nextMessage: "Next: run 'sl mcp server init --id sentinelayer-session --registry-file <path>'.",
532
+ });
533
+
534
+ registerSessionRegistryInit({
535
+ commandName: "init-senti-session",
536
+ description: "Write the built-in Senti session MCP tool registry",
537
+ outputSuffix: ".senti-session-tools",
538
+ payloadCommand: "mcp registry init-senti-session",
539
+ successLabel: "Senti session MCP registry template",
540
+ nextMessage: "Next: run 'sl mcp registry init-hosted-session-connector --registry-file <path>' for hosted MCP.",
541
+ });
515
542
 
516
543
  registry
517
544
  .command("init-hosted-session-connector")