cozempic 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. package/install.js +37 -14
  2. package/package.json +31 -8
package/install.js CHANGED
@@ -2,26 +2,49 @@
2
2
  "use strict";
3
3
 
4
4
  const { spawnSync } = require("child_process");
5
+ const { existsSync } = require("fs");
6
+ const { join } = require("path");
7
+
8
+ // ── 1. Install Python package ─────────────────────────────────────────────────
5
9
 
6
- // Skip if already installed
7
10
  const check = spawnSync("cozempic", ["--version"], { stdio: "pipe" });
8
- if (check.status === 0) process.exit(0);
11
+ const alreadyInstalled = check.status === 0;
9
12
 
10
- console.log("Installing cozempic Python package...");
13
+ if (!alreadyInstalled) {
14
+ console.log("Installing cozempic Python package...");
11
15
 
12
- const attempts = [
13
- ["pip", ["install", "cozempic", "--quiet", "--disable-pip-version-check"]],
14
- ["pip3", ["install", "cozempic", "--quiet", "--disable-pip-version-check"]],
15
- ["python", ["-m", "pip", "install", "cozempic", "--quiet"]],
16
- ["python3", ["-m", "pip", "install", "cozempic", "--quiet"]],
17
- ];
16
+ const attempts = [
17
+ ["pip", ["install", "cozempic", "--quiet", "--disable-pip-version-check"]],
18
+ ["pip3", ["install", "cozempic", "--quiet", "--disable-pip-version-check"]],
19
+ ["python", ["-m", "pip", "install", "cozempic", "--quiet"]],
20
+ ["python3", ["-m", "pip", "install", "cozempic", "--quiet"]],
21
+ ];
18
22
 
19
- for (const [cmd, args] of attempts) {
20
- const r = spawnSync(cmd, args, { stdio: "inherit" });
21
- if (r.status === 0) {
22
- console.log("cozempic ready.");
23
+ let installed = false;
24
+ for (const [cmd, args] of attempts) {
25
+ const r = spawnSync(cmd, args, { stdio: "inherit" });
26
+ if (r.status === 0) { installed = true; break; }
27
+ }
28
+
29
+ if (!installed) {
30
+ console.log("\ncozempic could not be auto-installed. Run manually:\n pip install cozempic\n");
23
31
  process.exit(0);
24
32
  }
25
33
  }
26
34
 
27
- console.log("\ncozempic could not be auto-installed. Run manually:\n pip install cozempic\n");
35
+ // ── 2. Auto-configure if inside a Claude Code project ────────────────────────
36
+
37
+ const cwd = process.env.INIT_CWD || process.cwd();
38
+ const isClaudeProject = existsSync(join(cwd, ".claude"));
39
+
40
+ if (isClaudeProject) {
41
+ console.log("Claude Code project detected — running cozempic init...");
42
+ const r = spawnSync("cozempic", ["init"], { stdio: "inherit", cwd });
43
+ if (r.status === 0) {
44
+ console.log("Guard daemon and hooks wired. Auto-pruning is active.");
45
+ } else {
46
+ console.log("cozempic init failed — run manually: cozempic init");
47
+ }
48
+ } else {
49
+ console.log("cozempic ready. Run inside your Claude Code project to enable auto-guard:\n cd your-project/ && cozempic init");
50
+ }
package/package.json CHANGED
@@ -1,15 +1,38 @@
1
1
  {
2
2
  "name": "cozempic",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Context weight-loss for Claude Code — prune bloated sessions, protect Agent Teams from compaction",
5
- "keywords": ["claude", "claude-code", "context", "pruning", "jsonl", "agent-teams", "compaction", "mcp"],
5
+ "keywords": [
6
+ "claude",
7
+ "claude-code",
8
+ "context",
9
+ "pruning",
10
+ "jsonl",
11
+ "agent-teams",
12
+ "compaction",
13
+ "mcp"
14
+ ],
6
15
  "homepage": "https://github.com/Ruya-AI/cozempic",
7
- "repository": { "type": "git", "url": "https://github.com/Ruya-AI/cozempic.git" },
8
- "bugs": { "url": "https://github.com/Ruya-AI/cozempic/issues" },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Ruya-AI/cozempic.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Ruya-AI/cozempic/issues"
22
+ },
9
23
  "license": "MIT",
10
24
  "author": "Ruya AI",
11
- "bin": { "cozempic": "./bin/cozempic.js" },
12
- "scripts": { "postinstall": "node install.js" },
13
- "files": ["bin/", "install.js"],
14
- "engines": { "node": ">=16" }
25
+ "bin": {
26
+ "cozempic": "bin/cozempic.js"
27
+ },
28
+ "scripts": {
29
+ "postinstall": "node install.js"
30
+ },
31
+ "files": [
32
+ "bin/",
33
+ "install.js"
34
+ ],
35
+ "engines": {
36
+ "node": ">=16"
37
+ }
15
38
  }