cascivo 0.4.2 → 0.5.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 +4 -1
- package/dist/config-CYlTGdmE.mjs +171 -0
- package/dist/config-CYlTGdmE.mjs.map +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +312 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/readme.body.md +3 -0
- package/dist/config-BsyJbMvD.mjs +0 -106
- package/dist/config-BsyJbMvD.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cascivo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI — npx cascivo init / add / list / update",
|
|
6
6
|
"keywords": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"provenance": true
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@cascivo/registry": "^0.
|
|
45
|
+
"@cascivo/registry": "^0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^25",
|
package/readme.body.md
CHANGED
|
@@ -44,6 +44,9 @@ npx shadcn@latest add https://cascivo.com/r/shadcn/button.json
|
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Every item inlines its source and resolves its cascivo dependencies transitively.
|
|
47
|
+
Page **blocks** are in the shadcn registry too, under a `block-` slug — install
|
|
48
|
+
`block/dashboard-overview` as `https://cascivo.com/r/shadcn/block-dashboard-overview.json`
|
|
49
|
+
(the `cascivo` binary addresses the same block as `npx cascivo add block/dashboard-overview`).
|
|
47
50
|
|
|
48
51
|
Building **with an AI assistant?** cascivo has no training-data footprint yet, so
|
|
49
52
|
give the tool the knowledge directly rather than relying on it to browse the site:
|
package/dist/config-BsyJbMvD.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { pathToFileURL } from "node:url";
|
|
3
|
-
import { existsSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
//#region \0rolldown/runtime.js
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __exportAll = (all, no_symbols) => {
|
|
8
|
-
let target = {};
|
|
9
|
-
for (var name in all) __defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true
|
|
12
|
-
});
|
|
13
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/utils/config.ts
|
|
18
|
-
var config_exports = /* @__PURE__ */ __exportAll({
|
|
19
|
-
CASCIVO_HOST: () => CASCIVO_HOST,
|
|
20
|
-
DEFAULT_CONFIG: () => DEFAULT_CONFIG,
|
|
21
|
-
THEMES: () => THEMES,
|
|
22
|
-
applyEnvOverrides: () => applyEnvOverrides,
|
|
23
|
-
detectPackageManager: () => detectPackageManager,
|
|
24
|
-
installCommand: () => installCommand,
|
|
25
|
-
loadConfig: () => loadConfig,
|
|
26
|
-
resolveConfig: () => resolveConfig
|
|
27
|
-
});
|
|
28
|
-
/**
|
|
29
|
-
* Canonical host for hosted cascivo artifacts (registry.json, per-item
|
|
30
|
-
* r/<name>.json, marketplace.json). docs.cascivo.com mirrors the same tree.
|
|
31
|
-
* Keep in sync with CASCIVO_HOST in packages/mcp.
|
|
32
|
-
*/
|
|
33
|
-
const CASCIVO_HOST = "https://cascivo.com";
|
|
34
|
-
/** All first-party themes shipped by @cascivo/themes (selectable via data-theme). */
|
|
35
|
-
const THEMES = [
|
|
36
|
-
"light",
|
|
37
|
-
"dark",
|
|
38
|
-
"warm",
|
|
39
|
-
"flat",
|
|
40
|
-
"minimal",
|
|
41
|
-
"midnight",
|
|
42
|
-
"pastel",
|
|
43
|
-
"brutalist",
|
|
44
|
-
"corporate",
|
|
45
|
-
"terminal",
|
|
46
|
-
"cyberpunk",
|
|
47
|
-
"arcade"
|
|
48
|
-
];
|
|
49
|
-
const DEFAULT_CONFIG = {
|
|
50
|
-
registry: `${CASCIVO_HOST}/registry.json`,
|
|
51
|
-
outputDir: "src/components/ui",
|
|
52
|
-
theme: "light"
|
|
53
|
-
};
|
|
54
|
-
const CONFIG_FILES = [
|
|
55
|
-
"cascivo.config.ts",
|
|
56
|
-
"cascivo.config.js",
|
|
57
|
-
"cascivo.config.mjs"
|
|
58
|
-
];
|
|
59
|
-
/** Apply defaults over a (possibly partial) user config object. */
|
|
60
|
-
function resolveConfig(partial) {
|
|
61
|
-
return {
|
|
62
|
-
...DEFAULT_CONFIG,
|
|
63
|
-
...partial
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/** Let env vars override config — used by the MCP server to pass `outputDir`. */
|
|
67
|
-
function applyEnvOverrides(config, env = process.env) {
|
|
68
|
-
return {
|
|
69
|
-
...config,
|
|
70
|
-
...env.CASCIVO_REGISTRY ? { registry: env.CASCIVO_REGISTRY } : {},
|
|
71
|
-
...env.CASCIVO_OUTPUT_DIR ? { outputDir: env.CASCIVO_OUTPUT_DIR } : {}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Locate and load `cascivo.config.{ts,js,mjs}` from `cwd`. Falls back to the
|
|
76
|
-
* default config when no file is found or the file cannot be loaded. Env vars
|
|
77
|
-
* (`CASCIVO_REGISTRY`, `CASCIVO_OUTPUT_DIR`) take precedence.
|
|
78
|
-
*/
|
|
79
|
-
async function loadConfig(cwd = process.cwd()) {
|
|
80
|
-
for (const file of CONFIG_FILES) {
|
|
81
|
-
const path = join(cwd, file);
|
|
82
|
-
if (!existsSync(path)) continue;
|
|
83
|
-
try {
|
|
84
|
-
const mod = await import(pathToFileURL(path).href);
|
|
85
|
-
return applyEnvOverrides(resolveConfig(mod.default ?? mod));
|
|
86
|
-
} catch {
|
|
87
|
-
return applyEnvOverrides(resolveConfig(null));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return applyEnvOverrides(resolveConfig(null));
|
|
91
|
-
}
|
|
92
|
-
/** Detect the package manager in use from lock files, defaulting to npm. */
|
|
93
|
-
function detectPackageManager(cwd = process.cwd()) {
|
|
94
|
-
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
95
|
-
if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
|
|
96
|
-
if (existsSync(join(cwd, "bun.lockb"))) return "bun";
|
|
97
|
-
return "npm";
|
|
98
|
-
}
|
|
99
|
-
/** The install subcommand each package manager uses to add dependencies. */
|
|
100
|
-
function installCommand(pm, packages) {
|
|
101
|
-
return [pm, [pm === "npm" ? "install" : "add", ...packages]];
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { detectPackageManager as a, __exportAll as c, config_exports as i, DEFAULT_CONFIG as n, installCommand as o, THEMES as r, loadConfig as s, CASCIVO_HOST as t };
|
|
105
|
-
|
|
106
|
-
//# sourceMappingURL=config-BsyJbMvD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-BsyJbMvD.mjs","names":[],"sources":["../src/utils/config.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { pathToFileURL } from 'node:url'\n\n/**\n * Canonical host for hosted cascivo artifacts (registry.json, per-item\n * r/<name>.json, marketplace.json). docs.cascivo.com mirrors the same tree.\n * Keep in sync with CASCIVO_HOST in packages/mcp.\n */\nexport const CASCIVO_HOST = 'https://cascivo.com'\n\n/** All first-party themes shipped by @cascivo/themes (selectable via data-theme). */\nexport const THEMES = [\n 'light',\n 'dark',\n 'warm',\n 'flat',\n 'minimal',\n 'midnight',\n 'pastel',\n 'brutalist',\n 'corporate',\n 'terminal',\n 'cyberpunk',\n 'arcade',\n] as const\n\nexport type ThemeName = (typeof THEMES)[number]\n\nexport type RegistryNamespaceConfig =\n | string\n | { url: string; headers?: Record<string, string>; params?: Record<string, string> }\n\nexport interface CascadeConfig {\n /** URL of the registry.json index. */\n registry: string\n /** Directory (relative to project root) where components are written. */\n outputDir: string\n /** Default theme imported by `cascade init`. */\n theme: ThemeName\n /** Namespace → registry URL template (with {name} placeholder) or auth config. */\n registries?: Record<string, RegistryNamespaceConfig>\n /** Whether to copy test files (*.contract.test.tsx) when adding components. */\n tests?: boolean\n}\n\nexport const DEFAULT_CONFIG: CascadeConfig = {\n // Canonical hosted registry index (served from the landing site, documented in\n // llms.txt). Prefer this over a branch's GitHub raw URL, which 404s for\n // unauthenticated/private-repo requests and breaks `cascivo list`/`add`.\n registry: `${CASCIVO_HOST}/registry.json`,\n outputDir: 'src/components/ui',\n theme: 'light',\n}\n\nconst CONFIG_FILES = ['cascivo.config.ts', 'cascivo.config.js', 'cascivo.config.mjs']\n\n/** Apply defaults over a (possibly partial) user config object. */\nexport function resolveConfig(partial: Partial<CascadeConfig> | null | undefined): CascadeConfig {\n return { ...DEFAULT_CONFIG, ...partial }\n}\n\n/** Let env vars override config — used by the MCP server to pass `outputDir`. */\nexport function applyEnvOverrides(\n config: CascadeConfig,\n env: NodeJS.ProcessEnv = process.env,\n): CascadeConfig {\n return {\n ...config,\n ...(env.CASCIVO_REGISTRY ? { registry: env.CASCIVO_REGISTRY } : {}),\n ...(env.CASCIVO_OUTPUT_DIR ? { outputDir: env.CASCIVO_OUTPUT_DIR } : {}),\n }\n}\n\n/**\n * Locate and load `cascivo.config.{ts,js,mjs}` from `cwd`. Falls back to the\n * default config when no file is found or the file cannot be loaded. Env vars\n * (`CASCIVO_REGISTRY`, `CASCIVO_OUTPUT_DIR`) take precedence.\n */\nexport async function loadConfig(cwd: string = process.cwd()): Promise<CascadeConfig> {\n for (const file of CONFIG_FILES) {\n const path = join(cwd, file)\n if (!existsSync(path)) continue\n try {\n const mod = (await import(pathToFileURL(path).href)) as {\n default?: Partial<CascadeConfig>\n }\n return applyEnvOverrides(resolveConfig(mod.default ?? (mod as Partial<CascadeConfig>)))\n } catch {\n // Unloadable config (e.g. unsupported TS syntax) — fall back to defaults.\n return applyEnvOverrides(resolveConfig(null))\n }\n }\n return applyEnvOverrides(resolveConfig(null))\n}\n\nexport type PackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun'\n\n/** Detect the package manager in use from lock files, defaulting to npm. */\nexport function detectPackageManager(cwd: string = process.cwd()): PackageManager {\n if (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n if (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n if (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n return 'npm'\n}\n\n/** The install subcommand each package manager uses to add dependencies. */\nexport function installCommand(pm: PackageManager, packages: string[]): [string, string[]] {\n const verb = pm === 'npm' ? 'install' : 'add'\n return [pm, [verb, ...packages]]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,eAAe;;AAG5B,MAAa,SAAS;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAqBA,MAAa,iBAAgC;CAI3C,UAAU,GAAG,aAAa;CAC1B,WAAW;CACX,OAAO;AACT;AAEA,MAAM,eAAe;CAAC;CAAqB;CAAqB;AAAoB;;AAGpF,SAAgB,cAAc,SAAmE;CAC/F,OAAO;EAAE,GAAG;EAAgB,GAAG;CAAQ;AACzC;;AAGA,SAAgB,kBACd,QACA,MAAyB,QAAQ,KAClB;CACf,OAAO;EACL,GAAG;EACH,GAAI,IAAI,mBAAmB,EAAE,UAAU,IAAI,iBAAiB,IAAI,CAAC;EACjE,GAAI,IAAI,qBAAqB,EAAE,WAAW,IAAI,mBAAmB,IAAI,CAAC;CACxE;AACF;;;;;;AAOA,eAAsB,WAAW,MAAc,QAAQ,IAAI,GAA2B;CACpF,KAAK,MAAM,QAAQ,cAAc;EAC/B,MAAM,OAAO,KAAK,KAAK,IAAI;EAC3B,IAAI,CAAC,WAAW,IAAI,GAAG;EACvB,IAAI;GACF,MAAM,MAAO,MAAM,OAAO,cAAc,IAAI,CAAC,CAAC;GAG9C,OAAO,kBAAkB,cAAc,IAAI,WAAY,GAA8B,CAAC;EACxF,QAAQ;GAEN,OAAO,kBAAkB,cAAc,IAAI,CAAC;EAC9C;CACF;CACA,OAAO,kBAAkB,cAAc,IAAI,CAAC;AAC9C;;AAKA,SAAgB,qBAAqB,MAAc,QAAQ,IAAI,GAAmB;CAChF,IAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,GAAG,OAAO;CACpD,IAAI,WAAW,KAAK,KAAK,WAAW,CAAC,GAAG,OAAO;CAC/C,IAAI,WAAW,KAAK,KAAK,WAAW,CAAC,GAAG,OAAO;CAC/C,OAAO;AACT;;AAGA,SAAgB,eAAe,IAAoB,UAAwC;CAEzF,OAAO,CAAC,IAAI,CADC,OAAO,QAAQ,YAAY,OACrB,GAAG,QAAQ,CAAC;AACjC"}
|