Skip to content

Commit 62fccb6

Browse files
committed
Add npm README and global skills install helper
Ship packages/cli/README.md for the registry page, know-code skills --global for cross-repo harness installs, and bump to 0.1.3. Know-Code-Verified: e40e38dbcda584f35980d61a2d3d29eb73abdc19b264cd23bddd848c0d2d8a37
1 parent 23da07c commit 62fccb6

13 files changed

Lines changed: 164 additions & 12 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.1.3
4+
5+
### Package
6+
- Add `packages/cli/README.md` so the npm package page has documentation
7+
- `know-code skills [--global]` wraps `npx skills add chtnnh/know-code` for project or user-global skill install
8+
9+
### Docs
10+
- Document global skill install (`--global` / harness home dirs)
11+
312
## 0.1.2
413

514
### Package

‎README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ npm i -g @chtnnh/know-code
2828
npm i -g github:chtnnh/know-code#main:packages/cli
2929

3030
know-code init --level standard --agents claude,cursor,codex --workflow
31-
npx skills add chtnnh/know-code
31+
32+
# Skills — project only, or global (all repos)
33+
know-code skills
34+
know-code skills --global
35+
# equivalent: npx skills add chtnnh/know-code [--global]
3236
```
3337

3438
`init --workflow` adds a GitHub Actions workflow that uses [`chtnnh/know-code/action@v0.1.2`](./action).
@@ -49,6 +53,7 @@ Zed has no PreToolUse-style shell hooks. Rely on git hooks from `know-code init`
4953

5054
```bash
5155
know-code init [--level …] [--base-branch main] [--agents …] [--workflow]
56+
know-code skills [--global] [--agents cursor,claude-code,…]
5257
know-code status [--json]
5358
know-code hash [--json]
5459
know-code check

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "know-code-monorepo",
33
"private": true,
4-
"version": "0.1.2",
4+
"version": "0.1.3",
55
"description": "k(no)w-code — agents don't push until you know exactly what's changed",
66
"workspaces": [
77
"packages/cli",

‎packages/cli/README.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# @chtnnh/know-code
2+
3+
**Agents don’t push until you know exactly what’s changed.**
4+
5+
CLI that gates `git commit` / `git push` / PR creation until a human passes a browser comprehension quiz about the staged diff. Pair with the [know-code Agent Skills](https://github.com/chtnnh/know-code) in Claude Code, Cursor, Codex, and other agentskills.io harnesses.
6+
7+
**Docs:** [kc.chtnnhfoundation.org](https://kc.chtnnhfoundation.org) · **Repo:** [chtnnh/know-code](https://github.com/chtnnh/know-code)
8+
9+
## Install
10+
11+
```bash
12+
npm i -g @chtnnh/know-code
13+
know-code init --level standard --agents claude,cursor,codex --workflow
14+
```
15+
16+
The npm binary is `know-code` (package name is scoped because unscoped `know-code` collides with `knowcode` on npm).
17+
18+
## Skills (project or global)
19+
20+
```bash
21+
# This repo / project only
22+
know-code skills
23+
# same as: npx skills add chtnnh/know-code
24+
25+
# All repos — install into your user harness dirs (~/.cursor/skills, ~/.claude/skills, …)
26+
know-code skills --global
27+
# same as: npx skills add chtnnh/know-code --global
28+
```
29+
30+
## Everyday commands
31+
32+
```bash
33+
know-code status
34+
know-code ask --quiz .know-code/quiz.json
35+
know-code pass --level standard --hash "$(know-code hash)"
36+
know-code commit -m "feat: …" # adds Know-Code-Verified trailer
37+
know-code verify # CI
38+
```
39+
40+
## CI
41+
42+
```yaml
43+
- uses: actions/checkout@v4
44+
with: { fetch-depth: 0 }
45+
- uses: chtnnh/know-code/action@v0.1.2
46+
with:
47+
base-branch: main
48+
```
49+
50+
Or `know-code init --workflow`.
51+
52+
## License
53+
54+
MIT

‎packages/cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chtnnh/know-code",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Gate git push / PR creation until the human passes a comprehension quiz about the diff",
55
"type": "module",
66
"bin": {

‎packages/cli/src/commands/init.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ export function cmdInit(opts: {
121121
console.log(`Config written → .know-code/config.json (level: ${config.level})`);
122122
console.log("");
123123
console.log("Next steps:");
124-
console.log(" 1. npm i -g @chtnnh/know-code # or: npm i -g github:chtnnh/know-code#main:packages/cli");
125-
console.log(" 2. npx skills add chtnnh/know-code");
124+
console.log(" 1. npm i -g @chtnnh/know-code");
125+
console.log(" 2. Skills (pick one):");
126+
console.log(" know-code skills # this repo only");
127+
console.log(" know-code skills --global # all repos (Cursor/Claude/Codex/…)");
126128
console.log(" 3. teach → implement → know-code ask (browser quiz) → know-code pass");
127129
console.log(' 4. know-code commit -m "…" # adds Know-Code-Verified trailer');
128130
console.log(`Docs: ${DOCS}`);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { spawnSync } from "node:child_process";
2+
3+
const SKILLS_SOURCE = "chtnnh/know-code";
4+
5+
/**
6+
* Install know-code + know-code-teach via the agentskills `skills` CLI.
7+
* --global puts skills in user harness dirs (e.g. ~/.cursor/skills) so they
8+
* apply across all repositories.
9+
*/
10+
export function cmdSkills(opts: {
11+
global?: boolean;
12+
agents?: string;
13+
yes?: boolean;
14+
}): void {
15+
const args = ["skills", "add", SKILLS_SOURCE];
16+
if (opts.global) args.push("--global");
17+
if (opts.yes) args.push("--yes");
18+
if (opts.agents) {
19+
for (const a of opts.agents.split(",").map((s) => s.trim()).filter(Boolean)) {
20+
args.push("--agent", a);
21+
}
22+
}
23+
24+
console.log(`know-code: running npx ${args.join(" ")}`);
25+
if (opts.global) {
26+
console.log(
27+
"know-code: global install → user skill dirs (available in every repo for selected harnesses)",
28+
);
29+
} else {
30+
console.log("know-code: project install → .agents/skills (or agent-specific project dirs)");
31+
}
32+
33+
const result = spawnSync("npx", ["--yes", ...args], {
34+
stdio: "inherit",
35+
shell: process.platform === "win32",
36+
});
37+
38+
if (result.error) {
39+
throw new Error(
40+
`Failed to run npx skills: ${result.error.message}\n` +
41+
`Install Node/npm, then: npx skills add ${SKILLS_SOURCE}${opts.global ? " --global" : ""}`,
42+
);
43+
}
44+
if (result.status !== 0) {
45+
process.exit(result.status ?? 1);
46+
}
47+
48+
console.log("");
49+
console.log("know-code: skills installed.");
50+
if (opts.global) {
51+
console.log(" Tip: restart or reload the agent window if skills don’t appear yet.");
52+
console.log(" List: npx skills ls -g");
53+
}
54+
}

‎packages/cli/src/index.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { cmdCommit } from "./commands/commit.js";
55
import { cmdHash } from "./commands/hash.js";
66
import { cmdInit } from "./commands/init.js";
77
import { cmdPass } from "./commands/pass.js";
8+
import { cmdSkills } from "./commands/skills.js";
89
import { cmdStatus } from "./commands/status.js";
910
import { cmdVerify } from "./commands/verify.js";
1011

@@ -13,6 +14,7 @@ const HELP = `know-code — block commit/push/PR until you can explain the diff
1314
Usage:
1415
know-code init [--level lite|standard|deep] [--base-branch main]
1516
[--agents claude,cursor,codex] [--require-trailer] [--workflow]
17+
know-code skills [--global|-g] [--agents <names>] [--yes]
1618
know-code check
1719
know-code pass [--level lite|standard|deep] [--hash <diffHash>]
1820
know-code ask [--quiz .know-code/quiz.json] [--port 3847] [--timeout 1800] [--no-open]
@@ -109,6 +111,17 @@ function main(): void {
109111
case "commit":
110112
cmdCommit(rest[0] === "--" ? rest.slice(1) : rest);
111113
break;
114+
case "skills":
115+
cmdSkills({
116+
global:
117+
flags.global === true ||
118+
flags.g === true ||
119+
rest.includes("-g") ||
120+
rest.includes("--global"),
121+
agents: typeof flags.agents === "string" ? flags.agents : undefined,
122+
yes: flags.yes === true || flags.y === true || rest.includes("-y"),
123+
});
124+
break;
112125
case "help":
113126
case "--help":
114127
case "-h":
@@ -117,7 +130,7 @@ function main(): void {
117130
case "version":
118131
case "--version":
119132
case "-v":
120-
console.log("0.1.2");
133+
console.log("0.1.3");
121134
break;
122135
default:
123136
console.error(`Unknown command: ${command}\n`);

‎skills/know-code/SKILL.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Then push when asked / when shipping.
111111
```bash
112112
npm i -g @chtnnh/know-code
113113
know-code init --level standard --agents claude,cursor,codex --workflow
114-
npx skills add chtnnh/know-code
114+
know-code skills # project
115+
know-code skills --global # all repos
115116
```
116117

117118
Docs: https://kc.chtnnhfoundation.org

‎website/docs/cli.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ npm i -g @chtnnh/know-code
1414
| Command | Purpose |
1515
|---------|---------|
1616
| `know-code init` | Config, git hooks; optional `--agents`, `--workflow` |
17+
| `know-code skills [--global]` | Install Agent Skills (project or user-global) |
1718
| `know-code status [--json]` | Gate status, hash, range |
1819
| `know-code hash [--json]` | Print current index hash |
1920
| `know-code check` | Exit 0 allow / 2 block |

0 commit comments

Comments
 (0)