@yeison.restrepo.r/code-conductor 1.23.3 → 1.30.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 +21 -185
- package/README.md +72 -15
- package/bin/code-conductor.mjs +6 -5
- package/global/CLAUDE.md +2 -0
- package/global/hooks/graphify-ast-refresh.mjs +91 -0
- package/global/settings.json +0 -13
- package/lib/installer/config.mjs +0 -8
- package/lib/installer/deploy.mjs +120 -19
- package/lib/installer/file-merge.mjs +87 -0
- package/lib/installer/host-owned.mjs +94 -0
- package/lib/installer/merge-md.mjs +168 -0
- package/lib/installer/settings-merge.mjs +118 -0
- package/lib/installer/settings.mjs +46 -11
- package/package.json +1 -1
- package/project-template/.claude/commands/cc-init.md +50 -18
- package/project-template/.claude/commands/cc-plan.md +114 -1
- package/project-template/.claude/hooks/pre-tool-use.mjs +509 -0
- package/project-template/.claude/settings.json +2 -2
- package/project-template/CLAUDE.md +5 -1
- package/project-template/gitignore +3 -0
- package/scripts/claude-md-fields.mjs +42 -0
- package/scripts/conductor-db.mjs +92 -0
- package/scripts/detect-stack.mjs +5 -1
- package/scripts/init-wizard.mjs +195 -0
- package/skills/{code-simplifier.md → code-simplifier/SKILL.md} +6 -0
- package/skills/{verbosity.md → verbosity/SKILL.md} +6 -0
- package/project-template/.claude/hooks/pre-tool-use.sh +0 -81
- /package/skills/{agent-delegation.md → agent-delegation/SKILL.md} +0 -0
- /package/skills/{critical-review.md → critical-review/SKILL.md} +0 -0
- /package/skills/{memory-first.md → memory-first/SKILL.md} +0 -0
package/LICENSE
CHANGED
|
@@ -1,185 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship made available under
|
|
36
|
-
the License, as indicated by a copyright notice that is included in
|
|
37
|
-
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
-
|
|
39
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
-
form, that is based on (or derived from) the Work and for which the
|
|
41
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
-
of this License, Derivative Works shall not include works that remain
|
|
44
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
-
the Work and derivative works thereof.
|
|
46
|
-
|
|
47
|
-
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
-
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
-
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
-
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
-
or written communication sent to the Licensor or its representatives,
|
|
52
|
-
including but not limited to communication on electronic mailing lists,
|
|
53
|
-
source code control systems, and issue tracking systems that are managed
|
|
54
|
-
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
55
|
-
improving the Work, but excluding communication that is conspicuously
|
|
56
|
-
marked or otherwise designated in writing by the copyright owner as
|
|
57
|
-
"Not a Contribution."
|
|
58
|
-
|
|
59
|
-
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
-
whom a Contribution has been received by the Licensor and subsequently
|
|
61
|
-
incorporated within the Work.
|
|
62
|
-
|
|
63
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
-
Work and such Derivative Works in Source or Object form.
|
|
69
|
-
|
|
70
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
-
(except as stated in this section) patent license to make, have made,
|
|
74
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
-
where such license applies only to those patent claims licensable
|
|
76
|
-
by such Contributor that are necessarily infringed by their
|
|
77
|
-
Contribution(s) alone or by combination of their Contributions
|
|
78
|
-
with the Work to which such Contributions were submitted. If You
|
|
79
|
-
institute patent litigation against any entity (including a cross-claim
|
|
80
|
-
or counterclaim in a lawsuit) alleging that the Work or any
|
|
81
|
-
Contribution incorporated within the Work constitutes direct or
|
|
82
|
-
contributory patent infringement, then any patent licenses granted
|
|
83
|
-
to You under this License for that Work shall terminate as of the
|
|
84
|
-
date such litigation is filed.
|
|
85
|
-
|
|
86
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
-
modifications, and in Source or Object form, provided that You
|
|
89
|
-
meet the following conditions:
|
|
90
|
-
|
|
91
|
-
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
-
Works a copy of this License; and
|
|
93
|
-
|
|
94
|
-
(b) You must cause any modified files to carry prominent notices
|
|
95
|
-
stating that You changed the files; and
|
|
96
|
-
|
|
97
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
-
that You distribute, all copyright, patent, trademark, and
|
|
99
|
-
attribution notices from the Source form of the Work,
|
|
100
|
-
excluding those notices that do not pertain to any part of
|
|
101
|
-
the Derivative Works; and
|
|
102
|
-
|
|
103
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
-
distribution, You must include a readable copy of the
|
|
105
|
-
attribution notices contained within such NOTICE file, in
|
|
106
|
-
at least one of the following places: within a NOTICE text
|
|
107
|
-
file distributed as part of the Derivative Works; within
|
|
108
|
-
the Source form or documentation, if provided along with the
|
|
109
|
-
Derivative Works; or, within a display generated by the
|
|
110
|
-
Derivative Works, if and wherever such third-party notices
|
|
111
|
-
normally appear. The contents of the NOTICE file are for
|
|
112
|
-
informational purposes only and do not modify the License.
|
|
113
|
-
You may add Your own attribution notices within Derivative
|
|
114
|
-
Works that You distribute, alongside or as an additional
|
|
115
|
-
addendum to the NOTICE text from the Work, provided that
|
|
116
|
-
such additional attribution notices cannot be construed
|
|
117
|
-
as modifying the License.
|
|
118
|
-
|
|
119
|
-
You may add Your own license statement for Your modifications and
|
|
120
|
-
may provide additional grant of rights to use, copy, modify, merge,
|
|
121
|
-
publish, distribute, sublicense, and/or sell copies of the
|
|
122
|
-
Derivative Works, and to permit persons to whom the Derivative Works
|
|
123
|
-
are furnished to do so.
|
|
124
|
-
|
|
125
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
126
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
127
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
128
|
-
this License, without any additional terms or conditions.
|
|
129
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
130
|
-
the terms of any separate license agreement you may have executed
|
|
131
|
-
with Licensor regarding such Contributions.
|
|
132
|
-
|
|
133
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
134
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
135
|
-
except as required for reasonable and customary use in describing the
|
|
136
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
137
|
-
|
|
138
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
139
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
140
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
141
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
142
|
-
implied, including, without limitation, any conditions of title,
|
|
143
|
-
merchantability, or fitness for a particular purpose. You are
|
|
144
|
-
solely responsible for determining the appropriateness of using
|
|
145
|
-
or redistributing the Work and assume any risks associated with
|
|
146
|
-
Your exercise of permissions under this License.
|
|
147
|
-
|
|
148
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
149
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
150
|
-
unless required by applicable law (such as deliberate and grossly
|
|
151
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
152
|
-
liable to You for damages, including any direct, indirect, special,
|
|
153
|
-
incidental, or exemplary damages of any character arising as a
|
|
154
|
-
result of this License or out of the use or inability to use the
|
|
155
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
156
|
-
work stoppage, computer failure or malfunction, or all other
|
|
157
|
-
commercial damages or losses), even if such Contributor has been
|
|
158
|
-
advised of the possibility of such damages.
|
|
159
|
-
|
|
160
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
161
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
162
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
163
|
-
or other liability obligations and/or rights consistent with this
|
|
164
|
-
License. However, in accepting such obligations, You may act only
|
|
165
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
166
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
167
|
-
defend, and hold each Contributor harmless for any liability
|
|
168
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
169
|
-
of your accepting any warranty or additional liability.
|
|
170
|
-
|
|
171
|
-
END OF TERMS AND CONDITIONS
|
|
172
|
-
|
|
173
|
-
Copyright 2026 Yeison Restrepo
|
|
174
|
-
|
|
175
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
176
|
-
you may not use this file except in compliance with the License.
|
|
177
|
-
You may obtain a copy of the License at
|
|
178
|
-
|
|
179
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
180
|
-
|
|
181
|
-
Unless required by applicable law or agreed to in writing, software
|
|
182
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
183
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
184
|
-
implied. See the License for the specific language governing
|
|
185
|
-
permissions and limitations under the License.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2026 The Bootstrap Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# code-conductor
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@yeison.restrepo.r/code-conductor)
|
|
4
|
-
[](LICENSE)
|
|
4
|
+
[](https://github.com/yeisonrestrepo/code-conductor/blob/main/LICENSE)
|
|
5
5
|
[](https://github.com/yeisonrestrepo/code-conductor/issues)
|
|
6
6
|
|
|
7
7
|
A spec-first, token-efficient Claude Code configuration that turns AI-assisted coding into a disciplined, repeatable engineering workflow.
|
|
@@ -172,19 +172,27 @@ Hooks run automatically at specific points in a Claude Code session. They requir
|
|
|
172
172
|
|
|
173
173
|
### graphify-ast-refresh *(global)*
|
|
174
174
|
|
|
175
|
-
Fires on every `UserPromptSubmit`.
|
|
175
|
+
Fires on every `UserPromptSubmit`. A small Node wrapper (`graphify-ast-refresh.mjs`) checks whether `graphify-out/.graphify_ast_done` is fresh (default: 60 min, override with `GRAPHIFY_STALE_MINUTES`). If it is stale or missing, the wrapper looks for a `python3` or `python` on `PATH` (override with `GRAPHIFY_PYTHON`) and spawns the Python payload (`graphify-ast-refresh.py`) in the background to run file detection and AST extraction - no LLM calls, no tokens. The main session inherits a ready graph without paying the generation cost.
|
|
176
176
|
|
|
177
|
-
Works on Windows, Linux, and macOS
|
|
177
|
+
Node hosts the check because Python is what is being probed: on a machine with no Python the wrapper exits 0 in silence rather than printing an interpreter error on every prompt. Set `CC_GRAPHIFY_DEBUG=1` to see the one line it would otherwise swallow. Works on Windows, Linux, and macOS, and returns immediately when the graph is current.
|
|
178
178
|
|
|
179
179
|
### pre-tool-use
|
|
180
180
|
|
|
181
|
-
Fires before
|
|
181
|
+
Fires before `Read`, `Write`, `Edit`, `create_file`, `write_file` and `Bash`. A single zero-dependency Node front door (`pre-tool-use.mjs`) reads the `PreToolUse` payload from stdin, dispatches on `tool_name`, and returns its verdict as `hookSpecificOutput.permissionDecision`. Every path exits 0: a denial is data, never an exit code.
|
|
182
182
|
|
|
183
|
-
**Large-file Read guard
|
|
183
|
+
**Large-file Read guard (Guard 1)** - a `Read` of a file over 150 lines that names no `limit` is denied, and the reason redirects Claude to the orchestrator lookup chain (memory, graph, grep, targeted read). Prevents reading entire codebases when a targeted search would do.
|
|
184
184
|
|
|
185
|
-
**Duplicate file guard
|
|
185
|
+
**Duplicate file guard (Guard 2)** - a `Write`, `create_file` or `write_file` naming a path that already exists returns `ask`, showing the path, line count and last-modified timestamp with three options: edit in place, confirm the overwrite, or cancel. `Edit` is deliberately not gated, because editing in place is the action this guard recommends.
|
|
186
186
|
|
|
187
|
-
**Bash scan guard (Guard 3)**
|
|
187
|
+
**Bash scan guard (Guard 3)** - every `Bash` command is matched against twelve mass content-dump patterns before it runs: deep `find` without `-maxdepth 1`, `find -exec` with readers or shells, `xargs` with readers, `cat` or a pager followed by an unquoted glob, command substitution as a reader's argument, `grep -r` with a match-all pattern, `ls -R`, shell loops, `mapfile` and `readarray`, `eval`, `source` and the dot operator, alias remapping to a reader, and obfuscation sequences. Commands over 8192 characters and unclosed quotes are denied fail-closed.
|
|
188
|
+
|
|
189
|
+
Permanent exceptions live in `.claude/memory/bash-scan-allowlist.txt`, one entry per line, blank lines and `#` comments ignored and whitespace trimmed. An entry ending in `/` covers paths under that prefix, rejecting any suffix that walks up the tree with `..`; any other entry matches a whole command token. **Entries match literally: regex metacharacters carry no special meaning, so `file.ts` matches `file.ts` and nothing else.** The installer never ships or overwrites this file. Every line in it disarms patterns for matching commands, so give each entry a comment saying why it exists; an uncommented entry is a review smell.
|
|
190
|
+
|
|
191
|
+
Hit a block you believe is wrong? Re-run the command with `CC_GUARD3_WARN=1` and the guard asks instead of denying, carrying the same pattern ids. That is a triage aid for reporting a false positive while you keep working, not a configuration mode: the allowlist is the sanctioned permanent exception. The variable affects Guard 3 alone.
|
|
192
|
+
|
|
193
|
+
**graphify-out and node_modules guard (Guard 4)** - a `Read` whose path carries `graphify-out` or `node_modules` as an exact path component is denied, with backslashes and `..` resolved first. Use Glob for existence checks and the graphify skill for graph questions.
|
|
194
|
+
|
|
195
|
+
Input the hook cannot parse fails closed: it is denied with one stderr line naming `CC_HOOK_ALLOW=1`, which overrides that denial alone and leaves every guard fully active on every payload the hook can read. Set `CC_HOOK_DEBUG=1` to see the diagnostic lines it otherwise swallows.
|
|
188
196
|
|
|
189
197
|
### context-guard *(global + project)* — v1.15.0
|
|
190
198
|
|
|
@@ -276,11 +284,13 @@ code-conductor/
|
|
|
276
284
|
│ │ ├── cc-stack.md /cc-stack
|
|
277
285
|
│ │ └── cc-lang.md /cc-lang
|
|
278
286
|
│ ├── hooks/
|
|
287
|
+
│ │ ├── graphify-ast-refresh.mjs Node wrapper: freshness + interpreter check
|
|
279
288
|
│ │ └── graphify-ast-refresh.py Background AST refresh on UserPromptSubmit
|
|
280
289
|
│ └── memory/
|
|
281
290
|
│ └── personal.md Template (never committed)
|
|
282
291
|
├── project-template/
|
|
283
292
|
│ ├── CLAUDE.md
|
|
293
|
+
│ ├── gitignore Merged into the host project's .gitignore
|
|
284
294
|
│ └── .claude/
|
|
285
295
|
│ ├── settings.json Hooks wiring (pre-tool-use, post-compact)
|
|
286
296
|
│ ├── commands/
|
|
@@ -296,7 +306,7 @@ code-conductor/
|
|
|
296
306
|
│ │ ├── cc-test.md /cc-test
|
|
297
307
|
│ │ └── cc-docs.md /cc-docs
|
|
298
308
|
│ ├── hooks/
|
|
299
|
-
│ │ ├── pre-tool-use.
|
|
309
|
+
│ │ ├── pre-tool-use.mjs Node front door: large-file, duplicate-write and graphify-out guards
|
|
300
310
|
│ │ ├── context-guard.sh Turn-counter warning (.sh + .ps1)
|
|
301
311
|
│ │ └── post-compact.sh Checkpoint reminder + cache sweep after `/compact` (.sh + .ps1)
|
|
302
312
|
│ └── memory/
|
|
@@ -309,11 +319,12 @@ code-conductor/
|
|
|
309
319
|
│ ├── session-id.mjs Stable session-id resolver
|
|
310
320
|
│ └── detect-stack.mjs Stack auto-detection scanner
|
|
311
321
|
└── skills/
|
|
312
|
-
├── code-simplifier.md
|
|
313
|
-
├── critical-review.md
|
|
314
|
-
├── verbosity.md
|
|
315
|
-
├── memory-first.md
|
|
316
|
-
└── agent-delegation.md
|
|
322
|
+
├── code-simplifier/SKILL.md Always active — complexity and simplicity rules
|
|
323
|
+
├── critical-review/SKILL.md Always active — 4-phase adversarial review protocol
|
|
324
|
+
├── verbosity/SKILL.md Always active — MIN/INFO/VERBOSE response rules
|
|
325
|
+
├── memory-first/SKILL.md Always active — memory → graph → grep → read chain
|
|
326
|
+
└── agent-delegation/SKILL.md Always active — sub-agent spawn rules
|
|
327
|
+
# Claude Code registers personal skills only at ~/.claude/skills/<name>/SKILL.md
|
|
317
328
|
# ui-ux-pro-max installed from github.com/nextlevelbuilder/ui-ux-pro-max-skill
|
|
318
329
|
```
|
|
319
330
|
|
|
@@ -321,7 +332,53 @@ code-conductor/
|
|
|
321
332
|
|
|
322
333
|
## .gitignore Note
|
|
323
334
|
|
|
324
|
-
When installed with `--project`, the installer appends
|
|
335
|
+
When installed with `--project`, the installer appends these rules to your project's
|
|
336
|
+
`.gitignore`, and only the ones you are missing — your own entries are never touched:
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
.claude/memory/turn-count.txt
|
|
340
|
+
*.installer-backup.*
|
|
341
|
+
*.installer-tmp.*
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The last two keep the installer's own backups and crash-stranded temp files out of
|
|
345
|
+
`git status`. The rules ship inside the package as `project-template/gitignore`
|
|
346
|
+
(no leading dot) because npm strips any file literally named `.gitignore` from every
|
|
347
|
+
published tarball; the installer restores the dot when it writes to your project.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## How the installer treats your CLAUDE.md
|
|
352
|
+
|
|
353
|
+
`CLAUDE.md` and `.gitignore` are **merged**, never overwritten. Everything else the
|
|
354
|
+
installer ships (`settings.json`, hooks, commands, `scripts/`) is replaced on every run.
|
|
355
|
+
|
|
356
|
+
- **Managed sections** live between `<!-- cc:managed:start -->` and `<!-- cc:managed:end -->`.
|
|
357
|
+
Code Conductor owns that block and replaces its contents wholesale on every upgrade, so
|
|
358
|
+
released improvements reach existing installs. Edits inside the block are lost.
|
|
359
|
+
- **Everything outside the block is yours.** Existing sections are preserved byte-for-byte;
|
|
360
|
+
sections the template has and your file lacks are appended once, immediately above the
|
|
361
|
+
managed block. Sections you wrote that the template has never heard of are never touched.
|
|
362
|
+
- **Before any change, the installer copies your file to
|
|
363
|
+
`CLAUDE.md.installer-backup.<UTC timestamp>`** and keeps the five most recent.
|
|
364
|
+
|
|
365
|
+
> **One-time migration on your first 1.24 install.** If your `CLAUDE.md` predates the
|
|
366
|
+
> sentinel markers and already contains sections that the managed block also defines
|
|
367
|
+
> (`## Agent Identity`, `## Hard Constraints`, …), **those sections are removed** and
|
|
368
|
+
> replaced by the managed block, so you do not end up with two copies of each. This is the
|
|
369
|
+
> only path that discards content you wrote. **Your pre-migration file is preserved in the
|
|
370
|
+
> `.installer-backup.` copy beside it** — diff it after upgrading and move anything you
|
|
371
|
+
> want to keep into a section outside the managed block.
|
|
372
|
+
|
|
373
|
+
> **A cosmetic wart of that same migration, in `~/.claude/CLAUDE.md` only.** The managed
|
|
374
|
+
> block carries the file's intro sentence ("Applies to every project on this machine…"),
|
|
375
|
+
> and your pre-sentinel copy keeps its own above the block, so you will see that one
|
|
376
|
+
> sentence twice after the first upgrade. Delete the copy above the block — it is outside
|
|
377
|
+
> the managed region, so your deletion sticks.
|
|
378
|
+
|
|
379
|
+
If the markers in your file are damaged — a `start` with no `end`, two blocks, an `end`
|
|
380
|
+
before its `start` — the installer prints a warning, leaves the file completely untouched,
|
|
381
|
+
and finishes the rest of the install. Fix the markers and re-run.
|
|
325
382
|
|
|
326
383
|
---
|
|
327
384
|
|
|
@@ -330,4 +387,4 @@ When installed with `--project`, the installer appends `.claude/memory/personal.
|
|
|
330
387
|
> **`git revert` in non-repository environments (CI/CD, Docker, bare installs):**
|
|
331
388
|
> Uninstall steps that use `git checkout <tag>` or `git revert <sha>` require a git working tree. In CI/CD pipelines, Docker containers, or directories that are not git repositories, these commands will fail with `fatal: not a git repository`. This is expected and non-fatal.
|
|
332
389
|
>
|
|
333
|
-
> **In non-repo environments:** manually delete or restore `skills/verbosity.md` and remove the `verbosity-remind` entry from `~/.claude/settings.json`. Hook removal (`rm ~/.claude/hooks/verbosity-remind.sh`) and `settings.json` cleanup work identically in all environments — no git is required.
|
|
390
|
+
> **In non-repo environments:** manually delete or restore `skills/verbosity/SKILL.md` and remove the `verbosity-remind` entry from `~/.claude/settings.json`. Hook removal (`rm ~/.claude/hooks/verbosity-remind.sh`) and `settings.json` cleanup work identically in all environments — no git is required.
|
package/bin/code-conductor.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import { readFileSync, realpathSync } from 'node:fs';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { resolveAssetRoot, resolveHome, nodeMajorAtLeast } from '../lib/installer/env.mjs';
|
|
6
|
-
import { assertAssets, deployGlobal, deployProject, chmodHooks } from '../lib/installer/deploy.mjs';
|
|
7
|
-
import { verbosityHookCommand, mergeVerbosityHook } from '../lib/installer/settings.mjs';
|
|
8
|
-
import { writeVerbosity,
|
|
6
|
+
import { assertAssets, assertMergeTargets, deployGlobal, deployProject, chmodHooks } from '../lib/installer/deploy.mjs';
|
|
7
|
+
import { verbosityHookCommand, mergeVerbosityHook, graphifyHookCommand, mergeGraphifyHook } from '../lib/installer/settings.mjs';
|
|
8
|
+
import { writeVerbosity, writeVersionFile } from '../lib/installer/config.mjs';
|
|
9
9
|
|
|
10
10
|
const USAGE = `Usage: code-conductor [--project] [--verbosity MIN|INFO|VERBOSE] [--version] [--help]`;
|
|
11
11
|
|
|
@@ -88,15 +88,16 @@ export function run(argv, env = process.env, { cwd = process.cwd(), log } = {})
|
|
|
88
88
|
let writing = false;
|
|
89
89
|
try {
|
|
90
90
|
assertAssets(assetRoot, ['global', 'skills', 'scripts', 'project-template']); // pre-flight
|
|
91
|
+
assertMergeTargets(home, cwd, opts.project); // pre-flight
|
|
91
92
|
writing = true; // copy phase begins
|
|
92
93
|
const claudeDir = deployGlobal(assetRoot, home);
|
|
93
94
|
chmodHooks(claudeDir);
|
|
94
|
-
seedMemoryFile(home, 'personal.md', assetRoot);
|
|
95
95
|
const v = writeVerbosity(home, assetRoot, opts.verbosity, opts.verbosityGiven);
|
|
96
96
|
if (v.warn) emit('stderr', v.warn);
|
|
97
97
|
mergeVerbosityHook(join(claudeDir, 'settings.json'), verbosityHookCommand(home));
|
|
98
|
+
mergeGraphifyHook(join(claudeDir, 'settings.json'), graphifyHookCommand(home));
|
|
98
99
|
writeVersionFile(home, pkgVersion(assetRoot));
|
|
99
|
-
if (opts.project) deployProject(assetRoot, cwd);
|
|
100
|
+
if (opts.project) deployProject(assetRoot, cwd, { warn: (m) => emit('stderr', m) });
|
|
100
101
|
return 0;
|
|
101
102
|
} catch (err) {
|
|
102
103
|
// Pre-flight failures (nothing written yet) → exit 1.
|
package/global/CLAUDE.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Global Claude Configuration
|
|
2
2
|
|
|
3
|
+
<!-- cc:managed:start -->
|
|
3
4
|
Applies to every project on this machine. Project CLAUDE.md adds project-specific overrides on top.
|
|
4
5
|
|
|
5
6
|
## Workflow
|
|
@@ -91,3 +92,4 @@ Always tag responses:
|
|
|
91
92
|
## Loaded Profiles
|
|
92
93
|
|
|
93
94
|
`/cc-stack` detects your stack dynamically and writes the detected commands and a generated ruleset into the project `CLAUDE.md`. Never apply one language's conventions to another.
|
|
95
|
+
<!-- cc:managed:end -->
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// UserPromptSubmit hook: Node wrapper over the Python AST-refresh payload.
|
|
3
|
+
//
|
|
4
|
+
// Node hosts the decision because Python is the thing being probed: a Python
|
|
5
|
+
// script cannot report that Python is missing. Every path exits 0 and prints
|
|
6
|
+
// nothing unless CC_GRAPHIFY_DEBUG is set (the CC_VERBOSITY_DEBUG and
|
|
7
|
+
// CC_GUARD4_DEBUG precedent), so a machine without the toolchain is silent.
|
|
8
|
+
|
|
9
|
+
import { statSync, accessSync, constants } from 'node:fs';
|
|
10
|
+
import { spawn } from 'node:child_process';
|
|
11
|
+
import { join, dirname, delimiter } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const PAYLOAD = join(HOOK_DIR, 'graphify-ast-refresh.py');
|
|
16
|
+
|
|
17
|
+
function debug(msg) {
|
|
18
|
+
if (process.env.CC_GRAPHIFY_DEBUG) process.stderr.write(`GRAPHIFY_HOOK: ${msg}\n`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Mirrors the payload's int(os.environ.get("GRAPHIFY_STALE_MINUTES", "60")) and
|
|
22
|
+
// its ValueError fallback. Python's int() accepts surrounding whitespace and a
|
|
23
|
+
// sign and rejects everything else, while parseInt would read "120abc" as 120;
|
|
24
|
+
// the regex keeps the two readers of this variable in agreement.
|
|
25
|
+
function staleMinutes() {
|
|
26
|
+
const raw = process.env.GRAPHIFY_STALE_MINUTES;
|
|
27
|
+
if (typeof raw !== 'string' || !/^\s*[+-]?\d+\s*$/.test(raw)) return 60;
|
|
28
|
+
return Number.parseInt(raw, 10);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isFresh(cwd) {
|
|
32
|
+
try {
|
|
33
|
+
const { mtimeMs } = statSync(join(cwd, 'graphify-out', '.graphify_ast_done'));
|
|
34
|
+
return (Date.now() - mtimeMs) / 60000 < staleMinutes();
|
|
35
|
+
} catch {
|
|
36
|
+
return false; // absent or unreadable sentinel counts as stale
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isExecutableFile(candidate) {
|
|
41
|
+
try {
|
|
42
|
+
if (!statSync(candidate).isFile()) return false;
|
|
43
|
+
accessSync(candidate, constants.X_OK);
|
|
44
|
+
return true;
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// A PATH scan, never an execution: starting an interpreter to learn whether an
|
|
51
|
+
// interpreter exists is the cost this hook is meant to avoid, and it is the
|
|
52
|
+
// reason no negative cache is needed.
|
|
53
|
+
function resolveInterpreter() {
|
|
54
|
+
const override = process.env.GRAPHIFY_PYTHON;
|
|
55
|
+
if (override && isExecutableFile(override)) return override;
|
|
56
|
+
const exts = process.platform === 'win32' ? ['.exe', '.bat', '.cmd'] : [''];
|
|
57
|
+
const dirs = (process.env.PATH || '').split(delimiter).filter(Boolean);
|
|
58
|
+
for (const name of ['python3', 'python']) {
|
|
59
|
+
for (const dir of dirs) {
|
|
60
|
+
for (const ext of exts) {
|
|
61
|
+
const candidate = join(dir, `${name}${ext}`);
|
|
62
|
+
if (isExecutableFile(candidate)) return candidate;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function main() {
|
|
70
|
+
const cwd = process.cwd();
|
|
71
|
+
if (isFresh(cwd)) return;
|
|
72
|
+
const python = resolveInterpreter();
|
|
73
|
+
if (!python) {
|
|
74
|
+
debug('no python3 or python on PATH; graph refresh skipped');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Detached with stdio ignored and unref'd: the child's exit status can never
|
|
78
|
+
// surface as a hook error, which is what keeps the `import graphify` guard in
|
|
79
|
+
// the payload where it already lives.
|
|
80
|
+
const child = spawn(python, [PAYLOAD], { cwd, detached: true, stdio: 'ignore', windowsHide: true });
|
|
81
|
+
child.on('error', (e) => debug(`spawn failed: ${e.message}`));
|
|
82
|
+
child.unref();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// No explicit process.exit: the unref'd child holds nothing open, so the default
|
|
86
|
+
// exit code 0 stands, and the deferred 'error' event above still gets to fire.
|
|
87
|
+
try {
|
|
88
|
+
main();
|
|
89
|
+
} catch (e) {
|
|
90
|
+
debug(`unexpected: ${e && e.message}`);
|
|
91
|
+
}
|
package/global/settings.json
CHANGED
package/lib/installer/config.mjs
CHANGED
|
@@ -32,14 +32,6 @@ export function writeVerbosity(home, assetRoot, requested, flagGiven) {
|
|
|
32
32
|
return { level: 'MIN', warn: 'code-conductor: verbosity.md unreadable, reset to MIN' };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function seedMemoryFile(home, relName, assetRoot) {
|
|
36
|
-
const dst = join(home, '.claude', 'memory', relName);
|
|
37
|
-
if (existsSync(dst)) return false;
|
|
38
|
-
mkdirSync(dirname(dst), { recursive: true });
|
|
39
|
-
copyFileSync(join(assetRoot, 'global', 'memory', relName), dst);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
35
|
// conductor-version.md is a plain data file, NOT markdown prose: exactly one bare
|
|
44
36
|
// semver line plus a trailing newline (e.g. "1.22.0\n"). No frontmatter, no heading.
|
|
45
37
|
// This matches the legacy install.sh contract, which reads it with `cat` and string-
|