agent-workflow-kit-cli 1.3.4 → 1.3.6

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.
Files changed (50) hide show
  1. package/README.md +158 -9
  2. package/dist/cli/commands/create.js +162 -0
  3. package/dist/cli/commands/ui.js +192 -0
  4. package/dist/cli/index.js +29 -1
  5. package/package.json +4 -2
  6. package/templates/react-ts/project/.gitignore.hbs +24 -0
  7. package/templates/react-ts/project/eslint.config.js.hbs +34 -0
  8. package/templates/react-ts/project/index.html.hbs +17 -0
  9. package/templates/react-ts/project/package.json.hbs +28 -0
  10. package/templates/react-ts/project/src/App.tsx.hbs +60 -0
  11. package/templates/react-ts/project/src/components/Counter.tsx.hbs +16 -0
  12. package/templates/react-ts/project/src/components/ThemeToggle.tsx.hbs +29 -0
  13. package/templates/react-ts/project/src/hooks/useLocalStorage.ts.hbs +25 -0
  14. package/templates/react-ts/project/src/main.tsx.hbs +10 -0
  15. package/templates/react-ts/project/src/services/api.ts.hbs +16 -0
  16. package/templates/react-ts/project/src/styles/App.css.hbs +143 -0
  17. package/templates/react-ts/project/src/styles/index.css.hbs +34 -0
  18. package/templates/react-ts/project/src/vite-env.d.ts.hbs +1 -0
  19. package/templates/react-ts/project/tsconfig.app.json.hbs +26 -0
  20. package/templates/react-ts/project/tsconfig.json.hbs +7 -0
  21. package/templates/react-ts/project/tsconfig.node.json.hbs +24 -0
  22. package/templates/react-ts/project/vite.config.ts.hbs +7 -0
  23. package/templates/spring-boot/project/.gitignore.hbs +28 -0
  24. package/templates/spring-boot/project/pom.xml.hbs +69 -0
  25. package/templates/spring-boot/project/src/main/java/com/example/packageName/DemoApplication.java.hbs +13 -0
  26. package/templates/spring-boot/project/src/main/java/com/example/packageName/controller/UserController.java.hbs +37 -0
  27. package/templates/spring-boot/project/src/main/java/com/example/packageName/dto/UserDTO.java.hbs +16 -0
  28. package/templates/spring-boot/project/src/main/java/com/example/packageName/entity/User.java.hbs +27 -0
  29. package/templates/spring-boot/project/src/main/java/com/example/packageName/repository/UserRepository.java.hbs +9 -0
  30. package/templates/spring-boot/project/src/main/java/com/example/packageName/service/UserService.java.hbs +11 -0
  31. package/templates/spring-boot/project/src/main/java/com/example/packageName/service/impl/UserServiceImpl.java.hbs +55 -0
  32. package/templates/spring-boot/project/src/main/resources/application.yml.hbs +20 -0
  33. package/templates/spring-boot/project/src/test/java/com/example/packageName/DemoApplicationTests.java.hbs +13 -0
  34. package/ui-dist/assets/Antigravity-IRHfUNd0.webp +0 -0
  35. package/ui-dist/assets/Codex-B3jt494H.png +0 -0
  36. package/ui-dist/assets/Logo-DARneFJW.png +0 -0
  37. package/ui-dist/assets/ReactTS-Cv7D5v-r.png +0 -0
  38. package/ui-dist/assets/devops-DfKGji1l.png +0 -0
  39. package/ui-dist/assets/drawio-D1K35acK.png +0 -0
  40. package/ui-dist/assets/expressjs-cjiJ1MIq.png +0 -0
  41. package/ui-dist/assets/fastapi-x75ez5Tf.png +0 -0
  42. package/ui-dist/assets/golang-DWpOzDNa.png +0 -0
  43. package/ui-dist/assets/index-BhHU4Khx.js +372 -0
  44. package/ui-dist/assets/index-C0BHmZv8.css +1 -0
  45. package/ui-dist/assets/nestjs-CZk_FY6t.png +0 -0
  46. package/ui-dist/assets/nextjs-DIQjv1J3.png +0 -0
  47. package/ui-dist/assets/python-CfV_cs4B.png +0 -0
  48. package/ui-dist/assets/rust-A_NnBwqP.png +0 -0
  49. package/ui-dist/assets/springbootjava--7jHXzq_.jpg +0 -0
  50. package/ui-dist/index.html +47 -0
package/README.md CHANGED
@@ -162,21 +162,78 @@ packages = ["src"]
162
162
 
163
163
  ---
164
164
 
165
+ ### 🌐 Next.js Frontend Pack
166
+ Tailored for Next.js App or Pages Router web application structures.
167
+ - **Default Architecture:** Standard layouts, page component separations, and shared Tailwind/styling assets.
168
+ - **Tooling Defaults:** Next CLI tools, ESLint, strict TypeScript rules.
169
+
170
+ ---
171
+
172
+ ### šŸ›”ļø NestJS & Express Backend Packs
173
+ Designed for structured modular Node.js backend systems.
174
+ - **Default Architecture:** Dependency injection modular patterns (NestJS) or routing/middleware setups (Express).
175
+ - **Tooling Defaults:** ESLint, Prettier, and Vitest/Jest for automated testing.
176
+
177
+ ---
178
+
179
+ ### šŸ¤– Python AI Pack
180
+ Custom-tailored rules and structures for AI modeling, machine learning, and data science.
181
+ - **Default Architecture:** Machine learning pipelines, model loaders, script helpers, and notebook guides.
182
+ - **Tooling Defaults:** Ruff linting, mypy strict type checking, and standard AI environment libraries.
183
+
184
+ ---
185
+
186
+ ### āš™ļø .NET Core C# Pack
187
+ Designed for enterprise-level applications written in C# on .NET Core.
188
+ - **Default Architecture:** Clean-architecture layers (controllers, application services, domain interfaces, and infrastructure/data layers).
189
+ - **Tooling Defaults:** C# styling guides, standard `dotnet test` suites.
190
+
191
+ ---
192
+
193
+ ### 🐹 Go Pack
194
+ High-performance Go backend structures.
195
+ - **Default Architecture:** Go standard layout structures, clear service boundary interfaces, and separation of concerns.
196
+ - **Tooling Defaults:** `go fmt`, `go vet`, and standard go test execution.
197
+
198
+ ---
199
+
200
+ ### šŸ¦€ Rust Pack
201
+ Memory-safe, high-performance systems and backend libraries in Rust.
202
+ - **Default Architecture:** Workspace modules, cargo configurations, and library/binary structures.
203
+ - **Tooling Defaults:** `cargo clippy`, `cargo fmt`, and standard Rust test suites.
204
+
205
+ ---
206
+
207
+ ### šŸ“¦ DevOps Stack Pack
208
+ Standardizes container, pipeline, and automation configurations.
209
+ - **Default Architecture:** Multi-stage Dockerfiles, Docker Compose environment setups, and CI/CD pipelines (GitHub Actions, GitLab CI).
210
+
211
+ ---
212
+
213
+ ### šŸ“Š Diagram Pack
214
+ Organizes system designs and architectures using standard diagrams.
215
+ - **Default Architecture:** Standard guidelines for UML, Mermaid blocks, and PlantUML designs.
216
+
217
+ ---
218
+
165
219
  ## šŸš€ Quick Start
166
220
 
167
221
  Initialize the toolkit instantly inside your project repository using `npx` (no local installation required):
168
222
 
169
223
  ```bash
170
- # 1. Initialize rules and custom skills for the project
224
+ # 1. Launch the local configuration wizard web dashboard (Optional)
225
+ npx agent-workflow-kit-cli ui
226
+
227
+ # 2. Or initialize rules and custom skills directly via CLI
171
228
  npx agent-workflow-kit-cli init
172
229
 
173
- # 2. View the generated AGENTS.md guidelines at your repository root
230
+ # 3. View the generated AGENTS.md guidelines at your repository root
174
231
  cat AGENTS.md
175
232
 
176
- # 3. Export custom skills to register them with Antigravity
233
+ # 4. Export custom skills to register them with Antigravity
177
234
  npx agent-workflow-kit-cli export antigravity
178
235
 
179
- # 4. Enable pre-commit auto-validation hook
236
+ # 5. Enable pre-commit auto-validation hook
180
237
  npx agent-workflow-kit-cli doctor --install-hook
181
238
  ```
182
239
 
@@ -191,12 +248,12 @@ npx agent-workflow-kit-cli <command> [options]
191
248
  ```
192
249
 
193
250
  ### 1. `init`
194
- Analyzes the directory manifests (`package.json`, `pom.xml`, `pyproject.toml`) and bootstraps agent guidelines (`AGENTS.md`) and custom skills (`.agents/`).
251
+ Analyzes the directory manifests (`package.json`, `pom.xml`, `pyproject.toml`, etc.) and bootstraps agent guidelines (`AGENTS.md`) and custom skills (`.agents/`).
195
252
 
196
253
  * **Usage:** `npx agent-workflow-kit-cli init [options]`
197
254
  * **Options:**
198
255
  * `--stack <stack>`: Specify the target project stack.
199
- * Values: `auto`, `spring-boot`, `react-ts`, `fastapi`
256
+ * Values: `auto`, `spring-boot`, `react-ts`, `next-js`, `nestjs`, `express`, `fastapi`, `python-ai`, `dotnet`, `golang`, `rust`, `devops`, `diagram`
200
257
  * Default: `auto` (auto-detects project manifests)
201
258
  * `--agent <agent>`: Target profile settings.
202
259
  * Values: `both`, `codex`, `antigravity`
@@ -205,7 +262,30 @@ Analyzes the directory manifests (`package.json`, `pom.xml`, `pyproject.toml`) a
205
262
 
206
263
  ---
207
264
 
208
- ### 2. `sync`
265
+ ### 2. `ui`
266
+ Launches the local configuration wizard web dashboard in your browser.
267
+
268
+ * **Usage:** `npx agent-workflow-kit-cli ui [options]`
269
+ * **Options:**
270
+ * `-p, --port <port>`: Port to run the UI server on.
271
+ * Default: `4321`
272
+
273
+ ---
274
+
275
+ ### 3. `add <stack>`
276
+ Manually installs a specific stack pack guidelines and templates to a folder.
277
+
278
+ * **Usage:** `npx agent-workflow-kit-cli add <stack> [options]`
279
+ * **Arguments:**
280
+ * `<stack>`: The stack pack name (e.g. `spring-boot`, `react-ts`, `rust`, etc.).
281
+ * **Options:**
282
+ * `--path <path>`: Target folder path to install the guidelines (default: `.`).
283
+ * `--agent <agent>`: Specify target agent profile: `both | codex | antigravity` (default: `both`).
284
+ * `--dry-run`: Simulation mode. Logs actions without writing files to disk.
285
+
286
+ ---
287
+
288
+ ### 4. `sync`
209
289
  Re-evaluates the manifests and updates existing guidelines/skills inside the workspace without touching user modifications. It writes changes inside the `<!-- AWK-START: <id> -->` managed blocks.
210
290
 
211
291
  * **Usage:** `npx agent-workflow-kit-cli sync [options]`
@@ -214,7 +294,7 @@ Re-evaluates the manifests and updates existing guidelines/skills inside the wor
214
294
 
215
295
  ---
216
296
 
217
- ### 3. `doctor`
297
+ ### 5. `doctor`
218
298
  Checks consistency of active agent configurations, environment setups, and executes the validation test commands configured for detected stacks.
219
299
 
220
300
  * **Usage:** `npx agent-workflow-kit-cli doctor [options]`
@@ -223,7 +303,7 @@ Checks consistency of active agent configurations, environment setups, and execu
223
303
 
224
304
  ---
225
305
 
226
- ### 4. `export <target>`
306
+ ### 6. `export <target>`
227
307
  Exports and bundles custom workflows and skills in `.agents/skills/` into a single consolidated string optimized for the target AI agent console.
228
308
 
229
309
  * **Usage:** `npx agent-workflow-kit-cli export <target> [options]`
@@ -231,6 +311,75 @@ Exports and bundles custom workflows and skills in `.agents/skills/` into a sing
231
311
  * `<target>`: The name of the target agent (e.g., `antigravity`).
232
312
  * **Options:**
233
313
  * `--no-clipboard`: Prevents the CLI from copying the bundled instructions directly to the system clipboard (by default, it will attempt to copy to the clipboard first, fallback to printing on stdout).
314
+ * `-o, --output <file>`: Write the exported guidelines to a specific file.
315
+
316
+ ---
317
+
318
+ ### 7. `run <workflow>`
319
+ Runs an AWOS graph workflow directly from the command line.
320
+
321
+ * **Usage:** `npx agent-workflow-kit-cli run <workflow> [options]`
322
+ * **Arguments:**
323
+ * `<workflow>`: Path to the workflow JSON configuration.
324
+ * **Options:**
325
+ * `--inputs <inputs>`: Path to input parameters JSON file or inline JSON string.
326
+ * `--dry-run`: Run workflow nodes in dry-run simulation mode.
327
+
328
+ ---
329
+
330
+ ### 8. `resume <runId>`
331
+ Resumes a suspended or paused AWOS workflow run.
332
+
333
+ * **Usage:** `npx agent-workflow-kit-cli resume <runId>`
334
+ * **Arguments:**
335
+ * `<runId>`: The ID of the suspended workflow run.
336
+
337
+ ---
338
+
339
+ ### 9. `profile`
340
+ Validates directory architecture structure and rule boundaries using custom structural rules.
341
+
342
+ * **Usage:** `npx agent-workflow-kit-cli profile [options]`
343
+ * **Options:**
344
+ * `--profile <profile>`: Target profile name (e.g. `clean-architecture`).
345
+
346
+ ---
347
+
348
+ ### 10. `workflow` (Subcommands)
349
+ Manage and execute registered AWOS workflow packs.
350
+
351
+ * **Subcommands:**
352
+ * `list`: List all discovered/registered workflow packs.
353
+ * `show <id>`: Show details, steps, and metadata of a workflow pack.
354
+ * `validate <id>`: Validate a workflow pack's JSON schema and graph cycle constraints.
355
+ * `run <id> [options]`: Execute a registered workflow pack by ID (options: `--inputs`, `--dry-run`).
356
+
357
+ ---
358
+
359
+ ### 11. `role` (Subcommands)
360
+ Manage agent role profiles.
361
+
362
+ * **Subcommands:**
363
+ * `list`: List all discovered agent role profiles in the catalog.
364
+ * `show <id>`: Show agent role details, checkpoints, and inputs schema.
365
+ * `validate`: Validate all role catalog configuration files against schema parameters.
366
+
367
+ ---
368
+
369
+ ### 12. `adr` (Subcommands)
370
+ Manage Architectural Decision Records (ADR).
371
+
372
+ * **Subcommands:**
373
+ * `create [options]`: Create a new numbered ADR document. Options:
374
+ * `--title <title>`: ADR title.
375
+ * `--status <status>`: Status: `proposed | accepted | rejected | superseded` (default: `proposed`).
376
+ * `--context <context>`: Background context.
377
+ * `--decision <decision>`: Decision details.
378
+ * `--consequences <consequences>`: Repercussions/consequences.
379
+ * `--decision-maker <maker>`: Name/role of decision maker (default: `AWOS System`).
380
+ * `list`: List all saved ADR documents.
381
+ * `show <id>`: Display details of a numbered ADR document.
382
+ * `search <keyword>`: Search all ADR documents for keyword text matches.
234
383
 
235
384
  ---
236
385
 
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ import chalk from "chalk";
6
+ import { promises as fs } from "fs";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+ import { runInit } from "./init.js";
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const TEMPLATES_DIR = path.resolve(__dirname, "../../../templates");
13
+ export async function runCreate(template, projectNameInput, options) {
14
+ console.log(chalk.bold.cyan("\nšŸš€ Agent Workflow Kit - Creating New Project..."));
15
+ console.log(chalk.dim("------------------------------------------"));
16
+ const validTemplates = ["spring-boot", "react-ts"];
17
+ if (!validTemplates.includes(template)) {
18
+ console.error(chalk.red(`Error: Invalid template '${template}'. Supported templates are: ${validTemplates.join(", ")}`));
19
+ process.exit(1);
20
+ }
21
+ const projectName = projectNameInput || `my-${template}-project`;
22
+ const targetDir = path.resolve(process.cwd(), projectName);
23
+ console.log(`${chalk.bold("Template:")} ${chalk.green(template)}`);
24
+ console.log(`${chalk.bold("Project Name:")} ${chalk.green(projectName)}`);
25
+ console.log(`${chalk.bold("Target Dir:")} ${chalk.green(targetDir)}`);
26
+ console.log(`${chalk.bold("Dry Run:")} ${options.dryRun ? chalk.yellow("Enabled 🧪") : chalk.gray("Disabled")}`);
27
+ console.log(chalk.dim("------------------------------------------\n"));
28
+ // Verify target directory doesn't exist or is empty
29
+ try {
30
+ const stat = await fs.stat(targetDir);
31
+ if (stat.isDirectory()) {
32
+ const files = await fs.readdir(targetDir);
33
+ if (files.length > 0) {
34
+ console.error(chalk.red(`Error: Directory '${targetDir}' already exists and is not empty.`));
35
+ process.exit(1);
36
+ }
37
+ }
38
+ }
39
+ catch {
40
+ // Directory doesn't exist, which is fine
41
+ }
42
+ const templateProjectDir = path.join(TEMPLATES_DIR, template, "project");
43
+ // Verify template project skeleton exists
44
+ try {
45
+ await fs.access(templateProjectDir);
46
+ }
47
+ catch {
48
+ console.error(chalk.red(`Error: Project template for '${template}' was not found.`));
49
+ process.exit(1);
50
+ }
51
+ const safePackageName = projectName
52
+ .toLowerCase()
53
+ .replace(/[^a-z0-9]/g, "");
54
+ if (options.dryRun) {
55
+ console.log(chalk.yellow(`[Dry Run] Would create project directory: ${targetDir}`));
56
+ await listTemplateFilesDry(templateProjectDir, templateProjectDir, targetDir, safePackageName);
57
+ console.log(chalk.bold.green("\nšŸŽ‰ Dry Run completed successfully!"));
58
+ return;
59
+ }
60
+ // Create project directory
61
+ await fs.mkdir(targetDir, { recursive: true });
62
+ // Copy and interpolate template files
63
+ await copyAndInterpolate(templateProjectDir, templateProjectDir, targetDir, projectName, safePackageName);
64
+ console.log(chalk.green(`āœ”ļø Project skeleton for ${template} created successfully.`));
65
+ // Initialize agent guidelines in the new project directory
66
+ console.log(chalk.cyan("\nInitializing AI agent guidelines inside project..."));
67
+ const originalCwd = process.cwd();
68
+ try {
69
+ process.chdir(targetDir);
70
+ await runInit({
71
+ stack: template,
72
+ agent: "both",
73
+ dryRun: false,
74
+ });
75
+ }
76
+ catch (err) {
77
+ console.error(chalk.red(`Warning: Failed to initialize agent guidelines: ${err instanceof Error ? err.message : String(err)}`));
78
+ }
79
+ finally {
80
+ process.chdir(originalCwd);
81
+ }
82
+ printCreateSuccess(projectName, template);
83
+ }
84
+ async function listTemplateFilesDry(baseSrc, currentSrc, destDir, safePackageName) {
85
+ const entries = await fs.readdir(currentSrc, { withFileTypes: true });
86
+ for (const entry of entries) {
87
+ const srcPath = path.join(currentSrc, entry.name);
88
+ // Resolve entry destination name (mapping packageName to safePackageName)
89
+ let destName = entry.name;
90
+ if (entry.name === "packageName") {
91
+ destName = safePackageName;
92
+ }
93
+ const relativePart = path.relative(baseSrc, srcPath);
94
+ let resolvedRelativePart = relativePart
95
+ .replace(/\\/g, "/")
96
+ .replace(/\bpackageName\b/g, safePackageName);
97
+ if (resolvedRelativePart.endsWith(".hbs")) {
98
+ resolvedRelativePart = resolvedRelativePart.slice(0, -4);
99
+ }
100
+ const targetPath = path.join(destDir, resolvedRelativePart);
101
+ if (entry.isDirectory()) {
102
+ console.log(chalk.gray(`[Dry Run] Would create directory: ${targetPath}`));
103
+ await listTemplateFilesDry(baseSrc, srcPath, destDir, safePackageName);
104
+ }
105
+ else {
106
+ console.log(chalk.gray(`[Dry Run] Would write file: ${targetPath}`));
107
+ }
108
+ }
109
+ }
110
+ async function copyAndInterpolate(baseSrc, currentSrc, destDir, projectName, safePackageName) {
111
+ const entries = await fs.readdir(currentSrc, { withFileTypes: true });
112
+ for (const entry of entries) {
113
+ const srcPath = path.join(currentSrc, entry.name);
114
+ // Resolve destination path (replaces 'packageName' directory or file parts)
115
+ let destName = entry.name;
116
+ if (entry.name === "packageName") {
117
+ destName = safePackageName;
118
+ }
119
+ const relativePart = path.relative(baseSrc, srcPath);
120
+ let resolvedRelativePart = relativePart
121
+ .replace(/\\/g, "/")
122
+ .replace(/\bpackageName\b/g, safePackageName);
123
+ if (resolvedRelativePart.endsWith(".hbs")) {
124
+ resolvedRelativePart = resolvedRelativePart.slice(0, -4);
125
+ }
126
+ const targetPath = path.join(destDir, resolvedRelativePart);
127
+ if (entry.isDirectory()) {
128
+ await fs.mkdir(targetPath, { recursive: true });
129
+ await copyAndInterpolate(baseSrc, srcPath, destDir, projectName, safePackageName);
130
+ }
131
+ else {
132
+ await fs.mkdir(path.dirname(targetPath), { recursive: true });
133
+ // Interpolate text files
134
+ const content = await fs.readFile(srcPath, "utf8");
135
+ const interpolated = content
136
+ .replace(/\{\{projectName\}\}/g, projectName)
137
+ .replace(/\{\{safePackageName\}\}/g, safePackageName);
138
+ await fs.writeFile(targetPath, interpolated, "utf8");
139
+ }
140
+ }
141
+ }
142
+ function printCreateSuccess(projectName, template) {
143
+ console.log(chalk.bold.green(`\nšŸŽ‰ Project '${projectName}' bootstrapped successfully!`));
144
+ console.log(chalk.bold.cyan("\nšŸ‘‰ Next Steps to run/develop:"));
145
+ console.log(chalk.dim("------------------------------------------"));
146
+ console.log(chalk.white(`1. Change directory:`));
147
+ console.log(chalk.cyan(` cd ${projectName}`));
148
+ if (template === "spring-boot") {
149
+ console.log(chalk.white(`2. Build project using Maven:`));
150
+ console.log(chalk.cyan(` mvn clean install`));
151
+ console.log(chalk.white(`3. Run the Spring Boot application:`));
152
+ console.log(chalk.cyan(` mvn spring-boot:run`));
153
+ }
154
+ else if (template === "react-ts") {
155
+ console.log(chalk.white(`2. Install dependencies:`));
156
+ console.log(chalk.cyan(` npm install`));
157
+ console.log(chalk.white(`3. Start the Vite dev server:`));
158
+ console.log(chalk.cyan(` npm run dev`));
159
+ }
160
+ console.log(chalk.white(`4. Start coding! AI guidelines and rules are already configured.`));
161
+ console.log(chalk.dim("------------------------------------------\n"));
162
+ }
@@ -0,0 +1,192 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ import http from "http";
6
+ import fs from "fs/promises";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+ import chalk from "chalk";
10
+ import { exec } from "child_process";
11
+ import { detectProjectModules } from "../../core/detector.js";
12
+ import { runInit } from "./init.js";
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
15
+ // Map file extensions to MIME types
16
+ const MIME_TYPES = {
17
+ ".html": "text/html",
18
+ ".css": "text/css",
19
+ ".js": "text/javascript",
20
+ ".json": "application/json",
21
+ ".png": "image/png",
22
+ ".jpg": "image/jpeg",
23
+ ".jpeg": "image/jpeg",
24
+ ".gif": "image/gif",
25
+ ".svg": "image/svg+xml",
26
+ ".ico": "image/x-icon",
27
+ };
28
+ // Find static assets directory in dev and production build structures
29
+ async function findUiDistDir() {
30
+ const possiblePaths = [
31
+ // Production path (dist/ui-dist) relative to dist/cli/commands/ui.js
32
+ path.join(__dirname, "..", "..", "..", "ui-dist"),
33
+ // Development path relative to src/cli/commands/ui.ts
34
+ path.join(__dirname, "..", "..", "..", "..", "agent-workflow-kit", "dist"),
35
+ ];
36
+ for (const p of possiblePaths) {
37
+ try {
38
+ const stats = await fs.stat(p);
39
+ if (stats.isDirectory()) {
40
+ return p;
41
+ }
42
+ }
43
+ catch {
44
+ // Continue searching
45
+ }
46
+ }
47
+ throw new Error("Could not find frontend UI assets directory (ui-dist). Make sure the Vite app is built.");
48
+ }
49
+ // Open URL in native browser
50
+ function openBrowser(url) {
51
+ const startCmd = process.platform === "win32" ? "start" : process.platform === "darwin" ? "open" : "xdg-open";
52
+ if (process.platform === "win32") {
53
+ // Windows start requires extra care with double quotes
54
+ exec(`start "" "${url}"`);
55
+ }
56
+ else {
57
+ exec(`${startCmd} "${url}"`);
58
+ }
59
+ }
60
+ export async function runUiServer(options) {
61
+ const port = parseInt(options.port, 10) || 4321;
62
+ const cwd = process.cwd();
63
+ let uiDistDir = "";
64
+ try {
65
+ uiDistDir = await findUiDistDir();
66
+ }
67
+ catch (err) {
68
+ console.error(chalk.red(`\nāŒ Error: ${err.message}`));
69
+ console.log(chalk.yellow("šŸ‘‰ Please run 'npm run build' in the 'agent-workflow-kit' directory first.\n"));
70
+ process.exit(1);
71
+ }
72
+ const server = http.createServer(async (req, res) => {
73
+ // Enable CORS for development mode proxying
74
+ res.setHeader("Access-Control-Allow-Origin", "*");
75
+ res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
76
+ res.setHeader("Access-Control-Allow-Headers", "Content-Type");
77
+ if (req.method === "OPTIONS") {
78
+ res.writeHead(200);
79
+ res.end();
80
+ return;
81
+ }
82
+ const url = new URL(req.url || "/", `http://localhost:${port}`);
83
+ const pathname = url.pathname;
84
+ // API - GET /api/status
85
+ if (pathname === "/api/status" && req.method === "GET") {
86
+ try {
87
+ const detected = await detectProjectModules(cwd);
88
+ res.writeHead(200, { "Content-Type": "application/json" });
89
+ res.end(JSON.stringify({
90
+ isLocalCli: true,
91
+ cwd,
92
+ detectedModules: detected,
93
+ }));
94
+ }
95
+ catch (err) {
96
+ res.writeHead(500, { "Content-Type": "application/json" });
97
+ res.end(JSON.stringify({ error: err.message }));
98
+ }
99
+ return;
100
+ }
101
+ // API - POST /api/generate
102
+ if (pathname === "/api/generate" && req.method === "POST") {
103
+ let body = "";
104
+ req.on("data", (chunk) => {
105
+ body += chunk;
106
+ });
107
+ req.on("end", async () => {
108
+ try {
109
+ const config = JSON.parse(body);
110
+ const stack = config.stack || "auto";
111
+ const agent = config.agent || "both";
112
+ const dryRun = !!config.dryRun;
113
+ const logs = [];
114
+ const originalLog = console.log;
115
+ const originalWarn = console.warn;
116
+ const originalError = console.error;
117
+ // Capture console outputs to send back to the web console UI
118
+ console.log = (...args) => {
119
+ logs.push(args.join(" "));
120
+ originalLog(...args);
121
+ };
122
+ console.warn = (...args) => {
123
+ logs.push("[WARN] " + args.join(" "));
124
+ originalWarn(...args);
125
+ };
126
+ console.error = (...args) => {
127
+ logs.push("[ERROR] " + args.join(" "));
128
+ originalError(...args);
129
+ };
130
+ try {
131
+ await runInit({ stack, agent, dryRun });
132
+ res.writeHead(200, { "Content-Type": "application/json" });
133
+ res.end(JSON.stringify({ success: true, logs }));
134
+ }
135
+ catch (err) {
136
+ res.writeHead(500, { "Content-Type": "application/json" });
137
+ res.end(JSON.stringify({ success: false, error: err.message, logs }));
138
+ }
139
+ finally {
140
+ // Restore console methods
141
+ console.log = originalLog;
142
+ console.warn = originalWarn;
143
+ console.error = originalError;
144
+ }
145
+ }
146
+ catch (err) {
147
+ res.writeHead(400, { "Content-Type": "application/json" });
148
+ res.end(JSON.stringify({ error: "Invalid JSON payload" }));
149
+ }
150
+ });
151
+ return;
152
+ }
153
+ // Serve Static Files
154
+ let filePath = path.join(uiDistDir, pathname === "/" ? "index.html" : pathname);
155
+ // Guard against directory traversal attacks
156
+ if (!filePath.startsWith(uiDistDir)) {
157
+ res.writeHead(403);
158
+ res.end("Forbidden");
159
+ return;
160
+ }
161
+ try {
162
+ let stats = await fs.stat(filePath);
163
+ if (stats.isDirectory()) {
164
+ filePath = path.join(filePath, "index.html");
165
+ }
166
+ const content = await fs.readFile(filePath);
167
+ const ext = path.extname(filePath).toLowerCase();
168
+ const contentType = MIME_TYPES[ext] || "application/octet-stream";
169
+ res.writeHead(200, { "Content-Type": contentType });
170
+ res.end(content);
171
+ }
172
+ catch {
173
+ // For SPA fallback support: Serve index.html if file not found
174
+ try {
175
+ const indexContent = await fs.readFile(path.join(uiDistDir, "index.html"));
176
+ res.writeHead(200, { "Content-Type": "text/html" });
177
+ res.end(indexContent);
178
+ }
179
+ catch {
180
+ res.writeHead(404);
181
+ res.end("Not Found");
182
+ }
183
+ }
184
+ });
185
+ server.listen(port, () => {
186
+ const localUrl = `http://localhost:${port}`;
187
+ console.log(chalk.bold.green(`\nšŸ–„ļø Agent Workflow Kit local dashboard running at: ${localUrl}`));
188
+ console.log(chalk.dim(`Press Ctrl+C to stop the server.\n`));
189
+ // Automatically open in user browser
190
+ openBrowser(localUrl);
191
+ });
192
+ }
package/dist/cli/index.js CHANGED
@@ -5,6 +5,8 @@
5
5
  import { Command } from "commander";
6
6
  import chalk from "chalk";
7
7
  import { runInit } from "./commands/init.js";
8
+ import { runCreate } from "./commands/create.js";
9
+ import { runUiServer } from "./commands/ui.js";
8
10
  import { runAdd } from "./commands/add.js";
9
11
  import { runSync } from "./commands/sync.js";
10
12
  import { runDoctor } from "./commands/doctor.js";
@@ -19,7 +21,20 @@ export function runCli() {
19
21
  program
20
22
  .name("agent-workflow-kit")
21
23
  .description("Generate AI coding workflows/rules/templates for Codex and Antigravity")
22
- .version("1.3.2");
24
+ .version("1.3.6");
25
+ program
26
+ .command("create <template> [projectName]")
27
+ .description("Bootstrap a new project structure with AI workflow rules pre-configured")
28
+ .option("--dry-run", "Output actions to console without creating folders", false)
29
+ .action(async (template, projectName, options) => {
30
+ try {
31
+ await runCreate(template, projectName, options);
32
+ }
33
+ catch (err) {
34
+ console.error(chalk.red(`Error running create: ${err instanceof Error ? err.message : String(err)}`));
35
+ process.exit(1);
36
+ }
37
+ });
23
38
  program
24
39
  .command("init")
25
40
  .description("Initialize agent guidelines and skills for the repository")
@@ -35,6 +50,19 @@ export function runCli() {
35
50
  process.exit(1);
36
51
  }
37
52
  });
53
+ program
54
+ .command("ui")
55
+ .description("Launch the local configuration wizard web dashboard")
56
+ .option("-p, --port <port>", "Port to run the UI server on", "4321")
57
+ .action(async (options) => {
58
+ try {
59
+ await runUiServer(options);
60
+ }
61
+ catch (err) {
62
+ console.error(chalk.red(`Error running ui: ${err instanceof Error ? err.message : String(err)}`));
63
+ process.exit(1);
64
+ }
65
+ });
38
66
  program
39
67
  .command("add <stack>")
40
68
  .description("Manually add/install a stack pack to a specific folder")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-workflow-kit-cli",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "AI-Ready Repository Workflow Generator & Guideline Optimizer for Codex and Antigravity",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,14 +11,16 @@
11
11
  "files": [
12
12
  "dist",
13
13
  "templates",
14
+ "ui-dist",
14
15
  "LICENSE",
15
16
  "README.md"
16
17
  ],
17
18
  "scripts": {
18
19
  "build": "tsc",
20
+ "build:ui": "node scripts/copy-ui.js",
19
21
  "start": "node dist/index.js",
20
22
  "test": "vitest run",
21
- "prepublishOnly": "npm run build && npm test"
23
+ "prepublishOnly": "npm run build && npm run build:ui && npm test"
22
24
  },
23
25
  "author": "Truong & Cat",
24
26
  "license": "MIT",
@@ -0,0 +1,24 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?