ctxr-cli 0.17.0 → 0.19.0

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.
Files changed (101) hide show
  1. package/README.md +12 -5
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +2 -1
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/publish-check.d.ts +7 -0
  6. package/dist/commands/publish-check.d.ts.map +1 -1
  7. package/dist/commands/publish-check.js +8 -3
  8. package/dist/commands/publish-check.js.map +1 -1
  9. package/dist/commands/publish-new.d.ts +8 -0
  10. package/dist/commands/publish-new.d.ts.map +1 -1
  11. package/dist/commands/publish-new.js +6 -3
  12. package/dist/commands/publish-new.js.map +1 -1
  13. package/dist/commands/serve.d.ts.map +1 -1
  14. package/dist/commands/serve.js +5 -4
  15. package/dist/commands/serve.js.map +1 -1
  16. package/dist/commands/session-start.d.ts +7 -1
  17. package/dist/commands/session-start.d.ts.map +1 -1
  18. package/dist/commands/session-start.js +25 -5
  19. package/dist/commands/session-start.js.map +1 -1
  20. package/dist/commands/update.d.ts +41 -2
  21. package/dist/commands/update.d.ts.map +1 -1
  22. package/dist/commands/update.js +125 -3
  23. package/dist/commands/update.js.map +1 -1
  24. package/dist/commands/version.d.ts +6 -0
  25. package/dist/commands/version.d.ts.map +1 -1
  26. package/dist/commands/version.js +4 -1
  27. package/dist/commands/version.js.map +1 -1
  28. package/dist/config/defaults.d.ts +5 -0
  29. package/dist/config/defaults.d.ts.map +1 -1
  30. package/dist/config/defaults.js +5 -0
  31. package/dist/config/defaults.js.map +1 -1
  32. package/dist/config/load.d.ts +22 -1
  33. package/dist/config/load.d.ts.map +1 -1
  34. package/dist/config/load.js +54 -17
  35. package/dist/config/load.js.map +1 -1
  36. package/dist/config/migrations.d.ts +61 -0
  37. package/dist/config/migrations.d.ts.map +1 -0
  38. package/dist/config/migrations.js +55 -0
  39. package/dist/config/migrations.js.map +1 -0
  40. package/dist/config/schema.d.ts +14 -8
  41. package/dist/config/schema.d.ts.map +1 -1
  42. package/dist/config/schema.js +61 -8
  43. package/dist/config/schema.js.map +1 -1
  44. package/dist/core/browse/nav.d.ts.map +1 -1
  45. package/dist/core/browse/nav.js +6 -2
  46. package/dist/core/browse/nav.js.map +1 -1
  47. package/dist/core/browse/page-url.d.ts +68 -0
  48. package/dist/core/browse/page-url.d.ts.map +1 -0
  49. package/dist/core/browse/page-url.js +101 -0
  50. package/dist/core/browse/page-url.js.map +1 -0
  51. package/dist/core/env.d.ts +7 -0
  52. package/dist/core/env.d.ts.map +1 -1
  53. package/dist/core/env.js.map +1 -1
  54. package/dist/core/errors.d.ts +42 -1
  55. package/dist/core/errors.d.ts.map +1 -1
  56. package/dist/core/errors.js +79 -4
  57. package/dist/core/errors.js.map +1 -1
  58. package/dist/core/git/worktree.d.ts +10 -2
  59. package/dist/core/git/worktree.d.ts.map +1 -1
  60. package/dist/core/git/worktree.js +11 -2
  61. package/dist/core/git/worktree.js.map +1 -1
  62. package/dist/core/install-kind.d.ts +13 -0
  63. package/dist/core/install-kind.d.ts.map +1 -1
  64. package/dist/core/install-kind.js +29 -0
  65. package/dist/core/install-kind.js.map +1 -1
  66. package/dist/core/publish/filing.d.ts +5 -24
  67. package/dist/core/publish/filing.d.ts.map +1 -1
  68. package/dist/core/publish/filing.js +5 -36
  69. package/dist/core/publish/filing.js.map +1 -1
  70. package/dist/core/session.d.ts +39 -1
  71. package/dist/core/session.d.ts.map +1 -1
  72. package/dist/core/session.js +74 -2
  73. package/dist/core/session.js.map +1 -1
  74. package/dist/core/skills.d.ts +15 -4
  75. package/dist/core/skills.d.ts.map +1 -1
  76. package/dist/core/skills.js +92 -22
  77. package/dist/core/skills.js.map +1 -1
  78. package/dist/core/slug.d.ts +38 -0
  79. package/dist/core/slug.d.ts.map +1 -0
  80. package/dist/core/slug.js +50 -0
  81. package/dist/core/slug.js.map +1 -0
  82. package/dist/core/store.d.ts +15 -0
  83. package/dist/core/store.d.ts.map +1 -1
  84. package/dist/core/store.js +18 -2
  85. package/dist/core/store.js.map +1 -1
  86. package/dist/run.d.ts.map +1 -1
  87. package/dist/run.js +61 -9
  88. package/dist/run.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/package.json +1 -1
  92. package/templates/skills/ctxr-publish.md +12 -0
  93. package/templates/skills/ctxr-second-opinion/critic-contract.md +40 -0
  94. package/templates/skills/ctxr-second-opinion/lenses.md +15 -0
  95. package/templates/skills/ctxr-second-opinion/personas/architect.md +17 -0
  96. package/templates/skills/ctxr-second-opinion/personas/pragmatist.md +17 -0
  97. package/templates/skills/ctxr-second-opinion/personas/skeptic.md +17 -0
  98. package/templates/skills/ctxr-second-opinion/run.mjs +497 -0
  99. package/templates/skills/ctxr-session-lifecycle.md +9 -0
  100. package/templates/skills/ctxr-submit.md +2 -1
  101. package/templates/skills/ctxr-upgrade.md +8 -2
@@ -1,6 +1,14 @@
1
+ import { configPathFor, readConfigMigrating } from '../config/load.js';
2
+ import { MIGRATION_STEPS } from '../config/migrations.js';
3
+ import { SessionWorktreeRefusedError } from '../core/errors.js';
1
4
  import { ExitCode } from '../core/exit-codes.js';
5
+ import { writeFileAtomic } from '../core/fs/atomic.js';
6
+ import { addWorktree, fetchOrigin, hasRemote, removeWorktree } from '../core/git/worktree.js';
2
7
  import { reconcileStore } from '../core/reconcile.js';
8
+ import { CONFIG_FILE_NAME } from '../core/root.js';
9
+ import { worktreePathFor } from '../core/session.js';
3
10
  import { updateAdvisory } from '../core/version-check.js';
11
+ import { CLI_VERSION } from '../version.js';
4
12
  import { generateAdapterOutputs } from './adapters-generate.js';
5
13
  export const requires = { store: 'required' };
6
14
  /**
@@ -11,21 +19,135 @@ export const requires = { store: 'required' };
11
19
  * touched. Idempotent: a current store reports nothing changed.
12
20
  */
13
21
  export async function execute(env, store) {
22
+ // migrate-stores-on-update: a store opened through openStoreMigrating may have
23
+ // been carried forward in memory. Write it first, so the reconcile below — and
24
+ // anything it shells out to, like the pre-commit hook's doctor — reads the
25
+ // migrated configuration rather than the one the gate refuses.
26
+ const migrated = store.migratedFrom !== null && store.migratedFrom !== undefined && store.document !== undefined
27
+ ? { from: store.migratedFrom, to: store.config.schema_version }
28
+ : undefined;
29
+ if (migrated && store.document) {
30
+ await writeFileAtomic(configPathFor(store.root), String(store.document));
31
+ }
14
32
  const { changed, findings } = await reconcileStore(env, store.root, store.config);
15
33
  const adapterFiles = await generateAdapterOutputs(env.git, store);
16
- const all = [...new Set([...changed, ...adapterFiles.filter((f) => f.changed).map((f) => f.path)])];
34
+ const all = [
35
+ ...new Set([
36
+ ...(migrated ? [CONFIG_FILE_NAME] : []),
37
+ ...changed,
38
+ ...adapterFiles.filter((f) => f.changed).map((f) => f.path),
39
+ ]),
40
+ ];
17
41
  // cli-contract: the human path for the release advisory. This is the command
18
42
  // someone runs right AFTER upgrading, so "you have not upgraded" is at its
19
43
  // most actionable here. It never changes this command's exit code.
20
44
  const advisory = await updateAdvisory(env, store);
21
45
  return {
22
46
  exitCode: ExitCode.Ok,
23
- data: { changed: all },
47
+ data: migrated ? { changed: all, migrated } : { changed: all },
24
48
  findings: [...findings, ...advisory.findings],
25
49
  notices: advisory.notice ? [advisory.notice] : undefined,
26
- humanSummary: all.length === 0 ? 'Store is already up to date.' : `Updated ${all.length} contexture-owned file(s).`,
50
+ humanSummary: all.length === 0
51
+ ? 'Store is already up to date.'
52
+ : migrated
53
+ ? `Migrated contexture.yaml from schema ${migrated.from} to ${migrated.to}, and updated ${all.length} file(s).`
54
+ : `Updated ${all.length} contexture-owned file(s).`,
27
55
  storeRoot: store.root,
28
56
  schemaVersion: store.config.schema_version,
29
57
  };
30
58
  }
59
+ /**
60
+ * migrate-stores-on-update (design D3): the branch an update made with
61
+ * `--worktree` lives on. Derived only from the configured prefix and the
62
+ * running release, so every run of one release names the same branch — that is
63
+ * what makes a caller running this at every container start idempotent. The
64
+ * prefix is what `isSessionBranch` keys on, so `session list` and the
65
+ * lifecycle skill's submit and reclaim steps treat it as any other session.
66
+ */
67
+ export function updateBranchName(config) {
68
+ return `${config.session.branch_prefix}ctxr-update-${CLI_VERSION}`;
69
+ }
70
+ async function branchExists(env, root, branch, remoteExists) {
71
+ const local = await env.git.run(['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`], {
72
+ cwd: root,
73
+ allowFailure: true,
74
+ });
75
+ if (local.exitCode === 0)
76
+ return true;
77
+ if (!remoteExists)
78
+ return false;
79
+ // Exit 0 is "found"; 2 is "no such ref". Anything else — an unreachable remote —
80
+ // is not evidence the branch exists, and the fetch below will fail on its own terms.
81
+ const remote = await env.git.run(['ls-remote', '--exit-code', '--heads', 'origin', branch], {
82
+ cwd: root,
83
+ allowFailure: true,
84
+ });
85
+ return remote.exitCode === 0;
86
+ }
87
+ /**
88
+ * `ctxr update --worktree`: migrate and re-render in a worktree this command
89
+ * creates for itself, never in the checkout it was invoked from.
90
+ *
91
+ * `store` is the INVOKING checkout's configuration, migrated in memory only. It
92
+ * supplies the branch prefix, worktrees path and default branch in their
93
+ * current shape, so a step that renames one of them cannot strand the command
94
+ * before it starts. The worktree's own `contexture.yaml` — from the freshly
95
+ * fetched default branch, which may be ahead of the invoking checkout — is
96
+ * what gets migrated and written.
97
+ *
98
+ * It commits nothing. Whether the branch is pushed, reviewed or thrown away is
99
+ * the caller's decision.
100
+ */
101
+ export async function executeInWorktree(env, store) {
102
+ const git = env.git;
103
+ const branch = updateBranchName(store.config);
104
+ const remoteExists = await hasRemote(git, store.root);
105
+ if (await branchExists(env, store.root, branch, remoteExists)) {
106
+ return {
107
+ exitCode: ExitCode.Ok,
108
+ data: { changed: [], worktree: null, branch, existing: true },
109
+ findings: [],
110
+ humanSummary: `Branch "${branch}" already exists; nothing was done.`,
111
+ storeRoot: store.root,
112
+ schemaVersion: store.config.schema_version,
113
+ };
114
+ }
115
+ const defaultBranch = store.config.git.default_branch;
116
+ const fetched = remoteExists ? await fetchOrigin(git, store.root, defaultBranch) : false;
117
+ const startPoint = fetched ? `origin/${defaultBranch}` : defaultBranch;
118
+ const worktreeDir = worktreePathFor(store, branch);
119
+ const added = await addWorktree(git, store.root, worktreeDir, branch, startPoint, { allowFailure: true });
120
+ if (added.exitCode !== 0)
121
+ throw new SessionWorktreeRefusedError(branch, worktreeDir, added.stderr);
122
+ const discard = async () => {
123
+ await removeWorktree(git, store.root, worktreeDir);
124
+ await git.run(['branch', '-D', branch], { cwd: store.root, allowFailure: true });
125
+ };
126
+ let outcome;
127
+ try {
128
+ const read = await readConfigMigrating(worktreeDir, env.migrationSteps ?? MIGRATION_STEPS);
129
+ outcome = await execute(env, { root: worktreeDir, ...read });
130
+ }
131
+ catch (err) {
132
+ // A refused or failed run leaves nothing behind for the next run to trip over.
133
+ await discard();
134
+ throw err;
135
+ }
136
+ const data = outcome.data ?? { changed: [] };
137
+ if (data.changed.length === 0) {
138
+ await discard();
139
+ return {
140
+ ...outcome,
141
+ data: { changed: [], worktree: null, branch, existing: false },
142
+ humanSummary: 'Store is already up to date.',
143
+ storeRoot: store.root,
144
+ };
145
+ }
146
+ return {
147
+ ...outcome,
148
+ data: { ...data, worktree: worktreeDir, branch, existing: false },
149
+ humanSummary: `${outcome.humanSummary} Worktree "${worktreeDir}" on branch "${branch}" (from ${startPoint}), uncommitted.`,
150
+ storeRoot: store.root,
151
+ };
152
+ }
31
153
  //# sourceMappingURL=update.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,CAAC,MAAM,QAAQ,GAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAO/D;;;;;;G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AI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;QACjE,YAAY,EAAE,GAAG,OAAO,CAAC,YAAY,cAAc,WAAW,gBAAgB,MAAM,WAAW,UAAU,iBAAiB;QAC1H,SAAS,EAAE,KAAK,CAAC,IAAI;KACtB,CAAC;AACJ,CAAC"}
@@ -13,6 +13,12 @@ export interface VersionData {
13
13
  version: string;
14
14
  install_path: string;
15
15
  install_kind: InstallKind;
16
+ /**
17
+ * Global installs only: whether the running user can write where a
18
+ * package-manager upgrade would install. False means something else manages
19
+ * this executable — an image, a system package — and upgrades it there.
20
+ */
21
+ install_writable?: boolean;
16
22
  /** Only present with --check. Null when the published version could not be resolved. */
17
23
  latest?: string | null;
18
24
  release_status?: ReleaseStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAM3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAqC,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,YAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAuDzG"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAM3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAqC,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,YAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CA0DzG"}
@@ -1,5 +1,5 @@
1
1
  import { ExitCode } from '../core/exit-codes.js';
2
- import { resolveInstallLocation } from '../core/install-kind.js';
2
+ import { isGlobalInstallWritable, resolveInstallLocation } from '../core/install-kind.js';
3
3
  import { ownPackageName } from '../core/registry.js';
4
4
  import { compareRelease } from '../core/version-check.js';
5
5
  import { CLI_VERSION } from '../version.js';
@@ -23,6 +23,9 @@ export async function execute(env, flags = {}) {
23
23
  version: CLI_VERSION,
24
24
  install_path: install.path,
25
25
  install_kind: install.kind,
26
+ ...(install.kind === 'global'
27
+ ? { install_writable: await isGlobalInstallWritable(install.path, env.execPath) }
28
+ : {}),
26
29
  };
27
30
  if (!flags.check) {
28
31
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAiB7D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,KAAK,GAAiB,EAAE;IACjE,MAAM,OAAO,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,IAAI,GAAgB;QACxB,OAAO,EAAE,WAAW;QACpB,YAAY,EAAE,OAAO,CAAC,IAAI;QAC1B,YAAY,EAAE,OAAO,CAAC,IAAI;KAC3B,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,EAAE;YACrB,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,WAAW;YACzB,SAAS,EAAE,IAAI;YACf,aAAa,EAAE,IAAI;SACpB,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC,CAAC;IAClE,IAA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UAAU,MAAM,EAAE;QAChC,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC"}
@@ -195,6 +195,11 @@ export declare const DEFAULT_ADAPTERS: readonly AdapterDeclaration[];
195
195
  * sites branch on the key's presence to decide whether the store has a
196
196
  * mission mechanism at all. `DEFAULT_MISSION_PATH` is what `init` seeds,
197
197
  * not what an omission resolves to.
198
+ * - `serve.base_url` is an opt-in whose absence is meaningful in the same way,
199
+ * and unknowable besides: contexture cannot know the address a store's
200
+ * browsing surface is reachable at. Undeclared, a command reporting where a
201
+ * page is served reports the server-relative route alone and invents no
202
+ * origin, so there is nothing for `init` to seed either.
198
203
  */
199
204
  /**
200
205
  * cli-contract (keep-the-installed-cli-current): the release advisory is on by
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,YAAI,oBAAoB,CAAU,CAAC;AAErE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,YAAI,iBAAiB,EAAE,MAAM,CAAU,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,4HAA4H;AAC5H,eAAO,MAAM,sCAAsC,4BAA4B,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,yBAAyB,CAAC;AAE1E,mHAAmH;AACnH,eAAO,MAAM,yBAAyB,eAAe,CAAC;AAEtD,+IAA+I;AAC/I,eAAO,MAAM,oBAAoB,oCAAyD,CAAC;AAE3F,yIAAyI;AACzI,eAAO,MAAM,4BAA4B,QAAY,CAAC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oCAtHuB,MAAM,EAAE;;;aAwHtC,OAAO;iBAAI,aAAa;iBAAiC,cAAc;;aACvE,eAAe;iBAAI,uBAAuB;iBAAmC,cAAc,EAAQ,MAAM,EAAE;;aAC3G,OAAO;iBAAI,IAAI;iBAAwB,iBAAiB;;aACxD,OAAO;iBAAI,IAAI;;aACf,SAAS;iBAAI,IAAI;iBAA0B,SAAS;;aACpD,MAAM;iBAAI,QAAQ;;aAClB,MAAM;iBACJ,UAAU;iBACV,YAAY;iBACZ,eAAe;;aAEjB,QAAQ;iBAAI,iBAAiB;;aAC7B,OAAO;iBACL,WAAW;iBACX,aAAa;iBACb,oBAAoB;;aAEtB,QAAQ;;;;;;aACR,YAAY;iBAAI,OAAO;iBAAgC,SAAS;;CACxD,CAAC"}
@@ -199,6 +199,11 @@ export const DEFAULT_ADAPTERS = [{ id: 'claude-code', kind: 'harness-generation'
199
199
  * sites branch on the key's presence to decide whether the store has a
200
200
  * mission mechanism at all. `DEFAULT_MISSION_PATH` is what `init` seeds,
201
201
  * not what an omission resolves to.
202
+ * - `serve.base_url` is an opt-in whose absence is meaningful in the same way,
203
+ * and unknowable besides: contexture cannot know the address a store's
204
+ * browsing surface is reachable at. Undeclared, a command reporting where a
205
+ * page is served reports the server-relative route alone and invents no
206
+ * origin, so there is nothing for `init` to seed either.
202
207
  */
203
208
  /**
204
209
  * cli-contract (keep-the-installed-cli-current): the release advisory is on by
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,CAAU,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAU,CAAC;AAE5E;;;;;;GAMG;AACH,M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AAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,SAAS,EAAE,2BAA2B,EAAE;IACnF,MAAM,EAAE,EAAE,QAAQ,EAAE,uBAAuB,EAAE;IAC7C,MAAM,EAAE;QACN,UAAU,EAAE,kBAAkB;QAC9B,YAAY,EAAE,oBAAoB;QAClC,eAAe,EAAE,uBAAuB;KACzC;IACD,QAAQ,EAAE,EAAE,iBAAiB,EAAE,yBAAyB,EAAE;IAC1D,OAAO,EAAE;QACP,WAAW,EAAE,mBAAmB;QAChC,aAAa,EAAE,qBAAqB;QACpC,oBAAoB,EAAE,4BAA4B;KACnD;IACD,QAAQ,EAAE,gBAAgB;IAC1B,YAAY,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE,SAAS,EAAE,8BAA8B,EAAE;CAC1F,CAAC"}
@@ -1,3 +1,5 @@
1
+ import { type Document } from 'yaml';
2
+ import { type MigrationStep } from './migrations.js';
1
3
  import { type StoreConfig } from './schema.js';
2
4
  export declare function configPathFor(root: string): string;
3
5
  /**
@@ -6,6 +8,25 @@ export declare function configPathFor(root: string): string;
6
8
  * BEFORE full validation, so a store whose recorded version differs in either
7
9
  * direction reports the version rather than the confusing generic
8
10
  * shape-validation error the full schema would otherwise produce.
11
+ *
12
+ * `steps` is the migration ladder the gate measures its floor against. It is
13
+ * only ever overridden by tests; every command passes the shipped one.
9
14
  */
10
- export declare function readConfig(root: string): Promise<StoreConfig>;
15
+ export declare function readConfig(root: string, steps?: readonly MigrationStep[]): Promise<StoreConfig>;
16
+ export interface MigratingRead {
17
+ config: StoreConfig;
18
+ /** The document as it should be written: migrated when `migratedFrom` is set, otherwise as read. */
19
+ document: Document;
20
+ /** The schema version the store was recorded at, when a migration ran; null when it was already current. */
21
+ migratedFrom: number | null;
22
+ }
23
+ /**
24
+ * migrate-stores-on-update (design D2): the one exception to the gate, for
25
+ * `ctxr update` alone. A store recorded at an older version that is at or
26
+ * above the migration floor is carried forward IN MEMORY and validated; the
27
+ * caller decides whether and where the migrated document is written. Every
28
+ * other refusal — newer, missing, below the floor — is identical to
29
+ * `readConfig`'s, because it is the same function.
30
+ */
31
+ export declare function readConfigMigrating(root: string, steps?: readonly MigrationStep[]): Promise<MigratingRead>;
11
32
  //# sourceMappingURL=load.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAUA,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA2CnE"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAC;AASpD,OAAO,EAA4E,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/H,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,SAAS,aAAa,EAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAEtH;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,oGAAoG;IACpG,QAAQ,EAAE,QAAQ,CAAC;IACnB,4GAA4G;IAC5G,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,SAAS,aAAa,EAAoB,GAChD,OAAO,CAAC,aAAa,CAAC,CAExB"}
@@ -1,8 +1,9 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { parse as parseYaml } from 'yaml';
3
+ import { parseDocument } from 'yaml';
4
4
  import { CONFIG_FILE_NAME } from '../core/root.js';
5
- import { InvalidConfigError, SchemaVersionBehindError, SchemaVersionMissingError, SchemaVersionNewerError, } from '../core/errors.js';
5
+ import { InvalidConfigError, SchemaMigrationFailedError, SchemaVersionBehindError, SchemaVersionMissingError, SchemaVersionNewerError, } from '../core/errors.js';
6
+ import { MIGRATION_STEPS, migrationFloor, MigrationStepFailedError, runMigrations } from './migrations.js';
6
7
  import { StoreConfigSchema, SUPPORTED_SCHEMA_VERSION } from './schema.js';
7
8
  export function configPathFor(root) {
8
9
  return path.join(root, CONFIG_FILE_NAME);
@@ -13,19 +14,37 @@ export function configPathFor(root) {
13
14
  * BEFORE full validation, so a store whose recorded version differs in either
14
15
  * direction reports the version rather than the confusing generic
15
16
  * shape-validation error the full schema would otherwise produce.
17
+ *
18
+ * `steps` is the migration ladder the gate measures its floor against. It is
19
+ * only ever overridden by tests; every command passes the shipped one.
16
20
  */
17
- export async function readConfig(root) {
21
+ export async function readConfig(root, steps = MIGRATION_STEPS) {
22
+ return (await loadConfig(root, { migrate: false, steps })).config;
23
+ }
24
+ /**
25
+ * migrate-stores-on-update (design D2): the one exception to the gate, for
26
+ * `ctxr update` alone. A store recorded at an older version that is at or
27
+ * above the migration floor is carried forward IN MEMORY and validated; the
28
+ * caller decides whether and where the migrated document is written. Every
29
+ * other refusal — newer, missing, below the floor — is identical to
30
+ * `readConfig`'s, because it is the same function.
31
+ */
32
+ export async function readConfigMigrating(root, steps = MIGRATION_STEPS) {
33
+ return loadConfig(root, { migrate: true, steps });
34
+ }
35
+ async function loadConfig(root, mode) {
18
36
  const configPath = configPathFor(root);
19
37
  const text = await readFile(configPath, 'utf8');
20
- let raw;
21
- try {
22
- raw = parseYaml(text);
23
- }
24
- catch (err) {
38
+ // A Document, not a plain value: a migration has to write back everything it
39
+ // did not change — comments and key order included — and only the parsed
40
+ // document carries those.
41
+ const document = parseDocument(text);
42
+ if (document.errors.length > 0) {
25
43
  throw new InvalidConfigError(configPath, [
26
- { path: '(root)', message: err instanceof Error ? err.message : String(err) },
44
+ { path: '(root)', message: document.errors.map((err) => err.message).join('; ') },
27
45
  ]);
28
46
  }
47
+ const raw = document.toJS();
29
48
  const rawVersion = raw?.schema_version;
30
49
  if (rawVersion === undefined || rawVersion === null) {
31
50
  throw new SchemaVersionMissingError(configPath);
@@ -36,24 +55,42 @@ export async function readConfig(root) {
36
55
  if (rawVersion > SUPPORTED_SCHEMA_VERSION) {
37
56
  throw new SchemaVersionNewerError(rawVersion, SUPPORTED_SCHEMA_VERSION);
38
57
  }
58
+ let toValidate = document;
59
+ let migratedFrom = null;
39
60
  /**
40
- * retire-store-migrations: the older direction is refused here too, and for
41
- * the same reason the newer one is — this release cannot read that shape.
42
- * It has to happen before `safeParse`, or an older config fails on the keys
43
- * whose superseded spellings the schema no longer accepts, reporting a shape
44
- * error against keys the operator never wrote instead of the version.
61
+ * The older direction is refused here, before `safeParse`, for every command
62
+ * but update — or an older config fails on the keys whose superseded
63
+ * spellings the schema no longer accepts, reporting a shape error against
64
+ * keys the operator never wrote instead of the version. Update migrates the
65
+ * raw document first instead, so the typed schema still only ever sees the
66
+ * current spellings.
45
67
  */
46
68
  if (rawVersion < SUPPORTED_SCHEMA_VERSION) {
47
- throw new SchemaVersionBehindError(rawVersion, SUPPORTED_SCHEMA_VERSION);
69
+ const floor = migrationFloor(mode.steps);
70
+ if (!mode.migrate || rawVersion < floor) {
71
+ throw new SchemaVersionBehindError(rawVersion, SUPPORTED_SCHEMA_VERSION, floor);
72
+ }
73
+ try {
74
+ toValidate = runMigrations(document, rawVersion, mode.steps);
75
+ }
76
+ catch (err) {
77
+ if (err instanceof MigrationStepFailedError)
78
+ throw new SchemaMigrationFailedError(configPath, err.message);
79
+ throw err;
80
+ }
81
+ migratedFrom = rawVersion;
48
82
  }
49
- const result = StoreConfigSchema.safeParse(raw);
83
+ const result = StoreConfigSchema.safeParse(toValidate.toJS());
50
84
  if (!result.success) {
51
85
  const issues = result.error.issues.map((issue) => ({
52
86
  path: issue.path.join('.') || '(root)',
53
87
  message: issue.message,
54
88
  }));
89
+ if (migratedFrom !== null) {
90
+ throw new SchemaMigrationFailedError(configPath, `the migrated configuration does not validate: ${issues.map((i) => `${i.path}: ${i.message}`).join('; ')}`);
91
+ }
55
92
  throw new InvalidConfigError(configPath, issues);
56
93
  }
57
- return result.data;
94
+ return { config: result.data, document: toValidate, migratedFrom };
58
95
  }
59
96
  //# sourceMappingURL=load.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAoB,MAAM,aAAa,CAAC;AAE5F,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAEhD,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACx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IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3G,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACrE,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { Document } from 'yaml';
2
+ /**
3
+ * migrate-stores-on-update: one step carries a store's configuration from
4
+ * schema version `from` to `from + 1`.
5
+ *
6
+ * A step works on the PARSED DOCUMENT, never on the typed configuration and
7
+ * never on the plain value `parse` returns (design D1). That is what lets the
8
+ * typed schema keep exactly one spelling per key — the objection that retired
9
+ * the previous migration mechanism was the leniency it forced onto
10
+ * `StoreConfigSchema`, so a stale config could be read by the migration about
11
+ * to rewrite it. Here the stale spelling is renamed in the document before
12
+ * the typed schema ever sees it.
13
+ *
14
+ * It is also what keeps a migration reviewable: a `yaml` Document serializes
15
+ * back with its comments, key order and quoting intact, so the written file
16
+ * differs from the original only where the step says. Rename a key by
17
+ * assigning the pair's key value in place — `setIn` + `deleteIn` would append
18
+ * the new key at the end of its map instead.
19
+ */
20
+ export interface MigrationStep {
21
+ /** The schema version this step reads; it writes `from + 1`. */
22
+ readonly from: number;
23
+ /**
24
+ * Dotted key paths this step renames or removes. The typed schema must not
25
+ * declare any of them, which test/unit/config-migrations.test.ts asserts —
26
+ * a retired spelling that is still live is exactly the second contract this
27
+ * design exists to avoid.
28
+ */
29
+ readonly retires: readonly string[];
30
+ /** Mutates the document in place. Throwing aborts the whole run, and nothing is written. */
31
+ apply(doc: Document): void;
32
+ }
33
+ /**
34
+ * The shipped ladder, in version order. Empty at the change that introduced
35
+ * it: both known stores were already at the supported version, so there was
36
+ * nothing to carry. The first release that raises SUPPORTED_SCHEMA_VERSION
37
+ * adds its step here, in the same change — the contiguity test fails until
38
+ * it does.
39
+ */
40
+ export declare const MIGRATION_STEPS: readonly MigrationStep[];
41
+ /**
42
+ * The oldest schema version this release can bring forward. With no steps it
43
+ * is the supported version itself, so every older store is below it and the
44
+ * behind-version refusal never names an update that could not help.
45
+ */
46
+ export declare function migrationFloor(steps?: readonly MigrationStep[]): number;
47
+ export declare class MigrationStepFailedError extends Error {
48
+ readonly from: number;
49
+ readonly cause: unknown;
50
+ constructor(from: number, cause: unknown);
51
+ }
52
+ /**
53
+ * Applies every step from `fromVersion` up to the supported version, in order,
54
+ * to a CLONE of `doc`, records the supported version on it, and returns it.
55
+ * The input document is never touched, so a failure partway up the ladder
56
+ * leaves the caller holding exactly what it read. A missing or throwing step
57
+ * aborts with MigrationStepFailedError — a half-migrated document is never
58
+ * returned as if it were whole.
59
+ */
60
+ export declare function runMigrations(doc: Document, fromVersion: number, steps?: readonly MigrationStep[]): Document;
61
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/config/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGrC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,4FAA4F;IAC5F,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAAO,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,GAAE,SAAS,aAAa,EAAoB,GAAG,MAAM,CAGxF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAE/C,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO;IAFzB,YACW,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EAMxB;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,SAAS,aAAa,EAAoB,GAChD,QAAQ,CAeV"}
@@ -0,0 +1,55 @@
1
+ import { SUPPORTED_SCHEMA_VERSION } from './schema.js';
2
+ /**
3
+ * The shipped ladder, in version order. Empty at the change that introduced
4
+ * it: both known stores were already at the supported version, so there was
5
+ * nothing to carry. The first release that raises SUPPORTED_SCHEMA_VERSION
6
+ * adds its step here, in the same change — the contiguity test fails until
7
+ * it does.
8
+ */
9
+ export const MIGRATION_STEPS = [];
10
+ /**
11
+ * The oldest schema version this release can bring forward. With no steps it
12
+ * is the supported version itself, so every older store is below it and the
13
+ * behind-version refusal never names an update that could not help.
14
+ */
15
+ export function migrationFloor(steps = MIGRATION_STEPS) {
16
+ if (steps.length === 0)
17
+ return SUPPORTED_SCHEMA_VERSION;
18
+ return Math.min(...steps.map((step) => step.from));
19
+ }
20
+ export class MigrationStepFailedError extends Error {
21
+ from;
22
+ cause;
23
+ constructor(from, cause) {
24
+ super(`schema migration step ${from} -> ${from + 1} failed: ${cause instanceof Error ? cause.message : String(cause)}`);
25
+ this.from = from;
26
+ this.cause = cause;
27
+ this.name = 'MigrationStepFailedError';
28
+ }
29
+ }
30
+ /**
31
+ * Applies every step from `fromVersion` up to the supported version, in order,
32
+ * to a CLONE of `doc`, records the supported version on it, and returns it.
33
+ * The input document is never touched, so a failure partway up the ladder
34
+ * leaves the caller holding exactly what it read. A missing or throwing step
35
+ * aborts with MigrationStepFailedError — a half-migrated document is never
36
+ * returned as if it were whole.
37
+ */
38
+ export function runMigrations(doc, fromVersion, steps = MIGRATION_STEPS) {
39
+ const migrated = doc.clone();
40
+ for (let version = fromVersion; version < SUPPORTED_SCHEMA_VERSION; version += 1) {
41
+ const step = steps.find((candidate) => candidate.from === version);
42
+ if (!step) {
43
+ throw new MigrationStepFailedError(version, new Error('no step carries this version forward'));
44
+ }
45
+ try {
46
+ step.apply(migrated);
47
+ }
48
+ catch (err) {
49
+ throw new MigrationStepFailedError(version, err);
50
+ }
51
+ }
52
+ migrated.set('schema_version', SUPPORTED_SCHEMA_VERSION);
53
+ return migrated;
54
+ }
55
+ //# sourceMappingURL=migrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/config/migrations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAkCvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6B,EAAE,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAK,GAA6B,eAAe;IAC9E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,wBAAwB,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAEtC,IAAI;IACJ,KAAK;IAFhB,YACW,IAAY,EACZ,KAAc;QAEvB,KAAK,CACH,yBAAyB,IAAI,OAAO,IAAI,GAAG,CAAC,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACjH,CAAC;oBALO,IAAI;qBACJ,KAAK;QAKd,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAa,EACb,WAAmB,EACnB,KAAK,GAA6B,eAAe;IAEjD,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;IAC7B,KAAK,IAAI,OAAO,GAAG,WAAW,EAAE,OAAO,GAAG,wBAAwB,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;QACjG,CAAC;QACD,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;IACzD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -4,15 +4,18 @@ import { z } from 'zod';
4
4
  * note frontmatter conventions) — a monotonic integer independent of the npm
5
5
  * package version — not "what this CLI release happens to be."
6
6
  *
7
- * retire-store-migrations: contexture ships no migration mechanism, so this
8
- * number is a gate rather than a starting point. `readConfig` refuses any
9
- * store whose recorded version is not exactly this one, in either direction:
10
- * a newer store because this release cannot know its shape, an older one
11
- * because this release no longer reads that shape and offers nothing that
12
- * would bring it forward. A release that changes the store's shape bumps this
13
- * and documents the one-time fixup in its release notes.
7
+ * It is a gate. `readConfig` refuses any store whose recorded version is not
8
+ * exactly this one, in either direction — with one exception since
9
+ * migrate-stores-on-update: `ctxr update` carries an OLDER store forward
10
+ * through the migration ladder in ./migrations.ts, provided it is at or above
11
+ * the ladder's floor. A newer store is refused everywhere.
14
12
  *
15
- * It stayed at 10 through that retirement on purpose: nothing about a
13
+ * RAISING THIS NUMBER: add the step from the previous version to
14
+ * MIGRATION_STEPS in the same change, with a byte-exact fixture test of its
15
+ * own. test/unit/config-migrations.test.ts fails until the step exists; the
16
+ * fixture is the convention that keeps a step's output reviewable.
17
+ *
18
+ * It stayed at 10 through retire-store-migrations on purpose: nothing about a
16
19
  * conforming store's shape changed. What was dropped were superseded INPUT
17
20
  * spellings that no store at 10 has ever written, since `renderStoreConfig`
18
21
  * only ever emitted the current names.
@@ -86,6 +89,9 @@ export declare const StoreConfigSchema: z.ZodObject<{
86
89
  publish: z.ZodPrefault<z.ZodObject<{
87
90
  path: z.ZodDefault<z.ZodString>;
88
91
  }, z.core.$strip>>;
92
+ serve: z.ZodOptional<z.ZodObject<{
93
+ base_url: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>>;
89
95
  templates: z.ZodPrefault<z.ZodObject<{
90
96
  path: z.ZodDefault<z.ZodString>;
91
97
  installed: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAYH;;;;;;GAMG;AACH,QAAA,MAAM,mBAAmB;;;;;iBAKvB,CAAC;AA6OH,QAAA,MAAM,wBAAwB;;;;;;;iBAM5B,CAAC;AAiBH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwC1B,CAAC;AAEL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAm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