caplets 0.17.1 → 0.17.2
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/README.md +7 -5
- package/dist/index.js +57 -26
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -77,16 +77,18 @@ You can also invoke configured Caplets directly from the CLI for agent-friendly
|
|
|
77
77
|
```sh
|
|
78
78
|
caplets get-caplet context7
|
|
79
79
|
caplets list-tools context7
|
|
80
|
-
caplets get-tool context7
|
|
81
|
-
caplets call-tool context7
|
|
82
|
-
caplets call-tool context7
|
|
80
|
+
caplets get-tool context7 resolve-library-id
|
|
81
|
+
caplets call-tool context7 resolve-library-id --args '{"libraryName":"react"}'
|
|
82
|
+
caplets call-tool context7 resolve-library-id --args '{"libraryName":"react"}' --field result.id --format json
|
|
83
83
|
caplets list-resources docs
|
|
84
84
|
caplets read-resource docs file:///repo/README.md
|
|
85
85
|
caplets list-prompts linear
|
|
86
|
-
caplets get-prompt linear
|
|
86
|
+
caplets get-prompt linear review_issue --args '{"issueId":"CAP-123"}'
|
|
87
87
|
caplets complete docs --resource-template 'file:///repo/{path}' --argument path --value src/
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
The older qualified form, such as `caplets call-tool context7.resolve-library-id` or `caplets get-prompt linear.review_issue`, remains supported for scripts and existing usage.
|
|
91
|
+
|
|
90
92
|
Direct CLI operation commands print Markdown summaries by default. Add `--format plain` for plain text or `--format json` for machine-readable JSON (`md` is accepted as an alias for `markdown`). If a downstream tool returns `isError: true`, Caplets still exits with status code 1.
|
|
91
93
|
|
|
92
94
|
### Shell completions
|
|
@@ -117,7 +119,7 @@ caplets completion cmd > %USERPROFILE%\caplets-completion.cmd
|
|
|
117
119
|
%USERPROFILE%\caplets-completion.cmd
|
|
118
120
|
```
|
|
119
121
|
|
|
120
|
-
Completions include command names, options, common enum values, configured Caplet IDs, and cache-backed downstream names for qualified targets such as `caplets call-tool repo.<TAB>`. Downstream discovery is bounded by the `completion` config timeouts and a platform-native cache directory. Generated shell scripts suppress completion stderr; run the underlying CLI command directly when debugging completion behavior.
|
|
122
|
+
Completions include command names, options, common enum values, configured Caplet IDs, and cache-backed downstream names for split targets such as `caplets call-tool repo <TAB>` and qualified targets such as `caplets call-tool repo.<TAB>`. Downstream discovery is bounded by the `completion` config timeouts and a platform-native cache directory. Generated shell scripts suppress completion stderr; run the underlying CLI command directly when debugging completion behavior.
|
|
121
123
|
|
|
122
124
|
Backends that require OAuth or token auth may need `caplets auth login <server>` before live downstream completions can return richer results. Completion never starts interactive login flows.
|
|
123
125
|
|
package/dist/index.js
CHANGED
|
@@ -4709,7 +4709,7 @@ function generatedToolInputJsonSchema() {
|
|
|
4709
4709
|
return generatedToolInputJsonSchemaForCaplet({ backend: "tool" });
|
|
4710
4710
|
}
|
|
4711
4711
|
//#endregion
|
|
4712
|
-
//#region ../core/dist/options-
|
|
4712
|
+
//#region ../core/dist/options-bnsSREid.js
|
|
4713
4713
|
var __create = Object.create;
|
|
4714
4714
|
var __defProp = Object.defineProperty;
|
|
4715
4715
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -57625,7 +57625,7 @@ var CapletsEngine = class {
|
|
|
57625
57625
|
}
|
|
57626
57626
|
}
|
|
57627
57627
|
async completeCliWords(words) {
|
|
57628
|
-
const { completeCliWords } = await Promise.resolve().then(() =>
|
|
57628
|
+
const { completeCliWords } = await Promise.resolve().then(() => completion_L23s2FGB_exports).then((n) => n.r);
|
|
57629
57629
|
return await completeCliWords(words, {
|
|
57630
57630
|
config: this.registry.config,
|
|
57631
57631
|
managers: {
|
|
@@ -57963,8 +57963,8 @@ function hasEnv$1(value) {
|
|
|
57963
57963
|
return value !== void 0 && value.trim() !== "";
|
|
57964
57964
|
}
|
|
57965
57965
|
//#endregion
|
|
57966
|
-
//#region ../core/dist/completion-
|
|
57967
|
-
var
|
|
57966
|
+
//#region ../core/dist/completion-L23s2FGB.js
|
|
57967
|
+
var completion_L23s2FGB_exports = /* @__PURE__ */ __exportAll$1({
|
|
57968
57968
|
a: () => formatCapletList,
|
|
57969
57969
|
c: () => resolveCliConfigPaths,
|
|
57970
57970
|
i: () => trailingSpaceCompletionToken,
|
|
@@ -58434,9 +58434,17 @@ async function completeCliWords(words, options = {}) {
|
|
|
58434
58434
|
if (normalized.length === 1) return prefixFilter([...topLevelCommandNames], current);
|
|
58435
58435
|
if (normalized.length === 2 && command in cliSubcommands) return prefixFilter(cliSubcommands[command], current);
|
|
58436
58436
|
if (normalized.length === 2 && capletIdCommands.has(command)) return prefixFilter(promptResourceCommands.has(command) ? configuredCapletIds(options, { backend: "mcp" }) : configuredCapletIds(options), current);
|
|
58437
|
-
if (
|
|
58438
|
-
|
|
58439
|
-
|
|
58437
|
+
if (qualifiedToolCommands.has(command) || qualifiedPromptCommands.has(command)) {
|
|
58438
|
+
const kind = qualifiedToolCommands.has(command) ? "tools" : "prompts";
|
|
58439
|
+
const idFilter = qualifiedPromptCommands.has(command) ? { backend: "mcp" } : void 0;
|
|
58440
|
+
if (normalized.length === 2) {
|
|
58441
|
+
if (current.includes(".")) return prefixFilter((await discoverCompletionCandidates(current.slice(0, current.indexOf(".")), kind, discoveryOptions(options))).map((candidate) => candidate.value), current);
|
|
58442
|
+
return prefixFilter(configuredCapletIds(options, idFilter), current);
|
|
58443
|
+
}
|
|
58444
|
+
if (normalized.length === 3 && subcommand && !subcommand.includes(".")) {
|
|
58445
|
+
if (current.startsWith("-")) return [];
|
|
58446
|
+
return prefixFilter((await discoverCompletionCandidates(subcommand, kind, discoveryOptions(options))).map((candidate) => candidate.value.replace(`${subcommand}.`, "")), current);
|
|
58447
|
+
}
|
|
58440
58448
|
}
|
|
58441
58449
|
if (command === cliCommands.readResource && normalized.length === 3) return prefixFilter((await discoverCompletionCandidates(subcommand, "resources", discoveryOptions(options))).map((candidate) => candidate.value), current);
|
|
58442
58450
|
if (command === cliCommands.auth && ["login", "logout"].includes(subcommand) && normalized.length === 3) return prefixFilter(configuredCapletIds(options), current);
|
|
@@ -59819,7 +59827,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
59819
59827
|
values: [],
|
|
59820
59828
|
hasMore: false
|
|
59821
59829
|
} };
|
|
59822
|
-
var version$1 = "0.18.
|
|
59830
|
+
var version$1 = "0.18.2";
|
|
59823
59831
|
var CapletsMcpSession = class {
|
|
59824
59832
|
engine;
|
|
59825
59833
|
server;
|
|
@@ -67491,7 +67499,7 @@ function createHttpServeApp(options, engine, io = {}) {
|
|
|
67491
67499
|
}
|
|
67492
67500
|
});
|
|
67493
67501
|
}
|
|
67494
|
-
return c.json(await dispatchRemoteCliRequest(request, controlContext(io, writeErr, authFlowStore, c.req.url, paths.control, options.trustProxy, (name) => c.req.header(name))));
|
|
67502
|
+
return c.json(await dispatchRemoteCliRequest(request, controlContext(io, writeErr, authFlowStore, c.req.url, paths.control, options.publicOrigin, options.trustProxy, (name) => c.req.header(name))));
|
|
67495
67503
|
});
|
|
67496
67504
|
app.get(routePath(paths.control, "auth/callback/:flowId"), async (c) => {
|
|
67497
67505
|
const flowId = c.req.param("flowId");
|
|
@@ -67501,7 +67509,7 @@ function createHttpServeApp(options, engine, io = {}) {
|
|
|
67501
67509
|
flowId,
|
|
67502
67510
|
callbackUrl: c.req.url
|
|
67503
67511
|
}
|
|
67504
|
-
}, controlContext(io, writeErr, authFlowStore, c.req.url, paths.control, options.trustProxy, (name) => c.req.header(name)));
|
|
67512
|
+
}, controlContext(io, writeErr, authFlowStore, c.req.url, paths.control, options.publicOrigin, options.trustProxy, (name) => c.req.header(name)));
|
|
67505
67513
|
if (!result.ok) writeErr(`Caplets authentication failed for flow ${flowId}: ${result.error.message}\n`);
|
|
67506
67514
|
return result.ok ? c.text("Caplets authentication complete. You can return to your terminal.") : c.text("Caplets authentication failed. Check server logs for details.", 400);
|
|
67507
67515
|
});
|
|
@@ -67515,12 +67523,12 @@ function createHttpServeApp(options, engine, io = {}) {
|
|
|
67515
67523
|
if (options.warnUnauthenticatedNetwork) writeErr(`Warning: Caplets MCP HTTP server is listening on ${options.host} without authentication.\n`);
|
|
67516
67524
|
return app;
|
|
67517
67525
|
}
|
|
67518
|
-
function controlContext(io, writeErr, authFlowStore, requestUrl, controlPath, trustProxy, header) {
|
|
67526
|
+
function controlContext(io, writeErr, authFlowStore, requestUrl, controlPath, publicOrigin, trustProxy, header) {
|
|
67519
67527
|
return {
|
|
67520
67528
|
...io.control,
|
|
67521
67529
|
projectCapletsRoot: io.control?.projectCapletsRoot ?? resolveProjectCapletsRoot(),
|
|
67522
67530
|
authFlowStore,
|
|
67523
|
-
controlCallbackBaseUrl: new URL(controlPath, publicRequestOrigin(requestUrl, trustProxy, header)).toString(),
|
|
67531
|
+
controlCallbackBaseUrl: new URL(controlPath, publicOrigin ?? publicRequestOrigin(requestUrl, trustProxy, header)).toString(),
|
|
67524
67532
|
writeErr
|
|
67525
67533
|
};
|
|
67526
67534
|
}
|
|
@@ -67685,6 +67693,7 @@ function resolveServeOptions(raw, env = process.env) {
|
|
|
67685
67693
|
host,
|
|
67686
67694
|
port,
|
|
67687
67695
|
path,
|
|
67696
|
+
...serverUrl ? { publicOrigin: serverUrl.origin } : {},
|
|
67688
67697
|
auth,
|
|
67689
67698
|
warnUnauthenticatedNetwork: !loopback && !auth.enabled,
|
|
67690
67699
|
loopback,
|
|
@@ -67874,9 +67883,12 @@ function createProgram(io = {}) {
|
|
|
67874
67883
|
suggestions = remote ? await remote.request("complete_cli", {
|
|
67875
67884
|
shell,
|
|
67876
67885
|
words: completionWords
|
|
67877
|
-
}) : await
|
|
67886
|
+
}) : await completeCliWordsLocally(completionWords, {
|
|
67887
|
+
...configPath ? { configPath } : {},
|
|
67888
|
+
...io.authDir ? { authDir: io.authDir } : {}
|
|
67889
|
+
});
|
|
67878
67890
|
} catch {
|
|
67879
|
-
suggestions = [];
|
|
67891
|
+
suggestions = remote ? [] : await completeCliWords(completionWords, configPath ? { configPath } : {});
|
|
67880
67892
|
}
|
|
67881
67893
|
if (suggestions.length > 0) writeOut(`${suggestions.join("\n")}\n`);
|
|
67882
67894
|
});
|
|
@@ -68070,8 +68082,8 @@ function createProgram(io = {}) {
|
|
|
68070
68082
|
format: options.format
|
|
68071
68083
|
});
|
|
68072
68084
|
});
|
|
68073
|
-
program.command(cliCommands.getTool).description("Print one downstream tool schema.").argument("<caplet
|
|
68074
|
-
const { caplet, tool } = parseQualifiedTarget(
|
|
68085
|
+
program.command(cliCommands.getTool).description("Print one downstream tool schema.").argument("<caplet-or-target>", "Caplet ID or qualified <caplet.tool> target").argument("[tool]", "downstream tool name when caplet is provided separately").option("--format <format>", "output format: markdown, md, plain, or json", parseOutputFormat).action(async (capletOrTarget, toolArgument, options) => {
|
|
68086
|
+
const { caplet, tool } = parseQualifiedTarget(capletOrTarget, toolArgument);
|
|
68075
68087
|
await executeOperation(caplet, {
|
|
68076
68088
|
operation: "get_tool",
|
|
68077
68089
|
tool
|
|
@@ -68085,8 +68097,8 @@ function createProgram(io = {}) {
|
|
|
68085
68097
|
format: options.format
|
|
68086
68098
|
});
|
|
68087
68099
|
});
|
|
68088
|
-
program.command(cliCommands.callTool).description("Call one downstream tool.").argument("<caplet
|
|
68089
|
-
const { caplet, tool } = parseQualifiedTarget(
|
|
68100
|
+
program.command(cliCommands.callTool).description("Call one downstream tool.").argument("<caplet-or-target>", "Caplet ID or qualified <caplet.tool> target").argument("[tool]", "downstream tool name when caplet is provided separately").option("--args <json-object>", "JSON object of downstream tool arguments").option("--field <path>", "project a field from structured output", collect, []).option("--format <format>", "output format: markdown, md, plain, or json", parseOutputFormat).action(async (capletOrTarget, toolArgument, options) => {
|
|
68101
|
+
const { caplet, tool } = parseQualifiedTarget(capletOrTarget, toolArgument);
|
|
68090
68102
|
await executeOperation(caplet, {
|
|
68091
68103
|
operation: "call_tool",
|
|
68092
68104
|
tool,
|
|
@@ -68182,8 +68194,8 @@ function createProgram(io = {}) {
|
|
|
68182
68194
|
remote: remoteClientForCli(io),
|
|
68183
68195
|
format: options.format
|
|
68184
68196
|
}));
|
|
68185
|
-
program.command(cliCommands.getPrompt).description("Get one MCP prompt by name.").argument("<caplet
|
|
68186
|
-
const { caplet, tool: prompt } = parseQualifiedTarget(
|
|
68197
|
+
program.command(cliCommands.getPrompt).description("Get one MCP prompt by name.").argument("<caplet-or-target>", "MCP Caplet ID or qualified <caplet.prompt> target").argument("[prompt]", "prompt name when caplet is provided separately").option("--args <json-object>", "JSON object of prompt arguments").option("--format <format>", "output format: markdown, md, plain, or json", parseOutputFormat).action(async (capletOrTarget, promptArgument, options) => {
|
|
68198
|
+
const { caplet, tool: prompt } = parseQualifiedTarget(capletOrTarget, promptArgument);
|
|
68187
68199
|
await executeOperation(caplet, {
|
|
68188
68200
|
operation: "get_prompt",
|
|
68189
68201
|
prompt,
|
|
@@ -68348,14 +68360,33 @@ function parseOutputFormat(value) {
|
|
|
68348
68360
|
default: throw new CapletsError("REQUEST_INVALID", `Expected output format markdown, md, plain, or json; got ${value}`);
|
|
68349
68361
|
}
|
|
68350
68362
|
}
|
|
68351
|
-
function parseQualifiedTarget(
|
|
68352
|
-
|
|
68353
|
-
|
|
68363
|
+
function parseQualifiedTarget(capletOrTarget, toolArgument) {
|
|
68364
|
+
if (toolArgument !== void 0) {
|
|
68365
|
+
if (capletOrTarget.length === 0 || toolArgument.length === 0) throw new CapletsError("REQUEST_INVALID", "Expected target in the form <caplet> <tool> or <caplet>.<tool>");
|
|
68366
|
+
return {
|
|
68367
|
+
caplet: capletOrTarget,
|
|
68368
|
+
tool: toolArgument
|
|
68369
|
+
};
|
|
68370
|
+
}
|
|
68371
|
+
const dot = capletOrTarget.indexOf(".");
|
|
68372
|
+
if (dot <= 0 || dot === capletOrTarget.length - 1) throw new CapletsError("REQUEST_INVALID", "Expected target in the form <caplet> <tool> or <caplet>.<tool>");
|
|
68354
68373
|
return {
|
|
68355
|
-
caplet:
|
|
68356
|
-
tool:
|
|
68374
|
+
caplet: capletOrTarget.slice(0, dot),
|
|
68375
|
+
tool: capletOrTarget.slice(dot + 1)
|
|
68357
68376
|
};
|
|
68358
68377
|
}
|
|
68378
|
+
async function completeCliWordsLocally(words, options) {
|
|
68379
|
+
const engine = new CapletsEngine({
|
|
68380
|
+
...options.configPath ? { configPath: options.configPath } : {},
|
|
68381
|
+
...options.authDir ? { authDir: options.authDir } : {},
|
|
68382
|
+
watch: false
|
|
68383
|
+
});
|
|
68384
|
+
try {
|
|
68385
|
+
return await engine.completeCliWords(words);
|
|
68386
|
+
} finally {
|
|
68387
|
+
await engine.close();
|
|
68388
|
+
}
|
|
68389
|
+
}
|
|
68359
68390
|
function parseCallToolArgs(value) {
|
|
68360
68391
|
if (value === void 0) return {};
|
|
68361
68392
|
let parsed;
|
|
@@ -68780,7 +68811,7 @@ function writeAddResult(writeOut, label, result) {
|
|
|
68780
68811
|
}
|
|
68781
68812
|
//#endregion
|
|
68782
68813
|
//#region package.json
|
|
68783
|
-
var version = "0.17.
|
|
68814
|
+
var version = "0.17.2";
|
|
68784
68815
|
//#endregion
|
|
68785
68816
|
//#region src/index.ts
|
|
68786
68817
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caplets",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "Progressive disclosure gateway CLI for MCP servers and native Caplets adapters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caplets",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
37
|
-
"@caplets/core": "0.18.
|
|
37
|
+
"@caplets/core": "0.18.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^25.9.1",
|