@smartmemory/compose 0.1.18-beta → 0.1.19-beta

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartmemory/compose",
3
- "version": "0.1.18-beta",
3
+ "version": "0.1.19-beta",
4
4
  "description": "Structured AI dev pipeline — goal-to-product orchestration with gates, iteration loops, and feature lifecycle management.",
5
5
  "author": "SmartMemory",
6
6
  "license": "MIT",
@@ -159,8 +159,21 @@ export function scanFeatures(featuresDir) {
159
159
  relatedFeatures: [],
160
160
  predecessors: [],
161
161
  successors: [],
162
+ group: null, // explicit group from feature.json overrides derivation
162
163
  };
163
164
 
165
+ // Read feature.json if present — supplies optional explicit `group`,
166
+ // and may override description/status if more authoritative than the docs.
167
+ try {
168
+ const specPath = path.join(featureDir, 'feature.json');
169
+ if (fs.existsSync(specPath)) {
170
+ const spec = JSON.parse(fs.readFileSync(specPath, 'utf-8'));
171
+ if (typeof spec.group === 'string' && spec.group.trim()) {
172
+ feature.group = spec.group.trim();
173
+ }
174
+ }
175
+ } catch { /* ignore malformed feature.json */ }
176
+
164
177
  // List artifacts
165
178
  try {
166
179
  feature.artifacts = fs.readdirSync(featureDir)
@@ -503,6 +516,7 @@ export function seedFeatures(features, store) {
503
516
  phase: feature.phase || 'planning',
504
517
  confidence: feature.confidence,
505
518
  files: feature.artifacts.map(a => `docs/features/${feature.name}/${a}`),
519
+ ...(feature.group ? { group: feature.group } : {}),
506
520
  });
507
521
  try {
508
522
  store.updateLifecycle(featureItem.id, { featureCode: feature.name, currentPhase: 'explore_design' });
@@ -525,6 +539,9 @@ export function seedFeatures(features, store) {
525
539
  if (JSON.stringify(newFiles) !== JSON.stringify(featureItem.files || [])) {
526
540
  updates.files = newFiles;
527
541
  }
542
+ if (feature.group && feature.group !== featureItem.group) {
543
+ updates.group = feature.group;
544
+ }
528
545
  if (Object.keys(updates).length > 0) {
529
546
  store.updateItem(featureItem.id, updates);
530
547
  seeded.updated++;
@@ -77,15 +77,19 @@ export class VisionStore {
77
77
  }
78
78
  if (!item.slug && item.title) item.slug = slugify(item.title);
79
79
  if (!item.files) item.files = [];
80
- // Always re-derive group on load — the rule has evolved (singletons
81
- // first-2-tokens) and existing items need the new shape. Custom
82
- // user-set groups are not a use case here; group is derived metadata.
83
- const newGroup = deriveGroup(item.title, item.featureCode || item.lifecycle?.featureCode);
84
- if (newGroup && newGroup !== item.group) {
85
- item.group = newGroup;
80
+ // Group precedence (most-authoritative first):
81
+ // 1. feature.json `group` field applied later in seedFeatures()
82
+ // 2. deriveGroup() heuristic applied here on every load
83
+ // 3. previously stored value — overridden when (1) or (2) yields anything
84
+ // Always re-derive so items track rule changes (e.g. singleton →
85
+ // first-2-tokens migration). seedFeatures() runs after _load and
86
+ // overrides this with the feature.json value when present.
87
+ const derived = deriveGroup(item.title, item.featureCode || item.lifecycle?.featureCode);
88
+ if (derived && derived !== item.group) {
89
+ item.group = derived;
86
90
  migrated = true;
87
- } else if (!item.group && newGroup) {
88
- item.group = newGroup;
91
+ } else if (!item.group && derived) {
92
+ item.group = derived;
89
93
  migrated = true;
90
94
  }
91
95
  this.items.set(item.id, item);