@holdyourvoice/hyv 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,41 +7,51 @@ When the user asks to write, rewrite, or edit text "in their voice", "using thei
7
7
  Recognize these patterns:
8
8
  - `hyv shashank` or `hyv <name>` — rewrite using the named voice profile
9
9
  - `write this in my voice` / `rewrite in my voice` — use the default profile
10
+ - `rewrite the above in my voice` — rewrite the text above the user's message
11
+ - `rewrite this paragraph in my voice` — rewrite selected/referenced text
10
12
  - `check my voice` / `scan my voice` / `voice check` — run `hyv scan`
11
13
  - `voice status` / `hyv status` — show account status
12
14
 
13
- ## Workflow
15
+ ## Workflows
14
16
 
15
- ### To rewrite text in a user's voice:
17
+ ### 1. Inline rewrite (text in conversation)
16
18
 
17
- 1. If there's a draft file, run:
19
+ When the user says "rewrite the above in my voice" or "rewrite this in my voice" and the text is in the conversation (not a file):
20
+
21
+ 1. Capture the text the user wants rewritten (the previous message, a code block, a paragraph, etc.)
22
+ 2. Run:
18
23
  ```bash
19
- hyv rewrite <profile> <file>
24
+ hyv rewrite <profile> --text "the captured text here"
20
25
  ```
21
- If no file, pipe the text:
26
+ Or pipe it:
22
27
  ```bash
23
- echo "the draft text" | hyv rewrite <profile>
28
+ printf '%s' "the captured text" | hyv rewrite <profile>
24
29
  ```
30
+ 3. The CLI outputs a structured prompt. Read it.
31
+ 4. Execute the rewrite following the prompt's instructions.
32
+ 5. Present the rewritten text to the user.
25
33
 
26
- 2. The CLI outputs a structured prompt to stdout. Read it.
34
+ ### 2. File rewrite
27
35
 
28
- 3. Execute the rewrite following the prompt's instructions. The prompt contains:
29
- - The voice profile (keywords, tone, anchors, never-list)
30
- - Issues found in the draft
31
- - The draft text
32
- - Rewrite rules
36
+ When the user references a file:
33
37
 
34
- 4. Present the rewritten text to the user.
38
+ 1. Run:
39
+ ```bash
40
+ hyv rewrite <profile> <file.md>
41
+ ```
42
+ 2. Read the structured prompt from stdout.
43
+ 3. Execute the rewrite.
44
+ 4. Present or write the result.
35
45
 
36
- ### To check writing for issues:
46
+ ### 3. Scan (check for issues)
37
47
 
38
48
  ```bash
39
49
  hyv scan
40
50
  ```
41
51
 
42
- This scans all `.md` files in the current directory. Shows issues with line numbers and severity.
52
+ Scans all `.md` files in the current directory for AI patterns and voice drift.
43
53
 
44
- ### To list available profiles:
54
+ ### 4. List profiles
45
55
 
46
56
  ```bash
47
57
  hyv profiles
@@ -49,8 +59,10 @@ hyv profiles
49
59
 
50
60
  ## Rules
51
61
 
52
- - The CLI never calls an LLM. It generates prompts. You execute them.
53
- - Always preserve the original meaning when rewriting.
54
- - Match the voice profile's rhythm, vocabulary, and patterns.
55
- - If no profile is specified, use the default from `.hyv.yml` or ask the user.
56
- - If the CLI isn't installed, tell the user to run `npx @holdyourvoice/hyv init`.
62
+ - The CLI never calls an LLM. It generates prompts. **You** execute the rewrite.
63
+ - Always preserve the original meaning and factual claims.
64
+ - Match the voice profile's rhythm, vocabulary, sentence patterns, and tone.
65
+ - If no profile is specified, use the default from `.hyv.yml` or ask the user which profile.
66
+ - If the CLI isn't installed, tell the user: `npx @holdyourvoice/hyv init`
67
+ - When rewriting inline text, always use `--text` or pipe via stdin. Never save to a temp file.
68
+ - Present the rewritten text directly in the conversation. Don't save to a file unless asked.
package/agents/codex.md CHANGED
@@ -1,22 +1,34 @@
1
1
  # Hold Your Voice (HYV) — Codex Integration
2
2
 
3
- When the user mentions "voice", "brand voice", "hyv", or asks to rewrite in their voice, use the `hyv` CLI.
3
+ When the user mentions "voice", "brand voice", "hyv", "rewrite in my voice", or asks to rewrite text using their voice profile, use the `hyv` CLI.
4
4
 
5
5
  ## Quick Reference
6
6
 
7
- | User says | Command |
8
- |-----------|---------|
9
- | `hyv <name>` | `hyv rewrite <name> <current-file>` |
10
- | `write this in my voice` | `hyv rewrite <default-profile> <file>` |
11
- | `check my voice` | `hyv scan` |
12
- | `voice profiles` | `hyv profiles` |
13
- | `voice status` | `hyv status` |
7
+ | User says | What to do |
8
+ |-----------|-----------|
9
+ | `hyv shashank` | Capture the text, run `hyv rewrite shashank --text "..."`, execute the prompt |
10
+ | `rewrite the above in my voice` | Capture the text above, run `hyv rewrite --text "..."`, execute |
11
+ | `write this in my voice` | Capture the referenced text, run `hyv rewrite --text "..."`, execute |
12
+ | `rewrite draft.md in my voice` | Run `hyv rewrite <profile> draft.md`, execute the prompt |
13
+ | `check my voice` | Run `hyv scan` |
14
+ | `voice profiles` | Run `hyv profiles` |
15
+ | `voice status` | Run `hyv status` |
14
16
 
15
- ## How rewrite works
17
+ ## How inline rewrite works
16
18
 
17
- 1. Run `hyv rewrite <profile> <file>` outputs a structured prompt to stdout
18
- 2. Read the prompt and execute the rewrite
19
- 3. Present the rewritten text
19
+ 1. User says "rewrite the above in my voice" (or similar)
20
+ 2. Capture the text from the conversation context
21
+ 3. Run: `hyv rewrite <profile> --text "captured text"`
22
+ 4. Read the structured prompt from stdout
23
+ 5. Execute the rewrite — match the voice profile's patterns, rhythm, vocabulary
24
+ 6. Present the rewritten text directly in the conversation
25
+
26
+ ## How file rewrite works
27
+
28
+ 1. Run: `hyv rewrite <profile> file.md`
29
+ 2. Read the prompt from stdout
30
+ 3. Execute the rewrite
31
+ 4. Present or write the result
20
32
 
21
33
  ## Install
22
34
 
package/dist/index.js CHANGED
@@ -42,8 +42,9 @@ Expecting one of '${s.join("', '")}'`);let i=`${t}Help`;return this.on(i,r=>{let
42
42
  ${W()} ${m.dim("scan")}
43
43
  `);let a=0;for(let l of r)if(l.findings.length!==0){console.log(` ${m.bold(l.file)} ${m.dim(`(${l.lines} lines)`)}`);for(let h of l.findings)on(h),a++;console.log("")}an(o),t.failOnHit&&o.red+o.yellow>0&&process.exit(1)}var mt=I(require("fs"));bt();function dr(n,t,e,s){let i=[];if(i.push("You are rewriting a draft to match a specific voice profile."),i.push(""),i.push("<voice_profile>"),i.push(`<name>${n.name}</name>`),n.brand&&i.push(`<brand>${n.brand}</brand>`),n.description&&i.push(`<description>${n.description}</description>`),n.keywords?.length&&i.push(`<keywords>${n.keywords.join(", ")}</keywords>`),i.push(""),i.push(t),i.push("</voice_profile>"),i.push(""),s.length>0){i.push("<issues_found>");let r=s.filter(a=>a.severity==="red"),o=s.filter(a=>a.severity==="yellow");r.length&&i.push(`Critical issues (${r.length}): ${r.map(a=>a.pattern).join(", ")}`),o.length&&i.push(`Advisory issues (${o.length}): ${o.map(a=>a.pattern).join(", ")}`),i.push("</issues_found>"),i.push("")}return i.push("<draft>"),i.push(e),i.push("</draft>"),i.push(""),i.push("<instruction>"),i.push("Rewrite this draft to match the voice profile. Rules:"),i.push("1. Preserve the original meaning and all factual claims"),i.push("2. Match the profile's rhythm, tone, vocabulary, and sentence patterns"),i.push("3. Fix every critical issue listed above"),i.push("4. Remove AI-slop patterns (delve, leverage, tapestry, etc.)"),i.push("5. Ground your style in the anchor passages from the profile"),i.push("6. Never use words from the never-list"),i.push("7. Keep the same format (markdown headings, lists, links)"),i.push("8. Return ONLY the rewritten text, no commentary"),i.push("</instruction>"),i.join(`
44
44
  `)}async function pr(n,t,e){let i=Ht().profile,r;n&&t?(i=n,r=t):n&&(n.endsWith(".md")||mt.existsSync(n)?r=n:i=n),i||(console.log(`
45
- ${m.red("\u2717")} no profile specified`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> <file>`),console.log(` ${m.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let o;r?(mt.existsSync(r)||(console.log(`
46
- ${m.red("\u2717")} file not found: ${r}`),process.exit(1)),o=mt.readFileSync(r,"utf-8")):o=mt.readFileSync(0,"utf-8"),o.trim()||(console.log(`
45
+ ${m.red("\u2717")} no profile specified`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> <file>`),console.log(` ${m.dim(" ")} hyv rewrite <profile> --text "your text here"`),console.log(` ${m.dim(" ")} echo "text" | hyv rewrite <profile>`),console.log(` ${m.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let o;e.text?o=e.text:r?(mt.existsSync(r)||(console.log(`
46
+ ${m.red("\u2717")} file not found: ${r}`),process.exit(1)),o=mt.readFileSync(r,"utf-8")):(process.stdin.isTTY&&(console.log(`
47
+ ${m.red("\u2717")} no text provided`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> --text "your text here"`),console.log(` ${m.dim(" ")} echo "text" | hyv rewrite <profile>`),process.exit(1)),o=mt.readFileSync(0,"utf-8")),o.trim()||(console.log(`
47
48
  ${m.red("\u2717")} empty draft`),process.exit(1)),console.log(`
48
49
  ${W()} ${m.dim("rewrite")}
49
50
  `);let a,l;try{console.log(` ${m.dim("fetching profile:")} ${m.bold(i)}`);let f=await tt(`/cli/profiles/${encodeURIComponent(i)}`);a=f.profile,l=f.body||"",ms(a.slug||i,l)}catch{let f=ps(i);f||(console.log(` ${m.red("\u2717")} profile not found: ${i}`),console.log(` ${m.dim("run:")} hyv profiles ${m.dim("to see available profiles")}`),process.exit(1)),a={id:"",slug:i,name:i},l=f,console.log(` ${m.dim("using cached profile")}`)}console.log(` ${m.dim("scanning draft...")}`);let{results:h}=await He([r||"draft.md"],[]),u=h[0]?.findings||[];u.length>0?console.log(` ${m.yellow(String(u.length))} issues found`):console.log(` ${m.green("\u2713")} no issues found`);let c=dr(a,l,o,u);e.output?(mt.writeFileSync(e.output,c),console.log(`
@@ -60,4 +61,4 @@ ${"\u2500".repeat(60)}`),console.log(c),console.log(`${"\u2500".repeat(60)}
60
61
  `);try{await gs("/cli/learning/reinforce",{original:e,edited:s}),console.log(` ${m.green("\u2713")} learning signal sent`)}catch(i){console.log(` ${m.red("\u2717")} failed: ${i.message}`),process.exit(1)}}async function wr(n,t){gt.existsSync(n)||(console.log(`
61
62
  ${m.red("\u2717")} file not found: ${n}`),process.exit(1));let e=gt.readFileSync(n,"utf-8");console.log(`
62
63
  ${W()} ${m.dim("add sample")}
63
- `);try{await gs("/cli/learning/add",{text:e,profile:t.profile}),console.log(` ${m.green("\u2713")} sample added${t.profile?` to ${m.bold(t.profile)}`:""}`)}catch(s){console.log(` ${m.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var lt=new ai;lt.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.1.0");lt.command("init").description("authenticate and set up your project").option("-p, --profile <name>","set default voice profile").option("-k, --key <key>","use a license key directly").action(n=>cn(n.profile,{key:n.key}));lt.command("scan").description("scan local .md files for ai patterns and voice drift").argument("[paths...]","files or directories to scan").option("--json","output as json").option("--fail-on-hit","exit with code 1 if issues found").action((n,t)=>fr(n,t));lt.command("rewrite").description("generate a rewrite prompt for your ai agent").argument("[profile-or-file]","voice profile name or .md file").argument("[file]",".md file to rewrite").option("-o, --output <file>","write prompt to file instead of stdout").action((n,t,e)=>pr(n,t,e));lt.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>mr(n));lt.command("status").description("show account and cli status").action(()=>gr());lt.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").action((n,t)=>yr(n,t));lt.command("add").description("add a writing sample to your voice profile").argument("<file>",".md file to add as sample").option("-p, --profile <name>","target profile").action((n,t)=>wr(n,t));lt.parse();
64
+ `);try{await gs("/cli/learning/add",{text:e,profile:t.profile}),console.log(` ${m.green("\u2713")} sample added${t.profile?` to ${m.bold(t.profile)}`:""}`)}catch(s){console.log(` ${m.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var lt=new ai;lt.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.1.0");lt.command("init").description("authenticate and set up your project").option("-p, --profile <name>","set default voice profile").option("-k, --key <key>","use a license key directly").action(n=>cn(n.profile,{key:n.key}));lt.command("scan").description("scan local .md files for ai patterns and voice drift").argument("[paths...]","files or directories to scan").option("--json","output as json").option("--fail-on-hit","exit with code 1 if issues found").action((n,t)=>fr(n,t));lt.command("rewrite").description("generate a rewrite prompt for your ai agent").argument("[profile-or-file]","voice profile name or .md file").argument("[file]",".md file to rewrite").option("-o, --output <file>","write prompt to file instead of stdout").option("-t, --text <text>","inline text to rewrite (instead of file/stdin)").action((n,t,e)=>pr(n,t,e));lt.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>mr(n));lt.command("status").description("show account and cli status").action(()=>gr());lt.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").action((n,t)=>yr(n,t));lt.command("add").description("add a writing sample to your voice profile").argument("<file>",".md file to add as sample").option("-p, --profile <name>","target profile").action((n,t)=>wr(n,t));lt.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holdyourvoice/hyv",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Hold Your Voice — voice gate layer for AI workflows",
5
5
  "main": "dist/index.js",
6
6
  "bin": {