thomas-agentkit 0.5.3 → 0.6.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/README.md +7 -0
- package/dist/cli.js +26 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,13 @@ Install templates into the current directory:
|
|
|
14
14
|
npx thomas-agentkit init
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
If the package is installed in a project, use the local `agentkit` binary:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -D thomas-agentkit
|
|
21
|
+
npx agentkit init
|
|
22
|
+
```
|
|
23
|
+
|
|
17
24
|
By default, `init` opens a short interactive setup flow in terminals. It asks where to install files, what project type or preset to use, which AI tools you use, which template set to install, how to handle existing files, and whether to personalize repository-level placeholders such as project name, description, issue tracker, docs paths, stack summary, and project commands.
|
|
18
25
|
|
|
19
26
|
Install into another directory:
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { confirm, intro, isCancel, multiselect, select, text } from "@clack/prompts";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
-
import { constants as fsConstants } from "node:fs";
|
|
4
|
+
import { constants as fsConstants, realpathSync } from "node:fs";
|
|
5
5
|
import { access, mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
@@ -483,6 +483,18 @@ export function personalizeTemplateContent(file, content, values) {
|
|
|
483
483
|
}
|
|
484
484
|
return personalized;
|
|
485
485
|
}
|
|
486
|
+
export function shouldPromptForInit(options, streams) {
|
|
487
|
+
if (options.yes) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
if (options.interactive) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
if (options.dryRun) {
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
return Boolean(streams.stdin?.isTTY || streams.stdout?.isTTY);
|
|
497
|
+
}
|
|
486
498
|
async function promptForPersonalization(defaults) {
|
|
487
499
|
const shouldPersonalize = await confirm({
|
|
488
500
|
message: "Personalize template placeholders?",
|
|
@@ -760,7 +772,7 @@ function printUpdateResult(result, dryRun = false) {
|
|
|
760
772
|
}
|
|
761
773
|
async function resolveInteractiveTarget(target, options) {
|
|
762
774
|
const providedPreset = resolvePreset(options.preset);
|
|
763
|
-
const shouldPrompt =
|
|
775
|
+
const shouldPrompt = shouldPromptForInit(options, process);
|
|
764
776
|
if (!shouldPrompt) {
|
|
765
777
|
return target;
|
|
766
778
|
}
|
|
@@ -932,7 +944,18 @@ Examples:
|
|
|
932
944
|
});
|
|
933
945
|
await program.parseAsync(process.argv);
|
|
934
946
|
}
|
|
935
|
-
|
|
947
|
+
function resolveCliPath(filePath) {
|
|
948
|
+
try {
|
|
949
|
+
return realpathSync(filePath);
|
|
950
|
+
}
|
|
951
|
+
catch {
|
|
952
|
+
return path.resolve(filePath);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
function isDirectCliInvocation(argvPath) {
|
|
956
|
+
return Boolean(argvPath && resolveCliPath(argvPath) === resolveCliPath(__filename));
|
|
957
|
+
}
|
|
958
|
+
if (isDirectCliInvocation(process.argv[1])) {
|
|
936
959
|
main().catch((error) => {
|
|
937
960
|
const message = error instanceof Error ? error.message : String(error);
|
|
938
961
|
console.error(message);
|