@combos-fun/inspector-decorator 0.0.6 → 0.0.7

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 +1,27 @@
1
1
  # @combos-fun/inspector-decorator
2
+
3
+ Runtime decorators used by Combos Fun engine packages (Field + legacy type/step IDEProps).
4
+
5
+ Keywords: `decorators`, `inspector`, `editor`, `ide`, `field`, `metadata`.
6
+
7
+ ## Documentation
8
+
9
+ - Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
10
+ - Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
11
+ (validated against `schemas/combos-plugin.schema.json` in the repo
12
+ root)
13
+ - Entry skill (single source of truth for AI agents working with this
14
+ monorepo): `skills/combos-engine-development/SKILL.md`
15
+
16
+ When consumed from npm, the manifest and agent notes are exposed as
17
+ stable subpaths:
18
+
19
+ ```ts
20
+ import manifest from '@combos-fun/inspector-decorator/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/inspector-decorator/agent-skill')
23
+ ```
24
+
25
+ ## License
26
+
27
+ Internal workspace package, part of the Combos Fun engine monorepo.
package/agent-skill.md ADDED
@@ -0,0 +1,82 @@
1
+ # `@combos-fun/inspector-decorator` — Agent notes
2
+
3
+ Runtime decorator helpers used by Combos Fun engine and plugin packages to
4
+ expose Component fields to editor / inspector tooling. Built on
5
+ `reflect-metadata`.
6
+
7
+ ## When to read
8
+
9
+ Read when authoring a new Component / System and you want its fields to be
10
+ visible in the Combos Fun editor inspector, or when investigating why a
11
+ field appears (or fails to appear) in the inspector.
12
+
13
+ ## Public API
14
+
15
+ ```ts
16
+ import 'reflect-metadata';
17
+ import { Field, ExecuteInEditMode, getPropertiesOf, type, step } from '@combos-fun/inspector-decorator';
18
+ ```
19
+
20
+ | Export | Use |
21
+ |--------|-----|
22
+ | `Field()` / `Field(options)` / `Field(returnTypeFunc)` | Property decorator on a Component class field. Records a `FieldMetadata` entry that the editor reads to render an input control. |
23
+ | `ExecuteInEditMode` | Class decorator marking a Component that should also run in editor mode (in addition to game mode). |
24
+ | `getPropertiesOf(ComponentClass)` | Inspector-side helper. Returns the `FieldMetadata` tree for a Component. |
25
+ | `type` / `step` | Legacy `IDEProp`-style decorators kept for backwards compatibility with older Combos plugins. |
26
+
27
+ `FieldOptions` accepts at minimum `{ name?, type?, default?, options?, ... }`
28
+ — check the `interface.ts` source for the full surface.
29
+
30
+ ## Required setup
31
+
32
+ - `reflect-metadata` must be imported once per app entry. The package's
33
+ `lib/index.ts` already does this on import, so importing anything from
34
+ `@combos-fun/inspector-decorator` in your plugin entry is enough.
35
+ - TypeScript: `experimentalDecorators` and `emitDecoratorMetadata` must be
36
+ enabled in your plugin's `tsconfig.json`.
37
+
38
+ ## Runtime behaviour
39
+
40
+ - `Field` reads `design:type` metadata via `reflect-metadata` and stores a
41
+ per-class property descriptor on the class constructor under the
42
+ `IDE_PROPERTY_METADATA` symbol.
43
+ - `getPropertiesOf` walks that metadata tree, recursing into nested
44
+ Component types and arrays.
45
+ - These decorators have **no runtime cost during a normal game frame** —
46
+ they only emit metadata at class load time and are read on demand by the
47
+ editor.
48
+
49
+ ## Common pitfalls
50
+
51
+ - Forgetting `experimentalDecorators` / `emitDecoratorMetadata` produces a
52
+ compile-time TypeScript error like `"Decorators are not valid here"` or
53
+ silently missing metadata at runtime.
54
+ - Importing `@combos-fun/inspector-decorator` without `reflect-metadata`
55
+ installed throws at module load. Pin it in `dependencies`, not
56
+ `devDependencies`, of any plugin that uses `Field`.
57
+ - Using `Symbol` keys for fields throws `SymbolKeysNotSupportedError` —
58
+ always use `string` property keys.
59
+
60
+ ## Minimal example
61
+
62
+ ```ts
63
+ import 'reflect-metadata';
64
+ import { Field } from '@combos-fun/inspector-decorator';
65
+ import { Component } from '@combos-fun/engine';
66
+
67
+ export class MyHealth extends Component {
68
+ static componentName = 'MyHealth';
69
+
70
+ @Field({ default: 100 })
71
+ hp = 100;
72
+
73
+ @Field({ default: false })
74
+ invincible = false;
75
+ }
76
+ ```
77
+
78
+ ## Verification
79
+
80
+ - `pnpm --filter @combos-fun/inspector-decorator run build` should succeed.
81
+ - In the consumer plugin, `getPropertiesOf(MyHealth)` should return a
82
+ `FieldMetadata` tree containing the `hp` and `invincible` entries.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@combos-fun/inspector-decorator",
3
+ "pluginId": "inspector-decorator",
4
+ "category": "core",
5
+ "dimension": "shared",
6
+ "isCore": true,
7
+ "keywords": ["decorators", "inspector", "editor", "ide", "field", "metadata"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": [],
10
+ "exports": ["Field", "ExecuteInEditMode", "getPropertiesOf", "type", "step"]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/inspector-decorator",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Runtime decorators used by Combos Fun engine packages (Field + legacy type/step IDEProps).",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -10,8 +10,22 @@
10
10
  "types": "dist/inspector-decorator.d.ts",
11
11
  "files": [
12
12
  "index.js",
13
- "dist"
13
+ "dist",
14
+ "agent-skill.md",
15
+ "combos-plugin.json"
14
16
  ],
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/inspector-decorator.esm.js",
20
+ "require": "./index.js",
21
+ "types": "./dist/inspector-decorator.d.ts"
22
+ },
23
+ "./plugin-manifest": "./combos-plugin.json",
24
+ "./agent-skill": "./agent-skill.md"
25
+ },
26
+ "combos": {
27
+ "pluginManifest": "./combos-plugin.json"
28
+ },
15
29
  "keywords": [
16
30
  "combos-fun",
17
31
  "decorators"