@aaronsb/kg-cli 0.6.6 → 0.7.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/dist/api/client.d.ts +127 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +147 -0
- package/dist/api/client.js.map +1 -1
- package/dist/cli/batch.d.ts +8 -0
- package/dist/cli/batch.d.ts.map +1 -0
- package/dist/cli/batch.js +225 -0
- package/dist/cli/batch.js.map +1 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +8 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/concept.d.ts +9 -0
- package/dist/cli/concept.d.ts.map +1 -0
- package/dist/cli/concept.js +336 -0
- package/dist/cli/concept.js.map +1 -0
- package/dist/cli/edge.d.ts +9 -0
- package/dist/cli/edge.d.ts.map +1 -0
- package/dist/cli/edge.js +364 -0
- package/dist/cli/edge.js.map +1 -0
- package/dist/cli/jobs.js +111 -3
- package/dist/cli/jobs.js.map +1 -1
- package/dist/cli/storage.d.ts +10 -0
- package/dist/cli/storage.d.ts.map +1 -0
- package/dist/cli/storage.js +260 -0
- package/dist/cli/storage.js.map +1 -0
- package/dist/cli/vocabulary/index.d.ts.map +1 -1
- package/dist/cli/vocabulary/index.js +1 -0
- package/dist/cli/vocabulary/index.js.map +1 -1
- package/dist/cli/vocabulary/similarity.d.ts +1 -0
- package/dist/cli/vocabulary/similarity.d.ts.map +1 -1
- package/dist/cli/vocabulary/similarity.js +60 -9
- package/dist/cli/vocabulary/similarity.js.map +1 -1
- package/dist/lib/interactive.d.ts +84 -0
- package/dist/lib/interactive.d.ts.map +1 -0
- package/dist/lib/interactive.js +296 -0
- package/dist/lib/interactive.js.map +1 -0
- package/dist/lib/validation.d.ts +106 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +354 -0
- package/dist/lib/validation.js.map +1 -0
- package/dist/mcp/formatters/concept.d.ts +24 -0
- package/dist/mcp/formatters/concept.d.ts.map +1 -0
- package/dist/mcp/formatters/concept.js +243 -0
- package/dist/mcp/formatters/concept.js.map +1 -0
- package/dist/mcp/formatters/document.d.ts +25 -0
- package/dist/mcp/formatters/document.d.ts.map +1 -0
- package/dist/mcp/formatters/document.js +178 -0
- package/dist/mcp/formatters/document.js.map +1 -0
- package/dist/mcp/formatters/epistemic.d.ts +16 -0
- package/dist/mcp/formatters/epistemic.d.ts.map +1 -0
- package/dist/mcp/formatters/epistemic.js +269 -0
- package/dist/mcp/formatters/epistemic.js.map +1 -0
- package/dist/mcp/formatters/graph.d.ts +63 -0
- package/dist/mcp/formatters/graph.d.ts.map +1 -0
- package/dist/mcp/formatters/graph.js +220 -0
- package/dist/mcp/formatters/graph.js.map +1 -0
- package/dist/mcp/formatters/index.d.ts +18 -0
- package/dist/mcp/formatters/index.d.ts.map +1 -0
- package/dist/mcp/formatters/index.js +63 -0
- package/dist/mcp/formatters/index.js.map +1 -0
- package/dist/mcp/formatters/ingest.d.ts +16 -0
- package/dist/mcp/formatters/ingest.d.ts.map +1 -0
- package/dist/mcp/formatters/ingest.js +169 -0
- package/dist/mcp/formatters/ingest.js.map +1 -0
- package/dist/mcp/formatters/job.d.ts +13 -0
- package/dist/mcp/formatters/job.d.ts.map +1 -0
- package/dist/mcp/formatters/job.js +204 -0
- package/dist/mcp/formatters/job.js.map +1 -0
- package/dist/mcp/formatters/source.d.ts +19 -0
- package/dist/mcp/formatters/source.d.ts.map +1 -0
- package/dist/mcp/formatters/source.js +182 -0
- package/dist/mcp/formatters/source.js.map +1 -0
- package/dist/mcp/formatters/system.d.ts +10 -0
- package/dist/mcp/formatters/system.d.ts.map +1 -0
- package/dist/mcp/formatters/system.js +152 -0
- package/dist/mcp/formatters/system.js.map +1 -0
- package/dist/mcp/formatters/utils.d.ts +17 -0
- package/dist/mcp/formatters/utils.d.ts.map +1 -0
- package/dist/mcp/formatters/utils.js +55 -0
- package/dist/mcp/formatters/utils.js.map +1 -0
- package/dist/mcp/graph-operations.d.ts +242 -0
- package/dist/mcp/graph-operations.d.ts.map +1 -0
- package/dist/mcp/graph-operations.js +532 -0
- package/dist/mcp/graph-operations.js.map +1 -0
- package/dist/mcp-server.js +460 -32
- package/dist/mcp-server.js.map +1 -1
- package/dist/types/index.d.ts +153 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +3 -3
- package/dist/version.js +3 -3
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/mcp/formatters.d.ts +0 -100
- package/dist/mcp/formatters.d.ts.map +0 -1
- package/dist/mcp/formatters.js +0 -1411
- package/dist/mcp/formatters.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Batch Operations Commands (ADR-089 Phase 1b)
|
|
4
|
+
*
|
|
5
|
+
* Import batch JSON files containing concepts and edges.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.batchCommand = void 0;
|
|
42
|
+
const commander_1 = require("commander");
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const client_1 = require("../api/client");
|
|
45
|
+
const colors = __importStar(require("./colors"));
|
|
46
|
+
const colors_1 = require("./colors");
|
|
47
|
+
const help_formatter_1 = require("./help-formatter");
|
|
48
|
+
const interactive_1 = require("../lib/interactive");
|
|
49
|
+
exports.batchCommand = (0, help_formatter_1.setCommandHelp)(new commander_1.Command('batch'), 'Batch graph operations', 'Batch operations for creating concepts and edges in a single transaction. Import JSON files that define concepts and their relationships. All operations are atomic - if any item fails, the entire batch is rolled back.')
|
|
50
|
+
.alias('b')
|
|
51
|
+
.showHelpAfterError('(add --help for additional information)')
|
|
52
|
+
.showSuggestionAfterError()
|
|
53
|
+
.addCommand(new commander_1.Command('create')
|
|
54
|
+
.description('Import a batch JSON file to create concepts and edges atomically. The JSON must contain ontology, concepts array, and optional edges array. All operations succeed or all are rolled back.')
|
|
55
|
+
.argument('<file>', 'Path to batch JSON file')
|
|
56
|
+
.option('--json', 'Output result as JSON')
|
|
57
|
+
.option('--dry-run', 'Validate without creating (not yet implemented)')
|
|
58
|
+
.action(async (file, options) => {
|
|
59
|
+
try {
|
|
60
|
+
// Read and parse the JSON file
|
|
61
|
+
if (!fs.existsSync(file)) {
|
|
62
|
+
console.error(colors.status.error(`✗ File not found: ${file}`));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
66
|
+
let request;
|
|
67
|
+
try {
|
|
68
|
+
request = JSON.parse(content);
|
|
69
|
+
}
|
|
70
|
+
catch (parseError) {
|
|
71
|
+
console.error(colors.status.error('✗ Invalid JSON file'));
|
|
72
|
+
console.error(colors.status.error(parseError.message));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
// Basic validation
|
|
76
|
+
if (!request.ontology) {
|
|
77
|
+
console.error(colors.status.error('✗ Missing required field: ontology'));
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
if ((!request.concepts || request.concepts.length === 0) &&
|
|
81
|
+
(!request.edges || request.edges.length === 0)) {
|
|
82
|
+
console.error(colors.status.error('✗ Batch must contain at least one concept or edge'));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
// Check for edge references to concepts not in the batch
|
|
86
|
+
if (request.edges && request.edges.length > 0 && request.concepts) {
|
|
87
|
+
const batchLabels = new Set(request.concepts.map((c) => c.label.toLowerCase()));
|
|
88
|
+
const unreferencedEdges = [];
|
|
89
|
+
for (const edge of request.edges) {
|
|
90
|
+
const fromInBatch = batchLabels.has(edge.from_label.toLowerCase());
|
|
91
|
+
const toInBatch = batchLabels.has(edge.to_label.toLowerCase());
|
|
92
|
+
if (!fromInBatch || !toInBatch) {
|
|
93
|
+
const missing = [];
|
|
94
|
+
if (!fromInBatch)
|
|
95
|
+
missing.push(`from: "${edge.from_label}"`);
|
|
96
|
+
if (!toInBatch)
|
|
97
|
+
missing.push(`to: "${edge.to_label}"`);
|
|
98
|
+
unreferencedEdges.push(` ${edge.from_label} -[${edge.relationship_type}]-> ${edge.to_label} (${missing.join(', ')} not in batch)`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (unreferencedEdges.length > 0 && !options.json) {
|
|
102
|
+
console.log(colors.status.warning('\n⚠️ Some edges reference concepts not in this batch file:'));
|
|
103
|
+
for (const edge of unreferencedEdges.slice(0, 5)) {
|
|
104
|
+
console.log(colors.status.dim(edge));
|
|
105
|
+
}
|
|
106
|
+
if (unreferencedEdges.length > 5) {
|
|
107
|
+
console.log(colors.status.dim(` ... and ${unreferencedEdges.length - 5} more`));
|
|
108
|
+
}
|
|
109
|
+
console.log(colors.status.dim(' These edges will resolve to existing concepts in the database, or fail if not found.\n'));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (options.dryRun) {
|
|
113
|
+
console.log(colors.status.warning('Dry-run mode not yet implemented by API.'));
|
|
114
|
+
console.log(colors.status.info('File validation passed:'));
|
|
115
|
+
console.log(` Ontology: ${request.ontology}`);
|
|
116
|
+
console.log(` Concepts: ${request.concepts?.length || 0}`);
|
|
117
|
+
console.log(` Edges: ${request.edges?.length || 0}`);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const client = (0, client_1.createClientFromEnv)();
|
|
121
|
+
if (!options.json) {
|
|
122
|
+
console.log();
|
|
123
|
+
console.log(colors.ui.title('📦 Batch Import'));
|
|
124
|
+
console.log((0, colors_1.separator)());
|
|
125
|
+
console.log(` ${colors.ui.key('File:')} ${file}`);
|
|
126
|
+
console.log(` ${colors.ui.key('Ontology:')} ${request.ontology}`);
|
|
127
|
+
console.log(` ${colors.ui.key('Concepts:')} ${request.concepts?.length || 0}`);
|
|
128
|
+
console.log(` ${colors.ui.key('Edges:')} ${request.edges?.length || 0}`);
|
|
129
|
+
console.log();
|
|
130
|
+
console.log(colors.status.dim('Creating...'));
|
|
131
|
+
}
|
|
132
|
+
const result = await client.batchCreate(request);
|
|
133
|
+
if (options.json) {
|
|
134
|
+
console.log(JSON.stringify(result, null, 2));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
console.log();
|
|
138
|
+
console.log((0, colors_1.separator)());
|
|
139
|
+
// Show results
|
|
140
|
+
if (result.errors.length > 0) {
|
|
141
|
+
console.log(colors.status.warning('⚠️ Completed with errors:'));
|
|
142
|
+
for (const error of result.errors) {
|
|
143
|
+
console.log(` ${colors.status.error('✗')} ${error}`);
|
|
144
|
+
}
|
|
145
|
+
console.log();
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
console.log(colors.status.success('✓ Batch import successful'));
|
|
149
|
+
}
|
|
150
|
+
console.log(` ${colors.ui.key('Concepts created:')} ${colors.status.success(result.concepts_created.toString())}`);
|
|
151
|
+
console.log(` ${colors.ui.key('Concepts matched:')} ${colors.status.info(result.concepts_matched.toString())}`);
|
|
152
|
+
console.log(` ${colors.ui.key('Edges created:')} ${colors.status.success(result.edges_created.toString())}`);
|
|
153
|
+
// Show individual results if verbose
|
|
154
|
+
if (result.concept_results.length > 0) {
|
|
155
|
+
console.log();
|
|
156
|
+
console.log(colors.ui.header('Concept Results:'));
|
|
157
|
+
for (const cr of result.concept_results) {
|
|
158
|
+
const statusIcon = cr.status === 'created' ? colors.status.success('✓') :
|
|
159
|
+
cr.status === 'matched' ? colors.status.info('≈') :
|
|
160
|
+
colors.status.error('✗');
|
|
161
|
+
const statusText = cr.status === 'created' ? 'created' :
|
|
162
|
+
cr.status === 'matched' ? 'matched existing' : 'error';
|
|
163
|
+
console.log(` ${statusIcon} ${colors.concept.label(cr.label)} - ${statusText}${cr.id ? ` (${cr.id})` : ''}`);
|
|
164
|
+
if (cr.error) {
|
|
165
|
+
console.log(` ${colors.status.error(cr.error)}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (result.edge_results.length > 0) {
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(colors.ui.header('Edge Results:'));
|
|
172
|
+
for (const er of result.edge_results) {
|
|
173
|
+
const statusIcon = er.status === 'created' ? colors.status.success('✓') :
|
|
174
|
+
er.status === 'error' ? colors.status.error('✗') : '?';
|
|
175
|
+
console.log(` ${statusIcon} ${er.label}`);
|
|
176
|
+
if (er.error) {
|
|
177
|
+
console.log(` ${colors.status.error(er.error)}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
console.log();
|
|
182
|
+
console.log((0, colors_1.separator)());
|
|
183
|
+
// Exit with error code if there were failures
|
|
184
|
+
if (result.errors.length > 0 && result.concepts_created === 0 && result.edges_created === 0) {
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
(0, interactive_1.handleCliError)(error, 'Batch import failed');
|
|
190
|
+
}
|
|
191
|
+
}))
|
|
192
|
+
.addCommand(new commander_1.Command('template')
|
|
193
|
+
.description('Output a template batch JSON file to stdout. Redirect to a file to customize.')
|
|
194
|
+
.option('--with-edges', 'Include example edges in template')
|
|
195
|
+
.action((options) => {
|
|
196
|
+
const template = {
|
|
197
|
+
ontology: 'my-ontology',
|
|
198
|
+
matching_mode: 'auto',
|
|
199
|
+
creation_method: 'import',
|
|
200
|
+
concepts: [
|
|
201
|
+
{
|
|
202
|
+
label: 'Example Concept A',
|
|
203
|
+
description: 'A brief description of concept A',
|
|
204
|
+
search_terms: ['alt term', 'synonym'],
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
label: 'Example Concept B',
|
|
208
|
+
description: 'A brief description of concept B',
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
};
|
|
212
|
+
if (options.withEdges) {
|
|
213
|
+
template.edges = [
|
|
214
|
+
{
|
|
215
|
+
from_label: 'Example Concept A',
|
|
216
|
+
to_label: 'Example Concept B',
|
|
217
|
+
relationship_type: 'IMPLIES',
|
|
218
|
+
category: 'logical_truth',
|
|
219
|
+
confidence: 0.9,
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
console.log(JSON.stringify(template, null, 2));
|
|
224
|
+
}));
|
|
225
|
+
//# sourceMappingURL=batch.js.map
|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,EAAE,eAAe;gBACzB,UAAU,EAAE,GAAG;aAChB;SACF,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6EpC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,iBAmEtD"}
|
package/dist/cli/commands.js
CHANGED
|
@@ -61,6 +61,10 @@ const document_1 = require("./document");
|
|
|
61
61
|
const artifact_1 = require("./artifact");
|
|
62
62
|
const group_1 = require("./group");
|
|
63
63
|
const query_def_1 = require("./query-def");
|
|
64
|
+
const concept_1 = require("./concept");
|
|
65
|
+
const edge_1 = require("./edge");
|
|
66
|
+
const batch_1 = require("./batch");
|
|
67
|
+
const storage_1 = require("./storage");
|
|
64
68
|
const login_1 = require("./login");
|
|
65
69
|
const logout_1 = require("./logout");
|
|
66
70
|
const oauth_1 = require("./oauth");
|
|
@@ -135,12 +139,16 @@ async function registerCommands(program) {
|
|
|
135
139
|
ontology_1.ontologyCommand,
|
|
136
140
|
source_1.sourceCommand,
|
|
137
141
|
vocabulary_1.vocabularyCommand,
|
|
142
|
+
concept_1.conceptCommand, // ADR-089: Concept CRUD
|
|
143
|
+
edge_1.edgeCommand, // ADR-089: Edge CRUD
|
|
144
|
+
batch_1.batchCommand, // ADR-089: Batch operations
|
|
138
145
|
admin_1.adminCommand,
|
|
139
146
|
polarity_1.polarityCommand,
|
|
140
147
|
projection_1.projectionCommand,
|
|
141
148
|
artifact_1.artifactCommand,
|
|
142
149
|
group_1.groupCommand,
|
|
143
150
|
query_def_1.queryDefCommand,
|
|
151
|
+
storage_1.storageCommand,
|
|
144
152
|
];
|
|
145
153
|
subcommands.forEach(cmd => {
|
|
146
154
|
(0, help_formatter_1.configureColoredHelp)(cmd);
|
package/dist/cli/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EH,4CAmEC;AA/ID,sEAAqC;AACrC,oDAA4B;AAC5B,iDAAmC;AACnC,qDAAwD;AACxD,qCAAyC;AACzC,iCAAqC;AACrC,qCAAyC;AACzC,qCAAyC;AACzC,yCAA6C;AAC7C,yCAA6C;AAC7C,qCAAyC;AACzC,mCAAuC;AACvC,6CAAiD;AACjD,6CAAgD;AAChD,yCAA6C;AAC7C,6CAAiD;AACjD,qCAAyC;AACzC,yCAA6C;AAC7C,yCAA6C;AAC7C,mCAAuC;AACvC,2CAA8C;AAC9C,uCAA2C;AAC3C,iCAAqC;AACrC,mCAAuC;AACvC,uCAA2C;AAC3C,mCAA+C;AAC/C,qCAAiD;AACjD,mCAA+C;AAC/C,+CAAiD;AACjD,iCAA2C;AAC3C,0CAAoD;AACpD,wCAA0C;AAC1C,0CAA0C;AAE1C;;GAEG;AACH,KAAK,UAAU,UAAU;IACvB,gBAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE;QAC5B,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAG,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I,wBAAwB;QAC1C,kBAAW,EAAO,qBAAqB;QACvC,oBAAY,EAAM,4BAA4B;QAC9C,oBAAY;QACZ,0BAAe;QACf,8BAAiB;QACjB,0BAAe;QACf,oBAAY;QACZ,2BAAe;QACf,wBAAc;KACf,CAAC;IAEF,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACxB,IAAA,qCAAoB,EAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;IAC9B,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;IAE/B,qDAAqD;IACrD,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;IAE9B,kEAAkE;IAClE,MAAM,YAAY,GAAG,IAAA,8BAAgB,EAAC,OAAO,CAAC,CAAC;IAC/C,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACzB,IAAA,qCAAoB,EAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,mDAAmD;IACnD,MAAM,WAAW,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAC/C,IAAA,qCAAoB,EAAC,WAAW,CAAC,CAAC;IAClC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concept CRUD Commands (ADR-089 Phase 2)
|
|
3
|
+
*
|
|
4
|
+
* Direct creation, listing, and management of concepts in the knowledge graph.
|
|
5
|
+
* Supports both non-interactive (flags) and interactive (-i) modes.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
export declare const conceptCommand: Command;
|
|
9
|
+
//# sourceMappingURL=concept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept.d.ts","sourceRoot":"","sources":["../../src/cli/concept.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,cAAc,SAWS,CAAC"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Concept CRUD Commands (ADR-089 Phase 2)
|
|
4
|
+
*
|
|
5
|
+
* Direct creation, listing, and management of concepts in the knowledge graph.
|
|
6
|
+
* Supports both non-interactive (flags) and interactive (-i) modes.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.conceptCommand = void 0;
|
|
43
|
+
const commander_1 = require("commander");
|
|
44
|
+
const client_1 = require("../api/client");
|
|
45
|
+
const colors = __importStar(require("./colors"));
|
|
46
|
+
const colors_1 = require("./colors");
|
|
47
|
+
const table_1 = require("../lib/table");
|
|
48
|
+
const help_formatter_1 = require("./help-formatter");
|
|
49
|
+
const interactive_1 = require("../lib/interactive");
|
|
50
|
+
exports.conceptCommand = (0, help_formatter_1.setCommandHelp)(new commander_1.Command('concept'), 'Manage concepts in the knowledge graph', 'Create, list, show, and delete concepts. Concepts are the fundamental nodes in the knowledge graph. When creating concepts, the description is embedded and similarity-matched against existing concepts (same as automatic ingestion). Use matching modes to control duplicate handling.')
|
|
51
|
+
.alias('c')
|
|
52
|
+
.showHelpAfterError('(add --help for additional information)')
|
|
53
|
+
.showSuggestionAfterError()
|
|
54
|
+
.addCommand(createListCommand())
|
|
55
|
+
.addCommand(createShowCommand())
|
|
56
|
+
.addCommand(createCreateCommand())
|
|
57
|
+
.addCommand(createDeleteCommand());
|
|
58
|
+
function createListCommand() {
|
|
59
|
+
return new commander_1.Command('list')
|
|
60
|
+
.description('List concepts with optional filters. Shows concept ID, label, ontology, and creation method.')
|
|
61
|
+
.option('--ontology <name>', 'Filter by ontology')
|
|
62
|
+
.option('--label <text>', 'Filter by label (contains)')
|
|
63
|
+
.option('--creation-method <method>', 'Filter by creation method (cli, mcp, api, llm_extraction, import)')
|
|
64
|
+
.option('--limit <n>', 'Maximum results (default: 50)', '50')
|
|
65
|
+
.option('--offset <n>', 'Pagination offset', '0')
|
|
66
|
+
.option('--json', 'Output as JSON')
|
|
67
|
+
.action(async (options) => {
|
|
68
|
+
try {
|
|
69
|
+
const client = (0, client_1.createClientFromEnv)();
|
|
70
|
+
const params = {
|
|
71
|
+
ontology: options.ontology,
|
|
72
|
+
label_contains: options.label,
|
|
73
|
+
creation_method: options.creationMethod,
|
|
74
|
+
limit: parseInt(options.limit, 10),
|
|
75
|
+
offset: parseInt(options.offset, 10),
|
|
76
|
+
};
|
|
77
|
+
const result = await client.listConceptsCRUD(params);
|
|
78
|
+
if (options.json) {
|
|
79
|
+
console.log(JSON.stringify(result, null, 2));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (result.concepts.length === 0) {
|
|
83
|
+
console.log(colors.status.warning('\nNo concepts found.'));
|
|
84
|
+
if (options.ontology) {
|
|
85
|
+
console.log(colors.status.dim(` Ontology filter: ${options.ontology}`));
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
console.log('\n' + colors.ui.title('📚 Concepts'));
|
|
90
|
+
console.log((0, colors_1.separator)());
|
|
91
|
+
console.log(colors.status.dim(`Showing ${result.concepts.length} of ${result.total} concepts\n`));
|
|
92
|
+
const table = new table_1.Table({
|
|
93
|
+
columns: [
|
|
94
|
+
{ header: 'ID', field: 'concept_id', type: 'concept_id', width: 15 },
|
|
95
|
+
{ header: 'Label', field: 'label', type: 'heading', width: 'flex', priority: 3 },
|
|
96
|
+
{ header: 'Ontology', field: (row) => row.ontology || '-', type: 'text', width: 20 },
|
|
97
|
+
{ header: 'Created By', field: (row) => row.creation_method || '-', type: 'text', width: 15 },
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
table.print(result.concepts);
|
|
101
|
+
if (result.total > result.concepts.length) {
|
|
102
|
+
console.log(colors.status.dim(`\nUse --offset ${result.offset + result.concepts.length} to see more`));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
(0, interactive_1.handleCliError)(error, 'Failed to list concepts');
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function createShowCommand() {
|
|
111
|
+
return new commander_1.Command('show')
|
|
112
|
+
.description('Show detailed information about a concept by ID.')
|
|
113
|
+
.argument('<id>', 'Concept ID (e.g., c_abc123)')
|
|
114
|
+
.option('--json', 'Output as JSON')
|
|
115
|
+
.action(async (id, options) => {
|
|
116
|
+
try {
|
|
117
|
+
const client = (0, client_1.createClientFromEnv)();
|
|
118
|
+
const concept = await client.getConceptById(id);
|
|
119
|
+
if (options.json) {
|
|
120
|
+
console.log(JSON.stringify(concept, null, 2));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
console.log('\n' + (0, colors_1.separator)());
|
|
124
|
+
console.log(colors.ui.title(`📖 Concept: ${concept.label}`));
|
|
125
|
+
console.log((0, colors_1.separator)());
|
|
126
|
+
console.log();
|
|
127
|
+
console.log(`${colors.ui.key('ID:')} ${colors.concept.id(concept.concept_id)}`);
|
|
128
|
+
console.log(`${colors.ui.key('Label:')} ${colors.concept.label(concept.label)}`);
|
|
129
|
+
if (concept.description) {
|
|
130
|
+
console.log(`${colors.ui.key('Description:')} ${concept.description}`);
|
|
131
|
+
}
|
|
132
|
+
if (concept.ontology) {
|
|
133
|
+
console.log(`${colors.ui.key('Ontology:')} ${concept.ontology}`);
|
|
134
|
+
}
|
|
135
|
+
console.log(`${colors.ui.key('Creation Method:')} ${concept.creation_method || 'unknown'}`);
|
|
136
|
+
console.log(`${colors.ui.key('Has Embedding:')} ${concept.has_embedding ? colors.status.success('Yes') : colors.status.warning('No')}`);
|
|
137
|
+
if (concept.search_terms && concept.search_terms.length > 0) {
|
|
138
|
+
console.log(`${colors.ui.key('Search Terms:')} ${concept.search_terms.join(', ')}`);
|
|
139
|
+
}
|
|
140
|
+
console.log('\n' + (0, colors_1.separator)());
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
(0, interactive_1.handleCliError)(error, 'Failed to get concept', {
|
|
144
|
+
notFoundMessage: `Concept not found: ${id}`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function createCreateCommand() {
|
|
150
|
+
return new commander_1.Command('create')
|
|
151
|
+
.description('Create a new concept. Description is embedded and similarity-matched against existing concepts.')
|
|
152
|
+
.option('--label <name>', 'Concept label (required)')
|
|
153
|
+
.option('--ontology <name>', 'Target ontology (required)')
|
|
154
|
+
.option('--description <text>', 'Concept description (used for embedding match)')
|
|
155
|
+
.option('--search-terms <terms>', 'Comma-separated search terms')
|
|
156
|
+
.option('--matching-mode <mode>', 'auto|force_create|match_only (default: auto)', 'auto')
|
|
157
|
+
.option('--json', 'Output as JSON')
|
|
158
|
+
.option('-i, --interactive', 'Guided wizard mode')
|
|
159
|
+
.option('-y, --yes', 'Skip confirmation prompts')
|
|
160
|
+
.action(async (options) => {
|
|
161
|
+
try {
|
|
162
|
+
const client = (0, client_1.createClientFromEnv)();
|
|
163
|
+
let label;
|
|
164
|
+
let ontology;
|
|
165
|
+
let description;
|
|
166
|
+
let searchTerms;
|
|
167
|
+
let matchingMode = options.matchingMode || 'auto';
|
|
168
|
+
if (options.interactive) {
|
|
169
|
+
// Interactive wizard mode
|
|
170
|
+
console.log('\n' + colors.ui.title('📝 Create New Concept'));
|
|
171
|
+
console.log((0, colors_1.separator)());
|
|
172
|
+
console.log();
|
|
173
|
+
// Get ontology
|
|
174
|
+
const ontologies = await client.listOntologies();
|
|
175
|
+
if (ontologies.ontologies.length === 0) {
|
|
176
|
+
console.log(colors.status.warning('No ontologies found. Create one first with kg ingest.'));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const ontologyResult = await (0, interactive_1.selectOption)('Select ontology:', ontologies.ontologies.map((o) => ({
|
|
180
|
+
label: o.ontology,
|
|
181
|
+
value: o.ontology,
|
|
182
|
+
description: `${o.concept_count} concepts, ${o.file_count} files`,
|
|
183
|
+
})));
|
|
184
|
+
if (ontologyResult.cancelled || !ontologyResult.selected) {
|
|
185
|
+
console.log(colors.status.dim('\nCancelled.'));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
ontology = ontologyResult.selected.value;
|
|
189
|
+
// Get label
|
|
190
|
+
const labelResult = await (0, interactive_1.textInput)('Label');
|
|
191
|
+
if (labelResult.cancelled || !labelResult.value) {
|
|
192
|
+
console.log(colors.status.dim('\nCancelled.'));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
label = labelResult.value;
|
|
196
|
+
// Get description
|
|
197
|
+
const descResult = await (0, interactive_1.textInput)('Description (optional, used for similarity matching)');
|
|
198
|
+
if (!descResult.cancelled && descResult.value) {
|
|
199
|
+
description = descResult.value;
|
|
200
|
+
}
|
|
201
|
+
// Get search terms
|
|
202
|
+
const termsResult = await (0, interactive_1.textInput)('Search terms (optional, comma-separated)');
|
|
203
|
+
if (!termsResult.cancelled && termsResult.value) {
|
|
204
|
+
searchTerms = termsResult.value.split(',').map((t) => t.trim()).filter(Boolean);
|
|
205
|
+
}
|
|
206
|
+
// Matching mode
|
|
207
|
+
const modeResult = await (0, interactive_1.selectOption)('Matching mode:', [
|
|
208
|
+
{ label: 'auto', value: 'auto', description: 'Match existing if similar, create if not (recommended)' },
|
|
209
|
+
{ label: 'force_create', value: 'force_create', description: 'Always create new, skip matching' },
|
|
210
|
+
{ label: 'match_only', value: 'match_only', description: 'Only link to existing, fail if no match' },
|
|
211
|
+
]);
|
|
212
|
+
if (modeResult.cancelled) {
|
|
213
|
+
console.log(colors.status.dim('\nCancelled.'));
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
matchingMode = modeResult.selected?.value || 'auto';
|
|
217
|
+
// Confirm
|
|
218
|
+
console.log('\n' + (0, colors_1.separator)());
|
|
219
|
+
console.log(colors.ui.header('Summary:'));
|
|
220
|
+
console.log(` ${colors.ui.key('Ontology:')} ${ontology}`);
|
|
221
|
+
console.log(` ${colors.ui.key('Label:')} ${label}`);
|
|
222
|
+
if (description)
|
|
223
|
+
console.log(` ${colors.ui.key('Description:')} ${description}`);
|
|
224
|
+
if (searchTerms?.length)
|
|
225
|
+
console.log(` ${colors.ui.key('Search Terms:')} ${searchTerms.join(', ')}`);
|
|
226
|
+
console.log(` ${colors.ui.key('Matching Mode:')} ${matchingMode}`);
|
|
227
|
+
console.log();
|
|
228
|
+
const confirmed = await (0, interactive_1.confirmYesNo)('Create this concept?', true);
|
|
229
|
+
if (!confirmed) {
|
|
230
|
+
console.log(colors.status.dim('\nCancelled.'));
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// Non-interactive mode - require flags
|
|
236
|
+
if (!options.label) {
|
|
237
|
+
console.error(colors.status.error('✗ Missing required option: --label'));
|
|
238
|
+
console.log(colors.status.dim('\nUse -i for interactive mode, or provide required options:'));
|
|
239
|
+
console.log(colors.status.dim(' kg concept create --label "My Concept" --ontology my-ontology'));
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
if (!options.ontology) {
|
|
243
|
+
console.error(colors.status.error('✗ Missing required option: --ontology'));
|
|
244
|
+
console.log(colors.status.dim('\nUse -i for interactive mode, or provide required options:'));
|
|
245
|
+
console.log(colors.status.dim(' kg concept create --label "My Concept" --ontology my-ontology'));
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
label = options.label;
|
|
249
|
+
ontology = options.ontology;
|
|
250
|
+
description = options.description;
|
|
251
|
+
searchTerms = options.searchTerms?.split(',').map((t) => t.trim()).filter(Boolean);
|
|
252
|
+
}
|
|
253
|
+
// Create the concept
|
|
254
|
+
const result = await (0, interactive_1.withSpinner)('Creating concept...', async () => {
|
|
255
|
+
return client.createConcept({
|
|
256
|
+
label,
|
|
257
|
+
ontology,
|
|
258
|
+
description,
|
|
259
|
+
search_terms: searchTerms,
|
|
260
|
+
matching_mode: matchingMode,
|
|
261
|
+
creation_method: 'cli',
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
if (options.json) {
|
|
265
|
+
console.log(JSON.stringify(result, null, 2));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
console.log();
|
|
269
|
+
if (result.matched_existing) {
|
|
270
|
+
console.log(colors.status.info(`≈ Matched existing concept: ${result.concept_id}`));
|
|
271
|
+
console.log(colors.status.dim(' (Use --matching-mode force_create to create new anyway)'));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
console.log(colors.status.success(`✓ Created concept: ${result.concept_id}`));
|
|
275
|
+
}
|
|
276
|
+
console.log(` ${colors.ui.key('Label:')} ${result.label}`);
|
|
277
|
+
console.log(` ${colors.ui.key('Has Embedding:')} ${result.has_embedding ? 'Yes' : 'No'}`);
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
(0, interactive_1.handleCliError)(error, 'Failed to create concept');
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function createDeleteCommand() {
|
|
285
|
+
return new commander_1.Command('delete')
|
|
286
|
+
.description('Delete a concept by ID. Requires --force flag or interactive confirmation.')
|
|
287
|
+
.argument('<id>', 'Concept ID to delete')
|
|
288
|
+
.option('--cascade', 'Also delete orphaned synthetic sources')
|
|
289
|
+
.option('-f, --force', 'Skip confirmation')
|
|
290
|
+
.option('--json', 'Output as JSON')
|
|
291
|
+
.action(async (id, options) => {
|
|
292
|
+
try {
|
|
293
|
+
const client = (0, client_1.createClientFromEnv)();
|
|
294
|
+
// First, get the concept to show what will be deleted
|
|
295
|
+
let concept;
|
|
296
|
+
try {
|
|
297
|
+
concept = await client.getConceptById(id);
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
(0, interactive_1.handleCliError)(error, 'Failed to get concept', {
|
|
301
|
+
notFoundMessage: `Concept not found: ${id}`,
|
|
302
|
+
});
|
|
303
|
+
return; // handleCliError exits, but TypeScript needs this
|
|
304
|
+
}
|
|
305
|
+
if (!options.force) {
|
|
306
|
+
console.log('\n' + (0, colors_1.separator)());
|
|
307
|
+
console.log(colors.status.warning('⚠️ Delete Concept'));
|
|
308
|
+
console.log((0, colors_1.separator)());
|
|
309
|
+
console.log();
|
|
310
|
+
console.log(` ${colors.ui.key('ID:')} ${concept.concept_id}`);
|
|
311
|
+
console.log(` ${colors.ui.key('Label:')} ${concept.label}`);
|
|
312
|
+
if (concept.ontology) {
|
|
313
|
+
console.log(` ${colors.ui.key('Ontology:')} ${concept.ontology}`);
|
|
314
|
+
}
|
|
315
|
+
console.log();
|
|
316
|
+
console.log(colors.status.warning('This action cannot be undone.'));
|
|
317
|
+
console.log();
|
|
318
|
+
const confirmed = await (0, interactive_1.confirmYesNo)('Delete this concept?', false);
|
|
319
|
+
if (!confirmed) {
|
|
320
|
+
console.log(colors.status.dim('\nCancelled.'));
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
await client.deleteConcept(id, options.cascade);
|
|
325
|
+
if (options.json) {
|
|
326
|
+
console.log(JSON.stringify({ deleted: true, concept_id: id }));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
console.log(colors.status.success(`\n✓ Deleted concept: ${id}`));
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
(0, interactive_1.handleCliError)(error, 'Failed to delete concept');
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=concept.js.map
|