@fieldwork-ai/cli 0.27.3 → 0.28.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.
- package/dist/commands/tool.d.ts +2 -0
- package/dist/commands/tool.js +9 -1
- package/package.json +1 -1
package/dist/commands/tool.d.ts
CHANGED
|
@@ -10,3 +10,5 @@ export declare function buildToolArgs(argsOption: string | undefined, argEntries
|
|
|
10
10
|
export declare function applyArgEntries(base: Record<string, unknown>, entries: string[], flag: string): Record<string, unknown>;
|
|
11
11
|
export declare function readStdin(): Promise<string | null>;
|
|
12
12
|
export declare function registerToolCommands(program: Command): void;
|
|
13
|
+
/** A deprecated tool says so in its result; a script's author should see it on stderr, not only in the data. */
|
|
14
|
+
export declare function deprecationWarning(name: string, result: unknown): string | null;
|
package/dist/commands/tool.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiJson, getContext } from "../http.js";
|
|
2
|
-
import { EXIT, fail, printData } from "../output.js";
|
|
2
|
+
import { EXIT, fail, note, printData } from "../output.js";
|
|
3
3
|
/**
|
|
4
4
|
* `fieldwork tool run <name>` argument assembly (the httpie convention):
|
|
5
5
|
* --args takes a JSON object ('-' reads stdin); repeated --arg entries merge
|
|
@@ -100,7 +100,15 @@ export function registerToolCommands(program) {
|
|
|
100
100
|
method: "POST",
|
|
101
101
|
body: JSON.stringify({ name, args }),
|
|
102
102
|
});
|
|
103
|
+
const warning = deprecationWarning(name, body.result);
|
|
104
|
+
if (warning)
|
|
105
|
+
note(warning);
|
|
103
106
|
// Tool-error strings are data (chat semantics): printed, exit 0.
|
|
104
107
|
printData(body.result, json);
|
|
105
108
|
});
|
|
106
109
|
}
|
|
110
|
+
/** A deprecated tool says so in its result; a script's author should see it on stderr, not only in the data. */
|
|
111
|
+
export function deprecationWarning(name, result) {
|
|
112
|
+
const deprecated = result !== null && typeof result === "object" ? result.deprecated : undefined;
|
|
113
|
+
return typeof deprecated === "string" ? `warning: ${name} is deprecated. ${deprecated}` : null;
|
|
114
|
+
}
|