@dzhechkov/harness-core 0.3.7 → 0.3.8
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/recommend.d.ts +51 -0
- package/dist/recommend.d.ts.map +1 -0
- package/dist/recommend.js +160 -0
- package/dist/recommend.js.map +1 -0
- package/package.json +5 -5
- package/src/index.ts +2 -0
- package/src/recommend.ts +209 -0
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { checkUpstream, loadSourcesManifest } from './sync-upstream.js';
|
|
|
16
16
|
export type { SyncUpstreamReport, UpstreamCheckResult, SourcesManifest } from './sync-upstream.js';
|
|
17
17
|
export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
18
18
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
19
|
+
export { recommend } from './recommend.js';
|
|
20
|
+
export type { RecommendationReport, SkillRecommendation } from './recommend.js';
|
|
19
21
|
export { discoverPackages, publishPackages } from './publish.js';
|
|
20
22
|
export { fetchAllDownloads } from './downloads.js';
|
|
21
23
|
export type { PackageDownloads, DownloadsReport } from './downloads.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,CA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E,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACnG,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,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChF,YAAY,EAAE,aAAa,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
|
@@ -14,6 +14,7 @@ export { createSkill } from './create-skill.js';
|
|
|
14
14
|
export { checkUpstream, loadSourcesManifest } from './sync-upstream.js';
|
|
15
15
|
export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
16
16
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
17
|
+
export { recommend } from './recommend.js';
|
|
17
18
|
export { discoverPackages, publishPackages } from './publish.js';
|
|
18
19
|
export { fetchAllDownloads } from './downloads.js';
|
|
19
20
|
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,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAExE,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,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"}
|
|
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,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAExE,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;AAE3C,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task recommender — decomposes a user task into harness capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Maps a natural-language task description against the full inventory of
|
|
5
|
+
* commands (23), skills (59), presets (10), and targets (5) to produce
|
|
6
|
+
* a step-by-step plan using existing harness features.
|
|
7
|
+
*
|
|
8
|
+
* This module is deterministic (no LLM) — it uses topic extraction,
|
|
9
|
+
* weighted scoring, and capability matching. The knowledge base is
|
|
10
|
+
* auto-generated from the registry at runtime, so it stays current
|
|
11
|
+
* as new skills/commands are added.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import type { Registry } from './registry.js';
|
|
16
|
+
/** A recommended skill with relevance score. */
|
|
17
|
+
export interface SkillRecommendation {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly pack: string;
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly category: string;
|
|
22
|
+
readonly score: number;
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
}
|
|
25
|
+
/** A recommended CLI command. */
|
|
26
|
+
export interface CommandRecommendation {
|
|
27
|
+
readonly command: string;
|
|
28
|
+
readonly description: string;
|
|
29
|
+
readonly example: string;
|
|
30
|
+
readonly phase: string;
|
|
31
|
+
}
|
|
32
|
+
/** A recommended preset. */
|
|
33
|
+
export interface PresetRecommendation {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly skills: number;
|
|
36
|
+
readonly coverage: number;
|
|
37
|
+
readonly matchedSkills: string[];
|
|
38
|
+
}
|
|
39
|
+
/** Full recommendation report. */
|
|
40
|
+
export interface RecommendationReport {
|
|
41
|
+
readonly task: string;
|
|
42
|
+
readonly topics: readonly string[];
|
|
43
|
+
readonly skills: readonly SkillRecommendation[];
|
|
44
|
+
readonly presets: readonly PresetRecommendation[];
|
|
45
|
+
readonly commands: readonly CommandRecommendation[];
|
|
46
|
+
readonly installCommand: string;
|
|
47
|
+
readonly plan: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
/** Generate recommendation from a task and registry. */
|
|
50
|
+
export declare function recommend(task: string, registry: Registry): RecommendationReport;
|
|
51
|
+
//# sourceMappingURL=recommend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../src/recommend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,eAAe,CAAC;AAE7D,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,4BAA4B;AAC5B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACpD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AA0FD,wDAAwD;AACxD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,oBAAoB,CAiEhF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task recommender — decomposes a user task into harness capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Maps a natural-language task description against the full inventory of
|
|
5
|
+
* commands (23), skills (59), presets (10), and targets (5) to produce
|
|
6
|
+
* a step-by-step plan using existing harness features.
|
|
7
|
+
*
|
|
8
|
+
* This module is deterministic (no LLM) — it uses topic extraction,
|
|
9
|
+
* weighted scoring, and capability matching. The knowledge base is
|
|
10
|
+
* auto-generated from the registry at runtime, so it stays current
|
|
11
|
+
* as new skills/commands are added.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
/** Topic → keywords mapping for task decomposition. */
|
|
16
|
+
const TOPIC_KEYWORDS = {
|
|
17
|
+
'api': ['api', 'rest', 'graphql', 'endpoint', 'openapi', 'swagger', 'http', 'grpc'],
|
|
18
|
+
'testing': ['test', 'testing', 'tdd', 'unit test', 'integration test', 'e2e', 'coverage', 'spec'],
|
|
19
|
+
'ci-cd': ['ci', 'cd', 'pipeline', 'github actions', 'gitlab', 'jenkins', 'deploy', 'build'],
|
|
20
|
+
'security': ['security', 'audit', 'vulnerability', 'owasp', 'injection', 'auth', 'codeql', 'sast'],
|
|
21
|
+
'database': ['database', 'migration', 'schema', 'sql', 'postgres', 'mysql', 'query', 'index'],
|
|
22
|
+
'kubernetes': ['kubernetes', 'k8s', 'helm', 'pod', 'deployment', 'container', 'cluster', 'service mesh'],
|
|
23
|
+
'docker': ['docker', 'compose', 'container', 'dockerfile', 'image', 'registry'],
|
|
24
|
+
'terraform': ['terraform', 'iac', 'infrastructure', 'cloud', 'aws', 'gcp', 'azure', 'provision'],
|
|
25
|
+
'monitoring': ['monitoring', 'observability', 'metrics', 'logs', 'traces', 'alerting', 'slo', 'grafana', 'prometheus'],
|
|
26
|
+
'incident': ['incident', 'outage', 'postmortem', 'oncall', 'pagerduty', 'sev1', 'downtime'],
|
|
27
|
+
'monorepo': ['monorepo', 'workspace', 'pnpm', 'turborepo', 'nx', 'changeset', 'lerna'],
|
|
28
|
+
'review': ['review', 'pr', 'pull request', 'code review', 'merge'],
|
|
29
|
+
'debug': ['debug', 'error', 'crash', 'stack trace', 'bug', 'fix', 'troubleshoot'],
|
|
30
|
+
'frontend': ['frontend', 'react', 'vue', 'component', 'ui', 'css', 'tailwind'],
|
|
31
|
+
'git': ['git', 'merge', 'rebase', 'conflict', 'branch', 'cherry-pick'],
|
|
32
|
+
'web3': ['web3', 'blockchain', 'defi', 'crypto', 'ethereum', 'solana', 'nft', 'token', 'swap', 'wallet'],
|
|
33
|
+
'search': ['search', 'brave', 'exa', 'web search', 'find information'],
|
|
34
|
+
'email': ['email', 'gmail', 'inbox', 'send email', 'mail'],
|
|
35
|
+
'productivity': ['sheets', 'calendar', 'tasks', 'todo', 'schedule', 'meeting', 'clickup', 'project management'],
|
|
36
|
+
'data': ['data', 'etl', 'elt', 'pipeline', 'transform', 'dbt', 'airflow', 'warehouse'],
|
|
37
|
+
'social': ['farcaster', 'reddit', 'social', 'community'],
|
|
38
|
+
'research': ['research', 'explore', 'casarium', 'competitor', 'market', 'analysis'],
|
|
39
|
+
'docs': ['documentation', 'docs', 'context7', 'library', 'reference'],
|
|
40
|
+
'scrape': ['scrape', 'crawl', 'extract', 'jina', 'content', 'markdown'],
|
|
41
|
+
};
|
|
42
|
+
/** Command knowledge base — what each command does and when to use it. */
|
|
43
|
+
const COMMAND_KB = [
|
|
44
|
+
{ command: 'dz init', description: 'Install skills for your platform', example: 'dz init --target claude-code --preset devops', phase: 'Install', topics: ['install', 'setup', 'init'] },
|
|
45
|
+
{ command: 'dz install', description: 'Install skills from npm package', example: 'dz install @dzhechkov/skills-devops', phase: 'Install', topics: ['install', 'npm'] },
|
|
46
|
+
{ command: 'dz verify', description: 'Verify installed skills structure', example: 'dz verify', phase: 'Install', topics: ['verify', 'check', 'validate'] },
|
|
47
|
+
{ command: 'dz doctor', description: 'Run health checks', example: 'dz doctor', phase: 'Install', topics: ['health', 'check', 'diagnose'] },
|
|
48
|
+
{ command: 'dz registry', description: 'Browse all available skills', example: 'dz registry search kubernetes', phase: 'Discover', topics: ['find', 'browse', 'search', 'discover'] },
|
|
49
|
+
{ command: 'dz benchmark', description: 'Benchmark skill quality (L0)', example: 'dz benchmark <skill-dir> --all', phase: 'Create', topics: ['quality', 'benchmark', 'test', 'grade'] },
|
|
50
|
+
{ command: 'dz create-skill', description: 'Scaffold a new skill', example: 'dz create-skill --name my-skill --bto', phase: 'Create', topics: ['create', 'new', 'scaffold'] },
|
|
51
|
+
{ command: 'dz scout', description: 'Scan ecosystem for new skills', example: 'dz scout --deep', phase: 'Create', topics: ['find', 'ecosystem', 'discover', 'scan'] },
|
|
52
|
+
{ command: 'dz upgrade', description: 'Check installed skills for updates', example: 'dz upgrade', phase: 'Maintain', topics: ['update', 'upgrade', 'refresh'] },
|
|
53
|
+
{ command: 'dz sync-upstream', description: 'Check upstream for changes', example: 'dz sync-upstream --package <dir>', phase: 'Maintain', topics: ['sync', 'upstream', 'update'] },
|
|
54
|
+
{ command: 'dz publish', description: 'Publish packages to npm', example: 'dz publish --filter skills-devops', phase: 'Share', topics: ['publish', 'npm', 'release'] },
|
|
55
|
+
{ command: 'dz downloads', description: 'npm download statistics', example: 'dz downloads', phase: 'Discover', topics: ['stats', 'downloads', 'metrics'] },
|
|
56
|
+
{ command: 'dz workflow', description: 'Run dynamic workflow', example: 'dz workflow --task coverage-lift', phase: 'Maintain', topics: ['workflow', 'coverage', 'mutation', 'security'] },
|
|
57
|
+
{ command: 'dz dashboard', description: 'Visual overview of all packages', example: 'dz dashboard', phase: 'Discover', topics: ['overview', 'status', 'dashboard'] },
|
|
58
|
+
];
|
|
59
|
+
/** Preset knowledge base. */
|
|
60
|
+
const PRESET_KB = [
|
|
61
|
+
{ name: 'devops', skills: ['api-design', 'pr-review', 'security-audit', 'test-writer', 'ci-fix', 'codeql-fix', 'database-review', 'debugging', 'frontend-implementation', 'git-conflict-resolve', 'provider-debug', 'incident-response', 'monorepo-management', 'data-pipeline', 'docker-compose', 'terraform', 'kubernetes', 'github-actions', 'observability', 'database-migration'], topics: ['api', 'testing', 'ci-cd', 'security', 'database', 'kubernetes', 'docker', 'terraform', 'monitoring', 'incident', 'monorepo', 'review', 'debug', 'frontend', 'git', 'data'] },
|
|
62
|
+
{ name: 'web3', skills: ['quicknode', 'zerion', 'symbiosis', 'ens-primary-name', 'erc-8004', 'veil', 'neynar', 'trails', 'bankr', 'siwa', 'hydrex', 'quotient'], topics: ['web3', 'blockchain', 'defi', 'crypto'] },
|
|
63
|
+
{ name: 'mcp', skills: ['brave-search', 'exa-search', 'gmail', 'google-sheets', 'google-calendar', 'google-tasks', 'clickup', 'reddit', 'jina-reader', 'context7'], topics: ['search', 'email', 'productivity', 'social', 'docs', 'scrape'] },
|
|
64
|
+
{ name: 'qe-engineer', skills: ['qe-test-generation', 'qe-test-execution', 'qe-coverage-analysis', 'qe-quality-assessment', 'qe-requirements-validation', 'qe-defect-intelligence', 'qe-iterative-loop', 'qe-chaos-resilience'], topics: ['testing', 'quality', 'coverage'] },
|
|
65
|
+
{ name: 'meta', skills: ['explore', 'feature-adr', 'knowledge-extractor'], topics: ['research', 'explore'] },
|
|
66
|
+
{ name: 'keysarium', skills: ['explore', 'feature-adr', 'knowledge-extractor', 'problem-solver-enhanced', 'analyst-manual-full'], topics: ['research', 'explore', 'analysis'] },
|
|
67
|
+
{ name: 'health', skills: ['drug-interaction-checker', 'clinical-diagnostic-reasoning', 'lab-results'], topics: ['health', 'medical', 'clinical'] },
|
|
68
|
+
{ name: 'bto', skills: ['bto'], topics: ['benchmark', 'quality', 'test'] },
|
|
69
|
+
{ name: 'p-replicator', skills: ['explore', 'reverse-engineering-unicorn', 'sparc-prd-mini'], topics: ['product', 'replicate', 'prd'] },
|
|
70
|
+
{ name: 'feature-adr', skills: ['explore', 'feature-adr', 'knowledge-extractor', 'problem-solver-enhanced', 'frontend-design'], topics: ['feature', 'adr', 'architecture'] },
|
|
71
|
+
];
|
|
72
|
+
/** Extract topics from a task description. */
|
|
73
|
+
function extractTopics(task) {
|
|
74
|
+
const lower = task.toLowerCase();
|
|
75
|
+
const matched = [];
|
|
76
|
+
for (const [topic, keywords] of Object.entries(TOPIC_KEYWORDS)) {
|
|
77
|
+
for (const kw of keywords) {
|
|
78
|
+
if (lower.includes(kw)) {
|
|
79
|
+
matched.push(topic);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return matched.length > 0 ? matched : ['general'];
|
|
85
|
+
}
|
|
86
|
+
/** Score a skill against extracted topics. */
|
|
87
|
+
function scoreSkill(entry, topics) {
|
|
88
|
+
const lower = `${entry.id} ${entry.description} ${entry.category}`.toLowerCase();
|
|
89
|
+
let score = 0;
|
|
90
|
+
for (const topic of topics) {
|
|
91
|
+
const keywords = TOPIC_KEYWORDS[topic] ?? [topic];
|
|
92
|
+
for (const kw of keywords) {
|
|
93
|
+
if (lower.includes(kw)) {
|
|
94
|
+
score += 10;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return score;
|
|
100
|
+
}
|
|
101
|
+
/** Generate recommendation from a task and registry. */
|
|
102
|
+
export function recommend(task, registry) {
|
|
103
|
+
const topics = extractTopics(task);
|
|
104
|
+
// Score and rank skills
|
|
105
|
+
const scored = registry.entries
|
|
106
|
+
.map((e) => ({ entry: e, score: scoreSkill(e, topics) }))
|
|
107
|
+
.filter((s) => s.score > 0)
|
|
108
|
+
.sort((a, b) => b.score - a.score);
|
|
109
|
+
const skills = scored.slice(0, 10).map((s) => ({
|
|
110
|
+
id: s.entry.id,
|
|
111
|
+
pack: s.entry.pack,
|
|
112
|
+
description: s.entry.description,
|
|
113
|
+
category: s.entry.category,
|
|
114
|
+
score: s.score,
|
|
115
|
+
reason: `Matches topics: ${topics.filter((t) => scoreSkill(s.entry, [t]) > 0).join(', ')}`,
|
|
116
|
+
}));
|
|
117
|
+
// Score presets
|
|
118
|
+
const presetScores = PRESET_KB.map((p) => {
|
|
119
|
+
const matchedTopics = topics.filter((t) => p.topics.includes(t));
|
|
120
|
+
const matchedSkills = skills.filter((s) => p.skills.includes(s.id)).map((s) => s.id);
|
|
121
|
+
return {
|
|
122
|
+
name: p.name,
|
|
123
|
+
skills: p.skills.length,
|
|
124
|
+
coverage: matchedTopics.length,
|
|
125
|
+
matchedSkills,
|
|
126
|
+
};
|
|
127
|
+
}).filter((p) => p.coverage > 0 || p.matchedSkills.length > 0)
|
|
128
|
+
.sort((a, b) => (b.coverage + b.matchedSkills.length) - (a.coverage + a.matchedSkills.length));
|
|
129
|
+
const presets = presetScores.slice(0, 3);
|
|
130
|
+
// Recommend commands based on topics
|
|
131
|
+
const commands = COMMAND_KB
|
|
132
|
+
.filter((c) => c.topics.some((t) => topics.includes(t)) || c.command === 'dz init')
|
|
133
|
+
.slice(0, 6)
|
|
134
|
+
.map((c) => ({ command: c.command, description: c.description, example: c.example, phase: c.phase }));
|
|
135
|
+
// Generate install command
|
|
136
|
+
const topPreset = presets[0];
|
|
137
|
+
const topSkillIds = skills.slice(0, 5).map((s) => s.id);
|
|
138
|
+
const installCommand = topPreset
|
|
139
|
+
? `dz init --target claude-code --preset ${topPreset.name}`
|
|
140
|
+
: `dz init --target claude-code --select ${topSkillIds.join(',')}`;
|
|
141
|
+
// Generate step-by-step plan
|
|
142
|
+
const plan = [];
|
|
143
|
+
plan.push(`1. Install: ${installCommand}`);
|
|
144
|
+
plan.push(`2. Verify: dz verify && dz doctor`);
|
|
145
|
+
if (skills.length > 0) {
|
|
146
|
+
plan.push(`3. Key skills: ${skills.slice(0, 5).map((s) => s.id).join(', ')}`);
|
|
147
|
+
}
|
|
148
|
+
if (topics.includes('testing') || topics.includes('security')) {
|
|
149
|
+
plan.push(`4. Quality: dz benchmark --all (L0 gate) → /bto-test (L1/L2 judges)`);
|
|
150
|
+
}
|
|
151
|
+
if (topics.includes('ci-cd')) {
|
|
152
|
+
plan.push(`4. CI/CD: Use github-actions skill for pipeline setup`);
|
|
153
|
+
}
|
|
154
|
+
if (topics.includes('monitoring') || topics.includes('incident')) {
|
|
155
|
+
plan.push(`5. Ops: observability skill for monitoring + incident-response for runbooks`);
|
|
156
|
+
}
|
|
157
|
+
plan.push(`${plan.length + 1}. Use your agent normally — skills auto-activate on matching tasks`);
|
|
158
|
+
return { task, topics, skills, presets, commands, installCommand, plan };
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=recommend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommend.js","sourceRoot":"","sources":["../src/recommend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAy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UAAU,CAAC,EAAE,CAAC;QAC9D,IAAI,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjE,IAAI,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAElG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAC3E,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.8",
|
|
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",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"yaml": "^2.0.0",
|
|
28
|
-
"@dzhechkov/adapter-claude": "0.2.0",
|
|
29
28
|
"@dzhechkov/adapter-codex": "0.2.0",
|
|
30
|
-
"@dzhechkov/adapter-
|
|
31
|
-
"@dzhechkov/adapter-opencode": "0.2.0",
|
|
29
|
+
"@dzhechkov/adapter-claude": "0.2.0",
|
|
32
30
|
"@dzhechkov/adapter-openclaude": "0.1.0",
|
|
33
|
-
"@dzhechkov/
|
|
31
|
+
"@dzhechkov/adapter-opencode": "0.2.0",
|
|
32
|
+
"@dzhechkov/core": "0.2.0",
|
|
33
|
+
"@dzhechkov/adapter-hermes": "0.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.6.0",
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { checkUpstream, loadSourcesManifest } from './sync-upstream.js';
|
|
|
18
18
|
export type { SyncUpstreamReport, UpstreamCheckResult, SourcesManifest } from './sync-upstream.js';
|
|
19
19
|
export { benchmarkSkill, benchmarkSkills, compareSkills } from './benchmark.js';
|
|
20
20
|
export { buildRegistry, searchRegistry, filterByCategory } from './registry.js';
|
|
21
|
+
export { recommend } from './recommend.js';
|
|
22
|
+
export type { RecommendationReport, SkillRecommendation } from './recommend.js';
|
|
21
23
|
export { discoverPackages, publishPackages } from './publish.js';
|
|
22
24
|
export { fetchAllDownloads } from './downloads.js';
|
|
23
25
|
export type { PackageDownloads, DownloadsReport } from './downloads.js';
|
package/src/recommend.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task recommender — decomposes a user task into harness capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Maps a natural-language task description against the full inventory of
|
|
5
|
+
* commands (23), skills (59), presets (10), and targets (5) to produce
|
|
6
|
+
* a step-by-step plan using existing harness features.
|
|
7
|
+
*
|
|
8
|
+
* This module is deterministic (no LLM) — it uses topic extraction,
|
|
9
|
+
* weighted scoring, and capability matching. The knowledge base is
|
|
10
|
+
* auto-generated from the registry at runtime, so it stays current
|
|
11
|
+
* as new skills/commands are added.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { Registry, RegistryEntry } from './registry.js';
|
|
17
|
+
|
|
18
|
+
/** A recommended skill with relevance score. */
|
|
19
|
+
export interface SkillRecommendation {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly pack: string;
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly category: string;
|
|
24
|
+
readonly score: number;
|
|
25
|
+
readonly reason: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A recommended CLI command. */
|
|
29
|
+
export interface CommandRecommendation {
|
|
30
|
+
readonly command: string;
|
|
31
|
+
readonly description: string;
|
|
32
|
+
readonly example: string;
|
|
33
|
+
readonly phase: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A recommended preset. */
|
|
37
|
+
export interface PresetRecommendation {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly skills: number;
|
|
40
|
+
readonly coverage: number;
|
|
41
|
+
readonly matchedSkills: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Full recommendation report. */
|
|
45
|
+
export interface RecommendationReport {
|
|
46
|
+
readonly task: string;
|
|
47
|
+
readonly topics: readonly string[];
|
|
48
|
+
readonly skills: readonly SkillRecommendation[];
|
|
49
|
+
readonly presets: readonly PresetRecommendation[];
|
|
50
|
+
readonly commands: readonly CommandRecommendation[];
|
|
51
|
+
readonly installCommand: string;
|
|
52
|
+
readonly plan: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Topic → keywords mapping for task decomposition. */
|
|
56
|
+
const TOPIC_KEYWORDS: Record<string, string[]> = {
|
|
57
|
+
'api': ['api', 'rest', 'graphql', 'endpoint', 'openapi', 'swagger', 'http', 'grpc'],
|
|
58
|
+
'testing': ['test', 'testing', 'tdd', 'unit test', 'integration test', 'e2e', 'coverage', 'spec'],
|
|
59
|
+
'ci-cd': ['ci', 'cd', 'pipeline', 'github actions', 'gitlab', 'jenkins', 'deploy', 'build'],
|
|
60
|
+
'security': ['security', 'audit', 'vulnerability', 'owasp', 'injection', 'auth', 'codeql', 'sast'],
|
|
61
|
+
'database': ['database', 'migration', 'schema', 'sql', 'postgres', 'mysql', 'query', 'index'],
|
|
62
|
+
'kubernetes': ['kubernetes', 'k8s', 'helm', 'pod', 'deployment', 'container', 'cluster', 'service mesh'],
|
|
63
|
+
'docker': ['docker', 'compose', 'container', 'dockerfile', 'image', 'registry'],
|
|
64
|
+
'terraform': ['terraform', 'iac', 'infrastructure', 'cloud', 'aws', 'gcp', 'azure', 'provision'],
|
|
65
|
+
'monitoring': ['monitoring', 'observability', 'metrics', 'logs', 'traces', 'alerting', 'slo', 'grafana', 'prometheus'],
|
|
66
|
+
'incident': ['incident', 'outage', 'postmortem', 'oncall', 'pagerduty', 'sev1', 'downtime'],
|
|
67
|
+
'monorepo': ['monorepo', 'workspace', 'pnpm', 'turborepo', 'nx', 'changeset', 'lerna'],
|
|
68
|
+
'review': ['review', 'pr', 'pull request', 'code review', 'merge'],
|
|
69
|
+
'debug': ['debug', 'error', 'crash', 'stack trace', 'bug', 'fix', 'troubleshoot'],
|
|
70
|
+
'frontend': ['frontend', 'react', 'vue', 'component', 'ui', 'css', 'tailwind'],
|
|
71
|
+
'git': ['git', 'merge', 'rebase', 'conflict', 'branch', 'cherry-pick'],
|
|
72
|
+
'web3': ['web3', 'blockchain', 'defi', 'crypto', 'ethereum', 'solana', 'nft', 'token', 'swap', 'wallet'],
|
|
73
|
+
'search': ['search', 'brave', 'exa', 'web search', 'find information'],
|
|
74
|
+
'email': ['email', 'gmail', 'inbox', 'send email', 'mail'],
|
|
75
|
+
'productivity': ['sheets', 'calendar', 'tasks', 'todo', 'schedule', 'meeting', 'clickup', 'project management'],
|
|
76
|
+
'data': ['data', 'etl', 'elt', 'pipeline', 'transform', 'dbt', 'airflow', 'warehouse'],
|
|
77
|
+
'social': ['farcaster', 'reddit', 'social', 'community'],
|
|
78
|
+
'research': ['research', 'explore', 'casarium', 'competitor', 'market', 'analysis'],
|
|
79
|
+
'docs': ['documentation', 'docs', 'context7', 'library', 'reference'],
|
|
80
|
+
'scrape': ['scrape', 'crawl', 'extract', 'jina', 'content', 'markdown'],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Command knowledge base — what each command does and when to use it. */
|
|
84
|
+
const COMMAND_KB: { command: string; description: string; example: string; phase: string; topics: string[] }[] = [
|
|
85
|
+
{ command: 'dz init', description: 'Install skills for your platform', example: 'dz init --target claude-code --preset devops', phase: 'Install', topics: ['install', 'setup', 'init'] },
|
|
86
|
+
{ command: 'dz install', description: 'Install skills from npm package', example: 'dz install @dzhechkov/skills-devops', phase: 'Install', topics: ['install', 'npm'] },
|
|
87
|
+
{ command: 'dz verify', description: 'Verify installed skills structure', example: 'dz verify', phase: 'Install', topics: ['verify', 'check', 'validate'] },
|
|
88
|
+
{ command: 'dz doctor', description: 'Run health checks', example: 'dz doctor', phase: 'Install', topics: ['health', 'check', 'diagnose'] },
|
|
89
|
+
{ command: 'dz registry', description: 'Browse all available skills', example: 'dz registry search kubernetes', phase: 'Discover', topics: ['find', 'browse', 'search', 'discover'] },
|
|
90
|
+
{ command: 'dz benchmark', description: 'Benchmark skill quality (L0)', example: 'dz benchmark <skill-dir> --all', phase: 'Create', topics: ['quality', 'benchmark', 'test', 'grade'] },
|
|
91
|
+
{ command: 'dz create-skill', description: 'Scaffold a new skill', example: 'dz create-skill --name my-skill --bto', phase: 'Create', topics: ['create', 'new', 'scaffold'] },
|
|
92
|
+
{ command: 'dz scout', description: 'Scan ecosystem for new skills', example: 'dz scout --deep', phase: 'Create', topics: ['find', 'ecosystem', 'discover', 'scan'] },
|
|
93
|
+
{ command: 'dz upgrade', description: 'Check installed skills for updates', example: 'dz upgrade', phase: 'Maintain', topics: ['update', 'upgrade', 'refresh'] },
|
|
94
|
+
{ command: 'dz sync-upstream', description: 'Check upstream for changes', example: 'dz sync-upstream --package <dir>', phase: 'Maintain', topics: ['sync', 'upstream', 'update'] },
|
|
95
|
+
{ command: 'dz publish', description: 'Publish packages to npm', example: 'dz publish --filter skills-devops', phase: 'Share', topics: ['publish', 'npm', 'release'] },
|
|
96
|
+
{ command: 'dz downloads', description: 'npm download statistics', example: 'dz downloads', phase: 'Discover', topics: ['stats', 'downloads', 'metrics'] },
|
|
97
|
+
{ command: 'dz workflow', description: 'Run dynamic workflow', example: 'dz workflow --task coverage-lift', phase: 'Maintain', topics: ['workflow', 'coverage', 'mutation', 'security'] },
|
|
98
|
+
{ command: 'dz dashboard', description: 'Visual overview of all packages', example: 'dz dashboard', phase: 'Discover', topics: ['overview', 'status', 'dashboard'] },
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
/** Preset knowledge base. */
|
|
102
|
+
const PRESET_KB: { name: string; skills: string[]; topics: string[] }[] = [
|
|
103
|
+
{ name: 'devops', skills: ['api-design', 'pr-review', 'security-audit', 'test-writer', 'ci-fix', 'codeql-fix', 'database-review', 'debugging', 'frontend-implementation', 'git-conflict-resolve', 'provider-debug', 'incident-response', 'monorepo-management', 'data-pipeline', 'docker-compose', 'terraform', 'kubernetes', 'github-actions', 'observability', 'database-migration'], topics: ['api', 'testing', 'ci-cd', 'security', 'database', 'kubernetes', 'docker', 'terraform', 'monitoring', 'incident', 'monorepo', 'review', 'debug', 'frontend', 'git', 'data'] },
|
|
104
|
+
{ name: 'web3', skills: ['quicknode', 'zerion', 'symbiosis', 'ens-primary-name', 'erc-8004', 'veil', 'neynar', 'trails', 'bankr', 'siwa', 'hydrex', 'quotient'], topics: ['web3', 'blockchain', 'defi', 'crypto'] },
|
|
105
|
+
{ name: 'mcp', skills: ['brave-search', 'exa-search', 'gmail', 'google-sheets', 'google-calendar', 'google-tasks', 'clickup', 'reddit', 'jina-reader', 'context7'], topics: ['search', 'email', 'productivity', 'social', 'docs', 'scrape'] },
|
|
106
|
+
{ name: 'qe-engineer', skills: ['qe-test-generation', 'qe-test-execution', 'qe-coverage-analysis', 'qe-quality-assessment', 'qe-requirements-validation', 'qe-defect-intelligence', 'qe-iterative-loop', 'qe-chaos-resilience'], topics: ['testing', 'quality', 'coverage'] },
|
|
107
|
+
{ name: 'meta', skills: ['explore', 'feature-adr', 'knowledge-extractor'], topics: ['research', 'explore'] },
|
|
108
|
+
{ name: 'keysarium', skills: ['explore', 'feature-adr', 'knowledge-extractor', 'problem-solver-enhanced', 'analyst-manual-full'], topics: ['research', 'explore', 'analysis'] },
|
|
109
|
+
{ name: 'health', skills: ['drug-interaction-checker', 'clinical-diagnostic-reasoning', 'lab-results'], topics: ['health', 'medical', 'clinical'] },
|
|
110
|
+
{ name: 'bto', skills: ['bto'], topics: ['benchmark', 'quality', 'test'] },
|
|
111
|
+
{ name: 'p-replicator', skills: ['explore', 'reverse-engineering-unicorn', 'sparc-prd-mini'], topics: ['product', 'replicate', 'prd'] },
|
|
112
|
+
{ name: 'feature-adr', skills: ['explore', 'feature-adr', 'knowledge-extractor', 'problem-solver-enhanced', 'frontend-design'], topics: ['feature', 'adr', 'architecture'] },
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
/** Extract topics from a task description. */
|
|
116
|
+
function extractTopics(task: string): string[] {
|
|
117
|
+
const lower = task.toLowerCase();
|
|
118
|
+
const matched: string[] = [];
|
|
119
|
+
for (const [topic, keywords] of Object.entries(TOPIC_KEYWORDS)) {
|
|
120
|
+
for (const kw of keywords) {
|
|
121
|
+
if (lower.includes(kw)) {
|
|
122
|
+
matched.push(topic);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return matched.length > 0 ? matched : ['general'];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Score a skill against extracted topics. */
|
|
131
|
+
function scoreSkill(entry: RegistryEntry, topics: string[]): number {
|
|
132
|
+
const lower = `${entry.id} ${entry.description} ${entry.category}`.toLowerCase();
|
|
133
|
+
let score = 0;
|
|
134
|
+
for (const topic of topics) {
|
|
135
|
+
const keywords = TOPIC_KEYWORDS[topic] ?? [topic];
|
|
136
|
+
for (const kw of keywords) {
|
|
137
|
+
if (lower.includes(kw)) { score += 10; break; }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return score;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Generate recommendation from a task and registry. */
|
|
144
|
+
export function recommend(task: string, registry: Registry): RecommendationReport {
|
|
145
|
+
const topics = extractTopics(task);
|
|
146
|
+
|
|
147
|
+
// Score and rank skills
|
|
148
|
+
const scored = registry.entries
|
|
149
|
+
.map((e) => ({ entry: e, score: scoreSkill(e, topics) }))
|
|
150
|
+
.filter((s) => s.score > 0)
|
|
151
|
+
.sort((a, b) => b.score - a.score);
|
|
152
|
+
|
|
153
|
+
const skills: SkillRecommendation[] = scored.slice(0, 10).map((s) => ({
|
|
154
|
+
id: s.entry.id,
|
|
155
|
+
pack: s.entry.pack,
|
|
156
|
+
description: s.entry.description,
|
|
157
|
+
category: s.entry.category,
|
|
158
|
+
score: s.score,
|
|
159
|
+
reason: `Matches topics: ${topics.filter((t) => scoreSkill(s.entry, [t]) > 0).join(', ')}`,
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
// Score presets
|
|
163
|
+
const presetScores = PRESET_KB.map((p) => {
|
|
164
|
+
const matchedTopics = topics.filter((t) => p.topics.includes(t));
|
|
165
|
+
const matchedSkills = skills.filter((s) => p.skills.includes(s.id)).map((s) => s.id);
|
|
166
|
+
return {
|
|
167
|
+
name: p.name,
|
|
168
|
+
skills: p.skills.length,
|
|
169
|
+
coverage: matchedTopics.length,
|
|
170
|
+
matchedSkills,
|
|
171
|
+
};
|
|
172
|
+
}).filter((p) => p.coverage > 0 || p.matchedSkills.length > 0)
|
|
173
|
+
.sort((a, b) => (b.coverage + b.matchedSkills.length) - (a.coverage + a.matchedSkills.length));
|
|
174
|
+
|
|
175
|
+
const presets: PresetRecommendation[] = presetScores.slice(0, 3);
|
|
176
|
+
|
|
177
|
+
// Recommend commands based on topics
|
|
178
|
+
const commands: CommandRecommendation[] = COMMAND_KB
|
|
179
|
+
.filter((c) => c.topics.some((t) => topics.includes(t)) || c.command === 'dz init')
|
|
180
|
+
.slice(0, 6)
|
|
181
|
+
.map((c) => ({ command: c.command, description: c.description, example: c.example, phase: c.phase }));
|
|
182
|
+
|
|
183
|
+
// Generate install command
|
|
184
|
+
const topPreset = presets[0];
|
|
185
|
+
const topSkillIds = skills.slice(0, 5).map((s) => s.id);
|
|
186
|
+
const installCommand = topPreset
|
|
187
|
+
? `dz init --target claude-code --preset ${topPreset.name}`
|
|
188
|
+
: `dz init --target claude-code --select ${topSkillIds.join(',')}`;
|
|
189
|
+
|
|
190
|
+
// Generate step-by-step plan
|
|
191
|
+
const plan: string[] = [];
|
|
192
|
+
plan.push(`1. Install: ${installCommand}`);
|
|
193
|
+
plan.push(`2. Verify: dz verify && dz doctor`);
|
|
194
|
+
if (skills.length > 0) {
|
|
195
|
+
plan.push(`3. Key skills: ${skills.slice(0, 5).map((s) => s.id).join(', ')}`);
|
|
196
|
+
}
|
|
197
|
+
if (topics.includes('testing') || topics.includes('security')) {
|
|
198
|
+
plan.push(`4. Quality: dz benchmark --all (L0 gate) → /bto-test (L1/L2 judges)`);
|
|
199
|
+
}
|
|
200
|
+
if (topics.includes('ci-cd')) {
|
|
201
|
+
plan.push(`4. CI/CD: Use github-actions skill for pipeline setup`);
|
|
202
|
+
}
|
|
203
|
+
if (topics.includes('monitoring') || topics.includes('incident')) {
|
|
204
|
+
plan.push(`5. Ops: observability skill for monitoring + incident-response for runbooks`);
|
|
205
|
+
}
|
|
206
|
+
plan.push(`${plan.length + 1}. Use your agent normally — skills auto-activate on matching tasks`);
|
|
207
|
+
|
|
208
|
+
return { task, topics, skills, presets, commands, installCommand, plan };
|
|
209
|
+
}
|