@gxp-dev/tools 2.0.71 → 2.0.73

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 CHANGED
@@ -1,16 +1,16 @@
1
1
  # GxP Dev Tools
2
2
 
3
- A development toolkit for creating plugins for the GxP kiosk platform. Provides CLI tools, project scaffolding, an interactive TUI, and a development environment that emulates the GxP platform.
3
+ A development toolkit for building plugins for the GxP kiosk platform. Ships a CLI, an interactive TUI, a platform emulator for local dev, a JSON-config linter, and a Model Context Protocol (MCP) server that gives AI coding assistants 29 specialized tools across API specs, config editing, documentation search, and test scaffolding.
4
4
 
5
5
  ## Installation
6
6
 
7
- ### Global (Recommended)
7
+ ### Global (recommended)
8
8
 
9
9
  ```bash
10
10
  npm install -g @gxp-dev/tools
11
11
  ```
12
12
 
13
- ### Project-Level
13
+ ### Project-level
14
14
 
15
15
  ```bash
16
16
  npm install --save-dev @gxp-dev/tools
@@ -19,30 +19,26 @@ npm install --save-dev @gxp-dev/tools
19
19
  ### Updating
20
20
 
21
21
  ```bash
22
- # Global
23
- npm update -g @gxp-dev/tools
24
-
25
- # Project-level
26
- npm update @gxp-dev/tools
22
+ npm update -g @gxp-dev/tools # global
23
+ npm update @gxp-dev/tools # project-level
27
24
  ```
28
25
 
29
- After updating, run `gxdev init` in existing projects to sync dependencies and config files.
26
+ After updating, run `gxdev init` in existing projects to sync required dependencies, scripts, and config files.
30
27
 
31
28
  ## Quick Start
32
29
 
33
- ### New Project
30
+ ### New project
34
31
 
35
32
  ```bash
36
33
  gxdev init my-plugin
37
34
  cd my-plugin
35
+ npm install
38
36
  npm run dev-http
39
37
  ```
40
38
 
41
- Your plugin is running at `http://localhost:3060`. Press `Ctrl+Shift+D` to open the in-browser Dev Tools.
42
-
43
- ### Existing Project
39
+ Open `http://localhost:3060`. Press `Ctrl+Shift+D` for the in-browser Dev Tools (Store Inspector, Layout Switcher, Socket Simulator, Mock Data Editor).
44
40
 
45
- If you already have a Vue/Vite project:
41
+ ### Adding to an existing project
46
42
 
47
43
  ```bash
48
44
  cd my-existing-project
@@ -51,102 +47,133 @@ npm install
51
47
  npm run dev-http
52
48
  ```
53
49
 
54
- When run in a directory with an existing `package.json` (no name argument), `gxdev init` will:
50
+ When run in a directory with an existing `package.json` and no name argument, `gxdev init`:
55
51
 
56
- - Add missing required dependencies and devDependencies
57
- - Update mismatched dependency versions
58
- - Add missing npm scripts (`dev`, `build`, `dev-http`, etc.)
59
- - Back up your existing `vite.config.js` to `vite.config.js.backup`
60
- - Copy config files (`app-manifest.json`, `.env.example`, store setup, AI agent configs)
52
+ - Adds missing required dependencies and devDependencies (Vue, Pinia, Vite, ESLint, Prettier, Vitest, Vue Test Utils, toolkit itself).
53
+ - Sets `"type": "module"` if the field is missing (preserves an explicit `"commonjs"`).
54
+ - Adds missing npm scripts (`dev`, `build`, `test`, `lint`, `format`, `prepare`, socket/assets/datastore helpers).
55
+ - Copies bundle files: `app-manifest.json`, `configuration.json`, `app-instructions.md`, `vite.extend.js`, `eslint.config.js`, `.prettierrc`, `.githooks/pre-commit`, `.env.example`, store setup, AI agent configs.
56
+ - Creates `src/public/` for static assets (served by Vite at `/src/public/*`).
61
57
 
62
- It will **not** overwrite your source files (`src/`, `theme-layouts/`, etc.).
58
+ It does **not** overwrite your source files (`src/`, `theme-layouts/`, etc.).
63
59
 
64
60
  ## CLI Commands
65
61
 
66
- | Command | Description |
67
- | -------------------------- | ------------------------------------------------------ |
68
- | `gxdev` | Launch interactive TUI |
69
- | `gxdev init [name]` | Create a new project or update an existing one |
70
- | `gxdev dev` | Start development server (HTTPS + TUI) |
71
- | `gxdev dev --no-https` | Start with HTTP only |
72
- | `gxdev dev --with-socket` | Start with Socket.IO server |
73
- | `gxdev dev --chrome` | Start and launch Chrome with extension |
74
- | `gxdev dev --firefox` | Start and launch Firefox with extension |
75
- | `gxdev build` | Build plugin for production |
76
- | `gxdev setup-ssl` | Generate SSL certificates for HTTPS development |
77
- | `gxdev publish <file>` | Copy runtime files to your project for customization |
78
- | `gxdev datastore <action>` | Manage GxP datastore (list, add, scan-strings, config) |
79
- | `gxdev socket <action>` | Simulate socket events (list, send) |
80
- | `gxdev assets <action>` | Manage development assets (list, init, generate) |
81
- | `gxdev add-dependency` | Add API dependency via interactive wizard |
82
- | `gxdev extract-config` | Extract GxP config from source files |
83
- | `gxdev ext:chrome` | Launch Chrome with browser extension |
84
- | `gxdev ext:firefox` | Launch Firefox with browser extension |
85
- | `gxdev ext:build` | Build browser extensions for distribution |
62
+ | Command | Description |
63
+ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
+ | `gxdev` | Launch the interactive TUI |
65
+ | `gxdev init [name]` | Create a new project or update an existing one |
66
+ | `gxdev dev` | Start the dev server (HTTPS + Vite + Socket.IO) |
67
+ | `gxdev dev --no-https` | HTTP only |
68
+ | `gxdev dev --no-socket` | Skip the Socket.IO server |
69
+ | `gxdev dev --with-mock` | Enable the local Mock API (routes under `/api/*`) |
70
+ | `gxdev dev --chrome` | Start dev + launch Chrome with the inspector extension |
71
+ | `gxdev dev --firefox` | Start dev + launch Firefox with the inspector extension |
72
+ | `gxdev build` | Build the plugin for production → `dist/<name>.gxpapp` |
73
+ | `gxdev lint [files..]` | Validate `configuration.json` / `app-manifest.json` against the templating schema. `--all` lints every known config file in the project. `--json` emits machine-readable results. |
74
+ | `gxdev extract-config` | Scan `src/` for GxP directives and store calls; merge findings into `app-manifest.json` |
75
+ | `gxdev add-dependency` | Build an API dependency entry via interactive wizard |
76
+ | `gxdev setup-ssl` | Generate local SSL certificates via mkcert |
77
+ | `gxdev publish <file>` | Copy a runtime file (`main.js`, `index.html`, `server.cjs`, `gxpPortalConfigStore.js`) into the project for customization. For Vite config changes, use `vite.extend.js` at the project root instead. |
78
+ | `gxdev datastore <action>` | Manage the GxP datastore (`list`, `add`, `scan-strings`, `config`) |
79
+ | `gxdev socket <action>` | Simulate socket events (`list`, `send`) |
80
+ | `gxdev assets <action>` | Manage dev assets (`list`, `init`, `generate`) |
81
+ | `gxdev ext:chrome` / `ext:firefox` | Launch the browser inspector extension |
82
+ | `gxdev ext:build` | Build the browser extensions for distribution |
86
83
 
87
84
  ## Features
88
85
 
89
- - **Platform Emulator** - PortalContainer.vue mimics the GxP platform environment
90
- - **Interactive TUI** - Terminal UI for managing dev services, logs, and slash commands
91
- - **Hot Module Replacement** - Instant updates during development
92
- - **Socket.IO Integration** - Test real-time features with simulated events
93
- - **SSL Support** - HTTPS development with auto-generated certificates
94
- - **Browser Extensions** - Chrome/Firefox DevTools panel for inspecting plugins
95
- - **Dev Tools Modal** - In-browser tools for inspecting state, switching layouts, and more (Ctrl+Shift+D)
96
- - **AI Scaffolding** - Generate starter code with Claude, Codex, or Gemini during init
97
- - **Mock API** - Local mock API server with OpenAPI spec integration
98
- - **Asset Generation** - Create placeholder images for development
86
+ - **Platform emulator** — `PortalContainer.vue` mimics the live GxP environment so plugins render exactly like production.
87
+ - **Interactive TUI** — terminal UI for managing dev services, streaming logs, and firing slash commands.
88
+ - **HMR + HTTPS** — Vite 8 dev server with mkcert-generated certs (or HTTP fallback).
89
+ - **GxP Strings Plugin** — `gxp-string` / `gxp-src` / `gxp-settings` / `gxp-state` directives pull live values from the datastore, editable in the in-browser Dev Tools.
90
+ - **Socket.IO integration** — real-time events with a local server; CLI `socket send` simulates events on demand.
91
+ - **Mock API** — OpenAPI-driven local mock (auto-loads platform specs, routes under `/api/*`).
92
+ - **Browser extensions** — Chrome/Firefox DevTools panels for inspecting Vue component trees and GxP state.
93
+ - **Config linting** — AJV-based JSON Schema validation of `configuration.json` (form-builder definitions) and `app-manifest.json` (plugin metadata + defaults).
94
+ - **Pre-commit hook** — `.githooks/pre-commit` runs Prettier, ESLint, and the GxP linter on staged files; configured automatically via the `prepare` npm script.
95
+ - **Unit testing** — Vitest + `@vue/test-utils` wired out of the box; scaffolded tests via the MCP server.
96
+ - **MCP server** — 29 tools for AI coding assistants (see below).
97
+ - **AI scaffolding** — pre-wired configs for Claude Code, Codex, and Gemini during `init`.
98
+
99
+ ## MCP Server for AI assistants
100
+
101
+ The toolkit ships `gxp-api-server` (bin `@gxp-dev/tools/mcp/gxp-api-server.js`), an MCP server exposing 29 tools across five families. Point your AI assistant at it to get API-aware, schema-aware, test-aware help inside plugin projects:
102
+
103
+ | Family | Tools |
104
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
+ | **API spec** (6) | `get_openapi_spec`, `get_asyncapi_spec`, `search_api_endpoints`, `search_websocket_events`, `get_endpoint_details`, `get_api_environment` |
106
+ | **Extended API** (5) | `api_list_tags`, `api_list_operation_ids`, `api_get_operation_parameters`, `api_find_endpoints_by_schema`, `api_generate_dependency` |
107
+ | **Config editor** (13) | `config_validate`, `config_list_field_types`, `config_list_card_types`, `config_get_field_schema`, `config_list_cards`, `config_list_fields`, `config_add_field`, `config_move_field`, `config_remove_field`, `config_add_card`, `config_move_card`, `config_remove_card`, `config_extract_strings` |
108
+ | **Docs search** (3) | `docs_list_pages`, `docs_search`, `docs_get_page` — full-text across `docs.gxp.dev` via its sitemap |
109
+ | **Test helpers** (2) | `test_scaffold_component_test`, `test_api_route` |
110
+
111
+ Every config mutation is linter-guarded: invalid writes are refused unless `force: true`, so AI agents can't save broken state.
99
112
 
100
113
  ## Project Structure
101
114
 
102
- After `gxdev init`, your project contains:
115
+ After `gxdev init`:
103
116
 
104
117
  ```
105
118
  my-plugin/
106
119
  ā”œā”€ā”€ src/
107
- │ ā”œā”€ā”€ Plugin.vue # Main plugin entry point
108
- │ ā”œā”€ā”€ DemoPage.vue # Example component
120
+ │ ā”œā”€ā”€ Plugin.vue # App entry point
121
+ │ ā”œā”€ā”€ DemoPage.vue # Example component
122
+ │ ā”œā”€ā”€ public/ # Static assets (served at /src/public/*)
109
123
  │ └── stores/
110
- │ └── index.js # Pinia store setup
111
- ā”œā”€ā”€ theme-layouts/ # Layout components (Public, Private, System)
112
- ā”œā”€ā”€ dev-assets/images/ # Development placeholder images
113
- ā”œā”€ā”€ socket-events/ # Socket event templates
114
- ā”œā”€ā”€ app-manifest.json # Plugin configuration (strings, settings, assets)
115
- ā”œā”€ā”€ .env # Environment variables
124
+ │ └── index.js # Pinia store setup
125
+ ā”œā”€ā”€ theme-layouts/ # System/Private/Public layouts
126
+ ā”œā”€ā”€ dev-assets/images/ # Dev placeholder images
127
+ ā”œā”€ā”€ socket-events/ # Socket event templates for simulation
128
+ ā”œā”€ā”€ tests/ # Vitest test files (scaffolded as you go)
129
+ ā”œā”€ā”€ scripts/ # Browser extension launch/pack scripts
130
+ ā”œā”€ā”€ .githooks/pre-commit # Prettier + ESLint + gxdev lint on staged files
131
+ ā”œā”€ā”€ app-manifest.json # Plugin metadata + default strings/settings/assets
132
+ ā”œā”€ā”€ app-instructions.md # End-user onboarding doc (shown on install)
133
+ ā”œā”€ā”€ configuration.json # Admin-panel config form definition
134
+ ā”œā”€ā”€ vite.extend.js # Optional Vite config extension (aliases, plugins)
135
+ ā”œā”€ā”€ eslint.config.js # ESLint flat config (JS + Vue)
136
+ ā”œā”€ā”€ .prettierrc # Prettier config
116
137
  └── package.json
117
138
  ```
118
139
 
119
- The dev server automatically serves `index.html` and `main.js` from the toolkit runtime — no local copies needed.
140
+ The dev server serves `index.html` and `main.js` from the toolkit runtime — no local copies needed unless you opt in with `USE_LOCAL_INDEX` / `USE_LOCAL_MAIN`.
120
141
 
121
142
  ## Environment Variables
122
143
 
123
- Key variables (set in `.env`):
124
-
125
- | Variable | Default | Description |
126
- | ------------------- | ------------------ | ------------------------------------------------------------------------ |
127
- | `NODE_PORT` | `3060` | Development server port |
128
- | `SOCKET_IO_PORT` | `3061` | Socket.IO server port |
129
- | `COMPONENT_PATH` | `./src/Plugin.vue` | Main component path |
130
- | `USE_HTTPS` | `true` | Enable HTTPS |
131
- | `CERT_PATH` | | SSL certificate path |
132
- | `KEY_PATH` | | SSL private key path |
133
- | `USE_LOCAL_INDEX` | | Set to `true` to use a local `index.html` instead of the runtime version |
134
- | `USE_LOCAL_MAIN` | | Set to `true` to use a local `main.js` instead of the runtime version |
135
- | `SOCKET_IO_ENABLED` | `false` | Auto-start Socket.IO |
136
- | `API_ENV` | `mock` | API environment (mock, local, development, staging, production) |
137
-
138
- ## Runtime vs Template
139
-
140
- - **Runtime files** stay in `node_modules/` and are served automatically (`index.html`, `main.js`, store, dev tools, Vite config). Override `index.html`/`main.js` with `USE_LOCAL_INDEX`/`USE_LOCAL_MAIN` env vars. Use `gxdev publish` to copy other runtime files locally for customization.
144
+ Set in `.env` at the project root:
145
+
146
+ | Variable | Default | Description |
147
+ | ------------------------ | ------------------ | -------------------------------------------------------------------------------- |
148
+ | `NODE_PORT` | `3060` | Dev server port |
149
+ | `SOCKET_IO_PORT` | `3069` | Socket.IO server port |
150
+ | `COMPONENT_PATH` | `./src/Plugin.vue` | Main component path |
151
+ | `USE_HTTPS` | `true` | Enable HTTPS |
152
+ | `CERT_PATH` / `KEY_PATH` | | SSL cert/key paths (auto-set by `setup-ssl`) |
153
+ | `USE_LOCAL_INDEX` | | `true` to serve a local `index.html` instead of the runtime version |
154
+ | `USE_LOCAL_MAIN` | | `true` to serve a local `main.js` instead of the runtime version |
155
+ | `DISABLE_SOURCE_TRACKER` | | `true` to skip the source-tracking Vite plugin |
156
+ | `DISABLE_INSPECTOR` | | `true` to skip the component inspector plugin |
157
+ | `API_ENV` | `mock` | API environment (`mock`, `local`, `develop`, `testing`, `staging`, `production`) |
158
+ | `MOCK_API_ENABLED` | `false` | Mount the local mock API at `/api/*` |
159
+ | `ALLOWED_HOSTS` | | Comma-separated list of additional hostnames the dev server should accept |
160
+
161
+ ## Runtime vs. template
162
+
163
+ - **Runtime files** stay in `node_modules/@gxp-dev/tools/runtime/` and are used via imports or served by Vite at request time (`index.html`, `main.js`, store, dev tools, Vite config, inspector plugins). Override `index.html` / `main.js` with the `USE_LOCAL_*` env vars. Use `gxdev publish <file>` to copy other runtime files locally.
141
164
  - **Template files** are copied to your project during `gxdev init` and are fully yours to edit.
165
+ - **`vite.extend.js`** at the project root is deep-merged into the runtime Vite config via `mergeConfig` — add aliases, plugins, and `define` keys without replacing the whole config.
142
166
 
143
167
  ## Documentation
144
168
 
145
- Full documentation is available at the [GxP Documentation site](https://docs.gramercytech.com/gx-devtools).
169
+ - **Full docs**: [docs.gxp.dev](https://docs.gxp.dev)
170
+ - **CLI reference**: `gxdev --help` or [docs.gxp.dev/gx-devtools/cli-reference](https://docs.gxp.dev/gx-devtools/cli-reference)
171
+ - **Getting started**: [docs.gxp.dev/gx-devtools/getting-started](https://docs.gxp.dev/gx-devtools/getting-started)
172
+ - **Platform templating system**: [docs.gxp.dev/platform/plugin-system](https://docs.gxp.dev/platform/plugin-system)
146
173
 
147
174
  ## Contributing
148
175
 
149
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, architecture details, and how to make changes to the toolkit itself.
176
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, architecture, and how to extend the toolkit itself.
150
177
 
151
178
  ## License
152
179
 
package/bin/lib/cli.js CHANGED
@@ -24,6 +24,7 @@ const {
24
24
  extensionInstallCommand,
25
25
  extractConfigCommand,
26
26
  addDependencyCommand,
27
+ lintCommand,
27
28
  } = require("./commands")
28
29
 
29
30
  // Load global configuration
@@ -301,6 +302,23 @@ yargs
301
302
  },
302
303
  extractConfigCommand,
303
304
  )
305
+ .command(
306
+ "lint [files..]",
307
+ "Lint GxP config JSON (configuration.json, app-manifest.json) against the templating schema",
308
+ {
309
+ all: {
310
+ describe: "Lint all known config files in the project root",
311
+ type: "boolean",
312
+ default: false,
313
+ },
314
+ json: {
315
+ describe: "Output results as JSON instead of terminal report",
316
+ type: "boolean",
317
+ default: false,
318
+ },
319
+ },
320
+ lintCommand,
321
+ )
304
322
  .command(
305
323
  "add-dependency",
306
324
  "Add an API dependency to app-manifest.json via interactive wizard",
@@ -20,6 +20,7 @@ const {
20
20
  } = require("./extensions")
21
21
  const { extractConfigCommand } = require("./extract-config")
22
22
  const { addDependencyCommand } = require("./add-dependency")
23
+ const { lintCommand } = require("./lint")
23
24
 
24
25
  module.exports = {
25
26
  initCommand,
@@ -36,4 +37,5 @@ module.exports = {
36
37
  extensionInstallCommand,
37
38
  extractConfigCommand,
38
39
  addDependencyCommand,
40
+ lintCommand,
39
41
  }
@@ -9,8 +9,9 @@
9
9
  * 3. Run interactive configuration:
10
10
  * - App name (prepopulated from package.json)
11
11
  * - Description (prepopulated from package.json)
12
- * - AI scaffolding (optional)
13
- * 4. Prompt to start the app
12
+ * - SSL setup
13
+ * - Launch AI agent (2nd-to-last — replaces the start-server step when chosen)
14
+ * 4. Start Development (skipped if an AI agent was launched)
14
15
  * 5. Prompt to launch browser with extension
15
16
  */
16
17
 
@@ -34,6 +35,7 @@ const {
34
35
  generateSSLCertificates,
35
36
  updateEnvWithCertPaths,
36
37
  runAIScaffolding,
38
+ launchInteractiveAISession,
37
39
  getAvailableProviders,
38
40
  } = require("../utils")
39
41
 
@@ -127,6 +129,22 @@ function copyBundleFiles(projectPath, paths, overwrite = false) {
127
129
  dest: "vite.extend.js",
128
130
  desc: "vite.extend.js (customize the Vite runtime config)",
129
131
  },
132
+ {
133
+ src: "eslint.config.js",
134
+ dest: "eslint.config.js",
135
+ desc: "eslint.config.js (flat config for JS/Vue)",
136
+ },
137
+ {
138
+ src: ".prettierrc",
139
+ dest: ".prettierrc",
140
+ desc: ".prettierrc (format config)",
141
+ },
142
+ {
143
+ src: "githooks/pre-commit",
144
+ dest: ".githooks/pre-commit",
145
+ desc: ".githooks/pre-commit (runs prettier + eslint + gxdev lint)",
146
+ mode: 0o755,
147
+ },
130
148
  { src: "env.example", dest: ".env.example", desc: ".env.example" },
131
149
  { src: "gitignore", dest: ".gitignore", desc: ".gitignore" },
132
150
  {
@@ -162,6 +180,13 @@ function copyBundleFiles(projectPath, paths, overwrite = false) {
162
180
  const srcPath = path.join(paths.templateDir, file.src)
163
181
  const destPath = path.join(projectPath, file.dest)
164
182
  safeCopyFile(srcPath, destPath, file.desc, overwrite)
183
+ if (file.mode && fs.existsSync(destPath)) {
184
+ try {
185
+ fs.chmodSync(destPath, file.mode)
186
+ } catch (_e) {
187
+ // Best-effort — Windows or restrictive FS may reject chmod.
188
+ }
189
+ }
165
190
  })
166
191
  }
167
192
  /**
@@ -378,65 +403,100 @@ async function runInteractiveConfig(projectPath, initialName, isLocal = false) {
378
403
  updatePackageJson(projectPath, appName, description)
379
404
  updateAppManifest(projectPath, appName, description)
380
405
 
381
- // 3. AI Scaffolding
406
+ // 3. SSL Setup
382
407
  console.log("")
383
408
  console.log("─".repeat(50))
384
- console.log("šŸ¤– AI-Powered Scaffolding")
409
+ console.log("šŸ”’ SSL Configuration")
385
410
  console.log("─".repeat(50))
386
- console.log(" Describe what you want to build and AI will generate")
387
- console.log(" starter components, views, and manifest configuration.")
411
+
412
+ const sslChoice = await arrowSelectPrompt(
413
+ "Set up SSL certificates for HTTPS development?",
414
+ [
415
+ {
416
+ label: "Yes, set up SSL",
417
+ value: "yes",
418
+ description: "Recommended for full feature access",
419
+ },
420
+ {
421
+ label: "Skip SSL setup",
422
+ value: "no",
423
+ description: "Can be set up later with npm run setup-ssl",
424
+ },
425
+ ],
426
+ )
427
+
428
+ let sslSetup = false
429
+ if (sslChoice === "yes") {
430
+ console.log("\nšŸ”’ Setting up HTTPS development environment...")
431
+ ensureMkcertInstalled()
432
+ const certs = generateSSLCertificates(projectPath)
433
+ if (certs) {
434
+ updateEnvWithCertPaths(projectPath, certs)
435
+ sslSetup = true
436
+ }
437
+ }
438
+
439
+ // 4. Build with an AI agent (2nd-to-last step)
440
+ //
441
+ // Launches the selected CLI in interactive mode with an initial prompt
442
+ // that points the agent at AGENTS.md / GEMINI.md in the scaffolded project
443
+ // and instructs it to greet the user, ask clarifying questions until it
444
+ // has enough detail, then plan and implement. When an agent is launched
445
+ // we skip the "Start Development" step — the agent session replaces it.
446
+ console.log("")
447
+ console.log("─".repeat(50))
448
+ console.log("šŸ¤– Build with an AI Agent")
449
+ console.log("─".repeat(50))
450
+ console.log(
451
+ " Launch an AI coding agent that already knows the GxP toolkit,",
452
+ )
453
+ console.log(
454
+ " MCP tools, and workflow. The agent will ask you what you want",
455
+ )
456
+ console.log(" to build and then plan and implement it with you.")
388
457
  console.log("")
389
458
 
390
459
  // Check available AI providers
391
460
  const providers = await getAvailableProviders()
392
- const availableProviders = providers.filter((p) => p.available)
461
+ const interactiveProviders = providers.filter(
462
+ (p) => p.available && (p.id !== "gemini" || p.method === "cli"),
463
+ )
393
464
 
394
465
  let aiChoice = "skip"
395
466
  let selectedProvider = null
396
467
 
397
- if (availableProviders.length === 0) {
398
- console.log(" āš ļø No AI providers available.")
399
- console.log(" To enable AI scaffolding, set up one of:")
468
+ if (interactiveProviders.length === 0) {
469
+ console.log(" āš ļø No AI CLIs detected.")
470
+ console.log(
471
+ " To use an AI agent here, install one of the following and retry:",
472
+ )
400
473
  console.log(
401
474
  " • Claude CLI: npm install -g @anthropic-ai/claude-code && claude login",
402
475
  )
403
476
  console.log(" • Codex CLI: npm install -g @openai/codex && codex auth")
404
477
  console.log(" • Gemini CLI: npm install -g @google/gemini-cli && gemini")
405
- console.log(" • Gemini API: export GEMINI_API_KEY=your_key")
406
478
  console.log("")
407
479
  aiChoice = "skip"
408
480
  } else {
409
481
  // Build provider options
410
- const providerOptions = [{ label: "Skip AI scaffolding", value: "skip" }]
411
-
412
- for (const provider of availableProviders) {
413
- let authInfo = ""
414
- if (provider.id === "gemini") {
415
- switch (provider.method) {
416
- case "cli":
417
- authInfo = "logged in"
418
- break
419
- case "api_key":
420
- authInfo = "via API key"
421
- break
422
- case "gcloud":
423
- authInfo = "via gcloud"
424
- break
425
- default:
426
- authInfo = ""
427
- }
428
- } else {
429
- authInfo = "logged in"
430
- }
482
+ const providerOptions = [
483
+ {
484
+ label: "Skip — I'll build it myself",
485
+ value: "skip",
486
+ description: "You can launch an AI agent later from the project root",
487
+ },
488
+ ]
489
+
490
+ for (const provider of interactiveProviders) {
431
491
  providerOptions.push({
432
- label: `${provider.name}`,
492
+ label: provider.name,
433
493
  value: provider.id,
434
- description: `${authInfo}`,
494
+ description: "logged in",
435
495
  })
436
496
  }
437
497
 
438
498
  aiChoice = await arrowSelectPrompt(
439
- "Choose AI provider for scaffolding",
499
+ "Launch an AI agent to build your plugin?",
440
500
  providerOptions,
441
501
  )
442
502
  if (aiChoice !== "skip") {
@@ -444,55 +504,17 @@ async function runInteractiveConfig(projectPath, initialName, isLocal = false) {
444
504
  }
445
505
  }
446
506
 
447
- let buildPrompt = ""
507
+ // If an AI agent was chosen, it becomes the last step — skip starting the
508
+ // dev server. The agent is responsible for driving the rest of the session.
448
509
  if (selectedProvider) {
449
- buildPrompt = await multiLinePrompt(
450
- "šŸ“ Describe your plugin (what it does, key features, UI elements):",
451
- "Press Enter twice when done",
510
+ await launchInteractiveAISession(
511
+ projectPath,
512
+ appName,
513
+ description,
514
+ selectedProvider,
452
515
  )
453
-
454
- if (buildPrompt) {
455
- await runAIScaffolding(
456
- projectPath,
457
- appName,
458
- description,
459
- buildPrompt,
460
- selectedProvider,
461
- )
462
- }
463
- }
464
-
465
- // 4. SSL Setup
466
- console.log("")
467
- console.log("─".repeat(50))
468
- console.log("šŸ”’ SSL Configuration")
469
- console.log("─".repeat(50))
470
-
471
- const sslChoice = await arrowSelectPrompt(
472
- "Set up SSL certificates for HTTPS development?",
473
- [
474
- {
475
- label: "Yes, set up SSL",
476
- value: "yes",
477
- description: "Recommended for full feature access",
478
- },
479
- {
480
- label: "Skip SSL setup",
481
- value: "no",
482
- description: "Can be set up later with npm run setup-ssl",
483
- },
484
- ],
485
- )
486
-
487
- let sslSetup = false
488
- if (sslChoice === "yes") {
489
- console.log("\nšŸ”’ Setting up HTTPS development environment...")
490
- ensureMkcertInstalled()
491
- const certs = generateSSLCertificates(projectPath)
492
- if (certs) {
493
- updateEnvWithCertPaths(projectPath, certs)
494
- sslSetup = true
495
- }
516
+ printFinalInstructions(projectPath, appName, sslSetup, isLocal)
517
+ return null
496
518
  }
497
519
 
498
520
  // 5. Start App
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Lint Command
3
+ *
4
+ * Validates GxP config JSON (configuration.json, app-manifest.json) against
5
+ * schemas derived from the templating system docs.
6
+ */
7
+
8
+ const path = require("path")
9
+ const fs = require("fs")
10
+ const { lintFiles, detectSchema } = require("../lint")
11
+ const { formatReport } = require("../lint/formatter")
12
+ const { findProjectRoot } = require("../utils")
13
+
14
+ /**
15
+ * Targets for `--all` mode. Extendable as more lintable files emerge.
16
+ */
17
+ const DEFAULT_TARGETS = ["configuration.json", "app-manifest.json"]
18
+
19
+ function collectAllTargets(projectPath) {
20
+ return DEFAULT_TARGETS.map((name) => path.join(projectPath, name)).filter(
21
+ (p) => fs.existsSync(p),
22
+ )
23
+ }
24
+
25
+ async function lintCommand(argv) {
26
+ const projectPath = findProjectRoot()
27
+ const explicit = Array.isArray(argv.files) ? argv.files.filter(Boolean) : []
28
+
29
+ let files
30
+ let userSuppliedFiles = false
31
+ if (explicit.length > 0) {
32
+ // Resolve relative to the cwd the user ran from.
33
+ files = explicit.map((f) => path.resolve(process.cwd(), f))
34
+ userSuppliedFiles = true
35
+ } else {
36
+ // No files given: default to the well-known targets in the project root.
37
+ files = collectAllTargets(projectPath)
38
+ }
39
+
40
+ if (files.length === 0) {
41
+ console.log(
42
+ "No configuration.json or app-manifest.json found in project root.",
43
+ )
44
+ return
45
+ }
46
+
47
+ // Drop files we don't have a schema for, unless the user named them
48
+ // explicitly — in that case surface them as skipped in the report.
49
+ if (!userSuppliedFiles) {
50
+ files = files.filter((f) => detectSchema(f))
51
+ }
52
+
53
+ const { results, summary } = lintFiles(files)
54
+
55
+ if (argv.json) {
56
+ const out = {
57
+ summary,
58
+ results: results.map((r) => ({
59
+ file: r.file,
60
+ ok: r.ok,
61
+ skipped: r.skipped,
62
+ errors: r.errors,
63
+ })),
64
+ }
65
+ console.log(JSON.stringify(out, null, 2))
66
+ } else {
67
+ console.log(formatReport({ results, summary }, { cwd: projectPath }))
68
+ }
69
+
70
+ if (summary.filesWithErrors > 0) {
71
+ process.exit(1)
72
+ }
73
+ }
74
+
75
+ module.exports = {
76
+ lintCommand,
77
+ }