@harperfast/template-vue-ts-studio 1.9.0 → 1.9.2

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 (29) hide show
  1. package/.agents/skills/harper-best-practices/AGENTS.md +16 -12
  2. package/.agents/skills/harper-best-practices/rules/custom-resources.md +5 -4
  3. package/.agents/skills/harper-best-practices/rules/extending-tables.md +11 -8
  4. package/agent/skills/harper-best-practices/AGENTS.md +1950 -0
  5. package/agent/skills/harper-best-practices/SKILL.md +96 -0
  6. package/agent/skills/harper-best-practices/rules/adding-tables-with-schemas.md +42 -0
  7. package/agent/skills/harper-best-practices/rules/automatic-apis.md +165 -0
  8. package/agent/skills/harper-best-practices/rules/caching.md +163 -0
  9. package/agent/skills/harper-best-practices/rules/checking-authentication.md +190 -0
  10. package/agent/skills/harper-best-practices/rules/creating-a-fabric-account-and-cluster.md +30 -0
  11. package/agent/skills/harper-best-practices/rules/creating-harper-apps.md +54 -0
  12. package/agent/skills/harper-best-practices/rules/custom-resources.md +44 -0
  13. package/agent/skills/harper-best-practices/rules/defining-relationships.md +35 -0
  14. package/agent/skills/harper-best-practices/rules/deploying-to-harper-fabric.md +122 -0
  15. package/agent/skills/harper-best-practices/rules/extending-tables.md +46 -0
  16. package/agent/skills/harper-best-practices/rules/handling-binary-data.md +45 -0
  17. package/agent/skills/harper-best-practices/rules/load-env.md +111 -0
  18. package/agent/skills/harper-best-practices/rules/logging.md +169 -0
  19. package/agent/skills/harper-best-practices/rules/programmatic-table-requests.md +134 -0
  20. package/agent/skills/harper-best-practices/rules/querying-rest-apis.md +202 -0
  21. package/agent/skills/harper-best-practices/rules/real-time-apps.md +102 -0
  22. package/agent/skills/harper-best-practices/rules/schema-design-tooling.md +161 -0
  23. package/agent/skills/harper-best-practices/rules/serving-web-content.md +85 -0
  24. package/agent/skills/harper-best-practices/rules/typescript-type-stripping.md +64 -0
  25. package/agent/skills/harper-best-practices/rules/using-blob-datatype.md +38 -0
  26. package/agent/skills/harper-best-practices/rules/vector-indexing.md +124 -0
  27. package/agent/skills/harper-best-practices/rules.manifest.yaml +302 -0
  28. package/package.json +1 -1
  29. package/skills-lock.json +1 -1
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: typescript-type-stripping
3
+ description: How to run TypeScript files directly in Harper without a build step.
4
+ metadata:
5
+ mode: generate
6
+ sources:
7
+ - reference/v5/components/javascript-environment.md#TypeScript Support
8
+ sourceCommit: b7fbddadd42eb4487190b650a9abc4bcfeef5819
9
+ inputHash: 4e6bd8b610edd595
10
+ ---
11
+
12
+ # TypeScript Type Stripping in Harper
13
+
14
+ Instructions for the agent to run `.ts` files directly in Harper without a build step using Node.js's built-in type stripping.
15
+
16
+ ## When to Use
17
+
18
+ Apply this rule when writing Harper resource files in TypeScript. Use it any time you need to reference `.ts` source files from `config.yaml` or import between local TypeScript modules in a Harper project.
19
+
20
+ ## How It Works
21
+
22
+ 1. **Ensure Node.js version**: Require Node.js 22.6 or later. Type stripping is unavailable on earlier versions.
23
+
24
+ 2. **Point `jsResource` at `.ts` files**: The `jsResource` plugin loads both `.js` and `.ts` files. Set its `files` glob in `config.yaml` to target your `.ts` source files:
25
+
26
+ ```yaml
27
+ jsResource:
28
+ files: 'resources/*.ts'
29
+ ```
30
+
31
+ 3. **Use explicit `.ts` extensions in local imports**: Node's loader does not resolve `'./helper'` to `'./helper.ts'`, so always include the full extension:
32
+
33
+ ```typescript
34
+ import { helper } from './helper.ts';
35
+ ```
36
+
37
+ 4. **Stay within type-stripping limits**: Only type annotations and declarations are removed. Do not use enums with runtime values, namespaces with runtime semantics, or any other features that require code transformation beyond type stripping.
38
+
39
+ ## Examples
40
+
41
+ A complete Harper resource written in TypeScript, using imports from the `harper` package:
42
+
43
+ ```typescript
44
+ import { type RequestTargetOrId, Resource, tables } from 'harper';
45
+
46
+ export class MyResource extends Resource {
47
+ async get(target?: RequestTargetOrId): Promise<{ message: string }> {
48
+ return { message: 'Hello from TS' };
49
+ }
50
+ }
51
+ ```
52
+
53
+ Paired `config.yaml` entry loading the file via `jsResource`:
54
+
55
+ ```yaml
56
+ jsResource:
57
+ files: 'resources/*.ts'
58
+ ```
59
+
60
+ ## Notes
61
+
62
+ - No build step or transpiler is required — Harper runs `.ts` files directly.
63
+ - Type imports (e.g., `import { type RequestTargetOrId }`) from the `harper` package work as usual.
64
+ - Unsupported TypeScript features include: enums with runtime values, namespaces with runtime semantics, and anything requiring code transformation beyond simple type stripping.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: using-blob-datatype
3
+ description: How to use the Blob data type for efficient binary storage in Harper.
4
+ metadata:
5
+ mode: synthesized
6
+ ---
7
+
8
+ # Using Blob Datatype
9
+
10
+ Instructions for the agent to follow when working with the Blob data type in Harper.
11
+
12
+ ## When to Use
13
+
14
+ Use this skill when you need to store unstructured or large binary data (media, documents) that is too large for standard JSON fields. Blobs provide efficient storage and integrated streaming support.
15
+
16
+ ## How It Works
17
+
18
+ 1. **Define Blob Fields**: In your GraphQL schema, use the `Blob` type:
19
+ ```graphql
20
+ type MyTable @table {
21
+ id: ID @primaryKey
22
+ data: Blob
23
+ }
24
+ ```
25
+ 2. **Create and Store Blobs**: Use `createBlob()` from Harper's globals to wrap Buffers or Streams:
26
+ ```javascript
27
+ import { tables } from 'harper';
28
+ const blob = createBlob(largeBuffer);
29
+ await tables.MyTable.put('my-id', { data: blob });
30
+ ```
31
+ 3. **Use Streaming (Optional)**: For very large files, pass a stream to `createBlob()` to avoid loading the entire file into memory.
32
+ 4. **Read Blob Data**: Retrieve the record and use `.bytes()` or streaming interfaces on the blob field:
33
+ ```javascript
34
+ const record = await tables.MyTable.get('my-id');
35
+ const buffer = await record.data.bytes();
36
+ ```
37
+ 5. **Ensure Write Completion**: Use `saveBeforeCommit: true` in `createBlob` options if you need the blob fully written before the record is committed.
38
+ 6. **Handle Errors**: Attach error listeners to the blob object to handle streaming failures.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: vector-indexing
3
+ description: How to enable and query vector indexes for similarity search in Harper.
4
+ metadata:
5
+ mode: generate
6
+ sources:
7
+ - reference/v5/database/schema.md#Vector Indexing
8
+ sourceCommit: b7fbddadd42eb4487190b650a9abc4bcfeef5819
9
+ inputHash: 3732961c671aac00
10
+ ---
11
+
12
+ # Vector Indexing
13
+
14
+ Instructions for the agent to follow when enabling and querying vector indexes for similarity search in Harper using the HNSW algorithm.
15
+
16
+ ## When to Use
17
+
18
+ Apply this rule when adding a vector index to a Harper table schema or writing similarity search queries against high-dimensional vector fields. Use it whenever you need approximate nearest-neighbor search, distance-threshold filtering, or distance-scored results.
19
+
20
+ ## How It Works
21
+
22
+ 1. **Declare the vector index on a `[Float]` field**: Add `@indexed(type: "HNSW")` to any `[Float]` attribute in a `@table` type. See [adding-tables-with-schemas.md](adding-tables-with-schemas.md) for general schema setup.
23
+
24
+ ```graphql
25
+ type Document @table {
26
+ id: Long @primaryKey
27
+ textEmbeddings: [Float] @indexed(type: "HNSW")
28
+ }
29
+ ```
30
+
31
+ 2. **Query by nearest neighbors using `sort`**: Call `Document.search()` with a `sort` object containing `attribute` (the indexed field name) and `target` (the query vector). Include `limit` to cap results.
32
+
33
+ ```javascript
34
+ let results = Document.search({
35
+ sort: { attribute: 'textEmbeddings', target: searchVector },
36
+ limit: 5,
37
+ });
38
+ ```
39
+
40
+ 3. **Combine with filter conditions**: Add a `conditions` array alongside `sort` to pre-filter records before ranking by similarity.
41
+
42
+ ```javascript
43
+ let results = Document.search({
44
+ conditions: [{ attribute: 'price', comparator: 'lt', value: 50 }],
45
+ sort: { attribute: 'textEmbeddings', target: searchVector },
46
+ limit: 5,
47
+ });
48
+ ```
49
+
50
+ 4. **Filter by distance threshold**: To return only records within a similarity cutoff (without ranking), place `target` directly on the condition alongside `comparator` and `value`. Omit `sort`.
51
+
52
+ ```javascript
53
+ let results = Document.search({
54
+ conditions: {
55
+ attribute: 'textEmbeddings',
56
+ comparator: 'lt',
57
+ value: 0.1,
58
+ target: searchVector,
59
+ },
60
+ });
61
+ ```
62
+
63
+ 5. **Include computed distance in results**: Use the special `$distance` field in `select` to return the distance from the target vector. Works with both `sort`-based and `conditions`-based queries.
64
+
65
+ ```javascript
66
+ let results = Document.search({
67
+ select: ['name', '$distance'],
68
+ sort: { attribute: 'textEmbeddings', target: searchVector },
69
+ limit: 5,
70
+ });
71
+ ```
72
+
73
+ 6. **Tune HNSW parameters**: Pass additional parameters to `@indexed(type: "HNSW", ...)` to control index quality and performance.
74
+
75
+ | Parameter | Default | Description |
76
+ | ---------------------- | ----------------- | --------------------------------------------------------------------------------------------------- |
77
+ | `distance` | `"cosine"` | Distance function: `"euclidean"` or `"cosine"` (negative cosine similarity) |
78
+ | `efConstruction` | `100` | Max nodes explored during index construction. Higher = better recall, lower = better performance |
79
+ | `M` | `16` | Preferred connections per graph layer. Higher = more space, better recall for high-dimensional data |
80
+ | `optimizeRouting` | `0.5` | Heuristic aggressiveness for omitting redundant connections (0 = off, 1 = most aggressive) |
81
+ | `mL` | computed from `M` | Normalization factor for level generation |
82
+ | `efSearchConstruction` | `50` | Max nodes explored during search |
83
+
84
+ ## Examples
85
+
86
+ **Schema with custom HNSW parameters:**
87
+
88
+ ```graphql
89
+ type Document @table {
90
+ id: Long @primaryKey
91
+ textEmbeddings: [Float]
92
+ @indexed(type: "HNSW", distance: "euclidean", optimizeRouting: 0, efSearchConstruction: 100)
93
+ }
94
+ ```
95
+
96
+ **Nearest-neighbor search with distance score:**
97
+
98
+ ```javascript
99
+ let results = Document.search({
100
+ select: ['name', '$distance'],
101
+ sort: { attribute: 'textEmbeddings', target: searchVector },
102
+ limit: 5,
103
+ });
104
+ ```
105
+
106
+ **Distance-threshold filter (no ranking):**
107
+
108
+ ```javascript
109
+ let results = Document.search({
110
+ conditions: {
111
+ attribute: 'textEmbeddings',
112
+ comparator: 'lt',
113
+ value: 0.1,
114
+ target: searchVector,
115
+ },
116
+ });
117
+ ```
118
+
119
+ ## Notes
120
+
121
+ - The default `distance` function is `cosine`. Pass `distance: "euclidean"` to switch.
122
+ - `efConstruction` controls index build quality; raising it improves recall at the cost of build time.
123
+ - `$distance` is available in both `sort`-based ranking and `conditions`-based threshold queries.
124
+ - Use the threshold (`conditions` + `target`) form when you want to bound result quality by a similarity cutoff rather than ranking by similarity.
@@ -0,0 +1,302 @@
1
+ # Rules manifest for the harper-best-practices skill.
2
+ #
3
+ # Declarative source of truth for rule taxonomy, sources, and generation mode.
4
+ # Owned by humans; the generator reads this file and writes derived artifacts
5
+ # (rule bodies, AGENTS.md). See docs/plans/docs-driven-skills.md for the
6
+ # full schema definition and Manifest ↔ frontmatter reconciliation semantics.
7
+ #
8
+ # Phase 2 flipped vector-indexing to mode: generate.
9
+ # Phase 3 flips 7 obvious 1:1 rules to mode: generate (automatic-apis,
10
+ # querying-rest-apis, real-time-apps, checking-authentication, logging,
11
+ # deploying-to-harper-fabric, caching). All others remain synthesized.
12
+ # Phase 4 migrates schema-design-tooling and typescript-type-stripping to
13
+ # mode: generate. creating-harper-apps stays synthesized pending dedicated
14
+ # create-harper CLI documentation.
15
+
16
+ rules:
17
+ # ===========================================================================
18
+ # Schema & Data Design (priority 1 — HIGH)
19
+ # ===========================================================================
20
+
21
+ - rule: adding-tables-with-schemas
22
+ description: Guidelines for adding tables to a Harper database using GraphQL schemas.
23
+ category: schema
24
+ priority: 1
25
+ order: 1
26
+ mode: synthesized
27
+
28
+ - rule: schema-design-tooling
29
+ description: Best practices for Harper schema design, including core directives and GraphQL tooling configuration.
30
+ category: schema
31
+ priority: 1
32
+ order: 2
33
+ mode: generate
34
+ sources:
35
+ - path: reference/v5/database/schema.md
36
+ section: 'Overview'
37
+ role: primary
38
+ - path: reference/v5/database/schema.md
39
+ section: 'Type Directives'
40
+ role: primary
41
+ - path: reference/v5/database/schema.md
42
+ section: 'Field Directives'
43
+ role: primary
44
+ must_cover:
45
+ - '@table'
46
+ - '@export'
47
+ - '@primaryKey'
48
+ - '@indexed'
49
+ - 'graphqlSchema'
50
+
51
+ - rule: defining-relationships
52
+ description: How to define and use relationships between tables in Harper using GraphQL.
53
+ category: schema
54
+ priority: 1
55
+ order: 3
56
+ mode: synthesized
57
+
58
+ - rule: vector-indexing
59
+ description: How to enable and query vector indexes for similarity search in Harper.
60
+ category: schema
61
+ priority: 1
62
+ order: 4
63
+ mode: generate
64
+ sources:
65
+ - path: reference/v5/database/schema.md
66
+ section: 'Vector Indexing'
67
+ role: primary
68
+ must_cover:
69
+ - '@indexed(type: "HNSW")'
70
+ - 'sort'
71
+ - 'target'
72
+ - 'cosine'
73
+ - 'efConstruction'
74
+ cross_links:
75
+ - adding-tables-with-schemas
76
+
77
+ - rule: using-blob-datatype
78
+ description: How to use the Blob data type for efficient binary storage in Harper.
79
+ category: schema
80
+ priority: 1
81
+ order: 5
82
+ mode: synthesized
83
+
84
+ - rule: handling-binary-data
85
+ description: How to store and serve binary data like images or audio in Harper.
86
+ category: schema
87
+ priority: 1
88
+ order: 6
89
+ mode: synthesized
90
+
91
+ # ===========================================================================
92
+ # API & Communication (priority 2 — HIGH)
93
+ # ===========================================================================
94
+
95
+ - rule: automatic-apis
96
+ description: How to use Harper's automatically generated REST and WebSocket APIs.
97
+ category: api
98
+ priority: 2
99
+ order: 1
100
+ mode: generate
101
+ sources:
102
+ - path: reference/v5/rest/overview.md
103
+ role: primary
104
+ - path: reference/v5/rest/websockets.md
105
+ role: supplemental
106
+ must_cover:
107
+ - 'rest: true'
108
+ - '@export'
109
+ - 'WebSocket'
110
+ cross_links:
111
+ - querying-rest-apis
112
+ - real-time-apps
113
+
114
+ - rule: querying-rest-apis
115
+ description: How to use query parameters to filter, sort, and paginate Harper REST APIs.
116
+ category: api
117
+ priority: 2
118
+ order: 2
119
+ mode: generate
120
+ sources:
121
+ - path: reference/v5/rest/querying.md
122
+ role: primary
123
+ must_cover:
124
+ - '=gt='
125
+ - '=lt='
126
+ - 'select('
127
+ - 'sort('
128
+ - 'limit('
129
+ cross_links:
130
+ - automatic-apis
131
+
132
+ - rule: real-time-apps
133
+ description: How to build real-time features in Harper using WebSockets and Pub/Sub.
134
+ category: api
135
+ priority: 2
136
+ order: 3
137
+ mode: generate
138
+ sources:
139
+ - path: reference/v5/rest/websockets.md
140
+ role: primary
141
+ must_cover:
142
+ - 'WebSocket'
143
+ - 'connect('
144
+ cross_links:
145
+ - automatic-apis
146
+
147
+ - rule: checking-authentication
148
+ description: How to handle user authentication and sessions in Harper Resources.
149
+ category: api
150
+ priority: 2
151
+ order: 4
152
+ mode: generate
153
+ sources:
154
+ - path: reference/v5/resources/resource-api.md
155
+ section: '`getCurrentUser(): User | undefined`'
156
+ role: primary
157
+ - path: reference/v5/resources/resource-api.md
158
+ section: 'Session and Login from a Resource'
159
+ role: primary
160
+ - path: reference/v5/security/jwt-authentication.md
161
+ role: supplemental
162
+ must_cover:
163
+ - 'getCurrentUser()'
164
+ - 'getContext()'
165
+ - 'context.login'
166
+ - 'enableSessions'
167
+ cross_links:
168
+ - custom-resources
169
+
170
+ # ===========================================================================
171
+ # Logic & Extension (priority 3 — MEDIUM)
172
+ # ===========================================================================
173
+
174
+ - rule: custom-resources
175
+ description: How to define custom REST endpoints with JavaScript or TypeScript in Harper.
176
+ category: logic
177
+ priority: 3
178
+ order: 1
179
+ mode: synthesized
180
+
181
+ - rule: extending-tables
182
+ description: How to add custom logic to automatically generated table resources in Harper.
183
+ category: logic
184
+ priority: 3
185
+ order: 2
186
+ mode: synthesized
187
+
188
+ - rule: programmatic-table-requests
189
+ description: How to interact with Harper tables programmatically using the `tables` object.
190
+ category: logic
191
+ priority: 3
192
+ order: 3
193
+ mode: synthesized
194
+
195
+ - rule: typescript-type-stripping
196
+ description: How to run TypeScript files directly in Harper without a build step.
197
+ category: logic
198
+ priority: 3
199
+ order: 4
200
+ mode: generate
201
+ sources:
202
+ - path: reference/v5/components/javascript-environment.md
203
+ section: 'TypeScript Support'
204
+ role: primary
205
+ must_cover:
206
+ - '.ts'
207
+ - 'jsResource'
208
+ - 'Node.js 22.6'
209
+ - 'type stripping'
210
+
211
+ - rule: caching
212
+ description: How to implement integrated data caching in Harper from external sources.
213
+ category: logic
214
+ priority: 3
215
+ order: 5
216
+ mode: generate
217
+ sources:
218
+ - path: learn/developers/caching-with-harper.md
219
+ role: primary
220
+ must_cover:
221
+ - 'expiration'
222
+ - 'sourcedFrom'
223
+ - '@table'
224
+ cross_links:
225
+ - custom-resources
226
+ - automatic-apis
227
+
228
+ # ===========================================================================
229
+ # Infrastructure & Ops (priority 4 — MEDIUM)
230
+ # ===========================================================================
231
+
232
+ - rule: deploying-to-harper-fabric
233
+ description: How to deploy a Harper application to the Harper Fabric cloud.
234
+ category: ops
235
+ priority: 4
236
+ order: 1
237
+ mode: generate
238
+ sources:
239
+ - path: reference/v5/components/applications.md
240
+ section: 'Remote Management'
241
+ role: primary
242
+ - path: fabric/cluster-creation-management.md
243
+ section: 'Connecting the Harper CLI to a Cluster'
244
+ role: supplemental
245
+ must_cover:
246
+ - 'harper deploy'
247
+ - 'harper login'
248
+ cross_links:
249
+ - creating-a-fabric-account-and-cluster
250
+
251
+ - rule: creating-a-fabric-account-and-cluster
252
+ description: How to create a Harper Fabric account, organization, and cluster.
253
+ category: ops
254
+ priority: 4
255
+ order: 2
256
+ mode: synthesized
257
+
258
+ - rule: creating-harper-apps
259
+ description: How to initialize a new Harper application using the CLI.
260
+ category: ops
261
+ priority: 4
262
+ order: 3
263
+ mode: synthesized
264
+
265
+ - rule: serving-web-content
266
+ description: How to serve static files and integrated Vite/React applications in Harper.
267
+ category: ops
268
+ priority: 4
269
+ order: 4
270
+ mode: synthesized
271
+
272
+ - rule: logging
273
+ description: Best practices for logging in Harper, including console capture, the granular logger interface, and programmatic log retrieval.
274
+ category: ops
275
+ priority: 4
276
+ order: 5
277
+ mode: generate
278
+ sources:
279
+ - path: reference/v5/logging/overview.md
280
+ role: primary
281
+ - path: reference/v5/logging/api.md
282
+ role: primary
283
+ must_cover:
284
+ - 'console.log'
285
+ - 'logger'
286
+ - 'withTag('
287
+
288
+ - rule: load-env
289
+ description: How to load environment variables from .env files into a Harper application using the loadEnv plugin.
290
+ category: ops
291
+ priority: 4
292
+ order: 6
293
+ mode: generate
294
+ sources:
295
+ - path: reference/v5/environment-variables/overview.md
296
+ role: primary
297
+ must_cover:
298
+ - 'loadEnv'
299
+ - 'files'
300
+ - 'process.env'
301
+ - 'override'
302
+ - 'config.yaml'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harperfast/template-vue-ts-studio",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "type": "module",
5
5
  "repository": "github:HarperFast/create-harper",
6
6
  "scripts": {},
package/skills-lock.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "source": "harperfast/skills",
6
6
  "sourceType": "github",
7
7
  "skillPath": "harper-best-practices/SKILL.md",
8
- "computedHash": "8aa6811090a5ef3721428b048f3c1208fc50d93b5fe03acad27d89a416a081a1"
8
+ "computedHash": "83a152c96356e5c4c1429a96d1f1758738f11ef74aab3e045799bf6b7a4df2d4"
9
9
  }
10
10
  }
11
11
  }