@kentwynn/kgraph 0.2.33 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -253,9 +253,10 @@ kgraph repair
|
|
|
253
253
|
kgraph uninstall
|
|
254
254
|
kgraph uninstall --yes
|
|
255
255
|
kgraph uninstall --keep-integrations --yes
|
|
256
|
+
kgraph uninstall --yes --memory
|
|
256
257
|
```
|
|
257
258
|
|
|
258
|
-
`uninstall` previews repo-local removal and does not delete anything unless `--yes` is passed. `uninstall --yes` removes `.kgraph/` and KGraph-managed integration blocks/files while preserving source files and user-authored text outside managed blocks. Use `--keep-integrations --yes` to remove only `.kgraph/` while leaving AI tool instruction files in place. After uninstalling, `kgraph init` can be run again for a fresh setup.
|
|
259
|
+
`uninstall` previews repo-local removal and does not delete anything unless `--yes` is passed. `uninstall --yes` removes `.kgraph/` and KGraph-managed integration blocks/files while preserving source files and user-authored text outside managed blocks. Use `--keep-integrations --yes` to remove only `.kgraph/` while leaving AI tool instruction files in place. Add `--memory` to also remove the Copilot memory rule that `init` installs; without this flag the memory entry is preserved across uninstalls. After uninstalling, `kgraph init` can be run again for a fresh setup.
|
|
259
260
|
|
|
260
261
|
```bash
|
|
261
262
|
kgraph impact "Button"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadConfig, saveConfig, writeDefaultConfig, } from '../../config/config.js';
|
|
2
|
+
import { installCopilotMemory } from '../../integrations/copilot-memory.js';
|
|
2
3
|
import { normalizeIntegrationNames } from '../../integrations/integration-registry.js';
|
|
3
4
|
import { addIntegrations } from '../../integrations/integration-store.js';
|
|
4
5
|
import { ensureKnowledgeStore } from '../../knowledge/atom-store.js';
|
|
@@ -85,6 +86,11 @@ export function registerInitCommand(program) {
|
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
}
|
|
89
|
+
// Install Copilot memory entry
|
|
90
|
+
const installed = await installCopilotMemory();
|
|
91
|
+
if (installed) {
|
|
92
|
+
console.log('Copilot memory rule installed.');
|
|
93
|
+
}
|
|
88
94
|
console.log('');
|
|
89
95
|
console.log(renderInitSummary({
|
|
90
96
|
files: result.files,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdir, rm, rmdir } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { loadConfig } from '../../config/config.js';
|
|
4
|
+
import { removeCopilotMemory } from '../../integrations/copilot-memory.js';
|
|
4
5
|
import { removeIntegrations } from '../../integrations/integration-store.js';
|
|
5
6
|
import { pathExists, resolveWorkspace } from '../../storage/kgraph-paths.js';
|
|
6
7
|
import { runCommand } from '../errors.js';
|
|
@@ -15,6 +16,7 @@ export function registerUninstallCommand(program) {
|
|
|
15
16
|
.description('Remove KGraph from this repository')
|
|
16
17
|
.option('--yes', 'Apply the uninstall after previewing what will be removed')
|
|
17
18
|
.option('--keep-integrations', 'Remove only .kgraph/ and preserve generated AI tool instruction files')
|
|
19
|
+
.option('--memory', 'Also remove the global Copilot memory entry for this repo')
|
|
18
20
|
.action((options) => runCommand(async () => {
|
|
19
21
|
const workspace = resolveWorkspace(process.cwd());
|
|
20
22
|
const initialized = await pathExists(workspace.kgraphPath);
|
|
@@ -25,6 +27,7 @@ export function registerUninstallCommand(program) {
|
|
|
25
27
|
initialized,
|
|
26
28
|
integrations: configuredIntegrations,
|
|
27
29
|
keepIntegrations: options.keepIntegrations === true,
|
|
30
|
+
removeMemory: options.memory === true,
|
|
28
31
|
applying: options.yes === true,
|
|
29
32
|
});
|
|
30
33
|
if (!options.yes) {
|
|
@@ -39,6 +42,13 @@ export function registerUninstallCommand(program) {
|
|
|
39
42
|
if (initialized) {
|
|
40
43
|
await rm(workspace.kgraphPath, { recursive: true, force: true });
|
|
41
44
|
}
|
|
45
|
+
// Remove Copilot memory entry only if --memory flag is set
|
|
46
|
+
if (options.memory) {
|
|
47
|
+
const memoryRemoved = await removeCopilotMemory();
|
|
48
|
+
if (memoryRemoved) {
|
|
49
|
+
console.log('Removed Copilot memory rule.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
42
52
|
console.log('');
|
|
43
53
|
console.log('KGraph uninstall complete.');
|
|
44
54
|
console.log('Run `kgraph init` to set up this repository again.');
|
|
@@ -84,6 +94,9 @@ function printUninstallPreview(input) {
|
|
|
84
94
|
console.log('- No configured integration blocks/files found');
|
|
85
95
|
}
|
|
86
96
|
}
|
|
97
|
+
if (input.removeMemory) {
|
|
98
|
+
console.log('- Copilot memory rule for this repo');
|
|
99
|
+
}
|
|
87
100
|
console.log('');
|
|
88
101
|
console.log('Will preserve:');
|
|
89
102
|
console.log('- Repository source files');
|
package/dist/cli/help.js
CHANGED
|
@@ -11,7 +11,10 @@ export function renderRootHelp(useColor = supportsColor()) {
|
|
|
11
11
|
['purpose', 'durable engineering memory for AI coding tools'],
|
|
12
12
|
['storage', '.kgraph/ atoms, maps, indexes, and session history'],
|
|
13
13
|
['stance', 'local-first · deterministic-first · inspectable'],
|
|
14
|
-
[
|
|
14
|
+
[
|
|
15
|
+
'agents',
|
|
16
|
+
'Codex · Copilot · Cursor · Claude Code · Gemini · Windsurf · Cline',
|
|
17
|
+
],
|
|
15
18
|
]),
|
|
16
19
|
'',
|
|
17
20
|
sectionTitle(theme, `${accent} Usage`),
|
|
@@ -49,6 +52,7 @@ export function renderRootHelp(useColor = supportsColor()) {
|
|
|
49
52
|
command('repair', 'Clean noisy stale atom references'),
|
|
50
53
|
command('uninstall', 'Preview repo-local KGraph removal'),
|
|
51
54
|
command('uninstall --yes', 'Remove .kgraph/ and managed integrations'),
|
|
55
|
+
command('uninstall --yes --memory', 'Also remove Copilot memory rule'),
|
|
52
56
|
command('visualize', 'Interactive dependency graph at http://localhost:4242'),
|
|
53
57
|
command('history "blog button"', 'Search processed cognition sessions'),
|
|
54
58
|
'',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the Copilot memory-tool memories directory for the current OS.
|
|
3
|
+
* Returns undefined if the globalStorage root cannot be determined.
|
|
4
|
+
* Respects KGRAPH_COPILOT_MEMORY_DIR env override for testing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveCopilotMemoryDir(): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Install the KGraph memory entry into the Copilot memory store.
|
|
9
|
+
* Returns true if written, false if the directory could not be resolved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function installCopilotMemory(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Remove the KGraph memory entry from the Copilot memory store.
|
|
14
|
+
* Returns true if removed or did not exist, false if the directory could not be resolved.
|
|
15
|
+
*/
|
|
16
|
+
export declare function removeCopilotMemory(): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Check whether the KGraph memory entry exists.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hasCopilotMemory(): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Read the KGraph memory content, if it exists.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readCopilotMemory(): Promise<string | undefined>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages the GitHub Copilot memory-tool entry for KGraph.
|
|
3
|
+
* Installs/removes a persistent preference so Copilot always follows the
|
|
4
|
+
* KGraph workflow in repos where KGraph is initialised.
|
|
5
|
+
*/
|
|
6
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
7
|
+
import { homedir, platform } from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { pathExists } from '../storage/kgraph-paths.js';
|
|
10
|
+
const MEMORY_FILE = 'kgraph.md';
|
|
11
|
+
const MEMORY_CONTENT = `# KGraph
|
|
12
|
+
|
|
13
|
+
- KGraph is installed. Follow the copilot-instructions.md and @kgraph agent for this repo.
|
|
14
|
+
`;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the Copilot memory-tool memories directory for the current OS.
|
|
17
|
+
* Returns undefined if the globalStorage root cannot be determined.
|
|
18
|
+
* Respects KGRAPH_COPILOT_MEMORY_DIR env override for testing.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveCopilotMemoryDir() {
|
|
21
|
+
if (process.env['KGRAPH_COPILOT_MEMORY_DIR']) {
|
|
22
|
+
return process.env['KGRAPH_COPILOT_MEMORY_DIR'];
|
|
23
|
+
}
|
|
24
|
+
const home = homedir();
|
|
25
|
+
switch (platform()) {
|
|
26
|
+
case 'win32':
|
|
27
|
+
return path.join(process.env['APPDATA'] ?? path.join(home, 'AppData', 'Roaming'), 'Code', 'User', 'globalStorage', 'github.copilot-chat', 'memory-tool', 'memories');
|
|
28
|
+
case 'darwin':
|
|
29
|
+
return path.join(home, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'github.copilot-chat', 'memory-tool', 'memories');
|
|
30
|
+
case 'linux':
|
|
31
|
+
return path.join(process.env['XDG_CONFIG_HOME'] ?? path.join(home, '.config'), 'Code', 'User', 'globalStorage', 'github.copilot-chat', 'memory-tool', 'memories');
|
|
32
|
+
default:
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Install the KGraph memory entry into the Copilot memory store.
|
|
38
|
+
* Returns true if written, false if the directory could not be resolved.
|
|
39
|
+
*/
|
|
40
|
+
export async function installCopilotMemory() {
|
|
41
|
+
const memoryDir = resolveCopilotMemoryDir();
|
|
42
|
+
if (!memoryDir) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
await mkdir(memoryDir, { recursive: true });
|
|
46
|
+
await writeFile(path.join(memoryDir, MEMORY_FILE), MEMORY_CONTENT, 'utf8');
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Remove the KGraph memory entry from the Copilot memory store.
|
|
51
|
+
* Returns true if removed or did not exist, false if the directory could not be resolved.
|
|
52
|
+
*/
|
|
53
|
+
export async function removeCopilotMemory() {
|
|
54
|
+
const memoryDir = resolveCopilotMemoryDir();
|
|
55
|
+
if (!memoryDir) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const memoryFile = path.join(memoryDir, MEMORY_FILE);
|
|
59
|
+
if (await pathExists(memoryFile)) {
|
|
60
|
+
await rm(memoryFile, { force: true });
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check whether the KGraph memory entry exists.
|
|
66
|
+
*/
|
|
67
|
+
export async function hasCopilotMemory() {
|
|
68
|
+
const memoryDir = resolveCopilotMemoryDir();
|
|
69
|
+
if (!memoryDir) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return pathExists(path.join(memoryDir, MEMORY_FILE));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Read the KGraph memory content, if it exists.
|
|
76
|
+
*/
|
|
77
|
+
export async function readCopilotMemory() {
|
|
78
|
+
const memoryDir = resolveCopilotMemoryDir();
|
|
79
|
+
if (!memoryDir) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
const memoryFile = path.join(memoryDir, MEMORY_FILE);
|
|
83
|
+
if (!(await pathExists(memoryFile))) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return readFile(memoryFile, 'utf8');
|
|
87
|
+
}
|