create-dynamicagents 0.1.0 → 0.1.1
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 +9 -1
- package/dist/cli.js +36 -2
- package/dist/kinds.js +22 -0
- package/dist/messages.js +18 -0
- package/package.json +4 -1
- package/dist/welcome.js +0 -9
package/README.md
CHANGED
|
@@ -7,7 +7,15 @@ Create gates, leaders and agents on
|
|
|
7
7
|
npm create dynamicagents@latest
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
It asks what you want to build — a gate, a leader or an agent. Scaffolding
|
|
11
|
+
them is a work in progress; follow it at
|
|
12
|
+
[dynamicagents.dev](https://dynamicagents.dev). Requires Node 24 or later.
|
|
13
|
+
|
|
14
|
+
To skip the question, name what to build:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm create dynamicagents@latest agent
|
|
18
|
+
```
|
|
11
19
|
|
|
12
20
|
## License
|
|
13
21
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
-
import {
|
|
3
|
+
import { cancel, intro, isCancel, log, note, outro, select } from "@clack/prompts";
|
|
4
|
+
import { KINDS, kindOf } from "./kinds.js";
|
|
5
|
+
import { noTerminal, nothingBuilt, question, title, unknownKind, workInProgress } from "./messages.js";
|
|
4
6
|
// Read at runtime rather than imported: `package.json` sits outside `rootDir`.
|
|
5
7
|
const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
6
|
-
|
|
8
|
+
async function choose(arg) {
|
|
9
|
+
if (arg !== undefined) {
|
|
10
|
+
const kind = kindOf(arg);
|
|
11
|
+
if (kind === undefined)
|
|
12
|
+
log.error(unknownKind(arg));
|
|
13
|
+
return kind;
|
|
14
|
+
}
|
|
15
|
+
if (!process.stdin.isTTY) {
|
|
16
|
+
log.warn(noTerminal());
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const picked = await select({
|
|
20
|
+
message: question,
|
|
21
|
+
options: KINDS.map((kind) => ({
|
|
22
|
+
value: kind,
|
|
23
|
+
label: kind.label,
|
|
24
|
+
hint: kind.hint
|
|
25
|
+
}))
|
|
26
|
+
});
|
|
27
|
+
return isCancel(picked) ? undefined : picked;
|
|
28
|
+
}
|
|
29
|
+
intro(title(version));
|
|
30
|
+
const kind = await choose(process.argv[2]);
|
|
31
|
+
if (kind === undefined) {
|
|
32
|
+
cancel(nothingBuilt);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// clack wraps a note with `trim: false`, so a line that breaks at a space
|
|
37
|
+
// would start with it.
|
|
38
|
+
note(kind.about, kind.label, { format: (line) => line.trimStart() });
|
|
39
|
+
outro(workInProgress(kind));
|
|
40
|
+
}
|
package/dist/kinds.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const KINDS = [
|
|
2
|
+
{
|
|
3
|
+
value: "gate",
|
|
4
|
+
label: "Gate",
|
|
5
|
+
hint: "where people and APIs reach your agents",
|
|
6
|
+
about: "Gates are the interfaces humans or APIs interact with, like a Slack, WhatsApp or API gate."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: "leader",
|
|
10
|
+
label: "Leader",
|
|
11
|
+
hint: "creates, edits and evaluates a group of agents",
|
|
12
|
+
about: "A leader is a powerful agent that can create, edit and evaluate a group of agents."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "agent",
|
|
16
|
+
label: "Agent",
|
|
17
|
+
hint: "one agent, usually created by a leader",
|
|
18
|
+
about: "An agent should be created by a leader rather than directly by a developer. It adds a folder with an agent inside a worker and scaffolds it from plugins, significantly cutting the time it takes to deploy a production-ready agent."
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
/** The kind a command-line argument names, in any case. */
|
|
22
|
+
export const kindOf = (arg) => KINDS.find((kind) => kind.value === arg.toLowerCase());
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** What `npm create dynamicagents` prints. Pure, so the spec needs no process. */
|
|
2
|
+
import { KINDS } from "./kinds.js";
|
|
3
|
+
export const WEBSITE = "https://dynamicagents.dev";
|
|
4
|
+
export const title = (version) => `Dynamic Agents · create-dynamicagents v${version}`;
|
|
5
|
+
export const question = "What would you like to build?";
|
|
6
|
+
export const workInProgress = (kind) => `${kind.label} scaffolding is a work in progress. Follow updates at ${WEBSITE}`;
|
|
7
|
+
export const nothingBuilt = "Nothing was built.";
|
|
8
|
+
const width = Math.max(...KINDS.map((kind) => kind.value.length));
|
|
9
|
+
const choices = () => KINDS.map((kind) => ` ${kind.value.padEnd(width)} ${kind.hint}`).join("\n");
|
|
10
|
+
/** Without a TTY there is no menu, so the kind has to be an argument. */
|
|
11
|
+
export const noTerminal = () => [
|
|
12
|
+
"No terminal to ask in, so name what to build:",
|
|
13
|
+
"",
|
|
14
|
+
choices(),
|
|
15
|
+
"",
|
|
16
|
+
"npm create dynamicagents@latest <kind>"
|
|
17
|
+
].join("\n");
|
|
18
|
+
export const unknownKind = (arg) => [`"${arg}" is not something to build. Name one of:`, "", choices()].join("\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-dynamicagents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Create gates, leaders and agents on Dynamic Agents: npm create dynamicagents@latest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
"prepublishOnly": "npm run check && npm test && npm run verify:package",
|
|
43
43
|
"prepare": "husky"
|
|
44
44
|
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@clack/prompts": "^1.8.1"
|
|
47
|
+
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@types/node": "^24.13.6",
|
|
47
50
|
"eslint": "^10.10.0",
|
package/dist/welcome.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** What `npm create dynamicagents` prints. Pure, so the spec needs no process. */
|
|
2
|
-
export const welcome = (version) => [
|
|
3
|
-
"",
|
|
4
|
-
` Welcome to Dynamic Agents (create-dynamicagents v${version})`,
|
|
5
|
-
"",
|
|
6
|
-
" Creating gates, leaders and agents is coming soon.",
|
|
7
|
-
" https://github.com/dynamicagents",
|
|
8
|
-
""
|
|
9
|
-
].join("\n");
|