@aikdna/kdna-cli 0.19.0 → 0.19.2
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/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/cmds/registry.js +11 -5
- package/src/publish.js +9 -3
- package/src/search.js +4 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -203,7 +203,7 @@ switch (cmd) {
|
|
|
203
203
|
let output = null;
|
|
204
204
|
let target = null;
|
|
205
205
|
for (let i = 2; i < args.length; i++) {
|
|
206
|
-
if (args[i] === '--output' || args[i] === '-o') {
|
|
206
|
+
if (args[i] === '--output' || args[i] === '--out' || args[i] === '-o') {
|
|
207
207
|
output = args[i + 1];
|
|
208
208
|
i++;
|
|
209
209
|
} else if (args[i].startsWith('-')) {
|
package/src/cmds/registry.js
CHANGED
|
@@ -13,8 +13,10 @@ function cmdList(showAvailable, jsonMode = false, _locale = null) {
|
|
|
13
13
|
error('No registry found.');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const installableDomains = domains.filter((d) => d.yanked !== true);
|
|
17
|
+
|
|
16
18
|
if (jsonMode) {
|
|
17
|
-
const result =
|
|
19
|
+
const result = installableDomains.map((d) => ({
|
|
18
20
|
name: d.name || d.id || null,
|
|
19
21
|
version: d.version || null,
|
|
20
22
|
type: d.type || 'domain',
|
|
@@ -27,16 +29,20 @@ function cmdList(showAvailable, jsonMode = false, _locale = null) {
|
|
|
27
29
|
process.exit(EXIT.OK);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
console.log('Available KDNA domains:');
|
|
32
|
+
console.log('Available installable KDNA domains:');
|
|
31
33
|
console.log(`Registry: ${REGISTRY_CACHE}`);
|
|
32
34
|
console.log('');
|
|
33
|
-
|
|
35
|
+
if (!installableDomains.length) {
|
|
36
|
+
console.log(' No non-yanked registry entries are currently installable.');
|
|
37
|
+
console.log('');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
for (const d of installableDomains) {
|
|
34
41
|
const name = d.name || d.id || '?';
|
|
35
42
|
const installed = listInstalled().some((entry) => entry.full === name) ? '[installed]' : '';
|
|
36
|
-
const yanked = d.yanked ? '[yanked] ' : '';
|
|
37
43
|
const dep = d.deprecated ? '[deprecated] ' : '';
|
|
38
44
|
console.log(
|
|
39
|
-
` ${name.padEnd(36)} ${(d.version || '?').padEnd(8)} ${(d.type || 'domain').padEnd(8)} ${(d.status || '').padEnd(14)} ${
|
|
45
|
+
` ${name.padEnd(36)} ${(d.version || '?').padEnd(8)} ${(d.type || 'domain').padEnd(8)} ${(d.status || '').padEnd(14)} ${dep}${installed}`,
|
|
40
46
|
);
|
|
41
47
|
if (d.description) console.log(` ${d.description}`);
|
|
42
48
|
console.log('');
|
package/src/publish.js
CHANGED
|
@@ -697,6 +697,14 @@ function sha256File(p) {
|
|
|
697
697
|
return crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
+
function outputDirFromArgs(args, fallback) {
|
|
701
|
+
for (const flag of ['--output', '--out', '-o']) {
|
|
702
|
+
const idx = args.indexOf(flag);
|
|
703
|
+
if (idx >= 0) return args[idx + 1];
|
|
704
|
+
}
|
|
705
|
+
return fallback;
|
|
706
|
+
}
|
|
707
|
+
|
|
700
708
|
/**
|
|
701
709
|
* kdna publish <path> — Full publish pipeline.
|
|
702
710
|
*
|
|
@@ -781,9 +789,7 @@ function cmdPublish(domainPath, args = []) {
|
|
|
781
789
|
|
|
782
790
|
// 3. Pack
|
|
783
791
|
const fileName = `${m[2]}-${manifest.version}.kdna`;
|
|
784
|
-
const outDir = args.
|
|
785
|
-
? args[args.indexOf('--output') + 1]
|
|
786
|
-
: path.join(abs, 'dist');
|
|
792
|
+
const outDir = outputDirFromArgs(args, path.join(abs, 'dist'));
|
|
787
793
|
fs.mkdirSync(outDir, { recursive: true });
|
|
788
794
|
const outPath = path.join(outDir, fileName);
|
|
789
795
|
packToFile(abs, outPath);
|
package/src/search.js
CHANGED
|
@@ -36,14 +36,14 @@ function cmdSearch(query, json) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const resolver = new RegistryResolver({ allowNetwork: true });
|
|
39
|
-
const domains = resolver.listAllDomains() || [];
|
|
39
|
+
const domains = (resolver.listAllDomains() || []).filter((d) => d.yanked !== true);
|
|
40
40
|
|
|
41
41
|
if (!domains.length) {
|
|
42
42
|
if (json) {
|
|
43
43
|
console.log(JSON.stringify([]));
|
|
44
44
|
process.exit(EXIT.OK);
|
|
45
45
|
}
|
|
46
|
-
console.log('No registry entries found. Run: kdna registry refresh');
|
|
46
|
+
console.log('No installable registry entries found. Run: kdna registry refresh');
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -74,7 +74,7 @@ function cmdSearch(query, json) {
|
|
|
74
74
|
keywords: d.keywords || [],
|
|
75
75
|
domain_field: d.domain_field || [],
|
|
76
76
|
judgment_patterns: d.judgment_patterns || [],
|
|
77
|
-
yanked:
|
|
77
|
+
yanked: false,
|
|
78
78
|
deprecated: d.deprecated || false,
|
|
79
79
|
score,
|
|
80
80
|
}));
|
|
@@ -86,10 +86,9 @@ function cmdSearch(query, json) {
|
|
|
86
86
|
console.log('');
|
|
87
87
|
|
|
88
88
|
for (const { d, score } of matches) {
|
|
89
|
-
const yanked = d.yanked ? ' [yanked]' : '';
|
|
90
89
|
const dep = d.deprecated ? ' [deprecated]' : '';
|
|
91
90
|
console.log(
|
|
92
|
-
` ${(d.name || d.id || '?').padEnd(36)} v${d.version || '?'} ${(d.type || 'domain').padEnd(8)} score:${score}${
|
|
91
|
+
` ${(d.name || d.id || '?').padEnd(36)} v${d.version || '?'} ${(d.type || 'domain').padEnd(8)} score:${score}${dep}`,
|
|
93
92
|
);
|
|
94
93
|
if (d.description) console.log(` ${d.description}`);
|
|
95
94
|
if (d.core_insight) console.log(` » ${d.core_insight}`);
|