agenttwin 0.1.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 +48 -0
- package/dist/cli.js +135 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentTwin
|
|
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,48 @@
|
|
|
1
|
+
# agenttwin
|
|
2
|
+
|
|
3
|
+
**Give your agent a test world before it touches the real one.**
|
|
4
|
+
|
|
5
|
+
A safe, executable copy of the systems your agent reads from and writes to, so you
|
|
6
|
+
can run the same workflow against a replica, inject real failure conditions, and
|
|
7
|
+
turn a discovered failure into a regression test.
|
|
8
|
+
|
|
9
|
+
> **Early preview.** This package is the CLI shell for that vision. `agenttwin init`
|
|
10
|
+
> works today. The runtime commands (`up`, `run`, `fault`, `diff`, `adopt`) are
|
|
11
|
+
> coming soon.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx agenttwin init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Writes a starter `agenttwin.config.json` into the current directory:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"version": 1,
|
|
24
|
+
"world": "default",
|
|
25
|
+
"twins": []
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Re-run with `--force` to overwrite an existing config.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npx agenttwin --help
|
|
33
|
+
npx agenttwin --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
Node.js 18 or newer.
|
|
39
|
+
|
|
40
|
+
## Status
|
|
41
|
+
|
|
42
|
+
`agenttwin init` is the only implemented command. Nothing here connects to real
|
|
43
|
+
providers, requests credentials, or executes code. See the project repository for
|
|
44
|
+
the product thesis and roadmap.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import { dirname, join as join2 } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { parseArgs } from "util";
|
|
8
|
+
|
|
9
|
+
// src/lib/logger.ts
|
|
10
|
+
var useColor = process.stdout.isTTY === true && process.env.NO_COLOR === void 0;
|
|
11
|
+
function style(code) {
|
|
12
|
+
return (text) => useColor ? `\x1B[${code}m${text}\x1B[0m` : text;
|
|
13
|
+
}
|
|
14
|
+
var bold = style(1);
|
|
15
|
+
var dim = style(2);
|
|
16
|
+
var green = style(32);
|
|
17
|
+
var red = style(31);
|
|
18
|
+
function ok(message) {
|
|
19
|
+
console.log(`${green("\u2713")} ${message}`);
|
|
20
|
+
}
|
|
21
|
+
function info(message = "") {
|
|
22
|
+
console.log(message);
|
|
23
|
+
}
|
|
24
|
+
function fail(message) {
|
|
25
|
+
console.error(`${red("\u2717")} ${message}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/lib/config.ts
|
|
29
|
+
import { existsSync } from "fs";
|
|
30
|
+
import { writeFile } from "fs/promises";
|
|
31
|
+
import { join } from "path";
|
|
32
|
+
var CONFIG_FILENAME = "agenttwin.config.json";
|
|
33
|
+
var DEFAULT_CONFIG = {
|
|
34
|
+
version: 1,
|
|
35
|
+
world: "default",
|
|
36
|
+
twins: []
|
|
37
|
+
};
|
|
38
|
+
function configPath(cwd) {
|
|
39
|
+
return join(cwd, CONFIG_FILENAME);
|
|
40
|
+
}
|
|
41
|
+
async function writeConfig(cwd, { force = false } = {}) {
|
|
42
|
+
const path = configPath(cwd);
|
|
43
|
+
if (existsSync(path) && !force) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`${CONFIG_FILENAME} already exists. Re-run with --force to overwrite it.`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
await writeFile(path, `${JSON.stringify(DEFAULT_CONFIG, null, 2)}
|
|
49
|
+
`, "utf8");
|
|
50
|
+
return { path };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/commands/init.ts
|
|
54
|
+
async function runInit({ cwd, force }) {
|
|
55
|
+
const { path } = await writeConfig(cwd, { force });
|
|
56
|
+
ok(`Created ${CONFIG_FILENAME}`);
|
|
57
|
+
info(dim(` ${path}`));
|
|
58
|
+
info();
|
|
59
|
+
info(`Next: ${bold("npx agenttwin run")} on your workflow ${dim("(coming soon)")}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/cli.ts
|
|
63
|
+
var PLANNED = ["up", "run", "fault", "diff", "adopt"];
|
|
64
|
+
function readVersion() {
|
|
65
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
66
|
+
const pkg = JSON.parse(
|
|
67
|
+
readFileSync(join2(here, "..", "package.json"), "utf8")
|
|
68
|
+
);
|
|
69
|
+
return pkg.version ?? "0.0.0";
|
|
70
|
+
}
|
|
71
|
+
function helpText() {
|
|
72
|
+
return [
|
|
73
|
+
`${bold("agenttwin")} ${dim("\u2014 give your agent a test world before it touches the real one.")}`,
|
|
74
|
+
"",
|
|
75
|
+
bold("Usage"),
|
|
76
|
+
" $ npx agenttwin <command> [options]",
|
|
77
|
+
"",
|
|
78
|
+
bold("Commands"),
|
|
79
|
+
` ${"init".padEnd(14)}Write a starter agenttwin.config.json`,
|
|
80
|
+
"",
|
|
81
|
+
bold("Coming soon"),
|
|
82
|
+
` ${PLANNED.join(", ")}`,
|
|
83
|
+
"",
|
|
84
|
+
bold("Options"),
|
|
85
|
+
` ${"-v, --version".padEnd(14)}Print the installed version`,
|
|
86
|
+
` ${"-h, --help".padEnd(14)}Show this help`
|
|
87
|
+
].join("\n");
|
|
88
|
+
}
|
|
89
|
+
async function main() {
|
|
90
|
+
let values;
|
|
91
|
+
let positionals;
|
|
92
|
+
try {
|
|
93
|
+
const parsed = parseArgs({
|
|
94
|
+
args: process.argv.slice(2),
|
|
95
|
+
allowPositionals: true,
|
|
96
|
+
options: {
|
|
97
|
+
help: { type: "boolean", short: "h" },
|
|
98
|
+
version: { type: "boolean", short: "v" },
|
|
99
|
+
force: { type: "boolean" }
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
values = parsed.values;
|
|
103
|
+
positionals = parsed.positionals;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
106
|
+
info();
|
|
107
|
+
info(helpText());
|
|
108
|
+
process.exitCode = 1;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (values.version) {
|
|
112
|
+
process.stdout.write(`${readVersion()}
|
|
113
|
+
`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (values.help || positionals.length === 0) {
|
|
117
|
+
info(helpText());
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const [command] = positionals;
|
|
121
|
+
switch (command) {
|
|
122
|
+
case "init":
|
|
123
|
+
await runInit({ cwd: process.cwd(), force: values.force === true });
|
|
124
|
+
return;
|
|
125
|
+
default:
|
|
126
|
+
fail(`Unknown command: ${command}`);
|
|
127
|
+
info();
|
|
128
|
+
info(helpText());
|
|
129
|
+
process.exitCode = 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
main().catch((error) => {
|
|
133
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
134
|
+
process.exitCode = 1;
|
|
135
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agenttwin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Give your agent a test world before it touches the real one.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"ai",
|
|
8
|
+
"testing",
|
|
9
|
+
"simulation",
|
|
10
|
+
"sandbox",
|
|
11
|
+
"twin",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"agenttwin": "dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"dev": "tsx src/cli.ts",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"prepublishOnly": "npm run build && npm test"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^26.6.4",
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"tsx": "^4.23.15",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vitest": "^5.0.3"
|
|
43
|
+
}
|
|
44
|
+
}
|