@intentic/agent-cli 1.304.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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/env.d.ts +3 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +12 -0
- package/dist/env.js.map +1 -0
- package/dist/flags.d.ts +2 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +8 -0
- package/dist/flags.js.map +1 -0
- package/dist/output.d.ts +3 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +12 -0
- package/dist/output.js.map +1 -0
- package/dist/run.d.ts +16 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +50 -0
- package/dist/run.js.map +1 -0
- package/dist/testing.d.ts +8 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +107 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artur Kurowski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @intentic/agent-cli
|
|
2
|
+
|
|
3
|
+
The promise an agent-facing CLI makes — capsule first, content to a budget, errors you cannot mistake for silence — held in one place for the three tools that make it.
|
|
4
|
+
|
|
5
|
+
`iq` (code), `fileq` (workspace files) and `webq` (the web) are three answers to one question: *the thing I need
|
|
6
|
+
is in a format I cannot read, give me the part that fits.* They were written months apart, each one's entry file
|
|
7
|
+
copied from the last, and the copies had already drifted in the way copies do — three spellings of "read my own
|
|
8
|
+
version", two hand-rolled parsers beside the one their shared dependency ships, one inline token estimate beside
|
|
9
|
+
the shared one it was supposed to use.
|
|
10
|
+
|
|
11
|
+
What lives here is only the part all three must answer the same way:
|
|
12
|
+
|
|
13
|
+
- **The process contract** ([src/run.ts](src/run.ts)). EPIPE is a clean stop, not a crash — an agent pipes into
|
|
14
|
+
`head`. Errors go to **stdout**, because `<tool> … 2>/dev/null` is a reflex and a failure routed to stderr
|
|
15
|
+
reads as an empty answer. The app loads through a thunk so a broken module graph dies as a sentence naming the
|
|
16
|
+
install, not as a stack the same reflex swallows. Exit codes are 0 content / 1 none / 2 anything else.
|
|
17
|
+
- **The output shape** ([src/output.ts](src/output.ts)). One capsule line, one `note:` per caveat, then content
|
|
18
|
+
cut on a line boundary with a trailer naming the budget it hit and the file holding the rest. A body that
|
|
19
|
+
stops mid-thought with no trailer is the failure mode this exists to prevent.
|
|
20
|
+
- **The rest of the floor**: one XDG home per tool ([src/env.ts](src/env.ts)), one version resolver that finds
|
|
21
|
+
the manifest by walking to it ([src/version.ts](src/version.ts)), one non-negative parser for counts and
|
|
22
|
+
budgets ([src/flags.ts](src/flags.ts)), one in-process test seam ([src/testing.ts](src/testing.ts)).
|
|
23
|
+
|
|
24
|
+
What does **not** live here is everything that makes the three tools different: iq's grep-dialect absorption and
|
|
25
|
+
fusion budgets, fileq's sidecars and derivers, webq's cache, pruning and crawls. The shell takes a `name` and a
|
|
26
|
+
`noun` and nothing else about what the tool does.
|
|
27
|
+
|
|
28
|
+
## Key files
|
|
29
|
+
|
|
30
|
+
- [src/run.ts](src/run.ts) — the process contract; the one file a `cli.ts` is allowed to import statically, and
|
|
31
|
+
`run.test.ts` fails if it ever grows a runtime import of its own.
|
|
32
|
+
- [src/output.ts](src/output.ts) — the capsule line and the budget cut, including the trailer that keeps a
|
|
33
|
+
clipped answer from reading as a whole one.
|
|
34
|
+
- [src/env.ts](src/env.ts) — `<NAME>_HOME` → `XDG_CACHE_HOME` → `~/.cache/<name>`, and the shared `out` leaf.
|
|
35
|
+
- [src/flags.ts](src/flags.ts) — the count parser, and why stricli's own is not it.
|
|
36
|
+
- [src/testing.ts](src/testing.ts) — runs an app through the same `run` seam `cli.ts` uses, capturing stdout: no
|
|
37
|
+
build artifact, no child process.
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAOvC,CAAC;AAGF,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,MAAqC,CAAC"}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
export const toolHome = (name) => {
|
|
4
|
+
const explicit = process.env[`${name.toUpperCase()}_HOME`];
|
|
5
|
+
if (explicit !== undefined && explicit !== "") {
|
|
6
|
+
return explicit;
|
|
7
|
+
}
|
|
8
|
+
const xdg = process.env["XDG_CACHE_HOME"];
|
|
9
|
+
return join(xdg !== undefined && xdg !== "" ? xdg : join(homedir(), ".cache"), name);
|
|
10
|
+
};
|
|
11
|
+
export const toolOutDir = (name) => join(toolHome(name), "out");
|
|
12
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;IAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QAC5C,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;AACzF,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAMzC,CAAC"}
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,GAAG,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,SAAU,MAAM,UAAU,SAAS,MAAM,EAAE,UAAS,SAAS,MAAM,EAAE,KAAQ,MACT,CAAC;AAMzF,eAAO,MAAM,IAAI,aAAc,MAAM,gBAAgB,MAAM,QAAQ,MAAM,QAAQ,MAAM,KAAG,MASzF,CAAC"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { estimateTokens } from "@intentic/base/format";
|
|
2
|
+
export const capsule = (name, fields, notes = []) => `${name}: ${fields.join(" · ")}\n${notes.map((note) => `note: ${note}\n`).join("")}`;
|
|
3
|
+
export const clip = (markdown, budgetTokens, path, noun) => {
|
|
4
|
+
const total = estimateTokens(markdown);
|
|
5
|
+
if (total <= budgetTokens) {
|
|
6
|
+
return markdown;
|
|
7
|
+
}
|
|
8
|
+
const cut = markdown.slice(0, budgetTokens * 4);
|
|
9
|
+
const atLine = cut.slice(0, cut.lastIndexOf("\n") + 1);
|
|
10
|
+
return `${atLine}\n[cut at ${budgetTokens} of ${total} tokens: Read ${path} for the whole ${noun}]\n`;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,MAAyB,EAAE,KAAK,GAAsB,EAAE,EAAU,EAAE,CACtG,GAAG,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAMzF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,YAAoB,EAAE,IAAY,EAAE,IAAY,EAAU,EAAE;IAC/F,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,KAAK,IAAI,YAAY,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,OAAO,GAAG,MAAM,aAAa,YAAY,OAAO,KAAK,iBAAiB,IAAI,kBAAkB,IAAI,KAAK,CAAC;AAC1G,CAAC,CAAC"}
|
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Application, CommandContext } from "@stricli/core";
|
|
2
|
+
export interface LoadedCli {
|
|
3
|
+
readonly app: Application<CommandContext>;
|
|
4
|
+
readonly prepareArgv?: (raw: readonly string[]) => {
|
|
5
|
+
readonly argv: string[];
|
|
6
|
+
readonly lines: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface AgentCliOptions {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly noun: string;
|
|
12
|
+
readonly load: () => Promise<LoadedCli>;
|
|
13
|
+
readonly rewriteStderr?: (text: string) => string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare const runAgentCli: (options: AgentCliOptions) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAEjF,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAK1C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,KAAK;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CACrH;AAED,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAKtB,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAExC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACjE;AA+CD,eAAO,MAAM,WAAW,YAAmB,eAAe,KAAG,OAAO,CAAC,IAAI,CAqBxE,CAAC"}
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const exitOnBrokenPipe = () => {
|
|
2
|
+
process.stdout.on("error", (error) => {
|
|
3
|
+
if (error.code === "EPIPE") {
|
|
4
|
+
process.exit(typeof process.exitCode === "number" ? process.exitCode : 0);
|
|
5
|
+
}
|
|
6
|
+
throw error;
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
const errorsToStdout = (rewrite) => {
|
|
10
|
+
const emit = process.stdout.write.bind(process.stdout);
|
|
11
|
+
process.stderr.write = ((chunk, ...rest) => {
|
|
12
|
+
if (rewrite === undefined) {
|
|
13
|
+
return emit(chunk, ...rest);
|
|
14
|
+
}
|
|
15
|
+
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString();
|
|
16
|
+
return emit(rewrite(text) ?? chunk, ...rest);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const startFault = (name, noun, error) => {
|
|
20
|
+
const detail = error instanceof Error ? error.message.split("\n")[0] : String(error);
|
|
21
|
+
return (`${name}: cannot start, ${detail}\n` +
|
|
22
|
+
`${name}: this is a broken install, NOT an empty ${noun}. Do not read it as zero hits or fall back to ` +
|
|
23
|
+
`another tool silently. Reinstall ${name} (or rebuild its workspace deps) and report it.\n`);
|
|
24
|
+
};
|
|
25
|
+
const clampExitCode = () => {
|
|
26
|
+
if (process.exitCode !== undefined && process.exitCode !== 0 && process.exitCode !== 1) {
|
|
27
|
+
process.exitCode = 2;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export const runAgentCli = async (options) => {
|
|
31
|
+
exitOnBrokenPipe();
|
|
32
|
+
errorsToStdout(options.rewriteStderr);
|
|
33
|
+
const raw = process.argv.slice(2);
|
|
34
|
+
let cli;
|
|
35
|
+
try {
|
|
36
|
+
const [core, loaded] = await Promise.all([import("@stricli/core"), options.load()]);
|
|
37
|
+
cli = { run: core.run, loaded };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
process.stdout.write(startFault(options.name, options.noun, error));
|
|
41
|
+
process.exit(2);
|
|
42
|
+
}
|
|
43
|
+
const prepared = cli.loaded.prepareArgv?.(raw) ?? { argv: raw, lines: [] };
|
|
44
|
+
for (const line of prepared.lines) {
|
|
45
|
+
process.stdout.write(`${options.name}: ${line}\n`);
|
|
46
|
+
}
|
|
47
|
+
await cli.run(cli.loaded.app, prepared.argv, { process: process });
|
|
48
|
+
clampExitCode();
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AA6BA,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAChC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE;QACxD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,KAAK,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAIF,MAAM,cAAc,GAAG,CAAC,OAA2D,EAAQ,EAAE;IACzF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAgE,CAAC;IACtH,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAE,GAAG,IAAe,EAAW,EAAE;QAChF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KA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AAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpF,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC3E,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEhC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAyB,EAAE,CAAC,CAAC;IACrF,aAAa,EAAE,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Application, type CommandContext } from "@stricli/core";
|
|
2
|
+
export interface CliOutcome {
|
|
3
|
+
readonly out: string;
|
|
4
|
+
readonly err: string;
|
|
5
|
+
readonly exitCode: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const captureCli: (app: Application<CommandContext>, args: readonly string[]) => Promise<CliOutcome>;
|
|
8
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAA4B,MAAM,eAAe,CAAC;AAEhG,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B;AASD,eAAO,MAAM,UAAU,QAAe,WAAW,CAAC,cAAc,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAG,OAAO,CAAC,UAAU,CAuB9G,CAAC"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { run } from "@stricli/core";
|
|
2
|
+
const text = (chunk) => (typeof chunk === "string" ? chunk : Buffer.from(chunk).toString());
|
|
3
|
+
export const captureCli = async (app, args) => {
|
|
4
|
+
let out = "";
|
|
5
|
+
let err = "";
|
|
6
|
+
const streams = { stdout: process.stdout.write, stderr: process.stderr.write };
|
|
7
|
+
process.stdout.write = ((chunk) => {
|
|
8
|
+
out += text(chunk);
|
|
9
|
+
return true;
|
|
10
|
+
});
|
|
11
|
+
process.stderr.write = ((chunk) => {
|
|
12
|
+
err += text(chunk);
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
15
|
+
const previous = process.exitCode;
|
|
16
|
+
process.exitCode = undefined;
|
|
17
|
+
try {
|
|
18
|
+
await run(app, args, { process: process });
|
|
19
|
+
const code = typeof process.exitCode === "number" ? process.exitCode : 0;
|
|
20
|
+
return { out, err, exitCode: code !== 0 && code !== 1 ? 2 : code };
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
process.stdout.write = streams.stdout;
|
|
24
|
+
process.stderr.write = streams.stderr;
|
|
25
|
+
process.exitCode = previous;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"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AO,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,CAAC;YAAS,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;QACtC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;QACtC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAChC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,MAAuG,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { packageRoot } from "@intentic/constants/node";
|
|
4
|
+
export const packageVersion = (from) => createRequire(from)(join(packageRoot(from), "package.json")).version;
|
|
5
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAE,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAyB,CAAC,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentic/agent-cli",
|
|
3
|
+
"version": "1.304.0",
|
|
4
|
+
"description": "The process contract, budgeted output and test seam every agent-facing CLI in this repo keeps",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/intentic/intentic.git",
|
|
10
|
+
"directory": "_tools/agent-cli"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
"./run": {
|
|
21
|
+
"types": "./dist/run.d.ts",
|
|
22
|
+
"import": {
|
|
23
|
+
"@intentic/src": "./src/run.ts",
|
|
24
|
+
"default": "./dist/run.js"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"@intentic/src": "./src/run.ts",
|
|
28
|
+
"default": "./dist/run.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./output": {
|
|
32
|
+
"types": "./dist/output.d.ts",
|
|
33
|
+
"import": {
|
|
34
|
+
"@intentic/src": "./src/output.ts",
|
|
35
|
+
"default": "./dist/output.js"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"@intentic/src": "./src/output.ts",
|
|
39
|
+
"default": "./dist/output.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"./env": {
|
|
43
|
+
"types": "./dist/env.d.ts",
|
|
44
|
+
"import": {
|
|
45
|
+
"@intentic/src": "./src/env.ts",
|
|
46
|
+
"default": "./dist/env.js"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"@intentic/src": "./src/env.ts",
|
|
50
|
+
"default": "./dist/env.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"./flags": {
|
|
54
|
+
"types": "./dist/flags.d.ts",
|
|
55
|
+
"import": {
|
|
56
|
+
"@intentic/src": "./src/flags.ts",
|
|
57
|
+
"default": "./dist/flags.js"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"@intentic/src": "./src/flags.ts",
|
|
61
|
+
"default": "./dist/flags.js"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"./version": {
|
|
65
|
+
"types": "./dist/version.d.ts",
|
|
66
|
+
"import": {
|
|
67
|
+
"@intentic/src": "./src/version.ts",
|
|
68
|
+
"default": "./dist/version.js"
|
|
69
|
+
},
|
|
70
|
+
"require": {
|
|
71
|
+
"@intentic/src": "./src/version.ts",
|
|
72
|
+
"default": "./dist/version.js"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"./testing": {
|
|
76
|
+
"types": "./dist/testing.d.ts",
|
|
77
|
+
"import": {
|
|
78
|
+
"@intentic/src": "./src/testing.ts",
|
|
79
|
+
"default": "./dist/testing.js"
|
|
80
|
+
},
|
|
81
|
+
"require": {
|
|
82
|
+
"@intentic/src": "./src/testing.ts",
|
|
83
|
+
"default": "./dist/testing.js"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@intentic/base": "1.304.0",
|
|
89
|
+
"@intentic/constants": "1.304.0",
|
|
90
|
+
"@stricli/core": "1.3.0",
|
|
91
|
+
"tslib": "2.8.1"
|
|
92
|
+
},
|
|
93
|
+
"devDependencies": {
|
|
94
|
+
"@intentic/testing": "0.0.0",
|
|
95
|
+
"@intentic/tsconfig": "0.0.0",
|
|
96
|
+
"@types/node": "24.13.2",
|
|
97
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
98
|
+
"vitest": "4.1.10"
|
|
99
|
+
},
|
|
100
|
+
"scripts": {
|
|
101
|
+
"build": "tsgo",
|
|
102
|
+
"typecheck": "tsgo --noEmit -p tsconfig.test.json",
|
|
103
|
+
"watch": "tsgo --build --watch",
|
|
104
|
+
"test": "vitest run",
|
|
105
|
+
"test:watch": "vitest"
|
|
106
|
+
}
|
|
107
|
+
}
|