You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove information that is duplicated elsewhere in the project:
- Detailed command listings (available via `make help`)
- Architecture details (documented in `docs/code/architecture.md`)
- Logging and lint guidelines (enforced by ESLint config)
Consolidate remaining guidance and add Conventional Commits note to
the pull request guidelines section.
@@ -4,171 +4,37 @@ This file provides guidance to AI agents when working with code in this reposito
4
4
5
5
## Overview
6
6
7
-
GutenbergKit is an experimental Gutenberg block editor for native iOS and Android apps built with web technologies. It consists of:
7
+
GutenbergKit is a Gutenberg block editor for native iOS and Android apps built with web technologies. It consists of:
8
8
9
9
- A React-based web editor using WordPress Gutenberg packages
10
10
- Swift package for iOS integration
11
11
- Kotlin library for Android integration
12
12
- Native-to-web bridge for communication between platforms
13
13
14
-
The primary branch is `trunk` (not `main`).
14
+
For deeper architectural context on specific subsystems, see the docs under `docs/code/` — including `architecture.md`, `plugins.md`, `preloading.md`, and others.
15
15
16
16
## Common Development Commands
17
17
18
18
**CRITICAL**: Always use `make` commands over underlying tool commands (`npm`, `swift`, `gradle`, etc.) when they exist. The Makefile provides convenient wrappers that handle dependencies and configuration automatically. However, when you need to pass specific arguments that a `make` target does not support — such as running Prettier on a single file, linting only changed files, or running a single test file — use the underlying tool directly.
19
19
20
-
To see all available make commands, run:
20
+
To see all available make commands with descriptions, run:
21
21
22
22
```bash
23
23
make help
24
-
# or simply
25
-
make
26
24
```
27
25
28
-
This will display a list of all available targets with descriptions.
26
+
By default, dependencies, translations, and JS build are skipped if output directories already exist. Environment variables be used to force refresh of these steps when needed.
29
27
30
-
### Web Development
28
+
-`REFRESH_DEPS=1` - Force refresh of dependencies (e.g. re-install npm packages)
29
+
-`REFRESH_L10N=1` - Force refresh of translations (e.g. re-run translation extraction)
30
+
-`REFRESH_JS_BUILD=1` - Force refresh of JavaScript build (e.g. clear Vite cache)
31
31
32
-
```bash
33
-
# Install dependencies
34
-
npm ci
35
-
36
-
# Start development server (use this for active development)
37
-
make dev-server
38
-
39
-
# Start standalone React DevTools server
40
-
make dev-tools
41
-
42
-
# Preview production build locally
43
-
make preview
44
-
45
-
# Run JavaScript tests (one-time run)
46
-
make test-js
47
-
48
-
# Run JavaScript tests in watch mode (for active development)
49
-
make test-js-watch
50
-
51
-
# Lint JavaScript code
52
-
make lint-js
53
-
54
-
# Lint and auto-fix JavaScript code
55
-
make lint-fix-js
56
-
57
-
# Format JavaScript code
58
-
make format
59
-
```
60
-
61
-
### Building
62
-
63
-
```bash
64
-
# Build everything (web, iOS, Android)
65
-
make build
32
+
## Local WordPress Environment (wp-env)
66
33
67
-
# This builds the web app and copies assets to:
68
-
# - ios/Sources/GutenbergKit/Gutenberg/
69
-
# - android/Gutenberg/src/main/assets/
70
-
71
-
# By default, the build is skipped if output directories already exist
72
-
# Force refresh of dependencies, translations, and JS build
73
-
make build REFRESH_DEPS=1 REFRESH_L10N=1 REFRESH_JS_BUILD=1
74
-
75
-
# Clean build artifacts
76
-
make clean
77
-
```
78
-
79
-
### iOS Development
80
-
81
-
```bash
82
-
# Build Swift package
83
-
make build-swift-package
84
-
85
-
# Run Swift tests
86
-
make test-swift-package
87
-
```
88
-
89
-
### Android Development
90
-
91
-
```bash
92
-
# Build Android library to local Maven
93
-
make local-android-library
94
-
95
-
# Run Android tests
96
-
make test-android
97
-
```
98
-
99
-
### Local WordPress Environment (wp-env)
100
-
101
-
A local WordPress environment powered by `@wordpress/env` for testing the full editor experience with theme styles, media uploads, and plugin block assets.
102
-
103
-
```bash
104
-
# Start the local WordPress environment (requires Docker)
105
-
make wp-env-start
106
-
107
-
# Stop the environment (preserves data)
108
-
make wp-env-stop
109
-
110
-
# Destroy the environment and remove all data
111
-
make wp-env-clean
112
-
113
-
# View WordPress logs
114
-
make wp-env-logs
115
-
116
-
# Run a WP-CLI command
117
-
make wp-env-cli CMD="post list"
118
-
```
34
+
A local WordPress environment powered by `@wordpress/env` is available for verifying/testing changes against a full editor experience with theme styles, media uploads, and plugin block assets. Relevant commands are available via `make help`.
119
35
120
36
See `docs/code/local-wordpress.md` for detailed setup instructions and troubleshooting.
121
37
122
-
> **Note:** Most `make` targets have equivalent `npm` scripts in `package.json`. Build targets accept `REFRESH_DEPS=1`, `REFRESH_L10N=1`, and `REFRESH_JS_BUILD=1` flags to force refresh of dependencies, translations, and JavaScript builds respectively. Run `make help` for full details.
123
-
124
-
## Architecture
125
-
126
-
### Web Editor Structure
127
-
128
-
The web editor is built with React and WordPress packages:
129
-
130
-
-**Entry Points**:
131
-
-`src/index.js` - Main editor entry point (supports plugins via bundled code)
132
-
-**Core Components**:
133
-
-`src/components/editor/` - Main editor component with host bridge integration
1.**Web → Native**: JavaScript calls methods on `window.editorDelegate` (Android) or `window.webkit.messageHandlers` (iOS)
161
-
2.**Native → Web**: Native code evaluates JavaScript in the WebView
162
-
3.**Message Types**: Editor loaded, content changed, media upload, block management, etc.
163
-
164
-
### Build System
165
-
166
-
-**Vite**: Handles web bundling and development server
167
-
-**Translations**: Automated translation preparation from WordPress packages
168
-
-**Asset Distribution**: Built assets are copied to platform-specific directories
169
-
170
-
> For deeper architectural context on specific subsystems, see the docs under `docs/code/` — including `architecture.md`, `plugins.md`, `preloading.md`, and others.
171
-
172
38
## Code Quality Standards
173
39
174
40
The project follows WordPress coding standards for JavaScript:
@@ -210,12 +76,13 @@ make lint-js-fix
210
76
211
77
These commands ensure code quality and prevent lint errors from blocking commits.
212
78
213
-
### Pull Request Guidelines
79
+
### Commit and Pull Request Guidelines
214
80
215
81
When creating pull requests:
216
82
217
83
1.**Use the PR template**: Read `.github/PULL_REQUEST_TEMPLATE.md` to get the current template structure and follow it when writing the PR body.
218
84
2.**Assign a label**: Use `gh label list` to retrieve available labels and select the most relevant one for the PR.
85
+
3.**Use Conventional Commits**: Follow the Conventional Commits specification for commit messages (e.g. `feat: add new block type`, `fix: resolve toolbar bug`).
219
86
220
87
### E2E Test Interaction Guidelines
221
88
@@ -230,8 +97,6 @@ Since GutenbergKit targets touch devices (iOS/Android), E2E tests should prefer
230
97
231
98
## Common Pitfalls
232
99
233
-
-**Do not edit build output directories.** The files under `ios/Sources/GutenbergKit/Gutenberg/` and `android/Gutenberg/src/main/assets/` are generated by `make build`. Never modify them directly — run `make build` to regenerate them instead.
234
-
-**Do not use `console.*` directly.** Always use the logger utility (`src/utils/logger.js`). See the Logging Guidelines section above.
235
-
-**Always run `make lint-fix-js` before committing.** Lint errors will block commits via pre-commit hooks.
100
+
-**The primary branch is `trunk` (not `main`).** Always ensure you are working on the `trunk` branch for development and pull requests. The `main` branch is not used in this repository.
101
+
-**Do not edit build output directories.** The files under `dist/`, `ios/Sources/GutenbergKit/Gutenberg/`, and `android/Gutenberg/src/main/assets/` are generated by `make build`. Never modify them directly — run `make build` to regenerate them instead.
236
102
-**Patching dependencies: modify `node_modules`, then run `npx patch-package <package-name>`.** Do not edit the `.patch` files under `patches/` by hand. The workflow is: make changes in `node_modules/<package>`, verify they work, then run `npx patch-package <package-name>` to create or update the patch file. Document the patch and its justification in `patches/README.md`.
237
-
-**Do not edit the `dist/` directory.** It is a build artifact generated by Vite. Run `make build` or `make dev-server` instead.
0 commit comments