@hasna/knowledge 0.2.20 → 0.2.22
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 +38 -0
- package/bin/open-knowledge-mcp.js +927 -24
- package/bin/open-knowledge.js +153 -71
- package/docs/architecture/ai-native-knowledge-base.md +16 -0
- package/package.json +1 -1
- package/src/auth.ts +123 -0
- package/src/cli.ts +153 -10
- package/src/remote-client.ts +268 -0
- package/src/service.ts +142 -0
- package/src/storage-contract.ts +28 -0
- package/src/wiki-compiler.ts +711 -0
- package/src/workspace.ts +11 -0
package/src/workspace.ts
CHANGED
|
@@ -22,6 +22,9 @@ export interface KnowledgeWorkspace {
|
|
|
22
22
|
export interface KnowledgeConfig {
|
|
23
23
|
version: 1;
|
|
24
24
|
mode: 'local' | 'hosted';
|
|
25
|
+
hosted?: {
|
|
26
|
+
api_url?: string;
|
|
27
|
+
};
|
|
25
28
|
storage: {
|
|
26
29
|
type: 'local' | 's3';
|
|
27
30
|
artifacts_root: string;
|
|
@@ -112,6 +115,9 @@ export function defaultKnowledgeConfig(): KnowledgeConfig {
|
|
|
112
115
|
return {
|
|
113
116
|
version: 1,
|
|
114
117
|
mode: 'local',
|
|
118
|
+
hosted: {
|
|
119
|
+
api_url: 'https://knowledge.hasna.xyz',
|
|
120
|
+
},
|
|
115
121
|
storage: {
|
|
116
122
|
type: 'local',
|
|
117
123
|
artifacts_root: 'artifacts',
|
|
@@ -200,3 +206,8 @@ export function readKnowledgeConfig(path: string): KnowledgeConfig {
|
|
|
200
206
|
const raw = readFileSync(path, 'utf8');
|
|
201
207
|
return JSON.parse(raw) as KnowledgeConfig;
|
|
202
208
|
}
|
|
209
|
+
|
|
210
|
+
export function writeKnowledgeConfig(path: string, config: KnowledgeConfig): void {
|
|
211
|
+
ensureParentDir(path);
|
|
212
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`);
|
|
213
|
+
}
|