@bevel-software/platform-shared 0.25.2 → 0.27.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/dist/git/pr.types.d.ts +101 -0
- package/dist/git/pr.types.d.ts.map +1 -1
- package/dist/git/types.d.ts +76 -2
- package/dist/git/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow/events.d.ts +24 -1
- package/dist/workflow/events.d.ts.map +1 -1
- package/dist/workflow/events.js +1 -0
- package/dist/workflow/events.js.map +1 -1
- package/dist/workflow/interface.d.ts +42 -1
- package/dist/workflow/interface.d.ts.map +1 -1
- package/dist/workflow/types.d.ts +57 -3
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workspace/kb-layout.d.ts +40 -101
- package/dist/workspace/kb-layout.d.ts.map +1 -1
- package/dist/workspace/kb-layout.js +40 -159
- package/dist/workspace/kb-layout.js.map +1 -1
- package/dist/workspace/md-links.d.ts +138 -0
- package/dist/workspace/md-links.d.ts.map +1 -0
- package/dist/workspace/md-links.js +703 -0
- package/dist/workspace/md-links.js.map +1 -0
- package/dist/workspace/platform-files.d.ts +25 -24
- package/dist/workspace/platform-files.d.ts.map +1 -1
- package/dist/workspace/platform-files.js +41 -25
- package/dist/workspace/platform-files.js.map +1 -1
- package/package.json +1 -1
- package/src/git/pr.types.ts +99 -0
- package/src/git/types.ts +80 -2
- package/src/index.ts +1 -0
- package/src/workflow/events.ts +26 -0
- package/src/workflow/interface.ts +42 -0
- package/src/workflow/types.ts +48 -4
- package/src/workspace/kb-layout.ts +39 -172
- package/src/workspace/md-links.ts +757 -0
- package/src/workspace/platform-files.ts +44 -26
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_KB_LAYOUT,
|
|
3
3
|
FIXED_PLATFORM_FILE_NAMES,
|
|
4
|
-
agentsFileOf,
|
|
5
4
|
reservedRootDirNames,
|
|
6
5
|
type KbLayout,
|
|
7
6
|
} from './kb-layout.js';
|
|
@@ -9,28 +8,26 @@ import {
|
|
|
9
8
|
/**
|
|
10
9
|
* The files the platform reads as configuration, not content. `access.md`
|
|
11
10
|
* governs the folder it sits in and `.bevelignore` layers like `.gitignore`,
|
|
12
|
-
* so both count at any depth; `roles.yaml`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* so both count at any depth; `roles.yaml` is read from the repository root
|
|
12
|
+
* only, so a nested file of that name is ordinary content. Moving one changes
|
|
13
|
+
* what the platform enforces, so moves refuse them.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* The agent guide is NOT among them. It was, while the platform wrote it to
|
|
16
|
+
* the repository root; the backend serves it from code now (core-backend's
|
|
17
|
+
* `modules/agent-guide`), and a root `AGENTS.md` — or a file under whatever
|
|
18
|
+
* name a deployment once gave the guide — is the organisation's own
|
|
19
|
+
* conventions page, which moves and deletes like any other.
|
|
20
|
+
*
|
|
21
|
+
* Still a FUNCTION OF THE LAYOUT, so every gate asks the question the same
|
|
22
|
+
* way it asks the others, and a file the layout makes a platform file again
|
|
23
|
+
* one day needs no caller to change.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the layout is the question's shape, kept for every caller (see above)
|
|
26
|
+
export function platformFileNames(_layout: KbLayout): readonly string[] {
|
|
27
|
+
return [...FIXED_PLATFORM_FILE_NAMES];
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
/**
|
|
29
|
-
* The platform file names under the DEFAULT layout — what they were before the
|
|
30
|
-
* guide could be renamed. Kept for callers that want the default answer rather
|
|
31
|
-
* than this deployment's; anything judging a real path asks
|
|
32
|
-
* {@link platformFileNames}, which knows what this deployment called its guide.
|
|
33
|
-
*/
|
|
30
|
+
/** The platform file names under the DEFAULT layout — the same three on every deployment. */
|
|
34
31
|
export const PLATFORM_FILE_NAMES: readonly string[] = Object.freeze(
|
|
35
32
|
platformFileNames(DEFAULT_KB_LAYOUT),
|
|
36
33
|
);
|
|
@@ -41,8 +38,8 @@ const PLATFORM_FILES_AT_ANY_DEPTH = new Set(['access.md', '.bevelignore']);
|
|
|
41
38
|
/**
|
|
42
39
|
* The platform files split by the DEPTH they count at, which is the half of
|
|
43
40
|
* {@link isPlatformFile} that a name alone does not tell you: `access.md` and
|
|
44
|
-
* `.bevelignore` are platform files in any folder, `roles.yaml`
|
|
45
|
-
*
|
|
41
|
+
* `.bevelignore` are platform files in any folder, `roles.yaml` only in the
|
|
42
|
+
* repository root.
|
|
46
43
|
*
|
|
47
44
|
* Exported because the agent-facing rules state that split in prose, and a
|
|
48
45
|
* prose list written by hand drifts from the predicate that actually refuses
|
|
@@ -111,7 +108,7 @@ export function platformFileCreationRefusal(pathOrName: string): string {
|
|
|
111
108
|
/**
|
|
112
109
|
* The sentence an UPLOAD is refused with when one of its paths would land a
|
|
113
110
|
* platform file — a zip carrying an `access.md`, a `.bevelignore`, a
|
|
114
|
-
* `roles.yaml
|
|
111
|
+
* `roles.yaml`, or a single file sent under one of those
|
|
115
112
|
* names.
|
|
116
113
|
*
|
|
117
114
|
* Its own sentence rather than the move's, because the thing being kept out is
|
|
@@ -151,7 +148,7 @@ export function platformFolderRefusal(repoRelativeDir: string): string {
|
|
|
151
148
|
|
|
152
149
|
/**
|
|
153
150
|
* Whether the platform file at `repoRelativePath` sits directly in the
|
|
154
|
-
* repository root — the copy every one of the
|
|
151
|
+
* repository root — the copy every one of the three is read from there, and so
|
|
155
152
|
* never the misplaced one: it is the copy a restore puts back. A nested
|
|
156
153
|
* `access.md` or `.bevelignore` is a platform file too, but it layers on top
|
|
157
154
|
* of the root's rather than standing in for it, which is why moving the
|
|
@@ -161,11 +158,32 @@ export function isRootPlatformFile(repoRelativePath: string, layout: KbLayout):
|
|
|
161
158
|
return platformFiles(layout).has(normalize(repoRelativePath));
|
|
162
159
|
}
|
|
163
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The platform files that govern the WHOLE repository: the root's `access.md`,
|
|
163
|
+
* which every folder without its own falls back to, and `roles.yaml`, which
|
|
164
|
+
* says what the roles are. Deleting either leaves the repository ungoverned,
|
|
165
|
+
* so no surface deletes them — not the agent tools, not the app. A nested
|
|
166
|
+
* `access.md` is not among them: it narrows its own folder, and whoever may
|
|
167
|
+
* write it may delete it, which hands the folder back to its parent's rules.
|
|
168
|
+
* `.bevelignore` is not among them either; its delete rules are untouched.
|
|
169
|
+
*/
|
|
170
|
+
const REPOSITORY_OWN_FILES: ReadonlySet<string> = new Set(['access.md', 'roles.yaml']);
|
|
171
|
+
|
|
172
|
+
/** Whether `repoRelativePath` is one of the files no surface deletes (see above). Exact spelling. */
|
|
173
|
+
export function isRepositoryOwnFile(repoRelativePath: string, layout: KbLayout): boolean {
|
|
174
|
+
return isRootPlatformFile(repoRelativePath, layout) && REPOSITORY_OWN_FILES.has(normalize(repoRelativePath));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** The one sentence every surface refuses a delete of the repository's own file with. */
|
|
178
|
+
export function repositoryOwnFileDeleteRefusal(pathOrName: string): string {
|
|
179
|
+
return `${baseName(pathOrName)} is the repository's own file and cannot be deleted.`;
|
|
180
|
+
}
|
|
181
|
+
|
|
164
182
|
/**
|
|
165
183
|
* The place a misplaced platform file is allowed to be put back, when
|
|
166
184
|
* `repoRelativeDestination` names one, and null when it does not.
|
|
167
185
|
*
|
|
168
|
-
* `roles.yaml`
|
|
186
|
+
* `roles.yaml` is read from the repository root and
|
|
169
187
|
* nowhere else, so their one required location is the root. A nested `.bevelignore` is
|
|
170
188
|
* read too (it layers, see `BevelIgnoreStack`), yet a restore of one lands at
|
|
171
189
|
* the root only — a deliberate narrowing of the exception, not a claim about
|
|
@@ -204,8 +222,8 @@ export function platformRestoreDestination(
|
|
|
204
222
|
* Three things make the shape, and all three are about the move rather than
|
|
205
223
|
* about the source's current standing:
|
|
206
224
|
*
|
|
207
|
-
* - the source is NAMED like a platform file. A nested `roles.yaml
|
|
208
|
-
*
|
|
225
|
+
* - the source is NAMED like a platform file. A nested `roles.yaml` is
|
|
226
|
+
* ordinary content where it sits
|
|
209
227
|
* (`isPlatformFile` says so, and moving it needs no exception), but it is
|
|
210
228
|
* still the copy a restore carries back to the root — judging the shape on
|
|
211
229
|
* `isPlatformFile` would skip the exception for exactly the two files the
|