wogiflow 1.0.11 → 1.0.13
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/.workflow/specs/architecture.md.template +24 -0
- package/.workflow/specs/stack.md.template +33 -0
- package/.workflow/specs/testing.md.template +36 -0
- package/README.md +90 -1
- package/lib/unified-wizard.js +569 -30
- package/package.json +1 -1
- package/scripts/MEMORY-ARCHITECTURE.md +150 -0
- package/scripts/flow +20 -19
- package/scripts/flow-auto-context.js +97 -3
- package/scripts/flow-conflict-resolver.js +735 -0
- package/scripts/flow-context-gatherer.js +520 -0
- package/scripts/flow-context-monitor.js +148 -19
- package/scripts/flow-damage-control.js +5 -1
- package/scripts/flow-export-profile +168 -1
- package/scripts/flow-import-profile +257 -6
- package/scripts/flow-instruction-richness.js +182 -18
- package/scripts/flow-knowledge-router.js +2 -0
- package/scripts/flow-knowledge-sync.js +2 -0
- package/scripts/{flow-transcript-chunking.js → flow-long-input-chunking.js} +4 -2
- package/scripts/{flow-transcript-parsing.js → flow-long-input-parsing.js} +35 -0
- package/scripts/{flow-transcript-stories.js → flow-long-input-stories.js} +86 -38
- package/scripts/{flow-transcript-digest.js → flow-long-input.js} +231 -15
- package/scripts/flow-memory-db.js +386 -1
- package/scripts/flow-memory-sync.js +2 -0
- package/scripts/flow-model-adapter.js +53 -29
- package/scripts/flow-model-router.js +246 -1
- package/scripts/flow-morning.js +94 -0
- package/scripts/flow-onboard +223 -10
- package/scripts/flow-orchestrate-validation.js +539 -0
- package/scripts/flow-orchestrate.js +16 -507
- package/scripts/flow-pattern-extractor.js +1265 -0
- package/scripts/flow-prompt-composer.js +222 -2
- package/scripts/flow-quality-guard.js +594 -0
- package/scripts/flow-section-index.js +713 -0
- package/scripts/flow-section-resolver.js +484 -0
- package/scripts/flow-session-end.js +188 -2
- package/scripts/flow-skill-create.js +19 -3
- package/scripts/flow-skill-matcher.js +122 -7
- package/scripts/flow-statusline-setup.js +218 -0
- package/scripts/flow-step-review.js +19 -0
- package/scripts/flow-tech-debt.js +734 -0
- package/scripts/flow-utils.js +2 -0
- package/scripts/hooks/core/long-input-gate.js +293 -0
- package/scripts/flow-parallel-detector.js +0 -399
- package/scripts/flow-parallel-dispatch.js +0 -987
- /package/scripts/{flow-transcript-language.js → flow-long-input-language.js} +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Memory & Knowledge System Architecture
|
|
2
|
+
|
|
3
|
+
This document clarifies the boundaries between the memory and knowledge modules.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
9
|
+
│ KNOWLEDGE LAYER │
|
|
10
|
+
│ Where learnings/rules are stored and retrieved │
|
|
11
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
12
|
+
│ │
|
|
13
|
+
│ ┌─────────────────────┐ ┌─────────────────────┐ │
|
|
14
|
+
│ │ flow-knowledge- │ │ flow-knowledge- │ │
|
|
15
|
+
│ │ router.js │ │ sync.js │ │
|
|
16
|
+
│ │ │ │ │ │
|
|
17
|
+
│ │ WHERE to store │ │ FRESHNESS of │ │
|
|
18
|
+
│ │ learnings │ │ knowledge files │ │
|
|
19
|
+
│ │ │ │ │ │
|
|
20
|
+
│ │ Routes to: │ │ Tracks: │ │
|
|
21
|
+
│ │ - model-specific │ │ - stack.md │ │
|
|
22
|
+
│ │ - skill │ │ - architecture.md │ │
|
|
23
|
+
│ │ - project │ │ - testing.md │ │
|
|
24
|
+
│ │ - team │ │ │ │
|
|
25
|
+
│ └─────────────────────┘ └─────────────────────┘ │
|
|
26
|
+
│ │
|
|
27
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
28
|
+
|
|
29
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
30
|
+
│ MEMORY LAYER │
|
|
31
|
+
│ Persistent fact storage and retrieval │
|
|
32
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
33
|
+
│ │
|
|
34
|
+
│ ┌─────────────────────┐ ┌─────────────────────┐ │
|
|
35
|
+
│ │ flow-memory-db.js │ │ flow-memory-sync.js │ │
|
|
36
|
+
│ │ │ │ │ │
|
|
37
|
+
│ │ DATABASE operations │ │ PROMOTION of │ │
|
|
38
|
+
│ │ │ │ facts to rules │ │
|
|
39
|
+
│ │ - SQLite + sql.js │ │ │ │
|
|
40
|
+
│ │ - Embeddings │ │ Promotes: │ │
|
|
41
|
+
│ │ - Semantic search │ │ high-relevance │ │
|
|
42
|
+
│ │ - Facts/Proposals │ │ facts → decisions.md│ │
|
|
43
|
+
│ │ - PRD storage │ │ │ │
|
|
44
|
+
│ └──────────┬──────────┘ └──────────┬──────────┘ │
|
|
45
|
+
│ │ │ │
|
|
46
|
+
│ └───────────────────────────┘ │
|
|
47
|
+
│ │ │
|
|
48
|
+
│ ▼ │
|
|
49
|
+
│ ┌─────────────────────┐ │
|
|
50
|
+
│ │ .workflow/memory/ │ │
|
|
51
|
+
│ │ local.db │ │
|
|
52
|
+
│ └─────────────────────┘ │
|
|
53
|
+
│ │
|
|
54
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Module Responsibilities
|
|
58
|
+
|
|
59
|
+
### flow-knowledge-router.js
|
|
60
|
+
**Purpose**: Determine WHERE learnings should be stored.
|
|
61
|
+
|
|
62
|
+
**Input**: A correction/learning text + context
|
|
63
|
+
**Output**: Routing recommendation (model-specific, skill, project, or team)
|
|
64
|
+
|
|
65
|
+
**Commands**:
|
|
66
|
+
```bash
|
|
67
|
+
flow knowledge-route detect "<text>" # Detect route
|
|
68
|
+
flow knowledge-route store "<text>" # Store with detected route
|
|
69
|
+
flow knowledge-route routes # Show all routes
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### flow-knowledge-sync.js
|
|
73
|
+
**Purpose**: Track FRESHNESS of knowledge files.
|
|
74
|
+
|
|
75
|
+
**Monitors**:
|
|
76
|
+
- package.json → stack.md
|
|
77
|
+
- src/ structure → architecture.md
|
|
78
|
+
- test config → testing.md
|
|
79
|
+
|
|
80
|
+
**Commands**:
|
|
81
|
+
```bash
|
|
82
|
+
flow knowledge-sync status # Check sync status
|
|
83
|
+
flow knowledge-sync regenerate # Regenerate stale files
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### flow-memory-db.js
|
|
87
|
+
**Purpose**: DATABASE operations for persistent memory.
|
|
88
|
+
|
|
89
|
+
**Features**:
|
|
90
|
+
- SQLite database using sql.js (pure JS)
|
|
91
|
+
- Embedding generation via @xenova/transformers
|
|
92
|
+
- Semantic similarity search
|
|
93
|
+
- Facts, proposals, and PRD chunk storage
|
|
94
|
+
|
|
95
|
+
**Used by**: MCP memory server, memory-sync
|
|
96
|
+
|
|
97
|
+
### flow-memory-sync.js
|
|
98
|
+
**Purpose**: PROMOTE high-relevance facts to decisions.md.
|
|
99
|
+
|
|
100
|
+
**Flow**:
|
|
101
|
+
1. Scan memory DB for high-relevance facts
|
|
102
|
+
2. Check if fact applies broadly (not one-off)
|
|
103
|
+
3. Propose promotion to decisions.md
|
|
104
|
+
4. On approval, add to decisions.md
|
|
105
|
+
|
|
106
|
+
**Commands**:
|
|
107
|
+
```bash
|
|
108
|
+
flow memory-sync # Check for promotable patterns
|
|
109
|
+
flow memory-sync --auto # Auto-promote without asking
|
|
110
|
+
flow memory-sync --list # List candidates only
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Data Flow
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
User correction
|
|
117
|
+
│
|
|
118
|
+
▼
|
|
119
|
+
┌─────────────────────┐
|
|
120
|
+
│ knowledge-router │──────► Route to storage location
|
|
121
|
+
└─────────────────────┘
|
|
122
|
+
│
|
|
123
|
+
▼
|
|
124
|
+
┌─────────────────────┐
|
|
125
|
+
│ memory-db │──────► Store in SQLite
|
|
126
|
+
└─────────────────────┘
|
|
127
|
+
│
|
|
128
|
+
▼
|
|
129
|
+
┌─────────────────────┐
|
|
130
|
+
│ memory-sync │──────► Promote to decisions.md
|
|
131
|
+
└─────────────────────┘
|
|
132
|
+
│
|
|
133
|
+
▼
|
|
134
|
+
┌─────────────────────┐
|
|
135
|
+
│ knowledge-sync │──────► Regenerate knowledge files
|
|
136
|
+
└─────────────────────┘
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Why Separate Modules?
|
|
140
|
+
|
|
141
|
+
1. **Single Responsibility**: Each module does one thing well
|
|
142
|
+
2. **Testability**: Easier to test in isolation
|
|
143
|
+
3. **Composability**: Can be used independently or together
|
|
144
|
+
4. **Maintainability**: Changes to one don't affect others
|
|
145
|
+
|
|
146
|
+
## Future Considerations
|
|
147
|
+
|
|
148
|
+
- Consider extracting common utilities to `flow-memory-utils.js`
|
|
149
|
+
- May add `flow-knowledge-index.js` for knowledge search
|
|
150
|
+
- Could add `flow-memory-export.js` for team sharing
|
package/scripts/flow
CHANGED
|
@@ -76,6 +76,7 @@ show_help() {
|
|
|
76
76
|
echo " hooks setup Install CLI hooks (Claude Code, etc.)"
|
|
77
77
|
echo " hooks remove Remove CLI hooks"
|
|
78
78
|
echo " hooks status Show CLI hooks status"
|
|
79
|
+
echo " statusline-setup Configure Claude Code status line"
|
|
79
80
|
echo " archive Archive old request-log entries"
|
|
80
81
|
echo " watch Run file watcher for auto-validation"
|
|
81
82
|
echo ""
|
|
@@ -172,8 +173,6 @@ show_help() {
|
|
|
172
173
|
echo "Parallel Execution:"
|
|
173
174
|
echo " parallel config Show parallel execution config"
|
|
174
175
|
echo " parallel check Check tasks for parallel potential"
|
|
175
|
-
echo " parallel analyze Analyze tasks for parallel potential"
|
|
176
|
-
echo " parallel suggest Check if parallel should be suggested"
|
|
177
176
|
echo " parallel enable Enable parallel execution"
|
|
178
177
|
echo " parallel disable Disable parallel execution"
|
|
179
178
|
echo ""
|
|
@@ -277,9 +276,6 @@ show_help() {
|
|
|
277
276
|
echo " context-init \"task\" Initialize context for a task"
|
|
278
277
|
echo ""
|
|
279
278
|
echo "Advanced Execution (Phase 4):"
|
|
280
|
-
echo " dispatch analyze \"<task>\" Analyze task for parallel execution"
|
|
281
|
-
echo " dispatch plan \"<task>\" Create dispatch plan"
|
|
282
|
-
echo " dispatch status Show dispatch status"
|
|
283
279
|
echo " ctx-score score --task Score context items by relevance"
|
|
284
280
|
echo " ctx-score budget --tokens Fit context within token budget"
|
|
285
281
|
echo " ctx-score analyze --file Analyze file for context inclusion"
|
|
@@ -287,6 +283,13 @@ show_help() {
|
|
|
287
283
|
echo " confidence check --file Check confidence of file"
|
|
288
284
|
echo " confidence stats Show confidence statistics"
|
|
289
285
|
echo ""
|
|
286
|
+
echo "Input & Editing:"
|
|
287
|
+
echo " voice-input Voice-to-transcript input"
|
|
288
|
+
echo " voice-input setup Install/configure voice dependencies"
|
|
289
|
+
echo " voice-input record Record and transcribe audio"
|
|
290
|
+
echo " guided-edit \"task\" Step-by-step guided multi-file editing"
|
|
291
|
+
echo " guided-edit status Show current guided edit session"
|
|
292
|
+
echo ""
|
|
290
293
|
echo "Memory & Knowledge (v1.8):"
|
|
291
294
|
echo " memory search <query> Search stored facts"
|
|
292
295
|
echo " memory stats Show memory statistics"
|
|
@@ -401,6 +404,9 @@ case "${1:-}" in
|
|
|
401
404
|
hooks)
|
|
402
405
|
node "$SCRIPT_DIR/flow-hooks.js" "${@:2}"
|
|
403
406
|
;;
|
|
407
|
+
statusline-setup|statusline)
|
|
408
|
+
node "$SCRIPT_DIR/flow-statusline-setup.js" "${@:2}"
|
|
409
|
+
;;
|
|
404
410
|
update-map)
|
|
405
411
|
"$SCRIPT_DIR/flow-update-map" "${@:2}"
|
|
406
412
|
;;
|
|
@@ -460,12 +466,6 @@ case "${1:-}" in
|
|
|
460
466
|
check)
|
|
461
467
|
node "$SCRIPT_DIR/flow-parallel.js" check
|
|
462
468
|
;;
|
|
463
|
-
analyze)
|
|
464
|
-
node "$SCRIPT_DIR/flow-parallel-detector.js" analyze
|
|
465
|
-
;;
|
|
466
|
-
suggest)
|
|
467
|
-
node "$SCRIPT_DIR/flow-parallel-detector.js" suggest
|
|
468
|
-
;;
|
|
469
469
|
enable)
|
|
470
470
|
node "$SCRIPT_DIR/flow-config-set.js" parallel.enabled true
|
|
471
471
|
;;
|
|
@@ -476,7 +476,7 @@ case "${1:-}" in
|
|
|
476
476
|
node "$SCRIPT_DIR/flow-config-set.js" parallel.autoApprove true
|
|
477
477
|
;;
|
|
478
478
|
*)
|
|
479
|
-
echo "Usage: flow parallel [config|check|
|
|
479
|
+
echo "Usage: flow parallel [config|check|enable|disable|auto-approve]"
|
|
480
480
|
;;
|
|
481
481
|
esac
|
|
482
482
|
;;
|
|
@@ -798,10 +798,6 @@ case "${1:-}" in
|
|
|
798
798
|
# Phase 3: Tiered learning system
|
|
799
799
|
node "$SCRIPT_DIR/flow-tiered-learning.js" "${@:2}"
|
|
800
800
|
;;
|
|
801
|
-
dispatch)
|
|
802
|
-
# Phase 4: Parallel dispatch system
|
|
803
|
-
node "$SCRIPT_DIR/flow-parallel-dispatch.js" "${@:2}"
|
|
804
|
-
;;
|
|
805
801
|
ctx-score)
|
|
806
802
|
# Phase 4: Context priority scoring
|
|
807
803
|
node "$SCRIPT_DIR/flow-context-scoring.js" "${@:2}"
|
|
@@ -941,8 +937,12 @@ case "${1:-}" in
|
|
|
941
937
|
voice-input|voice)
|
|
942
938
|
node "$SCRIPT_DIR/flow-voice-input.js" "${@:2}"
|
|
943
939
|
;;
|
|
944
|
-
|
|
945
|
-
node "$SCRIPT_DIR/flow-
|
|
940
|
+
guided-edit)
|
|
941
|
+
node "$SCRIPT_DIR/flow-guided-edit.js" "${@:2}"
|
|
942
|
+
;;
|
|
943
|
+
long-input|long-input-process|transcript-digest|digest)
|
|
944
|
+
# long-input is the new name, transcript-digest kept for backward compatibility
|
|
945
|
+
node "$SCRIPT_DIR/flow-long-input.js" "${@:2}"
|
|
946
946
|
;;
|
|
947
947
|
version|--version|-v)
|
|
948
948
|
show_version
|
|
@@ -970,7 +970,8 @@ case "${1:-}" in
|
|
|
970
970
|
parallel) echo "Manage parallel execution. Subcommands: config, check, enable, disable" ;;
|
|
971
971
|
worktree) echo "Manage worktree isolation. Subcommands: enable, disable, list, cleanup" ;;
|
|
972
972
|
voice-input|voice) echo "Voice-to-transcript input. Subcommands: setup, status, test, record" ;;
|
|
973
|
-
transcript-digest|digest) echo "
|
|
973
|
+
long-input|long-input-process|transcript-digest|digest) echo "Long input processing. Ensures nothing missed from long prompts/transcripts/specs. Subcommands: status, new, check, topics, save-topics" ;;
|
|
974
|
+
guided-edit) echo "Step-by-step guided multi-file editing. Usage: flow guided-edit \"task description\"" ;;
|
|
974
975
|
*) echo "No detailed help for '$2'. Run 'flow help' for all commands." ;;
|
|
975
976
|
esac
|
|
976
977
|
;;
|
|
@@ -33,7 +33,8 @@ const {
|
|
|
33
33
|
findReactComponents,
|
|
34
34
|
findCustomHooks,
|
|
35
35
|
findTypeDefinitions,
|
|
36
|
-
isPathWithinProject
|
|
36
|
+
isPathWithinProject,
|
|
37
|
+
safeJsonParse
|
|
37
38
|
} = require('./flow-utils');
|
|
38
39
|
|
|
39
40
|
// Semantic memory search (optional - may not be initialized)
|
|
@@ -45,6 +46,14 @@ try {
|
|
|
45
46
|
// Memory DB not available - that's ok
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
// Smart Context System (Phase 2) - optional
|
|
50
|
+
let smartContextGatherer = null;
|
|
51
|
+
try {
|
|
52
|
+
smartContextGatherer = require('./flow-context-gatherer');
|
|
53
|
+
} catch {
|
|
54
|
+
// Smart context gatherer not available - that's ok
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
const PROJECT_ROOT = getProjectRoot();
|
|
49
58
|
|
|
50
59
|
// ============================================================
|
|
@@ -350,7 +359,9 @@ function searchComponentIndex(keywords, config = null) {
|
|
|
350
359
|
const maxComponentMatches = cfg.autoContext?.maxComponentMatches || 15;
|
|
351
360
|
|
|
352
361
|
try {
|
|
353
|
-
|
|
362
|
+
// Use safeJsonParse for prototype pollution protection
|
|
363
|
+
const index = safeJsonParse(indexPath, null);
|
|
364
|
+
if (!index) return results;
|
|
354
365
|
const components = index.components || [];
|
|
355
366
|
|
|
356
367
|
const allKeywords = [...keywords.high, ...keywords.medium];
|
|
@@ -497,7 +508,9 @@ function searchRelatedTasks(keywords) {
|
|
|
497
508
|
if (!fs.existsSync(PATHS.ready)) return results;
|
|
498
509
|
|
|
499
510
|
try {
|
|
500
|
-
|
|
511
|
+
// Use safeJsonParse for prototype pollution protection
|
|
512
|
+
const data = safeJsonParse(PATHS.ready, null);
|
|
513
|
+
if (!data) return results;
|
|
501
514
|
const allTasks = [
|
|
502
515
|
...(data.ready || []),
|
|
503
516
|
...(data.inProgress || []),
|
|
@@ -783,6 +796,50 @@ function searchWithAstGrep(keywords, taskType = null, config = null) {
|
|
|
783
796
|
return results;
|
|
784
797
|
}
|
|
785
798
|
|
|
799
|
+
// ============================================================
|
|
800
|
+
// Smart Context (Phase 2)
|
|
801
|
+
// ============================================================
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Get smart context using section-level references
|
|
805
|
+
* This is the new dynamic context system that replaces hardcoded limits
|
|
806
|
+
* @param {string} description - Task description
|
|
807
|
+
* @param {object} options - { model, maxTokens }
|
|
808
|
+
* @returns {object} - Smart context result
|
|
809
|
+
*/
|
|
810
|
+
async function getSmartContext(description, options = {}) {
|
|
811
|
+
if (!smartContextGatherer) {
|
|
812
|
+
return null; // Fall back to legacy behavior
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const config = getConfig();
|
|
816
|
+
const model = options.model || config.multiModel?.orchestrator?.model || 'claude-sonnet-4';
|
|
817
|
+
|
|
818
|
+
try {
|
|
819
|
+
const result = await smartContextGatherer.gatherContext({
|
|
820
|
+
task: description,
|
|
821
|
+
model,
|
|
822
|
+
maxTokens: options.maxTokens,
|
|
823
|
+
format: 'full'
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
return {
|
|
827
|
+
enabled: true,
|
|
828
|
+
strategy: 'dynamic',
|
|
829
|
+
sectionContext: result.context,
|
|
830
|
+
sections: result.sections,
|
|
831
|
+
stats: result.stats,
|
|
832
|
+
message: `Smart context: ${result.stats.sectionsIncluded} sections, ${result.stats.totalTokens} tokens (${result.stats.budgetUsed})`
|
|
833
|
+
};
|
|
834
|
+
} catch (err) {
|
|
835
|
+
// Fall back to legacy behavior on error
|
|
836
|
+
if (config.debug) {
|
|
837
|
+
console.warn(`Smart context failed: ${err.message}`);
|
|
838
|
+
}
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
786
843
|
// ============================================================
|
|
787
844
|
// Main Context Loading
|
|
788
845
|
// ============================================================
|
|
@@ -791,6 +848,8 @@ function searchWithAstGrep(keywords, taskType = null, config = null) {
|
|
|
791
848
|
* Get auto-context for a task description
|
|
792
849
|
* Returns prioritized list of relevant files and context
|
|
793
850
|
* Now async to support semantic memory search
|
|
851
|
+
*
|
|
852
|
+
* v3.0: Supports 'dynamic' strategy using Smart Context System
|
|
794
853
|
*/
|
|
795
854
|
async function getAutoContext(description, options = {}) {
|
|
796
855
|
const config = getConfig();
|
|
@@ -800,6 +859,39 @@ async function getAutoContext(description, options = {}) {
|
|
|
800
859
|
return { enabled: false, files: [], context: [] };
|
|
801
860
|
}
|
|
802
861
|
|
|
862
|
+
// v3.0: Use Smart Context System if strategy is 'dynamic'
|
|
863
|
+
const strategy = config.autoContext?.strategy || 'fixed';
|
|
864
|
+
if (strategy === 'dynamic' && smartContextGatherer) {
|
|
865
|
+
const smartResult = await getSmartContext(description, options);
|
|
866
|
+
if (smartResult) {
|
|
867
|
+
// Merge smart context with legacy context for backward compatibility
|
|
868
|
+
// The smart context provides section-level rules, legacy provides file context
|
|
869
|
+
const legacyResult = await getLegacyContext(description, options, config);
|
|
870
|
+
|
|
871
|
+
return {
|
|
872
|
+
...legacyResult,
|
|
873
|
+
strategy: 'dynamic',
|
|
874
|
+
sectionContext: smartResult.sectionContext,
|
|
875
|
+
sections: smartResult.sections,
|
|
876
|
+
smartStats: smartResult.stats,
|
|
877
|
+
message: smartResult.message + (legacyResult.files.length > 0
|
|
878
|
+
? ` | ${legacyResult.files.length} files`
|
|
879
|
+
: '')
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// Fall back to legacy (fixed) strategy
|
|
885
|
+
return await getLegacyContext(description, options, config);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Legacy context loading (fixed strategy)
|
|
890
|
+
* This is the original implementation with hardcoded limits
|
|
891
|
+
*/
|
|
892
|
+
async function getLegacyContext(description, options = {}, config = null) {
|
|
893
|
+
config = config || getConfig();
|
|
894
|
+
|
|
803
895
|
// v2.0: Check and refresh stale component index
|
|
804
896
|
if (config.componentIndex?.autoScan !== false) {
|
|
805
897
|
checkAndRefreshIndex(config);
|
|
@@ -1093,6 +1185,8 @@ module.exports = {
|
|
|
1093
1185
|
inferTaskType,
|
|
1094
1186
|
checkAndRefreshIndex,
|
|
1095
1187
|
getAutoContext,
|
|
1188
|
+
getLegacyContext, // v3.0: Legacy context loading
|
|
1189
|
+
getSmartContext, // v3.0: Smart context with section-level refs
|
|
1096
1190
|
formatAutoContext
|
|
1097
1191
|
};
|
|
1098
1192
|
|