@decantr/cli 1.0.0-beta.2 → 1.0.0-beta.4
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/LICENSE +21 -0
- package/dist/index.js +32 -12
- package/package.json +9 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Decantr AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -58,8 +58,20 @@ async function cmdGet(type, id) {
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const resolver = getResolver();
|
|
61
|
-
|
|
61
|
+
let result = await resolver.resolve(type, id);
|
|
62
62
|
if (!result) {
|
|
63
|
+
const apiType = type === "blueprint" ? "blueprints" : `${type}s`;
|
|
64
|
+
try {
|
|
65
|
+
const res = await fetch(`https://decantr-registry.fly.dev/v1/${apiType}/${id}`);
|
|
66
|
+
if (res.ok) {
|
|
67
|
+
const item = await res.json();
|
|
68
|
+
if (!item.error) {
|
|
69
|
+
console.log(JSON.stringify(item, null, 2));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
63
75
|
console.error(error(`${type} "${id}" not found.`));
|
|
64
76
|
process.exitCode = 1;
|
|
65
77
|
return;
|
|
@@ -117,25 +129,33 @@ async function cmdList(type) {
|
|
|
117
129
|
}
|
|
118
130
|
const { readdirSync } = await import("fs");
|
|
119
131
|
const dir = join(getContentRoot(), type);
|
|
132
|
+
let found = false;
|
|
120
133
|
try {
|
|
121
134
|
const files = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
if (files.length > 0) {
|
|
136
|
+
found = true;
|
|
137
|
+
console.log(heading(`${files.length} ${type}`));
|
|
138
|
+
for (const f of files) {
|
|
139
|
+
const data = JSON.parse(readFileSync(join(dir, f), "utf-8"));
|
|
140
|
+
console.log(` ${cyan(data.id || f.replace(".json", ""))} ${dim(data.description || data.name || "")}`);
|
|
141
|
+
}
|
|
126
142
|
}
|
|
127
143
|
} catch {
|
|
128
|
-
|
|
144
|
+
}
|
|
145
|
+
if (!found) {
|
|
129
146
|
try {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
const res = await fetch(`https://decantr-registry.fly.dev/v1/${type}`);
|
|
148
|
+
if (res.ok) {
|
|
149
|
+
const data = await res.json();
|
|
150
|
+
console.log(heading(`${data.total} ${type}`));
|
|
151
|
+
for (const item of data.items) {
|
|
152
|
+
console.log(` ${cyan(item.id)} ${dim(item.description || item.name || "")}`);
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
135
155
|
}
|
|
136
156
|
} catch {
|
|
137
|
-
console.log(dim(`No ${type} found.`));
|
|
138
157
|
}
|
|
158
|
+
console.log(dim(`No ${type} found.`));
|
|
139
159
|
}
|
|
140
160
|
}
|
|
141
161
|
function cmdHelp() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decantr/cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Decantr CLI — search the registry, validate essence files, and access design intelligence from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,17 +14,19 @@
|
|
|
14
14
|
"decantr": "./dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"main": "dist/index.js",
|
|
17
|
-
"files": [
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
18
20
|
"publishConfig": {
|
|
19
21
|
"access": "public"
|
|
20
22
|
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@decantr/essence-spec": "1.0.0-beta.3",
|
|
25
|
+
"@decantr/registry": "1.0.0-beta.3"
|
|
26
|
+
},
|
|
21
27
|
"scripts": {
|
|
22
28
|
"build": "tsup",
|
|
23
29
|
"test": "vitest run",
|
|
24
30
|
"test:watch": "vitest"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@decantr/essence-spec": "workspace:*",
|
|
28
|
-
"@decantr/registry": "workspace:*"
|
|
29
31
|
}
|
|
30
|
-
}
|
|
32
|
+
}
|