Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@onfabric/openclaw-fabric",
"description": "Portable AI memory for OpenClaw",
"version": "0.0.19",
"version": "0.0.20",
"author": "Fabric Developers <developers@onfabric.io>",
"repository": {
"type": "git",
Expand Down
13 changes: 10 additions & 3 deletions src/cli/commands/setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { cron as deepUserProfileCron } from '../../crons/deep-user-profile';
import { prompt } from '../../lib/cli';
import { saveFabricPluginConfig } from '../../lib/config';
import { replaceContentInWorkspaceFile, WorkspaceFile } from '../../lib/openclaw';
import {
replaceContentInWorkspaceFile,
WorkspaceFile,
workspaceFileExists,
} from '../../lib/openclaw';
import { getSkillPath, Skill } from '../../lib/skills';
import type { CommandCtx } from '../types';

Expand Down Expand Up @@ -35,15 +39,18 @@ function register({ cmd, config, workspaceDir }: CommandCtx) {

console.log('\n💾 Configuration saved to ~/.openclaw/openclaw.json');

if (workspaceDir) {
if (workspaceDir && workspaceFileExists(workspaceDir, WorkspaceFile.HEARTBEAT)) {
console.log(`\n📂 Workspace directory is available: ${workspaceDir}`);
replaceContentInWorkspaceFile(
workspaceDir,
WorkspaceFile.HEARTBEAT,
FABRIC_PLUGIN_HEARTBEAT_CONTENT,
);
} else {
console.warn('\n⚠️ Workspace directory is not available. Cannot update workspace files.');
console.warn(
`\n⚠️ Workspace directory or ${WorkspaceFile.HEARTBEAT} file is not available.`,
);
console.warn(' Start at least one conversation with your OpenClaw first.');
}

await deepUserProfileCron.register();
Expand Down
10 changes: 7 additions & 3 deletions src/lib/openclaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ function getOpenClawConfigFilePath(configDir: string): string {

export function saveOpenClawConfig(config: OpenClawConfig): void {
const configDir = getOpenClawConfigDir();
if (!fs.existsSync(configDir)) {
fs.mkdirSync(configDir, { recursive: true });
}
fs.mkdirSync(configDir, { recursive: true });
Comment thread
ilbertt marked this conversation as resolved.
Resolved

const configPath = getOpenClawConfigFilePath(configDir);
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
}
Expand All @@ -38,6 +37,11 @@ export function replaceContentInWorkspaceFile(
console.log(`✅ ${filename} updated`);
}

export function workspaceFileExists(workspaceDir: string, filename: WorkspaceFile): boolean {
const workspaceFilePath = path.join(workspaceDir, filename);
return fs.existsSync(workspaceFilePath);
}

type CliCronAddOptions = {
cronExpression: string;
name: string;
Expand Down