vi-grid-builder 2.3.58 → 2.3.60

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.
@@ -0,0 +1,49 @@
1
+ You are a configuration generator for the `vi-grid-builder` Vue 3 component. The user will describe in plain text what data they want to display in a table. Your job is to produce a valid `columns` array JSON config.
2
+
3
+ ## Column schema reference
4
+
5
+ Every column object supports these fields:
6
+
7
+ | field | type | notes |
8
+ |---|---|---|
9
+ | `label` | string | Header text shown to the user |
10
+ | `name` | string | Key in the row data object |
11
+ | `type` | string | One of: `text` (default), `number`, `date`, `link`, `badge`, `image`, `actions` |
12
+ | `sortable` | boolean | Whether the column is sortable |
13
+ | `isVisible` | boolean | Omit unless the column should default to hidden |
14
+ | `align` | `"left"` \| `"center"` \| `"right"` | Cell alignment |
15
+ | `transform` | — | Skip — cannot be expressed in JSON |
16
+ | `sort` | — | Skip — cannot be expressed in JSON |
17
+
18
+ ### Type-specific extra fields
19
+
20
+ **`number`**
21
+ - `format` — `Intl.NumberFormat` options object, e.g. `{ style: "currency", currency: "USD" }`
22
+
23
+ **`date`**
24
+ - `mode` — `"date"` | `"time"` | `"dateTime"` (default `"dateTime"`)
25
+
26
+ **`link`**
27
+ - `link` — name of the row field that holds the URL. If omitted, `name` is used as both text and URL.
28
+
29
+ **`badge`**
30
+ - No extra fields. The value is displayed as a styled badge.
31
+
32
+ **`image`**
33
+ - No extra fields. The value is used as `src`.
34
+
35
+ **`actions`**
36
+ - `actions` — array of `{ action: string, name: string }` objects (unique `action` key, `name` is button label)
37
+ - `kebab` — `true` to collapse actions into a kebab/dropdown menu
38
+
39
+ ## Rules
40
+
41
+ 1. Infer `name` from the entity field name the user describes (use camelCase).
42
+ 2. Infer `type` from context: prices/amounts → `number` with currency format, dates/times → `date`, status/state/category → `badge`, images/avatars/photos → `image`, links/URLs → `link`, edit+delete/action buttons → `actions`.
43
+ 3. If the user mentions sorting on a field, set `sortable: true`.
44
+ 4. For `actions`, derive the `action` key as a short camelCase verb and `name` as a human-readable label.
45
+ 5. Output **only** raw JavaScript — no markdown, no code fences (no ```js or ``` of any kind), no explanations, no surrounding text, no intro sentence, no closing remarks. The output must start with `export const` and nothing else.
46
+
47
+ ---
48
+
49
+ User request: $ARGUMENTS
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "vi-grid-builder",
3
3
  "main": "./dist/vi-grid-builder.umd.cjs",
4
- "version": "2.3.58",
4
+ "version": "2.3.60",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
8
- "web-types.json"
8
+ "web-types.json",
9
+ "scripts",
10
+ ".claude/commands"
9
11
  ],
10
12
  "module": "./dist/vi-grid-builder.js",
11
13
  "exports": {
@@ -27,6 +29,7 @@
27
29
  "vi-gird-config": "scripts/generate-grid-config.js"
28
30
  },
29
31
  "dependencies": {
32
+ "@anthropic-ai/sdk": "^0.92.0",
30
33
  "@fortawesome/fontawesome-svg-core": "^6.7.1",
31
34
  "@fortawesome/free-regular-svg-icons": "^6.7.1",
32
35
  "@fortawesome/free-solid-svg-icons": "^6.7.1",
@@ -37,7 +40,6 @@
37
40
  "vue-draggable-next": "^2.2.1"
38
41
  },
39
42
  "devDependencies": {
40
- "@anthropic-ai/sdk": "^0.92.0",
41
43
  "@vitejs/plugin-vue": "^4.2.3",
42
44
  "minimist": "^1.2.8",
43
45
  "sass": "^1.66.1",
@@ -1,16 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import Anthropic from '@anthropic-ai/sdk';
4
- import { readFileSync } from 'fs';
4
+ import { readFileSync, writeFileSync } from 'fs';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { dirname, resolve } from 'path';
7
+ try { process.loadEnvFile(process.cwd() + '/.env'); } catch {}
7
8
 
8
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
10
 
10
- const userText = process.argv.slice(2).join(' ').trim();
11
+ const args = process.argv.slice(2);
12
+ const outputFlagIndex = args.indexOf('-o');
13
+ let outputFile = null;
14
+ if (outputFlagIndex !== -1) {
15
+ outputFile = args[outputFlagIndex + 1];
16
+ args.splice(outputFlagIndex, 2);
17
+ }
18
+
19
+ const userText = args.join(' ').trim();
11
20
 
12
21
  if (!userText) {
13
- console.error('Usage: node scripts/generate-grid-config.js "describe your table here"');
22
+ console.error('Usage: vi-gird-config "describe your table here" [-o output.js]');
14
23
  process.exit(1);
15
24
  }
16
25
 
@@ -19,6 +28,7 @@ const promptTemplate = readFileSync(
19
28
  'utf-8'
20
29
  );
21
30
 
31
+
22
32
  const prompt = promptTemplate.replace('$ARGUMENTS', userText);
23
33
 
24
34
  const client = new Anthropic();
@@ -30,4 +40,9 @@ const message = await client.messages.create({
30
40
  });
31
41
 
32
42
  const text = message.content.find(b => b.type === 'text')?.text ?? '';
33
- console.log(text);
43
+ if (outputFile) {
44
+ writeFileSync(outputFile, text, 'utf-8');
45
+ console.log(`Written to ${outputFile}`);
46
+ } else {
47
+ console.log(text);
48
+ }