@hxp-tools/humanizer 0.0.0-stage → 2.0.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/AGENTS.md +52 -0
- package/CHANGELOG.md +242 -0
- package/LICENSE +21 -0
- package/README.md +214 -2
- package/SKILL.md +355 -0
- package/bin/humanizer.js +161 -0
- package/package.json +51 -4
- package/references/do-not-flag.md +129 -0
- package/references/examples.md +379 -0
- package/references/tell-patterns.md +541 -0
- package/references/text-hygiene.md +111 -0
- package/references/voice-matching.md +122 -0
package/SKILL.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: humanizer
|
|
3
|
+
description: >-
|
|
4
|
+
Humanize and de-slop AI-sounding prose while preserving meaning, specific
|
|
5
|
+
detail, and genuine human quirks. When a voice sample or style profile is
|
|
6
|
+
available, rewrite in that writer's actual voice. Remove recurring AI tells
|
|
7
|
+
such as inflated significance, stock vocabulary, uniform rhythm, excessive
|
|
8
|
+
hedging, formulaic structure, and formatting artifacts. Also clean
|
|
9
|
+
suspicious invisible Unicode and copy-paste residue conservatively, without
|
|
10
|
+
treating them as proof of authorship. Use whenever a user wants to humanize,
|
|
11
|
+
de-AI, de-slop, or de-robotify text; fix prose that sounds corporate,
|
|
12
|
+
generic, like ChatGPT, or otherwise off; match a draft to a writer or named
|
|
13
|
+
author; edit for authentic voice and rhythm; or clean zero-width characters,
|
|
14
|
+
exotic spaces, bidi controls, and similar hidden text residue.
|
|
15
|
+
license: MIT
|
|
16
|
+
allowed-tools: Read Write Edit Glob Grep
|
|
17
|
+
metadata:
|
|
18
|
+
version: 2.0.0
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Humanizer
|
|
22
|
+
|
|
23
|
+
Turn AI-flavored or generically smooth prose into writing that reads as the
|
|
24
|
+
work of a person. When a writer's voice is available, make it read as the work
|
|
25
|
+
of *that* person. The goal is prose a careful human reader would not flag,
|
|
26
|
+
with its meaning and its human texture intact. The goal is not to beat any
|
|
27
|
+
particular detector, and this skill names and targets none.
|
|
28
|
+
|
|
29
|
+
The workflow also includes conservative text hygiene. It can remove
|
|
30
|
+
suspicious invisible Unicode and normalize copy-paste spacing in the prose it
|
|
31
|
+
rewrites, while preserving characters that carry real linguistic or display
|
|
32
|
+
meaning. This is not file-provenance or media-watermark tooling.
|
|
33
|
+
|
|
34
|
+
## When to use this
|
|
35
|
+
|
|
36
|
+
Use it when someone pastes a draft and says it sounds like AI, asks to
|
|
37
|
+
humanize or de-slop text, wants their own draft to sound like them, names an
|
|
38
|
+
author to match, or says the writing "feels off," "sounds corporate,"
|
|
39
|
+
"reads like a robot," or "is too generic." Use it even when they do not say
|
|
40
|
+
the word "humanize." It also pairs well after any drafting step where the
|
|
41
|
+
output came out machine-smooth. By default the rewrite stays measured and
|
|
42
|
+
faithful; if the user explicitly asks for more voice, edge, or opinion, turn
|
|
43
|
+
on Stance mode (see below).
|
|
44
|
+
|
|
45
|
+
Use the text-hygiene part when prose may contain invisible characters,
|
|
46
|
+
zero-width residue, unusual spaces, or direction controls. Treat hygiene as
|
|
47
|
+
format cleanup, never as evidence that a person or model wrote the text.
|
|
48
|
+
|
|
49
|
+
Do not use it to disguise authorship for an assessment or to defeat a
|
|
50
|
+
plagiarism or AI-detection system. See Scope and intended use below; reframe
|
|
51
|
+
such requests toward genuine quality and voice.
|
|
52
|
+
|
|
53
|
+
## Core principle: variance over substitution
|
|
54
|
+
|
|
55
|
+
The reason AI prose reads as AI is not its vocabulary. It is its uniformity:
|
|
56
|
+
even sentence lengths, even rhythm, even hedging, the same shapes resolved the
|
|
57
|
+
same way. Swapping "delve" for "explore" everywhere does not fix that. It just
|
|
58
|
+
moves the signature, and a uniform "humanizer dialect" is still a machine
|
|
59
|
+
fingerprint, just a different one.
|
|
60
|
+
|
|
61
|
+
Real humanization comes from genuine structural variance. Sentences of very
|
|
62
|
+
different lengths next to each other. A fragment. Then a long, winding one
|
|
63
|
+
that takes its time. Mixed syntax. The occasional asymmetry a tidy model would
|
|
64
|
+
smooth away. You are writing for a sharp human reader, not optimizing a score.
|
|
65
|
+
Every pass below serves this principle: increase real variance, do not install
|
|
66
|
+
a new regularity.
|
|
67
|
+
|
|
68
|
+
## Step 0: Discover the voice (do this every run, before rewriting)
|
|
69
|
+
|
|
70
|
+
Decide which mode you are in. Announce it in the output header so a wrong
|
|
71
|
+
guess is instantly correctable.
|
|
72
|
+
|
|
73
|
+
1. **Explicit input wins.** Did the user paste a writing sample, point to a
|
|
74
|
+
file, or name a well-known author to match? Use that. Read
|
|
75
|
+
`references/voice-matching.md` and proceed in voice mode.
|
|
76
|
+
2. **Otherwise, look for a profile.** `Glob` the working directory and up to
|
|
77
|
+
two parent levels, in this priority order:
|
|
78
|
+
`VOICE.md`, then `STYLE-GUIDE.md`, then
|
|
79
|
+
`voice-profile.md` / `.yaml` / `.json`, then `.manuscript/STYLE-GUIDE.md`,
|
|
80
|
+
then a voice or style section inside `AGENTS.md` or `CLAUDE.md`. One strong
|
|
81
|
+
match: read it, then read `references/voice-matching.md`, proceed in voice
|
|
82
|
+
mode. Several plausible matches: ask one short question to pick.
|
|
83
|
+
3. **Otherwise, generic mode.** No voice target. De-slop toward natural,
|
|
84
|
+
varied human prose. Do not invent a persona or a backstory; an invented
|
|
85
|
+
voice is its own failure. Generic mode skips Pass 1 and starts at Pass 2.
|
|
86
|
+
|
|
87
|
+
This discovery is filesystem-generic. It interoperates with Scriveno, Pillars,
|
|
88
|
+
or any project that happens to keep a voice file, without depending on any of
|
|
89
|
+
them.
|
|
90
|
+
|
|
91
|
+
## Step 0b: Stance mode (opt-in, off by default)
|
|
92
|
+
|
|
93
|
+
Default output is measured and faithful: it reports the source's content in
|
|
94
|
+
clean human prose and does not editorialize. That is the right default,
|
|
95
|
+
because the most common failure of livelier humanizers is that "adding voice"
|
|
96
|
+
becomes "adding content," and an invented opinion quietly drags an invented
|
|
97
|
+
fact in behind it.
|
|
98
|
+
|
|
99
|
+
Turn stance mode **on only when the user explicitly asks for it**: "give it
|
|
100
|
+
some voice," "make it punchier," "have a take," "don't keep it so neutral,"
|
|
101
|
+
"add some edge or opinion." Do not turn it on for an ordinary de-slop request,
|
|
102
|
+
and never in voice mode (a discovered profile already dictates stance; do not
|
|
103
|
+
override it).
|
|
104
|
+
|
|
105
|
+
When stance mode is on, you may add **attitude toward the existing content**:
|
|
106
|
+
a judgment, emphasis, dry understatement, first person as the narrator of the
|
|
107
|
+
same facts, an honest "this part is the weak spot," acknowledged ambivalence
|
|
108
|
+
about what the source already says, and freer rhythm. This is the same
|
|
109
|
+
material, said by someone with a point of view.
|
|
110
|
+
|
|
111
|
+
The hard line, and the entire reason this mode is safe: **stance is a reaction
|
|
112
|
+
to what is there, never the addition of what is not.** You may judge a stated
|
|
113
|
+
fact; you may not invent the fact, its cause, its mechanism, an event, a named
|
|
114
|
+
person, a quote, or a lived experience to react to. Test every added clause:
|
|
115
|
+
"is this an opinion about something the source already states, or a new claim
|
|
116
|
+
about the world?" If it is a new claim, it is fabrication wearing a voice, and
|
|
117
|
+
it is exactly the failure this skill exists to prevent. When in doubt, the
|
|
118
|
+
opinion is allowed and the new fact is not.
|
|
119
|
+
|
|
120
|
+
Example. Source states only: infrastructure cost rose 18% during the
|
|
121
|
+
migration, temporarily.
|
|
122
|
+
|
|
123
|
+
- Allowed (stance about the stated fact): "An 18% jump is a real line item,
|
|
124
|
+
not a rounding error, and 'temporary' is doing some hopeful work in that
|
|
125
|
+
sentence."
|
|
126
|
+
- Forbidden (invented cause dressed as candor): "costs rose because we were
|
|
127
|
+
running the old and new systems in parallel" (the source never says why;
|
|
128
|
+
this is a new fact).
|
|
129
|
+
|
|
130
|
+
Stance mode raises fabrication risk, so the Pass 3 self-audit and the Meaning
|
|
131
|
+
check apply with extra force, and the output header must show stance is on so
|
|
132
|
+
the user can dial it back. Stance is a requested change of register, so it
|
|
133
|
+
applies even when the density pre-check picks a light pass; density still
|
|
134
|
+
decides how hard to hunt for tells.
|
|
135
|
+
|
|
136
|
+
## Step 0c: Density pre-check (match effort to evidence)
|
|
137
|
+
|
|
138
|
+
Before rewriting, skim the whole text once and judge how heavily it is
|
|
139
|
+
AI-marked. Count only the **dead-giveaway** tells, not the weak surface
|
|
140
|
+
signals: chat-UI contamination (pattern 31), knowledge-cutoff disclaimers
|
|
141
|
+
(29), collaborative chatbot artifacts (28), significance inflation (1),
|
|
142
|
+
promotional language (5), AI-vocabulary clustering (16), sycophantic tone
|
|
143
|
+
(7), generic positive conclusion (13). Estimate roughly how many appear per
|
|
144
|
+
100 words, then pick the pass intensity and announce it in the output header:
|
|
145
|
+
|
|
146
|
+
- **Low (about 0 to 2 per 100 words): light pass.** The text is human-first
|
|
147
|
+
(a journal, rough notes, a real person's draft). Fix only the dead-giveaway
|
|
148
|
+
artifacts. Leave lower-tier patterns, rhythm, and voice alone, and bias hard
|
|
149
|
+
toward "Deliberately left alone." All-or-nothing rewriting here is exactly
|
|
150
|
+
what strips the quirks that made the writing sound like a person; that is
|
|
151
|
+
the worst failure this skill can commit, so when density is low, restraint
|
|
152
|
+
is the default and edits are the exception.
|
|
153
|
+
- **Medium (about 3 to 5 per 100 words): standard pass.** Mixed authorship.
|
|
154
|
+
Apply the full catalog, but with the restraint of do-not-flag.md; do not
|
|
155
|
+
flatten what already works.
|
|
156
|
+
- **High (6 or more per 100 words): full pass.** AI-first text. Apply the
|
|
157
|
+
full catalog thoroughly and push real structural variance.
|
|
158
|
+
|
|
159
|
+
This is calibration, not a scan you report mechanically. Effort should match
|
|
160
|
+
evidence. One exception overrides density: any chat-UI contamination string
|
|
161
|
+
(pattern 31) is decisive on its own and is always removed, whatever the
|
|
162
|
+
overall density, because its presence is near-certain confirmation rather
|
|
163
|
+
than a weak signal.
|
|
164
|
+
|
|
165
|
+
## Step 0d: Text hygiene preflight (do this every run)
|
|
166
|
+
|
|
167
|
+
Inspect the source before rewriting so invisible formatting does not survive
|
|
168
|
+
or get confused with prose style. Read `references/text-hygiene.md` when the
|
|
169
|
+
source contains non-ASCII formatting characters, when the user mentions
|
|
170
|
+
hidden characters or text marks, or when the interface reports suspicious
|
|
171
|
+
codepoints.
|
|
172
|
+
|
|
173
|
+
Remove only characters whose lack of semantic purpose is clear. Preserve
|
|
174
|
+
script joiners, direction marks needed by multilingual text, variation
|
|
175
|
+
selectors used for display, and non-breaking spaces that carry layout or
|
|
176
|
+
locale meaning. Do not normalize confusable letters automatically. Invisible
|
|
177
|
+
characters do not count toward the density score and do not establish AI
|
|
178
|
+
authorship.
|
|
179
|
+
|
|
180
|
+
This is a pure-prompt skill, so inspection is limited to characters the host
|
|
181
|
+
preserves and exposes. When the prose is in a file and a search tool is
|
|
182
|
+
available, also run the codepoint search in `references/text-hygiene.md`. If
|
|
183
|
+
you can neither see the characters directly nor search a file, say
|
|
184
|
+
`not verifiable in this interface` in the output header. Never report the
|
|
185
|
+
text as universally watermark-free.
|
|
186
|
+
|
|
187
|
+
## The multi-pass workflow
|
|
188
|
+
|
|
189
|
+
Run the passes in order. Voice is generative; de-slopping is subtractive. If
|
|
190
|
+
you strip tells first you get flat neutral prose that is then hard to inflect,
|
|
191
|
+
so establish voice first when you have one.
|
|
192
|
+
|
|
193
|
+
### Pass 1: Voice injection (voice mode only)
|
|
194
|
+
|
|
195
|
+
Rewrite the draft *toward the target voice* before removing any tells. Set the
|
|
196
|
+
cadence, diction, sentence-length signature, stance, and characteristic moves
|
|
197
|
+
described in `references/voice-matching.md`. Match the writer's instincts and
|
|
198
|
+
distribution, never their specific sentences. In generic mode, skip this pass.
|
|
199
|
+
|
|
200
|
+
### Pass 2: Tell removal
|
|
201
|
+
|
|
202
|
+
Load `references/tell-patterns.md`. Walk the prose against the 32-pattern
|
|
203
|
+
catalog (six families), scoped to the pass intensity chosen in Step 0c. For
|
|
204
|
+
each genuine flag, fix the *underlying thought*, not the surface token: ask
|
|
205
|
+
"what is actually being said here?" and write that, concretely, at the length
|
|
206
|
+
the thought deserves. Preserve meaning exactly.
|
|
207
|
+
|
|
208
|
+
Concreteness must come from the source or from the user, never from you. If
|
|
209
|
+
the source is vague and you have no real detail to restore, the honest fix is
|
|
210
|
+
to say less, plainly, not to manufacture a number, date, name, or example to
|
|
211
|
+
make it "sound human." An invented specific reads convincingly human, which
|
|
212
|
+
makes it more dangerous than the fog it replaced: vague slop merely bores a
|
|
213
|
+
reader, a fluent fabrication misleads one. When you are tempted to add a
|
|
214
|
+
specific the text does not contain, shorten instead.
|
|
215
|
+
|
|
216
|
+
While you do this, hold or increase sentence-length variance; do not let
|
|
217
|
+
de-slopping homogenize the rhythm. In voice mode, a tell fix that would
|
|
218
|
+
flatten the established voice is the wrong fix; find one that keeps the voice.
|
|
219
|
+
|
|
220
|
+
Humanization changes word choice and syntax, so it may disrupt statistical
|
|
221
|
+
token patterns as a side effect. That effect is best-effort and unverifiable
|
|
222
|
+
without a public detector and key. Do not intensify a rewrite solely to evade
|
|
223
|
+
a detector, promise that a mark was removed, or call the result undetectable.
|
|
224
|
+
|
|
225
|
+
### Pass 3: Self-audit (has veto power over Passes 1 and 2)
|
|
226
|
+
|
|
227
|
+
Load `references/do-not-flag.md`. Ask two questions and act on both:
|
|
228
|
+
|
|
229
|
+
a. If a sharp human read this cold, what one or two things would still tip
|
|
230
|
+
them that a machine touched it? Fix only those.
|
|
231
|
+
b. Did I overcorrect? Did I strip a specific detail, flatten a genuine quirk,
|
|
232
|
+
change a meaning, or introduce my own uniform rhythm (every fix the same
|
|
233
|
+
shape)? Revert any such damage.
|
|
234
|
+
|
|
235
|
+
Finally, recheck the rewritten prose for suspicious characters, including any
|
|
236
|
+
your own edits introduced. If Step 0d found or cleaned any, confirm against
|
|
237
|
+
`references/text-hygiene.md` that suspicious carriers were removed and
|
|
238
|
+
load-bearing Unicode was preserved. Report only changes you could actually
|
|
239
|
+
verify.
|
|
240
|
+
|
|
241
|
+
If Pass 3 conflicts with an earlier pass, Pass 3 wins. A clean rewrite that no
|
|
242
|
+
longer sounds like the writer, or that lost a real detail, has failed even if
|
|
243
|
+
every tell is gone.
|
|
244
|
+
|
|
245
|
+
## False-positive guardrails
|
|
246
|
+
|
|
247
|
+
These are inline because every run needs them. Do not flag in isolation:
|
|
248
|
+
|
|
249
|
+
- Perfect grammar. Correctness is not a confession; never add errors.
|
|
250
|
+
- A single em dash. Only dash frequency and monotony is a tell.
|
|
251
|
+
- Curly quotes or smart apostrophes. Word processors insert these for humans;
|
|
252
|
+
normalize only for consistency with the surrounding text, never as evidence.
|
|
253
|
+
- Formal or elevated vocabulary. Register is not origin.
|
|
254
|
+
- Common transitions ("however," "therefore," "for example").
|
|
255
|
+
- One passive sentence, one tricolon, one topic sentence.
|
|
256
|
+
|
|
257
|
+
Escalate to a flag only on recurrence or co-occurrence. When unsure, do not
|
|
258
|
+
cut. The full treatment, including human markers to preserve and per-model
|
|
259
|
+
idiolects, is in `references/do-not-flag.md`; read it during Pass 3.
|
|
260
|
+
|
|
261
|
+
## Anti-signature guidance
|
|
262
|
+
|
|
263
|
+
Do not develop tics of your own. Not every sentence varied the same way. Not a
|
|
264
|
+
fixed "short punchy line, then long winding clause" template repeated down the
|
|
265
|
+
page. Not a contraction forced into every paragraph. Not the same three
|
|
266
|
+
replacement words for "delve" every time. The tell of a humanizer is
|
|
267
|
+
regularity in its irregularity. Vary how you vary. If your edits are starting
|
|
268
|
+
to rhyme with each other, stop and break your own pattern.
|
|
269
|
+
|
|
270
|
+
## Output contract
|
|
271
|
+
|
|
272
|
+
Always deliver the rewritten prose as the primary artifact, followed by a
|
|
273
|
+
short report. Never silently rewrite in place. Never deliver a raw diff as the
|
|
274
|
+
main output (prose diffs are unreadable and hide meaning drift). Use this exact
|
|
275
|
+
structure:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
## Humanized draft
|
|
279
|
+
Voice: [generic | from FILENAME | matched to pasted sample | author: NAME]
|
|
280
|
+
[append " + stance" when stance mode is on, e.g. "generic + stance"]
|
|
281
|
+
[append ", low-confidence: REASON" when the voice source is thin]
|
|
282
|
+
Density: [low -> light pass | medium -> standard pass | high -> full pass]
|
|
283
|
+
Text hygiene: [no suspicious characters visible | cleaned: COUNTS AND TYPES |
|
|
284
|
+
not verifiable in this interface]
|
|
285
|
+
|
|
286
|
+
[the full rewritten text]
|
|
287
|
+
|
|
288
|
+
## What changed
|
|
289
|
+
- [pattern family]: [plain note on what was adjusted and why]
|
|
290
|
+
(group by family; do not list every token; about 8 bullets maximum)
|
|
291
|
+
- [text hygiene]: [include only when characters were removed or normalized]
|
|
292
|
+
|
|
293
|
+
## Deliberately left alone
|
|
294
|
+
- [something that looked like a tell but is authentic, and why you kept it]
|
|
295
|
+
(one to three bullets; this section is required, even on heavy rewrites)
|
|
296
|
+
|
|
297
|
+
## Meaning check
|
|
298
|
+
One sentence confirming no facts, numbers, names, claims, or intent changed.
|
|
299
|
+
Confirm that text-hygiene edits changed formatting only and preserved
|
|
300
|
+
load-bearing Unicode.
|
|
301
|
+
Then check soft inference: did you assert any causal, temporal, or
|
|
302
|
+
quantitative link ("most of the time went to X", "because of Y", "this drove
|
|
303
|
+
Z") that the source only implied or did not state? If so, name it here and
|
|
304
|
+
either hedge it ("probably", "as I read it") or cut it back to what the
|
|
305
|
+
source actually says. If anything was ambiguous, ask the question here
|
|
306
|
+
instead of guessing.
|
|
307
|
+
|
|
308
|
+
## Next step
|
|
309
|
+
If the user gave a file path, offer to write the rewrite into it. Otherwise
|
|
310
|
+
stop here.
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The "Deliberately left alone" and "Meaning check" sections are not optional
|
|
314
|
+
decoration. They are forcing functions: naming what you preserved makes
|
|
315
|
+
over-editing visible, and the meaning check makes drift visible. Soft
|
|
316
|
+
inference is the drift most likely to slip through, precisely because it is
|
|
317
|
+
plausible and reads human: an invented cause, or a claim about where the time
|
|
318
|
+
or effort went, does not trip a hard-fact scan, so the meaning check has to
|
|
319
|
+
look for it on purpose. If a near-miss text is already essentially human, the
|
|
320
|
+
correct output is minimal or no edits plus a clear explanation of what you
|
|
321
|
+
left and why.
|
|
322
|
+
|
|
323
|
+
## Scope and intended use
|
|
324
|
+
|
|
325
|
+
This skill exists to improve prose quality and to help a writer's own work
|
|
326
|
+
sound authentically like them. It is not designed or tuned to defeat
|
|
327
|
+
plagiarism checkers or AI-detection systems, and it deliberately names and
|
|
328
|
+
optimizes against none. If a request is framed as passing AI-written work off
|
|
329
|
+
as a person's own for a graded or contractual assessment, do not adopt that
|
|
330
|
+
framing; offer the quality-and-voice improvement instead, which is what this
|
|
331
|
+
skill actually does well.
|
|
332
|
+
|
|
333
|
+
Text hygiene in this skill is limited to characters present in supplied
|
|
334
|
+
prose. It does not inspect or strip C2PA, EXIF, XMP, PDF or document
|
|
335
|
+
properties, image pixels, audio, video, or provenance outside the text layer.
|
|
336
|
+
Those operations require dedicated tooling. Do not imply they were performed.
|
|
337
|
+
|
|
338
|
+
## Reference files
|
|
339
|
+
|
|
340
|
+
Read these on demand, not upfront:
|
|
341
|
+
|
|
342
|
+
- `references/tell-patterns.md` during Pass 2. The 32-pattern catalog in six
|
|
343
|
+
families, each with detect / why / before-after / restraint.
|
|
344
|
+
- `references/do-not-flag.md` during Pass 3. False positives, human markers to
|
|
345
|
+
preserve, LLM idiolects, and the hard stop conditions.
|
|
346
|
+
- `references/voice-matching.md` whenever Step 0 found a voice. How to extract
|
|
347
|
+
and apply a voice, the optional VOICE.md schema, and conflict resolution.
|
|
348
|
+
- `references/text-hygiene.md` when Step 0d needs it (suspicious characters,
|
|
349
|
+
a mention of hidden marks, or prose in a file to search) and for the final
|
|
350
|
+
check after a cleanup. Suspicious invisible Unicode, load-bearing
|
|
351
|
+
exceptions, the exact codepoint search, conservative normalization,
|
|
352
|
+
reporting, and prompt-only scope boundaries.
|
|
353
|
+
- `references/examples.md` when you are unsure what good output looks like.
|
|
354
|
+
Five full worked runs: generic de-slop, voice-first, a restraint case,
|
|
355
|
+
stance mode, and text hygiene.
|
package/bin/humanizer.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Copies the humanizer skill into Agent Skills folders so
|
|
5
|
+
// `npx @hxp-tools/humanizer` works. No dependencies, no network.
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
12
|
+
const PKG = require('../package.json');
|
|
13
|
+
const SKILL = 'humanizer';
|
|
14
|
+
const PAYLOAD = ['SKILL.md', 'references', 'LICENSE'];
|
|
15
|
+
|
|
16
|
+
const TOOLS = {
|
|
17
|
+
agents: { dir: '.agents', label: 'shared skills (Codex, Cursor, Gemini CLI, Copilot, OpenCode, Pi, Devin Desktop, Zed)' },
|
|
18
|
+
claude: { dir: '.claude', label: 'Claude Code' },
|
|
19
|
+
cline: { dir: '.cline', label: 'Cline' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const COLORS = {
|
|
23
|
+
reset: '\x1b[0m',
|
|
24
|
+
bold: '\x1b[1m',
|
|
25
|
+
dim: '\x1b[2m',
|
|
26
|
+
cyan: '\x1b[36m',
|
|
27
|
+
green: '\x1b[32m',
|
|
28
|
+
yellow: '\x1b[33m',
|
|
29
|
+
red: '\x1b[31m',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function c(color, text) {
|
|
33
|
+
return process.stdout.isTTY ? COLORS[color] + text + COLORS.reset : text;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function usage() {
|
|
37
|
+
console.log(`
|
|
38
|
+
${c('bold', 'humanizer')} ${c('dim', 'v' + PKG.version)}
|
|
39
|
+
Strip the tells. Keep the facts. Sound like you.
|
|
40
|
+
|
|
41
|
+
${c('bold', 'Usage')}
|
|
42
|
+
npx @hxp-tools/humanizer
|
|
43
|
+
npx @hxp-tools/humanizer --project
|
|
44
|
+
npx @hxp-tools/humanizer --tools agents,claude,cline
|
|
45
|
+
npx @hxp-tools/humanizer --uninstall
|
|
46
|
+
npx @hxp-tools/humanizer --help
|
|
47
|
+
|
|
48
|
+
${c('bold', 'Targets')}
|
|
49
|
+
agents ~/.agents/skills/humanizer always
|
|
50
|
+
claude ~/.claude/skills/humanizer when ~/.claude exists
|
|
51
|
+
cline ~/.cline/skills/humanizer when ~/.cline exists
|
|
52
|
+
|
|
53
|
+
--project uses the current directory instead of your home directory.
|
|
54
|
+
|
|
55
|
+
${c('bold', 'After install')}
|
|
56
|
+
Restart your coding agent, then ask it to humanize a draft.
|
|
57
|
+
`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parse(argv) {
|
|
61
|
+
const opts = { project: false, uninstall: false, tools: null };
|
|
62
|
+
for (let i = 0; i < argv.length; i++) {
|
|
63
|
+
const arg = argv[i];
|
|
64
|
+
if (arg === '--project') opts.project = true;
|
|
65
|
+
else if (arg === '--uninstall') opts.uninstall = true;
|
|
66
|
+
else if (arg === '--help' || arg === '-h') opts.help = true;
|
|
67
|
+
else if (arg === '--version' || arg === '-v') opts.version = true;
|
|
68
|
+
else if (arg === '--tools' || arg.startsWith('--tools=')) {
|
|
69
|
+
const value = arg.includes('=') ? arg.slice(arg.indexOf('=') + 1) : argv[++i];
|
|
70
|
+
if (!value) throw new Error('--tools needs a list, for example --tools agents,claude');
|
|
71
|
+
opts.tools = value.split(',').map((t) => t.trim()).filter(Boolean);
|
|
72
|
+
const unknown = opts.tools.filter((t) => !TOOLS[t]);
|
|
73
|
+
if (unknown.length) throw new Error(`unknown tool: ${unknown.join(', ')} (use ${Object.keys(TOOLS).join(', ')})`);
|
|
74
|
+
} else throw new Error(`unknown option: ${arg}`);
|
|
75
|
+
}
|
|
76
|
+
return opts;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function pickTools(base, opts) {
|
|
80
|
+
if (opts.tools) return opts.tools;
|
|
81
|
+
return Object.keys(TOOLS).filter(
|
|
82
|
+
(t) => t === 'agents' || fs.existsSync(path.join(base, TOOLS[t].dir))
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isHumanizer(dest) {
|
|
87
|
+
const skill = path.join(dest, 'SKILL.md');
|
|
88
|
+
if (!fs.existsSync(skill)) return false;
|
|
89
|
+
return /^name:\s*humanizer\s*$/m.test(fs.readFileSync(skill, 'utf8'));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function install(dest) {
|
|
93
|
+
if (fs.existsSync(path.join(dest, '.git'))) {
|
|
94
|
+
return ['skip', 'git clone; update it with git pull'];
|
|
95
|
+
}
|
|
96
|
+
const existed = fs.existsSync(dest);
|
|
97
|
+
if (existed && !isHumanizer(dest)) {
|
|
98
|
+
return ['skip', 'folder exists and is not humanizer; left alone'];
|
|
99
|
+
}
|
|
100
|
+
if (existed) fs.rmSync(dest, { recursive: true, force: true });
|
|
101
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
102
|
+
for (const item of PAYLOAD) {
|
|
103
|
+
fs.cpSync(path.join(ROOT, item), path.join(dest, item), { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
return ['ok', existed ? 'updated' : 'installed'];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function uninstall(dest) {
|
|
109
|
+
if (!fs.existsSync(dest)) return ['skip', 'not installed'];
|
|
110
|
+
if (fs.existsSync(path.join(dest, '.git'))) return ['skip', 'git clone; remove it yourself'];
|
|
111
|
+
if (!isHumanizer(dest)) return ['skip', 'not a humanizer install; left alone'];
|
|
112
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
113
|
+
return ['ok', 'removed'];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function main(argv) {
|
|
117
|
+
let opts;
|
|
118
|
+
try {
|
|
119
|
+
opts = parse(argv.slice(2));
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error(c('red', error.message));
|
|
122
|
+
return 2;
|
|
123
|
+
}
|
|
124
|
+
if (opts.help) {
|
|
125
|
+
usage();
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
if (opts.version) {
|
|
129
|
+
console.log(PKG.version);
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const base = opts.project ? process.cwd() : os.homedir();
|
|
134
|
+
const tools = pickTools(base, opts);
|
|
135
|
+
console.log(c('cyan', 'humanizer') + ' ' + c('dim', 'v' + PKG.version));
|
|
136
|
+
|
|
137
|
+
let ok = 0;
|
|
138
|
+
for (const tool of tools) {
|
|
139
|
+
const dest = path.join(base, TOOLS[tool].dir, 'skills', SKILL);
|
|
140
|
+
let status;
|
|
141
|
+
let note;
|
|
142
|
+
try {
|
|
143
|
+
[status, note] = opts.uninstall ? uninstall(dest) : install(dest);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
[status, note] = ['fail', error.message];
|
|
146
|
+
}
|
|
147
|
+
if (status === 'ok') ok++;
|
|
148
|
+
const color = status === 'ok' ? 'green' : status === 'skip' ? 'yellow' : 'red';
|
|
149
|
+
console.log(` ${c(color, note.padEnd(9))} ${dest} ${c('dim', TOOLS[tool].label)}`);
|
|
150
|
+
if (status === 'fail') return 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!opts.uninstall && ok > 0) {
|
|
154
|
+
console.log('');
|
|
155
|
+
console.log(c('green', 'Press start: restart your agent, then ask it to humanize a draft.'));
|
|
156
|
+
console.log(c('dim', 'Docs: ' + PKG.homepage));
|
|
157
|
+
}
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
process.exitCode = main(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hxp-tools/humanizer",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Strip the tells. Keep the facts. Sound like you. A writing skill for AI coding tools.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent-skills",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"ai-writing",
|
|
9
|
+
"humanizer",
|
|
10
|
+
"deslop",
|
|
11
|
+
"ai-slop",
|
|
12
|
+
"writing",
|
|
13
|
+
"prose-editing",
|
|
14
|
+
"voice",
|
|
15
|
+
"claude-code",
|
|
16
|
+
"codex",
|
|
17
|
+
"cursor",
|
|
18
|
+
"gemini-cli",
|
|
19
|
+
"github-copilot",
|
|
20
|
+
"opencode"
|
|
21
|
+
],
|
|
22
|
+
"homepage": "https://github.com/hannsxpeter/humanizer#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/hannsxpeter/humanizer/issues"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/hannsxpeter/humanizer.git"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"author": "hannsxpeter",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"humanizer": "bin/humanizer.js"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"bin",
|
|
40
|
+
"SKILL.md",
|
|
41
|
+
"references",
|
|
42
|
+
"AGENTS.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md",
|
|
45
|
+
"CHANGELOG.md"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"check": "python3 .github/scripts/check_drift.py"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|