fix: auto-initialize skills system when applying first skill
applySkill() now creates .nanoclaw/ automatically if state.yaml is missing, removing the need to run --init as a separate step. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,10 @@ import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import { clearBackup, createBackup, restoreBackup } from './backup.js';
|
||||
import { NANOCLAW_DIR } from './constants.js';
|
||||
import { NANOCLAW_DIR, STATE_FILE } from './constants.js';
|
||||
import { copyDir } from './fs-utils.js';
|
||||
import { isCustomizeActive } from './customize.js';
|
||||
import { initNanoclawDir } from './init.js';
|
||||
import { executeFileOps } from './file-ops.js';
|
||||
import { acquireLock } from './lock.js';
|
||||
import {
|
||||
@@ -38,7 +39,12 @@ export async function applySkill(skillDir: string): Promise<ApplyResult> {
|
||||
const manifest = readManifest(skillDir);
|
||||
|
||||
// --- Pre-flight checks ---
|
||||
const currentState = readState(); // Validates state exists and version is compatible
|
||||
// Auto-initialize skills system if state file doesn't exist
|
||||
const statePath = path.join(projectRoot, NANOCLAW_DIR, STATE_FILE);
|
||||
if (!fs.existsSync(statePath)) {
|
||||
initNanoclawDir();
|
||||
}
|
||||
const currentState = readState();
|
||||
|
||||
// Check skills system version compatibility
|
||||
const sysCheck = checkSystemVersion(manifest);
|
||||
|
||||
Reference in New Issue
Block a user