Skip to content

Commit b891363

Browse files
committed
Refactor native bindings and output adaptor integration
1 parent 90fd652 commit b891363

108 files changed

Lines changed: 10624 additions & 1108 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/src/cli-runtime.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ vi.mock('@truenine/memory-sync-sdk', () => ({
1515
clean: cleanMock,
1616
listAdaptors: listAdaptorsMock
1717
}
18-
},
19-
createTsFallbackMemorySyncBinding() {
20-
return {
21-
install: installMock,
22-
dryRun: dryRunMock,
23-
clean: cleanMock
24-
}
2518
}
2619
}))
2720

cli/src/cli-runtime.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {MemorySyncAdaptorInfo, MemorySyncCommandResult} from '@truenine/mem
22

33
import process from 'node:process'
44
import {flushOutput, setGlobalLogLevel} from '@truenine/logger'
5-
import {createTsFallbackMemorySyncBinding, getMemorySyncSdkBinding} from '@truenine/memory-sync-sdk'
5+
import {getMemorySyncSdkBinding} from '@truenine/memory-sync-sdk'
66
import {extractUserArgs, parseArgs} from './cli-args'
77

88
const CLI_NAME = 'tnmsc'
@@ -31,7 +31,7 @@ Synchronize AI memory and configuration files across projects.
3131
- \`${CLI_NAME} dry-run\` previews what would be written.
3232
- \`${CLI_NAME} clean\` removes generated files.
3333
- \`${CLI_NAME} clean --dry-run\` previews what would be cleaned.
34-
- \`${CLI_NAME} plugins\` lists the built-in output plugins.
34+
- \`${CLI_NAME} plugins\` lists the built-in output adaptors.
3535
3636
## Log Controls
3737
@@ -58,9 +58,9 @@ function writeUnknownCommand(command: string): void {
5858
}
5959

6060
function writePluginList(plugins: readonly MemorySyncAdaptorInfo[]): void {
61-
const lines = ['# Registered plugins', '']
61+
const lines = ['# Registered adaptors', '']
6262
if (plugins.length === 0) {
63-
lines.push('- No plugins are currently registered.')
63+
lines.push('- No adaptors are currently registered.')
6464
} else {
6565
for (const plugin of plugins) {
6666
const dependencySuffix = plugin.dependencies.length > 0 ? ` (depends on: ${plugin.dependencies.join(', ')})` : ''
@@ -94,17 +94,7 @@ export async function runCli(argv: readonly string[] = process.argv): Promise<nu
9494
return 1
9595
}
9696

97-
const nativeBinding = getMemorySyncSdkBinding()
98-
const fallbackBinding = createTsFallbackMemorySyncBinding()
99-
// Pipeline commands (install / dry-run / clean) are not yet fully
100-
// implemented in Rust, so use the mature TS fallback for them while
101-
// keeping the native binding for prompts and listAdaptors.
102-
const binding = {
103-
...nativeBinding,
104-
install: fallbackBinding.install,
105-
dryRun: fallbackBinding.dryRun,
106-
clean: fallbackBinding.clean
107-
}
97+
const binding = getMemorySyncSdkBinding()
10898
const commandOptions = {
10999
cwd: process.cwd(),
110100
...parsedArgs.logLevel != null ? {logLevel: parsedArgs.logLevel} : {}

cli/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum CliCommand {
5555
/// Remove all generated output files and directories
5656
Clean(CleanArgs),
5757

58-
/// List all registered plugins
58+
/// List all registered adaptors
5959
Plugins,
6060
}
6161

cli/src/commands/bridge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ pub fn dry_run_clean() -> ExitCode {
3434
pub fn plugins() -> ExitCode {
3535
let plugins = tnmsc::list_plugins();
3636

37-
println!("# Registered plugins");
37+
println!("# Registered adaptors");
3838
println!();
3939

4040
if plugins.is_empty() {
41-
println!("- No plugins are currently registered.");
41+
println!("- No adaptors are currently registered.");
4242
} else {
4343
for plugin in plugins {
4444
if plugin.dependencies.is_empty() {

cli/src/commands/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn execute() -> ExitCode {
1111
println!(" install Run the install pipeline explicitly");
1212
println!(" dry-run Preview changes without writing files");
1313
println!(" clean Remove all generated output files");
14-
println!(" plugins List all registered plugins");
14+
println!(" plugins List all registered adaptors");
1515
println!(" version Show version information");
1616
println!(" help Show this help message");
1717
println!();

doc/content/sdk/_meta.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export default {
2-
index: '概览'
2+
index: '概览',
3+
architecture: '架构总览',
4+
logger: 'Logger 日志库',
5+
'md-compiler': 'MDX-Compiler 编译器',
6+
'script-runtime': 'Script-Runtime 运行时'
37
}

0 commit comments

Comments
 (0)