@schnick371/devsteps-shared 0.7.0-next.3 → 0.8.1-next.1
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/core/add.d.ts +2 -3
- package/dist/core/add.d.ts.map +1 -1
- package/dist/core/add.js +58 -37
- package/dist/core/add.js.map +1 -1
- package/dist/core/archive.d.ts.map +1 -1
- package/dist/core/archive.js +35 -25
- package/dist/core/archive.js.map +1 -1
- package/dist/core/auto-migrate.d.ts +154 -0
- package/dist/core/auto-migrate.d.ts.map +1 -0
- package/dist/core/auto-migrate.js +383 -0
- package/dist/core/auto-migrate.js.map +1 -0
- package/dist/core/auto-migrate.test.d.ts +7 -0
- package/dist/core/auto-migrate.test.d.ts.map +1 -0
- package/dist/core/auto-migrate.test.js +364 -0
- package/dist/core/auto-migrate.test.js.map +1 -0
- package/dist/core/index-rebuild.d.ts +75 -0
- package/dist/core/index-rebuild.d.ts.map +1 -0
- package/dist/core/index-rebuild.js +260 -0
- package/dist/core/index-rebuild.js.map +1 -0
- package/dist/core/index-rebuild.test.d.ts +8 -0
- package/dist/core/index-rebuild.test.d.ts.map +1 -0
- package/dist/core/index-rebuild.test.js +582 -0
- package/dist/core/index-rebuild.test.js.map +1 -0
- package/dist/core/index-refs.d.ts +155 -0
- package/dist/core/index-refs.d.ts.map +1 -0
- package/dist/core/index-refs.js +442 -0
- package/dist/core/index-refs.js.map +1 -0
- package/dist/core/index-refs.test.d.ts +7 -0
- package/dist/core/index-refs.test.d.ts.map +1 -0
- package/dist/core/index-refs.test.js +367 -0
- package/dist/core/index-refs.test.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/list.d.ts +2 -3
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +67 -12
- package/dist/core/list.js.map +1 -1
- package/dist/core/update.d.ts +1 -2
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +30 -21
- package/dist/core/update.js.map +1 -1
- package/dist/migration/fix-missing-eisenhower.d.ts +8 -0
- package/dist/migration/fix-missing-eisenhower.d.ts.map +1 -0
- package/dist/migration/fix-missing-eisenhower.js +58 -0
- package/dist/migration/fix-missing-eisenhower.js.map +1 -0
- package/dist/migration/remove-priority-field.d.ts +15 -0
- package/dist/migration/remove-priority-field.d.ts.map +1 -0
- package/dist/migration/remove-priority-field.js +113 -0
- package/dist/migration/remove-priority-field.js.map +1 -0
- package/dist/schemas/index-refs.schema.d.ts +103 -0
- package/dist/schemas/index-refs.schema.d.ts.map +1 -0
- package/dist/schemas/index-refs.schema.js +88 -0
- package/dist/schemas/index-refs.schema.js.map +1 -0
- package/dist/schemas/index.d.ts +7 -22
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -7
- package/dist/schemas/index.js.map +1 -1
- package/dist/types/commands.d.ts +2 -5
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/types/index-refs.types.d.ts +123 -0
- package/dist/types/index-refs.types.d.ts.map +1 -0
- package/dist/types/index-refs.types.js +71 -0
- package/dist/types/index-refs.types.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +26 -8
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/add.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { DevStepsConfig, EisenhowerQuadrant, ItemMetadata, ItemType
|
|
1
|
+
import type { DevStepsConfig, EisenhowerQuadrant, ItemMetadata, ItemType } from '../schemas/index.js';
|
|
2
2
|
export interface AddItemArgs {
|
|
3
3
|
type: ItemType;
|
|
4
4
|
title: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
category?: string;
|
|
7
|
-
|
|
7
|
+
eisenhower?: EisenhowerQuadrant;
|
|
8
8
|
tags?: string[];
|
|
9
9
|
affected_paths?: string[];
|
|
10
10
|
assignee?: string;
|
|
11
|
-
eisenhower?: EisenhowerQuadrant;
|
|
12
11
|
}
|
|
13
12
|
export interface AddItemResult {
|
|
14
13
|
itemId: string;
|
package/dist/core/add.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/core/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,YAAY,EACZ,QAAQ,
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/core/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAe7B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CA+H3F"}
|
package/dist/core/add.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { TYPE_TO_DIRECTORY, generateItemId, getCurrentTimestamp } from '../utils/index.js';
|
|
3
|
+
import { TYPE_TO_DIRECTORY, generateItemId, getCurrentTimestamp, getTypePrefix, } from '../utils/index.js';
|
|
4
|
+
import { hasRefsStyleIndex, loadCounters, updateCounters, addItemToIndex, } from './index-refs.js';
|
|
4
5
|
/**
|
|
5
6
|
* Core business logic for adding a new item to devsteps
|
|
6
7
|
* Pure function that handles all file I/O and validation
|
|
@@ -12,32 +13,36 @@ export async function addItem(devstepsir, args) {
|
|
|
12
13
|
}
|
|
13
14
|
// Read config and index
|
|
14
15
|
const configPath = join(devstepsir, 'config.json');
|
|
15
|
-
const indexPath = join(devstepsir, 'index.json');
|
|
16
16
|
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
// Get counter - try refs-style first, fallback to legacy
|
|
18
|
+
let counter;
|
|
19
|
+
const counterKey = getTypePrefix(args.type); // Use uppercase prefix for consistency
|
|
20
|
+
if (hasRefsStyleIndex(devstepsir)) {
|
|
21
|
+
const counters = loadCounters(devstepsir);
|
|
22
|
+
counter = (counters[counterKey] || 0) + 1;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Legacy index.json
|
|
26
|
+
const indexPath = join(devstepsir, 'index.json');
|
|
27
|
+
const index = JSON.parse(readFileSync(indexPath, 'utf-8'));
|
|
28
|
+
// Migration: Initialize counters if missing (for legacy projects)
|
|
29
|
+
if (!index.counters) {
|
|
30
|
+
index.counters = {};
|
|
31
|
+
// Calculate existing max IDs per type
|
|
32
|
+
for (const item of index.items) {
|
|
33
|
+
const match = item.id.match(/-(\d+)$/);
|
|
34
|
+
if (match) {
|
|
35
|
+
const num = Number.parseInt(match[1], 10);
|
|
36
|
+
const prefix = item.id.replace(/-\d+$/, ''); // Extract prefix from ID (uppercase)
|
|
37
|
+
index.counters[prefix] = Math.max(index.counters[prefix] || 0, num);
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
40
|
}
|
|
41
|
+
counter = (index.counters[counterKey] || 0) + 1;
|
|
29
42
|
}
|
|
30
43
|
// Generate ID using global counter
|
|
31
44
|
const typeFolder = TYPE_TO_DIRECTORY[args.type];
|
|
32
|
-
const counter = (index.counters[args.type] || 0) + 1;
|
|
33
45
|
const itemId = generateItemId(args.type, counter);
|
|
34
|
-
// Check for duplicate ID (data integrity validation)
|
|
35
|
-
const existingIds = index.items.map((i) => i.id);
|
|
36
|
-
if (existingIds.includes(itemId)) {
|
|
37
|
-
throw new Error(`Duplicate ID detected: ${itemId}. Index may be corrupted or counter was reset. Please check .devsteps/index.json`);
|
|
38
|
-
}
|
|
39
|
-
// Increment counter
|
|
40
|
-
index.counters[args.type] = counter;
|
|
41
46
|
// Create metadata
|
|
42
47
|
const now = getCurrentTimestamp();
|
|
43
48
|
const metadata = {
|
|
@@ -46,8 +51,7 @@ export async function addItem(devstepsir, args) {
|
|
|
46
51
|
category: args.category || 'general',
|
|
47
52
|
title: args.title,
|
|
48
53
|
status: 'draft',
|
|
49
|
-
|
|
50
|
-
eisenhower: args.eisenhower,
|
|
54
|
+
eisenhower: args.eisenhower || 'not-urgent-important',
|
|
51
55
|
created: now,
|
|
52
56
|
updated: now,
|
|
53
57
|
author: args.assignee || config.settings.default_author,
|
|
@@ -78,21 +82,38 @@ export async function addItem(devstepsir, args) {
|
|
|
78
82
|
// Save description
|
|
79
83
|
const description = args.description || `# ${args.title}\n\n<!-- Add detailed description here -->\n`;
|
|
80
84
|
writeFileSync(descriptionPath, description);
|
|
81
|
-
// Update index
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
// Update index - use refs-style if available, otherwise legacy
|
|
86
|
+
if (hasRefsStyleIndex(devstepsir)) {
|
|
87
|
+
// Update counters (use uppercase prefix key for consistency)
|
|
88
|
+
const currentCounters = loadCounters(devstepsir);
|
|
89
|
+
currentCounters[counterKey] = counter;
|
|
90
|
+
updateCounters(devstepsir, currentCounters);
|
|
91
|
+
// Add to all relevant indexes (by-type, by-status, by-priority)
|
|
92
|
+
addItemToIndex(devstepsir, metadata);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Legacy index.json update
|
|
96
|
+
const indexPath = join(devstepsir, 'index.json');
|
|
97
|
+
const index = JSON.parse(readFileSync(indexPath, 'utf-8'));
|
|
98
|
+
// Increment counter (use uppercase prefix key for consistency)
|
|
99
|
+
if (!index.counters)
|
|
100
|
+
index.counters = {};
|
|
101
|
+
index.counters[counterKey] = counter;
|
|
102
|
+
index.items.push({
|
|
103
|
+
id: itemId,
|
|
104
|
+
type: args.type,
|
|
105
|
+
title: args.title,
|
|
106
|
+
status: 'draft',
|
|
107
|
+
eisenhower: args.eisenhower || 'not-urgent-important',
|
|
108
|
+
updated: now,
|
|
109
|
+
});
|
|
110
|
+
index.last_updated = now;
|
|
111
|
+
index.stats = index.stats || { total: 0, by_type: {}, by_status: {} };
|
|
112
|
+
index.stats.total = index.items.length;
|
|
113
|
+
index.stats.by_type[args.type] = (index.stats.by_type[args.type] || 0) + 1;
|
|
114
|
+
index.stats.by_status.draft = (index.stats.by_status.draft || 0) + 1;
|
|
115
|
+
writeFileSync(indexPath, JSON.stringify(index, null, 2));
|
|
116
|
+
}
|
|
96
117
|
return {
|
|
97
118
|
itemId,
|
|
98
119
|
metadata,
|
package/dist/core/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/core/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UA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C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3E,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAErE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/core/archive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/core/archive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,UAAU,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyFhG;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA6C3B"}
|
package/dist/core/archive.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { TYPE_TO_DIRECTORY, getCurrentTimestamp, parseItemId } from '../utils/index.js';
|
|
4
|
+
import { hasRefsStyleIndex, removeItemFromIndex } from './index-refs.js';
|
|
4
5
|
/**
|
|
5
6
|
* Core business logic for archiving a single item
|
|
6
7
|
*/
|
|
@@ -31,35 +32,44 @@ export async function archiveItem(devstepsir, itemId) {
|
|
|
31
32
|
if (existsSync(descriptionPath)) {
|
|
32
33
|
renameSync(descriptionPath, archiveDescriptionPath);
|
|
33
34
|
}
|
|
34
|
-
// Update index
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
index.items.splice(itemIndex, 1);
|
|
35
|
+
// Update index - use refs-style if available, otherwise legacy
|
|
36
|
+
if (hasRefsStyleIndex(devstepsir)) {
|
|
37
|
+
// Remove from all indexes (by-type, by-status, by-priority)
|
|
38
|
+
removeItemFromIndex(devstepsir, itemId, metadata.type, metadata.status, metadata.eisenhower);
|
|
39
|
+
// Note: refs-style doesn't track archived_items in index
|
|
40
|
+
// Archive metadata already contains all needed info
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
index.
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
else {
|
|
43
|
+
// Legacy index.json update
|
|
44
|
+
const indexPath = join(devstepsir, 'index.json');
|
|
45
|
+
const index = JSON.parse(readFileSync(indexPath, 'utf-8'));
|
|
46
|
+
// Remove from items
|
|
47
|
+
const itemIndex = index.items.findIndex((i) => i.id === itemId);
|
|
48
|
+
if (itemIndex !== -1) {
|
|
49
|
+
index.items.splice(itemIndex, 1);
|
|
50
|
+
}
|
|
51
|
+
// Add to archived_items
|
|
52
|
+
const archivedAt = getCurrentTimestamp();
|
|
53
|
+
index.archived_items = index.archived_items || [];
|
|
54
|
+
index.archived_items.push({
|
|
55
|
+
id: itemId,
|
|
56
|
+
type: parsed.type,
|
|
57
|
+
title: metadata.title,
|
|
58
|
+
archived_at: archivedAt,
|
|
59
|
+
original_status: originalStatus,
|
|
60
|
+
});
|
|
61
|
+
// Update stats
|
|
62
|
+
if (index.stats) {
|
|
63
|
+
index.stats.total = index.items.length;
|
|
64
|
+
index.stats.by_status[originalStatus] = Math.max((index.stats.by_status[originalStatus] || 1) - 1, 0);
|
|
65
|
+
index.stats.archived = (index.stats.archived || 0) + 1;
|
|
66
|
+
}
|
|
67
|
+
index.last_updated = archivedAt;
|
|
68
|
+
writeFileSync(indexPath, JSON.stringify(index, null, 2));
|
|
57
69
|
}
|
|
58
|
-
index.last_updated = archivedAt;
|
|
59
|
-
writeFileSync(indexPath, JSON.stringify(index, null, 2));
|
|
60
70
|
return {
|
|
61
71
|
itemId,
|
|
62
|
-
archivedAt,
|
|
72
|
+
archivedAt: getCurrentTimestamp(),
|
|
63
73
|
originalStatus,
|
|
64
74
|
};
|
|
65
75
|
}
|
package/dist/core/archive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/core/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,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AW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mCAAmC;YACnC,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Migration Module
|
|
3
|
+
*
|
|
4
|
+
* Provides auto-detection and migration for external DevSteps projects.
|
|
5
|
+
* Safely migrates from legacy index.json to refs-style distributed index.
|
|
6
|
+
*
|
|
7
|
+
* Safe to call repeatedly - only migrates once.
|
|
8
|
+
*
|
|
9
|
+
* @see STORY-073 External Project Migration Auto-Detection
|
|
10
|
+
* @see EPIC-018 Index Architecture Refactoring
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Migration check result
|
|
14
|
+
*/
|
|
15
|
+
export interface MigrationCheckResult {
|
|
16
|
+
/** Whether migration is needed */
|
|
17
|
+
needed: boolean;
|
|
18
|
+
/** Whether legacy index exists */
|
|
19
|
+
hasLegacy: boolean;
|
|
20
|
+
/** Whether refs-style index exists */
|
|
21
|
+
hasRefs: boolean;
|
|
22
|
+
/** Number of items in legacy index (if exists) */
|
|
23
|
+
itemCount?: number;
|
|
24
|
+
/** Human-readable status message */
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Auto-migration options
|
|
29
|
+
*/
|
|
30
|
+
export interface AutoMigrationOptions {
|
|
31
|
+
/** Skip backup creation (advanced users only) */
|
|
32
|
+
skipBackup?: boolean;
|
|
33
|
+
/** Silent mode - suppress console output */
|
|
34
|
+
silent?: boolean;
|
|
35
|
+
/** Dry-run mode - check only, don't migrate */
|
|
36
|
+
dryRun?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Migration statistics
|
|
40
|
+
*/
|
|
41
|
+
export interface MigrationStats {
|
|
42
|
+
totalItems: number;
|
|
43
|
+
byType: Record<string, number>;
|
|
44
|
+
byStatus: Record<string, number>;
|
|
45
|
+
byPriority: Record<string, number>;
|
|
46
|
+
backupPath?: string;
|
|
47
|
+
archivePath?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if migration is needed
|
|
51
|
+
*
|
|
52
|
+
* Migration is needed when:
|
|
53
|
+
* - Legacy index.json exists
|
|
54
|
+
* - Refs-style index/ doesn't exist
|
|
55
|
+
*
|
|
56
|
+
* @param devstepsDir Path to .devsteps directory
|
|
57
|
+
* @returns Migration check result with details
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const result = checkMigrationNeeded('/path/to/.devsteps');
|
|
62
|
+
* if (result.needed) {
|
|
63
|
+
* console.log(result.message);
|
|
64
|
+
* await ensureIndexMigrated('/path/to/.devsteps');
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function checkMigrationNeeded(devstepsDir: string): MigrationCheckResult;
|
|
69
|
+
/**
|
|
70
|
+
* Perform index migration (internal implementation)
|
|
71
|
+
*
|
|
72
|
+
* This is the core migration logic without console output.
|
|
73
|
+
* Use ensureIndexMigrated() for auto-migration with user feedback.
|
|
74
|
+
*
|
|
75
|
+
* @param devstepsDir Path to .devsteps directory
|
|
76
|
+
* @param options Migration options
|
|
77
|
+
* @returns Migration statistics
|
|
78
|
+
* @throws Error if migration fails or preconditions not met
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function performMigration(devstepsDir: string, options?: AutoMigrationOptions): Promise<MigrationStats>;
|
|
82
|
+
/**
|
|
83
|
+
* Get user-friendly status message
|
|
84
|
+
*
|
|
85
|
+
* @param devstepsDir Path to .devsteps directory
|
|
86
|
+
* @returns Human-readable status message
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* console.log(getMigrationStatusMessage('/path/to/.devsteps'));
|
|
91
|
+
* // Output: "📦 DevSteps project using refs-style index ✓"
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function getMigrationStatusMessage(devstepsDir: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Automatically migrate if needed
|
|
97
|
+
*
|
|
98
|
+
* Safe to call repeatedly - only migrates once.
|
|
99
|
+
* Checks if migration is needed and runs it if necessary.
|
|
100
|
+
*
|
|
101
|
+
* @param devstepsDir Path to .devsteps directory
|
|
102
|
+
* @param options Migration options
|
|
103
|
+
* @returns True if migration was performed, false if not needed
|
|
104
|
+
* @throws Error if migration fails
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* // Auto-migrate with user feedback
|
|
109
|
+
* const migrated = await ensureIndexMigrated('/path/to/.devsteps');
|
|
110
|
+
* if (migrated) {
|
|
111
|
+
* console.log('✨ Migration complete!');
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
* // Silent auto-migration (for background tasks)
|
|
115
|
+
* await ensureIndexMigrated('/path/to/.devsteps', { silent: true });
|
|
116
|
+
*
|
|
117
|
+
* // Dry-run (check only)
|
|
118
|
+
* const needed = await ensureIndexMigrated('/path/to/.devsteps', { dryRun: true });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function ensureIndexMigrated(devstepsDir: string, options?: AutoMigrationOptions): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Check if items/ directory migration is needed
|
|
124
|
+
*
|
|
125
|
+
* Returns true if using flat structure (epics/, stories/)
|
|
126
|
+
* instead of nested structure (items/epics/, items/stories/)
|
|
127
|
+
*/
|
|
128
|
+
export declare function needsItemsDirectoryMigration(devstepsDir: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Migrate from flat directory structure to items/ subdirectory
|
|
131
|
+
*
|
|
132
|
+
* Moves files from:
|
|
133
|
+
* .devsteps/epics/EPIC-001.json → .devsteps/items/epics/EPIC-001.json
|
|
134
|
+
* .devsteps/stories/... → .devsteps/items/stories/...
|
|
135
|
+
*
|
|
136
|
+
* @param devstepsDir Path to .devsteps directory
|
|
137
|
+
* @param options Migration options
|
|
138
|
+
* @returns Migration statistics
|
|
139
|
+
*/
|
|
140
|
+
export declare function migrateItemsDirectory(devstepsDir: string, options?: AutoMigrationOptions): {
|
|
141
|
+
moved: number;
|
|
142
|
+
types: Record<string, number>;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Ensure index is migrated AND items are in correct directory structure
|
|
146
|
+
*
|
|
147
|
+
* Combines both migrations:
|
|
148
|
+
* 1. Legacy index.json → refs-style index/ (if needed)
|
|
149
|
+
* 2. Flat structure → items/ subdirectory (if needed)
|
|
150
|
+
*
|
|
151
|
+
* Safe to call on every operation - only migrates when needed.
|
|
152
|
+
*/
|
|
153
|
+
export declare function ensureFullMigration(devstepsDir: string, options?: AutoMigrationOptions): Promise<void>;
|
|
154
|
+
//# sourceMappingURL=auto-migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-migrate.d.ts","sourceRoot":"","sources":["../../src/core/auto-migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAEhB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IAEnB,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IAEjB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAA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