@replayio/app-building 1.19.1 → 1.21.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 +1 -1
- package/dist/container.d.ts +2 -0
- package/dist/container.js +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ The agent can also run `list-secrets` to see which secrets are available, and `s
|
|
|
80
80
|
|
|
81
81
|
| Export | Description |
|
|
82
82
|
|---|---|
|
|
83
|
-
| `ContainerConfig` | `infisical` (required `InfisicalConfig`), optional `projectRoot` (local Docker only), `registry`, `flyToken`/`flyApp` (set both for remote Fly.io), `imageRef`, `webhookUrl`/`webhookSecret`, `detached`, `initialPrompt`, `localPort`, `absorbTasks
|
|
83
|
+
| `ContainerConfig` | `infisical` (required `InfisicalConfig`), optional `projectRoot` (local Docker only), `registry`, `flyToken`/`flyApp` (set both for remote Fly.io), `imageRef`, `webhookUrl`/`webhookSecret`, `detached`, `initialPrompt`, `localPort`, `absorbTasks`, `namePrefix` (default: `"app-building"`). |
|
|
84
84
|
| `RepoOptions` | Per-invocation git settings: `repoUrl`, `cloneBranch`, `pushBranch`. |
|
|
85
85
|
| `AgentState` | Returned by `startContainer`. Contains `type`, `containerName`, `port`, `baseUrl`, and Fly-specific fields for remote containers. |
|
|
86
86
|
| `ContainerRegistry` | Interface for container registry storage. Methods: `log`, `markStopped`, `clearStopped`, `getRecent`, `find`, `findAlive`. |
|
package/dist/container.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface ContainerConfig {
|
|
|
27
27
|
localPort?: number;
|
|
28
28
|
/** Absorb task files from other containers at startup. Default: false. */
|
|
29
29
|
absorbTasks?: boolean;
|
|
30
|
+
/** Container name prefix. Default: "app-building". */
|
|
31
|
+
namePrefix?: string;
|
|
30
32
|
}
|
|
31
33
|
export interface RepoOptions {
|
|
32
34
|
repoUrl: string;
|
package/dist/container.js
CHANGED
|
@@ -35,7 +35,7 @@ export function buildImage(config) {
|
|
|
35
35
|
if (!config.projectRoot)
|
|
36
36
|
throw new Error("projectRoot is required for local Docker operations");
|
|
37
37
|
console.log("Building Docker image...");
|
|
38
|
-
execFileSync("docker", ["build", "--network", "host", "-t", IMAGE_NAME, config.projectRoot], {
|
|
38
|
+
execFileSync("docker", ["build", "--platform", "linux/amd64", "--network", "host", "-t", IMAGE_NAME, config.projectRoot], {
|
|
39
39
|
stdio: "inherit",
|
|
40
40
|
timeout: 600000,
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ function ensureImageExists(projectRoot) {
|
|
|
49
49
|
}
|
|
50
50
|
catch {
|
|
51
51
|
console.log("Building Docker image...");
|
|
52
|
-
execFileSync("docker", ["build", "--network", "host", "-t", IMAGE_NAME, projectRoot], {
|
|
52
|
+
execFileSync("docker", ["build", "--platform", "linux/amd64", "--network", "host", "-t", IMAGE_NAME, projectRoot], {
|
|
53
53
|
stdio: "inherit",
|
|
54
54
|
timeout: 600000,
|
|
55
55
|
});
|
|
@@ -121,13 +121,14 @@ function isRemote(config) {
|
|
|
121
121
|
async function startLocalContainer(config, repo) {
|
|
122
122
|
buildImage(config);
|
|
123
123
|
const uniqueId = Math.random().toString(36).slice(2, 8);
|
|
124
|
-
const
|
|
124
|
+
const prefix = config.namePrefix ?? "app-building";
|
|
125
|
+
const containerName = `${prefix}-${uniqueId}`;
|
|
125
126
|
const containerPort = 3000;
|
|
126
127
|
const hostPort = config.localPort ?? findFreePort();
|
|
127
128
|
const extra = buildExtraEnv(config, containerName);
|
|
128
129
|
extra.PORT = String(containerPort);
|
|
129
130
|
const containerEnv = buildContainerEnv(repo, config.infisical, extra);
|
|
130
|
-
const args = ["run", "-d", "--rm", "--name", containerName];
|
|
131
|
+
const args = ["run", "--platform", "linux/amd64", "-d", "--rm", "--name", containerName];
|
|
131
132
|
args.push("-p", `${hostPort}:${containerPort}`);
|
|
132
133
|
for (const [k, v] of Object.entries(containerEnv)) {
|
|
133
134
|
args.push("--env", `${k}=${v}`);
|
|
@@ -195,7 +196,8 @@ async function startRemoteContainerImpl(config, repo) {
|
|
|
195
196
|
throw new Error("flyApp is required for remote containers");
|
|
196
197
|
const imageRef = config.imageRef ?? getImageRef();
|
|
197
198
|
const uniqueId = Math.random().toString(36).slice(2, 8);
|
|
198
|
-
const
|
|
199
|
+
const prefix = config.namePrefix ?? "app-building";
|
|
200
|
+
const machineName = `${prefix}-${uniqueId}`;
|
|
199
201
|
const extra = buildExtraEnv(config, machineName);
|
|
200
202
|
const containerEnv = buildContainerEnv(repo, config.infisical, extra);
|
|
201
203
|
const existing = await listMachines(config.flyApp, config.flyToken);
|
|
@@ -329,7 +331,7 @@ export function spawnTestContainer(config) {
|
|
|
329
331
|
ensureImageExists(config.projectRoot);
|
|
330
332
|
const uniqueId = Math.random().toString(36).slice(2, 8);
|
|
331
333
|
const containerName = `app-building-test-${uniqueId}`;
|
|
332
|
-
const args = ["run", "-it", "--rm", "--name", containerName];
|
|
334
|
+
const args = ["run", "--platform", "linux/amd64", "-it", "--rm", "--name", containerName];
|
|
333
335
|
args.push("-v", `${config.projectRoot}:/repo`);
|
|
334
336
|
args.push("-w", "/repo");
|
|
335
337
|
args.push("--network", "host");
|