@dboio/cli 0.9.5 → 0.9.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/package.json +1 -1
- package/src/commands/clone.js +3 -6
- package/src/lib/delta.js +34 -4
package/package.json
CHANGED
package/src/commands/clone.js
CHANGED
|
@@ -2533,12 +2533,9 @@ async function processRecord(entityName, record, structure, options, usedNames,
|
|
|
2533
2533
|
meta._contentColumns = ['Content'];
|
|
2534
2534
|
}
|
|
2535
2535
|
|
|
2536
|
-
//
|
|
2537
|
-
//
|
|
2538
|
-
//
|
|
2539
|
-
if (ext && !record.Extension) {
|
|
2540
|
-
meta.Extension = ext;
|
|
2541
|
-
}
|
|
2536
|
+
// Extension was derived from Name/Path for local filename purposes only.
|
|
2537
|
+
// Do NOT write it to metadata or baseline when the server doesn't have it —
|
|
2538
|
+
// this prevents delta detection from flagging a false change on push.
|
|
2542
2539
|
|
|
2543
2540
|
await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
|
|
2544
2541
|
log.dim(` → ${metaPath}`);
|
package/src/lib/delta.js
CHANGED
|
@@ -48,12 +48,31 @@ export function findBaselineEntry(baseline, entity, uid) {
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// Check top-level array first
|
|
51
52
|
const entityArray = baseline.children[entity];
|
|
52
|
-
if (
|
|
53
|
-
|
|
53
|
+
if (Array.isArray(entityArray)) {
|
|
54
|
+
const found = entityArray.find(item => item.UID === uid);
|
|
55
|
+
if (found) return found;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// For output hierarchy entities (output_value, output_value_filter,
|
|
59
|
+
// output_value_entity_column_rel), also search nested inside each
|
|
60
|
+
// output record's .children — server nests them per-output.
|
|
61
|
+
if (entity !== 'output') {
|
|
62
|
+
const outputs = baseline.children.output;
|
|
63
|
+
if (Array.isArray(outputs)) {
|
|
64
|
+
for (const o of outputs) {
|
|
65
|
+
if (!o.children) continue;
|
|
66
|
+
const nested = o.children[entity];
|
|
67
|
+
if (Array.isArray(nested)) {
|
|
68
|
+
const found = nested.find(item => item.UID === uid);
|
|
69
|
+
if (found) return found;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
54
73
|
}
|
|
55
74
|
|
|
56
|
-
return
|
|
75
|
+
return null;
|
|
57
76
|
}
|
|
58
77
|
|
|
59
78
|
/**
|
|
@@ -127,6 +146,13 @@ export async function detectChangedColumns(metaPath, baseline) {
|
|
|
127
146
|
const baselineValue = normalizeValue(baselineEntry[columnName]);
|
|
128
147
|
|
|
129
148
|
if (currentValue !== baselineValue) {
|
|
149
|
+
// Skip Extension column when baseline is null/empty — clone derives
|
|
150
|
+
// it from the filename for local use but it's not a user change.
|
|
151
|
+
if (columnName === 'Extension'
|
|
152
|
+
&& !baselineValue
|
|
153
|
+
&& (baselineEntry[columnName] === null || baselineEntry[columnName] === undefined)) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
130
156
|
changedColumns.push(columnName);
|
|
131
157
|
}
|
|
132
158
|
}
|
|
@@ -183,13 +209,17 @@ function isReference(value) {
|
|
|
183
209
|
|
|
184
210
|
/**
|
|
185
211
|
* Resolve a @reference path to absolute file path.
|
|
212
|
+
* @/ prefix means relative to project root (cwd), plain @ is relative to baseDir.
|
|
186
213
|
*
|
|
187
|
-
* @param {string} reference - Reference string starting with @ (e.g., "@file.html")
|
|
214
|
+
* @param {string} reference - Reference string starting with @ (e.g., "@file.html" or "@/docs/file.md")
|
|
188
215
|
* @param {string} baseDir - Base directory containing metadata
|
|
189
216
|
* @returns {string} - Absolute file path
|
|
190
217
|
*/
|
|
191
218
|
function resolveReferencePath(reference, baseDir) {
|
|
192
219
|
const refPath = reference.substring(1); // Strip leading @
|
|
220
|
+
if (refPath.startsWith('/')) {
|
|
221
|
+
return join(process.cwd(), refPath);
|
|
222
|
+
}
|
|
193
223
|
return join(baseDir, refPath);
|
|
194
224
|
}
|
|
195
225
|
|