Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Model Context Protocol server for AI assistant integration:

#### Portable Package Format (`semanticwiki pack/unpack`)
Bundle wikis with RAG indexes for sharing:
- `.archiwiki` compressed format with manifest
- `.semantics` compressed format with manifest
- Includes wiki content + embeddings + BM25 index
- Extract wiki-only or full package

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ Create portable wiki packages for sharing:

```bash
# Create package (includes wiki + RAG index)
semanticwiki pack -w ./wiki -o ./my-wiki.archiwiki
semanticwiki pack -w ./wiki -o ./my-wiki.semantics

# Extract package
semanticwiki unpack -p ./my-wiki.archiwiki -o ./extracted
semanticwiki unpack -p ./my-wiki.semantics -o ./extracted

# Extract wiki only (no RAG index)
semanticwiki unpack -p ./my-wiki.archiwiki -o ./extracted --wiki-only
semanticwiki unpack -p ./my-wiki.semantics -o ./extracted --wiki-only
```

### Large Codebase Options
Expand Down Expand Up @@ -287,7 +287,7 @@ semanticwiki generate -r ./my-project --max-turns 50
| Option | Description | Default |
|--------|-------------|---------|
| `-w, --wiki <dir>` | Wiki directory (required) | - |
| `-o, --output <file>` | Output package path | `<name>.archiwiki` |
| `-o, --output <file>` | Output package path | `<name>.semantics` |
| `-n, --name <name>` | Package name | wiki folder name |
| `--no-rag` | Exclude RAG index | - |

Expand Down
28 changes: 20 additions & 8 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ program
.option('--gpu-layers <n>', 'Number of GPU layers to offload (default: auto)', parseInt)
.option('--context-size <n>', 'Context window size for local models (default: 32768)', parseInt)
.option('--threads <n>', 'CPU threads for local inference (default: auto)', parseInt)
// Contextual retrieval options
.option('--contextual', 'Enable contextual retrieval for better chunk understanding (uses Claude API)')
.option('--contextual-local', 'Use local LLM for contextual retrieval instead of Claude API')
.option('--contextual-model <model>', 'Claude model for contextual retrieval (default: claude-3-haiku-20240307)')
.option('--contextual-ollama-model <model>', 'Ollama model for local contextual retrieval (default: qwen2.5-coder:7b)')
.action(async (options) => {
try {
const configManager = new ConfigManager();
Expand Down Expand Up @@ -304,7 +309,14 @@ program
ollamaHost: options.ollamaHost,
gpuLayers: options.gpuLayers,
contextSize: options.contextSize,
threads: options.threads
threads: options.threads,
// Contextual retrieval options
useContextualRetrieval: options.contextual || options.contextualLocal,
contextualLocal: options.contextualLocal,
contextualUseOllama: options.contextualLocal && options.useOllama, // Use Ollama if both flags set
contextualModel: options.contextualModel,
contextualOllamaHost: options.ollamaHost, // Reuse Ollama host if set
contextualLocalModel: options.contextualOllamaModel
};

// Choose generator based on options
Expand Down Expand Up @@ -1432,9 +1444,9 @@ program
// Package command - create portable wiki package
program
.command('pack')
.description('Create a portable .archiwiki package from wiki directory')
.description('Create a portable .semantics package from wiki directory')
.option('-o, --output <dir>', 'Wiki directory to package', './wiki')
.option('-f, --file <path>', 'Output package file path (default: wiki name + .archiwiki)')
.option('-f, --file <path>', 'Output package file path (default: wiki name + .semantics)')
.option('-n, --name <name>', 'Package name')
.option('-d, --description <text>', 'Package description')
.option('--source-repo <url>', 'Source repository URL')
Expand All @@ -1448,11 +1460,11 @@ program
process.exit(1);
}

console.log(chalk.cyan.bold('\n📦 Creating ArchiWiki Package\n'));
console.log(chalk.cyan.bold('\n📦 Creating SemanticWiki Package\n'));

const { createPackage } = await import('./package-format.js');

const outputPath = options.file || path.join(path.dirname(wikiDir), `${path.basename(wikiDir)}.archiwiki`);
const outputPath = options.file || path.join(path.dirname(wikiDir), `${path.basename(wikiDir)}.semantics`);

await createPackage({
wikiPath: wikiDir,
Expand All @@ -1473,8 +1485,8 @@ program
// Unpack command - extract portable wiki package
program
.command('unpack')
.description('Extract an .archiwiki package to a directory')
.argument('<package>', 'Path to .archiwiki package file')
.description('Extract a .semantics package to a directory')
.argument('<package>', 'Path to .semantics package file')
.option('-o, --output <dir>', 'Output directory', '.')
.option('--wiki-only', 'Extract only wiki files, skip RAG index')
.option('--info', 'Show package info without extracting')
Expand Down Expand Up @@ -1524,7 +1536,7 @@ program
return;
}

console.log(chalk.cyan.bold('\n📦 Extracting ArchiWiki Package\n'));
console.log(chalk.cyan.bold('\n📦 Extracting SemanticWiki Package\n'));

const manifest = await extractPackage({
packagePath: pkgPath,
Expand Down
8 changes: 4 additions & 4 deletions src/mcp-wiki-server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* MCP Server for querying ArchiWiki generated documentation
* MCP Server for querying SemanticWiki generated documentation
*
* This server exposes tools for:
* - Searching wiki pages by keyword or semantic similarity
Expand Down Expand Up @@ -49,7 +49,7 @@ export class WikiMCPServer {
this.config = config;
this.server = new Server(
{
name: 'archiwiki',
name: 'semanticwiki',
version: '1.0.0',
},
{
Expand Down Expand Up @@ -514,7 +514,7 @@ export class WikiMCPServer {

const transport = new StdioServerTransport();
await this.server.connect(transport);
console.error('ArchiWiki MCP Server started');
console.error('SemanticWiki MCP Server started');
}
}

Expand All @@ -536,7 +536,7 @@ async function main() {
repoPath = args[++i];
} else if (args[i] === '--help' || args[i] === '-h') {
console.log(`
ArchiWiki MCP Server
SemanticWiki MCP Server

Usage: npx ts-node src/mcp-wiki-server.ts [options]

Expand Down
8 changes: 4 additions & 4 deletions src/package-format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* ArchiWiki Portable Package Format (.archiwiki)
* SemanticWiki Portable Package Format (.semantics)
*
* A portable package format that bundles:
* - Wiki documentation (markdown files)
Expand Down Expand Up @@ -53,7 +53,7 @@ export interface ExtractOptions {
}

/**
* Create an ArchiWiki package from a wiki directory
* Create a SemanticWiki package from a wiki directory
*/
export async function createPackage(options: PackageOptions): Promise<string> {
const { wikiPath, outputPath, name, description, sourceRepo, includeRag = true } = options;
Expand Down Expand Up @@ -154,7 +154,7 @@ export async function createPackage(options: PackageOptions): Promise<string> {
// Format: [manifest_length (4 bytes)][manifest JSON][file entries...]
// Each file entry: [path_length (2 bytes)][path][content_length (4 bytes)][content]

const packagePath = outputPath.endsWith('.archiwiki') ? outputPath : `${outputPath}.archiwiki`;
const packagePath = outputPath.endsWith('.semantics') ? outputPath : `${outputPath}.semantics`;

// Build the package buffer
const chunks: Buffer[] = [];
Expand Down Expand Up @@ -204,7 +204,7 @@ export async function createPackage(options: PackageOptions): Promise<string> {
}

/**
* Extract an ArchiWiki package to a directory
* Extract a SemanticWiki package to a directory
*/
export async function extractPackage(options: ExtractOptions): Promise<PackageManifest> {
const { packagePath, outputPath, wikiOnly = false } = options;
Expand Down
Loading