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
package/dist/dna/path.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DNA_ENTRY_OPTION_PREFIX = void 0;
|
|
4
|
+
exports.dnaEntryOptionName = dnaEntryOptionName;
|
|
5
|
+
exports.dnaEntryFieldOfOption = dnaEntryFieldOfOption;
|
|
6
|
+
exports.resolveDnaPath = resolveDnaPath;
|
|
7
|
+
exports.dnaCollectionPaths = dnaCollectionPaths;
|
|
8
|
+
exports.dnaEntryOptionNames = dnaEntryOptionNames;
|
|
9
|
+
const schema_1 = require("./schema");
|
|
10
|
+
const set_1 = require("./set");
|
|
11
|
+
/**
|
|
12
|
+
* The prefix every schema-derived entry-field option carries: `--entry-<field>`, spelled with the
|
|
13
|
+
* schema's own field name (`--entry-executes_as`, not `--entry-executes-as`).
|
|
14
|
+
*
|
|
15
|
+
* It exists because the option set is **derived** — `dnaEntryOptionNames()` reads `spec-002`'s entry
|
|
16
|
+
* schemas — while the global flags are **declared** (`spec-008` §2), and the two namespaces had no
|
|
17
|
+
* reason to stay disjoint. They did not: `TechEntry` declares `version`, so
|
|
18
|
+
* `dna add stacks.technologies --value Zod --category validation --version 4.0` reached Commander's
|
|
19
|
+
* program-level `-V, --version`, printed the CLI version, exited `0` and wrote nothing, while
|
|
20
|
+
* `--help` advertised the option as working. Measured on a real `wingfoil init` project.
|
|
21
|
+
*
|
|
22
|
+
* **It is not a `version` problem.** Driving a synthetic Commander tree with one subcommand option per
|
|
23
|
+
* global flag shows three distinct outcomes, two of them silent: `--version` fires the program's own
|
|
24
|
+
* action and exits; `--format` and `--verbose` are swallowed by the program-level option and simply
|
|
25
|
+
* do not appear in the subcommand's parsed options; `--color` and a non-colliding name survive. So
|
|
26
|
+
* the failure mode is "the value vanishes", and any future entry field named after any current or
|
|
27
|
+
* future global flag inherits it.
|
|
28
|
+
*
|
|
29
|
+
* **What an unprefixed spelling therefore does, which is two different things.** A name §2 does not
|
|
30
|
+
* declare (`--category`, `--email`) is refused by Commander as an unknown option, exit `1`. A name §2
|
|
31
|
+
* DOES declare — today exactly one, `version`, which is the whole overlap between the derived set and
|
|
32
|
+
* the global set — is consumed by the global instead and is never reported: that is the silent no-op
|
|
33
|
+
* above. `spec-008` §9's option row states both halves, because stating only the first is a claim
|
|
34
|
+
* that is false for the very field the section uses as its example.
|
|
35
|
+
*
|
|
36
|
+
* **Why a prefix rather than refusing to register a shadowing name.** Refusal trades a silent failure
|
|
37
|
+
* for a loud hole: `version` is a field `spec-002` declares on `TechEntry`, so refusing it would make
|
|
38
|
+
* a schema-declared field permanently unwritable, and `dl-081` ratified a surface that reaches every
|
|
39
|
+
* collection. Refusal is also unstable in the wrong direction — the global set can grow (`spec-008`
|
|
40
|
+
* §2 is amendable), and a new global flag would then retroactively disable an entry field that had
|
|
41
|
+
* been writable, breaking scripts with no code change nearby. A prefix removes the collision **by
|
|
42
|
+
* construction**, for every present and future name on both sides, and it is uniform rather than
|
|
43
|
+
* conditional: a rule that prefixed only the colliding names would make an option's spelling depend
|
|
44
|
+
* on a table declared elsewhere, so adding a global flag later would silently RENAME an existing
|
|
45
|
+
* option. `test/cli/derived-option-namespace.test.ts` holds the invariant that keeps this true,
|
|
46
|
+
* derived from the built program rather than from a hand-listed copy of `spec-008` §2.
|
|
47
|
+
*/
|
|
48
|
+
exports.DNA_ENTRY_OPTION_PREFIX = 'entry-';
|
|
49
|
+
/** The CLI/MCP option name carrying one entry field — the single place the prefix is applied. */
|
|
50
|
+
function dnaEntryOptionName(field) {
|
|
51
|
+
return `${exports.DNA_ENTRY_OPTION_PREFIX}${field}`;
|
|
52
|
+
}
|
|
53
|
+
/** The entry field an option name carries, or `undefined` when it is not an entry-field option. */
|
|
54
|
+
function dnaEntryFieldOfOption(option) {
|
|
55
|
+
return option.startsWith(exports.DNA_ENTRY_OPTION_PREFIX) ? option.slice(exports.DNA_ENTRY_OPTION_PREFIX.length) : undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Strip the wrappers that do not change addressing (`.optional()`, `.nullable()`, `.default()`). */
|
|
58
|
+
function unwrap(node) {
|
|
59
|
+
let current = node;
|
|
60
|
+
while ((current.def.type === 'optional' || current.def.type === 'nullable' || current.def.type === 'default') &&
|
|
61
|
+
current.def.innerType !== undefined) {
|
|
62
|
+
current = current.def.innerType;
|
|
63
|
+
}
|
|
64
|
+
return current;
|
|
65
|
+
}
|
|
66
|
+
/** Whether the schema makes this node omittable — the only thing that decides if `remove` may drop it. */
|
|
67
|
+
function isOptional(node) {
|
|
68
|
+
return node.def.type === 'optional' || node.def.type === 'default' || node.def.type === 'nullable';
|
|
69
|
+
}
|
|
70
|
+
/** How a leaf's value is shaped, for coercing a `--entry-<field>` option string into it. */
|
|
71
|
+
function fieldKind(node) {
|
|
72
|
+
const inner = unwrap(node);
|
|
73
|
+
if (inner.def.type === 'string')
|
|
74
|
+
return 'string';
|
|
75
|
+
if (inner.def.type === 'number')
|
|
76
|
+
return 'number';
|
|
77
|
+
if (inner.def.type === 'boolean')
|
|
78
|
+
return 'boolean';
|
|
79
|
+
if (inner.def.type === 'array' && inner.def.element !== undefined && unwrap(inner.def.element).def.type === 'string') {
|
|
80
|
+
return 'string-list';
|
|
81
|
+
}
|
|
82
|
+
return 'other';
|
|
83
|
+
}
|
|
84
|
+
/** The fields one collection's entry object declares, in schema order (deterministic — REQ-SYS-07). */
|
|
85
|
+
function entryFieldsOf(entrySchema) {
|
|
86
|
+
const shape = unwrap(entrySchema).def.shape ?? {};
|
|
87
|
+
return Object.keys(shape).map((name) => {
|
|
88
|
+
const field = shape[name];
|
|
89
|
+
return { name, kind: fieldKind(field), required: !isOptional(field) };
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** The node kind a schema node resolves to when a path ends on it. */
|
|
93
|
+
function kindOf(node) {
|
|
94
|
+
const inner = unwrap(node);
|
|
95
|
+
if (inner.def.type === 'object')
|
|
96
|
+
return 'section';
|
|
97
|
+
if (inner.def.type === 'array') {
|
|
98
|
+
const element = inner.def.element === undefined ? undefined : unwrap(inner.def.element);
|
|
99
|
+
if (element?.def.type === 'object')
|
|
100
|
+
return 'collection';
|
|
101
|
+
if (element?.def.type === 'string')
|
|
102
|
+
return 'string-list';
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
if (inner.def.type === 'string' || inner.def.type === 'number' || inner.def.type === 'boolean')
|
|
106
|
+
return 'scalar';
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `a.b.c` for the first `depth` segments — how a refusal names the part of the path that did resolve.
|
|
111
|
+
*
|
|
112
|
+
* A segment whose name contains a `.` is re-quoted (`quoteDnaSegment`, task-099/`dl-083`), so the
|
|
113
|
+
* reported prefix is a path that re-parses to the node it names: `stacks.technologies."Node.js"`,
|
|
114
|
+
* never `stacks.technologies.Node.js`, which would re-split into four segments and name something
|
|
115
|
+
* else.
|
|
116
|
+
*
|
|
117
|
+
* The round trip holds here because `segments` came out of `splitDnaPath` and therefore carries no
|
|
118
|
+
* `"`: `quoteDnaSegment` is the inverse on exactly those names, not on every string — its own note
|
|
119
|
+
* measures where it stops being one, and why that gap cannot be reached from here.
|
|
120
|
+
*/
|
|
121
|
+
function prefixOf(segments, depth) {
|
|
122
|
+
return segments.slice(0, depth).map(set_1.quoteDnaSegment).join('.');
|
|
123
|
+
}
|
|
124
|
+
/** The refusal a segment the schema does not declare produces: it names the whole path AND the segment. */
|
|
125
|
+
function unknownField(path, segments, depth) {
|
|
126
|
+
const where = depth === 0 ? 'the dna.yaml schema' : `'${prefixOf(segments, depth)}'`;
|
|
127
|
+
return { ok: false, message: `unknown DNA field '${path}': '${segments[depth]}' is not declared under ${where}` };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Resolve `keyPath` against `DnaYaml` and `dna`, reporting what a verb may do at the end of it.
|
|
131
|
+
*
|
|
132
|
+
* Every refusal names the **full** path (so an error message is greppable against the invocation) and
|
|
133
|
+
* the part of it that failed. The four refusal families:
|
|
134
|
+
*
|
|
135
|
+
* - a segment the schema does not declare — `bug-084`, the reason this module exists;
|
|
136
|
+
* - a path that tries to descend through a value or through a list of values;
|
|
137
|
+
* - an index where an entry `name` is expected (`dl-081`: indices are not the addressing form);
|
|
138
|
+
* - an entry `name` the collection does not carry, or carries more than once. The second is
|
|
139
|
+
* unreachable through any CLI/MCP path once `DnaYaml`'s per-collection uniqueness refinement is in
|
|
140
|
+
* force (a duplicate-bearing document no longer loads), and is kept because this function is a pure
|
|
141
|
+
* helper that can be handed any object — including, in a test, one that never went through the
|
|
142
|
+
* loader.
|
|
143
|
+
*
|
|
144
|
+
* A **declared but absent** node is not a refusal: it resolves with `exists: false`, which is what lets
|
|
145
|
+
* `dna set project.license --value MIT` fill an optional section the document happens to omit. That is the
|
|
146
|
+
* precise line `bug-084` draws — creating a node the schema declares is legitimate; inventing one it
|
|
147
|
+
* does not declare is the defect.
|
|
148
|
+
*
|
|
149
|
+
* `schemaRoot` defaults to `DnaYaml` — the only schema any caller passes — and is a parameter because
|
|
150
|
+
* the traversal is a function of *a* schema and a document, not of this one: it keeps the
|
|
151
|
+
* "addressable shape" rules (which node kinds a path may end on, which it may descend through)
|
|
152
|
+
* testable against shapes `spec-002` does not declare today, rather than leaving them as assertions
|
|
153
|
+
* nothing exercises.
|
|
154
|
+
*/
|
|
155
|
+
function resolveDnaPath(dna, keyPath, schemaRoot = schema_1.DnaYaml) {
|
|
156
|
+
const split = (0, set_1.splitDnaPath)(keyPath);
|
|
157
|
+
if (!split.ok) {
|
|
158
|
+
return { ok: false, message: split.message };
|
|
159
|
+
}
|
|
160
|
+
const segments = split.segments;
|
|
161
|
+
let schema = schemaRoot;
|
|
162
|
+
let value = dna;
|
|
163
|
+
let collectionPath;
|
|
164
|
+
let entryIndex;
|
|
165
|
+
let entryFields;
|
|
166
|
+
for (let depth = 0; depth < segments.length; depth += 1) {
|
|
167
|
+
const segment = segments[depth];
|
|
168
|
+
const node = unwrap(schema);
|
|
169
|
+
if (node.def.type === 'object') {
|
|
170
|
+
const child = node.def.shape?.[segment];
|
|
171
|
+
if (child === undefined)
|
|
172
|
+
return unknownField(keyPath, segments, depth);
|
|
173
|
+
schema = child;
|
|
174
|
+
value = isRecord(value) ? value[segment] : undefined;
|
|
175
|
+
collectionPath = undefined;
|
|
176
|
+
entryIndex = undefined;
|
|
177
|
+
entryFields = undefined;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (node.def.type === 'array' && node.def.element !== undefined) {
|
|
181
|
+
const element = unwrap(node.def.element);
|
|
182
|
+
if (element.def.type !== 'object') {
|
|
183
|
+
return {
|
|
184
|
+
ok: false,
|
|
185
|
+
message: `unknown DNA field '${keyPath}': '${prefixOf(segments, depth)}' is a list of values, with nothing to address below it`,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (/^\d+$/.test(segment)) {
|
|
189
|
+
return {
|
|
190
|
+
ok: false,
|
|
191
|
+
message: `unknown DNA field '${keyPath}': entries of '${prefixOf(segments, depth)}' are addressed by name, not by index`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const entries = Array.isArray(value) ? value : [];
|
|
195
|
+
const matches = entries
|
|
196
|
+
.map((entry, index) => ({ entry, index }))
|
|
197
|
+
.filter(({ entry }) => isRecord(entry) && entry.name === segment);
|
|
198
|
+
if (matches.length === 0) {
|
|
199
|
+
return { ok: false, message: `no entry named '${segment}' in '${prefixOf(segments, depth)}' (path '${keyPath}')` };
|
|
200
|
+
}
|
|
201
|
+
if (matches.length > 1) {
|
|
202
|
+
return {
|
|
203
|
+
ok: false,
|
|
204
|
+
message: `'${prefixOf(segments, depth)}' carries ${matches.length} entries named '${segment}' — the name is ambiguous (path '${keyPath}')`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
collectionPath = prefixOf(segments, depth);
|
|
208
|
+
entryFields = entryFieldsOf(node.def.element);
|
|
209
|
+
entryIndex = matches[0].index;
|
|
210
|
+
schema = node.def.element;
|
|
211
|
+
value = matches[0].entry;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
ok: false,
|
|
216
|
+
message: `unknown DNA field '${keyPath}': '${prefixOf(segments, depth)}' is a value, not a section`,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// The path ended on `schema`/`value`. An entry is the one kind the loop above already established.
|
|
220
|
+
const isEntry = entryIndex !== undefined && collectionPath !== undefined && segments.length > 0;
|
|
221
|
+
const kind = isEntry ? 'entry' : kindOf(schema);
|
|
222
|
+
if (kind === undefined) {
|
|
223
|
+
return { ok: false, message: `unknown DNA field '${keyPath}': it is not a field this schema can address` };
|
|
224
|
+
}
|
|
225
|
+
const base = {
|
|
226
|
+
kind,
|
|
227
|
+
path: keyPath,
|
|
228
|
+
segments,
|
|
229
|
+
value,
|
|
230
|
+
exists: value !== undefined,
|
|
231
|
+
required: !isOptional(schema),
|
|
232
|
+
};
|
|
233
|
+
if (kind === 'entry') {
|
|
234
|
+
return { ok: true, target: { ...base, entryIndex, entryFields, collectionPath } };
|
|
235
|
+
}
|
|
236
|
+
if (kind === 'collection') {
|
|
237
|
+
return { ok: true, target: { ...base, entryFields: entryFieldsOf(unwrap(schema).def.element) } };
|
|
238
|
+
}
|
|
239
|
+
return { ok: true, target: base };
|
|
240
|
+
}
|
|
241
|
+
/** Whether `value` is a plain object we can read a key from (not null, not an array). */
|
|
242
|
+
function isRecord(value) {
|
|
243
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Every collection `DnaYaml` declares, as a dotted path — derived from the schema, in a fixed order
|
|
247
|
+
* (REQ-SYS-07). Used to build the union of `--<entry-field>` options the mutation verbs accept and to
|
|
248
|
+
* document the surface in `--help`; nothing here is hand-listed, so a collection added to `spec-002`
|
|
249
|
+
* becomes addressable without touching this module.
|
|
250
|
+
*/
|
|
251
|
+
function dnaCollectionPaths() {
|
|
252
|
+
const out = [];
|
|
253
|
+
const walk = (node, prefix) => {
|
|
254
|
+
const inner = unwrap(node);
|
|
255
|
+
if (inner.def.type !== 'object' || inner.def.shape === undefined)
|
|
256
|
+
return;
|
|
257
|
+
for (const key of Object.keys(inner.def.shape)) {
|
|
258
|
+
const child = unwrap(inner.def.shape[key]);
|
|
259
|
+
const path = [...prefix, key];
|
|
260
|
+
if (kindOf(child) === 'collection')
|
|
261
|
+
out.push(path.join('.'));
|
|
262
|
+
else if (child.def.type === 'object')
|
|
263
|
+
walk(child, path);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
walk(schema_1.DnaYaml, []);
|
|
267
|
+
return out;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The union of every field name the entries of every collection may carry, minus `name` (which travels
|
|
271
|
+
* in `--value`, per `dl-081`'s `--value`-is-the-identity convention), in a fixed order. This is the
|
|
272
|
+
* `--entry-<field>` option set `dna add`/`dna update` register on both surfaces (see {@link dnaEntryOptionName}).
|
|
273
|
+
*/
|
|
274
|
+
function dnaEntryOptionNames() {
|
|
275
|
+
const seen = new Set();
|
|
276
|
+
const out = [];
|
|
277
|
+
for (const path of dnaCollectionPaths()) {
|
|
278
|
+
const resolved = resolveDnaPath({}, path);
|
|
279
|
+
const fields = resolved.ok ? (resolved.target.entryFields ?? []) : [];
|
|
280
|
+
for (const field of fields) {
|
|
281
|
+
if (field.name === 'name' || seen.has(field.name))
|
|
282
|
+
continue;
|
|
283
|
+
seen.add(field.name);
|
|
284
|
+
out.push(field.name);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return out;
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/dna/path.ts"],"names":[],"mappings":";;;AAoFA,gDAEC;AAGD,sDAEC;AAmKD,wCA2FC;AAaD,gDAcC;AAOD,kDAaC;AA/VD,qCAAmC;AACnC,+BAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACU,QAAA,uBAAuB,GAAG,QAAiB,CAAC;AAEzD,iGAAiG;AACjG,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,GAAG,+BAAuB,GAAG,KAAK,EAAE,CAAC;AAC9C,CAAC;AAED,mGAAmG;AACnG,SAAgB,qBAAqB,CAAC,MAAc;IAClD,OAAO,MAAM,CAAC,UAAU,CAAC,+BAAuB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,+BAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/G,CAAC;AA+DD,qGAAqG;AACrG,SAAS,MAAM,CAAC,IAAgB;IAC9B,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OACE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;QACtG,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,EACnC,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SAAS;YAC5D,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACrB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-based **directive binding** resolver (REQ-SYS-08, task-034-role-based-binding) — the DNA-only
|
|
3
|
+
* primitives directive binding (P3.2/P3.7) and auto-load-by-role (P3.6) build on. Directives bind to
|
|
4
|
+
* roles, never to named persons (ADR-006): every function here reads only the already-parsed
|
|
5
|
+
* `DnaYaml` (`team.roles`/`team.members`/`team.agents`, spec-002-dna-yaml-schema) — never a directive
|
|
6
|
+
* or workflow file — so reassigning a person's role in `dna.yaml` changes the resolved binding with
|
|
7
|
+
* zero edits anywhere else (the REQ-SYS-08 Fit Criterion).
|
|
8
|
+
*
|
|
9
|
+
* **Approval routing is deliberately out of scope here** (`dl-033-canonical-role-resolver`, option b).
|
|
10
|
+
* "Who holds this role?" and "may this principal approve?" are different questions with different
|
|
11
|
+
* answers: AI agents do hold `developer`/`reviewer` via `team.agents[].executes_as` — correct for
|
|
12
|
+
* directive binding — but never hold approval authority (ADR-006, REQ-SEC-03). The canonical answer
|
|
13
|
+
* to the authority question is `src/core/approval-authority.ts` (task-040), which resolves the
|
|
14
|
+
* approver from `team.members` by live git identity and never consults `team.agents` at all. Note
|
|
15
|
+
* that `team.agents[].approval_authority` is **not** what grants or denies authority in code: no code
|
|
16
|
+
* path in this tree reads that field — it is a declarative `dna.yaml` marker, enforced by
|
|
17
|
+
* process/governance (ADR-006, CLAUDE.md §4/§8), as `approval-authority.ts`'s own header states.
|
|
18
|
+
* BDD `p4-workflow/P4.14-approval-routing.feature`'s routing scenarios belong to `task-046-memory-approve`,
|
|
19
|
+
* built on that module. Nothing in this file decides who may approve.
|
|
20
|
+
*
|
|
21
|
+
* No `CORE_MODULES` operation is registered here: this is the pure resolver later tasks (task-051/056
|
|
22
|
+
* `directive assign`/role-based assignment) wire into their own CLI/MCP surfaces.
|
|
23
|
+
*/
|
|
24
|
+
import type { AgentEntry, DnaYaml, TeamMember } from './schema';
|
|
25
|
+
/**
|
|
26
|
+
* Raised when a role name is referenced (e.g. a directive binding or an approval step) but is not
|
|
27
|
+
* registered in `dna.yaml`'s `team.roles` catalogue. Message matches BDD
|
|
28
|
+
* `p5-interaction/P5.4.2-role-directives-binding.feature` "Error - binding references an undefined
|
|
29
|
+
* role" verbatim.
|
|
30
|
+
*/
|
|
31
|
+
export declare class UnknownRoleError extends Error {
|
|
32
|
+
/** The role name that was not found in `team.roles`. */
|
|
33
|
+
readonly role: string;
|
|
34
|
+
constructor(role: string);
|
|
35
|
+
}
|
|
36
|
+
/** Whether `role` is registered in `dna.team.roles` — the sole role catalogue (REQ-SYS-08). */
|
|
37
|
+
export declare function isRoleDefined(dna: DnaYaml, role: string): boolean;
|
|
38
|
+
/** Throws {@link UnknownRoleError} unless `role` is registered in `dna.team.roles`. */
|
|
39
|
+
export declare function assertRoleDefined(dna: DnaYaml, role: string): void;
|
|
40
|
+
/** The team members and agents currently holding a role, as resolved by {@link resolveRoleHolders}. */
|
|
41
|
+
export interface RoleHolders {
|
|
42
|
+
/** `team.members` entries whose `roles` include the resolved role. */
|
|
43
|
+
readonly members: readonly TeamMember[];
|
|
44
|
+
/** `team.agents` entries whose `executes_as` include the resolved role. */
|
|
45
|
+
readonly agents: readonly AgentEntry[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolves who currently holds `role`, reading only `dna.team.members`/`dna.team.agents` — no
|
|
49
|
+
* directive or workflow file. Throws {@link UnknownRoleError} if `role` is not in `team.roles`;
|
|
50
|
+
* returns empty lists (not an error) when the role is defined but nobody currently holds it.
|
|
51
|
+
*
|
|
52
|
+
* Agents are included because they genuinely hold the roles they `executes_as` for **directive
|
|
53
|
+
* binding** purposes (P3.6). This is **not** an authority check: a holder returned here may not
|
|
54
|
+
* approve anything (ADR-006, REQ-SEC-03) — use `src/core/approval-authority.ts` for that.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveRoleHolders(dna: DnaYaml, role: string): RoleHolders;
|
|
57
|
+
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/dna/roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhE;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAOzB;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,uGAAuG;AACvG,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAM1E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownRoleError = void 0;
|
|
4
|
+
exports.isRoleDefined = isRoleDefined;
|
|
5
|
+
exports.assertRoleDefined = assertRoleDefined;
|
|
6
|
+
exports.resolveRoleHolders = resolveRoleHolders;
|
|
7
|
+
/**
|
|
8
|
+
* Raised when a role name is referenced (e.g. a directive binding or an approval step) but is not
|
|
9
|
+
* registered in `dna.yaml`'s `team.roles` catalogue. Message matches BDD
|
|
10
|
+
* `p5-interaction/P5.4.2-role-directives-binding.feature` "Error - binding references an undefined
|
|
11
|
+
* role" verbatim.
|
|
12
|
+
*/
|
|
13
|
+
class UnknownRoleError extends Error {
|
|
14
|
+
/** The role name that was not found in `team.roles`. */
|
|
15
|
+
role;
|
|
16
|
+
constructor(role) {
|
|
17
|
+
super(`unknown role '${role}' (not defined in dna.yaml)`);
|
|
18
|
+
this.name = 'UnknownRoleError';
|
|
19
|
+
this.role = role;
|
|
20
|
+
// Restore the prototype chain so `instanceof UnknownRoleError` holds after transpilation.
|
|
21
|
+
Object.setPrototypeOf(this, UnknownRoleError.prototype);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.UnknownRoleError = UnknownRoleError;
|
|
25
|
+
/** Whether `role` is registered in `dna.team.roles` — the sole role catalogue (REQ-SYS-08). */
|
|
26
|
+
function isRoleDefined(dna, role) {
|
|
27
|
+
return dna.team.roles.some((entry) => entry.name === role);
|
|
28
|
+
}
|
|
29
|
+
/** Throws {@link UnknownRoleError} unless `role` is registered in `dna.team.roles`. */
|
|
30
|
+
function assertRoleDefined(dna, role) {
|
|
31
|
+
if (!isRoleDefined(dna, role))
|
|
32
|
+
throw new UnknownRoleError(role);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolves who currently holds `role`, reading only `dna.team.members`/`dna.team.agents` — no
|
|
36
|
+
* directive or workflow file. Throws {@link UnknownRoleError} if `role` is not in `team.roles`;
|
|
37
|
+
* returns empty lists (not an error) when the role is defined but nobody currently holds it.
|
|
38
|
+
*
|
|
39
|
+
* Agents are included because they genuinely hold the roles they `executes_as` for **directive
|
|
40
|
+
* binding** purposes (P3.6). This is **not** an authority check: a holder returned here may not
|
|
41
|
+
* approve anything (ADR-006, REQ-SEC-03) — use `src/core/approval-authority.ts` for that.
|
|
42
|
+
*/
|
|
43
|
+
function resolveRoleHolders(dna, role) {
|
|
44
|
+
assertRoleDefined(dna, role);
|
|
45
|
+
return {
|
|
46
|
+
members: dna.team.members.filter((member) => member.roles.includes(role)),
|
|
47
|
+
agents: (dna.team.agents ?? []).filter((agent) => agent.executes_as.includes(role)),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/dna/roles.ts"],"names":[],"mappings":";;;AA6CA,sCAEC;AAGD,8CAEC;AAmBD,gDAMC;AApDD;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACzC,wDAAwD;IAC/C,IAAI,CAAS;IAEtB,YAAY,IAAY;QACtB,KAAK,CAAC,iBAAiB,IAAI,6BAA6B,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,0FAA0F;QAC1F,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAXD,4CAWC;AAED,+FAA+F;AAC/F,SAAgB,aAAa,CAAC,GAAY,EAAE,IAAY;IACtD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,uFAAuF;AACvF,SAAgB,iBAAiB,CAAC,GAAY,EAAE,IAAY;IAC1D,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAUD;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,GAAY,EAAE,IAAY;IAC3D,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzE,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACpF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DnaYaml schema (spec-002-dna-yaml-schema) — the Project DNA structural map (P2.4). This is one of
|
|
3
|
+
* the three independent per-pillar schemas task-004-decoupled-pillars keeps decoupled (REQ-SYS-02):
|
|
4
|
+
* it has no dependency on `memory.yaml`'s or `workflows.yaml`'s schema, and its own validation never
|
|
5
|
+
* inspects any other file.
|
|
6
|
+
*
|
|
7
|
+
* Every object node is `.passthrough()` per spec-009-validation-strategy §2. The TypeScript type is
|
|
8
|
+
* derived exclusively via `z.infer` (spec-002: "no hand-written duplicate interface").
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/** `project:` — free-form project-identity block (name, description, license, north-star, ...); every field optional. */
|
|
12
|
+
export declare const Project: z.ZodObject<{
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
license: z.ZodOptional<z.ZodString>;
|
|
16
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
17
|
+
methodology: z.ZodOptional<z.ZodString>;
|
|
18
|
+
north_star: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$loose>;
|
|
20
|
+
/** Parsed shape of the {@link Project} schema. */
|
|
21
|
+
export type Project = z.infer<typeof Project>;
|
|
22
|
+
/** One `modules[]` entry — a source module (`name`, optional `description`/`path`). */
|
|
23
|
+
export declare const Module: z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
description: z.ZodOptional<z.ZodString>;
|
|
26
|
+
path: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$loose>;
|
|
28
|
+
/** Parsed shape of the {@link Module} schema. */
|
|
29
|
+
export type Module = z.infer<typeof Module>;
|
|
30
|
+
/** `category` is a free string, not a fixed enum (spec-002) — keeps the schema project-shape-agnostic. */
|
|
31
|
+
export declare const TechEntry: z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
category: z.ZodString;
|
|
34
|
+
version: z.ZodOptional<z.ZodString>;
|
|
35
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$loose>;
|
|
37
|
+
export type TechEntry = z.infer<typeof TechEntry>;
|
|
38
|
+
/** One `stacks.methodologies[]` entry — a development methodology (`name`, optional `phase`/`notes`). */
|
|
39
|
+
export declare const MethodologyEntry: z.ZodObject<{
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
phase: z.ZodOptional<z.ZodString>;
|
|
42
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$loose>;
|
|
44
|
+
/** Parsed shape of the {@link MethodologyEntry} schema. */
|
|
45
|
+
export type MethodologyEntry = z.infer<typeof MethodologyEntry>;
|
|
46
|
+
/** Replaces the old fixed-key `tech_stack` object with two flat, generically-shaped lists. */
|
|
47
|
+
export declare const Stacks: z.ZodObject<{
|
|
48
|
+
technologies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
category: z.ZodString;
|
|
51
|
+
version: z.ZodOptional<z.ZodString>;
|
|
52
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$loose>>>;
|
|
54
|
+
methodologies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
phase: z.ZodOptional<z.ZodString>;
|
|
57
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$loose>>>;
|
|
59
|
+
}, z.core.$loose>;
|
|
60
|
+
export type Stacks = z.infer<typeof Stacks>;
|
|
61
|
+
/** One `team.members[]` entry — a human contributor and the `roles` they hold (validated against `team.roles`). */
|
|
62
|
+
export declare const TeamMember: z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
email: z.ZodOptional<z.ZodString>;
|
|
65
|
+
roles: z.ZodArray<z.ZodString>;
|
|
66
|
+
}, z.core.$loose>;
|
|
67
|
+
/** Parsed shape of the {@link TeamMember} schema. */
|
|
68
|
+
export type TeamMember = z.infer<typeof TeamMember>;
|
|
69
|
+
/** One `team.agents[]` entry — an AI agent, the roles it `executes_as`, and whether it may hold `approval_authority` (REQ-SEC-03). */
|
|
70
|
+
export declare const AgentEntry: z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
executes_as: z.ZodArray<z.ZodString>;
|
|
73
|
+
approval_authority: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$loose>;
|
|
75
|
+
/** Parsed shape of the {@link AgentEntry} schema. */
|
|
76
|
+
export type AgentEntry = z.infer<typeof AgentEntry>;
|
|
77
|
+
/** One `team.roles[]` entry — a role in the canonical role catalogue (REQ-SYS-08). */
|
|
78
|
+
export declare const RoleEntry: z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
description: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$loose>;
|
|
82
|
+
/** Parsed shape of the {@link RoleEntry} schema. */
|
|
83
|
+
export type RoleEntry = z.infer<typeof RoleEntry>;
|
|
84
|
+
/**
|
|
85
|
+
* `team.roles` is the canonical role catalogue (REQ-SYS-08); every role name referenced by
|
|
86
|
+
* `members[].roles` and `agents[].executes_as` is semantically validated against it (spec-002 "Role
|
|
87
|
+
* binding (REQ-SYS-08)"). This is a same-document cross-field rule, so — per spec-009 §1's guidance
|
|
88
|
+
* that such rules "cannot be expressed as a per-field Zod .regex()/.min()" — it runs as a
|
|
89
|
+
* `.superRefine()` here, still inside the Zod schema.
|
|
90
|
+
*/
|
|
91
|
+
export declare const Team: z.ZodObject<{
|
|
92
|
+
members: z.ZodArray<z.ZodObject<{
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
email: z.ZodOptional<z.ZodString>;
|
|
95
|
+
roles: z.ZodArray<z.ZodString>;
|
|
96
|
+
}, z.core.$loose>>;
|
|
97
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
executes_as: z.ZodArray<z.ZodString>;
|
|
100
|
+
approval_authority: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
}, z.core.$loose>>>;
|
|
102
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
description: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$loose>>;
|
|
106
|
+
}, z.core.$loose>;
|
|
107
|
+
export type Team = z.infer<typeof Team>;
|
|
108
|
+
/** Category names are fixed per P2.5, but `.passthrough()` tolerates a future extra category. */
|
|
109
|
+
export declare const Paths: z.ZodObject<{
|
|
110
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
+
tests: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
|
+
docs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
+
config: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
governance: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
+
}, z.core.$loose>;
|
|
116
|
+
export type Paths = z.infer<typeof Paths>;
|
|
117
|
+
/** The whole `.wingfoil/dna.yaml` document (P2.4, spec-002) — the Project DNA structural map's root schema. */
|
|
118
|
+
export declare const DnaYaml: z.ZodObject<{
|
|
119
|
+
version: z.ZodNumber;
|
|
120
|
+
project: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
name: z.ZodOptional<z.ZodString>;
|
|
122
|
+
description: z.ZodOptional<z.ZodString>;
|
|
123
|
+
license: z.ZodOptional<z.ZodString>;
|
|
124
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
125
|
+
methodology: z.ZodOptional<z.ZodString>;
|
|
126
|
+
north_star: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$loose>>;
|
|
128
|
+
modules: z.ZodArray<z.ZodObject<{
|
|
129
|
+
name: z.ZodString;
|
|
130
|
+
description: z.ZodOptional<z.ZodString>;
|
|
131
|
+
path: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$loose>>;
|
|
133
|
+
stacks: z.ZodObject<{
|
|
134
|
+
technologies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
135
|
+
name: z.ZodString;
|
|
136
|
+
category: z.ZodString;
|
|
137
|
+
version: z.ZodOptional<z.ZodString>;
|
|
138
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$loose>>>;
|
|
140
|
+
methodologies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
phase: z.ZodOptional<z.ZodString>;
|
|
143
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$loose>>>;
|
|
145
|
+
}, z.core.$loose>;
|
|
146
|
+
team: z.ZodObject<{
|
|
147
|
+
members: z.ZodArray<z.ZodObject<{
|
|
148
|
+
name: z.ZodString;
|
|
149
|
+
email: z.ZodOptional<z.ZodString>;
|
|
150
|
+
roles: z.ZodArray<z.ZodString>;
|
|
151
|
+
}, z.core.$loose>>;
|
|
152
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
executes_as: z.ZodArray<z.ZodString>;
|
|
155
|
+
approval_authority: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
}, z.core.$loose>>>;
|
|
157
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
description: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$loose>>;
|
|
161
|
+
}, z.core.$loose>;
|
|
162
|
+
paths: z.ZodObject<{
|
|
163
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
|
+
tests: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
docs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
config: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
governance: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$loose>;
|
|
169
|
+
}, z.core.$loose>;
|
|
170
|
+
/** Parsed shape of the {@link DnaYaml} schema — the type every DNA reader (`loadDnaYaml`, `dna show`) returns. */
|
|
171
|
+
export type DnaYaml = z.infer<typeof DnaYaml>;
|
|
172
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/dna/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4CxB,yHAAyH;AACzH,eAAO,MAAM,OAAO;;;;;;;iBASJ,CAAC;AACjB,kDAAkD;AAClD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,uFAAuF;AACvF,eAAO,MAAM,MAAM;;;;iBAMH,CAAC;AACjB,iDAAiD;AACjD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5C,0GAA0G;AA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