@zhama/tego-plugin-sdk 1.36.1 → 1.37.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.
Files changed (99) hide show
  1. package/README.md +50 -3
  2. package/agent/RULES.md +123 -0
  3. package/agent/guides/access.md +39 -0
  4. package/agent/guides/backend.md +76 -0
  5. package/agent/guides/claw.md +18 -0
  6. package/agent/guides/desktop-web.md +48 -0
  7. package/agent/guides/frontend.md +83 -0
  8. package/agent/guides/host-api-versions.md +34 -0
  9. package/agent/guides/i18n.md +17 -0
  10. package/agent/guides/manifest.md +26 -0
  11. package/agent/guides/migrations.md +17 -0
  12. package/agent/guides/storage.md +18 -0
  13. package/agent/guides/testing.md +17 -0
  14. package/agent/guides/ui.md +22 -0
  15. package/agent/reference/plugin-sdk-api.md +561 -0
  16. package/bin/tego-plugin-pack.mjs +1 -1
  17. package/bin/tego-plugin.mjs +4 -2
  18. package/dist/chunk-2NTAWYCG.js +1 -0
  19. package/dist/chunk-2P6UEAPV.cjs +1 -0
  20. package/dist/chunk-45Y4CR4R.cjs +1 -0
  21. package/dist/{chunk-THMWRUAT.cjs → chunk-4LKRXDYY.cjs} +13 -12
  22. package/dist/{chunk-7XHF3YSK.js → chunk-56QOZQTY.js} +1 -1
  23. package/dist/{chunk-C2OCOPZQ.cjs → chunk-6HNG5OZI.cjs} +1 -1
  24. package/dist/chunk-DEGQDJF6.js +1 -0
  25. package/dist/chunk-EIVA5BR6.js +1 -0
  26. package/dist/chunk-FCYAAOHC.js +20 -0
  27. package/dist/chunk-HZ4YWRYX.cjs +5 -0
  28. package/dist/chunk-I5Z3ECC4.js +5 -0
  29. package/dist/chunk-INCA3GFW.js +1 -0
  30. package/dist/chunk-IVJECPGG.js +1 -0
  31. package/dist/chunk-MWMGJJ74.cjs +1 -0
  32. package/dist/chunk-N4SXZZPY.cjs +1 -0
  33. package/dist/chunk-SKNPNPJP.cjs +1 -0
  34. package/dist/dev.cjs +358 -0
  35. package/dist/dev.d.cts +144 -0
  36. package/dist/dev.d.ts +144 -0
  37. package/dist/dev.js +358 -0
  38. package/dist/doctor.cjs +8 -0
  39. package/dist/doctor.d.cts +62 -0
  40. package/dist/doctor.d.ts +62 -0
  41. package/dist/doctor.js +8 -0
  42. package/dist/frontend.d.cts +33 -1
  43. package/dist/frontend.d.ts +33 -1
  44. package/dist/hono.cjs +1 -0
  45. package/dist/hono.d.cts +84 -0
  46. package/dist/hono.d.ts +84 -0
  47. package/dist/hono.js +1 -0
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.cts +8 -3
  50. package/dist/index.d.ts +8 -3
  51. package/dist/index.js +1 -1
  52. package/dist/{manifest-types-DQARCQJt.d.cts → manifest-types-CUTNfJTa.d.cts} +1 -1
  53. package/dist/{manifest-types-DQARCQJt.d.ts → manifest-types-CUTNfJTa.d.ts} +1 -1
  54. package/dist/manifest.cjs +1 -1
  55. package/dist/manifest.d.cts +55 -2
  56. package/dist/manifest.d.ts +55 -2
  57. package/dist/manifest.js +1 -1
  58. package/dist/migrations-sync.cjs +1 -0
  59. package/dist/migrations-sync.d.cts +20 -0
  60. package/dist/migrations-sync.d.ts +20 -0
  61. package/dist/migrations-sync.js +1 -0
  62. package/dist/pack.cjs +1 -1
  63. package/dist/pack.d.cts +8 -2
  64. package/dist/pack.d.ts +8 -2
  65. package/dist/pack.js +1 -1
  66. package/dist/publish.cjs +1 -1
  67. package/dist/publish.d.cts +1 -1
  68. package/dist/publish.d.ts +1 -1
  69. package/dist/publish.js +1 -1
  70. package/dist/react.cjs +1 -0
  71. package/dist/react.d.cts +101 -0
  72. package/dist/react.d.ts +101 -0
  73. package/dist/react.js +1 -0
  74. package/dist/scaffold.cjs +672 -17
  75. package/dist/scaffold.d.cts +42 -18
  76. package/dist/scaffold.d.ts +42 -18
  77. package/dist/scaffold.js +674 -19
  78. package/dist/server-runtime.cjs +1 -1
  79. package/dist/server-runtime.d.cts +27 -2
  80. package/dist/server-runtime.d.ts +27 -2
  81. package/dist/server-runtime.js +1 -1
  82. package/dist/testing.cjs +6 -2
  83. package/dist/testing.d.cts +19 -1
  84. package/dist/testing.d.ts +19 -1
  85. package/dist/testing.js +6 -2
  86. package/dist/verify-FF2RD2MV.cjs +1 -0
  87. package/dist/verify-W7ZTUCO4.js +1 -0
  88. package/dist/vite.cjs +1 -1
  89. package/dist/vite.d.cts +27 -1
  90. package/dist/vite.d.ts +27 -1
  91. package/dist/vite.js +1 -1
  92. package/package.json +37 -3
  93. package/dist/chunk-3KUOBGJN.js +0 -19
  94. package/dist/chunk-3WA3M347.cjs +0 -1
  95. package/dist/chunk-5CU33JVY.js +0 -1
  96. package/dist/chunk-7K37PVGV.js +0 -5
  97. package/dist/chunk-BTHXQWHT.js +0 -1
  98. package/dist/chunk-ROFUQLOZ.cjs +0 -1
  99. package/dist/chunk-W7C357A6.cjs +0 -5
@@ -1,17 +1,3 @@
1
- /**
2
- * The files a new plugin starts with (`pnpm plugin:new` in this repository,
3
- * `tego-plugin create` anywhere else), as pure data.
4
- *
5
- * Kept apart from the interactive generator (`turbo/generators/config.ts`) so
6
- * the same builder can be exercised without a TTY: a test — or a one-off
7
- * script — calls `buildPluginFiles(answers)` and asserts on the tree, where the
8
- * interactive generator can only be driven by a real terminal.
9
- *
10
- * Everything here is faithful to what the upload validator (`@tego/plugin-sdk`
11
- * manifest schema + the server's `prepare-plugin-package`) accepts, because a
12
- * scaffold that produces a package the platform then rejects is worse than no
13
- * scaffold: the author learns the rules by hitting them one at a time.
14
- */
15
1
  type PluginPart = 'frontend' | 'backend' | 'claw';
16
2
  interface PluginAnswers {
17
3
  /** kebab-case id, e.g. `tego-notes`. */
@@ -25,7 +11,17 @@ interface PluginAnswers {
25
11
  scope: 'avatar' | 'tenant';
26
12
  /** Caret range for the current host, e.g. `^1.5.0`. */
27
13
  hostApiRange: string;
14
+ /**
15
+ * `standard` (what `tego-plugin create` writes): the patterns the mature
16
+ * plugins use — access catalog with one policy per route, Tailwind scoping,
17
+ * API errors with codes, an error boundary, live updates, locale and route
18
+ * tests. `minimal`: one page and one route, for starting from nothing.
19
+ * Omitted means `minimal`, so existing callers keep their output.
20
+ */
21
+ template?: PluginTemplate;
28
22
  }
23
+ type PluginTemplate = 'standard' | 'minimal';
24
+ declare const PLUGIN_TEMPLATES: readonly PluginTemplate[];
29
25
  /**
30
26
  * Where the SDK packages come from.
31
27
  *
@@ -45,6 +41,27 @@ interface BuildPluginFilesOptions {
45
41
  * `plugin-files.test.ts` fails if the two disagree.
46
42
  */
47
43
  declare const PUBLISHED_SDK_PACKAGES: Record<string, string>;
44
+ /**
45
+ * The repository's Prettier settings (root `.prettierrc`), which the lint
46
+ * config enforces through `prettier/prettier`. A standalone
47
+ * repository has no root to inherit them from. The Tailwind class-sorting
48
+ * plugin is left out: it is one more dependency, and only reorders classes.
49
+ */
50
+ declare const STANDALONE_PRETTIER: {
51
+ readonly semi: true;
52
+ readonly trailingComma: "es5";
53
+ readonly singleQuote: true;
54
+ readonly printWidth: 80;
55
+ readonly tabWidth: 2;
56
+ readonly useTabs: false;
57
+ readonly bracketSpacing: true;
58
+ readonly bracketSameLine: false;
59
+ readonly arrowParens: "avoid";
60
+ readonly endOfLine: "lf";
61
+ readonly quoteProps: "as-needed";
62
+ readonly jsxSingleQuote: true;
63
+ readonly proseWrap: "preserve";
64
+ };
48
65
  /**
49
66
  * The TypeScript presets of `@tego/tsconfig` (packages/tsconfig), copied into a
50
67
  * standalone plugin's root instead of published as a package: they only drive
@@ -158,10 +175,17 @@ declare function writePlugin(repoRoot: string, answers: PluginAnswers): {
158
175
  * packages come from npm instead of this workspace. Same refusal rule as
159
176
  * {@link writePlugin}.
160
177
  */
161
- declare function writeStandalonePlugin(parentDirectory: string, answers: PluginAnswers): {
178
+ declare function writeStandalonePlugin(parentDirectory: string, answers: PluginAnswers): Promise<{
162
179
  directory: string;
163
180
  files: string[];
164
- };
181
+ }>;
182
+ /**
183
+ * The files as Prettier writes them with the plugin's own settings, so a new
184
+ * plugin passes its `lint` gate (which enforces Prettier) from the first run.
185
+ * Done here rather than in the templates: where Prettier breaks a line depends
186
+ * on the plugin id's length.
187
+ */
188
+ declare function formatPluginFiles(files: GeneratedFile[]): Promise<GeneratedFile[]>;
165
189
  /** What `tego-plugin create` prints on success. */
166
190
  interface CreatePluginResult {
167
191
  directory: string;
@@ -177,6 +201,6 @@ interface CreatePluginResult {
177
201
  declare function createStandalonePlugin(input: string, options: {
178
202
  parent: string;
179
203
  cwd: string;
180
- }): CreatePluginResult;
204
+ }): Promise<CreatePluginResult>;
181
205
 
182
- export { type BuildPluginFilesOptions, type CreatePluginResult, type DependencySource, type GeneratedFile, PLUGIN_ID_HINT, PLUGIN_ID_PATTERN, PLUGIN_PARTS, PLUGIN_SCOPES, PUBLISHED_SDK_PACKAGES, type PluginAnswers, type PluginPart, STANDALONE_TSCONFIG_FILES, buildPluginFiles, createStandalonePlugin, packageNameFor, validatePluginAnswers, writePlugin, writeStandalonePlugin };
206
+ export { type BuildPluginFilesOptions, type CreatePluginResult, type DependencySource, type GeneratedFile, PLUGIN_ID_HINT, PLUGIN_ID_PATTERN, PLUGIN_PARTS, PLUGIN_SCOPES, PLUGIN_TEMPLATES, PUBLISHED_SDK_PACKAGES, type PluginAnswers, type PluginPart, type PluginTemplate, STANDALONE_PRETTIER, STANDALONE_TSCONFIG_FILES, buildPluginFiles, createStandalonePlugin, formatPluginFiles, packageNameFor, validatePluginAnswers, writePlugin, writeStandalonePlugin };
@@ -1,17 +1,3 @@
1
- /**
2
- * The files a new plugin starts with (`pnpm plugin:new` in this repository,
3
- * `tego-plugin create` anywhere else), as pure data.
4
- *
5
- * Kept apart from the interactive generator (`turbo/generators/config.ts`) so
6
- * the same builder can be exercised without a TTY: a test — or a one-off
7
- * script — calls `buildPluginFiles(answers)` and asserts on the tree, where the
8
- * interactive generator can only be driven by a real terminal.
9
- *
10
- * Everything here is faithful to what the upload validator (`@tego/plugin-sdk`
11
- * manifest schema + the server's `prepare-plugin-package`) accepts, because a
12
- * scaffold that produces a package the platform then rejects is worse than no
13
- * scaffold: the author learns the rules by hitting them one at a time.
14
- */
15
1
  type PluginPart = 'frontend' | 'backend' | 'claw';
16
2
  interface PluginAnswers {
17
3
  /** kebab-case id, e.g. `tego-notes`. */
@@ -25,7 +11,17 @@ interface PluginAnswers {
25
11
  scope: 'avatar' | 'tenant';
26
12
  /** Caret range for the current host, e.g. `^1.5.0`. */
27
13
  hostApiRange: string;
14
+ /**
15
+ * `standard` (what `tego-plugin create` writes): the patterns the mature
16
+ * plugins use — access catalog with one policy per route, Tailwind scoping,
17
+ * API errors with codes, an error boundary, live updates, locale and route
18
+ * tests. `minimal`: one page and one route, for starting from nothing.
19
+ * Omitted means `minimal`, so existing callers keep their output.
20
+ */
21
+ template?: PluginTemplate;
28
22
  }
23
+ type PluginTemplate = 'standard' | 'minimal';
24
+ declare const PLUGIN_TEMPLATES: readonly PluginTemplate[];
29
25
  /**
30
26
  * Where the SDK packages come from.
31
27
  *
@@ -45,6 +41,27 @@ interface BuildPluginFilesOptions {
45
41
  * `plugin-files.test.ts` fails if the two disagree.
46
42
  */
47
43
  declare const PUBLISHED_SDK_PACKAGES: Record<string, string>;
44
+ /**
45
+ * The repository's Prettier settings (root `.prettierrc`), which the lint
46
+ * config enforces through `prettier/prettier`. A standalone
47
+ * repository has no root to inherit them from. The Tailwind class-sorting
48
+ * plugin is left out: it is one more dependency, and only reorders classes.
49
+ */
50
+ declare const STANDALONE_PRETTIER: {
51
+ readonly semi: true;
52
+ readonly trailingComma: "es5";
53
+ readonly singleQuote: true;
54
+ readonly printWidth: 80;
55
+ readonly tabWidth: 2;
56
+ readonly useTabs: false;
57
+ readonly bracketSpacing: true;
58
+ readonly bracketSameLine: false;
59
+ readonly arrowParens: "avoid";
60
+ readonly endOfLine: "lf";
61
+ readonly quoteProps: "as-needed";
62
+ readonly jsxSingleQuote: true;
63
+ readonly proseWrap: "preserve";
64
+ };
48
65
  /**
49
66
  * The TypeScript presets of `@tego/tsconfig` (packages/tsconfig), copied into a
50
67
  * standalone plugin's root instead of published as a package: they only drive
@@ -158,10 +175,17 @@ declare function writePlugin(repoRoot: string, answers: PluginAnswers): {
158
175
  * packages come from npm instead of this workspace. Same refusal rule as
159
176
  * {@link writePlugin}.
160
177
  */
161
- declare function writeStandalonePlugin(parentDirectory: string, answers: PluginAnswers): {
178
+ declare function writeStandalonePlugin(parentDirectory: string, answers: PluginAnswers): Promise<{
162
179
  directory: string;
163
180
  files: string[];
164
- };
181
+ }>;
182
+ /**
183
+ * The files as Prettier writes them with the plugin's own settings, so a new
184
+ * plugin passes its `lint` gate (which enforces Prettier) from the first run.
185
+ * Done here rather than in the templates: where Prettier breaks a line depends
186
+ * on the plugin id's length.
187
+ */
188
+ declare function formatPluginFiles(files: GeneratedFile[]): Promise<GeneratedFile[]>;
165
189
  /** What `tego-plugin create` prints on success. */
166
190
  interface CreatePluginResult {
167
191
  directory: string;
@@ -177,6 +201,6 @@ interface CreatePluginResult {
177
201
  declare function createStandalonePlugin(input: string, options: {
178
202
  parent: string;
179
203
  cwd: string;
180
- }): CreatePluginResult;
204
+ }): Promise<CreatePluginResult>;
181
205
 
182
- export { type BuildPluginFilesOptions, type CreatePluginResult, type DependencySource, type GeneratedFile, PLUGIN_ID_HINT, PLUGIN_ID_PATTERN, PLUGIN_PARTS, PLUGIN_SCOPES, PUBLISHED_SDK_PACKAGES, type PluginAnswers, type PluginPart, STANDALONE_TSCONFIG_FILES, buildPluginFiles, createStandalonePlugin, packageNameFor, validatePluginAnswers, writePlugin, writeStandalonePlugin };
206
+ export { type BuildPluginFilesOptions, type CreatePluginResult, type DependencySource, type GeneratedFile, PLUGIN_ID_HINT, PLUGIN_ID_PATTERN, PLUGIN_PARTS, PLUGIN_SCOPES, PLUGIN_TEMPLATES, PUBLISHED_SDK_PACKAGES, type PluginAnswers, type PluginPart, type PluginTemplate, STANDALONE_PRETTIER, STANDALONE_TSCONFIG_FILES, buildPluginFiles, createStandalonePlugin, formatPluginFiles, packageNameFor, validatePluginAnswers, writePlugin, writeStandalonePlugin };