@friedbotstudio/create-baseline 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +222 -0
- package/bin/cli.js +247 -0
- package/obj/template/.claude/agents/swarm-worker.md +52 -0
- package/obj/template/.claude/bin/LICENSE +201 -0
- package/obj/template/.claude/bin/NOTICE +48 -0
- package/obj/template/.claude/commands/approve-spec.md +29 -0
- package/obj/template/.claude/commands/approve-swarm.md +27 -0
- package/obj/template/.claude/commands/grant-commit.md +19 -0
- package/obj/template/.claude/commands/init-project.md +191 -0
- package/obj/template/.claude/hooks/artifact_template_guard.sh +141 -0
- package/obj/template/.claude/hooks/consent_gate_grant.sh +89 -0
- package/obj/template/.claude/hooks/destructive_cmd_guard.sh +42 -0
- package/obj/template/.claude/hooks/env_guard.sh +36 -0
- package/obj/template/.claude/hooks/git_commit_guard.sh +93 -0
- package/obj/template/.claude/hooks/harness_continuation.sh +121 -0
- package/obj/template/.claude/hooks/lib/__pycache__/resume_writer.cpython-314.pyc +0 -0
- package/obj/template/.claude/hooks/lib/common.sh +328 -0
- package/obj/template/.claude/hooks/lib/resume_writer.py +341 -0
- package/obj/template/.claude/hooks/lint_runner.sh +55 -0
- package/obj/template/.claude/hooks/memory_pre_compact.sh +36 -0
- package/obj/template/.claude/hooks/memory_session_start.sh +244 -0
- package/obj/template/.claude/hooks/memory_stop.sh +173 -0
- package/obj/template/.claude/hooks/plantuml_syntax_guard.sh +161 -0
- package/obj/template/.claude/hooks/process_lifecycle_guard.sh +89 -0
- package/obj/template/.claude/hooks/setup_guard.sh +50 -0
- package/obj/template/.claude/hooks/spec_approval_guard.sh +81 -0
- package/obj/template/.claude/hooks/spec_design_calls_guard.sh +183 -0
- package/obj/template/.claude/hooks/spec_diagram_presence_guard.sh +141 -0
- package/obj/template/.claude/hooks/swarm_approval_guard.sh +39 -0
- package/obj/template/.claude/hooks/swarm_boundary_guard.sh +136 -0
- package/obj/template/.claude/hooks/tdd_order_guard.sh +176 -0
- package/obj/template/.claude/hooks/test_runner.sh +75 -0
- package/obj/template/.claude/hooks/tests/fixtures/ac008_byte_equal_reference.txt +12 -0
- package/obj/template/.claude/hooks/tests/memory_session_start_test.sh +285 -0
- package/obj/template/.claude/hooks/track_guard.sh +127 -0
- package/obj/template/.claude/hooks/verify_pass_guard.sh +88 -0
- package/obj/template/.claude/memory/README.md +108 -0
- package/obj/template/.claude/memory/_pending.md +15 -0
- package/obj/template/.claude/memory/_resume.md +12 -0
- package/obj/template/.claude/memory/conventions.md +26 -0
- package/obj/template/.claude/memory/decisions.md +29 -0
- package/obj/template/.claude/memory/landmarks.md +26 -0
- package/obj/template/.claude/memory/landmines.md +27 -0
- package/obj/template/.claude/memory/libraries.md +27 -0
- package/obj/template/.claude/memory/pending-questions.md +28 -0
- package/obj/template/.claude/project.json +221 -0
- package/obj/template/.claude/settings.json +110 -0
- package/obj/template/.claude/skills/archive/SKILL.md +48 -0
- package/obj/template/.claude/skills/archive/archive.sh +145 -0
- package/obj/template/.claude/skills/audit-baseline/SKILL.md +80 -0
- package/obj/template/.claude/skills/audit-baseline/audit.sh +919 -0
- package/obj/template/.claude/skills/brd/SKILL.md +44 -0
- package/obj/template/.claude/skills/brd/template.md +83 -0
- package/obj/template/.claude/skills/chore/SKILL.md +99 -0
- package/obj/template/.claude/skills/claude-automation-recommender/LICENSE +202 -0
- package/obj/template/.claude/skills/claude-automation-recommender/NOTICE +69 -0
- package/obj/template/.claude/skills/claude-automation-recommender/SKILL.md +358 -0
- package/obj/template/.claude/skills/claude-automation-recommender/references/hooks-patterns.md +226 -0
- package/obj/template/.claude/skills/claude-automation-recommender/references/mcp-servers.md +263 -0
- package/obj/template/.claude/skills/claude-automation-recommender/references/plugins-reference.md +98 -0
- package/obj/template/.claude/skills/claude-automation-recommender/references/skills-reference.md +408 -0
- package/obj/template/.claude/skills/claude-automation-recommender/references/subagent-templates.md +181 -0
- package/obj/template/.claude/skills/code-structure/SKILL.md +204 -0
- package/obj/template/.claude/skills/commit/SKILL.md +21 -0
- package/obj/template/.claude/skills/copywriting/SKILL.md +252 -0
- package/obj/template/.claude/skills/copywriting/evals/evals.json +111 -0
- package/obj/template/.claude/skills/copywriting/references/ai-writing-detection.md +200 -0
- package/obj/template/.claude/skills/copywriting/references/copy-frameworks.md +344 -0
- package/obj/template/.claude/skills/copywriting/references/natural-transitions.md +272 -0
- package/obj/template/.claude/skills/design-ui/SKILL.md +175 -0
- package/obj/template/.claude/skills/design-ui/references/design-vs-development.md +89 -0
- package/obj/template/.claude/skills/design-ui/references/intent-table.md +64 -0
- package/obj/template/.claude/skills/design-ui/references/orchestration.md +121 -0
- package/obj/template/.claude/skills/design-ui/references/state-machine.md +125 -0
- package/obj/template/.claude/skills/document/SKILL.md +66 -0
- package/obj/template/.claude/skills/documentation/SKILL.md +50 -0
- package/obj/template/.claude/skills/harness/SKILL.md +169 -0
- package/obj/template/.claude/skills/humanizer/SKILL.md +489 -0
- package/obj/template/.claude/skills/humanizer/references/ai-writing-detection.md +208 -0
- package/obj/template/.claude/skills/impeccable/PROJECT_NOTES.md +22 -0
- package/obj/template/.claude/skills/impeccable/SKILL.md +153 -0
- package/obj/template/.claude/skills/impeccable/agents/openai.yaml +4 -0
- package/obj/template/.claude/skills/impeccable/reference/adapt.md +190 -0
- package/obj/template/.claude/skills/impeccable/reference/animate.md +173 -0
- package/obj/template/.claude/skills/impeccable/reference/audit.md +134 -0
- package/obj/template/.claude/skills/impeccable/reference/bolder.md +113 -0
- package/obj/template/.claude/skills/impeccable/reference/brand.md +104 -0
- package/obj/template/.claude/skills/impeccable/reference/clarify.md +174 -0
- package/obj/template/.claude/skills/impeccable/reference/cognitive-load.md +106 -0
- package/obj/template/.claude/skills/impeccable/reference/color-and-contrast.md +105 -0
- package/obj/template/.claude/skills/impeccable/reference/colorize.md +154 -0
- package/obj/template/.claude/skills/impeccable/reference/craft.md +138 -0
- package/obj/template/.claude/skills/impeccable/reference/critique.md +213 -0
- package/obj/template/.claude/skills/impeccable/reference/delight.md +302 -0
- package/obj/template/.claude/skills/impeccable/reference/distill.md +111 -0
- package/obj/template/.claude/skills/impeccable/reference/document.md +427 -0
- package/obj/template/.claude/skills/impeccable/reference/extract.md +70 -0
- package/obj/template/.claude/skills/impeccable/reference/harden.md +347 -0
- package/obj/template/.claude/skills/impeccable/reference/heuristics-scoring.md +234 -0
- package/obj/template/.claude/skills/impeccable/reference/interaction-design.md +195 -0
- package/obj/template/.claude/skills/impeccable/reference/layout.md +141 -0
- package/obj/template/.claude/skills/impeccable/reference/live.md +513 -0
- package/obj/template/.claude/skills/impeccable/reference/motion-design.md +99 -0
- package/obj/template/.claude/skills/impeccable/reference/onboard.md +234 -0
- package/obj/template/.claude/skills/impeccable/reference/optimize.md +258 -0
- package/obj/template/.claude/skills/impeccable/reference/overdrive.md +130 -0
- package/obj/template/.claude/skills/impeccable/reference/personas.md +178 -0
- package/obj/template/.claude/skills/impeccable/reference/polish.md +232 -0
- package/obj/template/.claude/skills/impeccable/reference/product.md +62 -0
- package/obj/template/.claude/skills/impeccable/reference/quieter.md +99 -0
- package/obj/template/.claude/skills/impeccable/reference/responsive-design.md +114 -0
- package/obj/template/.claude/skills/impeccable/reference/shape.md +136 -0
- package/obj/template/.claude/skills/impeccable/reference/spatial-design.md +100 -0
- package/obj/template/.claude/skills/impeccable/reference/teach.md +137 -0
- package/obj/template/.claude/skills/impeccable/reference/typeset.md +124 -0
- package/obj/template/.claude/skills/impeccable/reference/typography.md +159 -0
- package/obj/template/.claude/skills/impeccable/reference/ux-writing.md +107 -0
- package/obj/template/.claude/skills/impeccable/scripts/cleanup-deprecated.mjs +284 -0
- package/obj/template/.claude/skills/impeccable/scripts/command-metadata.json +94 -0
- package/obj/template/.claude/skills/impeccable/scripts/design-parser.mjs +820 -0
- package/obj/template/.claude/skills/impeccable/scripts/detect-csp.mjs +198 -0
- package/obj/template/.claude/skills/impeccable/scripts/is-generated.mjs +69 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-accept.mjs +465 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-browser.js +4684 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-inject.mjs +436 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-poll.mjs +187 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-server.mjs +679 -0
- package/obj/template/.claude/skills/impeccable/scripts/live-wrap.mjs +395 -0
- package/obj/template/.claude/skills/impeccable/scripts/live.mjs +247 -0
- package/obj/template/.claude/skills/impeccable/scripts/load-context.mjs +93 -0
- package/obj/template/.claude/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/obj/template/.claude/skills/impeccable/scripts/pin.mjs +214 -0
- package/obj/template/.claude/skills/implement/SKILL.md +83 -0
- package/obj/template/.claude/skills/intake/SKILL.md +46 -0
- package/obj/template/.claude/skills/intake/template.md +61 -0
- package/obj/template/.claude/skills/integrate/SKILL.md +62 -0
- package/obj/template/.claude/skills/memory-flush/SKILL.md +172 -0
- package/obj/template/.claude/skills/memory-flush/sweep.py +286 -0
- package/obj/template/.claude/skills/memory-flush/tests/run.sh +327 -0
- package/obj/template/.claude/skills/prose/SKILL.md +119 -0
- package/obj/template/.claude/skills/rca/SKILL.md +42 -0
- package/obj/template/.claude/skills/rca/template.md +83 -0
- package/obj/template/.claude/skills/research/SKILL.md +75 -0
- package/obj/template/.claude/skills/scenario/SKILL.md +64 -0
- package/obj/template/.claude/skills/scout/SKILL.md +72 -0
- package/obj/template/.claude/skills/security/SKILL.md +75 -0
- package/obj/template/.claude/skills/simplify/SKILL.md +67 -0
- package/obj/template/.claude/skills/spec/SKILL.md +69 -0
- package/obj/template/.claude/skills/spec/template.md +274 -0
- package/obj/template/.claude/skills/spec-diagram-review/SKILL.md +81 -0
- package/obj/template/.claude/skills/spec-lint/SKILL.md +55 -0
- package/obj/template/.claude/skills/spec-lint/lint.sh +218 -0
- package/obj/template/.claude/skills/spec-render/SKILL.md +45 -0
- package/obj/template/.claude/skills/spec-render/render.sh +109 -0
- package/obj/template/.claude/skills/spec-traceability-review/SKILL.md +72 -0
- package/obj/template/.claude/skills/swarm-dispatch/SKILL.md +212 -0
- package/obj/template/.claude/skills/swarm-dispatch/swarm_merge.sh +154 -0
- package/obj/template/.claude/skills/swarm-plan/SKILL.md +90 -0
- package/obj/template/.claude/skills/swarm-plan/validate.sh +181 -0
- package/obj/template/.claude/skills/tdd/SKILL.md +100 -0
- package/obj/template/.claude/skills/technical-tutorials/SKILL.md +569 -0
- package/obj/template/.claude/skills/technical-tutorials/references/audience-context-README.md +53 -0
- package/obj/template/.claude/skills/technical-tutorials/references/audience-context.md +246 -0
- package/obj/template/.claude/skills/technical-tutorials/references/audience-example.md +175 -0
- package/obj/template/.claude/skills/technical-tutorials/references/audience-template.md +152 -0
- package/obj/template/.claude/skills/triage/SKILL.md +55 -0
- package/obj/template/.claude/skills/verify/SKILL.md +74 -0
- package/obj/template/.mcp.json +24 -0
- package/obj/template/CLAUDE.md +327 -0
- package/obj/template/docs/init/seed.md +585 -0
- package/obj/template/manifest.json +214 -0
- package/package.json +48 -0
- package/src/.mcp.template.json +24 -0
- package/src/.npmrc.template +2 -0
- package/src/CLAUDE.template.md +327 -0
- package/src/agents/swarm-worker.template.md +51 -0
- package/src/cli/conflict.js +31 -0
- package/src/cli/doctor.js +152 -0
- package/src/cli/install.js +93 -0
- package/src/cli/io.js +27 -0
- package/src/cli/manifest.js +38 -0
- package/src/cli/mcp.js +54 -0
- package/src/cli/merge.js +107 -0
- package/src/cli/plantuml.js +121 -0
- package/src/cli/util.js +10 -0
- package/src/memory/_pending.template.md +15 -0
- package/src/memory/_resume.template.md +12 -0
- package/src/memory/conventions.template.md +26 -0
- package/src/memory/decisions.template.md +29 -0
- package/src/memory/landmarks.template.md +26 -0
- package/src/memory/landmines.template.md +27 -0
- package/src/memory/libraries.template.md +27 -0
- package/src/memory/pending-questions.template.md +28 -0
- package/src/project.template.json +221 -0
- package/src/seed.template.md +585 -0
- package/src/settings.template.json +110 -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 2026 Friedbot Studio Private Limited
|
|
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
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="./.github/assets/logo-baseline.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="./.github/assets/logo-baseline.svg">
|
|
6
|
+
<img alt="Claude Code Baseline" src="./.github/assets/logo-baseline.svg" width="160">
|
|
7
|
+
</picture>
|
|
8
|
+
|
|
9
|
+
<br/><br/>
|
|
10
|
+
|
|
11
|
+
# Claude Code Baseline
|
|
12
|
+
|
|
13
|
+
A discipline layer for Claude Code. Hooks at every tool boundary, a workflow that runs from intake to commit, and a small constitution that the agent cannot bypass.
|
|
14
|
+
|
|
15
|
+
<br/>
|
|
16
|
+
|
|
17
|
+
[](LICENSE)
|
|
18
|
+
[](https://github.com/friedbotstudio/baseline/commits/main)
|
|
19
|
+
[](https://github.com/friedbotstudio/baseline/releases)
|
|
20
|
+
[](https://github.com/friedbotstudio/baseline/actions/workflows/release.yml)
|
|
21
|
+
[](https://claude.com/claude-code)
|
|
22
|
+
|
|
23
|
+
[](#installation)
|
|
24
|
+
[](https://baseline.friedbotstudio.com/)
|
|
25
|
+
|
|
26
|
+
<br/>
|
|
27
|
+
|
|
28
|
+
[Overview](#what-this-is) · [Why](#why-this-exists) · [Install](#installation) · [Quickstart](#quickstart) · [Inventory](#what-gets-installed) · [Enforcement](#how-the-enforcement-works) · [Contributing](#contributing)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
> [!WARNING]
|
|
35
|
+
> **Public alpha — under active development.** Expect breaking changes, evolving APIs, and shifting structural counts between releases. The constitution and the consent-gate semantics are stable; specifics in `docs/init/seed.md` §16 may move. Pin to a specific `@friedbotstudio/create-baseline@<version>` for repeatable installs across a team.
|
|
36
|
+
|
|
37
|
+
> [!IMPORTANT]
|
|
38
|
+
> **Install in one line:** `npx @friedbotstudio/create-baseline ./your-project`
|
|
39
|
+
>
|
|
40
|
+
> The CLI fetches the published package, runs the install, and leaves your project with `.claude/`, `CLAUDE.md`, `docs/init/seed.md`, and `.mcp.json`. Re-run with `--merge` to bring an existing install forward; with `--dry-run` to preview without writing; with `doctor` to report drift.
|
|
41
|
+
|
|
42
|
+
## What this is
|
|
43
|
+
|
|
44
|
+
The Claude Code Baseline is a repository overlay shipped via `npx @friedbotstudio/create-baseline ./target`. It installs **22 hooks** at Claude's tool boundaries, **36 skills** organised into nine categories, **1 subagent** for parallel work in isolated worktrees, an **11-phase workflow** from intake to commit, and **3 user-typed consent gates** that Claude cannot forge.
|
|
45
|
+
|
|
46
|
+
Every soft engineering rule a team usually repeats every session — *don't push, don't `--amend`, don't self-approve specs, don't skip phases, don't mock internal modules* — becomes a structural guarantee because the hooks run **outside Claude's tool boundary**. Claude cannot disable a hook with a flag, cannot write a consent marker, cannot reorder the phases without an explicit exception that triage records on disk.
|
|
47
|
+
|
|
48
|
+
The contract is small and traceable. `docs/init/seed.md` is the genesis prompt. `CLAUDE.md` is the in-session constitution. The hooks, skills, commands, and config files are the actuators. Order of precedence is `seed.md > CLAUDE.md > implementation`. Every claim in the docs points at a file you can open.
|
|
49
|
+
|
|
50
|
+
**Read the docs:** <https://baseline.friedbotstudio.com/>
|
|
51
|
+
|
|
52
|
+
## Why this exists
|
|
53
|
+
|
|
54
|
+
Claude Code on a real codebase, used unattended, will eventually do things you do not want — push to main without review, amend a published commit, mock the database in a test, mark a phase complete that never ran, sign off on its own spec. None of these are bugs in Claude Code. They are the absence of an opinion the team already has but has never written down in a way the agent must obey.
|
|
55
|
+
|
|
56
|
+
The baseline is that written-down opinion. It chooses one default for every decision the team would otherwise repeat verbatim every session, and it enforces the default at the layer Claude cannot reach.
|
|
57
|
+
|
|
58
|
+
A team that installs the baseline stops typing *"don't push, don't `--amend`, don't self-approve specs"* and starts trusting that the agent simply cannot.
|
|
59
|
+
|
|
60
|
+
## What gets installed
|
|
61
|
+
|
|
62
|
+
| What | Count | Where it lives |
|
|
63
|
+
|---|---:|---|
|
|
64
|
+
| **Hooks** at PreToolUse / PostToolUse / SessionStart / Stop / PreCompact / UserPromptSubmit | 22 | `.claude/hooks/` |
|
|
65
|
+
| **Skills** across artifact drafting, workflow phases, phase workers, spec helpers, orchestration, memory, audit, alternate tracks, and shared globals | 36 | `.claude/skills/` |
|
|
66
|
+
| **Subagent** — `swarm-worker`, executes pre-decided recipes inside isolated git worktrees | 1 | `.claude/agents/` |
|
|
67
|
+
| **Workflow phases** — intake → scout → research → spec → tdd → simplify → security → integrate → document → archive → commit | 11 | enforced by `track_guard` |
|
|
68
|
+
| **Consent gates** — `/approve-spec`, `/approve-swarm`, `/grant-commit`. User-typed; structurally un-invokable by Claude | 3 | `consent_gate_grant` UserPromptSubmit hook |
|
|
69
|
+
| **MCP servers** declared in `.mcp.json` — `context7` (third-party API docs), `plantuml` (diagram render), `playwright` (cross-engine smoke) | 3 | `.mcp.json` |
|
|
70
|
+
|
|
71
|
+
Every count is asserted by `audit-baseline` against `docs/init/seed.md` on every build. Drift fails CI.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
### Requirements
|
|
76
|
+
|
|
77
|
+
- Node 18.17 or newer (the CLI runs as a Node script)
|
|
78
|
+
- `git` — required for the commit phase, swarm worktrees, and the post-archive consent gate. Workflows on non-git projects auto-except `commit` and end at `/archive`.
|
|
79
|
+
- `java` — optional. Required only for `/spec-render` (PlantUML to SVG). The install fetches a SHA-pinned `plantuml.jar` (~19 MB); you supply the JVM.
|
|
80
|
+
|
|
81
|
+
### One-line install
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Install the baseline into ./your-project
|
|
85
|
+
npx @friedbotstudio/create-baseline ./your-project
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Modes
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Default — install into a fresh or empty target
|
|
92
|
+
npx @friedbotstudio/create-baseline ./your-project
|
|
93
|
+
|
|
94
|
+
# Force-overwrite an existing install (interactive — type 'overwrite')
|
|
95
|
+
npx @friedbotstudio/create-baseline ./your-project --overwrite
|
|
96
|
+
|
|
97
|
+
# Three-way merge against a previously-installed baseline:
|
|
98
|
+
# - adds new baseline files
|
|
99
|
+
# - refreshes baseline files the user has not touched
|
|
100
|
+
# - preserves user-customised files (exit 3 if any)
|
|
101
|
+
# - removes baseline files the upstream removed (only if untouched locally)
|
|
102
|
+
npx @friedbotstudio/create-baseline ./your-project --merge
|
|
103
|
+
|
|
104
|
+
# Preview without writing anything
|
|
105
|
+
npx @friedbotstudio/create-baseline ./your-project --dry-run
|
|
106
|
+
|
|
107
|
+
# Skip the install-time PlantUML jar download
|
|
108
|
+
npx @friedbotstudio/create-baseline ./your-project --no-plantuml
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Doctor
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Report drift between a previously-installed target and its install snapshot.
|
|
115
|
+
# Counts matched / customised / missing / added files.
|
|
116
|
+
# Exit 0 clean, 1 if any baseline file is missing, 2 if no manifest.
|
|
117
|
+
npx @friedbotstudio/create-baseline doctor ./your-project
|
|
118
|
+
|
|
119
|
+
# Strict mode — print TAMPERED: shipped vs observed sha256 for every
|
|
120
|
+
# customised file and exit 1 on any drift.
|
|
121
|
+
npx @friedbotstudio/create-baseline doctor ./your-project --strict
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Quickstart
|
|
125
|
+
|
|
126
|
+
After `npx @friedbotstudio/create-baseline ./your-project`:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cd ./your-project
|
|
130
|
+
|
|
131
|
+
# 1. Configure the project — runs the recommender, asks the questions,
|
|
132
|
+
# flips .claude/project.json from configured: false to true.
|
|
133
|
+
# The setup_guard hook surfaces a one-shot reminder until this runs.
|
|
134
|
+
/init-project
|
|
135
|
+
|
|
136
|
+
# 2. Triage an incoming request — picks the entry phase (intake, spec,
|
|
137
|
+
# tdd, or chore) and writes .claude/state/workflow.json with any
|
|
138
|
+
# exceptions the request needs.
|
|
139
|
+
/triage "your request in plain English"
|
|
140
|
+
|
|
141
|
+
# 3. Run the pipeline. /harness chains every non-gated phase in one
|
|
142
|
+
# invocation; it yields at consent gates so you can review.
|
|
143
|
+
/harness
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The three consent gates pause the workflow until you type the corresponding command:
|
|
147
|
+
|
|
148
|
+
- **`/approve-spec <slug>`** — after the spec phase, before any code is written
|
|
149
|
+
- **`/approve-swarm <slug>`** — after `/swarm-plan`, before parallel dispatch
|
|
150
|
+
- **`/grant-commit`** — after `/archive`, before the commit lands
|
|
151
|
+
|
|
152
|
+
Each gate writes a short-lived consent marker via a UserPromptSubmit hook that runs *before* Claude is invoked on the body. Claude cannot forge the marker; the corresponding write-boundary guard validates it on disk before allowing the approval token through.
|
|
153
|
+
|
|
154
|
+
## How the enforcement works
|
|
155
|
+
|
|
156
|
+
The 22 hooks declared in `.claude/settings.json` fire at every Claude tool boundary — PreToolUse for Bash / Write / Edit / MultiEdit, PostToolUse for the same, plus SessionStart, Stop, PreCompact, and UserPromptSubmit. They run as bash and python3 in a subprocess outside Claude's reach. Their output is JSON; their exit decides whether the tool call proceeds.
|
|
157
|
+
|
|
158
|
+
The architectural rule is simple: **decisions live in main context; subagents only execute pre-decided recipes**. The baseline ships exactly one subagent — `swarm-worker` — and its only sanctioned use is parallel dispatch of fully-specified recipes inside isolated git worktrees during `/swarm-dispatch`. Every other capability that might have been a subagent (code authoring, scenario design, scouting, security review, prose writing, UI design) lives instead as a **skill** that runs in main context with full conversation visibility.
|
|
159
|
+
|
|
160
|
+
The 11-phase workflow is enforced at the write boundary by `track_guard`. Phase ordering is binding; the only mechanism to bypass a phase is the `exceptions` array in `.claude/state/workflow.json`, written by `/triage` at workflow creation time. The chore track is a stripped-down ordering of the same gates, with the test-first phases removed because there is nothing to test-first.
|
|
161
|
+
|
|
162
|
+
The constitution at `CLAUDE.md` is the source of truth for in-session behaviour; `docs/init/seed.md` is the source of truth for the baseline's shape. When the constitution and the implementation conflict, the constitution governs and the implementation gets corrected. When `seed.md` and the constitution conflict, `seed.md` governs and you stop and surface the drift before acting.
|
|
163
|
+
|
|
164
|
+
## Documentation
|
|
165
|
+
|
|
166
|
+
- **Docs site:** <https://baseline.friedbotstudio.com/> — overview, hook reference, skill index, workflow walkthrough, install reference
|
|
167
|
+
- **Constitution:** [`CLAUDE.md`](CLAUDE.md) — the in-session contract that binds Claude in this repository
|
|
168
|
+
- **Genesis:** [`docs/init/seed.md`](docs/init/seed.md) — the governing specification of the baseline
|
|
169
|
+
- **Product brief:** [`PRODUCT.md`](PRODUCT.md) — audience, voice, anti-references
|
|
170
|
+
- **Design system:** [`DESIGN.md`](DESIGN.md) — type, colour, spacing, motion vocabulary for the docs site
|
|
171
|
+
|
|
172
|
+
## Contributing
|
|
173
|
+
|
|
174
|
+
The baseline aims for a small, traceable surface. Contributions that make the structural enforcement *more* reliable — closing a hook gap, tightening a guard, fixing a regex, adding a missing test — land easily. Contributions that grow the surface need a stronger justification.
|
|
175
|
+
|
|
176
|
+
Specifically: the **hook count, skill count, subagent count, command count, and MCP-server count are constitutional**. Any change to those counts requires:
|
|
177
|
+
|
|
178
|
+
1. An amendment to `docs/init/seed.md` §4 first (the genesis prompt)
|
|
179
|
+
2. A matching update in `CLAUDE.md` (the constitution)
|
|
180
|
+
3. The implementation change
|
|
181
|
+
4. A passing `bash .claude/skills/audit-baseline/audit.sh` (which checks all four for drift)
|
|
182
|
+
|
|
183
|
+
The `/triage` skill picks the right track for your contribution. Most one-file fixes are chore-track; anything adding new behaviour goes through intake → spec.
|
|
184
|
+
|
|
185
|
+
Please read [`CODE-OF-CONDUCT.md`](CODE-OF-CONDUCT.md) before opening an issue or PR.
|
|
186
|
+
|
|
187
|
+
## Support and feedback
|
|
188
|
+
|
|
189
|
+
- **Issues:** <https://github.com/friedbotstudio/baseline/issues>
|
|
190
|
+
- **Docs:** <https://baseline.friedbotstudio.com/>
|
|
191
|
+
|
|
192
|
+
## Vulnerability reporting
|
|
193
|
+
|
|
194
|
+
Security disclosures go to **hello@friedbotstudio.com**. See [`SECURITY.md`](SECURITY.md) for the full policy and scope.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
Apache License 2.0. See [`LICENSE`](LICENSE).
|
|
199
|
+
|
|
200
|
+
## About
|
|
201
|
+
|
|
202
|
+
The Claude Code Baseline is built and maintained by [Friedbot Studio](https://friedbotstudio.com). We build infrastructure for AI-augmented engineering teams — discipline layers, evaluation harnesses, audit trails — that make agentic tools usable on production systems.
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><strong>Update history</strong></summary>
|
|
206
|
+
|
|
207
|
+
<br/>
|
|
208
|
+
|
|
209
|
+
**2026-05-14**
|
|
210
|
+
|
|
211
|
+
- `feat(site)` — page-relative URL filter + CNAME for dual-mount Pages deployment ([86cfbc7](https://github.com/friedbotstudio/baseline/commit/86cfbc7))
|
|
212
|
+
- `fix(build)` — seed runtime memory placeholders so `audit-baseline` passes on fresh clones ([829f9cf](https://github.com/friedbotstudio/baseline/commit/829f9cf))
|
|
213
|
+
- `fix(publish-check)` — surface `npm publish --dry-run` stderr on precheck failure ([095cda4](https://github.com/friedbotstudio/baseline/commit/095cda4))
|
|
214
|
+
- `fix(release-workflow)` — correct AC-006 / AC-011 / AC-013 (cache:false fatal + missing build-verify needs edge) ([572fef7](https://github.com/friedbotstudio/baseline/commit/572fef7))
|
|
215
|
+
- `fix(hook)` — `git_commit_guard` regex no longer false-positives on dot-prefixed paths ([064102d](https://github.com/friedbotstudio/baseline/commit/064102d))
|
|
216
|
+
- `chore` — add `.nojekyll` guard + labels-as-code workflow ([f4f514b](https://github.com/friedbotstudio/baseline/commit/f4f514b))
|
|
217
|
+
|
|
218
|
+
**2026-05-13**
|
|
219
|
+
|
|
220
|
+
- Initial commit — Claude Code baseline + release workflow ([0dcf76e](https://github.com/friedbotstudio/baseline/commit/0dcf76e))
|
|
221
|
+
|
|
222
|
+
</details>
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
|
|
8
|
+
import * as io from '../src/cli/io.js';
|
|
9
|
+
import { scanSentinels } from '../src/cli/conflict.js';
|
|
10
|
+
import { freshInstall, forceInstall } from '../src/cli/install.js';
|
|
11
|
+
import { threeWayMerge } from '../src/cli/merge.js';
|
|
12
|
+
import { loadManifest, buildManifestFromDir } from '../src/cli/manifest.js';
|
|
13
|
+
import { fetchPlantumlIfMissing, FETCH_OUTCOMES } from '../src/cli/plantuml.js';
|
|
14
|
+
import { runDoctor, formatReport } from '../src/cli/doctor.js';
|
|
15
|
+
|
|
16
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const PKG_ROOT = resolve(__dirname, '..');
|
|
18
|
+
|
|
19
|
+
const HELP_TEXT = `Usage:
|
|
20
|
+
create-baseline <target> [options] install/merge the baseline
|
|
21
|
+
create-baseline doctor [target] report drift in an installed target
|
|
22
|
+
|
|
23
|
+
Materializes the Claude Code baseline (.claude/, CLAUDE.md, .mcp.json,
|
|
24
|
+
docs/init/seed.md, plus vendored LICENSE/NOTICE) into <target>.
|
|
25
|
+
|
|
26
|
+
Modes:
|
|
27
|
+
(default) Fresh install. Refuses if any sentinel path already present.
|
|
28
|
+
--force Overwrite unconditionally (requires typing 'overwrite' in TTY).
|
|
29
|
+
--merge Three-way merge against existing .baseline-manifest.json.
|
|
30
|
+
Prunes baseline files removed upstream that the user hadn't
|
|
31
|
+
touched; customized stale files are preserved (exit 3).
|
|
32
|
+
--dry-run Print intended actions without writing.
|
|
33
|
+
|
|
34
|
+
Doctor:
|
|
35
|
+
Reads <target>/.claude/.baseline-manifest.json and reports:
|
|
36
|
+
matched / customized / missing / added (compared to install snapshot)
|
|
37
|
+
Exit 0 if no missing files, 1 if any missing, 2 if no manifest.
|
|
38
|
+
--strict Promote customized to exit 1 and prefix tampered paths
|
|
39
|
+
with "TAMPERED:" with shipped vs observed sha256. Detects
|
|
40
|
+
post-install supply-chain tampering of the baseline tree.
|
|
41
|
+
|
|
42
|
+
PlantUML jar (~19 MB, fetched at install time from upstream):
|
|
43
|
+
--no-plantuml Skip the jar download entirely.
|
|
44
|
+
--require-plantuml Treat jar fetch failure (network/sha256) as fatal (exit 4).
|
|
45
|
+
|
|
46
|
+
Misc:
|
|
47
|
+
--help, -h Show this message.
|
|
48
|
+
--version Print version.
|
|
49
|
+
|
|
50
|
+
Exit codes:
|
|
51
|
+
0 success / clean doctor
|
|
52
|
+
1 user abort, conflict-without-force/merge, or doctor reports missing files
|
|
53
|
+
2 argv error, non-TTY where TTY required, or doctor finds no manifest
|
|
54
|
+
3 --merge had skipped customizations (or stale-customized prunes)
|
|
55
|
+
4 --require-plantuml fetch failure
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
async function readPackageVersion() {
|
|
59
|
+
try {
|
|
60
|
+
const pkg = JSON.parse(await readFile(join(PKG_ROOT, 'package.json'), 'utf8'));
|
|
61
|
+
return pkg.version || '0.0.0';
|
|
62
|
+
} catch {
|
|
63
|
+
return '0.0.0';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getTemplateDir() {
|
|
68
|
+
if (process.env.CREATE_BASELINE_TEMPLATE_DIR) return process.env.CREATE_BASELINE_TEMPLATE_DIR;
|
|
69
|
+
// Build output lives at obj/template/ (gitignored, generated by scripts/build-template.sh).
|
|
70
|
+
const candidate = join(PKG_ROOT, 'obj', 'template');
|
|
71
|
+
if (existsSync(candidate)) return candidate;
|
|
72
|
+
throw new Error(`Template directory not found at ${candidate}. Run \`npm run build\` (or rely on prepack).`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function listShippedFiles(templateDir) {
|
|
76
|
+
const files = [];
|
|
77
|
+
const walk = (dir, base) => {
|
|
78
|
+
for (const entry of require('node:fs').readdirSync(dir, { withFileTypes: true })) {
|
|
79
|
+
const full = join(dir, entry.name);
|
|
80
|
+
if (entry.isDirectory()) walk(full, base);
|
|
81
|
+
else if (entry.isFile()) files.push(full.slice(base.length + 1).split(require('node:path').sep).join('/'));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return files;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function main(argv) {
|
|
88
|
+
let parsed;
|
|
89
|
+
try {
|
|
90
|
+
parsed = parseArgs({
|
|
91
|
+
args: argv.slice(2),
|
|
92
|
+
options: {
|
|
93
|
+
help: { type: 'boolean', short: 'h' },
|
|
94
|
+
version: { type: 'boolean' },
|
|
95
|
+
force: { type: 'boolean' },
|
|
96
|
+
merge: { type: 'boolean' },
|
|
97
|
+
'dry-run': { type: 'boolean' },
|
|
98
|
+
'no-plantuml': { type: 'boolean' },
|
|
99
|
+
'require-plantuml': { type: 'boolean' },
|
|
100
|
+
strict: { type: 'boolean' },
|
|
101
|
+
},
|
|
102
|
+
strict: true,
|
|
103
|
+
allowPositionals: true,
|
|
104
|
+
});
|
|
105
|
+
} catch (err) {
|
|
106
|
+
io.error(err.message);
|
|
107
|
+
return 2;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const { values, positionals } = parsed;
|
|
111
|
+
|
|
112
|
+
if (values.help) {
|
|
113
|
+
io.log(HELP_TEXT);
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
if (values.version) {
|
|
117
|
+
io.log(await readPackageVersion());
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// `doctor` subcommand: read-only drift check against an installed target's manifest.
|
|
122
|
+
if (positionals[0] === 'doctor') {
|
|
123
|
+
const target = resolve(positionals[1] ?? '.');
|
|
124
|
+
const report = await runDoctor(target, { strict: !!values.strict });
|
|
125
|
+
io.log(formatReport(report));
|
|
126
|
+
return report.exitCode;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (values.force && values.merge) {
|
|
130
|
+
io.error('--force and --merge are mutually exclusive');
|
|
131
|
+
return 2;
|
|
132
|
+
}
|
|
133
|
+
if (values['no-plantuml'] && values['require-plantuml']) {
|
|
134
|
+
io.error('--no-plantuml and --require-plantuml are mutually exclusive');
|
|
135
|
+
return 2;
|
|
136
|
+
}
|
|
137
|
+
if (positionals.length === 0) {
|
|
138
|
+
io.error('missing required <target> argument');
|
|
139
|
+
io.error(HELP_TEXT);
|
|
140
|
+
return 2;
|
|
141
|
+
}
|
|
142
|
+
if (positionals.length > 1) {
|
|
143
|
+
io.error(`unexpected positional arguments: ${positionals.slice(1).join(', ')}`);
|
|
144
|
+
return 2;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const target = resolve(positionals[0]);
|
|
148
|
+
const dryRun = !!values['dry-run'];
|
|
149
|
+
|
|
150
|
+
let templateDir;
|
|
151
|
+
try {
|
|
152
|
+
templateDir = getTemplateDir();
|
|
153
|
+
} catch (err) {
|
|
154
|
+
io.error(err.message);
|
|
155
|
+
return 2;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const sentinels = await scanSentinels(target);
|
|
159
|
+
const hasConflict = sentinels.length > 0;
|
|
160
|
+
|
|
161
|
+
if (hasConflict && !values.force && !values.merge) {
|
|
162
|
+
io.error(`existing baseline detected at ${target}: ${sentinels.join(', ')}`);
|
|
163
|
+
io.error('pass --force to overwrite or --merge to three-way merge');
|
|
164
|
+
return 1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (values.force) {
|
|
168
|
+
if (!process.stdin.isTTY) {
|
|
169
|
+
io.error('--force requires an interactive TTY for the confirmation prompt');
|
|
170
|
+
return 2;
|
|
171
|
+
}
|
|
172
|
+
if (!dryRun) {
|
|
173
|
+
const answer = await io.ask("type 'overwrite' to proceed: ");
|
|
174
|
+
if (answer.toLowerCase() !== 'overwrite') {
|
|
175
|
+
io.error('confirmation declined');
|
|
176
|
+
return 1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (values.merge) {
|
|
182
|
+
if (!process.stdin.isTTY && !dryRun) {
|
|
183
|
+
io.error('--merge requires an interactive TTY for the confirmation prompt');
|
|
184
|
+
return 2;
|
|
185
|
+
}
|
|
186
|
+
if (!dryRun) {
|
|
187
|
+
const answer = await io.ask("type 'merge' to proceed: ");
|
|
188
|
+
if (answer.toLowerCase() !== 'merge') {
|
|
189
|
+
io.error('confirmation declined');
|
|
190
|
+
return 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let exitCode = 0;
|
|
196
|
+
try {
|
|
197
|
+
if (values.merge) {
|
|
198
|
+
const oldManifest = await loadManifest(join(target, '.claude/.baseline-manifest.json'));
|
|
199
|
+
const tplFiles = listShippedFiles(templateDir);
|
|
200
|
+
const newManifest = await buildManifestFromDir(templateDir, tplFiles);
|
|
201
|
+
if (dryRun) {
|
|
202
|
+
io.log(`Would merge ${tplFiles.length} files into ${target}`);
|
|
203
|
+
} else {
|
|
204
|
+
const report = await threeWayMerge(templateDir, target, oldManifest, newManifest);
|
|
205
|
+
for (const a of report.actions) {
|
|
206
|
+
io.log(`${a.kind.padEnd(24)} ${a.path}`);
|
|
207
|
+
}
|
|
208
|
+
exitCode = report.exitCode;
|
|
209
|
+
}
|
|
210
|
+
} else if (values.force) {
|
|
211
|
+
if (dryRun) io.log(`Would force-install into ${target}`);
|
|
212
|
+
else await forceInstall(templateDir, target);
|
|
213
|
+
} else {
|
|
214
|
+
if (dryRun) io.log(`Would fresh-install into ${target}`);
|
|
215
|
+
else await freshInstall(templateDir, target);
|
|
216
|
+
}
|
|
217
|
+
} catch (err) {
|
|
218
|
+
io.error(`install failed: ${err.message}`);
|
|
219
|
+
return 1;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!dryRun) {
|
|
223
|
+
const fetchResult = await fetchPlantumlIfMissing(target, {
|
|
224
|
+
noPlantuml: values['no-plantuml'],
|
|
225
|
+
requirePlantuml: values['require-plantuml'],
|
|
226
|
+
});
|
|
227
|
+
if (fetchResult.outcome === FETCH_OUTCOMES.WARNED_NETWORK_FAILURE
|
|
228
|
+
|| fetchResult.outcome === FETCH_OUTCOMES.WARNED_HASH_MISMATCH) {
|
|
229
|
+
io.warn(`PlantUML jar fetch failed (${fetchResult.reason}); install continued. Retry with --require-plantuml or set system plantuml on PATH.`);
|
|
230
|
+
} else if (fetchResult.outcome === FETCH_OUTCOMES.ERRORED_REQUIRE_PLANTUML) {
|
|
231
|
+
io.error(`--require-plantuml: ${fetchResult.reason}`);
|
|
232
|
+
return 4;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!dryRun && exitCode === 0) {
|
|
237
|
+
io.log(`Installed manifest version 1 to ${target}.`);
|
|
238
|
+
io.log(`Pin via "@friedbotstudio/create-baseline@<exact-version>" in your bootstrap docs.`);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return exitCode;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
main(process.argv).then((code) => { process.exit(code); }).catch((err) => {
|
|
245
|
+
process.stderr.write(`fatal: ${err.stack || err.message}\n`);
|
|
246
|
+
process.exit(2);
|
|
247
|
+
});
|