@hexabot-ai/cli 3.2.2-alpha.17 → 3.2.2-alpha.18
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/AGENTS.md
CHANGED
|
@@ -26,7 +26,7 @@ This file is the authoritative cheat-sheet for the Hexabot CLI. It summarizes th
|
|
|
26
26
|
| Command | Responsibilities | Options & IO | Implementation Notes |
|
|
27
27
|
| --- | --- | --- | --- |
|
|
28
28
|
| `check [--docker-only] [--no-docker]` | Run diagnostics for local Node version, Hexabot project detection, env files, and optionally Docker. | Flags narrow which checks run; outputs PASS/FAIL rows and sets exit code 1 if any check fails. | `src/commands/check.ts` calls `checkNodeVersion()`, `isHexabotProject()`, `loadProjectConfig()`, `listEnvStatus()`, and `checkDocker()` in sequence and prints results with chalk. |
|
|
29
|
-
| `create <projectName>` | Scaffold a project from a GitHub template, configure package manager, bootstrap env files, install deps, and optionally start dev mode. | `--template`, `--pm`, `--no-install`, `--dev`, `--docker`, `--force`. Writes `hexabot.config.json`, bootstraps local and Docker env files, persists initial admin seed credentials, installs deps (unless skipped), and can immediately run `hexabot dev`. | `src/commands/create.ts` validates the slug, downloads the latest release zip of `hexastack/hexabot-template-*` via `downloadAndExtractTemplate()`, ensures config/env files exist, installs dependencies via `installDependencies()`, and optionally calls `runDev()` for the new project. |
|
|
29
|
+
| `create <projectName>` | Scaffold a project from a GitHub template, configure package manager, bootstrap env files, install deps, and optionally start dev mode. | `--template`, `--pm`, `--no-install`, `--dev`, `--docker`, `--force`. Writes `hexabot.config.json`, bootstraps local and Docker env files, persists initial admin seed credentials, sets `COMPOSE_PROJECT_NAME` in `.env.docker`, installs deps (unless skipped), and can immediately run `hexabot dev`. | `src/commands/create.ts` validates the slug, downloads the latest release zip of `hexastack/hexabot-template-*` via `downloadAndExtractTemplate()`, ensures config/env files exist, installs dependencies via `installDependencies()`, and optionally calls `runDev()` for the new project. |
|
|
30
30
|
| `config show` | Print the effective `hexabot.config.json` after merging defaults. | No flags; emits pretty-printed JSON. | `src/commands/config.ts` resolves the project root, asserts the workspace, and calls `loadProjectConfig()`. |
|
|
31
31
|
| `config set <key> <value>` | Update nested config values via dot notation with type-aware parsing. | Supports booleans, numbers, JSON literals, comma lists (for `*Services` keys), and package-manager normalization. | Uses `parseValue()` + `buildOverride()` to construct overrides, writes via `updateProjectConfig()`, and echoes the new config. |
|
|
32
32
|
| `dev [--docker] [--services] [-d] [--env] [--no-env-bootstrap] [--pm]` | Run the project in development mode using either the package script or Docker compose stack. | When not using Docker it runs the configured dev script (`dev` default) after optional env bootstrapping. Docker mode bootstraps the docker env file, resolves compose overlays, and runs `docker compose ... up --build [-d]`. | `src/commands/dev.ts` auto-detects the package manager, persists it into the config, handles env bootstrapping (local or docker), then either calls `runPackageScript()` or `runDockerDev()` (which uses `generateComposeFiles()` with mode `dev`). |
|
|
@@ -46,7 +46,7 @@ This file is the authoritative cheat-sheet for the Hexabot CLI. It summarizes th
|
|
|
46
46
|
|
|
47
47
|
## Typical Workflow
|
|
48
48
|
|
|
49
|
-
1. `hexabot create my-bot` — scaffold a workspace, persist the preferred package manager into `hexabot.config.json`, bootstrap both local and Docker env files, capture initial admin credentials, and install dependencies.
|
|
49
|
+
1. `hexabot create my-bot` — scaffold a workspace, persist the preferred package manager into `hexabot.config.json`, bootstrap both local and Docker env files, set the Docker Compose project name, capture initial admin credentials, and install dependencies.
|
|
50
50
|
2. `cd my-bot`
|
|
51
51
|
3. `hexabot check` — confirm Node/Docker availability, project structure, and env files before running heavier commands.
|
|
52
52
|
4. `hexabot env init` — re-run if you need to refresh `.env` files (use `--docker` to target docker envs).
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Common options:
|
|
|
44
44
|
- `--docker` – show Docker-first next steps and use Docker mode when combined with `--dev`.
|
|
45
45
|
- `--force` – allow scaffolding into a non-empty directory.
|
|
46
46
|
|
|
47
|
-
The command downloads the latest template release, installs dependencies (unless `--no-install`), and bootstraps `.env` plus `.env.docker` when their example files are present.
|
|
47
|
+
The command downloads the latest template release, installs dependencies (unless `--no-install`), and bootstraps `.env` plus `.env.docker` when their example files are present. The Docker env file is initialized with `COMPOSE_PROJECT_NAME=<project-name>` so Docker Compose uses the scaffolded project name.
|
|
48
48
|
|
|
49
49
|
#### `dev`
|
|
50
50
|
|
|
@@ -114,7 +114,7 @@ afterEach(() => {
|
|
|
114
114
|
jest.restoreAllMocks();
|
|
115
115
|
});
|
|
116
116
|
describe('registerCreateCommand', () => {
|
|
117
|
-
it('prompts admin credentials and persists
|
|
117
|
+
it('prompts admin credentials and persists create env values', async () => {
|
|
118
118
|
input
|
|
119
119
|
.mockResolvedValueOnce('Anis')
|
|
120
120
|
.mockResolvedValueOnce('Bot')
|
|
@@ -149,6 +149,7 @@ describe('registerCreateCommand', () => {
|
|
|
149
149
|
SEED_ADMIN_LAST_NAME: 'Bot',
|
|
150
150
|
SEED_ADMIN_EMAIL: 'anis@example.com',
|
|
151
151
|
SEED_ADMIN_PASSWORD: 'Admin#123',
|
|
152
|
+
COMPOSE_PROJECT_NAME: 'anisbot',
|
|
152
153
|
});
|
|
153
154
|
expect(exitSpy).not.toHaveBeenCalled();
|
|
154
155
|
expect(input).toHaveBeenCalledTimes(3);
|
|
@@ -156,7 +157,7 @@ describe('registerCreateCommand', () => {
|
|
|
156
157
|
expect(bootstrapEnvFile).toHaveBeenCalledTimes(2);
|
|
157
158
|
expect(upsertEnvVariables).toHaveBeenCalledTimes(2);
|
|
158
159
|
});
|
|
159
|
-
it('skips Docker
|
|
160
|
+
it('skips Docker env values when the Docker env file is unavailable', async () => {
|
|
160
161
|
bootstrapEnvFile.mockImplementation((_projectRoot, _exampleFile, targetFile) => targetFile === '.env');
|
|
161
162
|
input
|
|
162
163
|
.mockResolvedValueOnce('Anis')
|
package/dist/commands/create.js
CHANGED
|
@@ -51,7 +51,7 @@ const createProject = async (projectName, options) => {
|
|
|
51
51
|
const config = loadProjectConfig(projectPath);
|
|
52
52
|
const dockerEnvBootstrapped = bootstrapCreateEnvFiles(projectPath, config);
|
|
53
53
|
const adminCredentials = await promptSeedAdminCredentials();
|
|
54
|
-
persistAdminSeedCredentials(projectPath, config, adminCredentials, dockerEnvBootstrapped);
|
|
54
|
+
persistAdminSeedCredentials(projectPath, config, adminCredentials, dockerEnvBootstrapped, projectName);
|
|
55
55
|
if (options.noInstall) {
|
|
56
56
|
console.log(chalk.yellow('Skipping dependency installation (--no-install).'));
|
|
57
57
|
}
|
|
@@ -121,12 +121,15 @@ const buildAdminSeedVariables = (credentials) => {
|
|
|
121
121
|
SEED_ADMIN_PASSWORD: credentials.password,
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
const persistAdminSeedCredentials = (projectPath, config, credentials, dockerEnvBootstrapped) => {
|
|
124
|
+
const persistAdminSeedCredentials = (projectPath, config, credentials, dockerEnvBootstrapped, projectName) => {
|
|
125
125
|
const seedVariables = buildAdminSeedVariables(credentials);
|
|
126
126
|
upsertEnvVariables(projectPath, config.env.local, seedVariables);
|
|
127
127
|
if (dockerEnvBootstrapped ||
|
|
128
128
|
fs.existsSync(path.join(projectPath, config.env.docker))) {
|
|
129
|
-
upsertEnvVariables(projectPath, config.env.docker,
|
|
129
|
+
upsertEnvVariables(projectPath, config.env.docker, {
|
|
130
|
+
...seedVariables,
|
|
131
|
+
COMPOSE_PROJECT_NAME: projectName,
|
|
132
|
+
});
|
|
130
133
|
}
|
|
131
134
|
};
|
|
132
135
|
const requireValue = (label) => {
|
package/package.json
CHANGED
|
@@ -134,7 +134,7 @@ afterEach(() => {
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
describe('registerCreateCommand', () => {
|
|
137
|
-
it('prompts admin credentials and persists
|
|
137
|
+
it('prompts admin credentials and persists create env values', async () => {
|
|
138
138
|
(input as any)
|
|
139
139
|
.mockResolvedValueOnce('Anis')
|
|
140
140
|
.mockResolvedValueOnce('Bot')
|
|
@@ -187,6 +187,7 @@ describe('registerCreateCommand', () => {
|
|
|
187
187
|
SEED_ADMIN_LAST_NAME: 'Bot',
|
|
188
188
|
SEED_ADMIN_EMAIL: 'anis@example.com',
|
|
189
189
|
SEED_ADMIN_PASSWORD: 'Admin#123',
|
|
190
|
+
COMPOSE_PROJECT_NAME: 'anisbot',
|
|
190
191
|
},
|
|
191
192
|
);
|
|
192
193
|
expect(exitSpy).not.toHaveBeenCalled();
|
|
@@ -196,7 +197,7 @@ describe('registerCreateCommand', () => {
|
|
|
196
197
|
expect(upsertEnvVariables).toHaveBeenCalledTimes(2);
|
|
197
198
|
});
|
|
198
199
|
|
|
199
|
-
it('skips Docker
|
|
200
|
+
it('skips Docker env values when the Docker env file is unavailable', async () => {
|
|
200
201
|
(bootstrapEnvFile as any).mockImplementation(
|
|
201
202
|
(_projectRoot: string, _exampleFile: string, targetFile: string) =>
|
|
202
203
|
targetFile === '.env',
|
package/src/commands/create.ts
CHANGED
|
@@ -99,6 +99,7 @@ const createProject = async (
|
|
|
99
99
|
config,
|
|
100
100
|
adminCredentials,
|
|
101
101
|
dockerEnvBootstrapped,
|
|
102
|
+
projectName,
|
|
102
103
|
);
|
|
103
104
|
|
|
104
105
|
if (options.noInstall) {
|
|
@@ -201,6 +202,7 @@ const persistAdminSeedCredentials = (
|
|
|
201
202
|
config: ReturnType<typeof loadProjectConfig>,
|
|
202
203
|
credentials: AdminSeedCredentials,
|
|
203
204
|
dockerEnvBootstrapped: boolean,
|
|
205
|
+
projectName: string,
|
|
204
206
|
) => {
|
|
205
207
|
const seedVariables = buildAdminSeedVariables(credentials);
|
|
206
208
|
upsertEnvVariables(projectPath, config.env.local, seedVariables);
|
|
@@ -209,7 +211,10 @@ const persistAdminSeedCredentials = (
|
|
|
209
211
|
dockerEnvBootstrapped ||
|
|
210
212
|
fs.existsSync(path.join(projectPath, config.env.docker))
|
|
211
213
|
) {
|
|
212
|
-
upsertEnvVariables(projectPath, config.env.docker,
|
|
214
|
+
upsertEnvVariables(projectPath, config.env.docker, {
|
|
215
|
+
...seedVariables,
|
|
216
|
+
COMPOSE_PROJECT_NAME: projectName,
|
|
217
|
+
});
|
|
213
218
|
}
|
|
214
219
|
};
|
|
215
220
|
const requireValue = (label: string) => {
|