@digital-gravy/etch-public-api 0.7.3 → 0.8.0

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
@@ -254,6 +254,42 @@ etch.blocks.setAttribute(svgBlockId, 'src', '/icons/logo.svg');
254
254
  etch.blocks.setAttribute(svgBlockId, 'stripColors', 'true');
255
255
  ```
256
256
 
257
+ ### Skills
258
+
259
+ `etch.skills` exposes the bundled, read-only authoring guides Etch ships (e.g.
260
+ the Automatic.css conventions). They follow a **progressive-disclosure** model:
261
+ `list()` returns lightweight summaries for discovery, `get()` loads the full
262
+ guide body, and `getReference()` pulls an individual reference (subskill)
263
+ document only when needed — mirroring how a tool driving the builder is meant to
264
+ read them.
265
+
266
+ ```ts
267
+ // Discover what's currently available
268
+ const skills = etch.skills.list();
269
+ // └─ [{ name, description, metadata, references }, …]
270
+
271
+ // Load the full guide for a relevant skill
272
+ const acss = etch.skills.get('acss');
273
+ console.log(acss?.content); // SKILL.md body as Markdown
274
+
275
+ // Pull a reference document on demand
276
+ for (const file of acss?.references ?? []) {
277
+ const doc = etch.skills.getReference('acss', file);
278
+ // …
279
+ }
280
+ ```
281
+
282
+ All three methods are **synchronous** and never hit the network — content is
283
+ bundled at build time or generated from live page state. An unknown `name` or
284
+ `file`, or a skill whose integration isn't active, returns `undefined` rather
285
+ than throwing, so you can probe the surface without guarding every call.
286
+
287
+ > The available set is **runtime-dependent**: a skill tied to an integration is
288
+ > only listed when that integration is active (the ACSS skill appears only when
289
+ > Automatic.css is present), and some references are generated on demand from
290
+ > live page state. Always `list()` to see what is currently available rather
291
+ > than assuming a fixed set.
292
+
257
293
  ### Types only
258
294
 
259
295
  Every contract type is exported and dependency-free, so you can use them
@@ -283,6 +319,7 @@ is imported.
283
319
  - **Loops** — `EtchLoopsApi`, `EtchLoop`, `EtchLoopConfig`, `BlockLoopBinding`, …
284
320
  - **Navigation** — `EtchNavigationApi`, `NavigationPlace`, `PostSummary`, `TemplateSummary`
285
321
  - **Fields** — `EtchFieldsApi`, `CustomField`, `CustomFieldGroup`, …
322
+ - **Skills** — `EtchSkillsApi`, `SkillSummary`, `SkillDetail`
286
323
  - **UI / History** — `EtchUiApi`, `EtchHistoryApi`, `ColorScheme`
287
324
 
288
325
  ## Versioning
package/dist/index.d.cts CHANGED
@@ -1046,8 +1046,9 @@ interface EtchComponentsApi {
1046
1046
  * - `content-hub` — the pages/posts browser
1047
1047
  * - `style-manager` — the global style manager
1048
1048
  * - `loop-manager` — the loop manager
1049
+ * - `asset-manager` — the asset (media) library
1049
1050
  */
1050
- type NavigationPlace = 'builder' | 'templates' | 'style-manager' | 'content-hub' | 'loop-manager';
1051
+ type NavigationPlace = 'builder' | 'templates' | 'style-manager' | 'content-hub' | 'loop-manager' | 'asset-manager';
1051
1052
  /** Lightweight post entry returned by `navigation.listPostsAsync()`. */
1052
1053
  interface PostSummary {
1053
1054
  /** Post id. */
@@ -1212,6 +1213,83 @@ interface EtchFieldsApi {
1212
1213
  deleteValueAsync(postId: number, fieldKey: string): Promise<void>;
1213
1214
  }
1214
1215
 
1216
+ /**
1217
+ * Skill definitions and the `etch.skills` API surface.
1218
+ *
1219
+ * Skills are bundled, read-only authoring guides the Etch builder ships (e.g.
1220
+ * the Automatic.css conventions). They follow a progressive-disclosure model:
1221
+ * a lightweight {@link SkillSummary} for discovery, a {@link SkillDetail} with
1222
+ * the full guide body, and per-reference subskill documents loaded on demand.
1223
+ *
1224
+ * Tooling — an AI assistant driving the builder over `connectAs`, for example —
1225
+ * is expected to `list()` the available skills, `get()` the relevant one, then
1226
+ * pull individual references only when needed, mirroring how the documents are
1227
+ * meant to be read.
1228
+ *
1229
+ * The set is **runtime-dependent**: a skill tied to an integration is only
1230
+ * listed when that integration is active (e.g. the ACSS skill appears only when
1231
+ * Automatic.css is present), and some references are generated on demand from
1232
+ * live page state rather than bundled. Always `list()` to see what is currently
1233
+ * available rather than assuming a fixed set.
1234
+ */
1235
+ /** A skill's metadata, without the guide body (returned by `skills.list()`). */
1236
+ interface SkillSummary {
1237
+ /**
1238
+ * Stable identifier from the skill's frontmatter `name` (e.g. `acss`).
1239
+ * Lowercase; used to address the skill in {@link EtchSkillsApi.get} and
1240
+ * {@link EtchSkillsApi.getReference}. Note this is the frontmatter name, not
1241
+ * the on-disk directory name.
1242
+ */
1243
+ name: string;
1244
+ /**
1245
+ * One-line summary of when the skill applies, from frontmatter `description`.
1246
+ * Meant to be read at discovery time to decide whether to load the full body.
1247
+ */
1248
+ description: string;
1249
+ /**
1250
+ * Arbitrary key/value metadata from the skill's frontmatter `metadata` block
1251
+ * (e.g. `acss_min_version`). Extensible — keys vary per skill, so narrow
1252
+ * before reading a specific one.
1253
+ */
1254
+ metadata: Record<string, unknown>;
1255
+ /**
1256
+ * Filenames of the skill's reference (subskill) documents, e.g.
1257
+ * `['colors.md', 'spacing.md']`. Pass one to
1258
+ * {@link EtchSkillsApi.getReference} to load its content. Derived from the
1259
+ * files that actually ship, so it never drifts from what is available.
1260
+ */
1261
+ references: string[];
1262
+ }
1263
+ /** A skill including its full guide body (returned by `skills.get()`). */
1264
+ interface SkillDetail extends SkillSummary {
1265
+ /**
1266
+ * The skill's primary guide as Markdown, with the frontmatter block stripped.
1267
+ * This is the `SKILL.md` body.
1268
+ */
1269
+ content: string;
1270
+ }
1271
+ /**
1272
+ * Bundled, read-only authoring skills shipped with the builder.
1273
+ *
1274
+ * All three methods are synchronous and never hit the network — content is
1275
+ * either bundled at build time or generated from live page state. Lookups by an
1276
+ * unknown `name` or reference `file`, or for a skill whose integration is not
1277
+ * currently active, return `undefined` rather than throwing, so callers can
1278
+ * probe the surface without guarding every call.
1279
+ */
1280
+ interface EtchSkillsApi {
1281
+ /** All available skills as summaries (without their guide bodies). */
1282
+ list(): SkillSummary[];
1283
+ /** One skill including its guide body, by frontmatter `name`; `undefined` if unknown. */
1284
+ get(name: string): SkillDetail | undefined;
1285
+ /**
1286
+ * The Markdown content of one reference (subskill) document, by skill `name`
1287
+ * and reference `file` (as listed in {@link SkillSummary.references});
1288
+ * `undefined` if either is unknown.
1289
+ */
1290
+ getReference(name: string, file: string): string | undefined;
1291
+ }
1292
+
1215
1293
  /**
1216
1294
  * Builder chrome controls (`etch.ui`) and undo/redo (`etch.history`).
1217
1295
  */
@@ -1345,6 +1423,8 @@ interface Etch {
1345
1423
  ui: EtchUiApi;
1346
1424
  /** Undo/redo of builder mutations. */
1347
1425
  history: EtchHistoryApi;
1426
+ /** Bundled, read-only authoring skills (guides + reference subskills). */
1427
+ skills: EtchSkillsApi;
1348
1428
  /** Persist everything (blocks, loops, styles, UI). */
1349
1429
  saveAsync(): Promise<void>;
1350
1430
  /**
@@ -1440,4 +1520,4 @@ declare function isEtchApiError(value: unknown): value is EtchApiError;
1440
1520
  */
1441
1521
  declare const ETCH_API_VERSION = "0.x";
1442
1522
 
1443
- export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CopyObject, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
1523
+ export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CopyObject, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSkillsApi, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type SkillDetail, type SkillSummary, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
package/dist/index.d.ts CHANGED
@@ -1046,8 +1046,9 @@ interface EtchComponentsApi {
1046
1046
  * - `content-hub` — the pages/posts browser
1047
1047
  * - `style-manager` — the global style manager
1048
1048
  * - `loop-manager` — the loop manager
1049
+ * - `asset-manager` — the asset (media) library
1049
1050
  */
1050
- type NavigationPlace = 'builder' | 'templates' | 'style-manager' | 'content-hub' | 'loop-manager';
1051
+ type NavigationPlace = 'builder' | 'templates' | 'style-manager' | 'content-hub' | 'loop-manager' | 'asset-manager';
1051
1052
  /** Lightweight post entry returned by `navigation.listPostsAsync()`. */
1052
1053
  interface PostSummary {
1053
1054
  /** Post id. */
@@ -1212,6 +1213,83 @@ interface EtchFieldsApi {
1212
1213
  deleteValueAsync(postId: number, fieldKey: string): Promise<void>;
1213
1214
  }
1214
1215
 
1216
+ /**
1217
+ * Skill definitions and the `etch.skills` API surface.
1218
+ *
1219
+ * Skills are bundled, read-only authoring guides the Etch builder ships (e.g.
1220
+ * the Automatic.css conventions). They follow a progressive-disclosure model:
1221
+ * a lightweight {@link SkillSummary} for discovery, a {@link SkillDetail} with
1222
+ * the full guide body, and per-reference subskill documents loaded on demand.
1223
+ *
1224
+ * Tooling — an AI assistant driving the builder over `connectAs`, for example —
1225
+ * is expected to `list()` the available skills, `get()` the relevant one, then
1226
+ * pull individual references only when needed, mirroring how the documents are
1227
+ * meant to be read.
1228
+ *
1229
+ * The set is **runtime-dependent**: a skill tied to an integration is only
1230
+ * listed when that integration is active (e.g. the ACSS skill appears only when
1231
+ * Automatic.css is present), and some references are generated on demand from
1232
+ * live page state rather than bundled. Always `list()` to see what is currently
1233
+ * available rather than assuming a fixed set.
1234
+ */
1235
+ /** A skill's metadata, without the guide body (returned by `skills.list()`). */
1236
+ interface SkillSummary {
1237
+ /**
1238
+ * Stable identifier from the skill's frontmatter `name` (e.g. `acss`).
1239
+ * Lowercase; used to address the skill in {@link EtchSkillsApi.get} and
1240
+ * {@link EtchSkillsApi.getReference}. Note this is the frontmatter name, not
1241
+ * the on-disk directory name.
1242
+ */
1243
+ name: string;
1244
+ /**
1245
+ * One-line summary of when the skill applies, from frontmatter `description`.
1246
+ * Meant to be read at discovery time to decide whether to load the full body.
1247
+ */
1248
+ description: string;
1249
+ /**
1250
+ * Arbitrary key/value metadata from the skill's frontmatter `metadata` block
1251
+ * (e.g. `acss_min_version`). Extensible — keys vary per skill, so narrow
1252
+ * before reading a specific one.
1253
+ */
1254
+ metadata: Record<string, unknown>;
1255
+ /**
1256
+ * Filenames of the skill's reference (subskill) documents, e.g.
1257
+ * `['colors.md', 'spacing.md']`. Pass one to
1258
+ * {@link EtchSkillsApi.getReference} to load its content. Derived from the
1259
+ * files that actually ship, so it never drifts from what is available.
1260
+ */
1261
+ references: string[];
1262
+ }
1263
+ /** A skill including its full guide body (returned by `skills.get()`). */
1264
+ interface SkillDetail extends SkillSummary {
1265
+ /**
1266
+ * The skill's primary guide as Markdown, with the frontmatter block stripped.
1267
+ * This is the `SKILL.md` body.
1268
+ */
1269
+ content: string;
1270
+ }
1271
+ /**
1272
+ * Bundled, read-only authoring skills shipped with the builder.
1273
+ *
1274
+ * All three methods are synchronous and never hit the network — content is
1275
+ * either bundled at build time or generated from live page state. Lookups by an
1276
+ * unknown `name` or reference `file`, or for a skill whose integration is not
1277
+ * currently active, return `undefined` rather than throwing, so callers can
1278
+ * probe the surface without guarding every call.
1279
+ */
1280
+ interface EtchSkillsApi {
1281
+ /** All available skills as summaries (without their guide bodies). */
1282
+ list(): SkillSummary[];
1283
+ /** One skill including its guide body, by frontmatter `name`; `undefined` if unknown. */
1284
+ get(name: string): SkillDetail | undefined;
1285
+ /**
1286
+ * The Markdown content of one reference (subskill) document, by skill `name`
1287
+ * and reference `file` (as listed in {@link SkillSummary.references});
1288
+ * `undefined` if either is unknown.
1289
+ */
1290
+ getReference(name: string, file: string): string | undefined;
1291
+ }
1292
+
1215
1293
  /**
1216
1294
  * Builder chrome controls (`etch.ui`) and undo/redo (`etch.history`).
1217
1295
  */
@@ -1345,6 +1423,8 @@ interface Etch {
1345
1423
  ui: EtchUiApi;
1346
1424
  /** Undo/redo of builder mutations. */
1347
1425
  history: EtchHistoryApi;
1426
+ /** Bundled, read-only authoring skills (guides + reference subskills). */
1427
+ skills: EtchSkillsApi;
1348
1428
  /** Persist everything (blocks, loops, styles, UI). */
1349
1429
  saveAsync(): Promise<void>;
1350
1430
  /**
@@ -1440,4 +1520,4 @@ declare function isEtchApiError(value: unknown): value is EtchApiError;
1440
1520
  */
1441
1521
  declare const ETCH_API_VERSION = "0.x";
1442
1522
 
1443
- export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CopyObject, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
1523
+ export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CopyObject, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSkillsApi, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type SkillDetail, type SkillSummary, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-gravy/etch-public-api",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "MIT-licensed typed client and contract for the Etch builder scripting API (window.etch). Etch itself is a separate proprietary product governed by its own commercial terms.",
5
5
  "license": "MIT",
6
6
  "repository": {