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,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withAssignedDirectives = exports.setRoleAssignmentsInText = exports.parseDirectiveIds = exports.renderCustomDirective = exports.isValidDirectiveName = exports.directiveTitleFromName = exports.INVALID_DIRECTIVE_NAME_MESSAGE = exports.RolesYaml = exports.DirectiveFrontmatter = exports.MODULE_NAME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* `directives` module — Project Directives pillar; role-based rules (built-in + custom) (P3.5/P3.8).
|
|
6
|
+
* `DirectiveFrontmatter` (an [AUTHORING]-level minimal schema — see `./schema` for why there is no
|
|
7
|
+
* dedicated tech-spec yet) lives here — the pillar owns its own independent schema (REQ-SYS-02);
|
|
8
|
+
* `src/core`'s loader wires it through the shared validation pipeline. `./create`
|
|
9
|
+
* (task-050-directive-create, P3.1) adds the pillar's first *authoring* helpers — the kebab-case
|
|
10
|
+
* name rule and the generated file's content — which `src/core`'s `directiveCreate` operation
|
|
11
|
+
* composes with the git-identity pre-flight, write and commit. `./roles-edit`
|
|
12
|
+
* (task-051-directive-assign, P3.2) adds the pure, comment-preserving `roles.yaml` assignment edit that
|
|
13
|
+
* `src/core`'s `directiveAssign` writes through, and `parseDirectiveIds`
|
|
14
|
+
* (task-056-role-based-directive-assignment, P3.7) the comma-separated `--directive` value parser that
|
|
15
|
+
* makes the same verb bind several directives at once. `directive remove` (P3.3, task-052) reuses none
|
|
16
|
+
* of it — it refuses a still-assigned directive rather than unbinding it. Further Directives behavior
|
|
17
|
+
* lands in later tasks.
|
|
18
|
+
*/
|
|
19
|
+
exports.MODULE_NAME = 'directives';
|
|
20
|
+
var schema_1 = require("./schema");
|
|
21
|
+
Object.defineProperty(exports, "DirectiveFrontmatter", { enumerable: true, get: function () { return schema_1.DirectiveFrontmatter; } });
|
|
22
|
+
Object.defineProperty(exports, "RolesYaml", { enumerable: true, get: function () { return schema_1.RolesYaml; } });
|
|
23
|
+
var create_1 = require("./create");
|
|
24
|
+
Object.defineProperty(exports, "INVALID_DIRECTIVE_NAME_MESSAGE", { enumerable: true, get: function () { return create_1.INVALID_DIRECTIVE_NAME_MESSAGE; } });
|
|
25
|
+
Object.defineProperty(exports, "directiveTitleFromName", { enumerable: true, get: function () { return create_1.directiveTitleFromName; } });
|
|
26
|
+
Object.defineProperty(exports, "isValidDirectiveName", { enumerable: true, get: function () { return create_1.isValidDirectiveName; } });
|
|
27
|
+
Object.defineProperty(exports, "renderCustomDirective", { enumerable: true, get: function () { return create_1.renderCustomDirective; } });
|
|
28
|
+
var roles_edit_1 = require("./roles-edit");
|
|
29
|
+
Object.defineProperty(exports, "parseDirectiveIds", { enumerable: true, get: function () { return roles_edit_1.parseDirectiveIds; } });
|
|
30
|
+
Object.defineProperty(exports, "setRoleAssignmentsInText", { enumerable: true, get: function () { return roles_edit_1.setRoleAssignmentsInText; } });
|
|
31
|
+
Object.defineProperty(exports, "withAssignedDirectives", { enumerable: true, get: function () { return roles_edit_1.withAssignedDirectives; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,WAAW,GAAG,YAAqB,CAAC;AAEjD,mCAA2D;AAAlD,8GAAA,oBAAoB,OAAA;AAAE,mGAAA,SAAS,OAAA;AAExC,mCAKkB;AAJhB,wHAAA,8BAA8B,OAAA;AAC9B,gHAAA,sBAAsB,OAAA;AACtB,8GAAA,oBAAoB,OAAA;AACpB,+GAAA,qBAAqB,OAAA;AAGvB,2CAAmG;AAA1F,+GAAA,iBAAiB,OAAA;AAAE,sHAAA,wBAAwB,OAAA;AAAE,oHAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The set semantics of assigning `ids` to a role currently bound to `current`: existing ids keep
|
|
3
|
+
* their order, ids not yet present are appended in argument order, and no id ever appears twice
|
|
4
|
+
* (P3.7 "Binding is idempotent"). No sorting, so an assignment never moves an existing line.
|
|
5
|
+
*
|
|
6
|
+
* @param current - The role's current assignment list (from `roles.yaml`).
|
|
7
|
+
* @param ids - Directive ids to assign.
|
|
8
|
+
* @returns A new array; `current` is not mutated.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withAssignedDirectives(current: readonly string[], ids: readonly string[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Parse the CLI `--directive "a,b,c"` value into the directive ids it names (P3.7, US-4-06,
|
|
13
|
+
* task-056-role-based-directive-assignment): split on commas, trim each segment, drop the empty ones,
|
|
14
|
+
* and de-duplicate keeping each id's FIRST position.
|
|
15
|
+
*
|
|
16
|
+
* The comma-separated spelling follows `memory add --tags "a,b"` (`parseTags`, `src/memory/add.ts`),
|
|
17
|
+
* the project's existing list-valued option: the CLI option seam carries one `string` per `--{name}`
|
|
18
|
+
* (`CliCommand.options` → `ParamsContext.options`), so a list travels inside the value rather than as
|
|
19
|
+
* a repeated flag. A value with no comma yields a one-element list, which is why P3.2's single-id
|
|
20
|
+
* invocation is byte-for-byte unchanged.
|
|
21
|
+
*
|
|
22
|
+
* De-duplication happens here rather than being left to {@link withAssignedDirectives} — which also
|
|
23
|
+
* de-duplicates — because this list is *echoed*: it becomes `DirectiveAssignResult.directives` and the
|
|
24
|
+
* ids named in the commit subject, and `--directive testing,testing` must not produce a subject naming
|
|
25
|
+
* `testing` twice.
|
|
26
|
+
*
|
|
27
|
+
* @param raw - The raw `--directive` value.
|
|
28
|
+
* @returns The ids, in argument order, without duplicates; **empty** when the value contributes none
|
|
29
|
+
* (`""`, `" "`, `","`), which the caller treats as a missing argument rather than as an empty id —
|
|
30
|
+
* `directiveAssignFn`, spec-008 §4.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseDirectiveIds(raw: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Rewrite `assignments.<role>` in the raw `roles.yaml` text to exactly `next`, leaving every other
|
|
35
|
+
* line — comments, blank lines, other roles, `global`, inline comments on kept items — byte-for-byte
|
|
36
|
+
* intact.
|
|
37
|
+
*
|
|
38
|
+
* `next` is realized as the current list with some items deleted (greedy in-order match) followed by
|
|
39
|
+
* appended ids, so it covers assignment (append), removal (delete) and any combination. New item
|
|
40
|
+
* lines adopt the indentation of the role's existing items (else the key's indentation + 2); a role
|
|
41
|
+
* with no `assignments` entry yet (dl-029) gets its key inserted after the block's last content line,
|
|
42
|
+
* before any trailing blank/comment lines. An emptied list becomes `role: []`; an empty flow list
|
|
43
|
+
* `role: []` becomes a block list. CRLF files keep CRLF.
|
|
44
|
+
*
|
|
45
|
+
* @param text - The current `roles.yaml` file content.
|
|
46
|
+
* @param role - The role whose assignment list is rewritten.
|
|
47
|
+
* @param next - The exact list `assignments.<role>` must hold afterwards.
|
|
48
|
+
* @returns The edited text; `text` itself when nothing changes; `undefined` when the edit cannot be
|
|
49
|
+
* made provably — no block `assignments:` mapping, a non-empty flow list, a non-scalar or multi-line
|
|
50
|
+
* item, tab indentation, mixed line endings, or a re-parse that does not read back as intended.
|
|
51
|
+
*/
|
|
52
|
+
export declare function setRoleAssignmentsInText(text: string, role: string, next: readonly string[]): string | undefined;
|
|
53
|
+
//# sourceMappingURL=roles-edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles-edit.d.ts","sourceRoot":"","sources":["../../src/directives/roles-edit.ts"],"names":[],"mappings":"AAsBA;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAMnG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOvD;AAkED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CA4ChH"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withAssignedDirectives = withAssignedDirectives;
|
|
4
|
+
exports.parseDirectiveIds = parseDirectiveIds;
|
|
5
|
+
exports.setRoleAssignmentsInText = setRoleAssignmentsInText;
|
|
6
|
+
/**
|
|
7
|
+
* Pure, comment-preserving edits of `.wingfoil/roles.yaml` role → directive assignments
|
|
8
|
+
* (task-051-directive-assign, P3.2), plus the `--directive a,b,c` value parser multi-directive
|
|
9
|
+
* assignment needs (task-056-role-based-directive-assignment, P3.7).
|
|
10
|
+
*
|
|
11
|
+
* P3.7 reuses {@link withAssignedDirectives} and {@link setRoleAssignmentsInText} unchanged — both
|
|
12
|
+
* were written to take a *list* of ids from the start. `directive remove` (P3.3, task-052) reuses
|
|
13
|
+
* **neither**: P3.3 refuses a still-assigned directive rather than unbinding it, so a removal has no
|
|
14
|
+
* `roles.yaml` write to make (see `src/core/directive-assign.ts`'s module doc).
|
|
15
|
+
*
|
|
16
|
+
* `roles.yaml` is hand-annotated configuration, so a whole-file `js-yaml` `dump()` — which drops every
|
|
17
|
+
* comment — is not an acceptable write path (bug-004 for `dna.yaml`, and bug-019 for the silent
|
|
18
|
+
* fallback). Like `setDnaValueInText` (`src/dna/set.ts`, task-063) this module edits the raw text
|
|
19
|
+
* line by line, touching only the lines of one role's list, and needs no YAML CST dependency
|
|
20
|
+
* (dl-010). Anything it cannot edit provably yields `undefined`, leaving the fallback decision to the
|
|
21
|
+
* caller.
|
|
22
|
+
*
|
|
23
|
+
* Zero imports besides `js-yaml`: no filesystem, no git, no clock (REQ-SYS-07 — outputs are a pure
|
|
24
|
+
* function of the inputs), and no dependency on `src/core` (the pillar stays a leaf).
|
|
25
|
+
*/
|
|
26
|
+
const js_yaml_1 = require("js-yaml");
|
|
27
|
+
/**
|
|
28
|
+
* The set semantics of assigning `ids` to a role currently bound to `current`: existing ids keep
|
|
29
|
+
* their order, ids not yet present are appended in argument order, and no id ever appears twice
|
|
30
|
+
* (P3.7 "Binding is idempotent"). No sorting, so an assignment never moves an existing line.
|
|
31
|
+
*
|
|
32
|
+
* @param current - The role's current assignment list (from `roles.yaml`).
|
|
33
|
+
* @param ids - Directive ids to assign.
|
|
34
|
+
* @returns A new array; `current` is not mutated.
|
|
35
|
+
*/
|
|
36
|
+
function withAssignedDirectives(current, ids) {
|
|
37
|
+
const next = [...current];
|
|
38
|
+
for (const id of ids) {
|
|
39
|
+
if (!next.includes(id))
|
|
40
|
+
next.push(id);
|
|
41
|
+
}
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse the CLI `--directive "a,b,c"` value into the directive ids it names (P3.7, US-4-06,
|
|
46
|
+
* task-056-role-based-directive-assignment): split on commas, trim each segment, drop the empty ones,
|
|
47
|
+
* and de-duplicate keeping each id's FIRST position.
|
|
48
|
+
*
|
|
49
|
+
* The comma-separated spelling follows `memory add --tags "a,b"` (`parseTags`, `src/memory/add.ts`),
|
|
50
|
+
* the project's existing list-valued option: the CLI option seam carries one `string` per `--{name}`
|
|
51
|
+
* (`CliCommand.options` → `ParamsContext.options`), so a list travels inside the value rather than as
|
|
52
|
+
* a repeated flag. A value with no comma yields a one-element list, which is why P3.2's single-id
|
|
53
|
+
* invocation is byte-for-byte unchanged.
|
|
54
|
+
*
|
|
55
|
+
* De-duplication happens here rather than being left to {@link withAssignedDirectives} — which also
|
|
56
|
+
* de-duplicates — because this list is *echoed*: it becomes `DirectiveAssignResult.directives` and the
|
|
57
|
+
* ids named in the commit subject, and `--directive testing,testing` must not produce a subject naming
|
|
58
|
+
* `testing` twice.
|
|
59
|
+
*
|
|
60
|
+
* @param raw - The raw `--directive` value.
|
|
61
|
+
* @returns The ids, in argument order, without duplicates; **empty** when the value contributes none
|
|
62
|
+
* (`""`, `" "`, `","`), which the caller treats as a missing argument rather than as an empty id —
|
|
63
|
+
* `directiveAssignFn`, spec-008 §4.
|
|
64
|
+
*/
|
|
65
|
+
function parseDirectiveIds(raw) {
|
|
66
|
+
const ids = [];
|
|
67
|
+
for (const segment of raw.split(',')) {
|
|
68
|
+
const id = segment.trim();
|
|
69
|
+
if (id.length > 0 && !ids.includes(id))
|
|
70
|
+
ids.push(id);
|
|
71
|
+
}
|
|
72
|
+
return ids;
|
|
73
|
+
}
|
|
74
|
+
const COMMENT_OR_BLANK = /^\s*(#.*)?$/;
|
|
75
|
+
const EMPTY_FLOW_VALUE = /^(\s*.*?):\s*\[\s*\](\s*#.*)?$/;
|
|
76
|
+
const NULL_VALUE = /^(\s*.*?):(\s+#.*)?$/;
|
|
77
|
+
const ITEM = /^-\s+(.*)$/;
|
|
78
|
+
function parseLine(raw) {
|
|
79
|
+
const body = raw.trimStart();
|
|
80
|
+
return { indent: raw.length - body.length, body };
|
|
81
|
+
}
|
|
82
|
+
function isContent(raw) {
|
|
83
|
+
return !COMMENT_OR_BLANK.test(raw);
|
|
84
|
+
}
|
|
85
|
+
/** Parse a YAML fragment, or `undefined` when it is not valid YAML. */
|
|
86
|
+
function tryLoad(text) {
|
|
87
|
+
try {
|
|
88
|
+
return (0, js_yaml_1.load)(text);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Render a scalar exactly as a whole-file `dump` would, or `undefined` when it would span lines. */
|
|
95
|
+
function renderScalar(value) {
|
|
96
|
+
const rendered = (0, js_yaml_1.dump)(value, { lineWidth: -1 }).replace(/\n$/, '');
|
|
97
|
+
return rendered.includes('\n') ? undefined : rendered;
|
|
98
|
+
}
|
|
99
|
+
/** The single key and value of a `key: value` mapping line, or `undefined` when it is not one. */
|
|
100
|
+
function mappingEntry(body) {
|
|
101
|
+
const parsed = tryLoad(body);
|
|
102
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
103
|
+
return undefined;
|
|
104
|
+
const keys = Object.keys(parsed);
|
|
105
|
+
if (keys.length !== 1)
|
|
106
|
+
return undefined;
|
|
107
|
+
return { key: keys[0], value: parsed[keys[0]] };
|
|
108
|
+
}
|
|
109
|
+
function sameJson(a, b) {
|
|
110
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Read `edited` back and confirm `assignments.<role>` is exactly `next` while every other top-level
|
|
114
|
+
* key and every other role is unchanged — the safety net behind the textual edit (it catches, e.g., a
|
|
115
|
+
* YAML alias elsewhere in the file that would silently change along with the edited list).
|
|
116
|
+
*/
|
|
117
|
+
function readsBackAs(original, edited, role, next) {
|
|
118
|
+
const before = tryLoad(original);
|
|
119
|
+
const after = tryLoad(edited);
|
|
120
|
+
if (!before || !after)
|
|
121
|
+
return false;
|
|
122
|
+
const beforeAssignments = { ...before.assignments };
|
|
123
|
+
const afterAssignments = { ...after.assignments };
|
|
124
|
+
const roleMatches = sameJson(afterAssignments[role], next);
|
|
125
|
+
delete beforeAssignments[role];
|
|
126
|
+
delete afterAssignments[role];
|
|
127
|
+
return roleMatches && sameJson({ ...before, assignments: beforeAssignments }, { ...after, assignments: afterAssignments });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Rewrite `assignments.<role>` in the raw `roles.yaml` text to exactly `next`, leaving every other
|
|
131
|
+
* line — comments, blank lines, other roles, `global`, inline comments on kept items — byte-for-byte
|
|
132
|
+
* intact.
|
|
133
|
+
*
|
|
134
|
+
* `next` is realized as the current list with some items deleted (greedy in-order match) followed by
|
|
135
|
+
* appended ids, so it covers assignment (append), removal (delete) and any combination. New item
|
|
136
|
+
* lines adopt the indentation of the role's existing items (else the key's indentation + 2); a role
|
|
137
|
+
* with no `assignments` entry yet (dl-029) gets its key inserted after the block's last content line,
|
|
138
|
+
* before any trailing blank/comment lines. An emptied list becomes `role: []`; an empty flow list
|
|
139
|
+
* `role: []` becomes a block list. CRLF files keep CRLF.
|
|
140
|
+
*
|
|
141
|
+
* @param text - The current `roles.yaml` file content.
|
|
142
|
+
* @param role - The role whose assignment list is rewritten.
|
|
143
|
+
* @param next - The exact list `assignments.<role>` must hold afterwards.
|
|
144
|
+
* @returns The edited text; `text` itself when nothing changes; `undefined` when the edit cannot be
|
|
145
|
+
* made provably — no block `assignments:` mapping, a non-empty flow list, a non-scalar or multi-line
|
|
146
|
+
* item, tab indentation, mixed line endings, or a re-parse that does not read back as intended.
|
|
147
|
+
*/
|
|
148
|
+
function setRoleAssignmentsInText(text, role, next) {
|
|
149
|
+
const crlf = text.includes('\r\n');
|
|
150
|
+
if (crlf && text.replace(/\r\n/g, '').includes('\n'))
|
|
151
|
+
return undefined;
|
|
152
|
+
if (!crlf && text.includes('\r'))
|
|
153
|
+
return undefined;
|
|
154
|
+
const eol = crlf ? '\r\n' : '\n';
|
|
155
|
+
const lines = text.split(eol);
|
|
156
|
+
if (lines.some((raw) => /^\s*\t/.test(raw)))
|
|
157
|
+
return undefined;
|
|
158
|
+
const header = lines.findIndex((raw) => /^assignments:(\s+#.*)?$/.test(raw));
|
|
159
|
+
if (header < 0)
|
|
160
|
+
return undefined;
|
|
161
|
+
// The block runs until the next top-level content line; its insertion point is after its last
|
|
162
|
+
// content line, so trailing blank/comment lines stay attached to whatever follows.
|
|
163
|
+
let end = header + 1;
|
|
164
|
+
let lastContent = header;
|
|
165
|
+
while (end < lines.length) {
|
|
166
|
+
const raw = lines[end];
|
|
167
|
+
if (isContent(raw)) {
|
|
168
|
+
if (parseLine(raw).indent === 0)
|
|
169
|
+
break;
|
|
170
|
+
lastContent = end;
|
|
171
|
+
}
|
|
172
|
+
end += 1;
|
|
173
|
+
}
|
|
174
|
+
const firstChild = lines.slice(header + 1, lastContent + 1).find(isContent);
|
|
175
|
+
const childIndent = firstChild === undefined ? 2 : parseLine(firstChild).indent;
|
|
176
|
+
let keyIndex = -1;
|
|
177
|
+
for (let i = header + 1; i <= lastContent; i += 1) {
|
|
178
|
+
const raw = lines[i];
|
|
179
|
+
const line = parseLine(raw);
|
|
180
|
+
if (!isContent(raw) || line.indent !== childIndent || line.body.startsWith('-'))
|
|
181
|
+
continue;
|
|
182
|
+
const entry = mappingEntry(line.body);
|
|
183
|
+
if (entry === undefined)
|
|
184
|
+
return undefined;
|
|
185
|
+
if (entry.key === role)
|
|
186
|
+
keyIndex = i;
|
|
187
|
+
}
|
|
188
|
+
const edited = keyIndex < 0
|
|
189
|
+
? insertRole(lines, header, lastContent, childIndent, role, next)
|
|
190
|
+
: rewriteRole(lines, keyIndex, childIndent, lastContent, next);
|
|
191
|
+
if (edited === undefined)
|
|
192
|
+
return undefined;
|
|
193
|
+
const result = edited.join(eol);
|
|
194
|
+
if (result === text)
|
|
195
|
+
return text;
|
|
196
|
+
return readsBackAs(text, result, role, next) ? result : undefined;
|
|
197
|
+
}
|
|
198
|
+
function insertRole(lines, header, lastContent, childIndent, role, next) {
|
|
199
|
+
if (next.length === 0)
|
|
200
|
+
return [...lines];
|
|
201
|
+
const key = renderScalar(role);
|
|
202
|
+
const items = next.map(renderScalar);
|
|
203
|
+
if (key === undefined || items.some((item) => item === undefined))
|
|
204
|
+
return undefined;
|
|
205
|
+
// Reuse the item indentation of an existing sibling list, so the new key matches its neighbours.
|
|
206
|
+
const siblingItem = lines
|
|
207
|
+
.slice(header + 1, lastContent + 1)
|
|
208
|
+
.map(parseLine)
|
|
209
|
+
.reverse()
|
|
210
|
+
.find((line) => line.body.startsWith('- '));
|
|
211
|
+
const itemIndent = siblingItem ? siblingItem.indent : childIndent + 2;
|
|
212
|
+
const inserted = [
|
|
213
|
+
`${' '.repeat(childIndent)}${key}:`,
|
|
214
|
+
...items.map((item) => `${' '.repeat(itemIndent)}- ${item}`),
|
|
215
|
+
];
|
|
216
|
+
return [...lines.slice(0, lastContent + 1), ...inserted, ...lines.slice(lastContent + 1)];
|
|
217
|
+
}
|
|
218
|
+
function rewriteRole(lines, keyIndex, childIndent, lastContent, next) {
|
|
219
|
+
const keyLine = lines[keyIndex];
|
|
220
|
+
const entry = mappingEntry(parseLine(keyLine).body);
|
|
221
|
+
const isEmptyFlow = Array.isArray(entry?.value) && (entry?.value).length === 0;
|
|
222
|
+
if (!isEmptyFlow && entry?.value !== null)
|
|
223
|
+
return undefined;
|
|
224
|
+
// Collect the role's item lines (and interleaved comments) up to the next sibling key.
|
|
225
|
+
const itemIndices = [];
|
|
226
|
+
const current = [];
|
|
227
|
+
let i = keyIndex + 1;
|
|
228
|
+
for (; i <= lastContent; i += 1) {
|
|
229
|
+
const raw = lines[i];
|
|
230
|
+
if (!isContent(raw))
|
|
231
|
+
continue;
|
|
232
|
+
const line = parseLine(raw);
|
|
233
|
+
if (line.indent < childIndent || (line.indent === childIndent && !line.body.startsWith('-')))
|
|
234
|
+
break;
|
|
235
|
+
const item = ITEM.exec(line.body);
|
|
236
|
+
if (isEmptyFlow || item === null)
|
|
237
|
+
return undefined;
|
|
238
|
+
const value = tryLoad(item[1]);
|
|
239
|
+
if (typeof value !== 'string')
|
|
240
|
+
return undefined;
|
|
241
|
+
itemIndices.push(i);
|
|
242
|
+
current.push(value);
|
|
243
|
+
}
|
|
244
|
+
// Greedy in-order match: keep the current items `next` still wants, in order; delete the rest;
|
|
245
|
+
// append whatever of `next` is left.
|
|
246
|
+
const deleted = new Set();
|
|
247
|
+
let matched = 0;
|
|
248
|
+
current.forEach((id, index) => {
|
|
249
|
+
if (matched < next.length && next[matched] === id)
|
|
250
|
+
matched += 1;
|
|
251
|
+
else
|
|
252
|
+
deleted.add(itemIndices[index]);
|
|
253
|
+
});
|
|
254
|
+
const appended = next.slice(matched).map(renderScalar);
|
|
255
|
+
if (appended.some((item) => item === undefined))
|
|
256
|
+
return undefined;
|
|
257
|
+
const firstItem = itemIndices[0];
|
|
258
|
+
const itemIndent = firstItem === undefined ? childIndent + 2 : parseLine(lines[firstItem]).indent;
|
|
259
|
+
const appendAfter = itemIndices.length > 0 ? itemIndices[itemIndices.length - 1] : keyIndex;
|
|
260
|
+
const newItems = appended.map((item) => `${' '.repeat(itemIndent)}- ${item}`);
|
|
261
|
+
const out = [];
|
|
262
|
+
lines.forEach((raw, index) => {
|
|
263
|
+
if (deleted.has(index)) {
|
|
264
|
+
if (index === appendAfter)
|
|
265
|
+
out.push(...newItems);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (index === keyIndex)
|
|
269
|
+
out.push(renderKeyLine(raw, next.length === 0));
|
|
270
|
+
else
|
|
271
|
+
out.push(raw);
|
|
272
|
+
if (index === appendAfter)
|
|
273
|
+
out.push(...newItems);
|
|
274
|
+
});
|
|
275
|
+
return out;
|
|
276
|
+
}
|
|
277
|
+
/** The role's key line in block form (`key:`) or, for an emptied list, flow form (`key: []`). */
|
|
278
|
+
function renderKeyLine(raw, empty) {
|
|
279
|
+
const flow = EMPTY_FLOW_VALUE.exec(raw);
|
|
280
|
+
const bare = flow ?? NULL_VALUE.exec(raw);
|
|
281
|
+
if (bare === null)
|
|
282
|
+
return raw;
|
|
283
|
+
const [, key, comment = ''] = bare;
|
|
284
|
+
return empty ? `${key}: []${comment}` : `${key}:${comment}`;
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=roles-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles-edit.js","sourceRoot":"","sources":["../../src/directives/roles-edit.ts"],"names":[],"mappings":";;AA+BA,wDAMC;AAuBD,8CAOC;AAqFD,4DA4CC;AApMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qCAAqC;AAErC;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,OAA0B,EAAE,GAAsB;IACvF,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC1B,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAOD,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAC1D,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,IAAI,GAAG,YAAY,CAAC;AAE1B,SAAS,SAAS,CAAC,GAAW;IAC5B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B,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,KAAK,KAAK,WAAW;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QACD,IAAI,KAAK,KAAK,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;;YACnE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,KAAK,KAAK,WAAW;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,iGAAiG;AACjG,SAAS,aAAa,CAAC,GAAW,EAAE,KAAc;IAChD,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IAC9B,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IACnC,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,GAAa,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,GAAa,IAAI,OAAO,EAAE,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DirectiveFrontmatter schema (task-004-decoupled-pillars, REQ-SYS-02) — the fourth pillar named by
|
|
3
|
+
* this task's Acceptance Criteria ("memory.yaml, dna.yaml, directives/*.yaml, and workflows.yaml
|
|
4
|
+
* each validate against their own Zod schema independently").
|
|
5
|
+
*
|
|
6
|
+
* UNLIKE memory.yaml/dna.yaml/workflows.yaml, there is currently no dedicated, approved tech-spec
|
|
7
|
+
* for the Directives pillar's own file shape: spec-010-memory-frontmatter-schema's scope is
|
|
8
|
+
* explicitly `docs/self/docs/04_memory/**\/*.md frontmatter` (Memory documents), not
|
|
9
|
+
* `.wingfoil/directives/**` (Directives files are `.md` with YAML frontmatter, not `.yaml` — the
|
|
10
|
+
* AC's "directives/*.yaml" phrasing does not match the real file extension either). This schema is
|
|
11
|
+
* therefore an [AUTHORING]-level minimal shape, grounded directly in the fields every one of the
|
|
12
|
+
* twelve real files under `docs/self/.wingfoil/directives/custom/*.md` actually carries (`id`,
|
|
13
|
+
* `name`, `type: directive`, `kind`, `title`, `tags`, `ref`, and — on three files — `scope`), not a
|
|
14
|
+
* transcription of an approved spec. See this task's Execution Notes for why this was not treated
|
|
15
|
+
* as a hard STOP (design-gap) and the follow-up this leaves for the reviewer/approver (a candidate
|
|
16
|
+
* `spec-013-directive-frontmatter-schema`).
|
|
17
|
+
*
|
|
18
|
+
* `name` is REQUIRED, not merely observed: REQ-SYS-02's own traceability cites
|
|
19
|
+
* `p3-directives/P3.5-project-directives.feature`, whose "Error - a directive file missing required
|
|
20
|
+
* header fields" scenario is explicit ("Given a custom directive file lacks its required 'name'
|
|
21
|
+
* header ... Then loading reports the file as invalid") — the one piece of that BDD contract this
|
|
22
|
+
* schema honors even without a tech-spec of its own.
|
|
23
|
+
*
|
|
24
|
+
* `.passthrough()` per spec-009-validation-strategy §2, matching every other pillar schema.
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/**
|
|
28
|
+
* The YAML frontmatter of a `.wingfoil/directives/**\/*.md` file — the minimal [AUTHORING] shape
|
|
29
|
+
* grounded in the fields the real custom directive files carry (see the module doc for why there is
|
|
30
|
+
* no dedicated tech-spec). `name` is required per REQ-SYS-08's BDD contract. `.passthrough()` per
|
|
31
|
+
* spec-009 §2.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DirectiveFrontmatter: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
type: z.ZodLiteral<"directive">;
|
|
37
|
+
kind: z.ZodString;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
ref: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
/** Parsed shape of the {@link DirectiveFrontmatter} schema. */
|
|
43
|
+
export type DirectiveFrontmatter = z.infer<typeof DirectiveFrontmatter>;
|
|
44
|
+
/**
|
|
45
|
+
* `.wingfoil/roles.yaml` schema (task-037-role-task-scoped-context, REQ-STATE-05's
|
|
46
|
+
* `directive-loader`, P3.2/P3.7) — the role → directive binding config
|
|
47
|
+
* `resolveRoleDirectives`/`assembleExecutionContext` (`src/core/context.ts`) resolve against. Same
|
|
48
|
+
* [AUTHORING]-level rationale as {@link DirectiveFrontmatter}: no dedicated tech-spec covers this
|
|
49
|
+
* pillar's own file shapes yet (spec-012-context-loader-relevance-filtering §5 describes the
|
|
50
|
+
* `directive-loader`'s *behavior* — "look up the request role in `roles.yaml`" — but not roles.yaml's
|
|
51
|
+
* own schema), so this is grounded directly in the fields the real, live
|
|
52
|
+
* `docs/self/.wingfoil/roles.yaml` file carries: `version`, `assignments` (role name -> directive id
|
|
53
|
+
* array), and `global` (directive ids applied to every role). `assignments` keys are role names
|
|
54
|
+
* (validated against `dna.yaml`'s `team.roles` catalogue elsewhere, by REQ-SYS-08/task-034 — NOT here,
|
|
55
|
+
* to keep this pillar's schema independent per REQ-SYS-02); `assignments` values and `global` entries
|
|
56
|
+
* are directive **ids** (`DirectiveFrontmatter.id`), not `name`s. `.passthrough()` per spec-009 §2.
|
|
57
|
+
*/
|
|
58
|
+
export declare const RolesYaml: z.ZodObject<{
|
|
59
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
assignments: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
61
|
+
global: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
62
|
+
}, z.core.$loose>;
|
|
63
|
+
/** Parsed shape of the {@link RolesYaml} schema. */
|
|
64
|
+
export type RolesYaml = z.infer<typeof RolesYaml>;
|
|
65
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/directives/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;iBAUjB,CAAC;AACjB,+DAA+D;AAC/D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS;;;;iBAMN,CAAC;AACjB,oDAAoD;AACpD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RolesYaml = exports.DirectiveFrontmatter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* DirectiveFrontmatter schema (task-004-decoupled-pillars, REQ-SYS-02) — the fourth pillar named by
|
|
6
|
+
* this task's Acceptance Criteria ("memory.yaml, dna.yaml, directives/*.yaml, and workflows.yaml
|
|
7
|
+
* each validate against their own Zod schema independently").
|
|
8
|
+
*
|
|
9
|
+
* UNLIKE memory.yaml/dna.yaml/workflows.yaml, there is currently no dedicated, approved tech-spec
|
|
10
|
+
* for the Directives pillar's own file shape: spec-010-memory-frontmatter-schema's scope is
|
|
11
|
+
* explicitly `docs/self/docs/04_memory/**\/*.md frontmatter` (Memory documents), not
|
|
12
|
+
* `.wingfoil/directives/**` (Directives files are `.md` with YAML frontmatter, not `.yaml` — the
|
|
13
|
+
* AC's "directives/*.yaml" phrasing does not match the real file extension either). This schema is
|
|
14
|
+
* therefore an [AUTHORING]-level minimal shape, grounded directly in the fields every one of the
|
|
15
|
+
* twelve real files under `docs/self/.wingfoil/directives/custom/*.md` actually carries (`id`,
|
|
16
|
+
* `name`, `type: directive`, `kind`, `title`, `tags`, `ref`, and — on three files — `scope`), not a
|
|
17
|
+
* transcription of an approved spec. See this task's Execution Notes for why this was not treated
|
|
18
|
+
* as a hard STOP (design-gap) and the follow-up this leaves for the reviewer/approver (a candidate
|
|
19
|
+
* `spec-013-directive-frontmatter-schema`).
|
|
20
|
+
*
|
|
21
|
+
* `name` is REQUIRED, not merely observed: REQ-SYS-02's own traceability cites
|
|
22
|
+
* `p3-directives/P3.5-project-directives.feature`, whose "Error - a directive file missing required
|
|
23
|
+
* header fields" scenario is explicit ("Given a custom directive file lacks its required 'name'
|
|
24
|
+
* header ... Then loading reports the file as invalid") — the one piece of that BDD contract this
|
|
25
|
+
* schema honors even without a tech-spec of its own.
|
|
26
|
+
*
|
|
27
|
+
* `.passthrough()` per spec-009-validation-strategy §2, matching every other pillar schema.
|
|
28
|
+
*/
|
|
29
|
+
const zod_1 = require("zod");
|
|
30
|
+
/**
|
|
31
|
+
* The YAML frontmatter of a `.wingfoil/directives/**\/*.md` file — the minimal [AUTHORING] shape
|
|
32
|
+
* grounded in the fields the real custom directive files carry (see the module doc for why there is
|
|
33
|
+
* no dedicated tech-spec). `name` is required per REQ-SYS-08's BDD contract. `.passthrough()` per
|
|
34
|
+
* spec-009 §2.
|
|
35
|
+
*/
|
|
36
|
+
exports.DirectiveFrontmatter = zod_1.z
|
|
37
|
+
.object({
|
|
38
|
+
id: zod_1.z.string(),
|
|
39
|
+
name: zod_1.z.string(),
|
|
40
|
+
type: zod_1.z.literal('directive'),
|
|
41
|
+
kind: zod_1.z.string(),
|
|
42
|
+
title: zod_1.z.string(),
|
|
43
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
44
|
+
ref: zod_1.z.array(zod_1.z.string()).optional(),
|
|
45
|
+
})
|
|
46
|
+
.passthrough();
|
|
47
|
+
/**
|
|
48
|
+
* `.wingfoil/roles.yaml` schema (task-037-role-task-scoped-context, REQ-STATE-05's
|
|
49
|
+
* `directive-loader`, P3.2/P3.7) — the role → directive binding config
|
|
50
|
+
* `resolveRoleDirectives`/`assembleExecutionContext` (`src/core/context.ts`) resolve against. Same
|
|
51
|
+
* [AUTHORING]-level rationale as {@link DirectiveFrontmatter}: no dedicated tech-spec covers this
|
|
52
|
+
* pillar's own file shapes yet (spec-012-context-loader-relevance-filtering §5 describes the
|
|
53
|
+
* `directive-loader`'s *behavior* — "look up the request role in `roles.yaml`" — but not roles.yaml's
|
|
54
|
+
* own schema), so this is grounded directly in the fields the real, live
|
|
55
|
+
* `docs/self/.wingfoil/roles.yaml` file carries: `version`, `assignments` (role name -> directive id
|
|
56
|
+
* array), and `global` (directive ids applied to every role). `assignments` keys are role names
|
|
57
|
+
* (validated against `dna.yaml`'s `team.roles` catalogue elsewhere, by REQ-SYS-08/task-034 — NOT here,
|
|
58
|
+
* to keep this pillar's schema independent per REQ-SYS-02); `assignments` values and `global` entries
|
|
59
|
+
* are directive **ids** (`DirectiveFrontmatter.id`), not `name`s. `.passthrough()` per spec-009 §2.
|
|
60
|
+
*/
|
|
61
|
+
exports.RolesYaml = zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
version: zod_1.z.number().optional(),
|
|
64
|
+
assignments: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
|
|
65
|
+
global: zod_1.z.array(zod_1.z.string()).default([]),
|
|
66
|
+
})
|
|
67
|
+
.passthrough();
|
|
68
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/directives/schema.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,6BAAwB;AAExB;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,GAAG,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,WAAW,EAAE,CAAC;AAIjB;;;;;;;;;;;;;GAaG;AACU,QAAA,SAAS,GAAG,OAAC;KACvB,MAAM,CAAC;IACN,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAC;KACD,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** One step of a text path: a mapping key, or the index of an entry inside a block sequence. */
|
|
2
|
+
export type DnaTextStep = {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
} | {
|
|
5
|
+
readonly index: number;
|
|
6
|
+
};
|
|
7
|
+
/** The minimal edits `applyDnaMutation` (`./mutate.ts`) expresses its result as. */
|
|
8
|
+
export type DnaTextEdit =
|
|
9
|
+
/** Write `value` at the mapping key the path ends on, inserting the key when it is absent. */
|
|
10
|
+
{
|
|
11
|
+
readonly kind: 'set-scalar';
|
|
12
|
+
readonly path: readonly DnaTextStep[];
|
|
13
|
+
readonly value: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** Drop the mapping key the path ends on, with whatever block hangs below it. */
|
|
16
|
+
| {
|
|
17
|
+
readonly kind: 'delete-key';
|
|
18
|
+
readonly path: readonly DnaTextStep[];
|
|
19
|
+
}
|
|
20
|
+
/** Append `items` to the sequence the path ends on. */
|
|
21
|
+
| {
|
|
22
|
+
readonly kind: 'append-items';
|
|
23
|
+
readonly path: readonly DnaTextStep[];
|
|
24
|
+
readonly items: readonly unknown[];
|
|
25
|
+
}
|
|
26
|
+
/** Drop the items at `indexes` from the sequence the path ends on. */
|
|
27
|
+
| {
|
|
28
|
+
readonly kind: 'remove-items';
|
|
29
|
+
readonly path: readonly DnaTextStep[];
|
|
30
|
+
readonly indexes: readonly number[];
|
|
31
|
+
}
|
|
32
|
+
/** Replace the whole sequence the path ends on with `items`. */
|
|
33
|
+
| {
|
|
34
|
+
readonly kind: 'replace-list';
|
|
35
|
+
readonly path: readonly DnaTextStep[];
|
|
36
|
+
readonly items: readonly unknown[];
|
|
37
|
+
}
|
|
38
|
+
/** Apply several edits in order, verified once at the end (an entry update changing two fields). */
|
|
39
|
+
| {
|
|
40
|
+
readonly kind: 'batch';
|
|
41
|
+
readonly edits: readonly DnaTextEdit[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Apply `edit` to the RAW TEXT of a `dna.yaml`, editing as few lines as possible, and return the new
|
|
45
|
+
* text — or `undefined`, deliberately and not as an error, when no provably-minimal edit exists, so the
|
|
46
|
+
* caller falls back to the whole-file `dump()`.
|
|
47
|
+
*
|
|
48
|
+
* `intended` is the document the mutation produced (`applyDnaMutation`'s `dna`). It serves twice: an
|
|
49
|
+
* inline flow sequence is re-rendered from it rather than patched token-by-token, and — the part that
|
|
50
|
+
* makes this safe — the edited text is re-parsed and compared against it in full before being returned.
|
|
51
|
+
* Structural equality is used rather than a byte comparison because key ORDER is a rendering detail
|
|
52
|
+
* while key values are the contract; a mis-located edit fails the comparison and costs the comments,
|
|
53
|
+
* never the content.
|
|
54
|
+
*
|
|
55
|
+
* Declines (returns `undefined`) when: the text is not one valid YAML document; a step of the path is
|
|
56
|
+
* absent from the text; the target or a value it must rewrite spans more than its own line (a block
|
|
57
|
+
* scalar, a nested block); a value has no single-line YAML form; or the result does not read back as
|
|
58
|
+
* `intended`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function applyDnaEditInText(text: string, edit: DnaTextEdit, intended: unknown): string | undefined;
|
|
61
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/dna/edit.ts"],"names":[],"mappings":"AA0BA,gGAAgG;AAChG,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,oFAAoF;AACpF,MAAM,MAAM,WAAW;AACrB,8FAA8F;AAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AACjG,iFAAiF;GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE;AACxE,uDAAuD;GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SA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