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
{{ message }}
Repository navigation
Commit 49b4489
Browse filesBrowse the repository at this point in the historyBrowse files
ADFA-6252 | Fold the format reference into templates/README.md
Two documents covered one subject and overlapped on the parts people actually
need — the Pebble delimiters, the identifiers, path substitution and the
gotchas were in both, which is how they drift. One file now: Part 1 is how to
write a template, Part 2 is the format.
Dropped on the way in, rather than carried across:
- The five-gap table (G01-G05) listing what this repository had to add. All of
it is implemented; it described a plan, not the system.
- The record of what the Flutter conversion involved, for the same reason the
migration plan went.
- The dev-assets publication path, the local build-core-cgt.sh warning, and the
CodeOnTheGoPlugin jar-fetching detail. That is how core.cgt reaches the app
assets over SSH; addons here go to R2 and nothing about it guided a reader.
- The absolute /Users/eisen paths in the sources table, replaced by repository-
relative pointers to the CodeOnTheGo files that define the format.
Added while merging, because the reference described dev-assets and not this
repository: how scripts/build-cgt.sh builds the archive, that an unrecognised
root entry is ignored (which is what makes cgt-build.properties safe), and how
publishing is wired from discovery through to the catalog entry.
core.cgt stays in as the larger worked example. It exercises the language
chooser, user parameters and path flags, none of which the Flutter bundle shows.
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Read the area's own README before working in it. This file holds only what is tr
21
21
22
22
Working on a plugin means reading `plugins/README.md` first: the `libs/` coupling, the credential store, the manifest shape, build provenance and the tooltip wiring all live there, and each has a failure that a green build does not catch.
23
23
24
-
The format reference for `.cgt`is [`templates/cgt-templates.md`](templates/cgt-templates.md).
24
+
`templates/README.md` is both halves: how to write a template, then the `.cgt`format reference. The format has no other written specification.
<TemplateName>/template/template.json <- metadata for this template
398
+
<TemplateName>/template/thumb.png <- thumbnail for the New Project screen
399
+
<TemplateName>/<any path>.peb <- a file that Pebble renders
400
+
<TemplateName>/<any path> <- a file that is copied without change
401
+
```
402
+
403
+
The names are fixed. `ZipTemplateConstants.kt` declares them:
404
+
405
+
```kotlin
406
+
constvalARCHIVE_JSON="templates.json"
407
+
constvalMETA_FOLDER="template"
408
+
constvalMETA_JSON="template.json"
409
+
constvalMETA_THUMBNAIL="thumb.png"
410
+
constvalMETA_EXTENSION_JAR="extensions.jar"
411
+
constvalTEMPLATE_EXTENSION=".peb"
412
+
```
413
+
414
+
`extensions.jar` is optional and rarely used. It supplies custom Pebble `Extension` classes,
415
+
which the IDE dexes into `dex_opt/`. Neither `core.cgt` nor `flutter-templates.cgt` uses it.
416
+
417
+
An unrecognised entry at the archive root is ignored, which is why
418
+
`cgt-build.properties` can sit there safely.
419
+
420
+
### Two readers, both of which must be satisfied
421
+
422
+
| Reader | Purpose | Method |
423
+
|---|---|---|
424
+
|`ZipTemplateReader`| Builds the New Project list | Reads `templates.json` by that exact bare name at the archive root, then reads `<path>/template/template.json` for each entry |
425
+
|`CgtTemplateReader`| Shows the Templates manager list | Scans for any entry ending in `/template/template.json`, and ignores `templates.json`|
426
+
427
+
A missing `template.json` makes `ZipTemplateReader` skip that entry with no error.
428
+
429
+
## `templates.json`
430
+
431
+
The root manifest, in **strict** JSON. It names the directory of each template.
432
+
433
+
```json
434
+
{
435
+
"templates": [
436
+
{ "path": "FlutterBasic" },
437
+
{ "path": "FlutterBloc" }
438
+
]
439
+
}
440
+
```
441
+
442
+
An entry also accepts `"experimental": true`. The IDE then hides that template unless
443
+
`FeatureFlags.isExperimentsEnabled` is set.
444
+
445
+
The manifest carries no version and no schema version. The IDE checks nothing about it; the
446
+
repository's `addons check` does, which is why a typo fails in CI rather than silently on a
447
+
device.
448
+
449
+
## `template/template.json`
450
+
451
+
One file per template, in **JSON5** — unquoted keys are accepted, and `core.cgt` uses them
452
+
(`{identifier: "APP_NAME"}`). Quote them anyway.
453
+
454
+
| Field | Purpose |
455
+
|---|---|
456
+
|`name`| The name on the New Project screen |
457
+
|`description`| One line under the name |
458
+
|`version`| The template version, such as `"1.0.0"`|
459
+
|`tooltipTag`| The in-app help tag, such as `"template.flutter.basic"`|
460
+
|`defaultAppName`| Optional. Pre-fills the app name field |
0 commit comments