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
14 changes: 0 additions & 14 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,6 @@ program
.option('--enrich', 'Enable LLM enrichment (requires ANTHROPIC_API_KEY)')
.action((options) => extractCommand(options, logger));

// Deprecated alias — will be removed in a future version
program
.command('liberate')
.description('Deprecated: use "extract" instead')
.option('--since <date>', 'Start date (default: 90 days ago)')
.option('--commit-count <n>', 'Max commits to process')
.option('--dry-run', 'Preview without writing')
.option('--threshold <n>', 'Interest score threshold', '3')
.option('--enrich', 'Enable LLM enrichment (requires ANTHROPIC_API_KEY)')
.action((options) => {
console.warn('Warning: "liberate" is deprecated, use "extract" instead.');
return extractCommand(options, logger);
});

program
.command('context')
.description('Show memories relevant to staged changes')
Expand Down
10 changes: 0 additions & 10 deletions src/commands/init-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,6 @@ export function deepMergeGitMemConfig(
const existingHooks = (existing.hooks ?? {}) as Record<string, unknown>;
const defaultHooks = (defaults.hooks ?? {}) as Record<string, unknown>;

// Backward compat: migrate autoLiberate → autoExtract in sessionStop
const existingStop = existingHooks.sessionStop;
if (typeof existingStop === 'object' && existingStop !== null && !Array.isArray(existingStop)) {
const stop = existingStop as Record<string, unknown>;
if (stop.autoExtract === undefined && stop.autoLiberate !== undefined) {
stop.autoExtract = stop.autoLiberate;
delete stop.autoLiberate;
}
}

const mergedHooks: Record<string, unknown> = {};

// Merge each default key
Expand Down
4 changes: 0 additions & 4 deletions src/domain/types/IMemoryQuality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* - commit-trailer: Extracted from AI-* commit trailers
* - git-note: Stored in refs/notes/mem
* - extract: Generated by extracting knowledge from existing history
* - liberate: @deprecated Alias for 'extract' (backward compat)
* - heuristic-extraction: Pattern-matched from commit messages
*/

Expand Down Expand Up @@ -55,7 +54,6 @@ export type SourceType =
| 'commit-trailer'
| 'git-note'
| 'extract'
| 'liberate' // @deprecated — kept for backward compat with existing memories
| 'heuristic-extraction'
| 'llm-enrichment';

Expand All @@ -67,7 +65,6 @@ export const SOURCE_VALUES: readonly SourceType[] = [
'commit-trailer',
'git-note',
'extract',
'liberate', // @deprecated — kept for backward compat
'heuristic-extraction',
'llm-enrichment',
] as const;
Expand All @@ -80,7 +77,6 @@ export const DEFAULT_CONFIDENCE: Readonly<Record<SourceType, ConfidenceLevel>> =
'commit-trailer': 'high',
'git-note': 'high',
'extract': 'medium',
'liberate': 'medium', // @deprecated — kept for backward compat
'heuristic-extraction': 'low',
'llm-enrichment': 'medium',
};
Expand Down
5 changes: 0 additions & 5 deletions src/hooks/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ export function loadHookConfig(cwd?: string): IHookConfig {
const raw = JSON.parse(readFileSync(configPath, 'utf8')) as Record<string, unknown>;
const rawHooks = (raw.hooks ?? {}) as Partial<IHooksConfig>;

// Backward compat: migrate autoLiberate → autoExtract
const rawStop = (rawHooks.sessionStop ?? {}) as Record<string, unknown>;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rawStop variable is no longer needed after removing the migration code. For consistency with sessionStart and promptSubmit configuration handling (lines 39-42 and 47-50), consider using rawHooks.sessionStop directly in the spread on line 45 instead of this intermediate variable.

Copilot uses AI. Check for mistakes.
if (rawStop.autoExtract === undefined && rawStop.autoLiberate !== undefined) {
rawStop.autoExtract = rawStop.autoLiberate;
delete rawStop.autoLiberate;
}

return {
hooks: {
Expand Down
30 changes: 0 additions & 30 deletions tests/unit/commands/init-hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,36 +342,6 @@ describe('deepMergeGitMemConfig', () => {
assert.equal(sessionStart.memoryLimit, 20); // Default fills in
});

it('should migrate autoLiberate to autoExtract in existing config', () => {
const existing = {
hooks: {
sessionStop: { enabled: true, autoLiberate: true, threshold: 5 },
},
};

const result = deepMergeGitMemConfig(existing, defaults);
const hooks = result.hooks as Record<string, unknown>;
const sessionStop = hooks.sessionStop as Record<string, unknown>;

assert.equal(sessionStop.autoExtract, true);
assert.equal(sessionStop.autoLiberate, undefined); // Migrated away
assert.equal(sessionStop.threshold, 5);
});

it('should not override explicit autoExtract with autoLiberate', () => {
const existing = {
hooks: {
sessionStop: { enabled: true, autoExtract: false, autoLiberate: true },
},
};

const result = deepMergeGitMemConfig(existing, defaults);
const hooks = result.hooks as Record<string, unknown>;
const sessionStop = hooks.sessionStop as Record<string, unknown>;

assert.equal(sessionStop.autoExtract, false); // Explicit autoExtract wins
});

it('should deep-merge sub-objects keeping user values over defaults', () => {
const existing = {
hooks: {
Expand Down
28 changes: 0 additions & 28 deletions tests/unit/hooks/utils/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,34 +89,6 @@ describe('loadHookConfig', () => {
assert.equal(config.hooks.enabled, false);
});

it('should migrate autoLiberate to autoExtract for backward compat', () => {
const testDir = createTestDir();
writeFileSync(join(testDir, '.git-mem.json'), JSON.stringify({
hooks: {
sessionStop: { enabled: true, autoLiberate: true, threshold: 5 },
},
}));

const config = loadHookConfig(testDir);

assert.equal(config.hooks.sessionStop.autoExtract, true);
assert.equal(config.hooks.sessionStop.threshold, 5);
});

it('should prefer autoExtract over autoLiberate when both present', () => {
const testDir = createTestDir();
writeFileSync(join(testDir, '.git-mem.json'), JSON.stringify({
hooks: {
sessionStop: { enabled: true, autoExtract: false, autoLiberate: true },
},
}));

const config = loadHookConfig(testDir);

// autoExtract is explicit — should not be overridden by autoLiberate
assert.equal(config.hooks.sessionStop.autoExtract, false);
});

it('should use process.cwd() when no cwd provided', () => {
// This should not throw — just returns defaults if no .git-mem.json
const config = loadHookConfig();
Expand Down
Loading