@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 +108 -81
- package/bin/lib/cli.js +18 -0
- package/bin/lib/commands/index.js +2 -0
- package/bin/lib/commands/init.js +104 -82
- package/bin/lib/commands/lint.js +77 -0
- package/bin/lib/constants.js +12 -0
- package/bin/lib/lint/formatter.js +91 -0
- package/bin/lib/lint/index.js +284 -0
- package/bin/lib/lint/schemas/app-manifest.schema.json +124 -0
- package/bin/lib/lint/schemas/card.schema.json +165 -0
- package/bin/lib/lint/schemas/common.schema.json +62 -0
- package/bin/lib/lint/schemas/configuration.schema.json +19 -0
- package/bin/lib/lint/schemas/field.schema.json +230 -0
- package/bin/lib/utils/ai-scaffold.js +137 -0
- package/mcp/gxp-api-server.js +87 -129
- package/mcp/lib/api-tools.js +543 -0
- package/mcp/lib/config-ops.js +234 -0
- package/mcp/lib/config-tools.js +549 -0
- package/mcp/lib/docs-tools.js +142 -0
- package/mcp/lib/docs.js +263 -0
- package/mcp/lib/specs.js +135 -0
- package/mcp/lib/test-tools.js +358 -0
- package/package.json +3 -1
- package/runtime/stores/gxpPortalConfigStore.js +88 -87
- package/runtime/vite.config.js +5 -3
- package/template/.claude/agents/gxp-developer.md +377 -50
- package/template/.prettierrc +10 -0
- package/template/AGENTS.md +265 -21
- package/template/GEMINI.md +181 -19
- package/template/README.md +205 -240
- package/template/app-instructions.md +91 -0
- package/template/eslint.config.js +32 -0
- package/template/githooks/pre-commit +37 -0
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# GxP Dev Tools
|
|
2
2
|
|
|
3
|
-
A development toolkit for
|
|
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 (
|
|
7
|
+
### Global (recommended)
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install -g @gxp-dev/tools
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
### Project-
|
|
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
|
-
#
|
|
23
|
-
npm update
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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`
|
|
50
|
+
When run in a directory with an existing `package.json` and no name argument, `gxdev init`:
|
|
55
51
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
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
|
|
58
|
+
It does **not** overwrite your source files (`src/`, `theme-layouts/`, etc.).
|
|
63
59
|
|
|
64
60
|
## CLI Commands
|
|
65
61
|
|
|
66
|
-
| Command
|
|
67
|
-
|
|
|
68
|
-
| `gxdev`
|
|
69
|
-
| `gxdev init [name]`
|
|
70
|
-
| `gxdev dev`
|
|
71
|
-
| `gxdev dev --no-https`
|
|
72
|
-
| `gxdev dev --
|
|
73
|
-
| `gxdev dev --
|
|
74
|
-
| `gxdev dev --
|
|
75
|
-
| `gxdev
|
|
76
|
-
| `gxdev
|
|
77
|
-
| `gxdev
|
|
78
|
-
| `gxdev
|
|
79
|
-
| `gxdev
|
|
80
|
-
| `gxdev
|
|
81
|
-
| `gxdev
|
|
82
|
-
| `gxdev
|
|
83
|
-
| `gxdev
|
|
84
|
-
| `gxdev
|
|
85
|
-
| `gxdev ext:
|
|
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
|
|
90
|
-
- **Interactive TUI**
|
|
91
|
-
- **
|
|
92
|
-
- **
|
|
93
|
-
- **
|
|
94
|
-
- **
|
|
95
|
-
- **
|
|
96
|
-
- **
|
|
97
|
-
- **
|
|
98
|
-
- **
|
|
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
|
|
115
|
+
After `gxdev init`:
|
|
103
116
|
|
|
104
117
|
```
|
|
105
118
|
my-plugin/
|
|
106
119
|
āāā src/
|
|
107
|
-
ā āāā Plugin.vue
|
|
108
|
-
ā āāā DemoPage.vue
|
|
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
|
|
111
|
-
āāā theme-layouts/
|
|
112
|
-
āāā dev-assets/images/
|
|
113
|
-
āāā socket-events/
|
|
114
|
-
āāā
|
|
115
|
-
āāā
|
|
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
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
| Variable
|
|
126
|
-
|
|
|
127
|
-
| `NODE_PORT`
|
|
128
|
-
| `SOCKET_IO_PORT`
|
|
129
|
-
| `COMPONENT_PATH`
|
|
130
|
-
| `USE_HTTPS`
|
|
131
|
-
| `CERT_PATH`
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `API_ENV`
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
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
|
|
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
|
}
|
package/bin/lib/commands/init.js
CHANGED
|
@@ -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
|
-
* -
|
|
13
|
-
*
|
|
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.
|
|
406
|
+
// 3. SSL Setup
|
|
382
407
|
console.log("")
|
|
383
408
|
console.log("ā".repeat(50))
|
|
384
|
-
console.log("
|
|
409
|
+
console.log("š SSL Configuration")
|
|
385
410
|
console.log("ā".repeat(50))
|
|
386
|
-
|
|
387
|
-
|
|
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
|
|
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 (
|
|
398
|
-
console.log(" ā ļø No AI
|
|
399
|
-
console.log(
|
|
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 = [
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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:
|
|
492
|
+
label: provider.name,
|
|
433
493
|
value: provider.id,
|
|
434
|
-
description:
|
|
494
|
+
description: "logged in",
|
|
435
495
|
})
|
|
436
496
|
}
|
|
437
497
|
|
|
438
498
|
aiChoice = await arrowSelectPrompt(
|
|
439
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
450
|
-
|
|
451
|
-
|
|
510
|
+
await launchInteractiveAISession(
|
|
511
|
+
projectPath,
|
|
512
|
+
appName,
|
|
513
|
+
description,
|
|
514
|
+
selectedProvider,
|
|
452
515
|
)
|
|
453
|
-
|
|
454
|
-
|
|
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
|
+
}
|