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.
- package/README.md +12 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/publish-check.d.ts +7 -0
- package/dist/commands/publish-check.d.ts.map +1 -1
- package/dist/commands/publish-check.js +8 -3
- package/dist/commands/publish-check.js.map +1 -1
- package/dist/commands/publish-new.d.ts +8 -0
- package/dist/commands/publish-new.d.ts.map +1 -1
- package/dist/commands/publish-new.js +6 -3
- package/dist/commands/publish-new.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +5 -4
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/session-start.d.ts +7 -1
- package/dist/commands/session-start.d.ts.map +1 -1
- package/dist/commands/session-start.js +25 -5
- package/dist/commands/session-start.js.map +1 -1
- package/dist/commands/update.d.ts +41 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +125 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/version.d.ts +6 -0
- package/dist/commands/version.d.ts.map +1 -1
- package/dist/commands/version.js +4 -1
- package/dist/commands/version.js.map +1 -1
- package/dist/config/defaults.d.ts +5 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +5 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/load.d.ts +22 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +54 -17
- package/dist/config/load.js.map +1 -1
- package/dist/config/migrations.d.ts +61 -0
- package/dist/config/migrations.d.ts.map +1 -0
- package/dist/config/migrations.js +55 -0
- package/dist/config/migrations.js.map +1 -0
- package/dist/config/schema.d.ts +14 -8
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +61 -8
- package/dist/config/schema.js.map +1 -1
- package/dist/core/browse/nav.d.ts.map +1 -1
- package/dist/core/browse/nav.js +6 -2
- package/dist/core/browse/nav.js.map +1 -1
- package/dist/core/browse/page-url.d.ts +68 -0
- package/dist/core/browse/page-url.d.ts.map +1 -0
- package/dist/core/browse/page-url.js +101 -0
- package/dist/core/browse/page-url.js.map +1 -0
- package/dist/core/env.d.ts +7 -0
- package/dist/core/env.d.ts.map +1 -1
- package/dist/core/env.js.map +1 -1
- package/dist/core/errors.d.ts +42 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +79 -4
- package/dist/core/errors.js.map +1 -1
- package/dist/core/git/worktree.d.ts +10 -2
- package/dist/core/git/worktree.d.ts.map +1 -1
- package/dist/core/git/worktree.js +11 -2
- package/dist/core/git/worktree.js.map +1 -1
- package/dist/core/install-kind.d.ts +13 -0
- package/dist/core/install-kind.d.ts.map +1 -1
- package/dist/core/install-kind.js +29 -0
- package/dist/core/install-kind.js.map +1 -1
- package/dist/core/publish/filing.d.ts +5 -24
- package/dist/core/publish/filing.d.ts.map +1 -1
- package/dist/core/publish/filing.js +5 -36
- package/dist/core/publish/filing.js.map +1 -1
- package/dist/core/session.d.ts +39 -1
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +74 -2
- package/dist/core/session.js.map +1 -1
- package/dist/core/skills.d.ts +15 -4
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +92 -22
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slug.d.ts +38 -0
- package/dist/core/slug.d.ts.map +1 -0
- package/dist/core/slug.js +50 -0
- package/dist/core/slug.js.map +1 -0
- package/dist/core/store.d.ts +15 -0
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +18 -2
- package/dist/core/store.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +61 -9
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/templates/skills/ctxr-publish.md +12 -0
- package/templates/skills/ctxr-second-opinion/critic-contract.md +40 -0
- package/templates/skills/ctxr-second-opinion/lenses.md +15 -0
- package/templates/skills/ctxr-second-opinion/personas/architect.md +17 -0
- package/templates/skills/ctxr-second-opinion/personas/pragmatist.md +17 -0
- package/templates/skills/ctxr-second-opinion/personas/skeptic.md +17 -0
- package/templates/skills/ctxr-second-opinion/run.mjs +497 -0
- package/templates/skills/ctxr-session-lifecycle.md +9 -0
- package/templates/skills/ctxr-submit.md +2 -1
- package/templates/skills/ctxr-upgrade.md +8 -2
package/dist/config/schema.js
CHANGED
|
@@ -6,15 +6,18 @@ import { SHIPPED_DEFAULTS } from './defaults.js';
|
|
|
6
6
|
* note frontmatter conventions) — a monotonic integer independent of the npm
|
|
7
7
|
* package version — not "what this CLI release happens to be."
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* would bring it forward. A release that changes the store's shape bumps this
|
|
15
|
-
* and documents the one-time fixup in its release notes.
|
|
9
|
+
* It is a gate. `readConfig` refuses any store whose recorded version is not
|
|
10
|
+
* exactly this one, in either direction — with one exception since
|
|
11
|
+
* migrate-stores-on-update: `ctxr update` carries an OLDER store forward
|
|
12
|
+
* through the migration ladder in ./migrations.ts, provided it is at or above
|
|
13
|
+
* the ladder's floor. A newer store is refused everywhere.
|
|
16
14
|
*
|
|
17
|
-
*
|
|
15
|
+
* RAISING THIS NUMBER: add the step from the previous version to
|
|
16
|
+
* MIGRATION_STEPS in the same change, with a byte-exact fixture test of its
|
|
17
|
+
* own. test/unit/config-migrations.test.ts fails until the step exists; the
|
|
18
|
+
* fixture is the convention that keeps a step's output reviewable.
|
|
19
|
+
*
|
|
20
|
+
* It stayed at 10 through retire-store-migrations on purpose: nothing about a
|
|
18
21
|
* conforming store's shape changed. What was dropped were superseded INPUT
|
|
19
22
|
* spellings that no store at 10 has ever written, since `renderStoreConfig`
|
|
20
23
|
* only ever emitted the current names.
|
|
@@ -94,9 +97,51 @@ const CatalogSchema = z.object({
|
|
|
94
97
|
* no default-merging, so a required field here would break every pre-existing
|
|
95
98
|
* store. `init` still writes it explicitly for a freshly generated config.
|
|
96
99
|
*/
|
|
100
|
+
/**
|
|
101
|
+
* An absolute `http`/`https` base URL: scheme and host only, optionally with a
|
|
102
|
+
* port and a path prefix. Query and fragment are refused because a base URL
|
|
103
|
+
* carrying either cannot be joined to a route without producing nonsense.
|
|
104
|
+
*/
|
|
105
|
+
function isAbsoluteHttpBase(value) {
|
|
106
|
+
let parsed;
|
|
107
|
+
try {
|
|
108
|
+
parsed = new URL(value);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
return (parsed.protocol === 'http:' || parsed.protocol === 'https:') && parsed.search === '' && parsed.hash === '';
|
|
114
|
+
}
|
|
97
115
|
const PublishSchema = z.object({
|
|
98
116
|
path: z.string().min(1).default(SHIPPED_DEFAULTS.publish.path),
|
|
99
117
|
});
|
|
118
|
+
/**
|
|
119
|
+
* publish-names-where-the-page-is-served (D6): the base URL at which this
|
|
120
|
+
* store's browsing surface is reachable, so a command that names a page can
|
|
121
|
+
* name a URL rather than a bare route.
|
|
122
|
+
*
|
|
123
|
+
* A full base URL rather than a host name: a host alone forces the tool to
|
|
124
|
+
* guess `http` against `https`, and cannot carry a port or the path prefix a
|
|
125
|
+
* store behind a reverse proxy is served under. Validated here so a typo fails
|
|
126
|
+
* at config load, where every other malformed value fails, rather than at the
|
|
127
|
+
* point some command tries to print it.
|
|
128
|
+
*
|
|
129
|
+
* `local-browsing-surface` D6 declined a `serve.port` key because an
|
|
130
|
+
* invocation-time choice with no store-specific default does not belong in the
|
|
131
|
+
* config. That test still stands and a port still fails it; an origin passes
|
|
132
|
+
* it — the address a store's pages are published at is a durable fact about
|
|
133
|
+
* that store, unknowable to the tool, and read by `publish new` and
|
|
134
|
+
* `publish check` rather than by any flag-bearing invocation.
|
|
135
|
+
*/
|
|
136
|
+
const ServeSchema = z.object({
|
|
137
|
+
base_url: z
|
|
138
|
+
.string()
|
|
139
|
+
.min(1)
|
|
140
|
+
.refine(isAbsoluteHttpBase, {
|
|
141
|
+
message: 'must be an absolute http(s) base URL with no query or fragment, e.g. "https://ctx.example.com" or "https://example.com/ctx/"',
|
|
142
|
+
})
|
|
143
|
+
.optional(),
|
|
144
|
+
});
|
|
100
145
|
/**
|
|
101
146
|
* harness-portability spec (vendored-craft-skills): which vendored
|
|
102
147
|
* third-party skills a store wants, defaulting to the shipped set so a
|
|
@@ -302,6 +347,14 @@ export const StoreConfigSchema = z
|
|
|
302
347
|
write_lifecycle: WriteLifecycleSchema.prefault({}),
|
|
303
348
|
catalog: CatalogSchema.prefault({}),
|
|
304
349
|
publish: PublishSchema.prefault({}),
|
|
350
|
+
// `.optional()`, not `.prefault({})` like every block above it (D7):
|
|
351
|
+
// `withoutShippedDefaults` keeps any key absent from `SHIPPED_DEFAULTS`
|
|
352
|
+
// verbatim, so a prefaulted block would resolve to `serve: {}` for every
|
|
353
|
+
// store and `ctxr init` would start writing an empty `serve:` block into
|
|
354
|
+
// every new config — against the requirement that a written configuration
|
|
355
|
+
// records only the store's own decisions. Absent, it stays absent through
|
|
356
|
+
// parse, render and reparse.
|
|
357
|
+
serve: ServeSchema.optional(),
|
|
305
358
|
templates: TemplatesSchema.prefault({}),
|
|
306
359
|
skills: SkillsSchema.prefault({}),
|
|
307
360
|
update_check: UpdateCheckSchema.prefault({}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"m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CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC;YAC9B,OAAO,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,+CAA+C,KAAK,CAAC,MAAM,CAAC,YAAY,IAAI;SACjH,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../src/core/browse/nav.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../src/core/browse/nav.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAwK9F;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMnD;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAUzD"}
|
package/dist/core/browse/nav.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { titleFor } from '../catalog/model.js';
|
|
2
|
+
import { previewRoute, publishRoute } from './page-url.js';
|
|
2
3
|
import { escapeHtml } from './render.js';
|
|
3
4
|
import { previewPages, publishPages, PUBLISH_INDEX_FILE } from './routes.js';
|
|
4
5
|
import { buildPathTree } from './tree.js';
|
|
@@ -100,7 +101,7 @@ function renderAreaContent(table, area) {
|
|
|
100
101
|
const tree = buildPathTree(pages,
|
|
101
102
|
// serve-page-names-theme-and-nav-toggle D1: a page's declared name, falling back to its
|
|
102
103
|
// directory segment — the same "one answer to what this is called" principle D6 gives notes.
|
|
103
|
-
(page) => table.publishTitles.get(page) ?? lastSegment(page), (page) =>
|
|
104
|
+
(page) => table.publishTitles.get(page) ?? lastSegment(page), (page) => publishRoute(`${page}/${PUBLISH_INDEX_FILE}`), groupLabelFor(table));
|
|
104
105
|
return renderTree(tree, 0);
|
|
105
106
|
}
|
|
106
107
|
case 'preview': {
|
|
@@ -116,7 +117,10 @@ function renderAreaContent(table, area) {
|
|
|
116
117
|
(treePath) => {
|
|
117
118
|
const entry = byPath.get(treePath);
|
|
118
119
|
return table.previews.get(entry.worktree)?.titles.get(entry.page) ?? lastSegment(entry.page);
|
|
119
|
-
}, (treePath) =>
|
|
120
|
+
}, (treePath) => {
|
|
121
|
+
const entry = byPath.get(treePath);
|
|
122
|
+
return previewRoute(entry.worktree, `${entry.page}/${PUBLISH_INDEX_FILE}`);
|
|
123
|
+
}, previewGroupLabelFor(table));
|
|
120
124
|
return renderTree(tree, 0);
|
|
121
125
|
}
|
|
122
126
|
case 'notes': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.js","sourceRoot":"","sources":["../../../src/core/browse/nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAyC,MAAM,WAAW,CAAC;AAEjF;;;;;;;;;GASG;AACH,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAI3E,MAAM,WAAW,GAAqC;IACpD,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,yFAAyF;AACzF,MAAM,YAAY,GAAqC;IACrD,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,SAAS;IAClB,K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AE,IAAI,CAAC,YAAY,CAAC;IAC/H,CAAC,CAAC,CAAC;IACH,OAAO,qDAAqD,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC;AACxF,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,MAAM,YAAY,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7H,MAAM,MAAM,GAAG,2BAA2B,YAAY,CAAC,KAAK,CAAC,CAAC,MAAM,uBAAuB,YAAY,wBAAwB,KAAK,CAAC,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,OAAO,CAAC,IAAI,0BAA0B,CAAC;IAEzM,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,WAAW,YAAY,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QACvF,OAAO,GAAG,OAAO,KAAK,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,qBAAqB,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Store } from '../store.js';
|
|
2
|
+
/**
|
|
3
|
+
* The two addresses the browsing surface answers for a published page, spelled
|
|
4
|
+
* once. `serve.ts` tests and slices these prefixes, `nav.ts` builds hrefs from
|
|
5
|
+
* them, and the publish commands report them — three readers, one spelling,
|
|
6
|
+
* pinned by `single-source-literals`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PUBLISH_ROUTE_PREFIX = "/publish/";
|
|
9
|
+
export declare const PREVIEW_ROUTE_PREFIX = "/preview/";
|
|
10
|
+
/**
|
|
11
|
+
* `encodeURI`, never `encodeURIComponent`: a page path carries `/` separators
|
|
12
|
+
* that must survive into the URL. The round trip is exact because `serve.ts`
|
|
13
|
+
* decodes the whole pathname once with `decodeURIComponent` before its lookup,
|
|
14
|
+
* recovering the raw key `walkFiles` produced.
|
|
15
|
+
*/
|
|
16
|
+
export declare function publishRoute(filePath: string): string;
|
|
17
|
+
/** `worktree` is the session worktree's directory name — the key `buildPreviews` inserts. */
|
|
18
|
+
export declare function previewRoute(worktree: string, filePath: string): string;
|
|
19
|
+
export interface ServedAtRoute {
|
|
20
|
+
/** Server-relative, always leading "/", always naming a file the route answers for. */
|
|
21
|
+
route: string;
|
|
22
|
+
/** `route` against the store's declared base URL; null when the store declares none. */
|
|
23
|
+
url: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface ServedAt extends ServedAtRoute {
|
|
26
|
+
area: 'preview' | 'publish';
|
|
27
|
+
/** The session worktree directory keying a preview address; null under the publish area. */
|
|
28
|
+
worktree: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Where the same page is served once the worktree's work lands. Null under the
|
|
31
|
+
* publish area, which is already that address — a page in the store's own
|
|
32
|
+
* checkout has no later one.
|
|
33
|
+
*/
|
|
34
|
+
after_landing: ServedAtRoute | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The address the browsing surface answers for one file of a published page.
|
|
38
|
+
*
|
|
39
|
+
* Null when the file is not under the store's configured publish path. That is
|
|
40
|
+
* the same verdict `checkPageLocation` (`src/commands/publish-check.ts`) already
|
|
41
|
+
* reaches for the same input, by the same prefix test: such a file is not a
|
|
42
|
+
* published page, so it has no filing to judge and no address to report. The
|
|
43
|
+
* two must keep agreeing about what "under the publish path" means.
|
|
44
|
+
*
|
|
45
|
+
* The preview branch asks `isSessionWorktreePath` about the resolved store root
|
|
46
|
+
* — root resolution has already resolved it *to* the worktree when the caller
|
|
47
|
+
* is standing in one — and takes the worktree's directory name from
|
|
48
|
+
* `path.basename`. That is precisely the key `buildPreviews`
|
|
49
|
+
* (`src/core/browse/routes.ts`) inserts, because it enumerates the directories
|
|
50
|
+
* under the configured worktrees path and keys by their names verbatim. No
|
|
51
|
+
* second enumeration, and no git subprocess.
|
|
52
|
+
*
|
|
53
|
+
* `storeRelativeFilePath` is "/"-separated, as both callers already produce.
|
|
54
|
+
*/
|
|
55
|
+
export declare function pageServedAt(store: Store, storeRelativeFilePath: string): ServedAt | null;
|
|
56
|
+
/**
|
|
57
|
+
* The clause both publish commands append to their one-line summary (D3).
|
|
58
|
+
*
|
|
59
|
+
* Leading space, so a caller writes `${summary}${servedAtSentence(served)}`
|
|
60
|
+
* and an unaddressable page simply adds nothing. The verb carries the
|
|
61
|
+
* distinction the caller was previously left to guess: a page in the store's
|
|
62
|
+
* own checkout is `Served at`, a page still in a session worktree is
|
|
63
|
+
* `Preview at` and names where it goes once it lands. When the store declares
|
|
64
|
+
* a base URL the absolute form replaces the route rather than joining it —
|
|
65
|
+
* two addresses for one page would be the same guessing one level down.
|
|
66
|
+
*/
|
|
67
|
+
export declare function servedAtSentence(served: ServedAt | null): string;
|
|
68
|
+
//# sourceMappingURL=page-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-url.d.ts","sourceRoot":"","sources":["../../../src/core/browse/page-url.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,QAAS,SAAQ,aAAa;IAC7C,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC;AAqBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAqBzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAMhE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { isSessionWorktreePath } from '../session.js';
|
|
3
|
+
/**
|
|
4
|
+
* The two addresses the browsing surface answers for a published page, spelled
|
|
5
|
+
* once. `serve.ts` tests and slices these prefixes, `nav.ts` builds hrefs from
|
|
6
|
+
* them, and the publish commands report them — three readers, one spelling,
|
|
7
|
+
* pinned by `single-source-literals`.
|
|
8
|
+
*/
|
|
9
|
+
export const PUBLISH_ROUTE_PREFIX = '/publish/';
|
|
10
|
+
export const PREVIEW_ROUTE_PREFIX = '/preview/';
|
|
11
|
+
/**
|
|
12
|
+
* `encodeURI`, never `encodeURIComponent`: a page path carries `/` separators
|
|
13
|
+
* that must survive into the URL. The round trip is exact because `serve.ts`
|
|
14
|
+
* decodes the whole pathname once with `decodeURIComponent` before its lookup,
|
|
15
|
+
* recovering the raw key `walkFiles` produced.
|
|
16
|
+
*/
|
|
17
|
+
export function publishRoute(filePath) {
|
|
18
|
+
return `${PUBLISH_ROUTE_PREFIX}${encodeURI(filePath)}`;
|
|
19
|
+
}
|
|
20
|
+
/** `worktree` is the session worktree's directory name — the key `buildPreviews` inserts. */
|
|
21
|
+
export function previewRoute(worktree, filePath) {
|
|
22
|
+
return `${PREVIEW_ROUTE_PREFIX}${encodeURI(`${worktree}/${filePath}`)}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Join a declared base URL to a server-relative route.
|
|
26
|
+
*
|
|
27
|
+
* String concatenation, deliberately, and NOT `new URL(route, base)`:
|
|
28
|
+
* `new URL('/publish/x', 'https://example.com/ctx/')` silently discards the
|
|
29
|
+
* `/ctx` prefix, so a store served under a subpath would be handed a confident
|
|
30
|
+
* wrong URL with no error. Stripping the base's trailing slashes and appending
|
|
31
|
+
* a route that always begins with "/" preserves whatever path the base carries.
|
|
32
|
+
*/
|
|
33
|
+
function joinBaseUrl(baseUrl, route) {
|
|
34
|
+
if (baseUrl === undefined)
|
|
35
|
+
return null;
|
|
36
|
+
return `${baseUrl.replace(/\/+$/, '')}${route}`;
|
|
37
|
+
}
|
|
38
|
+
/** The configured publish path as a "/"-separated prefix with no trailing slash. */
|
|
39
|
+
function publishPrefixOf(publishPath) {
|
|
40
|
+
return publishPath.split(path.sep).join('/').replace(/\/+$/, '');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The address the browsing surface answers for one file of a published page.
|
|
44
|
+
*
|
|
45
|
+
* Null when the file is not under the store's configured publish path. That is
|
|
46
|
+
* the same verdict `checkPageLocation` (`src/commands/publish-check.ts`) already
|
|
47
|
+
* reaches for the same input, by the same prefix test: such a file is not a
|
|
48
|
+
* published page, so it has no filing to judge and no address to report. The
|
|
49
|
+
* two must keep agreeing about what "under the publish path" means.
|
|
50
|
+
*
|
|
51
|
+
* The preview branch asks `isSessionWorktreePath` about the resolved store root
|
|
52
|
+
* — root resolution has already resolved it *to* the worktree when the caller
|
|
53
|
+
* is standing in one — and takes the worktree's directory name from
|
|
54
|
+
* `path.basename`. That is precisely the key `buildPreviews`
|
|
55
|
+
* (`src/core/browse/routes.ts`) inserts, because it enumerates the directories
|
|
56
|
+
* under the configured worktrees path and keys by their names verbatim. No
|
|
57
|
+
* second enumeration, and no git subprocess.
|
|
58
|
+
*
|
|
59
|
+
* `storeRelativeFilePath` is "/"-separated, as both callers already produce.
|
|
60
|
+
*/
|
|
61
|
+
export function pageServedAt(store, storeRelativeFilePath) {
|
|
62
|
+
const prefix = publishPrefixOf(store.config.publish.path);
|
|
63
|
+
if (!storeRelativeFilePath.startsWith(`${prefix}/`))
|
|
64
|
+
return null;
|
|
65
|
+
const pagePath = storeRelativeFilePath.slice(prefix.length + 1);
|
|
66
|
+
const baseUrl = store.config.serve?.base_url;
|
|
67
|
+
const published = publishRoute(pagePath);
|
|
68
|
+
if (!isSessionWorktreePath(store.config, store.root)) {
|
|
69
|
+
return { area: 'publish', route: published, url: joinBaseUrl(baseUrl, published), worktree: null, after_landing: null };
|
|
70
|
+
}
|
|
71
|
+
const worktree = path.basename(store.root);
|
|
72
|
+
const preview = previewRoute(worktree, pagePath);
|
|
73
|
+
return {
|
|
74
|
+
area: 'preview',
|
|
75
|
+
route: preview,
|
|
76
|
+
url: joinBaseUrl(baseUrl, preview),
|
|
77
|
+
worktree,
|
|
78
|
+
after_landing: { route: published, url: joinBaseUrl(baseUrl, published) },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The clause both publish commands append to their one-line summary (D3).
|
|
83
|
+
*
|
|
84
|
+
* Leading space, so a caller writes `${summary}${servedAtSentence(served)}`
|
|
85
|
+
* and an unaddressable page simply adds nothing. The verb carries the
|
|
86
|
+
* distinction the caller was previously left to guess: a page in the store's
|
|
87
|
+
* own checkout is `Served at`, a page still in a session worktree is
|
|
88
|
+
* `Preview at` and names where it goes once it lands. When the store declares
|
|
89
|
+
* a base URL the absolute form replaces the route rather than joining it —
|
|
90
|
+
* two addresses for one page would be the same guessing one level down.
|
|
91
|
+
*/
|
|
92
|
+
export function servedAtSentence(served) {
|
|
93
|
+
if (served === null)
|
|
94
|
+
return '';
|
|
95
|
+
const here = served.url ?? served.route;
|
|
96
|
+
if (served.after_landing === null)
|
|
97
|
+
return ` Served at ${here}.`;
|
|
98
|
+
const landed = served.after_landing.url ?? served.after_landing.route;
|
|
99
|
+
return ` Preview at ${here} (at ${landed} once it lands).`;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=page-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-url.js","sourceRoot":"","sources":["../../../src/core/browse/page-url.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;AACzD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,QAAgB;IAC7D,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,EAAE,CAAC;AAC1E,CAAC;AAqBD;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,OAA2B,EAAE,KAAa;IAC7D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC;AAClD,CAAC;AAED,oFAAoF;AACpF,SAAS,eAAe,CAAC,WAAmB;IAC1C,OAAO,WAAW,CAAC,KAAK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,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;KAC1E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAuB;IACtD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC;IACxC,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI;QAAE,OAAO,cAAc,IAAI,GAAG,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;IACtE,OAAO,eAAe,IAAI,QAAQ,MAAM,kBAAkB,CAAC;AAC7D,CAAC"}
|
package/dist/core/env.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MigrationStep } from '../config/migrations.js';
|
|
1
2
|
import type { Prompter } from '../prompt/prompter.js';
|
|
2
3
|
import type { GitRunner } from './git/exec.js';
|
|
3
4
|
import type { RegistryClient } from './registry.js';
|
|
@@ -32,6 +33,12 @@ export interface RunEnv {
|
|
|
32
33
|
/** The release registry. The only network-capable port; see core/registry.ts. */
|
|
33
34
|
registry: RegistryClient;
|
|
34
35
|
now(): Date;
|
|
36
|
+
/**
|
|
37
|
+
* The schema migration ladder. Absent in production — `realEnv()` never sets
|
|
38
|
+
* it, so every command measures against the shipped ladder. Tests set it to
|
|
39
|
+
* exercise a migration before any real step exists (migrate-stores-on-update).
|
|
40
|
+
*/
|
|
41
|
+
migrationSteps?: readonly MigrationStep[];
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
37
44
|
* interactive ⇔ stdin.isTTY && stdout.isTTY && !noInput.
|
package/dist/core/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/core/env.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AE,MAAM,CAAC,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,EAAE,EAAE,EAAE,CAAC;IACP,0FAA0F;IAC1F,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,SAAS,CAAC;IACf,iFAAiF;IACjF,QAAQ,EAAE,cAAc,CAAC;IACzB,GAAG,IAAI,IAAI,CAAC;IACZ;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,OAAO,IAAI,MAAM,CAYhC"}
|
package/dist/core/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/core/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/core/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAoCxE;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;QAC5E,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,sBAAsB,EAAE;QAClC,GAAG,EAAE,uBAAuB,EAAE;QAC9B,QAAQ,EAAE,yBAAyB,EAAE;QACrC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -34,8 +34,23 @@ export declare class NotAGitRepositoryError extends ContextureError {
|
|
|
34
34
|
export declare class SchemaVersionNewerError extends ContextureError {
|
|
35
35
|
constructor(storeVersion: number, supportedVersion: number);
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* migrate-stores-on-update: one error for every older store, so the code a
|
|
39
|
+
* caller matches on stays `config.schema_version.behind` whichever way the
|
|
40
|
+
* remedy points. What varies is the remedy, carried in the message and in
|
|
41
|
+
* `details.remedy`:
|
|
42
|
+
*
|
|
43
|
+
* - `update` the store is at or above the migration floor, so `ctxr update`
|
|
44
|
+
* carries it forward. Raised by every command except update.
|
|
45
|
+
* - `by_hand` the store is below the floor; nothing in this release can
|
|
46
|
+
* bring it forward. Raised by every command, update included.
|
|
47
|
+
*/
|
|
37
48
|
export declare class SchemaVersionBehindError extends ContextureError {
|
|
38
|
-
constructor(storeVersion: number, supportedVersion: number);
|
|
49
|
+
constructor(storeVersion: number, supportedVersion: number, floor: number);
|
|
50
|
+
}
|
|
51
|
+
/** A schema migration step failed, or its result did not validate; nothing was written. */
|
|
52
|
+
export declare class SchemaMigrationFailedError extends ContextureError {
|
|
53
|
+
constructor(configPath: string, detail: string);
|
|
39
54
|
}
|
|
40
55
|
export declare class SchemaVersionMissingError extends ContextureError {
|
|
41
56
|
constructor(configPath: string);
|
|
@@ -174,4 +189,30 @@ export declare class PublishSlugExistsError extends ContextureError {
|
|
|
174
189
|
export declare class PublishPageNotFoundError extends ContextureError {
|
|
175
190
|
constructor(relativePath: string);
|
|
176
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* write-lifecycle spec: a session label that normalizes to nothing is refused
|
|
194
|
+
* rather than dropped — dropping it would hand back a session named nothing like
|
|
195
|
+
* what the caller asked for, with no indication that anything happened.
|
|
196
|
+
*/
|
|
197
|
+
export declare class SessionLabelUnusableError extends ContextureError {
|
|
198
|
+
constructor(label: string);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* write-lifecycle spec: a label that is already taken is refused, never adjusted
|
|
202
|
+
* to fit (name-the-session-at-start design.md D4). Names the worktree as well as
|
|
203
|
+
* the branch, because returning to the earlier session is the likely next step.
|
|
204
|
+
*/
|
|
205
|
+
export declare class SessionNameExistsError extends ContextureError {
|
|
206
|
+
constructor(label: string, worktreePath: string);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* write-lifecycle spec: git refusing to create the worktree is reported as the
|
|
210
|
+
* usage error it almost always is — the name it was handed — rather than as an
|
|
211
|
+
* internal error, which is what an uncaught exec failure would produce. git's own
|
|
212
|
+
* stderr rides in details rather than in the message, so the sentence stays about
|
|
213
|
+
* what contexture asked for.
|
|
214
|
+
*/
|
|
215
|
+
export declare class SessionWorktreeRefusedError extends ContextureError {
|
|
216
|
+
constructor(branch: string, worktreePath: string, stderr: string);
|
|
217
|
+
}
|
|
177
218
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,YAAY,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAK/C;CACF;AAED,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,YAAY,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAShE;CACF;AAED;;;;;;GAMG;AACH,qBAAa,8BAA+B,SAAQ,eAAe;IACjE,cAQC;CACF;AAED,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,YAAY,IAAI,EAAE,MAAM,EAOvB;CACF;AAED,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EASzD;CACF;AAED,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,YAAY,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,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,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,IAAI,EAAE,MAAM,EAOvB;CACF;AAED,iEAAiE;AACjE,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,YAAY,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAQ7C;CACF;AAED,0GAA0G;AAC1G,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,YAAY,YAAY,EAAE,MAAM,EAO/B;CACF;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,eAAe;IAC5D,YAAY,KAAK,EAAE,MAAM,EAOxB;CACF;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,YAAY,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAQ9C;CACF;AAED;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,eAAe;IAC9D,YAAY,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAQ/D;CACF"}
|
package/dist/core/errors.js
CHANGED
|
@@ -64,16 +64,42 @@ export class SchemaVersionNewerError extends ContextureError {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* migrate-stores-on-update: one error for every older store, so the code a
|
|
69
|
+
* caller matches on stays `config.schema_version.behind` whichever way the
|
|
70
|
+
* remedy points. What varies is the remedy, carried in the message and in
|
|
71
|
+
* `details.remedy`:
|
|
72
|
+
*
|
|
73
|
+
* - `update` the store is at or above the migration floor, so `ctxr update`
|
|
74
|
+
* carries it forward. Raised by every command except update.
|
|
75
|
+
* - `by_hand` the store is below the floor; nothing in this release can
|
|
76
|
+
* bring it forward. Raised by every command, update included.
|
|
77
|
+
*/
|
|
67
78
|
export class SchemaVersionBehindError extends ContextureError {
|
|
68
|
-
constructor(storeVersion, supportedVersion) {
|
|
79
|
+
constructor(storeVersion, supportedVersion, floor) {
|
|
80
|
+
const withinFloor = storeVersion >= floor;
|
|
69
81
|
super(ExitCode.Usage, {
|
|
70
82
|
code: 'config.schema_version.behind',
|
|
71
83
|
severity: 'error',
|
|
72
84
|
message: `This store's schema_version (${storeVersion}) is older than the ` +
|
|
73
85
|
`version this contexture release supports (${supportedVersion}). ` +
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
(withinFloor
|
|
87
|
+
? 'Run `ctxr update` to bring it forward, or `ctxr update --worktree` to do it on a branch of its own.'
|
|
88
|
+
: `This release can only bring forward a store recorded at ${floor} or later, so it cannot ` +
|
|
89
|
+
'migrate this one: bring the store forward by hand, following the fixup in the release notes ' +
|
|
90
|
+
'for each version that raised it.'),
|
|
91
|
+
details: { storeVersion, supportedVersion, floor, remedy: withinFloor ? 'update' : 'by_hand' },
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** A schema migration step failed, or its result did not validate; nothing was written. */
|
|
96
|
+
export class SchemaMigrationFailedError extends ContextureError {
|
|
97
|
+
constructor(configPath, detail) {
|
|
98
|
+
super(ExitCode.Usage, {
|
|
99
|
+
code: 'config.schema_version.migration_failed',
|
|
100
|
+
severity: 'error',
|
|
101
|
+
message: `Could not migrate "${configPath}", and it was left unchanged: ${detail}`,
|
|
102
|
+
subject: configPath,
|
|
77
103
|
});
|
|
78
104
|
}
|
|
79
105
|
}
|
|
@@ -443,4 +469,53 @@ export class PublishPageNotFoundError extends ContextureError {
|
|
|
443
469
|
});
|
|
444
470
|
}
|
|
445
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* write-lifecycle spec: a session label that normalizes to nothing is refused
|
|
474
|
+
* rather than dropped — dropping it would hand back a session named nothing like
|
|
475
|
+
* what the caller asked for, with no indication that anything happened.
|
|
476
|
+
*/
|
|
477
|
+
export class SessionLabelUnusableError extends ContextureError {
|
|
478
|
+
constructor(label) {
|
|
479
|
+
super(ExitCode.Usage, {
|
|
480
|
+
code: 'session.label_unusable',
|
|
481
|
+
severity: 'error',
|
|
482
|
+
message: `"${label}" has no letters or digits to name a session with — give a label like "ctx-a", or none at all.`,
|
|
483
|
+
subject: label,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* write-lifecycle spec: a label that is already taken is refused, never adjusted
|
|
489
|
+
* to fit (name-the-session-at-start design.md D4). Names the worktree as well as
|
|
490
|
+
* the branch, because returning to the earlier session is the likely next step.
|
|
491
|
+
*/
|
|
492
|
+
export class SessionNameExistsError extends ContextureError {
|
|
493
|
+
constructor(label, worktreePath) {
|
|
494
|
+
super(ExitCode.Usage, {
|
|
495
|
+
code: 'session.name_exists',
|
|
496
|
+
severity: 'error',
|
|
497
|
+
message: `A session labelled "${label}" already exists at "${worktreePath}" — work there, or start this one under another label.`,
|
|
498
|
+
subject: label,
|
|
499
|
+
details: { worktree: worktreePath },
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* write-lifecycle spec: git refusing to create the worktree is reported as the
|
|
505
|
+
* usage error it almost always is — the name it was handed — rather than as an
|
|
506
|
+
* internal error, which is what an uncaught exec failure would produce. git's own
|
|
507
|
+
* stderr rides in details rather than in the message, so the sentence stays about
|
|
508
|
+
* what contexture asked for.
|
|
509
|
+
*/
|
|
510
|
+
export class SessionWorktreeRefusedError extends ContextureError {
|
|
511
|
+
constructor(branch, worktreePath, stderr) {
|
|
512
|
+
super(ExitCode.Usage, {
|
|
513
|
+
code: 'session.worktree_refused',
|
|
514
|
+
severity: 'error',
|
|
515
|
+
message: `git refused to create the session worktree at "${worktreePath}" on branch "${branch}".`,
|
|
516
|
+
subject: worktreePath,
|
|
517
|
+
details: { branch, worktree: worktreePath, git_stderr: stderr.trim() },
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
446
521
|
//# sourceMappingURL=errors.js.map
|