@cheongfish/bouncer 0.0.0-stage → 0.1.10
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 +202 -0
- package/README.md +28 -2
- package/bin/bouncer +26 -0
- package/bin/bouncer-root +25 -0
- package/bin/build-stamp.js +78 -0
- package/dist/.build-stamp +1 -0
- package/dist/approval-snapshot.js +99 -0
- package/dist/bouncer-root.js +80 -0
- package/dist/canonical-json.js +37 -0
- package/dist/cli-commit-guard-command.js +74 -0
- package/dist/cli-config-command.js +47 -0
- package/dist/cli-context-review-command.js +273 -0
- package/dist/cli-current-command.js +374 -0
- package/dist/cli-dispatch-command.js +119 -0
- package/dist/cli-doc-commands.js +352 -0
- package/dist/cli-epic-command.js +130 -0
- package/dist/cli-flags.js +50 -0
- package/dist/cli-git-commands.js +931 -0
- package/dist/cli-intent-command.js +491 -0
- package/dist/cli-metrics-command.js +134 -0
- package/dist/cli-ontology-command.js +109 -0
- package/dist/cli-project-commands.js +580 -0
- package/dist/cli-retro-command.js +138 -0
- package/dist/cli-review-command.js +251 -0
- package/dist/cli-review-dispatch-command.js +338 -0
- package/dist/cli-usage.js +72 -0
- package/dist/cli.js +70 -0
- package/dist/codex-agents.js +189 -0
- package/dist/command-argv.js +125 -0
- package/dist/commit-guard.js +72 -0
- package/dist/commit-hook.js +470 -0
- package/dist/commit-message.js +77 -0
- package/dist/commit-sha.js +107 -0
- package/dist/commit.js +519 -0
- package/dist/composite-gates.js +129 -0
- package/dist/comprehension.js +127 -0
- package/dist/config.js +298 -0
- package/dist/context-ids.js +288 -0
- package/dist/context-migration-rewrite.js +421 -0
- package/dist/context-ontology.js +746 -0
- package/dist/context-review-contracts.js +2 -0
- package/dist/context-review-projection.js +147 -0
- package/dist/context-review-state.js +824 -0
- package/dist/context-review-store.js +602 -0
- package/dist/context-review-transitions.js +412 -0
- package/dist/coordinate-advance.js +253 -0
- package/dist/coordinate-next.js +998 -0
- package/dist/coordinate-output.js +57 -0
- package/dist/coordinator-command-contracts.js +2 -0
- package/dist/coordinator-commands.js +1908 -0
- package/dist/coordinator-fanin.js +1021 -0
- package/dist/coordinator-git.js +121 -0
- package/dist/coordinator-input.js +37 -0
- package/dist/coordinator-ledger.js +381 -0
- package/dist/coordinator-prepare.js +1047 -0
- package/dist/coordinator-repair.js +1416 -0
- package/dist/coordinator-verification.js +42 -0
- package/dist/coordinator-worker.js +388 -0
- package/dist/coordinator.js +7 -0
- package/dist/cross-drive.js +85 -0
- package/dist/current.js +1148 -0
- package/dist/dag-shape.js +93 -0
- package/dist/doc-shape-contracts.js +241 -0
- package/dist/drive-metrics.js +691 -0
- package/dist/epic-index.js +347 -0
- package/dist/epic-registry.js +453 -0
- package/dist/execute-prepare.js +262 -0
- package/dist/execution-contracts.js +46 -0
- package/dist/execution-dag.js +148 -0
- package/dist/finalize-checks.js +177 -0
- package/dist/finalize-collect.js +343 -0
- package/dist/finalize-comprehension.js +116 -0
- package/dist/finalize-digest-collect.js +388 -0
- package/dist/finalize-digest-model.js +595 -0
- package/dist/finalize-digest.js +164 -0
- package/dist/finalize-explain.js +176 -0
- package/dist/finalize-pr.js +610 -0
- package/dist/finalize-release-main.js +652 -0
- package/dist/finalize.js +714 -0
- package/dist/frontmatter.js +22 -0
- package/dist/git-ops.js +49 -0
- package/dist/graph-exec.js +179 -0
- package/dist/graph-scope.js +268 -0
- package/dist/graphify.js +995 -0
- package/dist/guards.js +82 -0
- package/dist/import-git.js +78 -0
- package/dist/import-history.js +392 -0
- package/dist/import-render.js +59 -0
- package/dist/import-types.js +2 -0
- package/dist/init.js +571 -0
- package/dist/intent-bundle.js +936 -0
- package/dist/intent-provenance.js +927 -0
- package/dist/layout.js +131 -0
- package/dist/lease.js +145 -0
- package/dist/legacy-comments.js +71 -0
- package/dist/migrate-context-slugs.js +262 -0
- package/dist/migrate-merge-legacy-epics.js +392 -0
- package/dist/migrate-review-scope.js +144 -0
- package/dist/migrate-task-layout.js +194 -0
- package/dist/path-overlap.js +38 -0
- package/dist/paths.js +45 -0
- package/dist/plan-approve.js +218 -0
- package/dist/plan-inspect.js +575 -0
- package/dist/plan-prerequisites.js +197 -0
- package/dist/plan-snapshot-contract.js +98 -0
- package/dist/plan-snapshot.js +138 -0
- package/dist/plugin-root.js +204 -0
- package/dist/posix-path.js +14 -0
- package/dist/pre-commit-hook.js +170 -0
- package/dist/print-dispatch.js +285 -0
- package/dist/render.js +8 -0
- package/dist/retention-migration.js +595 -0
- package/dist/retro-read.js +259 -0
- package/dist/retro-sources.js +318 -0
- package/dist/review-dispatch.js +1054 -0
- package/dist/review-policy.js +28 -0
- package/dist/review-record.js +447 -0
- package/dist/review-repair-state.js +52 -0
- package/dist/review-snapshot.js +659 -0
- package/dist/run-detach.js +165 -0
- package/dist/run-preflight.js +368 -0
- package/dist/runtime-state.js +1038 -0
- package/dist/scaffold.js +533 -0
- package/dist/schema.js +294 -0
- package/dist/scope.js +1073 -0
- package/dist/seed-worktree.js +926 -0
- package/dist/session-graph.js +337 -0
- package/dist/subagents.js +86 -0
- package/dist/symbol-index.js +1390 -0
- package/dist/task-brief-hash.js +34 -0
- package/dist/task-commits.js +124 -0
- package/dist/tasks-docs.js +192 -0
- package/dist/templates.js +469 -0
- package/dist/time.js +21 -0
- package/dist/validate-docs.js +302 -0
- package/dist/validate-gates-finalize.js +303 -0
- package/dist/validate-gates-plan.js +720 -0
- package/dist/validate-gates-run.js +420 -0
- package/dist/validate-gates-shared.js +124 -0
- package/dist/validate-gates.js +87 -0
- package/dist/validate-sections.js +654 -0
- package/dist/validate-structural.js +347 -0
- package/dist/validate.js +417 -0
- package/dist/verification-contracts.js +26 -0
- package/dist/verification-evidence.js +233 -0
- package/dist/verification-execution.js +163 -0
- package/dist/verification-identity.js +413 -0
- package/dist/verification-target.js +51 -0
- package/dist/verification.js +383 -0
- package/dist/windows-npm.js +38 -0
- package/package.json +31 -4
- package/resources/graphify-compat.json +9 -0
- package/vendor/README.md +23 -0
- package/vendor/js-yaml.LICENSE +21 -0
- package/vendor/js-yaml.js +3022 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cheongfish/bouncer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bouncer CLI runtime npm package입니다. `bouncer`와 `bouncer-root` 실행 파일,
|
|
4
|
+
CommonJS runtime output인 `dist/`를 제공합니다. plugin은 별도 설치물이며
|
|
5
|
+
runtime과 같은 version이어야 합니다.
|
|
6
|
+
|
|
7
|
+
기본 설치는 전역입니다. registry에 공개된 plugin release와 같은 version을
|
|
8
|
+
선택하세요.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install --global @cheongfish/bouncer@0.1.10
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
프로젝트 local 설치도 지원합니다. 일반 터미널은 `node_modules/.bin`의 shim을
|
|
15
|
+
PATH에 추가할 수 있지만, plugin hook이 호스트 PATH를 상속하지 않는 환경에서는
|
|
16
|
+
`BOUNCER_BIN`에 `node_modules/.bin/bouncer`의 절대 경로를 지정하세요.
|
|
17
|
+
`npm config get bin-links`가 `false`이면 `npm config set bin-links true`로 바꾼 뒤
|
|
18
|
+
runtime을 다시 설치해야 shim이 생성됩니다.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install --save-dev @cheongfish/bouncer@0.1.10
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
PowerShell은 local 설치의 `node_modules/.bin/bouncer.cmd`를, 전역 설치는 PATH에
|
|
25
|
+
등록된 `bouncer.cmd`를 실행할 수 있습니다.
|
|
26
|
+
|
|
27
|
+
저장소 checkout은 root에서 `npm ci` 후 `npm run build`로 이 workspace를
|
|
28
|
+
빌드합니다. packed runtime에는 컴파일된 파일이 들어 있으므로 설치 중 source를
|
|
29
|
+
빌드하지 않습니다.
|
package/bin/bouncer
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const packageRoot = path.join(__dirname, '..');
|
|
7
|
+
const cliEntry = path.join(packageRoot, 'dist', 'cli.js');
|
|
8
|
+
if (!fs.existsSync(cliEntry)) {
|
|
9
|
+
process.stderr.write(
|
|
10
|
+
`bouncer: packages/cli/dist is missing; run \`npm run build\` in ${path.join(packageRoot, '..', '..')}\n`,
|
|
11
|
+
);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// npm tarball에는 src가 없으므로 source hash 검사는 checkout에서만 수행한다.
|
|
16
|
+
const sourceDir = path.join(packageRoot, 'src');
|
|
17
|
+
if (fs.existsSync(sourceDir) && !require('./build-stamp').checkBuildFresh(packageRoot).ok) {
|
|
18
|
+
process.stderr.write(
|
|
19
|
+
`bouncer: stale-build: packages/cli/dist does not match packages/cli/src; `
|
|
20
|
+
+ `run \`npm run build\` in ${path.join(packageRoot, '..', '..')}\n`,
|
|
21
|
+
);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { runCli } = require('../dist/cli');
|
|
26
|
+
process.exit(runCli(process.argv.slice(2)));
|
package/bin/bouncer-root
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const packageRoot = path.join(__dirname, '..');
|
|
7
|
+
const rootEntry = path.join(packageRoot, 'dist', 'bouncer-root.js');
|
|
8
|
+
if (!fs.existsSync(rootEntry)) {
|
|
9
|
+
process.stderr.write(
|
|
10
|
+
`bouncer: packages/cli/dist is missing; run \`npm run build\` in ${path.join(packageRoot, '..', '..')}\n`,
|
|
11
|
+
);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const sourceDir = path.join(packageRoot, 'src');
|
|
16
|
+
if (fs.existsSync(sourceDir) && !require('./build-stamp').checkBuildFresh(packageRoot).ok) {
|
|
17
|
+
process.stderr.write(
|
|
18
|
+
`bouncer: stale-build: packages/cli/dist does not match packages/cli/src; `
|
|
19
|
+
+ `run \`npm run build\` in ${path.join(packageRoot, '..', '..')}\n`,
|
|
20
|
+
);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { runBouncerRoot } = require('../dist/bouncer-root');
|
|
25
|
+
process.exit(runBouncerRoot(process.argv.slice(2)));
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
// 컴파일 산출물(dist)이 소스(src)와 어긋난 채 실행되는 것을 막는
|
|
4
|
+
// plain JS helper. 이 검사를 scripts/src에 두면 검사 자체가 오래된 산출물로
|
|
5
|
+
// 실행되므로 컴파일 대상 밖에 둔다.
|
|
6
|
+
const crypto = require('node:crypto');
|
|
7
|
+
const fs = require('node:fs');
|
|
8
|
+
const path = require('node:path');
|
|
9
|
+
|
|
10
|
+
const STAMP_RELATIVE = path.join('dist', '.build-stamp');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* packages/cli/src 아래 .ts 파일을 posix 상대 경로로 모은다.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} dir - 탐색할 디렉터리
|
|
16
|
+
* @param {string} rel - dir의 root 기준 posix 상대 경로
|
|
17
|
+
* @returns {string[]} root 기준 posix 상대 경로 목록
|
|
18
|
+
*/
|
|
19
|
+
function listTsFiles(dir, rel) {
|
|
20
|
+
const found = [];
|
|
21
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
22
|
+
const childRel = `${rel}/${entry.name}`;
|
|
23
|
+
if (entry.isDirectory()) found.push(...listTsFiles(path.join(dir, entry.name), childRel));
|
|
24
|
+
else if (entry.isFile() && entry.name.endsWith('.ts')) found.push(childRel);
|
|
25
|
+
}
|
|
26
|
+
return found;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 소스 트리 해시를 계산한다. scripts/src/**\/*.ts와 tsconfig.json을 정렬된
|
|
31
|
+
* 상대 경로 순으로 `<경로>\0<바이트>\0`씩 sha256에 넣는다. 줄바꿈은 정규화하지
|
|
32
|
+
* 않는다 — 바이트가 바뀌면 산출물도 달라질 수 있기 때문이다.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} root - 저장소(플러그인) root
|
|
35
|
+
* @returns {string} `sha256:<64hex>`
|
|
36
|
+
*/
|
|
37
|
+
function computeSourceHash(root) {
|
|
38
|
+
const files = [...listTsFiles(path.join(root, 'src'), 'src'), 'tsconfig.json'].sort();
|
|
39
|
+
const hash = crypto.createHash('sha256');
|
|
40
|
+
for (const rel of files) {
|
|
41
|
+
hash.update(`${rel}\0`);
|
|
42
|
+
hash.update(fs.readFileSync(path.join(root, rel)));
|
|
43
|
+
hash.update('\0');
|
|
44
|
+
}
|
|
45
|
+
return `sha256:${hash.digest('hex')}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 기록된 stamp를 읽는다. 파일이 없을 때만 null이고 다른 읽기 오류는 던진다.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} root - 저장소(플러그인) root
|
|
52
|
+
* @returns {string|null} 개행을 뗀 stamp, 없으면 null
|
|
53
|
+
*/
|
|
54
|
+
function readStamp(root) {
|
|
55
|
+
try {
|
|
56
|
+
return fs.readFileSync(path.join(root, STAMP_RELATIVE), 'utf8').trim();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (error.code === 'ENOENT') return null;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 현재 소스 해시가 stamp와 같은지 판정한다.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} root - 저장소(플러그인) root
|
|
67
|
+
* @returns {{ok: true} | {ok: false, reason: 'stale-build'}} stamp 부재도 stale이다
|
|
68
|
+
*/
|
|
69
|
+
function checkBuildFresh(root) {
|
|
70
|
+
return readStamp(root) === computeSourceHash(root) ? { ok: true } : { ok: false, reason: 'stale-build' };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (require.main === module && process.argv[2] === '--write') {
|
|
74
|
+
const root = path.join(__dirname, '..');
|
|
75
|
+
fs.writeFileSync(path.join(root, STAMP_RELATIVE), `${computeSourceHash(root)}\n`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = { computeSourceHash, readStamp, checkBuildFresh };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sha256:7abe62097bbb29562f470a8e2eb46654e2dbf1cba03f5a19b9e01199371e2826
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const canonicalJsonMod = require("./canonical-json");
|
|
3
|
+
const { sha256Canonical } = canonicalJsonMod;
|
|
4
|
+
const guards = require("./guards");
|
|
5
|
+
const { isRecord } = guards;
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const tasksDocs = require("./tasks-docs");
|
|
8
|
+
const { listTasksDocs } = tasksDocs;
|
|
9
|
+
const frontmatter = require("./frontmatter");
|
|
10
|
+
const { readDoc } = frontmatter;
|
|
11
|
+
const config = require("./config");
|
|
12
|
+
const { readVerifyPolicy } = config;
|
|
13
|
+
const paths = require("./paths");
|
|
14
|
+
const { toPosix } = paths;
|
|
15
|
+
function bouncerOf(data) {
|
|
16
|
+
if (!isRecord(data) || !isRecord(data.bouncer))
|
|
17
|
+
return {};
|
|
18
|
+
return data.bouncer;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* tasks.md frontmatter에서 승인 범위에 넣는 세 필드만 고른다.
|
|
22
|
+
* verify는 원본 문자열만 쓴다 — `readVerifyCommand`의 config 폴백을 넣으면
|
|
23
|
+
* 문서가 안 바뀌었는데도 allowlist·기본 verify 변경이 task.verify 항목으로 위장된다.
|
|
24
|
+
*
|
|
25
|
+
* @param {{ rel: string, id: string | null }} entry - listTasksDocs 엔트리
|
|
26
|
+
* @param {string} repoRoot - 저장소 루트 절대 경로
|
|
27
|
+
* @returns {{ id: string, affected_paths: unknown, verify: string | null }} id순 정렬에 쓸 task 레코드
|
|
28
|
+
*/
|
|
29
|
+
function taskFromEntry(entry, repoRoot) {
|
|
30
|
+
const { data } = readDoc(path.join(repoRoot, entry.rel));
|
|
31
|
+
const bouncer = bouncerOf(data);
|
|
32
|
+
const id = typeof bouncer.id === 'string' && bouncer.id
|
|
33
|
+
? bouncer.id
|
|
34
|
+
: (typeof entry.id === 'string' && entry.id ? entry.id : 'TASKS-unknown');
|
|
35
|
+
const affected_paths = Object.prototype.hasOwnProperty.call(bouncer, 'affected_paths')
|
|
36
|
+
? bouncer.affected_paths
|
|
37
|
+
: [];
|
|
38
|
+
const verify = typeof bouncer.verify === 'string' ? bouncer.verify : null;
|
|
39
|
+
return { id, affected_paths, verify };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* blueprint의 승인 digest와 항목별 digest를 계산한다.
|
|
43
|
+
* 게이트 G24와 `current --set`이 같은 hex를 써야 활성화 직후 대조가 어긋나지 않는다.
|
|
44
|
+
*
|
|
45
|
+
* @param {{ repoRoot: string, blueprintDir: string }} opts - 저장소 루트와 blueprint 상대 경로
|
|
46
|
+
* @returns {{ digest: string, parts: Record<string, string> }}
|
|
47
|
+
* `digest`는 `{ tasks, verify_allowlist }`의 sha256Canonical.
|
|
48
|
+
* `parts`는 `TASKS-NNN.affected_paths`·`TASKS-NNN.verify`·`verify_allowlist`·`tasks`(id 목록)별 digest
|
|
49
|
+
*/
|
|
50
|
+
function computeApprovalDigest({ repoRoot, blueprintDir }) {
|
|
51
|
+
const listing = listTasksDocs({ repoRoot, blueprintDir: toPosix(blueprintDir) });
|
|
52
|
+
const tasks = listing.entries
|
|
53
|
+
.map((entry) => taskFromEntry(entry, repoRoot))
|
|
54
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
55
|
+
const policy = readVerifyPolicy(repoRoot);
|
|
56
|
+
// invalid config는 기본 목록으로 넓히지 않는다. 파손된 allowlist를 통과시키면
|
|
57
|
+
// 운영자가 막은 명령이 승인 스냅샷에 실려 G24가 침묵한다.
|
|
58
|
+
const verify_allowlist = policy.ok === true ? [...policy.allowlist] : null;
|
|
59
|
+
const parts = {
|
|
60
|
+
tasks: sha256Canonical(tasks.map((task) => task.id)),
|
|
61
|
+
verify_allowlist: sha256Canonical(verify_allowlist),
|
|
62
|
+
};
|
|
63
|
+
for (const task of tasks) {
|
|
64
|
+
parts[`${task.id}.affected_paths`] = sha256Canonical(task.affected_paths);
|
|
65
|
+
parts[`${task.id}.verify`] = sha256Canonical(task.verify);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
digest: sha256Canonical({ tasks, verify_allowlist }),
|
|
69
|
+
parts,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const TASK_LEAF_RE = /^TASKS-\d{3}\.(affected_paths|verify)$/;
|
|
73
|
+
/**
|
|
74
|
+
* 승인 파일 `parts`와 현재 `parts`에서 바뀐 항목 이름을 고른다.
|
|
75
|
+
* task 추가·삭제로만 생긴 `TASKS-NNN.*` 키는 `tasks` 항목으로 대표한다 —
|
|
76
|
+
* 같은 사건을 세 이름으로 나열하면 G24 메시지가 재승인 대상을 흐린다.
|
|
77
|
+
*
|
|
78
|
+
* @param {Record<string, string>} approved - 승인 파일의 parts
|
|
79
|
+
* @param {Record<string, string>} current - 지금 계산한 parts
|
|
80
|
+
* @returns {string[]} 사전순 항목 이름
|
|
81
|
+
*/
|
|
82
|
+
function diffApprovalParts(approved, current) {
|
|
83
|
+
const names = new Set([...Object.keys(approved), ...Object.keys(current)]);
|
|
84
|
+
const changed = [];
|
|
85
|
+
for (const name of [...names].sort()) {
|
|
86
|
+
if (approved[name] === current[name])
|
|
87
|
+
continue;
|
|
88
|
+
if (TASK_LEAF_RE.test(name)) {
|
|
89
|
+
if (Object.prototype.hasOwnProperty.call(approved, name)
|
|
90
|
+
&& Object.prototype.hasOwnProperty.call(current, name)) {
|
|
91
|
+
changed.push(name);
|
|
92
|
+
}
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
changed.push(name);
|
|
96
|
+
}
|
|
97
|
+
return changed;
|
|
98
|
+
}
|
|
99
|
+
module.exports = { computeApprovalDigest, diffApprovalParts, sha256Canonical };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runBouncerRoot = runBouncerRoot;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const plugin_root_1 = require("./plugin-root");
|
|
9
|
+
function runBouncerRoot(argv, io = {}) {
|
|
10
|
+
const out = io.out ?? ((text) => process.stdout.write(text));
|
|
11
|
+
const err = io.err ?? ((text) => process.stderr.write(text));
|
|
12
|
+
let host;
|
|
13
|
+
let select = false;
|
|
14
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
15
|
+
const flag = argv[index];
|
|
16
|
+
if (flag === '--auto')
|
|
17
|
+
continue;
|
|
18
|
+
if (flag === '--select') {
|
|
19
|
+
select = true;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (flag === '--host') {
|
|
23
|
+
const parsedHost = (0, plugin_root_1.parseHost)(argv[index + 1]);
|
|
24
|
+
if (!parsedHost) {
|
|
25
|
+
err('bouncer-root: --host must be claude, codex, or antigravity\n');
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
host = parsedHost;
|
|
29
|
+
index += 1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
err(`bouncer-root: unknown argument: ${flag}\n`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
if (select) {
|
|
36
|
+
if (!(io.isTTY ?? process.stdin.isTTY)) {
|
|
37
|
+
err('bouncer-root: --select requires a TTY\n');
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
if ((io.env ?? process.env).BOUNCER_HOME !== undefined) {
|
|
41
|
+
try {
|
|
42
|
+
out(`${(0, plugin_root_1.resolvePluginRoot)(io, host ?? undefined).path}\n`);
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
err(`bouncer-root: ${error.message}\n`);
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const candidates = (0, plugin_root_1.findPluginCandidates)(io, host ?? undefined);
|
|
51
|
+
if (!candidates.length) {
|
|
52
|
+
err('bouncer-root: no valid Bouncer plugin roots found\n');
|
|
53
|
+
return 1;
|
|
54
|
+
}
|
|
55
|
+
candidates.forEach((candidate, index) => err(`${index + 1}) ${candidate.path} (${candidate.version})\n`));
|
|
56
|
+
const input = (io.readInput ?? (() => node_fs_1.default.readFileSync(0, 'utf8')))().trim();
|
|
57
|
+
const selected = /^\d+$/.test(input) ? candidates[Number(input) - 1] : undefined;
|
|
58
|
+
if (!selected) {
|
|
59
|
+
err('bouncer-root: invalid selection\n');
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
(0, plugin_root_1.assertPluginVersion)(selected);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
err(`bouncer-root: ${error.message}\n`);
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
69
|
+
out(`${selected.path}\n`);
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
out(`${(0, plugin_root_1.resolvePluginRoot)(io, host ?? undefined).path}\n`);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
err(`bouncer-root: ${error.message}\n`);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { createHash } = require('node:crypto');
|
|
3
|
+
// digest 단일 정의. 승인·검증·게이트 증적이 같은 입력에서 같은 hex를 내야 하므로
|
|
4
|
+
// 복사본을 두지 않는다. Node 내장 모듈만 import해 어느 모듈에서든 순환 없이 로드된다.
|
|
5
|
+
/**
|
|
6
|
+
* 객체의 키를 재귀적으로 정렬한 뒤 UTF-8 JSON으로 직렬화한다.
|
|
7
|
+
* digest가 키 삽입 순서에 흔들리면 같은 범위가 서로 다른 값으로 갈라진다.
|
|
8
|
+
*
|
|
9
|
+
* @param {unknown} value - 직렬화할 값
|
|
10
|
+
* @returns {string} canonical JSON 문자열
|
|
11
|
+
*/
|
|
12
|
+
function canonicalJson(value) {
|
|
13
|
+
const normalize = (input) => {
|
|
14
|
+
if (Array.isArray(input))
|
|
15
|
+
return input.map(normalize);
|
|
16
|
+
if (input && typeof input === 'object') {
|
|
17
|
+
const record = input;
|
|
18
|
+
const sorted = {};
|
|
19
|
+
for (const key of Object.keys(record).sort()) {
|
|
20
|
+
sorted[key] = normalize(record[key]);
|
|
21
|
+
}
|
|
22
|
+
return sorted;
|
|
23
|
+
}
|
|
24
|
+
return input;
|
|
25
|
+
};
|
|
26
|
+
return JSON.stringify(normalize(value));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* canonical JSON의 SHA-256 hex를 돌려준다.
|
|
30
|
+
*
|
|
31
|
+
* @param {unknown} value - 해시할 값
|
|
32
|
+
* @returns {string} 64자 hex digest
|
|
33
|
+
*/
|
|
34
|
+
function sha256Canonical(value) {
|
|
35
|
+
return createHash('sha256').update(canonicalJson(value), 'utf8').digest('hex');
|
|
36
|
+
}
|
|
37
|
+
module.exports = { canonicalJson, sha256Canonical };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const cliUsage = require("./cli-usage");
|
|
3
|
+
const cliFlags = require("./cli-flags");
|
|
4
|
+
const { parseFlags } = cliFlags;
|
|
5
|
+
const commitHook = require("./commit-hook");
|
|
6
|
+
const { evaluateStaged, evaluateCommit } = commitHook;
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
const USAGE = `usage: bouncer commit-guard (--staged | --command-stdin) [--repo <dir>]
|
|
9
|
+
|
|
10
|
+
`;
|
|
11
|
+
/**
|
|
12
|
+
* 커밋 범위 검사 CLI. 두 모드 중 정확히 하나만 받는다.
|
|
13
|
+
* - `--staged`: git pre-commit 훅용. staged 인덱스를 판정한다.
|
|
14
|
+
* - `--command-stdin`: PreToolUse 훅용. stdin 전체를 명령 원문으로 읽어
|
|
15
|
+
* `evaluateCommit`으로 판정한다(명령 탐지·alias·FAIL_CLOSED 규칙 포함).
|
|
16
|
+
* 둘 다 있거나 둘 다 없으면 사용법 오류(exit 2)로 끝내 판정 예외(exit 1,
|
|
17
|
+
* 커밋 차단)와 구분한다.
|
|
18
|
+
*
|
|
19
|
+
* @param {object} opts
|
|
20
|
+
* @param {string[]} opts.argv - `commit-guard` 뒤 인자
|
|
21
|
+
* @param {string} opts.cwd - `--repo`가 없을 때 쓸 저장소 루트
|
|
22
|
+
* @param {Function} [opts.evaluate] - 기본 `evaluateStaged`. 테스트 seam
|
|
23
|
+
* @param {Function} [opts.evaluateCommand] - 기본 `evaluateCommit`. 테스트 seam
|
|
24
|
+
* @param {Function} [opts.readInput] - 기본 stdin 전체 읽기. 테스트 seam
|
|
25
|
+
* @param {Function} [opts.stderr] - 차단 사유·사용법 싱크. 생략 시 stderr
|
|
26
|
+
* @returns {number} 0 허용, 1 차단 또는 내부 오류, 2 사용법
|
|
27
|
+
*/
|
|
28
|
+
function runCommitGuard({ argv, cwd, evaluate, evaluateCommand, readInput, stderr, }) {
|
|
29
|
+
const err = stderr || ((s) => {
|
|
30
|
+
process.stderr.write(s);
|
|
31
|
+
});
|
|
32
|
+
const staged = argv.includes('--staged');
|
|
33
|
+
const commandStdin = argv.includes('--command-stdin');
|
|
34
|
+
// 상호 배타: 둘 다 주면 어느 판정을 원하는지 모호하므로 사용법 오류로 거절한다.
|
|
35
|
+
if (staged === commandStdin) {
|
|
36
|
+
err(USAGE);
|
|
37
|
+
return 2;
|
|
38
|
+
}
|
|
39
|
+
const flags = parseFlags(argv);
|
|
40
|
+
const repoRoot = typeof flags.repo === 'string' && flags.repo ? flags.repo : cwd;
|
|
41
|
+
const judge = evaluate || evaluateStaged;
|
|
42
|
+
let result;
|
|
43
|
+
try {
|
|
44
|
+
if (commandStdin) {
|
|
45
|
+
const judgeCommand = evaluateCommand || evaluateCommit;
|
|
46
|
+
const read = readInput || (() => fs.readFileSync(0, 'utf8'));
|
|
47
|
+
// stdin 읽기 실패도 이 try 안에서 internal error(exit 1)로 막는다.
|
|
48
|
+
result = judgeCommand({ command: read(), repoRoot });
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
result = judge({ repoRoot });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// evaluate가 던지는 모든 예외를 흡수한다. hook 안에서 uncaught로 죽으면
|
|
56
|
+
// git은 막히지만 정해진 진단 문자열이 아니라 스택이 나와 복구 힌트가 없다.
|
|
57
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
58
|
+
err(`commit-guard: internal error, blocking commit: ${message}\n`);
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
if (result.block) {
|
|
62
|
+
err(`${result.reason || 'commit blocked'}\n`);
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
function cmdCommitGuard(rest, io) {
|
|
68
|
+
return runCommitGuard({ argv: rest, cwd: process.cwd(), stderr: io.err });
|
|
69
|
+
}
|
|
70
|
+
module.exports = {
|
|
71
|
+
runCommitGuard,
|
|
72
|
+
run: cmdCommitGuard,
|
|
73
|
+
usage: cliUsage.COMMAND_USAGE['commit-guard'],
|
|
74
|
+
};
|