@dzhechkov/harness-core 0.3.10 → 0.3.11
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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/setup.d.ts +40 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +150 -0
- package/dist/setup.js.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +2 -0
- package/src/setup.ts +177 -0
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
|
18
18
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
19
19
|
export { recommend } from './recommend.js';
|
|
20
20
|
export { pretrain } from './pretrain.js';
|
|
21
|
+
export { runSetup } from './setup.js';
|
|
22
|
+
export type { SetupOptions, SetupResult, SetupStep } from './setup.js';
|
|
21
23
|
export type { PretrainResult, DetectedTech } from './pretrain.js';
|
|
22
24
|
export type { RecommendationReport, SkillRecommendation } from './recommend.js';
|
|
23
25
|
export { discoverPackages, publishPackages } from './publish.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,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,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
|
16
16
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
17
17
|
export { recommend } from './recommend.js';
|
|
18
18
|
export { pretrain } from './pretrain.js';
|
|
19
|
+
export { runSetup } from './setup.js';
|
|
19
20
|
export { discoverPackages, publishPackages } from './publish.js';
|
|
20
21
|
export { fetchAllDownloads } from './downloads.js';
|
|
21
22
|
export { discoverInstalled, checkUpgrades } from './upgrade.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAElH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAElH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full environment setup — skills + hooks + memory + pretrain.
|
|
3
|
+
*
|
|
4
|
+
* Unlike `dz init` (skills only), `dz setup` configures the complete
|
|
5
|
+
* self-learning environment:
|
|
6
|
+
* 1. Skills installation (via init)
|
|
7
|
+
* 2. Claude Code hooks (session-start/end for memory)
|
|
8
|
+
* 3. Memory database initialization (.dz/memory.db)
|
|
9
|
+
* 4. Pretrain (project analysis → auto-recommend)
|
|
10
|
+
*
|
|
11
|
+
* All operations are additive — never overwrites existing files.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
/** Setup options. */
|
|
16
|
+
export interface SetupOptions {
|
|
17
|
+
readonly projectRoot: string;
|
|
18
|
+
readonly target: string;
|
|
19
|
+
readonly preset?: string | undefined;
|
|
20
|
+
readonly noHooks?: boolean | undefined;
|
|
21
|
+
readonly noMemory?: boolean | undefined;
|
|
22
|
+
readonly noPretrain?: boolean | undefined;
|
|
23
|
+
readonly force?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Setup result. */
|
|
26
|
+
export interface SetupResult {
|
|
27
|
+
readonly steps: readonly SetupStep[];
|
|
28
|
+
readonly totalSteps: number;
|
|
29
|
+
readonly completed: number;
|
|
30
|
+
readonly skipped: number;
|
|
31
|
+
}
|
|
32
|
+
/** A single setup step. */
|
|
33
|
+
export interface SetupStep {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly status: 'done' | 'skipped' | 'error';
|
|
36
|
+
readonly detail: string;
|
|
37
|
+
}
|
|
38
|
+
/** Run full environment setup. */
|
|
39
|
+
export declare function runSetup(opts: SetupOptions): SetupResult;
|
|
40
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,qBAAqB;AACrB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,oBAAoB;AACpB,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,2BAA2B;AAC3B,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA2CD,kCAAkC;AAClC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CA0FxD"}
|
package/dist/setup.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full environment setup — skills + hooks + memory + pretrain.
|
|
3
|
+
*
|
|
4
|
+
* Unlike `dz init` (skills only), `dz setup` configures the complete
|
|
5
|
+
* self-learning environment:
|
|
6
|
+
* 1. Skills installation (via init)
|
|
7
|
+
* 2. Claude Code hooks (session-start/end for memory)
|
|
8
|
+
* 3. Memory database initialization (.dz/memory.db)
|
|
9
|
+
* 4. Pretrain (project analysis → auto-recommend)
|
|
10
|
+
*
|
|
11
|
+
* All operations are additive — never overwrites existing files.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
/** Generate Claude Code hooks configuration for self-learning. */
|
|
18
|
+
function generateHooksConfig(projectRoot) {
|
|
19
|
+
const dzDir = join(projectRoot, '.dz');
|
|
20
|
+
return JSON.stringify({
|
|
21
|
+
hooks: {
|
|
22
|
+
SessionStart: [{
|
|
23
|
+
type: 'command',
|
|
24
|
+
command: `node -e "const fs=require('fs');const p='${dzDir}/memory.db';const d=new Date().toISOString();fs.appendFileSync('${dzDir}/sessions.jsonl',JSON.stringify({event:'start',ts:d})+'\\n')"`,
|
|
25
|
+
}],
|
|
26
|
+
SessionEnd: [{
|
|
27
|
+
type: 'command',
|
|
28
|
+
command: `node -e "const fs=require('fs');const d=new Date().toISOString();fs.appendFileSync('${dzDir}/sessions.jsonl',JSON.stringify({event:'end',ts:d})+'\\n')"`,
|
|
29
|
+
}],
|
|
30
|
+
},
|
|
31
|
+
}, null, 2);
|
|
32
|
+
}
|
|
33
|
+
/** Generate .dz/config.json with learning settings. */
|
|
34
|
+
function generateDzConfig(target, preset) {
|
|
35
|
+
return JSON.stringify({
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
target,
|
|
38
|
+
preset: preset ?? null,
|
|
39
|
+
learning: {
|
|
40
|
+
enabled: true,
|
|
41
|
+
sessionTracking: true,
|
|
42
|
+
patternConsolidation: true,
|
|
43
|
+
retentionDays: 90,
|
|
44
|
+
},
|
|
45
|
+
memory: {
|
|
46
|
+
backend: 'jsonl',
|
|
47
|
+
path: '.dz/sessions.jsonl',
|
|
48
|
+
maxSizeMb: 10,
|
|
49
|
+
},
|
|
50
|
+
hooks: {
|
|
51
|
+
sessionStart: true,
|
|
52
|
+
sessionEnd: true,
|
|
53
|
+
},
|
|
54
|
+
}, null, 2);
|
|
55
|
+
}
|
|
56
|
+
/** Run full environment setup. */
|
|
57
|
+
export function runSetup(opts) {
|
|
58
|
+
const steps = [];
|
|
59
|
+
const dzDir = join(opts.projectRoot, '.dz');
|
|
60
|
+
// Step 1: Create .dz directory
|
|
61
|
+
if (!existsSync(dzDir)) {
|
|
62
|
+
mkdirSync(dzDir, { recursive: true });
|
|
63
|
+
steps.push({ name: 'Create .dz directory', status: 'done', detail: dzDir });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
steps.push({ name: 'Create .dz directory', status: 'skipped', detail: 'already exists' });
|
|
67
|
+
}
|
|
68
|
+
// Step 2: Write .dz/config.json
|
|
69
|
+
const configPath = join(dzDir, 'config.json');
|
|
70
|
+
if (!existsSync(configPath) || opts.force) {
|
|
71
|
+
writeFileSync(configPath, generateDzConfig(opts.target, opts.preset));
|
|
72
|
+
steps.push({ name: 'Write .dz/config.json', status: 'done', detail: 'learning + memory config' });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
steps.push({ name: 'Write .dz/config.json', status: 'skipped', detail: 'already exists (use --force)' });
|
|
76
|
+
}
|
|
77
|
+
// Step 3: Initialize session log
|
|
78
|
+
const sessionsPath = join(dzDir, 'sessions.jsonl');
|
|
79
|
+
if (!existsSync(sessionsPath)) {
|
|
80
|
+
writeFileSync(sessionsPath, '');
|
|
81
|
+
steps.push({ name: 'Initialize sessions.jsonl', status: 'done', detail: 'session tracking ready' });
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
steps.push({ name: 'Initialize sessions.jsonl', status: 'skipped', detail: 'already exists' });
|
|
85
|
+
}
|
|
86
|
+
// Step 4: Initialize patterns store
|
|
87
|
+
const patternsPath = join(dzDir, 'patterns.jsonl');
|
|
88
|
+
if (!existsSync(patternsPath)) {
|
|
89
|
+
writeFileSync(patternsPath, '');
|
|
90
|
+
steps.push({ name: 'Initialize patterns.jsonl', status: 'done', detail: 'pattern learning ready' });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
steps.push({ name: 'Initialize patterns.jsonl', status: 'skipped', detail: 'already exists' });
|
|
94
|
+
}
|
|
95
|
+
// Step 5: Configure hooks (write to .claude/settings.json)
|
|
96
|
+
if (!opts.noHooks) {
|
|
97
|
+
const settingsDir = join(opts.projectRoot, '.claude');
|
|
98
|
+
const settingsPath = join(settingsDir, 'settings.json');
|
|
99
|
+
if (!existsSync(settingsPath) || opts.force) {
|
|
100
|
+
mkdirSync(settingsDir, { recursive: true });
|
|
101
|
+
writeFileSync(settingsPath, generateHooksConfig(opts.projectRoot));
|
|
102
|
+
steps.push({ name: 'Configure hooks', status: 'done', detail: 'session-start + session-end hooks' });
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Merge hooks into existing settings
|
|
106
|
+
try {
|
|
107
|
+
const existing = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
108
|
+
if (!existing['hooks']) {
|
|
109
|
+
const hooks = JSON.parse(generateHooksConfig(opts.projectRoot));
|
|
110
|
+
existing['hooks'] = hooks.hooks;
|
|
111
|
+
writeFileSync(settingsPath, JSON.stringify(existing, null, 2));
|
|
112
|
+
steps.push({ name: 'Configure hooks', status: 'done', detail: 'merged into existing settings' });
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: 'hooks already configured' });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: 'could not parse existing settings' });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: '--no-hooks' });
|
|
125
|
+
}
|
|
126
|
+
// Step 6: Update .gitignore
|
|
127
|
+
const gitignorePath = join(opts.projectRoot, '.gitignore');
|
|
128
|
+
const dzIgnoreEntry = '\n# DZ Harness learning data\n.dz/sessions.jsonl\n.dz/patterns.jsonl\n';
|
|
129
|
+
if (existsSync(gitignorePath)) {
|
|
130
|
+
const content = readFileSync(gitignorePath, 'utf-8');
|
|
131
|
+
if (!content.includes('.dz/sessions.jsonl')) {
|
|
132
|
+
writeFileSync(gitignorePath, content + dzIgnoreEntry);
|
|
133
|
+
steps.push({ name: 'Update .gitignore', status: 'done', detail: 'added .dz/sessions.jsonl + patterns.jsonl' });
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
steps.push({ name: 'Update .gitignore', status: 'skipped', detail: 'already ignoring .dz data' });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
writeFileSync(gitignorePath, dzIgnoreEntry);
|
|
141
|
+
steps.push({ name: 'Create .gitignore', status: 'done', detail: 'with .dz entries' });
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
steps,
|
|
145
|
+
totalSteps: steps.length,
|
|
146
|
+
completed: steps.filter((s) => s.status === 'done').length,
|
|
147
|
+
skipped: steps.filter((s) => s.status === 'skipped').length,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA4BjC,kEAAkE;AAClE,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;oBACb,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,4CAA4C,KAAK,mEAAmE,KAAK,+DAA+D;iBAClM,CAAC;YACF,UAAU,EAAE,CAAC;oBACX,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,uFAAuF,KAAK,6DAA6D;iBACnK,CAAC;SACH;KACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACd,CAAC;AAED,uDAAuD;AACvD,SAAS,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;QACN,aAAa,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,OAAO;QACL,KAAK;QACL,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM;QAC1D,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM;KAC5D,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/harness-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Shared harness logic - skill loading, additive apply, and the init/sync/verify/doctor operations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"yaml": "^2.0.0",
|
|
28
28
|
"@dzhechkov/adapter-claude": "0.2.0",
|
|
29
|
-
"@dzhechkov/adapter-openclaude": "0.1.0",
|
|
30
29
|
"@dzhechkov/adapter-opencode": "0.2.0",
|
|
30
|
+
"@dzhechkov/adapter-codex": "0.2.0",
|
|
31
31
|
"@dzhechkov/adapter-hermes": "0.2.0",
|
|
32
|
-
"@dzhechkov/
|
|
33
|
-
"@dzhechkov/
|
|
32
|
+
"@dzhechkov/adapter-openclaude": "0.1.0",
|
|
33
|
+
"@dzhechkov/core": "0.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.6.0",
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,8 @@ export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
|
20
20
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
21
21
|
export { recommend } from './recommend.js';
|
|
22
22
|
export { pretrain } from './pretrain.js';
|
|
23
|
+
export { runSetup } from './setup.js';
|
|
24
|
+
export type { SetupOptions, SetupResult, SetupStep } from './setup.js';
|
|
23
25
|
export type { PretrainResult, DetectedTech } from './pretrain.js';
|
|
24
26
|
export type { RecommendationReport, SkillRecommendation } from './recommend.js';
|
|
25
27
|
export { discoverPackages, publishPackages } from './publish.js';
|
package/src/setup.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full environment setup — skills + hooks + memory + pretrain.
|
|
3
|
+
*
|
|
4
|
+
* Unlike `dz init` (skills only), `dz setup` configures the complete
|
|
5
|
+
* self-learning environment:
|
|
6
|
+
* 1. Skills installation (via init)
|
|
7
|
+
* 2. Claude Code hooks (session-start/end for memory)
|
|
8
|
+
* 3. Memory database initialization (.dz/memory.db)
|
|
9
|
+
* 4. Pretrain (project analysis → auto-recommend)
|
|
10
|
+
*
|
|
11
|
+
* All operations are additive — never overwrites existing files.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
|
|
17
|
+
import { join } from 'node:path';
|
|
18
|
+
|
|
19
|
+
/** Setup options. */
|
|
20
|
+
export interface SetupOptions {
|
|
21
|
+
readonly projectRoot: string;
|
|
22
|
+
readonly target: string;
|
|
23
|
+
readonly preset?: string | undefined;
|
|
24
|
+
readonly noHooks?: boolean | undefined;
|
|
25
|
+
readonly noMemory?: boolean | undefined;
|
|
26
|
+
readonly noPretrain?: boolean | undefined;
|
|
27
|
+
readonly force?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Setup result. */
|
|
31
|
+
export interface SetupResult {
|
|
32
|
+
readonly steps: readonly SetupStep[];
|
|
33
|
+
readonly totalSteps: number;
|
|
34
|
+
readonly completed: number;
|
|
35
|
+
readonly skipped: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A single setup step. */
|
|
39
|
+
export interface SetupStep {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly status: 'done' | 'skipped' | 'error';
|
|
42
|
+
readonly detail: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Generate Claude Code hooks configuration for self-learning. */
|
|
46
|
+
function generateHooksConfig(projectRoot: string): string {
|
|
47
|
+
const dzDir = join(projectRoot, '.dz');
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
hooks: {
|
|
50
|
+
SessionStart: [{
|
|
51
|
+
type: 'command',
|
|
52
|
+
command: `node -e "const fs=require('fs');const p='${dzDir}/memory.db';const d=new Date().toISOString();fs.appendFileSync('${dzDir}/sessions.jsonl',JSON.stringify({event:'start',ts:d})+'\\n')"`,
|
|
53
|
+
}],
|
|
54
|
+
SessionEnd: [{
|
|
55
|
+
type: 'command',
|
|
56
|
+
command: `node -e "const fs=require('fs');const d=new Date().toISOString();fs.appendFileSync('${dzDir}/sessions.jsonl',JSON.stringify({event:'end',ts:d})+'\\n')"`,
|
|
57
|
+
}],
|
|
58
|
+
},
|
|
59
|
+
}, null, 2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Generate .dz/config.json with learning settings. */
|
|
63
|
+
function generateDzConfig(target: string, preset: string | undefined): string {
|
|
64
|
+
return JSON.stringify({
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
target,
|
|
67
|
+
preset: preset ?? null,
|
|
68
|
+
learning: {
|
|
69
|
+
enabled: true,
|
|
70
|
+
sessionTracking: true,
|
|
71
|
+
patternConsolidation: true,
|
|
72
|
+
retentionDays: 90,
|
|
73
|
+
},
|
|
74
|
+
memory: {
|
|
75
|
+
backend: 'jsonl',
|
|
76
|
+
path: '.dz/sessions.jsonl',
|
|
77
|
+
maxSizeMb: 10,
|
|
78
|
+
},
|
|
79
|
+
hooks: {
|
|
80
|
+
sessionStart: true,
|
|
81
|
+
sessionEnd: true,
|
|
82
|
+
},
|
|
83
|
+
}, null, 2);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Run full environment setup. */
|
|
87
|
+
export function runSetup(opts: SetupOptions): SetupResult {
|
|
88
|
+
const steps: SetupStep[] = [];
|
|
89
|
+
const dzDir = join(opts.projectRoot, '.dz');
|
|
90
|
+
|
|
91
|
+
// Step 1: Create .dz directory
|
|
92
|
+
if (!existsSync(dzDir)) {
|
|
93
|
+
mkdirSync(dzDir, { recursive: true });
|
|
94
|
+
steps.push({ name: 'Create .dz directory', status: 'done', detail: dzDir });
|
|
95
|
+
} else {
|
|
96
|
+
steps.push({ name: 'Create .dz directory', status: 'skipped', detail: 'already exists' });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Step 2: Write .dz/config.json
|
|
100
|
+
const configPath = join(dzDir, 'config.json');
|
|
101
|
+
if (!existsSync(configPath) || opts.force) {
|
|
102
|
+
writeFileSync(configPath, generateDzConfig(opts.target, opts.preset));
|
|
103
|
+
steps.push({ name: 'Write .dz/config.json', status: 'done', detail: 'learning + memory config' });
|
|
104
|
+
} else {
|
|
105
|
+
steps.push({ name: 'Write .dz/config.json', status: 'skipped', detail: 'already exists (use --force)' });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Step 3: Initialize session log
|
|
109
|
+
const sessionsPath = join(dzDir, 'sessions.jsonl');
|
|
110
|
+
if (!existsSync(sessionsPath)) {
|
|
111
|
+
writeFileSync(sessionsPath, '');
|
|
112
|
+
steps.push({ name: 'Initialize sessions.jsonl', status: 'done', detail: 'session tracking ready' });
|
|
113
|
+
} else {
|
|
114
|
+
steps.push({ name: 'Initialize sessions.jsonl', status: 'skipped', detail: 'already exists' });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Step 4: Initialize patterns store
|
|
118
|
+
const patternsPath = join(dzDir, 'patterns.jsonl');
|
|
119
|
+
if (!existsSync(patternsPath)) {
|
|
120
|
+
writeFileSync(patternsPath, '');
|
|
121
|
+
steps.push({ name: 'Initialize patterns.jsonl', status: 'done', detail: 'pattern learning ready' });
|
|
122
|
+
} else {
|
|
123
|
+
steps.push({ name: 'Initialize patterns.jsonl', status: 'skipped', detail: 'already exists' });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Step 5: Configure hooks (write to .claude/settings.json)
|
|
127
|
+
if (!opts.noHooks) {
|
|
128
|
+
const settingsDir = join(opts.projectRoot, '.claude');
|
|
129
|
+
const settingsPath = join(settingsDir, 'settings.json');
|
|
130
|
+
|
|
131
|
+
if (!existsSync(settingsPath) || opts.force) {
|
|
132
|
+
mkdirSync(settingsDir, { recursive: true });
|
|
133
|
+
writeFileSync(settingsPath, generateHooksConfig(opts.projectRoot));
|
|
134
|
+
steps.push({ name: 'Configure hooks', status: 'done', detail: 'session-start + session-end hooks' });
|
|
135
|
+
} else {
|
|
136
|
+
// Merge hooks into existing settings
|
|
137
|
+
try {
|
|
138
|
+
const existing = JSON.parse(readFileSync(settingsPath, 'utf-8')) as Record<string, unknown>;
|
|
139
|
+
if (!existing['hooks']) {
|
|
140
|
+
const hooks = JSON.parse(generateHooksConfig(opts.projectRoot));
|
|
141
|
+
existing['hooks'] = hooks.hooks;
|
|
142
|
+
writeFileSync(settingsPath, JSON.stringify(existing, null, 2));
|
|
143
|
+
steps.push({ name: 'Configure hooks', status: 'done', detail: 'merged into existing settings' });
|
|
144
|
+
} else {
|
|
145
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: 'hooks already configured' });
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: 'could not parse existing settings' });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
steps.push({ name: 'Configure hooks', status: 'skipped', detail: '--no-hooks' });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Step 6: Update .gitignore
|
|
156
|
+
const gitignorePath = join(opts.projectRoot, '.gitignore');
|
|
157
|
+
const dzIgnoreEntry = '\n# DZ Harness learning data\n.dz/sessions.jsonl\n.dz/patterns.jsonl\n';
|
|
158
|
+
if (existsSync(gitignorePath)) {
|
|
159
|
+
const content = readFileSync(gitignorePath, 'utf-8');
|
|
160
|
+
if (!content.includes('.dz/sessions.jsonl')) {
|
|
161
|
+
writeFileSync(gitignorePath, content + dzIgnoreEntry);
|
|
162
|
+
steps.push({ name: 'Update .gitignore', status: 'done', detail: 'added .dz/sessions.jsonl + patterns.jsonl' });
|
|
163
|
+
} else {
|
|
164
|
+
steps.push({ name: 'Update .gitignore', status: 'skipped', detail: 'already ignoring .dz data' });
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
writeFileSync(gitignorePath, dzIgnoreEntry);
|
|
168
|
+
steps.push({ name: 'Create .gitignore', status: 'done', detail: 'with .dz entries' });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
steps,
|
|
173
|
+
totalSteps: steps.length,
|
|
174
|
+
completed: steps.filter((s) => s.status === 'done').length,
|
|
175
|
+
skipped: steps.filter((s) => s.status === 'skipped').length,
|
|
176
|
+
};
|
|
177
|
+
}
|