vi-grid-builder 2.3.57 → 2.3.59
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** a JSON code block containing the `columns` array. No extra explanation unless something is ambiguous.
|
|
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.
|
|
4
|
+
"version": "2.3.59",
|
|
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": {
|
|
@@ -20,9 +22,14 @@
|
|
|
20
22
|
"dev": "vite",
|
|
21
23
|
"build": "vite build",
|
|
22
24
|
"preview": "vite preview",
|
|
23
|
-
"generate-web-types": "vue-docgen-web-types 'src/*.vue' --output web-types.json --vue-version 3"
|
|
25
|
+
"generate-web-types": "vue-docgen-web-types 'src/*.vue' --output web-types.json --vue-version 3",
|
|
26
|
+
"grid-config": "node --env-file=.env scripts/generate-grid-config.js"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"vi-gird-config": "scripts/generate-grid-config.js"
|
|
24
30
|
},
|
|
25
31
|
"dependencies": {
|
|
32
|
+
"@anthropic-ai/sdk": "^0.92.0",
|
|
26
33
|
"@fortawesome/fontawesome-svg-core": "^6.7.1",
|
|
27
34
|
"@fortawesome/free-regular-svg-icons": "^6.7.1",
|
|
28
35
|
"@fortawesome/free-solid-svg-icons": "^6.7.1",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
4
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname, resolve } from 'path';
|
|
7
|
+
try { process.loadEnvFile(process.cwd() + '/.env'); } catch {}
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
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();
|
|
20
|
+
|
|
21
|
+
if (!userText) {
|
|
22
|
+
console.error('Usage: vi-gird-config "describe your table here" [-o output.js]');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const promptTemplate = readFileSync(
|
|
27
|
+
resolve(__dirname, '../.claude/commands/grid-config.md'),
|
|
28
|
+
'utf-8'
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const prompt = promptTemplate.replace('$ARGUMENTS', userText);
|
|
33
|
+
|
|
34
|
+
const client = new Anthropic();
|
|
35
|
+
|
|
36
|
+
const message = await client.messages.create({
|
|
37
|
+
model: 'claude-opus-4-6',
|
|
38
|
+
max_tokens: 1024,
|
|
39
|
+
messages: [{ role: 'user', content: prompt }],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const text = message.content.find(b => b.type === 'text')?.text ?? '';
|
|
43
|
+
if (outputFile) {
|
|
44
|
+
writeFileSync(outputFile, text, 'utf-8');
|
|
45
|
+
console.log(`Written to ${outputFile}`);
|
|
46
|
+
} else {
|
|
47
|
+
console.log(text);
|
|
48
|
+
}
|