@relipa/ai-flow-kit 0.1.1 → 0.1.2-beta.0
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 +0 -0
- package/bin/aiflow.js +55 -2
- package/bin/ak.js +0 -0
- package/custom/mcp-presets/README.md +204 -237
- package/custom/mcp-presets/backlog.json +0 -0
- package/custom/mcp-presets/figma-desktop.json +0 -0
- package/custom/mcp-presets/figma.json +0 -0
- package/custom/mcp-presets/gitnexus.json +0 -0
- package/custom/mcp-presets/google-sheets.json +0 -0
- package/custom/mcp-presets/jira.json +0 -0
- package/custom/prompts/bug-fix.md +0 -0
- package/custom/prompts/feature.md +0 -0
- package/custom/prompts/investigation.md +0 -0
- package/custom/rules/code-style.md +0 -0
- package/custom/rules/java/code-style.md +0 -0
- package/custom/rules/java/naming.md +0 -0
- package/custom/rules/java/review-checklist.md +0 -0
- package/custom/rules/java/spring-boot-examples.md +0 -0
- package/custom/rules/javascript/code-style.md +0 -0
- package/custom/rules/javascript/naming.md +0 -0
- package/custom/rules/ml-conventions.md +88 -0
- package/custom/rules/ml-review-checklist.md +14 -0
- package/custom/rules/naming.md +0 -0
- package/custom/rules/php/code-style.md +0 -0
- package/custom/rules/php/naming.md +0 -0
- package/custom/rules/project-conventions.md +0 -0
- package/custom/rules/review-checklist.md +0 -0
- package/custom/skills/deploy-model/SKILL.md +90 -0
- package/custom/skills/design-experiment/SKILL.md +88 -0
- package/custom/skills/evaluate-model/SKILL.md +93 -0
- package/custom/skills/explore-data/SKILL.md +87 -0
- package/custom/skills/figma-to-component/SKILL.md +0 -0
- package/custom/skills/frame-ml-problem/SKILL.md +88 -0
- package/custom/skills/generate-spec/SKILL.md +0 -0
- package/custom/skills/impact-analysis/SKILL.md +0 -0
- package/custom/skills/improve-algorithm/SKILL.md +74 -0
- package/custom/skills/investigate-bug/SKILL.md +0 -0
- package/custom/skills/read-study-requirement/SKILL.md +0 -0
- package/custom/skills/report-customer/SKILL.md +0 -0
- package/custom/skills/review-plan/SKILL.md +0 -0
- package/custom/skills/train-model/SKILL.md +78 -0
- package/custom/templates/laravel.md +0 -0
- package/custom/templates/nestjs.md +0 -0
- package/custom/templates/nextjs.md +0 -0
- package/custom/templates/nodejs-express.md +0 -0
- package/custom/templates/php-plain.md +0 -0
- package/custom/templates/php.md +0 -0
- package/custom/templates/python-django.md +0 -0
- package/custom/templates/python-fastapi.md +0 -0
- package/custom/templates/python-ml.md +273 -0
- package/custom/templates/python.md +0 -0
- package/custom/templates/reactjs.md +0 -0
- package/custom/templates/shared/gate-workflow.md +0 -0
- package/custom/templates/shared/ml-gate-workflow.md +103 -0
- package/custom/templates/spring-boot.md +0 -0
- package/custom/templates/tools/claude.md +0 -0
- package/custom/templates/tools/copilot.md +0 -0
- package/custom/templates/tools/cursor.md +0 -0
- package/custom/templates/tools/gemini.md +0 -0
- package/custom/templates/tools/generic.md +0 -0
- package/custom/templates/vue-nuxt.md +0 -0
- package/docs/common/AIFLOW.md +512 -512
- package/docs/common/CHANGELOG.md +0 -0
- package/docs/common/QUICK_START.md +0 -0
- package/docs/common/ai-integration.md +0 -0
- package/docs/common/cli-reference.md +0 -0
- package/docs/common/configuration.md +0 -0
- package/docs/common/getting-started.md +0 -0
- package/docs/common/troubleshooting.md +0 -0
- package/docs/common/workflows/bug-fix.md +0 -0
- package/docs/common/workflows/feature.md +0 -0
- package/docs/common/workflows/figma.md +0 -0
- package/docs/common/workflows/impact-analysis.md +0 -0
- package/docs/common/workflows/investigation.md +0 -0
- package/docs/common/workflows/refactor.md +0 -0
- package/docs/project/ARCHITECTURE.md +0 -0
- package/index.js +0 -0
- package/package.json +1 -1
- package/scripts/checkpoint.js +0 -0
- package/scripts/config.js +0 -0
- package/scripts/context.js +0 -0
- package/scripts/create-score-excel.js +0 -0
- package/scripts/detect.js +239 -239
- package/scripts/doctor.js +192 -218
- package/scripts/gitnexus-worker.js +0 -0
- package/scripts/guide.js +0 -0
- package/scripts/hooks/block-git-write.js +0 -0
- package/scripts/hooks/session-start.js +0 -0
- package/scripts/hooks/session-stop.js +0 -0
- package/scripts/init.js +1112 -1009
- package/scripts/link-resolver.js +0 -0
- package/scripts/memory.js +0 -0
- package/scripts/prompt.js +538 -538
- package/scripts/remove.js +0 -0
- package/scripts/task.js +546 -546
- package/scripts/telemetry/cli.js +0 -0
- package/scripts/telemetry/config.js +0 -0
- package/scripts/telemetry/crypto.js +0 -0
- package/scripts/telemetry/flush.js +0 -0
- package/scripts/telemetry/record.js +0 -0
- package/scripts/update.js +10 -7
- package/scripts/use.js +33 -12
- package/scripts/validate.js +0 -0
- package/upstream/.claude-plugin/marketplace.json +0 -0
- package/upstream/.claude-plugin/plugin.json +0 -0
- package/upstream/.codex/INSTALL.md +0 -0
- package/upstream/.cursor-plugin/plugin.json +0 -0
- package/upstream/.gitattributes +0 -0
- package/upstream/.github/FUNDING.yml +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/config.yml +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +0 -0
- package/upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- package/upstream/.opencode/INSTALL.md +0 -0
- package/upstream/.opencode/plugins/superpowers.js +0 -0
- package/upstream/.version-bump.json +0 -0
- package/upstream/AGENTS.md +0 -0
- package/upstream/CHANGELOG.md +0 -0
- package/upstream/CLAUDE.md +0 -0
- package/upstream/CODE_OF_CONDUCT.md +0 -0
- package/upstream/GEMINI.md +0 -0
- package/upstream/LICENSE +0 -0
- package/upstream/README.md +0 -0
- package/upstream/RELEASE-NOTES.md +0 -0
- package/upstream/agents/code-reviewer.md +0 -0
- package/upstream/commands/brainstorm.md +0 -0
- package/upstream/commands/execute-plan.md +0 -0
- package/upstream/commands/write-plan.md +0 -0
- package/upstream/docs/README.codex.md +0 -0
- package/upstream/docs/README.opencode.md +0 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-design.md +0 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +0 -0
- package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +0 -0
- package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +0 -0
- package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +0 -0
- package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +0 -0
- package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +0 -0
- package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +0 -0
- package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +0 -0
- package/upstream/docs/testing.md +0 -0
- package/upstream/docs/windows/polyglot-hooks.md +0 -0
- package/upstream/gemini-extension.json +0 -0
- package/upstream/hooks/hooks-cursor.json +0 -0
- package/upstream/hooks/hooks.json +0 -0
- package/upstream/hooks/run-hook.cmd +0 -0
- package/upstream/hooks/session-start +0 -0
- package/upstream/package.json +0 -0
- package/upstream/scripts/bump-version.sh +0 -0
- package/upstream/skills/brainstorming/SKILL.md +0 -0
- package/upstream/skills/brainstorming/scripts/frame-template.html +0 -0
- package/upstream/skills/brainstorming/scripts/helper.js +0 -0
- package/upstream/skills/brainstorming/scripts/server.cjs +0 -0
- package/upstream/skills/brainstorming/scripts/start-server.sh +0 -0
- package/upstream/skills/brainstorming/scripts/stop-server.sh +0 -0
- package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
- package/upstream/skills/brainstorming/visual-companion.md +0 -0
- package/upstream/skills/dispatching-parallel-agents/SKILL.md +0 -0
- package/upstream/skills/executing-plans/SKILL.md +0 -0
- package/upstream/skills/finishing-a-development-branch/SKILL.md +0 -0
- package/upstream/skills/receiving-code-review/SKILL.md +0 -0
- package/upstream/skills/requesting-code-review/SKILL.md +0 -0
- package/upstream/skills/requesting-code-review/code-reviewer.md +0 -0
- package/upstream/skills/subagent-driven-development/SKILL.md +0 -0
- package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
- package/upstream/skills/subagent-driven-development/implementer-prompt.md +0 -0
- package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -0
- package/upstream/skills/systematic-debugging/CREATION-LOG.md +0 -0
- package/upstream/skills/systematic-debugging/SKILL.md +0 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +0 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting.md +0 -0
- package/upstream/skills/systematic-debugging/defense-in-depth.md +0 -0
- package/upstream/skills/systematic-debugging/find-polluter.sh +0 -0
- package/upstream/skills/systematic-debugging/root-cause-tracing.md +0 -0
- package/upstream/skills/systematic-debugging/test-academic.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-1.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-2.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-3.md +0 -0
- package/upstream/skills/tdd-lean/SKILL.md +0 -0
- package/upstream/skills/test-driven-development/SKILL.md +0 -0
- package/upstream/skills/test-driven-development/testing-anti-patterns.md +0 -0
- package/upstream/skills/using-git-worktrees/SKILL.md +0 -0
- package/upstream/skills/using-superpowers/SKILL.md +0 -0
- package/upstream/skills/using-superpowers/references/codex-tools.md +0 -0
- package/upstream/skills/using-superpowers/references/copilot-tools.md +0 -0
- package/upstream/skills/using-superpowers/references/gemini-tools.md +0 -0
- package/upstream/skills/verification-before-completion/SKILL.md +0 -0
- package/upstream/skills/writing-plans/SKILL.md +0 -0
- package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +0 -0
- package/upstream/skills/writing-skills/SKILL.md +0 -0
- package/upstream/skills/writing-skills/anthropic-best-practices.md +0 -0
- package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -0
- package/upstream/skills/writing-skills/graphviz-conventions.dot +0 -0
- package/upstream/skills/writing-skills/persuasion-principles.md +0 -0
- package/upstream/skills/writing-skills/render-graphs.js +0 -0
- package/upstream/skills/writing-skills/testing-skills-with-subagents.md +0 -0
- package/upstream/tests/brainstorm-server/package-lock.json +0 -0
- package/upstream/tests/brainstorm-server/package.json +0 -0
- package/upstream/tests/brainstorm-server/server.test.js +0 -0
- package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +0 -0
- package/upstream/tests/brainstorm-server/ws-protocol.test.js +0 -0
- package/upstream/tests/claude-code/README.md +0 -0
- package/upstream/tests/claude-code/analyze-token-usage.py +0 -0
- package/upstream/tests/claude-code/run-skill-tests.sh +0 -0
- package/upstream/tests/claude-code/test-document-review-system.sh +0 -0
- package/upstream/tests/claude-code/test-helpers.sh +0 -0
- package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +0 -0
- package/upstream/tests/claude-code/test-subagent-driven-development.sh +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +0 -0
- package/upstream/tests/explicit-skill-requests/run-all.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-test.sh +0 -0
- package/upstream/tests/opencode/run-tests.sh +0 -0
- package/upstream/tests/opencode/setup.sh +0 -0
- package/upstream/tests/opencode/test-plugin-loading.sh +0 -0
- package/upstream/tests/opencode/test-priority.sh +0 -0
- package/upstream/tests/opencode/test-tools.sh +0 -0
- package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/executing-plans.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/writing-plans.txt +0 -0
- package/upstream/tests/skill-triggering/run-all.sh +0 -0
- package/upstream/tests/skill-triggering/run-test.sh +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/design.md +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +0 -0
- package/upstream/tests/subagent-driven-dev/run-test.sh +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +0 -0
- package/custom/mcp-presets/playwright.json +0 -11
- package/custom/rules/test-patterns.md +0 -105
- package/custom/skills/automation-testing/SKILL.md +0 -168
- package/custom/skills/automation-testing/templates/BasePage.ts +0 -30
- package/custom/skills/automation-testing/templates/playwright.config.ts +0 -21
- package/custom/skills/automation-testing/templates/repos.json +0 -8
- package/scripts/score_members.js +0 -320
package/docs/common/CHANGELOG.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/scripts/checkpoint.js
CHANGED
|
File without changes
|
package/scripts/config.js
CHANGED
|
File without changes
|
package/scripts/context.js
CHANGED
|
File without changes
|
|
File without changes
|
package/scripts/detect.js
CHANGED
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
|
|
3
|
-
class TaskDetector {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.taskTypes = {
|
|
6
|
-
'bug-fix': {
|
|
7
|
-
keywords: [
|
|
8
|
-
'bug', 'error', 'broken', 'crash', 'fail', 'failed', 'failure',
|
|
9
|
-
'issue', 'problem', 'wrong', 'not working', 'doesn\'t work',
|
|
10
|
-
'can\'t', 'cannot', 'regression', 'fixing', 'fix',
|
|
11
|
-
'exception', 'bug report'
|
|
12
|
-
],
|
|
13
|
-
antiKeywords: ['add', 'create', 'new feature', 'build'],
|
|
14
|
-
icon: '🐛',
|
|
15
|
-
description: 'Fixing production issues'
|
|
16
|
-
},
|
|
17
|
-
'feature': {
|
|
18
|
-
keywords: [
|
|
19
|
-
'add', 'create', 'build', 'new', 'implement', 'feature',
|
|
20
|
-
'new feature', 'feature request', 'capability', 'support for',
|
|
21
|
-
'enable', 'make it possible', 'allow', 'user story'
|
|
22
|
-
],
|
|
23
|
-
antiKeywords: ['fix', 'bug', 'broken', 'error'],
|
|
24
|
-
icon: '✨',
|
|
25
|
-
description: 'Building new features'
|
|
26
|
-
},
|
|
27
|
-
'refactor': {
|
|
28
|
-
keywords: [
|
|
29
|
-
'refactor', 'improve', 'optimize', 'clean up', 'cleanup',
|
|
30
|
-
'simplify', 'reorganize', 'reorganise', 'redesign', 'restructure',
|
|
31
|
-
'modernize', 'upgrade', 'update', 'rework', 'rewrite',
|
|
32
|
-
'performance', 'efficient', 'better', 'enhancement'
|
|
33
|
-
],
|
|
34
|
-
antiKeywords: ['bug', 'broken', 'feature'],
|
|
35
|
-
icon: '♻️',
|
|
36
|
-
description: 'Improving existing code'
|
|
37
|
-
},
|
|
38
|
-
'investigation': {
|
|
39
|
-
keywords: [
|
|
40
|
-
'investigate', 'analyze', 'analysis', 'understand', 'how does',
|
|
41
|
-
'why', 'trace', 'explore', 'research', 'find out', 'examine',
|
|
42
|
-
'check', 'review', 'audit', 'assessment'
|
|
43
|
-
],
|
|
44
|
-
antiKeywords: ['fix', 'build', 'create'],
|
|
45
|
-
icon: '🔍',
|
|
46
|
-
description: 'Analyzing code and systems'
|
|
47
|
-
},
|
|
48
|
-
'impact-analysis': {
|
|
49
|
-
keywords: [
|
|
50
|
-
'impact', 'affect', 'affected', 'breaking', 'breaking change',
|
|
51
|
-
'scope', 'scope of change', 'side effect', 'consequence',
|
|
52
|
-
'dependent', 'dependency', 'risk', 'assess'
|
|
53
|
-
],
|
|
54
|
-
antiKeywords: [],
|
|
55
|
-
icon: '📊',
|
|
56
|
-
description: 'Assessing change impact'
|
|
57
|
-
},
|
|
58
|
-
'documentation': {
|
|
59
|
-
keywords: [
|
|
60
|
-
'document', 'readme', 'guide', 'tutorial',
|
|
61
|
-
'documentation', 'write doc', 'comment', 'docstring',
|
|
62
|
-
'explain', 'api doc', 'reference'
|
|
63
|
-
],
|
|
64
|
-
antiKeywords: ['code'],
|
|
65
|
-
icon: '📖',
|
|
66
|
-
description: 'Writing documentation'
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Detect task type from description
|
|
73
|
-
* Returns: { type, confidence, keywords, suggestions }
|
|
74
|
-
*/
|
|
75
|
-
detect(description, confidenceThreshold = 0.8) {
|
|
76
|
-
if (!description || typeof description !== 'string') {
|
|
77
|
-
return this.getDefaultResult();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const lowerDesc = description.toLowerCase();
|
|
81
|
-
const scores = {};
|
|
82
|
-
|
|
83
|
-
// Score each task type
|
|
84
|
-
for (const [type, config] of Object.entries(this.taskTypes)) {
|
|
85
|
-
scores[type] = this.scoreType(lowerDesc, config);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Find best match
|
|
89
|
-
const sorted = Object.entries(scores)
|
|
90
|
-
.sort(([, scoreA], [, scoreB]) => scoreB - scoreA);
|
|
91
|
-
|
|
92
|
-
if (!sorted.length || sorted[0][1] === 0) {
|
|
93
|
-
return this.getDefaultResult();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const [bestType, score] = sorted[0];
|
|
97
|
-
const confidence = Math.min(score, 1.0);
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
type: bestType,
|
|
101
|
-
confidence: Math.round(confidence * 100) / 100,
|
|
102
|
-
confidence_percent: Math.round(confidence * 100),
|
|
103
|
-
icon: this.taskTypes[bestType].icon,
|
|
104
|
-
description: this.taskTypes[bestType].description,
|
|
105
|
-
keywords: this.findMatchingKeywords(lowerDesc, this.taskTypes[bestType]),
|
|
106
|
-
suggestions: sorted.slice(1, 3).map(([t, s]) => ({
|
|
107
|
-
type: t,
|
|
108
|
-
confidence: Math.round(s * 100) / 100
|
|
109
|
-
})),
|
|
110
|
-
isConfident: confidence >= confidenceThreshold,
|
|
111
|
-
detectedKeywords: this.findAllMatchedKeywords(lowerDesc)
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Score a task type based on description
|
|
117
|
-
*/
|
|
118
|
-
scoreType(description, config) {
|
|
119
|
-
let score = 0;
|
|
120
|
-
|
|
121
|
-
// Count matching keywords
|
|
122
|
-
for (const keyword of config.keywords) {
|
|
123
|
-
if (description.includes(keyword)) {
|
|
124
|
-
score += 0.5;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Penalize anti-keywords
|
|
129
|
-
for (const antiKeyword of config.antiKeywords) {
|
|
130
|
-
if (description.includes(antiKeyword)) {
|
|
131
|
-
score -= 0.3;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Normalize score
|
|
136
|
-
return Math.max(0, Math.min(1, score / Math.max(1, config.keywords.length / 3)));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Find which keywords matched in description
|
|
141
|
-
*/
|
|
142
|
-
findMatchingKeywords(description, config) {
|
|
143
|
-
const matches = [];
|
|
144
|
-
for (const keyword of config.keywords) {
|
|
145
|
-
if (description.includes(keyword)) {
|
|
146
|
-
matches.push(keyword);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return matches.slice(0, 5); // Top 5 matches
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Find all matched keywords across all types
|
|
154
|
-
*/
|
|
155
|
-
findAllMatchedKeywords(description) {
|
|
156
|
-
const allKeywords = {};
|
|
157
|
-
for (const [type, config] of Object.entries(this.taskTypes)) {
|
|
158
|
-
const matched = this.findMatchingKeywords(description, config);
|
|
159
|
-
if (matched.length > 0) {
|
|
160
|
-
allKeywords[type] = matched;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return allKeywords;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Default result when detection fails
|
|
168
|
-
*/
|
|
169
|
-
getDefaultResult() {
|
|
170
|
-
return {
|
|
171
|
-
type: 'unknown',
|
|
172
|
-
confidence: 0,
|
|
173
|
-
confidence_percent: 0,
|
|
174
|
-
icon: '❓',
|
|
175
|
-
description: 'Unknown task type',
|
|
176
|
-
keywords: [],
|
|
177
|
-
suggestions: [],
|
|
178
|
-
isConfident: false,
|
|
179
|
-
detectedKeywords: {}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Get formatted output for CLI
|
|
185
|
-
*/
|
|
186
|
-
formatOutput(result, verbose = false) {
|
|
187
|
-
if (result.type === 'unknown') {
|
|
188
|
-
return `${result.icon} Could not detect task type\n\nPlease provide more details or specify task type explicitly:\n aiflow prompt bug-fix\n aiflow prompt feature\n aiflow prompt investigation`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
let output = `${result.icon} ${result.type.toUpperCase()} (${result.confidence_percent}% confidence)\n\n`;
|
|
192
|
-
|
|
193
|
-
if (verbose) {
|
|
194
|
-
output += `Description: ${result.description}\n`;
|
|
195
|
-
output += `Detected keywords:\n`;
|
|
196
|
-
for (const keyword of result.keywords.slice(0, 5)) {
|
|
197
|
-
output += ` - ${keyword}\n`;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (result.suggestions.length > 0) {
|
|
201
|
-
output += `\nOther possibilities:\n`;
|
|
202
|
-
for (const sugg of result.suggestions) {
|
|
203
|
-
output += ` - ${sugg.type} (${Math.round(sugg.confidence * 100)}%)\n`;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
output += `\nSuggested skill: ${result.type}\n`;
|
|
209
|
-
output += `\nNext: aiflow prompt ${result.type}`;
|
|
210
|
-
|
|
211
|
-
return output;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Export all task types for reference
|
|
216
|
-
*/
|
|
217
|
-
getTaskTypes() {
|
|
218
|
-
return this.taskTypes;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Get task type by name
|
|
223
|
-
*/
|
|
224
|
-
getTaskType(name) {
|
|
225
|
-
return this.taskTypes[name] || null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Get available task types
|
|
230
|
-
*/
|
|
231
|
-
getAvailableTypes() {
|
|
232
|
-
return Object.keys(this.taskTypes).map(type => ({
|
|
233
|
-
name: type,
|
|
234
|
-
...this.taskTypes[type]
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
module.exports = TaskDetector;
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
class TaskDetector {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.taskTypes = {
|
|
6
|
+
'bug-fix': {
|
|
7
|
+
keywords: [
|
|
8
|
+
'bug', 'error', 'broken', 'crash', 'fail', 'failed', 'failure',
|
|
9
|
+
'issue', 'problem', 'wrong', 'not working', 'doesn\'t work',
|
|
10
|
+
'can\'t', 'cannot', 'regression', 'fixing', 'fix',
|
|
11
|
+
'exception', 'bug report'
|
|
12
|
+
],
|
|
13
|
+
antiKeywords: ['add', 'create', 'new feature', 'build'],
|
|
14
|
+
icon: '🐛',
|
|
15
|
+
description: 'Fixing production issues'
|
|
16
|
+
},
|
|
17
|
+
'feature': {
|
|
18
|
+
keywords: [
|
|
19
|
+
'add', 'create', 'build', 'new', 'implement', 'feature',
|
|
20
|
+
'new feature', 'feature request', 'capability', 'support for',
|
|
21
|
+
'enable', 'make it possible', 'allow', 'user story'
|
|
22
|
+
],
|
|
23
|
+
antiKeywords: ['fix', 'bug', 'broken', 'error'],
|
|
24
|
+
icon: '✨',
|
|
25
|
+
description: 'Building new features'
|
|
26
|
+
},
|
|
27
|
+
'refactor': {
|
|
28
|
+
keywords: [
|
|
29
|
+
'refactor', 'improve', 'optimize', 'clean up', 'cleanup',
|
|
30
|
+
'simplify', 'reorganize', 'reorganise', 'redesign', 'restructure',
|
|
31
|
+
'modernize', 'upgrade', 'update', 'rework', 'rewrite',
|
|
32
|
+
'performance', 'efficient', 'better', 'enhancement'
|
|
33
|
+
],
|
|
34
|
+
antiKeywords: ['bug', 'broken', 'feature'],
|
|
35
|
+
icon: '♻️',
|
|
36
|
+
description: 'Improving existing code'
|
|
37
|
+
},
|
|
38
|
+
'investigation': {
|
|
39
|
+
keywords: [
|
|
40
|
+
'investigate', 'analyze', 'analysis', 'understand', 'how does',
|
|
41
|
+
'why', 'trace', 'explore', 'research', 'find out', 'examine',
|
|
42
|
+
'check', 'review', 'audit', 'assessment'
|
|
43
|
+
],
|
|
44
|
+
antiKeywords: ['fix', 'build', 'create'],
|
|
45
|
+
icon: '🔍',
|
|
46
|
+
description: 'Analyzing code and systems'
|
|
47
|
+
},
|
|
48
|
+
'impact-analysis': {
|
|
49
|
+
keywords: [
|
|
50
|
+
'impact', 'affect', 'affected', 'breaking', 'breaking change',
|
|
51
|
+
'scope', 'scope of change', 'side effect', 'consequence',
|
|
52
|
+
'dependent', 'dependency', 'risk', 'assess'
|
|
53
|
+
],
|
|
54
|
+
antiKeywords: [],
|
|
55
|
+
icon: '📊',
|
|
56
|
+
description: 'Assessing change impact'
|
|
57
|
+
},
|
|
58
|
+
'documentation': {
|
|
59
|
+
keywords: [
|
|
60
|
+
'document', 'readme', 'guide', 'tutorial',
|
|
61
|
+
'documentation', 'write doc', 'comment', 'docstring',
|
|
62
|
+
'explain', 'api doc', 'reference'
|
|
63
|
+
],
|
|
64
|
+
antiKeywords: ['code'],
|
|
65
|
+
icon: '📖',
|
|
66
|
+
description: 'Writing documentation'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Detect task type from description
|
|
73
|
+
* Returns: { type, confidence, keywords, suggestions }
|
|
74
|
+
*/
|
|
75
|
+
detect(description, confidenceThreshold = 0.8) {
|
|
76
|
+
if (!description || typeof description !== 'string') {
|
|
77
|
+
return this.getDefaultResult();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const lowerDesc = description.toLowerCase();
|
|
81
|
+
const scores = {};
|
|
82
|
+
|
|
83
|
+
// Score each task type
|
|
84
|
+
for (const [type, config] of Object.entries(this.taskTypes)) {
|
|
85
|
+
scores[type] = this.scoreType(lowerDesc, config);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Find best match
|
|
89
|
+
const sorted = Object.entries(scores)
|
|
90
|
+
.sort(([, scoreA], [, scoreB]) => scoreB - scoreA);
|
|
91
|
+
|
|
92
|
+
if (!sorted.length || sorted[0][1] === 0) {
|
|
93
|
+
return this.getDefaultResult();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const [bestType, score] = sorted[0];
|
|
97
|
+
const confidence = Math.min(score, 1.0);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
type: bestType,
|
|
101
|
+
confidence: Math.round(confidence * 100) / 100,
|
|
102
|
+
confidence_percent: Math.round(confidence * 100),
|
|
103
|
+
icon: this.taskTypes[bestType].icon,
|
|
104
|
+
description: this.taskTypes[bestType].description,
|
|
105
|
+
keywords: this.findMatchingKeywords(lowerDesc, this.taskTypes[bestType]),
|
|
106
|
+
suggestions: sorted.slice(1, 3).map(([t, s]) => ({
|
|
107
|
+
type: t,
|
|
108
|
+
confidence: Math.round(s * 100) / 100
|
|
109
|
+
})),
|
|
110
|
+
isConfident: confidence >= confidenceThreshold,
|
|
111
|
+
detectedKeywords: this.findAllMatchedKeywords(lowerDesc)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Score a task type based on description
|
|
117
|
+
*/
|
|
118
|
+
scoreType(description, config) {
|
|
119
|
+
let score = 0;
|
|
120
|
+
|
|
121
|
+
// Count matching keywords
|
|
122
|
+
for (const keyword of config.keywords) {
|
|
123
|
+
if (description.includes(keyword)) {
|
|
124
|
+
score += 0.5;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Penalize anti-keywords
|
|
129
|
+
for (const antiKeyword of config.antiKeywords) {
|
|
130
|
+
if (description.includes(antiKeyword)) {
|
|
131
|
+
score -= 0.3;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Normalize score
|
|
136
|
+
return Math.max(0, Math.min(1, score / Math.max(1, config.keywords.length / 3)));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Find which keywords matched in description
|
|
141
|
+
*/
|
|
142
|
+
findMatchingKeywords(description, config) {
|
|
143
|
+
const matches = [];
|
|
144
|
+
for (const keyword of config.keywords) {
|
|
145
|
+
if (description.includes(keyword)) {
|
|
146
|
+
matches.push(keyword);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return matches.slice(0, 5); // Top 5 matches
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Find all matched keywords across all types
|
|
154
|
+
*/
|
|
155
|
+
findAllMatchedKeywords(description) {
|
|
156
|
+
const allKeywords = {};
|
|
157
|
+
for (const [type, config] of Object.entries(this.taskTypes)) {
|
|
158
|
+
const matched = this.findMatchingKeywords(description, config);
|
|
159
|
+
if (matched.length > 0) {
|
|
160
|
+
allKeywords[type] = matched;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return allKeywords;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Default result when detection fails
|
|
168
|
+
*/
|
|
169
|
+
getDefaultResult() {
|
|
170
|
+
return {
|
|
171
|
+
type: 'unknown',
|
|
172
|
+
confidence: 0,
|
|
173
|
+
confidence_percent: 0,
|
|
174
|
+
icon: '❓',
|
|
175
|
+
description: 'Unknown task type',
|
|
176
|
+
keywords: [],
|
|
177
|
+
suggestions: [],
|
|
178
|
+
isConfident: false,
|
|
179
|
+
detectedKeywords: {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get formatted output for CLI
|
|
185
|
+
*/
|
|
186
|
+
formatOutput(result, verbose = false) {
|
|
187
|
+
if (result.type === 'unknown') {
|
|
188
|
+
return `${result.icon} Could not detect task type\n\nPlease provide more details or specify task type explicitly:\n aiflow prompt bug-fix\n aiflow prompt feature\n aiflow prompt investigation`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let output = `${result.icon} ${result.type.toUpperCase()} (${result.confidence_percent}% confidence)\n\n`;
|
|
192
|
+
|
|
193
|
+
if (verbose) {
|
|
194
|
+
output += `Description: ${result.description}\n`;
|
|
195
|
+
output += `Detected keywords:\n`;
|
|
196
|
+
for (const keyword of result.keywords.slice(0, 5)) {
|
|
197
|
+
output += ` - ${keyword}\n`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (result.suggestions.length > 0) {
|
|
201
|
+
output += `\nOther possibilities:\n`;
|
|
202
|
+
for (const sugg of result.suggestions) {
|
|
203
|
+
output += ` - ${sugg.type} (${Math.round(sugg.confidence * 100)}%)\n`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
output += `\nSuggested skill: ${result.type}\n`;
|
|
209
|
+
output += `\nNext: aiflow prompt ${result.type}`;
|
|
210
|
+
|
|
211
|
+
return output;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Export all task types for reference
|
|
216
|
+
*/
|
|
217
|
+
getTaskTypes() {
|
|
218
|
+
return this.taskTypes;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Get task type by name
|
|
223
|
+
*/
|
|
224
|
+
getTaskType(name) {
|
|
225
|
+
return this.taskTypes[name] || null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get available task types
|
|
230
|
+
*/
|
|
231
|
+
getAvailableTypes() {
|
|
232
|
+
return Object.keys(this.taskTypes).map(type => ({
|
|
233
|
+
name: type,
|
|
234
|
+
...this.taskTypes[type]
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
module.exports = TaskDetector;
|