@tinyrack/dotweave 0.42.19 → 0.42.21
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/cli/profile/add.d.ts +4 -0
- package/dist/cli/profile/add.d.ts.map +1 -0
- package/dist/cli/profile/add.js +29 -0
- package/dist/cli/profile/add.js.map +1 -0
- package/dist/cli/profile/index.d.ts.map +1 -1
- package/dist/cli/profile/index.js +5 -1
- package/dist/cli/profile/index.js.map +1 -1
- package/dist/cli/profile/list.d.ts.map +1 -1
- package/dist/cli/profile/list.js +4 -12
- package/dist/cli/profile/list.js.map +1 -1
- package/dist/cli/profile/remove.d.ts +4 -0
- package/dist/cli/profile/remove.d.ts.map +1 -0
- package/dist/cli/profile/remove.js +29 -0
- package/dist/cli/profile/remove.js.map +1 -0
- package/dist/cli/profile/use.js +1 -1
- package/dist/cli/profile/use.js.map +1 -1
- package/dist/cli/shared-flags.d.ts +1 -1
- package/dist/cli/shared-flags.d.ts.map +1 -1
- package/dist/cli/shared-flags.js +1 -1
- package/dist/cli/shared-flags.js.map +1 -1
- package/dist/cli/track.d.ts.map +1 -1
- package/dist/cli/track.js +6 -3
- package/dist/cli/track.js.map +1 -1
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.js +1 -1
- package/dist/config/migration.d.ts +6 -0
- package/dist/config/migration.d.ts.map +1 -1
- package/dist/config/migration.js +35 -13
- package/dist/config/migration.js.map +1 -1
- package/dist/config/sync-schema.d.ts +5 -2
- package/dist/config/sync-schema.d.ts.map +1 -1
- package/dist/config/sync-schema.js +89 -4
- package/dist/config/sync-schema.js.map +1 -1
- package/dist/lib/path.d.ts.map +1 -1
- package/dist/lib/path.js +8 -2
- package/dist/lib/path.js.map +1 -1
- package/dist/migrations/sync-v8.d.ts +3 -0
- package/dist/migrations/sync-v8.d.ts.map +1 -0
- package/dist/migrations/sync-v8.js +66 -0
- package/dist/migrations/sync-v8.js.map +1 -0
- package/dist/services/config-file.d.ts +2 -1
- package/dist/services/config-file.d.ts.map +1 -1
- package/dist/services/config-file.js +4 -2
- package/dist/services/config-file.js.map +1 -1
- package/dist/services/profile.d.ts +8 -0
- package/dist/services/profile.d.ts.map +1 -1
- package/dist/services/profile.js +98 -13
- package/dist/services/profile.js.map +1 -1
- package/dist/services/sync-context.d.ts.map +1 -1
- package/dist/services/sync-context.js +11 -2
- package/dist/services/sync-context.js.map +1 -1
- package/dist/services/track.d.ts.map +1 -1
- package/dist/services/track.js +20 -0
- package/dist/services/track.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,QAAA,MAAM,iBAAiB,qDAyBrB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { buildCommand } from "@stricli/core";
|
|
2
|
+
import { addProfile } from "#app/services/profile.ts";
|
|
3
|
+
import { createCliLogger } from "#app/services/terminal/logger.ts";
|
|
4
|
+
const profileAddCommand = buildCommand({
|
|
5
|
+
docs: {
|
|
6
|
+
brief: "Add a sync profile",
|
|
7
|
+
fullDescription: "Register a non-default profile in manifest.jsonc so entries can be assigned to it and it can be selected with profile use.",
|
|
8
|
+
},
|
|
9
|
+
async func(_flags, profile) {
|
|
10
|
+
const logger = createCliLogger();
|
|
11
|
+
const result = await addProfile(profile);
|
|
12
|
+
logger.success(`Added profile ${result.profile}`);
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
flags: {},
|
|
16
|
+
positional: {
|
|
17
|
+
kind: "tuple",
|
|
18
|
+
parameters: [
|
|
19
|
+
{
|
|
20
|
+
brief: "Profile name to add",
|
|
21
|
+
parse: String,
|
|
22
|
+
placeholder: "profile",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default profileAddCommand;
|
|
29
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/profile/add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,iBAAiB,GAAG,YAAY,CAAwC;IAC5E,IAAI,EAAE;QACJ,KAAK,EAAE,oBAAoB;QAC3B,eAAe,EACb,4HAA4H;KAC/H;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO;QACxB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzC,MAAM,CAAC,OAAO,CAAC,iBAAiB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;QACT,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,UAAU,EAAE;gBACV;oBACE,KAAK,EAAE,qBAAqB;oBAC5B,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,SAAS;iBACvB;aACF;SACF;KACF;CACF,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/index.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,YAAY,8EAYhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { buildRouteMap } from "@stricli/core";
|
|
2
|
+
import profileAddCommand from "#app/cli/profile/add.ts";
|
|
2
3
|
import profileListCommand from "#app/cli/profile/list.ts";
|
|
4
|
+
import profileRemoveCommand from "#app/cli/profile/remove.ts";
|
|
3
5
|
import profileUseCommand from "#app/cli/profile/use.ts";
|
|
4
6
|
const profileRoute = buildRouteMap({
|
|
5
7
|
docs: {
|
|
6
8
|
brief: "Manage active and assigned sync profiles",
|
|
7
|
-
fullDescription: "Inspect
|
|
9
|
+
fullDescription: "Inspect, add, remove, or select manifest-registered profiles.",
|
|
8
10
|
},
|
|
9
11
|
routes: {
|
|
12
|
+
add: profileAddCommand,
|
|
10
13
|
list: profileListCommand,
|
|
14
|
+
remove: profileRemoveCommand,
|
|
11
15
|
use: profileUseCommand,
|
|
12
16
|
},
|
|
13
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAExD,MAAM,YAAY,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE;QACJ,KAAK,EAAE,0CAA0C;QACjD,eAAe,EACb
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AACxD,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAExD,MAAM,YAAY,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE;QACJ,KAAK,EAAE,0CAA0C;QACjD,eAAe,EACb,+DAA+D;KAClE;IACD,MAAM,EAAE;QACN,GAAG,EAAE,iBAAiB;QACtB,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,oBAAoB;QAC5B,GAAG,EAAE,iBAAiB;KACvB;CACF,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,QAAA,MAAM,kBAAkB,qDA4BtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
package/dist/cli/profile/list.js
CHANGED
|
@@ -4,24 +4,16 @@ import { createCliLogger } from "#app/services/terminal/logger.ts";
|
|
|
4
4
|
const profileListCommand = buildCommand({
|
|
5
5
|
docs: {
|
|
6
6
|
brief: "Show configured and active sync profiles",
|
|
7
|
-
fullDescription: "List the
|
|
7
|
+
fullDescription: "List the implicit default profile and manifest-registered profiles, and show which profile is active through ~/.config/dotweave/settings.jsonc.",
|
|
8
8
|
},
|
|
9
9
|
async func() {
|
|
10
10
|
const logger = createCliLogger();
|
|
11
11
|
const result = await listProfiles();
|
|
12
12
|
logger.info("Profiles");
|
|
13
13
|
const profiles = [...result.availableProfiles];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
else {
|
|
18
|
-
logger.list(profiles.map((name) => name === result.activeProfile ? `${name} (active)` : name), { highlightLast: false });
|
|
19
|
-
}
|
|
20
|
-
if (result.assignments.length > 0) {
|
|
21
|
-
logger.log(` ${result.assignments.length} restricted entries`);
|
|
22
|
-
if (result.activeProfile === undefined) {
|
|
23
|
-
logger.warn("restricted entries are skipped until a profile is active");
|
|
24
|
-
}
|
|
14
|
+
logger.list(profiles.map((name) => name === result.activeProfile ? `${name} (active)` : name), { highlightLast: false });
|
|
15
|
+
if (result.activeProfileWarning !== undefined) {
|
|
16
|
+
logger.warn(result.activeProfileWarning);
|
|
25
17
|
}
|
|
26
18
|
},
|
|
27
19
|
parameters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/profile/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,kBAAkB,GAAG,YAAY,CAAkC;IACvE,IAAI,EAAE;QACJ,KAAK,EAAE,0CAA0C;QACjD,eAAe,EACb,iJAAiJ;KACpJ;IACD,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QAEjC,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;QAEpC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAExB,MAAM,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/C,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/profile/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,kBAAkB,GAAG,YAAY,CAAkC;IACvE,IAAI,EAAE;QACJ,KAAK,EAAE,0CAA0C;QACjD,eAAe,EACb,iJAAiJ;KACpJ;IACD,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QAEjC,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;QAEpC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAExB,MAAM,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAI,CACT,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACpB,IAAI,KAAK,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAC1D,EACD,EAAE,aAAa,EAAE,KAAK,EAAE,CACzB,CAAC;QAEF,IAAI,MAAM,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;KACV;CACF,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/cli/profile/remove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,QAAA,MAAM,oBAAoB,qDA6BxB,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { buildCommand } from "@stricli/core";
|
|
2
|
+
import { removeProfile } from "#app/services/profile.ts";
|
|
3
|
+
import { createCliLogger } from "#app/services/terminal/logger.ts";
|
|
4
|
+
const profileRemoveCommand = buildCommand({
|
|
5
|
+
docs: {
|
|
6
|
+
brief: "Remove a sync profile",
|
|
7
|
+
fullDescription: "Unregister an unused non-default profile from manifest.jsonc. Reassign or clear tracked entry assignments before removing a referenced profile.",
|
|
8
|
+
},
|
|
9
|
+
async func(_flags, profile) {
|
|
10
|
+
const logger = createCliLogger();
|
|
11
|
+
const result = await removeProfile(profile);
|
|
12
|
+
logger.success(`Removed profile ${result.profile}`);
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
flags: {},
|
|
16
|
+
positional: {
|
|
17
|
+
kind: "tuple",
|
|
18
|
+
parameters: [
|
|
19
|
+
{
|
|
20
|
+
brief: "Profile name to remove",
|
|
21
|
+
parse: String,
|
|
22
|
+
placeholder: "profile",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default profileRemoveCommand;
|
|
29
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/cli/profile/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,oBAAoB,GAAG,YAAY,CAIvC;IACA,IAAI,EAAE;QACJ,KAAK,EAAE,uBAAuB;QAC9B,eAAe,EACb,iJAAiJ;KACpJ;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO;QACxB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;QAE5C,MAAM,CAAC,OAAO,CAAC,mBAAmB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;QACT,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,UAAU,EAAE;gBACV;oBACE,KAAK,EAAE,wBAAwB;oBAC/B,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,SAAS;iBACvB;aACF;SACF;KACF;CACF,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
package/dist/cli/profile/use.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createCliLogger } from "#app/services/terminal/logger.ts";
|
|
|
4
4
|
const profileUseCommand = buildCommand({
|
|
5
5
|
docs: {
|
|
6
6
|
brief: "Set or clear the active sync profile",
|
|
7
|
-
fullDescription: "Write ~/.config/dotweave/settings.jsonc so plain push, pull, status, and doctor commands use the selected profile
|
|
7
|
+
fullDescription: "Write ~/.config/dotweave/settings.jsonc so plain push, pull, status, and doctor commands use the selected registered profile by default. Omit the profile name to clear the active profile.",
|
|
8
8
|
},
|
|
9
9
|
async func(_flags, profile) {
|
|
10
10
|
const logger = createCliLogger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/cli/profile/use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,iBAAiB,GAAG,YAAY,CAAyC;IAC7E,IAAI,EAAE;QACJ,KAAK,EAAE,sCAAsC;QAC7C,eAAe,EACb,
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/cli/profile/use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,iBAAiB,GAAG,YAAY,CAAyC;IAC7E,IAAI,EAAE;QACJ,KAAK,EAAE,sCAAsC;QAC7C,eAAe,EACb,6LAA6L;KAChM;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO;QACxB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QAEjC,MAAM,MAAM,GACV,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC;YACjC,CAAC,CAAC,MAAM,kBAAkB,EAAE,CAAC;QAEjC,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC5B,MAAM,CAAC,OAAO,CAAC,yBAAyB,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;QACT,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,UAAU,EAAE;gBACV;oBACE,KAAK,EAAE,0CAA0C;oBACjD,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,SAAS;iBACvB;aACF;SACF;KACF;CACF,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type NoFlags = Record<never, never>;
|
|
2
2
|
export declare const profileFlag: {
|
|
3
|
-
readonly brief: "Use a
|
|
3
|
+
readonly brief: "Use a registered profile layer for this command (add non-default profiles with 'dotweave profile add')";
|
|
4
4
|
readonly kind: "parsed";
|
|
5
5
|
readonly optional: true;
|
|
6
6
|
readonly parse: StringConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-flags.d.ts","sourceRoot":"","sources":["../../src/cli/shared-flags.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,eAAO,MAAM,WAAW;;;;;;
|
|
1
|
+
{"version":3,"file":"shared-flags.d.ts","sourceRoot":"","sources":["../../src/cli/shared-flags.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,eAAO,MAAM,WAAW;;;;;;CAOd,CAAC"}
|
package/dist/cli/shared-flags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-flags.js","sourceRoot":"","sources":["../../src/cli/shared-flags.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,
|
|
1
|
+
{"version":3,"file":"shared-flags.js","sourceRoot":"","sources":["../../src/cli/shared-flags.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EACH,wGAAwG;IAC1G,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,SAAS;CACd,CAAC"}
|
package/dist/cli/track.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/cli/track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/cli/track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAmBxD,QAAA,MAAM,YAAY,qDAmIhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
package/dist/cli/track.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildCommand } from "@stricli/core";
|
|
2
2
|
import { AppConstants } from "#app/config/constants.ts";
|
|
3
3
|
import { DotweaveError } from "#app/lib/error.ts";
|
|
4
|
-
import { assignProfiles } from "#app/services/profile.ts";
|
|
4
|
+
import { assignProfiles, validateProfilesExist, } from "#app/services/profile.ts";
|
|
5
5
|
import { setTargetMode } from "#app/services/sync-mode.ts";
|
|
6
6
|
import { createCliLogger } from "#app/services/terminal/logger.ts";
|
|
7
7
|
import { proposePathCompletions } from "#app/services/terminal/path-completion.ts";
|
|
@@ -53,9 +53,12 @@ const trackCommand = buildCommand({
|
|
|
53
53
|
if (flags.repoPath === undefined &&
|
|
54
54
|
error instanceof DotweaveError &&
|
|
55
55
|
error.code === "TARGET_NOT_FOUND") {
|
|
56
|
+
const isProfileClear = profiles.length === 1 && profiles[0] === "";
|
|
57
|
+
if (profiles.length > 0 && !isProfileClear) {
|
|
58
|
+
await validateProfilesExist(profiles);
|
|
59
|
+
}
|
|
56
60
|
const setResult = await setTargetMode({ mode: flags.mode, target }, cwd);
|
|
57
61
|
if (profiles.length > 0) {
|
|
58
|
-
const isProfileClear = profiles.length === 1 && profiles[0] === "";
|
|
59
62
|
await assignProfiles({ profiles: isProfileClear ? [] : profiles, target }, cwd);
|
|
60
63
|
}
|
|
61
64
|
if (setResult.action === "unchanged") {
|
|
@@ -83,7 +86,7 @@ const trackCommand = buildCommand({
|
|
|
83
86
|
values: AppConstants.SYNC.MODES,
|
|
84
87
|
},
|
|
85
88
|
profile: {
|
|
86
|
-
brief: "Restrict syncing to
|
|
89
|
+
brief: "Restrict syncing to registered profiles (add non-default profiles with 'dotweave profile add')",
|
|
87
90
|
kind: "parsed",
|
|
88
91
|
optional: true,
|
|
89
92
|
parse: String,
|
package/dist/cli/track.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.js","sourceRoot":"","sources":["../../src/cli/track.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM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H,CAAC;IACD,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,KAAK,EAAE,mCAAmC;gBAC1C,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnC,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK;aAChC;YACD,OAAO,EAAE;gBACP,KAAK,EACH,gGAAgG;gBAClG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,SAAS;gBACtB,QAAQ,EAAE,IAAI;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,sDAAsD;gBAC7D,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,MAAM;aACpB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC;YACV,SAAS,EAAE;gBACT,KAAK,EACH,4IAA4I;gBAC9I,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,QAAQ;gBACrB,kBAAkB,EAAE,sBAAsB;aAC3C;SACF;KACF;CACF,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -17,7 +17,7 @@ export declare const AppConstants: {
|
|
|
17
17
|
};
|
|
18
18
|
readonly SYNC: {
|
|
19
19
|
readonly CONFIG_FILE_NAME: "manifest.jsonc";
|
|
20
|
-
readonly CONFIG_VERSION:
|
|
20
|
+
readonly CONFIG_VERSION: 8;
|
|
21
21
|
readonly DEFAULT_CONCURRENCY: 20;
|
|
22
22
|
readonly DEFAULT_PROFILE: "default";
|
|
23
23
|
readonly MODES: readonly ["normal", "secret", "ignore"];
|
package/dist/config/constants.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type ConfigMigrationFn = (config: Record<string, unknown>) => Record<string, unknown>;
|
|
2
2
|
export type ConfigMigrationRegistry = ReadonlyMap<number, ConfigMigrationFn>;
|
|
3
|
+
export type ConfigMigrationResult = Readonly<{
|
|
4
|
+
config: unknown;
|
|
5
|
+
migrated: boolean;
|
|
6
|
+
originalVersion?: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const applyConfigMigrations: (rawConfig: unknown, registry: ConfigMigrationRegistry, targetVersion: number, filePath: string) => ConfigMigrationResult;
|
|
3
9
|
/**
|
|
4
10
|
* Applies sequential config migrations from the detected version up to targetVersion.
|
|
5
11
|
* Creates a backup file before the first migration step, then saves the result.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/config/migration.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7B,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,OAAO,EAClB,UAAU,uBAAuB,EACjC,eAAe,MAAM,EACrB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/config/migration.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7B,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE7E,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC,CAAC;AAkBH,eAAO,MAAM,qBAAqB,GAChC,WAAW,OAAO,EAClB,UAAU,uBAAuB,EACjC,eAAe,MAAM,EACrB,UAAU,MAAM,KACf,qBAsEF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,OAAO,EAClB,UAAU,uBAAuB,EACjC,eAAe,MAAM,EACrB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CA4BjB,CAAC"}
|
package/dist/config/migration.js
CHANGED
|
@@ -3,25 +3,31 @@ import { basename, dirname, join } from "node:path";
|
|
|
3
3
|
import { DotweaveError } from "#app/lib/error.ts";
|
|
4
4
|
import { writeTextFileAtomically } from "#app/lib/filesystem.ts";
|
|
5
5
|
import { ensureTrailingNewline } from "#app/lib/string.ts";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const withMigrationContext = (error, filePath, fromVersion) => {
|
|
7
|
+
return new DotweaveError(error.message, {
|
|
8
|
+
code: error.code,
|
|
9
|
+
details: [
|
|
10
|
+
...error.details,
|
|
11
|
+
`Config file: ${filePath}`,
|
|
12
|
+
`Migration: ${fromVersion} → ${fromVersion + 1}`,
|
|
13
|
+
],
|
|
14
|
+
hint: error.hint,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export const applyConfigMigrations = (rawConfig, registry, targetVersion, filePath) => {
|
|
12
18
|
if (typeof rawConfig !== "object" ||
|
|
13
19
|
rawConfig === null ||
|
|
14
20
|
Array.isArray(rawConfig)) {
|
|
15
|
-
return rawConfig;
|
|
21
|
+
return { config: rawConfig, migrated: false };
|
|
16
22
|
}
|
|
17
23
|
const configObject = rawConfig;
|
|
18
24
|
// biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature requires bracket notation
|
|
19
25
|
const version = configObject["version"];
|
|
20
26
|
if (typeof version !== "number") {
|
|
21
|
-
return rawConfig;
|
|
27
|
+
return { config: rawConfig, migrated: false };
|
|
22
28
|
}
|
|
23
29
|
if (version === targetVersion) {
|
|
24
|
-
return rawConfig;
|
|
30
|
+
return { config: rawConfig, migrated: false, originalVersion: version };
|
|
25
31
|
}
|
|
26
32
|
if (version > targetVersion) {
|
|
27
33
|
throw new DotweaveError(`Config file version ${version} is newer than this CLI supports (max: ${targetVersion}).`, {
|
|
@@ -30,8 +36,6 @@ export const runConfigMigrations = async (rawConfig, registry, targetVersion, fi
|
|
|
30
36
|
hint: "Upgrade dotweave to the latest version.",
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
|
-
const backupPath = join(dirname(filePath), `${basename(filePath)}.v${version}.bak`);
|
|
34
|
-
await writeFile(backupPath, ensureTrailingNewline(JSON.stringify(configObject, null, 2)), "utf8");
|
|
35
39
|
let current = configObject;
|
|
36
40
|
for (let v = version; v < targetVersion; v++) {
|
|
37
41
|
const migrateFn = registry.get(v);
|
|
@@ -46,16 +50,34 @@ export const runConfigMigrations = async (rawConfig, registry, targetVersion, fi
|
|
|
46
50
|
current = migrateFn(current);
|
|
47
51
|
}
|
|
48
52
|
catch (error) {
|
|
53
|
+
if (error instanceof DotweaveError) {
|
|
54
|
+
throw withMigrationContext(error, filePath, v);
|
|
55
|
+
}
|
|
49
56
|
throw new DotweaveError(`Failed to migrate config from version ${v} to ${v + 1}.`, {
|
|
50
57
|
code: "CONFIG_MIGRATION_FAILED",
|
|
51
58
|
details: [
|
|
52
59
|
`Config file: ${filePath}`,
|
|
60
|
+
`Migration: ${v} → ${v + 1}`,
|
|
53
61
|
...(error instanceof Error ? [error.message] : []),
|
|
54
62
|
],
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
return { config: current, migrated: true, originalVersion: version };
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Applies sequential config migrations from the detected version up to targetVersion.
|
|
70
|
+
* Creates a backup file before the first migration step, then saves the result.
|
|
71
|
+
* Returns the migrated config (or the original if no migration was needed).
|
|
72
|
+
*/
|
|
73
|
+
export const runConfigMigrations = async (rawConfig, registry, targetVersion, filePath) => {
|
|
74
|
+
const { config, migrated, originalVersion } = applyConfigMigrations(rawConfig, registry, targetVersion, filePath);
|
|
75
|
+
if (!migrated || originalVersion === undefined) {
|
|
76
|
+
return config;
|
|
77
|
+
}
|
|
78
|
+
const backupPath = join(dirname(filePath), `${basename(filePath)}.v${originalVersion}.bak`);
|
|
79
|
+
await writeFile(backupPath, ensureTrailingNewline(JSON.stringify(rawConfig, null, 2)), "utf8");
|
|
80
|
+
await writeTextFileAtomically(filePath, ensureTrailingNewline(JSON.stringify(config, null, 2)));
|
|
81
|
+
return config;
|
|
60
82
|
};
|
|
61
83
|
//# sourceMappingURL=migration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/config/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/config/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,qBAAqB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Ae,EAAE,OAAO,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,SAAkB,EAClB,QAAiC,EACjC,aAAqB,EACrB,QAAgB,EACE,EAAE;IACpB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,qBAAqB,CACjE,SAAS,EACT,QAAQ,EACR,aAAa,EACb,QAAQ,CACT,CAAC;IAEF,IAAI,CAAC,QAAQ,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CACrB,OAAO,CAAC,QAAQ,CAAC,EACjB,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,eAAe,MAAM,CAChD,CAAC;IACF,MAAM,SAAS,CACb,UAAU,EACV,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EACzD,MAAM,CACP,CAAC;IAEF,MAAM,uBAAuB,CAC3B,QAAQ,EACR,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CACvD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -36,10 +36,11 @@ declare const platformPermissionSchema: z.ZodObject<{
|
|
|
36
36
|
wsl: z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export declare const syncConfigSchema: z.ZodObject<{
|
|
39
|
-
version: z.ZodLiteral<7>;
|
|
39
|
+
version: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<8>]>;
|
|
40
40
|
age: z.ZodOptional<z.ZodObject<{
|
|
41
41
|
recipients: z.ZodArray<z.ZodString>;
|
|
42
42
|
}, z.core.$strip>>;
|
|
43
|
+
profiles: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
43
44
|
entries: z.ZodArray<z.ZodObject<{
|
|
44
45
|
kind: z.ZodEnum<{
|
|
45
46
|
file: "file";
|
|
@@ -130,13 +131,15 @@ export type AgeConfig = Readonly<{
|
|
|
130
131
|
export type ResolvedSyncConfig = Readonly<{
|
|
131
132
|
age?: AgeConfig;
|
|
132
133
|
entries: readonly ResolvedSyncConfigEntry[];
|
|
133
|
-
|
|
134
|
+
profiles?: readonly string[];
|
|
135
|
+
version: 7 | typeof AppConstants.SYNC.CONFIG_VERSION;
|
|
134
136
|
}>;
|
|
135
137
|
export declare const normalizeSyncRepoPath: (value: string) => string;
|
|
136
138
|
export declare const normalizeSyncProfileName: (value: string, description?: string) => string;
|
|
137
139
|
export declare const hasReservedSyncArtifactSuffixSegment: (value: string) => boolean;
|
|
138
140
|
export declare const deriveRepoPathFromLocalPath: (localPath: PlatformStringValue, homeDirectory: string) => string;
|
|
139
141
|
export declare const validateResolvedSyncConfigEntries: (entries: readonly ResolvedSyncConfigEntry[]) => void;
|
|
142
|
+
export declare const validateRawSyncConfigProfileRegistry: (config: Pick<RawSyncConfig, "entries" | "profiles">) => string[];
|
|
140
143
|
export declare const parseSyncConfig: (input: unknown, context: SyncConfigResolutionContext) => ResolvedSyncConfig;
|
|
141
144
|
export declare const createInitialSyncConfig: (age: {
|
|
142
145
|
recipients: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-schema.d.ts","sourceRoot":"","sources":["../../src/config/sync-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-schema.d.ts","sourceRoot":"","sources":["../../src/config/sync-schema.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,yBAAyB,CAAC;AAiDjC,QAAA,MAAM,sB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,KAAG,aAOH,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,aAAa,WAErD,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,eAAe,MAAM,WAE9D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,eAAe,MAAM,EACrB,SAAS,2BAA2B,KACnC,OAAO,CAAC,kBAAkB,CAsD5B,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { isAbsolute, join, posix, relative, sep } from "node:path";
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, posix, relative, sep, } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { AppConstants } from "#app/config/constants.ts";
|
|
5
|
+
import { applyConfigMigrations } from "#app/config/migration.ts";
|
|
5
6
|
import { resolvePlatformValue, } from "#app/config/platform.ts";
|
|
6
7
|
import { resolveConfiguredAbsolutePath } from "#app/config/xdg.ts";
|
|
7
8
|
import { DotweaveError } from "#app/lib/error.ts";
|
|
8
9
|
import { parsePermissionOctal } from "#app/lib/file-mode.ts";
|
|
10
|
+
import { writeTextFileAtomically } from "#app/lib/filesystem.ts";
|
|
9
11
|
import { parseJsonc, validateJsoncConfigPath } from "#app/lib/jsonc.ts";
|
|
10
12
|
import { doPathsOverlap } from "#app/lib/path.ts";
|
|
11
13
|
import { ensureTrailingNewline } from "#app/lib/string.ts";
|
|
12
14
|
import { formatInputIssues } from "#app/lib/validation.ts";
|
|
15
|
+
import { migrateSyncConfigV7ToV8 } from "#app/migrations/sync-v8.ts";
|
|
16
|
+
const syncConfigMigrationRegistry = new Map([[7, migrateSyncConfigV7ToV8]]);
|
|
13
17
|
// ---------------------------------------------------------------------------
|
|
14
18
|
// Zod schemas
|
|
15
19
|
// ---------------------------------------------------------------------------
|
|
@@ -20,6 +24,9 @@ const requiredTrimmedStringSchema = z
|
|
|
20
24
|
const syncProfileNameArraySchema = z
|
|
21
25
|
.array(requiredTrimmedStringSchema)
|
|
22
26
|
.min(1, "At least one profile must be specified.");
|
|
27
|
+
const syncProfileRegistrySchema = z
|
|
28
|
+
.array(requiredTrimmedStringSchema)
|
|
29
|
+
.default([]);
|
|
23
30
|
const platformLocalPathSchema = z.object({
|
|
24
31
|
default: requiredTrimmedStringSchema,
|
|
25
32
|
win: requiredTrimmedStringSchema.optional(),
|
|
@@ -67,8 +74,9 @@ const syncConfigAgeSchema = z.object({
|
|
|
67
74
|
.min(1, "At least one age recipient is required."),
|
|
68
75
|
});
|
|
69
76
|
const syncConfigSchemaV7 = z.object({
|
|
70
|
-
version: z.literal(AppConstants.SYNC.CONFIG_VERSION),
|
|
77
|
+
version: z.union([z.literal(7), z.literal(AppConstants.SYNC.CONFIG_VERSION)]),
|
|
71
78
|
age: syncConfigAgeSchema.optional(),
|
|
79
|
+
profiles: syncProfileRegistrySchema,
|
|
72
80
|
entries: z.array(syncConfigEntrySchema),
|
|
73
81
|
});
|
|
74
82
|
export const syncConfigSchema = syncConfigSchemaV7;
|
|
@@ -206,6 +214,70 @@ export const validateResolvedSyncConfigEntries = (entries) => {
|
|
|
206
214
|
validatePathOverlaps(entries, "repoPath", "Repository");
|
|
207
215
|
validatePathOverlaps(entries, "localPath", "Local");
|
|
208
216
|
};
|
|
217
|
+
const normalizeProfileRegistry = (profiles) => {
|
|
218
|
+
const normalizedProfiles = profiles.map((profile) => normalizeSyncProfileName(profile));
|
|
219
|
+
const seenProfiles = new Set();
|
|
220
|
+
for (const profile of normalizedProfiles) {
|
|
221
|
+
if (profile === AppConstants.SYNC.DEFAULT_PROFILE) {
|
|
222
|
+
throw new DotweaveError(`Profile '${AppConstants.SYNC.DEFAULT_PROFILE}' is implicit and must not be listed in manifest profiles.`, {
|
|
223
|
+
code: "INVALID_PROFILE_REGISTRY",
|
|
224
|
+
hint: `Remove '${AppConstants.SYNC.DEFAULT_PROFILE}' from profiles in ${AppConstants.SYNC.CONFIG_FILE_NAME}.`,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (seenProfiles.has(profile)) {
|
|
228
|
+
throw new DotweaveError(`Duplicate profile '${profile}' in manifest.`, {
|
|
229
|
+
code: "DUPLICATE_PROFILE",
|
|
230
|
+
hint: `Remove duplicate profile names from profiles in ${AppConstants.SYNC.CONFIG_FILE_NAME}.`,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
seenProfiles.add(profile);
|
|
234
|
+
}
|
|
235
|
+
return normalizedProfiles;
|
|
236
|
+
};
|
|
237
|
+
const validateProfileReferences = (references, profiles) => {
|
|
238
|
+
const availableProfiles = new Set([
|
|
239
|
+
AppConstants.SYNC.DEFAULT_PROFILE,
|
|
240
|
+
...profiles,
|
|
241
|
+
]);
|
|
242
|
+
for (const [entryLabel, entryProfiles] of references) {
|
|
243
|
+
for (const profile of entryProfiles) {
|
|
244
|
+
const normalizedProfile = normalizeSyncProfileName(profile);
|
|
245
|
+
if (!availableProfiles.has(normalizedProfile)) {
|
|
246
|
+
throw new DotweaveError(`Unknown profile '${normalizedProfile}'.`, {
|
|
247
|
+
code: "UNKNOWN_PROFILE",
|
|
248
|
+
details: [`Entry: ${entryLabel}`],
|
|
249
|
+
hint: `Add it with 'dotweave profile add ${normalizedProfile}', or remove it from the entry profiles.`,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const validateEntryProfileReferences = (entries, profiles) => {
|
|
256
|
+
validateProfileReferences(entries.map((entry) => [entry.repoPath, entry.profiles]), profiles);
|
|
257
|
+
};
|
|
258
|
+
export const validateRawSyncConfigProfileRegistry = (config) => {
|
|
259
|
+
const profiles = normalizeProfileRegistry(config.profiles ?? []);
|
|
260
|
+
validateProfileReferences(config.entries.map((entry, index) => [
|
|
261
|
+
entry.repoPath?.default ?? entry.localPath.default ?? `#${index}`,
|
|
262
|
+
entry.profiles ?? [],
|
|
263
|
+
]), profiles);
|
|
264
|
+
return profiles;
|
|
265
|
+
};
|
|
266
|
+
const collectLegacyProfileRegistry = (entries) => {
|
|
267
|
+
const profiles = new Set();
|
|
268
|
+
for (const entry of entries) {
|
|
269
|
+
if (entry.profiles === undefined) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
for (const profile of entry.profiles) {
|
|
273
|
+
const normalizedProfile = normalizeSyncProfileName(profile);
|
|
274
|
+
if (normalizedProfile !== AppConstants.SYNC.DEFAULT_PROFILE) {
|
|
275
|
+
profiles.add(normalizedProfile);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return [...profiles].sort((left, right) => left.localeCompare(right));
|
|
280
|
+
};
|
|
209
281
|
// ---------------------------------------------------------------------------
|
|
210
282
|
// Internal parsing helpers
|
|
211
283
|
// ---------------------------------------------------------------------------
|
|
@@ -334,6 +406,9 @@ export const parseSyncConfig = (input, context) => {
|
|
|
334
406
|
hint: `Fix the invalid fields in ${AppConstants.SYNC.CONFIG_FILE_NAME}, then run the command again.`,
|
|
335
407
|
});
|
|
336
408
|
}
|
|
409
|
+
const profiles = normalizeProfileRegistry(result.data.version === 7
|
|
410
|
+
? collectLegacyProfileRegistry(result.data.entries)
|
|
411
|
+
: result.data.profiles);
|
|
337
412
|
const rawEntries = result.data.entries.map((entry) => {
|
|
338
413
|
const resolvedLocalPath = resolveSyncEntryLocalPath(entry.localPath, context);
|
|
339
414
|
const configuredRepoPath = entry.repoPath === undefined
|
|
@@ -372,6 +447,7 @@ export const parseSyncConfig = (input, context) => {
|
|
|
372
447
|
});
|
|
373
448
|
validateResolvedSyncConfigEntries(rawEntries);
|
|
374
449
|
const entries = applyEntryInheritance(rawEntries, platformKey);
|
|
450
|
+
validateEntryProfileReferences(entries, profiles);
|
|
375
451
|
const age = result.data.age === undefined
|
|
376
452
|
? undefined
|
|
377
453
|
: {
|
|
@@ -380,6 +456,7 @@ export const parseSyncConfig = (input, context) => {
|
|
|
380
456
|
return {
|
|
381
457
|
...(age === undefined ? {} : { age }),
|
|
382
458
|
entries,
|
|
459
|
+
profiles,
|
|
383
460
|
version: result.data.version,
|
|
384
461
|
};
|
|
385
462
|
};
|
|
@@ -387,6 +464,7 @@ export const createInitialSyncConfig = (age) => {
|
|
|
387
464
|
return {
|
|
388
465
|
version: AppConstants.SYNC.CONFIG_VERSION,
|
|
389
466
|
age,
|
|
467
|
+
profiles: [],
|
|
390
468
|
entries: [],
|
|
391
469
|
};
|
|
392
470
|
};
|
|
@@ -401,7 +479,14 @@ export const readSyncConfig = async (syncDirectory, context) => {
|
|
|
401
479
|
try {
|
|
402
480
|
const contents = await readFile(filePath, "utf8");
|
|
403
481
|
const parsed = parseJsonc(contents);
|
|
404
|
-
|
|
482
|
+
const migration = applyConfigMigrations(parsed, syncConfigMigrationRegistry, AppConstants.SYNC.CONFIG_VERSION, filePath);
|
|
483
|
+
const resolved = parseSyncConfig(migration.config, context);
|
|
484
|
+
if (migration.migrated && migration.originalVersion !== undefined) {
|
|
485
|
+
const backupPath = join(dirname(filePath), `${basename(filePath)}.v${migration.originalVersion}.bak`);
|
|
486
|
+
await writeFile(backupPath, ensureTrailingNewline(JSON.stringify(parsed, null, 2)), "utf8");
|
|
487
|
+
await writeTextFileAtomically(filePath, ensureTrailingNewline(JSON.stringify(migration.config, null, 2)));
|
|
488
|
+
}
|
|
489
|
+
return resolved;
|
|
405
490
|
}
|
|
406
491
|
catch (error) {
|
|
407
492
|
if (error instanceof DotweaveError) {
|