wingfoil 0.2.1
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/LICENSE +21 -0
- package/README.md +334 -0
- package/dist/cli/error.d.ts +11 -0
- package/dist/cli/error.d.ts.map +1 -0
- package/dist/cli/error.js +27 -0
- package/dist/cli/error.js.map +1 -0
- package/dist/cli/exit.d.ts +19 -0
- package/dist/cli/exit.d.ts.map +1 -0
- package/dist/cli/exit.js +14 -0
- package/dist/cli/exit.js.map +1 -0
- package/dist/cli/index.d.ts +28 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +36 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-command.d.ts +34 -0
- package/dist/cli/init-command.d.ts.map +1 -0
- package/dist/cli/init-command.js +100 -0
- package/dist/cli/init-command.js.map +1 -0
- package/dist/cli/mcp-command.d.ts +24 -0
- package/dist/cli/mcp-command.d.ts.map +1 -0
- package/dist/cli/mcp-command.js +42 -0
- package/dist/cli/mcp-command.js.map +1 -0
- package/dist/cli/output.d.ts +13 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +28 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/program.d.ts +12 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +279 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/registrar.d.ts +69 -0
- package/dist/cli/registrar.d.ts.map +1 -0
- package/dist/cli/registrar.js +82 -0
- package/dist/cli/registrar.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +45 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/approval-authority.d.ts +83 -0
- package/dist/core/approval-authority.d.ts.map +1 -0
- package/dist/core/approval-authority.js +112 -0
- package/dist/core/approval-authority.js.map +1 -0
- package/dist/core/builtin-asset.d.ts +71 -0
- package/dist/core/builtin-asset.d.ts.map +1 -0
- package/dist/core/builtin-asset.js +137 -0
- package/dist/core/builtin-asset.js.map +1 -0
- package/dist/core/builtin-integrity.d.ts +32 -0
- package/dist/core/builtin-integrity.d.ts.map +1 -0
- package/dist/core/builtin-integrity.js +148 -0
- package/dist/core/builtin-integrity.js.map +1 -0
- package/dist/core/confinement.d.ts +57 -0
- package/dist/core/confinement.d.ts.map +1 -0
- package/dist/core/confinement.js +108 -0
- package/dist/core/confinement.js.map +1 -0
- package/dist/core/context.d.ts +187 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +192 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/directive-assign.d.ts +131 -0
- package/dist/core/directive-assign.d.ts.map +1 -0
- package/dist/core/directive-assign.js +352 -0
- package/dist/core/directive-assign.js.map +1 -0
- package/dist/core/directives-list.d.ts +80 -0
- package/dist/core/directives-list.d.ts.map +1 -0
- package/dist/core/directives-list.js +148 -0
- package/dist/core/directives-list.js.map +1 -0
- package/dist/core/exit-code.d.ts +85 -0
- package/dist/core/exit-code.d.ts.map +1 -0
- package/dist/core/exit-code.js +163 -0
- package/dist/core/exit-code.js.map +1 -0
- package/dist/core/git-identity.d.ts +32 -0
- package/dist/core/git-identity.d.ts.map +1 -0
- package/dist/core/git-identity.js +72 -0
- package/dist/core/git-identity.js.map +1 -0
- package/dist/core/index.d.ts +388 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +1331 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/init.d.ts +78 -0
- package/dist/core/init.d.ts.map +1 -0
- package/dist/core/init.js +167 -0
- package/dist/core/init.js.map +1 -0
- package/dist/core/loaders.d.ts +174 -0
- package/dist/core/loaders.d.ts.map +1 -0
- package/dist/core/loaders.js +364 -0
- package/dist/core/loaders.js.map +1 -0
- package/dist/core/memory-add-type.d.ts +43 -0
- package/dist/core/memory-add-type.d.ts.map +1 -0
- package/dist/core/memory-add-type.js +151 -0
- package/dist/core/memory-add-type.js.map +1 -0
- package/dist/core/memory-transition.d.ts +111 -0
- package/dist/core/memory-transition.d.ts.map +1 -0
- package/dist/core/memory-transition.js +269 -0
- package/dist/core/memory-transition.js.map +1 -0
- package/dist/core/registry.d.ts +189 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +66 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/relevance.d.ts +86 -0
- package/dist/core/relevance.d.ts.map +1 -0
- package/dist/core/relevance.js +258 -0
- package/dist/core/relevance.js.map +1 -0
- package/dist/core/require-reason.d.ts +27 -0
- package/dist/core/require-reason.d.ts.map +1 -0
- package/dist/core/require-reason.js +95 -0
- package/dist/core/require-reason.js.map +1 -0
- package/dist/core/types.d.ts +45 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +22 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/usage-error.d.ts +20 -0
- package/dist/core/usage-error.d.ts.map +1 -0
- package/dist/core/usage-error.js +29 -0
- package/dist/core/usage-error.js.map +1 -0
- package/dist/core/write-guard.d.ts +99 -0
- package/dist/core/write-guard.d.ts.map +1 -0
- package/dist/core/write-guard.js +247 -0
- package/dist/core/write-guard.js.map +1 -0
- package/dist/directives/create.d.ts +47 -0
- package/dist/directives/create.d.ts.map +1 -0
- package/dist/directives/create.js +82 -0
- package/dist/directives/create.js.map +1 -0
- package/dist/directives/index.d.ts +20 -0
- package/dist/directives/index.d.ts.map +1 -0
- package/dist/directives/index.js +32 -0
- package/dist/directives/index.js.map +1 -0
- package/dist/directives/roles-edit.d.ts +53 -0
- package/dist/directives/roles-edit.d.ts.map +1 -0
- package/dist/directives/roles-edit.js +286 -0
- package/dist/directives/roles-edit.js.map +1 -0
- package/dist/directives/schema.d.ts +65 -0
- package/dist/directives/schema.d.ts.map +1 -0
- package/dist/directives/schema.js +68 -0
- package/dist/directives/schema.js.map +1 -0
- package/dist/dna/edit.d.ts +61 -0
- package/dist/dna/edit.d.ts.map +1 -0
- package/dist/dna/edit.js +429 -0
- package/dist/dna/edit.js.map +1 -0
- package/dist/dna/index.d.ts +24 -0
- package/dist/dna/index.d.ts.map +1 -0
- package/dist/dna/index.js +59 -0
- package/dist/dna/index.js.map +1 -0
- package/dist/dna/mutate.d.ts +74 -0
- package/dist/dna/mutate.d.ts.map +1 -0
- package/dist/dna/mutate.js +318 -0
- package/dist/dna/mutate.js.map +1 -0
- package/dist/dna/path.d.ts +175 -0
- package/dist/dna/path.d.ts.map +1 -0
- package/dist/dna/path.js +289 -0
- package/dist/dna/path.js.map +1 -0
- package/dist/dna/roles.d.ts +57 -0
- package/dist/dna/roles.d.ts.map +1 -0
- package/dist/dna/roles.js +50 -0
- package/dist/dna/roles.js.map +1 -0
- package/dist/dna/schema.d.ts +172 -0
- package/dist/dna/schema.d.ts.map +1 -0
- package/dist/dna/schema.js +182 -0
- package/dist/dna/schema.js.map +1 -0
- package/dist/dna/set.d.ts +145 -0
- package/dist/dna/set.d.ts.map +1 -0
- package/dist/dna/set.js +428 -0
- package/dist/dna/set.js.map +1 -0
- package/dist/mcp/dna-resource.d.ts +16 -0
- package/dist/mcp/dna-resource.d.ts.map +1 -0
- package/dist/mcp/dna-resource.js +56 -0
- package/dist/mcp/dna-resource.js.map +1 -0
- package/dist/mcp/index.d.ts +49 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +60 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/memory-resource.d.ts +17 -0
- package/dist/mcp/memory-resource.d.ts.map +1 -0
- package/dist/mcp/memory-resource.js +133 -0
- package/dist/mcp/memory-resource.js.map +1 -0
- package/dist/mcp/prompt.d.ts +48 -0
- package/dist/mcp/prompt.d.ts.map +1 -0
- package/dist/mcp/prompt.js +176 -0
- package/dist/mcp/prompt.js.map +1 -0
- package/dist/mcp/read-only.d.ts +42 -0
- package/dist/mcp/read-only.d.ts.map +1 -0
- package/dist/mcp/read-only.js +93 -0
- package/dist/mcp/read-only.js.map +1 -0
- package/dist/mcp/registrar.d.ts +54 -0
- package/dist/mcp/registrar.d.ts.map +1 -0
- package/dist/mcp/registrar.js +72 -0
- package/dist/mcp/registrar.js.map +1 -0
- package/dist/mcp/server.d.ts +58 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +64 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/workflow-resource.d.ts +17 -0
- package/dist/mcp/workflow-resource.d.ts.map +1 -0
- package/dist/mcp/workflow-resource.js +63 -0
- package/dist/mcp/workflow-resource.js.map +1 -0
- package/dist/memory/add.d.ts +50 -0
- package/dist/memory/add.d.ts.map +1 -0
- package/dist/memory/add.js +131 -0
- package/dist/memory/add.js.map +1 -0
- package/dist/memory/audit.d.ts +177 -0
- package/dist/memory/audit.d.ts.map +1 -0
- package/dist/memory/audit.js +287 -0
- package/dist/memory/audit.js.map +1 -0
- package/dist/memory/commit-message.d.ts +146 -0
- package/dist/memory/commit-message.d.ts.map +1 -0
- package/dist/memory/commit-message.js +203 -0
- package/dist/memory/commit-message.js.map +1 -0
- package/dist/memory/entry.d.ts +56 -0
- package/dist/memory/entry.d.ts.map +1 -0
- package/dist/memory/entry.js +28 -0
- package/dist/memory/entry.js.map +1 -0
- package/dist/memory/frontmatter-edit.d.ts +68 -0
- package/dist/memory/frontmatter-edit.d.ts.map +1 -0
- package/dist/memory/frontmatter-edit.js +333 -0
- package/dist/memory/frontmatter-edit.js.map +1 -0
- package/dist/memory/git-log.d.ts +32 -0
- package/dist/memory/git-log.d.ts.map +1 -0
- package/dist/memory/git-log.js +100 -0
- package/dist/memory/git-log.js.map +1 -0
- package/dist/memory/history.d.ts +142 -0
- package/dist/memory/history.d.ts.map +1 -0
- package/dist/memory/history.js +250 -0
- package/dist/memory/history.js.map +1 -0
- package/dist/memory/index.d.ts +58 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +107 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/query.d.ts +150 -0
- package/dist/memory/query.d.ts.map +1 -0
- package/dist/memory/query.js +307 -0
- package/dist/memory/query.js.map +1 -0
- package/dist/memory/reject.d.ts +11 -0
- package/dist/memory/reject.d.ts.map +1 -0
- package/dist/memory/reject.js +32 -0
- package/dist/memory/reject.js.map +1 -0
- package/dist/memory/schema.d.ts +104 -0
- package/dist/memory/schema.d.ts.map +1 -0
- package/dist/memory/schema.js +161 -0
- package/dist/memory/schema.js.map +1 -0
- package/dist/memory/state-machine.d.ts +166 -0
- package/dist/memory/state-machine.d.ts.map +1 -0
- package/dist/memory/state-machine.js +431 -0
- package/dist/memory/state-machine.js.map +1 -0
- package/dist/memory/submit.d.ts +11 -0
- package/dist/memory/submit.d.ts.map +1 -0
- package/dist/memory/submit.js +44 -0
- package/dist/memory/submit.js.map +1 -0
- package/dist/storage/builtin-directives.d.ts +54 -0
- package/dist/storage/builtin-directives.d.ts.map +1 -0
- package/dist/storage/builtin-directives.js +152 -0
- package/dist/storage/builtin-directives.js.map +1 -0
- package/dist/storage/commit.d.ts +92 -0
- package/dist/storage/commit.d.ts.map +1 -0
- package/dist/storage/commit.js +201 -0
- package/dist/storage/commit.js.map +1 -0
- package/dist/storage/confinement.d.ts +93 -0
- package/dist/storage/confinement.d.ts.map +1 -0
- package/dist/storage/confinement.js +164 -0
- package/dist/storage/confinement.js.map +1 -0
- package/dist/storage/document.d.ts +27 -0
- package/dist/storage/document.d.ts.map +1 -0
- package/dist/storage/document.js +52 -0
- package/dist/storage/document.js.map +1 -0
- package/dist/storage/errors.d.ts +36 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +46 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/frontmatter.d.ts +27 -0
- package/dist/storage/frontmatter.d.ts.map +1 -0
- package/dist/storage/frontmatter.js +37 -0
- package/dist/storage/frontmatter.js.map +1 -0
- package/dist/storage/git-root.d.ts +17 -0
- package/dist/storage/git-root.d.ts.map +1 -0
- package/dist/storage/git-root.js +49 -0
- package/dist/storage/git-root.js.map +1 -0
- package/dist/storage/index.d.ts +29 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +66 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/init-state.d.ts +9 -0
- package/dist/storage/init-state.d.ts.map +1 -0
- package/dist/storage/init-state.js +24 -0
- package/dist/storage/init-state.js.map +1 -0
- package/dist/storage/layout.d.ts +51 -0
- package/dist/storage/layout.d.ts.map +1 -0
- package/dist/storage/layout.js +88 -0
- package/dist/storage/layout.js.map +1 -0
- package/dist/storage/memory-path.d.ts +72 -0
- package/dist/storage/memory-path.d.ts.map +1 -0
- package/dist/storage/memory-path.js +127 -0
- package/dist/storage/memory-path.js.map +1 -0
- package/dist/storage/snapshot.d.ts +16 -0
- package/dist/storage/snapshot.d.ts.map +1 -0
- package/dist/storage/snapshot.js +72 -0
- package/dist/storage/snapshot.js.map +1 -0
- package/dist/storage/templates.d.ts +88 -0
- package/dist/storage/templates.d.ts.map +1 -0
- package/dist/storage/templates.js +422 -0
- package/dist/storage/templates.js.map +1 -0
- package/dist/validation/error-mapper.d.ts +16 -0
- package/dist/validation/error-mapper.d.ts.map +1 -0
- package/dist/validation/error-mapper.js +18 -0
- package/dist/validation/error-mapper.js.map +1 -0
- package/dist/validation/errors.d.ts +69 -0
- package/dist/validation/errors.d.ts.map +1 -0
- package/dist/validation/errors.js +69 -0
- package/dist/validation/errors.js.map +1 -0
- package/dist/validation/id.d.ts +16 -0
- package/dist/validation/id.d.ts.map +1 -0
- package/dist/validation/id.js +177 -0
- package/dist/validation/id.js.map +1 -0
- package/dist/validation/index.d.ts +18 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +37 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/secret-scan.d.ts +129 -0
- package/dist/validation/secret-scan.d.ts.map +1 -0
- package/dist/validation/secret-scan.js +367 -0
- package/dist/validation/secret-scan.js.map +1 -0
- package/dist/validation/two-pass.d.ts +24 -0
- package/dist/validation/two-pass.d.ts.map +1 -0
- package/dist/validation/two-pass.js +24 -0
- package/dist/validation/two-pass.js.map +1 -0
- package/dist/validation/warning.d.ts +31 -0
- package/dist/validation/warning.d.ts.map +1 -0
- package/dist/validation/warning.js +81 -0
- package/dist/validation/warning.js.map +1 -0
- package/dist/validation/yaml.d.ts +9 -0
- package/dist/validation/yaml.d.ts.map +1 -0
- package/dist/validation/yaml.js +30 -0
- package/dist/validation/yaml.js.map +1 -0
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +16 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/schema.d.ts +89 -0
- package/dist/workflow/schema.d.ts.map +1 -0
- package/dist/workflow/schema.js +73 -0
- package/dist/workflow/schema.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DnaYaml = exports.Paths = exports.Team = exports.RoleEntry = exports.AgentEntry = exports.TeamMember = exports.Stacks = exports.MethodologyEntry = exports.TechEntry = exports.Module = exports.Project = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* DnaYaml schema (spec-002-dna-yaml-schema) — the Project DNA structural map (P2.4). This is one of
|
|
6
|
+
* the three independent per-pillar schemas task-004-decoupled-pillars keeps decoupled (REQ-SYS-02):
|
|
7
|
+
* it has no dependency on `memory.yaml`'s or `workflows.yaml`'s schema, and its own validation never
|
|
8
|
+
* inspects any other file.
|
|
9
|
+
*
|
|
10
|
+
* Every object node is `.passthrough()` per spec-009-validation-strategy §2. The TypeScript type is
|
|
11
|
+
* derived exclusively via `z.infer` (spec-002: "no hand-written duplicate interface").
|
|
12
|
+
*/
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
/**
|
|
15
|
+
* An array of named entries in which **no two entries share a `name`**.
|
|
16
|
+
*
|
|
17
|
+
* `dl-081-dna-mutation-surface-shape` ratified that entries are addressed by `name`
|
|
18
|
+
* (`dna update team.members.roberto.roles …`) rather than by index, because an index shifts the moment an
|
|
19
|
+
* entry is removed and a path written today would address a different entry tomorrow. Uniqueness is
|
|
20
|
+
* therefore not a nicety but the **prerequisite** that addressing rests on, and the ratification left
|
|
21
|
+
* the mechanism open: "a uniqueness refinement per collection, or the verbs must refuse on more than
|
|
22
|
+
* one match".
|
|
23
|
+
*
|
|
24
|
+
* This is the refinement, and it is the stronger of the two: it makes the ambiguity *unreachable*
|
|
25
|
+
* rather than *handled*, so no verb needs a two-match branch that nothing could exercise, and it
|
|
26
|
+
* protects the readers that are not verbs either — `resolveRoleHolders` (`./roles.ts`), the directive
|
|
27
|
+
* role bindings, and every future lookup by name. It follows the precedent `spec-002` already sets
|
|
28
|
+
* with `Team`'s referential `superRefine`: a same-document integrity rule that makes a violating file
|
|
29
|
+
* fail to load, rather than a rule each consumer re-checks.
|
|
30
|
+
*
|
|
31
|
+
* Non-breaking where it matters, measured rather than assumed (task-093 AC4): WingFoil's own
|
|
32
|
+
* `dna.yaml` carries 38 object entries across these six collections with zero duplicates, and every
|
|
33
|
+
* `wingfoil init` template scaffolds distinct names (`test/dna/schema-uniqueness.test.ts` pins both).
|
|
34
|
+
* The same name in DIFFERENT collections stays legal — a module and a role may share one.
|
|
35
|
+
*/
|
|
36
|
+
function uniquelyNamed(entry) {
|
|
37
|
+
return zod_1.z.array(entry).superRefine((value, ctx) => {
|
|
38
|
+
const firstSeen = new Map();
|
|
39
|
+
value.forEach((item, index) => {
|
|
40
|
+
const name = item?.name;
|
|
41
|
+
if (typeof name !== 'string')
|
|
42
|
+
return;
|
|
43
|
+
const earlier = firstSeen.get(name);
|
|
44
|
+
if (earlier === undefined) {
|
|
45
|
+
firstSeen.set(name, index);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
code: 'custom',
|
|
50
|
+
message: `duplicate entry name "${name}" (already used at index ${earlier}); entries of a collection are addressed by name, so names must be unique`,
|
|
51
|
+
path: [index, 'name'],
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** `project:` — free-form project-identity block (name, description, license, north-star, ...); every field optional. */
|
|
57
|
+
exports.Project = zod_1.z
|
|
58
|
+
.object({
|
|
59
|
+
name: zod_1.z.string().optional(),
|
|
60
|
+
description: zod_1.z.string().optional(),
|
|
61
|
+
license: zod_1.z.string().optional(),
|
|
62
|
+
repository: zod_1.z.string().optional(),
|
|
63
|
+
methodology: zod_1.z.string().optional(),
|
|
64
|
+
north_star: zod_1.z.string().optional(),
|
|
65
|
+
})
|
|
66
|
+
.passthrough();
|
|
67
|
+
/** One `modules[]` entry — a source module (`name`, optional `description`/`path`). */
|
|
68
|
+
exports.Module = zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
name: zod_1.z.string(),
|
|
71
|
+
description: zod_1.z.string().optional(),
|
|
72
|
+
path: zod_1.z.string().optional(),
|
|
73
|
+
})
|
|
74
|
+
.passthrough();
|
|
75
|
+
/** `category` is a free string, not a fixed enum (spec-002) — keeps the schema project-shape-agnostic. */
|
|
76
|
+
exports.TechEntry = zod_1.z
|
|
77
|
+
.object({
|
|
78
|
+
name: zod_1.z.string(),
|
|
79
|
+
category: zod_1.z.string(),
|
|
80
|
+
version: zod_1.z.string().optional(),
|
|
81
|
+
notes: zod_1.z.string().optional(),
|
|
82
|
+
})
|
|
83
|
+
.passthrough();
|
|
84
|
+
/** One `stacks.methodologies[]` entry — a development methodology (`name`, optional `phase`/`notes`). */
|
|
85
|
+
exports.MethodologyEntry = zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
name: zod_1.z.string(),
|
|
88
|
+
phase: zod_1.z.string().optional(),
|
|
89
|
+
notes: zod_1.z.string().optional(),
|
|
90
|
+
})
|
|
91
|
+
.passthrough();
|
|
92
|
+
/** Replaces the old fixed-key `tech_stack` object with two flat, generically-shaped lists. */
|
|
93
|
+
exports.Stacks = zod_1.z
|
|
94
|
+
.object({
|
|
95
|
+
technologies: uniquelyNamed(exports.TechEntry).optional(),
|
|
96
|
+
methodologies: uniquelyNamed(exports.MethodologyEntry).optional(),
|
|
97
|
+
})
|
|
98
|
+
.passthrough();
|
|
99
|
+
/** One `team.members[]` entry — a human contributor and the `roles` they hold (validated against `team.roles`). */
|
|
100
|
+
exports.TeamMember = zod_1.z
|
|
101
|
+
.object({
|
|
102
|
+
name: zod_1.z.string(),
|
|
103
|
+
email: zod_1.z.string().optional(),
|
|
104
|
+
roles: zod_1.z.array(zod_1.z.string()),
|
|
105
|
+
})
|
|
106
|
+
.passthrough();
|
|
107
|
+
/** One `team.agents[]` entry — an AI agent, the roles it `executes_as`, and whether it may hold `approval_authority` (REQ-SEC-03). */
|
|
108
|
+
exports.AgentEntry = zod_1.z
|
|
109
|
+
.object({
|
|
110
|
+
name: zod_1.z.string(),
|
|
111
|
+
executes_as: zod_1.z.array(zod_1.z.string()),
|
|
112
|
+
approval_authority: zod_1.z.boolean().optional(),
|
|
113
|
+
})
|
|
114
|
+
.passthrough();
|
|
115
|
+
/** One `team.roles[]` entry — a role in the canonical role catalogue (REQ-SYS-08). */
|
|
116
|
+
exports.RoleEntry = zod_1.z
|
|
117
|
+
.object({
|
|
118
|
+
name: zod_1.z.string(),
|
|
119
|
+
description: zod_1.z.string().optional(),
|
|
120
|
+
})
|
|
121
|
+
.passthrough();
|
|
122
|
+
/**
|
|
123
|
+
* `team.roles` is the canonical role catalogue (REQ-SYS-08); every role name referenced by
|
|
124
|
+
* `members[].roles` and `agents[].executes_as` is semantically validated against it (spec-002 "Role
|
|
125
|
+
* binding (REQ-SYS-08)"). This is a same-document cross-field rule, so — per spec-009 §1's guidance
|
|
126
|
+
* that such rules "cannot be expressed as a per-field Zod .regex()/.min()" — it runs as a
|
|
127
|
+
* `.superRefine()` here, still inside the Zod schema.
|
|
128
|
+
*/
|
|
129
|
+
exports.Team = zod_1.z
|
|
130
|
+
.object({
|
|
131
|
+
members: uniquelyNamed(exports.TeamMember),
|
|
132
|
+
agents: uniquelyNamed(exports.AgentEntry).optional(),
|
|
133
|
+
roles: uniquelyNamed(exports.RoleEntry),
|
|
134
|
+
})
|
|
135
|
+
.passthrough()
|
|
136
|
+
.superRefine((value, ctx) => {
|
|
137
|
+
const knownRoles = new Set(value.roles.map((role) => role.name));
|
|
138
|
+
value.members.forEach((member, memberIndex) => {
|
|
139
|
+
member.roles.forEach((roleName, roleIndex) => {
|
|
140
|
+
if (!knownRoles.has(roleName)) {
|
|
141
|
+
ctx.addIssue({
|
|
142
|
+
code: 'custom',
|
|
143
|
+
message: `team.members[${memberIndex}].roles references undefined role "${roleName}" (not in team.roles)`,
|
|
144
|
+
path: ['members', memberIndex, 'roles', roleIndex],
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
(value.agents ?? []).forEach((agent, agentIndex) => {
|
|
150
|
+
agent.executes_as.forEach((roleName, roleIndex) => {
|
|
151
|
+
if (!knownRoles.has(roleName)) {
|
|
152
|
+
ctx.addIssue({
|
|
153
|
+
code: 'custom',
|
|
154
|
+
message: `team.agents[${agentIndex}].executes_as references undefined role "${roleName}" (not in team.roles)`,
|
|
155
|
+
path: ['agents', agentIndex, 'executes_as', roleIndex],
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
/** Category names are fixed per P2.5, but `.passthrough()` tolerates a future extra category. */
|
|
162
|
+
exports.Paths = zod_1.z
|
|
163
|
+
.object({
|
|
164
|
+
sources: zod_1.z.array(zod_1.z.string()).optional(),
|
|
165
|
+
tests: zod_1.z.array(zod_1.z.string()).optional(),
|
|
166
|
+
docs: zod_1.z.array(zod_1.z.string()).optional(),
|
|
167
|
+
config: zod_1.z.array(zod_1.z.string()).optional(),
|
|
168
|
+
governance: zod_1.z.array(zod_1.z.string()).optional(),
|
|
169
|
+
})
|
|
170
|
+
.passthrough();
|
|
171
|
+
/** The whole `.wingfoil/dna.yaml` document (P2.4, spec-002) — the Project DNA structural map's root schema. */
|
|
172
|
+
exports.DnaYaml = zod_1.z
|
|
173
|
+
.object({
|
|
174
|
+
version: zod_1.z.number().positive(),
|
|
175
|
+
project: exports.Project.optional(),
|
|
176
|
+
modules: uniquelyNamed(exports.Module),
|
|
177
|
+
stacks: exports.Stacks,
|
|
178
|
+
team: exports.Team,
|
|
179
|
+
paths: exports.Paths,
|
|
180
|
+
})
|
|
181
|
+
.passthrough();
|
|
182
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/dna/schema.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,6BAAwB;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAS,aAAa,CAAsB,KAAQ;IAClD,OAAO,OAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAI,IAAkC,EAAE,IAAI,CAAC;YACvD,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO;YACrC,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC3B,OAAO;YACT,CAAC;YACD,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yBAAyB,IAAI,4BAA4B,OAAO,2EAA2E;gBACpJ,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;aACtB,CAAC,CAAC;QACL,C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AAE,SAAS,CAAC;iBACvD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAGL,iGAAiG;AACpF,QAAA,KAAK,GAAG,OAAC;KACnB,MAAM,CAAC;IACN,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,WAAW,EAAE,CAAC;AAGjB,+GAA+G;AAClG,QAAA,OAAO,GAAG,OAAC;KACrB,MAAM,CAAC;IACN,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,OAAO,EAAE,eAAO,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,aAAa,CAAC,cAAM,CAAC;IAC9B,MAAM,EAAE,cAAM;IACd,IAAI,EAAE,YAAI;IACV,KAAK,EAAE,aAAK;CACb,CAAC;KACD,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first-segment alias `dna show` resolves: `tech_stack` -> `stacks`, the BDD-compatibility alias
|
|
3
|
+
* spec-002-dna-yaml-schema's Consequences describe (the schema renamed the BDD's `tech_stack` wording
|
|
4
|
+
* to `stacks`), so `dna show tech_stack` still reads the `stacks` subtree.
|
|
5
|
+
*
|
|
6
|
+
* **READ side only, since task-093** (`bug-084-dna-key-alias-writes-unschemad-keys`). It used to be
|
|
7
|
+
* applied on the write path too, and there it was a trap: `stacks` replaced a fixed-key `tech_stack`
|
|
8
|
+
* OBJECT, which is a change of shape rather than of name, so rewriting only the first segment
|
|
9
|
+
* produced a path that resolves nowhere — `dna set tech_stack.cli.framework Commander` wrote
|
|
10
|
+
* `stacks.cli.framework`, a key no schema declares, through `Stacks`'s `.passthrough()`, at exit 0.
|
|
11
|
+
* spec-002 says plainly that "any consumer that read `tech_stack.<key>` must now scan" the lists, and
|
|
12
|
+
* a first-segment alias cannot honour that sentence. The write path therefore does not alias at all;
|
|
13
|
+
* an old-shape path is refused as the unknown key it is (`src/dna/path.ts`, exit 1).
|
|
14
|
+
*/
|
|
15
|
+
export declare const DNA_KEY_ALIASES: Readonly<Record<string, string>>;
|
|
16
|
+
/** The segments of a dotted DNA path, or the refusal message the caller reports (`splitDnaPath`). */
|
|
17
|
+
export type DnaPathSplit = {
|
|
18
|
+
readonly ok: true;
|
|
19
|
+
readonly segments: readonly string[];
|
|
20
|
+
} | {
|
|
21
|
+
readonly ok: false;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Parse a dotted DNA key path into its segments — the ONE place a path is split, shared by
|
|
26
|
+
* {@link isValidKeyPath}, {@link setDnaValueInText}'s text resolver and `resolveDnaPath`
|
|
27
|
+
* (`./path.ts`). It replaced three copies of `keyPath.split('.')`, which is why the quoting rule
|
|
28
|
+
* below has one definition rather than three chances to disagree.
|
|
29
|
+
*
|
|
30
|
+
* **The grammar** (`dl-083-dotted-entry-names-in-paths`, ratified; it exists because
|
|
31
|
+
* `dl-081-dna-mutation-surface-shape` made an entry's `name` the key it is addressed by, and
|
|
32
|
+
* `stacks.technologies` really does carry entries named `Node.js` and `Commander.js`):
|
|
33
|
+
*
|
|
34
|
+
* - a segment that **begins** with `"` is quoted and ends at the **next** `"`. The quotes are
|
|
35
|
+
* delimiters and are not part of the name; between them `.` is an ordinary character, and so is
|
|
36
|
+
* everything else;
|
|
37
|
+
* - the closing `"` must be followed by `.` or by the end of the path;
|
|
38
|
+
* - a segment that does not begin with `"` ends at the next `.`;
|
|
39
|
+
* - quoting is optional where it is unnecessary: `team."members".roberto` and `team.members.roberto`
|
|
40
|
+
* are the same path.
|
|
41
|
+
*
|
|
42
|
+
* **The rule narrows what a path may mean, and for one class of path that is a breaking change.**
|
|
43
|
+
* Before it, `"` was an ordinary character inside a segment; under it every `"` is a delimiter. Two
|
|
44
|
+
* measured consequences, neither hypothetical: `isValidKeyPath('modules.co"re')` was `true` and is
|
|
45
|
+
* now `false`; and where a collection carries an entry named `"a"` beside one named `a` — the schema
|
|
46
|
+
* permits both, `uniquelyNamed` included — `stacks.technologies."a".category` resolved to the
|
|
47
|
+
* quote-named entry before and resolves to the **other** entry now, silently rather than by refusing.
|
|
48
|
+
* `dl-083` accepts the narrowing deliberately (a name containing `"` becomes unaddressable, with no
|
|
49
|
+
* escape sequence), but accepting it is not the same as nothing having changed.
|
|
50
|
+
*
|
|
51
|
+
* At a shell prompt the two quoting layers overlap and are easy to confuse:
|
|
52
|
+
* `wingfoil dna update 'stacks.technologies."Node.js".version' --value 22.14+` has the **shell's**
|
|
53
|
+
* single quotes outside and **WingFoil's** double quotes inside. This function sees only the inner
|
|
54
|
+
* form.
|
|
55
|
+
*
|
|
56
|
+
* **Three refusals, and the distinctions between them are load-bearing:**
|
|
57
|
+
*
|
|
58
|
+
* - an **empty** segment, quoted (`team.""`) or not (`..language`) — `invalid key path: '<path>'`,
|
|
59
|
+
* the message `P2.1-dna-set.feature` scenario 3 pins, unchanged;
|
|
60
|
+
* - an **unterminated** quote — a segment that opens with `"` and never closes. Refused as
|
|
61
|
+
* unterminated rather than taken as a name that happens to begin with a quote, so
|
|
62
|
+
* `dna update 'stacks."Node.js'` reports the typo instead of hunting for an entry named `"Node`;
|
|
63
|
+
* - a `"` **no delimiter can account for**: inside an unquoted segment (`modules.co"re`), or in the
|
|
64
|
+
* remainder of a quoted one (`stacks."say "hi""`). A quoted segment may not contain `"` and there
|
|
65
|
+
* is **no escape sequence** — `dl-083` accepted that cost deliberately rather than overlooking it —
|
|
66
|
+
* so the name being reached for has no spelling at all. The refusal says the **name** is
|
|
67
|
+
* unaddressable, not that the path is malformed, because the path is the only spelling an
|
|
68
|
+
* impossible request has. A quoted segment that merely fails to span its segment (`"Node.js"x`)
|
|
69
|
+
* carries no such `"` and is malformed instead: that is what keeps the unaddressable message true
|
|
70
|
+
* every time it is printed.
|
|
71
|
+
*
|
|
72
|
+
* All three are usage errors (exit 2, `spec-005-cli-command-contract` §1) — properties of how the
|
|
73
|
+
* argument is spelled, decided before anything is read. This is a pure function with no side effects,
|
|
74
|
+
* so the caller owns turning a refusal into that exit code.
|
|
75
|
+
*/
|
|
76
|
+
export declare function splitDnaPath(keyPath: string): DnaPathSplit;
|
|
77
|
+
/**
|
|
78
|
+
* The path spelling of one segment: quoted when its name contains a `.`, bare otherwise. Used wherever
|
|
79
|
+
* a refusal echoes part of a path, so the reported prefix can be pasted back into a command — without
|
|
80
|
+
* it `stacks.technologies.Node.js` would be reported for the entry named `Node.js`, and that re-splits
|
|
81
|
+
* into four segments and names a different node.
|
|
82
|
+
*
|
|
83
|
+
* **It is the inverse of {@link splitDnaPath} on the segments `splitDnaPath` produces — not on every
|
|
84
|
+
* string**, and the difference is worth stating precisely rather than calling it "the inverse".
|
|
85
|
+
* Brute-forced over the alphabet `{a, ., "}` up to five characters (363 names): 62 round-trip
|
|
86
|
+
* unchanged, 294 produce a path `splitDnaPath` refuses, and **7 produce a path that parses back to a
|
|
87
|
+
* different name** — `"a"` contains no `.`, so it is returned bare and re-parses as `a`; `a"."a`
|
|
88
|
+
* becomes `"a"."a"`, which is two segments.
|
|
89
|
+
*
|
|
90
|
+
* All 7 have a `"` in the name, and that is why the gap is unreachable at the one call site
|
|
91
|
+
* (`prefixOf`, `./path.ts`), structurally rather than by luck: `prefixOf` is fed
|
|
92
|
+
* `DnaPathTarget.segments`, which comes from `splitDnaPath`, and a segment it returns can never
|
|
93
|
+
* contain a `"` — a bare segment containing one is refused as unaddressable, and a quoted segment
|
|
94
|
+
* ends at the *first* `"`. Measured over the same 363: **0** parse to a segment containing a quote.
|
|
95
|
+
* So the hardening a general inverse would need is unreachable code, and is deliberately not written;
|
|
96
|
+
* what is written instead is this note and the `"`-free precondition it rests on.
|
|
97
|
+
*/
|
|
98
|
+
export declare function quoteDnaSegment(name: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Whether `keyPath` is a well-formed dotted path — {@link splitDnaPath} reduced to a boolean, so the
|
|
101
|
+
* predicate and the parser cannot disagree about what "well-formed" means. A malformed path (the
|
|
102
|
+
* BDD's `..language`, an empty segment, an unterminated or unaccountable quote) is a usage error
|
|
103
|
+
* (exit 2, spec-005-cli-command-contract §1) the caller rejects before any write; a caller that
|
|
104
|
+
* reports a message uses `splitDnaPath` directly, because only it knows *which* of the three it was.
|
|
105
|
+
*/
|
|
106
|
+
export declare function isValidKeyPath(keyPath: string): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Index within `rest` of the `#` that starts an inline comment, or `-1`. Quote-aware, so a `#`
|
|
109
|
+
* inside a `'single'`- or `"double"`-quoted scalar is not mistaken for a comment; per the YAML spec
|
|
110
|
+
* a comment must also be preceded by whitespace (or start the field).
|
|
111
|
+
*
|
|
112
|
+
* Exported for `./edit.ts`, the sequence-aware editor added by task-093: both write paths must agree
|
|
113
|
+
* on where a line's value ends and its comment begins, and two copies of this scanner would be two
|
|
114
|
+
* chances to disagree.
|
|
115
|
+
*/
|
|
116
|
+
export declare function inlineCommentIndex(rest: string): number;
|
|
117
|
+
/** The value part of a key line's `rest`, with any inline comment and surrounding spaces removed. */
|
|
118
|
+
export declare function valueOf(rest: string): string;
|
|
119
|
+
/**
|
|
120
|
+
* Set the (alias-resolved) dotted `keyPath` to `value` inside the RAW TEXT of a `dna.yaml`, editing
|
|
121
|
+
* as few bytes as possible: one line rewritten, or one line inserted. Everything else — every
|
|
122
|
+
* comment, including the inline `[SPEC]`/`[AUTHORING]` field-provenance annotations, and every blank
|
|
123
|
+
* line, quote style and alignment — is returned byte-for-byte unchanged.
|
|
124
|
+
*
|
|
125
|
+
* This is `dna set`'s primary write path (bug-004): re-serializing the parsed object through
|
|
126
|
+
* `dump()` is correct but discards every comment token, which silently voids the field-provenance
|
|
127
|
+
* convention — a `[SPEC]` field may only be removed or renamed after changing the specification it
|
|
128
|
+
* cites, and that cannot be audited once the annotations are gone. A textual edit also needs no
|
|
129
|
+
* comment-preserving YAML library, keeping `dl-010-minimal-dependencies` intact.
|
|
130
|
+
*
|
|
131
|
+
* Returns `undefined` — deliberately, not as an error — whenever a provably-minimal edit does not
|
|
132
|
+
* exist, leaving the caller to fall back to the whole-file `dump()`:
|
|
133
|
+
* - `text` is not a single, valid YAML document;
|
|
134
|
+
* - the key path is malformed (the caller has already raised the exit-2 usage error for it);
|
|
135
|
+
* - the value's own YAML form is multi-line;
|
|
136
|
+
* - the target, or an ancestor of it, is a block/multi-line scalar, opens a nested block, or holds
|
|
137
|
+
* an inline scalar the path would have to descend through;
|
|
138
|
+
* - the parent block is a sequence rather than a mapping;
|
|
139
|
+
* - the edited text does not read back with the target key holding exactly the intended scalar.
|
|
140
|
+
*
|
|
141
|
+
* The result is a pure function of `(text, keyPath, value)` — no wall-clock, randomness or unordered
|
|
142
|
+
* iteration anywhere on the path (REQ-SYS-07).
|
|
143
|
+
*/
|
|
144
|
+
export declare function setDnaValueInText(text: string, keyPath: string, value: string): string | undefined;
|
|
145
|
+
//# sourceMappingURL=set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/dna/set.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAA4B,CAAC;AAE1F,qGAAqG;AACrG,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAkC1D;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAevD;AAED,qGAAqG;AACrG,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAoKD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA2BlG"}
|