vizcn 0.1.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.
- package/README.md +25 -0
- package/bin.mjs +59 -0
- package/package.json +14 -0
- package/shelf.json +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# vizcn
|
|
2
|
+
|
|
3
|
+
Agent-first SVG viz registry. **This package is a pointer CLI** — the
|
|
4
|
+
registry itself lives at [vibecoding.tech/vizcn](https://vibecoding.tech/vizcn):
|
|
5
|
+
copy-paste React + inline-SVG forms (no chart libraries) that an AI coding
|
|
6
|
+
agent picks from a catalog by the question the data answers.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx vizcn # list the forms
|
|
10
|
+
npx vizcn add <name> # install one (wraps shadcn add)
|
|
11
|
+
npx vizcn prompt # print a ready-made prompt for your coding agent
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Equivalent direct install (any shadcn-initialized project):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx shadcn@latest add https://vibecoding.tech/vizcn/r/<name>.json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Machine-readable catalog with per-form `question` / `whenToUse` / `antiUse`:
|
|
21
|
+
[catalog.json](https://vibecoding.tech/vizcn/catalog.json) ·
|
|
22
|
+
Repo: [github.com/eugeneshilow/vizcn](https://github.com/eugeneshilow/vizcn)
|
|
23
|
+
|
|
24
|
+
Not affiliated with shadcn — an independent registry following the shadcn
|
|
25
|
+
registry spec.
|
package/bin.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// vizcn pointer CLI. The registry itself lives on the shelf (shelf.json is
|
|
3
|
+
// generated from registry.config.json — the single home of all URLs).
|
|
4
|
+
import { readFileSync } from 'node:fs'
|
|
5
|
+
import { spawnSync } from 'node:child_process'
|
|
6
|
+
|
|
7
|
+
const { shelfUrl, registryBase } = JSON.parse(
|
|
8
|
+
readFileSync(new URL('./shelf.json', import.meta.url), 'utf8'),
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
const PROMPT = `Add a data visualization to this project from the vizcn registry:
|
|
12
|
+
|
|
13
|
+
1. Fetch ${shelfUrl}/catalog.json — every form declares the
|
|
14
|
+
question it answers, whenToUse, and antiUse.
|
|
15
|
+
2. Pick the form whose question matches what my data needs to answer.
|
|
16
|
+
Respect antiUse. If no form fits, stop and ask — never invent a chart.
|
|
17
|
+
3. Install: npx shadcn@latest add ${registryBase}/<name>.json
|
|
18
|
+
(no shadcn in the project? run \`npx shadcn@latest init -d\` once,
|
|
19
|
+
or copy the form file from the repo).
|
|
20
|
+
4. Feed my real data via props — the demo data is fictional reference.`
|
|
21
|
+
|
|
22
|
+
async function list() {
|
|
23
|
+
try {
|
|
24
|
+
const res = await fetch(`${shelfUrl}/catalog.json`)
|
|
25
|
+
const { forms } = await res.json()
|
|
26
|
+
console.log(`vizcn — agent-first SVG viz registry · ${forms.length} forms\n`)
|
|
27
|
+
const pad = Math.max(...forms.map((f) => f.name.length)) + 2
|
|
28
|
+
for (const f of forms) console.log(` ${f.name.padEnd(pad)}${f.question}`)
|
|
29
|
+
console.log(`
|
|
30
|
+
install npx vizcn add <name>
|
|
31
|
+
npx shadcn@latest add ${registryBase}/<name>.json
|
|
32
|
+
agents npx vizcn prompt (paste the output into your coding agent)
|
|
33
|
+
shelf ${shelfUrl}`)
|
|
34
|
+
} catch {
|
|
35
|
+
console.log(`vizcn — agent-first SVG viz registry`)
|
|
36
|
+
console.log(`shelf: ${shelfUrl}`)
|
|
37
|
+
console.log(`catalog: ${shelfUrl}/catalog.json (couldn't fetch it right now)`)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const [cmd, ...args] = process.argv.slice(2)
|
|
42
|
+
|
|
43
|
+
if (cmd === 'add' && args.length > 0) {
|
|
44
|
+
for (const name of args) {
|
|
45
|
+
const item = `${registryBase}/${name.replace(/\.json$/, '')}.json`
|
|
46
|
+
const r = spawnSync('npx', ['shadcn@latest', 'add', item], {
|
|
47
|
+
stdio: 'inherit',
|
|
48
|
+
shell: process.platform === 'win32',
|
|
49
|
+
})
|
|
50
|
+
if (r.status) process.exit(r.status)
|
|
51
|
+
}
|
|
52
|
+
} else if (cmd === 'prompt') {
|
|
53
|
+
console.log(PROMPT)
|
|
54
|
+
} else if (cmd === 'add') {
|
|
55
|
+
console.error('usage: npx vizcn add <form-name> — see `npx vizcn` for the list')
|
|
56
|
+
process.exit(1)
|
|
57
|
+
} else {
|
|
58
|
+
await list()
|
|
59
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vizcn",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent-first SVG viz registry — pointer CLI. The registry lives at https://vibecoding.tech/vizcn: copy-paste forms an AI coding agent picks from a catalog by the question the data answers.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": { "vizcn": "./bin.mjs" },
|
|
8
|
+
"files": ["bin.mjs", "shelf.json", "README.md"],
|
|
9
|
+
"engines": { "node": ">=18" },
|
|
10
|
+
"repository": "github:eugeneshilow/vizcn",
|
|
11
|
+
"homepage": "https://vibecoding.tech/vizcn",
|
|
12
|
+
"author": "Evgeny Shilov (https://github.com/eugeneshilow)",
|
|
13
|
+
"keywords": ["shadcn", "registry", "svg", "dataviz", "charts", "agent", "ai", "vizcn"]
|
|
14
|
+
}
|
package/shelf.json
ADDED