@kelceyp/caw 1.0.28 → 1.0.30
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/dist/caw.js +1 -1
- package/dist/postinstall.js +144 -0
- package/package.json +3 -4
- package/scripts/postinstall.js +0 -14
package/dist/caw.js
CHANGED
|
@@ -11066,7 +11066,7 @@ function debug(fmt, ...args) {
|
|
|
11066
11066
|
`);
|
|
11067
11067
|
}
|
|
11068
11068
|
function resolveApiKey() {
|
|
11069
|
-
return process.env.POSTHOG_API_KEY ??
|
|
11069
|
+
return process.env.POSTHOG_API_KEY ?? "phc_kxCKEn8saL3Zg4mexitLRiqFybxHzTK7gNcxurdh2Ycq";
|
|
11070
11070
|
}
|
|
11071
11071
|
function launcherVersion() {
|
|
11072
11072
|
try {
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// scripts/postinstall.js
|
|
2
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
// src/guards.js
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { execSync } from "node:child_process";
|
|
7
|
+
var EXIT_PLATFORM = 100;
|
|
8
|
+
var EXIT_ARCH = 101;
|
|
9
|
+
var EXIT_NODE = 102;
|
|
10
|
+
var EXIT_ROOT = 103;
|
|
11
|
+
var EXIT_WRITABLE = 104;
|
|
12
|
+
var INSTALL_GUIDE_URL = "https://athenadesign.com.au/caw/installation-guide";
|
|
13
|
+
var GUIDE_TAIL = `See ${INSTALL_GUIDE_URL} for the full walkthrough.`;
|
|
14
|
+
function buildPrefixWritableMessage(prefix) {
|
|
15
|
+
return `caw: writable preflight check failed.
|
|
16
|
+
` + `The npm global prefix is not writable.
|
|
17
|
+
|
|
18
|
+
` + `sudo npm install -g @kelceyp/caw-server@latest
|
|
19
|
+
` + `(and, if the target server needs a newer launcher: sudo npm install -g @kelceyp/caw@latest)
|
|
20
|
+
|
|
21
|
+
` + `${GUIDE_TAIL}
|
|
22
|
+
|
|
23
|
+
` + `Observed prefix: ${prefix}
|
|
24
|
+
` + `Note: sudo may resolve a different Node than your login shell — compare \`node --version\` with \`sudo node --version\` before running.`;
|
|
25
|
+
}
|
|
26
|
+
function checkNodeVersion() {
|
|
27
|
+
const major = parseInt(process.versions.node.split(".")[0], 10);
|
|
28
|
+
if (major >= 24) {
|
|
29
|
+
return { ok: true, message: null };
|
|
30
|
+
}
|
|
31
|
+
const message = `caw: node preflight check failed.
|
|
32
|
+
` + `caw requires Node.js 24 or later.
|
|
33
|
+
|
|
34
|
+
` + `Install Node.js 24 or later (nvm is the recommended path to a user-owned Node).
|
|
35
|
+
|
|
36
|
+
` + `${GUIDE_TAIL}
|
|
37
|
+
|
|
38
|
+
` + `Observed Node: ${process.version}`;
|
|
39
|
+
return { ok: false, message };
|
|
40
|
+
}
|
|
41
|
+
function checkPrefixWritable() {
|
|
42
|
+
let prefix;
|
|
43
|
+
try {
|
|
44
|
+
prefix = execSync("npm config get prefix", { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
45
|
+
} catch {
|
|
46
|
+
return { ok: true, message: null };
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
fs.accessSync(prefix, fs.constants.W_OK);
|
|
50
|
+
return { ok: true, message: null };
|
|
51
|
+
} catch {
|
|
52
|
+
return {
|
|
53
|
+
ok: false,
|
|
54
|
+
message: buildPrefixWritableMessage(prefix)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function checkPlatform() {
|
|
59
|
+
if (process.platform === "darwin") {
|
|
60
|
+
return { ok: true, message: null };
|
|
61
|
+
}
|
|
62
|
+
const message = `caw: platform preflight check failed.
|
|
63
|
+
` + `caw supports macOS only.
|
|
64
|
+
|
|
65
|
+
` + `Install caw on a macOS (darwin) host.
|
|
66
|
+
|
|
67
|
+
` + `${GUIDE_TAIL}
|
|
68
|
+
|
|
69
|
+
` + `Observed platform: ${process.platform}`;
|
|
70
|
+
return { ok: false, message };
|
|
71
|
+
}
|
|
72
|
+
function checkArch() {
|
|
73
|
+
if (process.arch === "x64" || process.arch === "arm64") {
|
|
74
|
+
return { ok: true, message: null };
|
|
75
|
+
}
|
|
76
|
+
const message = `caw: arch preflight check failed.
|
|
77
|
+
` + `caw supports x64 (Intel) and arm64 (Apple Silicon) only.
|
|
78
|
+
|
|
79
|
+
` + `Install caw on a supported architecture.
|
|
80
|
+
|
|
81
|
+
` + `${GUIDE_TAIL}
|
|
82
|
+
|
|
83
|
+
` + `Observed arch: ${process.arch}`;
|
|
84
|
+
return { ok: false, message };
|
|
85
|
+
}
|
|
86
|
+
function checkNotRoot() {
|
|
87
|
+
const uid = process.getuid?.();
|
|
88
|
+
if (uid !== 0) {
|
|
89
|
+
return { ok: true, message: null };
|
|
90
|
+
}
|
|
91
|
+
const message = `caw: not-root preflight check failed.
|
|
92
|
+
` + `Refusing to run as root — this command must not be invoked under sudo.
|
|
93
|
+
|
|
94
|
+
` + `Re-run the command without sudo.
|
|
95
|
+
|
|
96
|
+
` + `${GUIDE_TAIL}`;
|
|
97
|
+
return { ok: false, message };
|
|
98
|
+
}
|
|
99
|
+
function runInstallPreflight({ requireNotRoot }) {
|
|
100
|
+
const platform = checkPlatform();
|
|
101
|
+
if (!platform.ok) {
|
|
102
|
+
return { ok: false, failedGate: "platform", message: platform.message, exitCode: EXIT_PLATFORM };
|
|
103
|
+
}
|
|
104
|
+
const arch = checkArch();
|
|
105
|
+
if (!arch.ok) {
|
|
106
|
+
return { ok: false, failedGate: "arch", message: arch.message, exitCode: EXIT_ARCH };
|
|
107
|
+
}
|
|
108
|
+
const node = checkNodeVersion();
|
|
109
|
+
if (!node.ok) {
|
|
110
|
+
return { ok: false, failedGate: "node", message: node.message, exitCode: EXIT_NODE };
|
|
111
|
+
}
|
|
112
|
+
if (requireNotRoot) {
|
|
113
|
+
const notRoot = checkNotRoot();
|
|
114
|
+
if (!notRoot.ok) {
|
|
115
|
+
return { ok: false, failedGate: "root", message: notRoot.message, exitCode: EXIT_ROOT };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const writable = checkPrefixWritable();
|
|
119
|
+
if (!writable.ok) {
|
|
120
|
+
return { ok: false, failedGate: "writable", message: writable.message, exitCode: EXIT_WRITABLE };
|
|
121
|
+
}
|
|
122
|
+
return { ok: true, failedGate: null, message: null };
|
|
123
|
+
}
|
|
124
|
+
function emitPreflightFailure(result, { warnOnly = false } = {}) {
|
|
125
|
+
if (warnOnly) {
|
|
126
|
+
console.log(result.message);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
console.error(result.message);
|
|
130
|
+
process.exit(result.exitCode);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// scripts/postinstall.js
|
|
134
|
+
var preflight = runInstallPreflight({ requireNotRoot: false });
|
|
135
|
+
if (!preflight.ok) {
|
|
136
|
+
emitPreflightFailure(preflight, { warnOnly: true });
|
|
137
|
+
} else {
|
|
138
|
+
try {
|
|
139
|
+
execSync2("npm install -g @kelceyp/caw-server@^1 --loglevel=error", { stdio: "inherit" });
|
|
140
|
+
} catch {
|
|
141
|
+
console.warn("Could not install @kelceyp/caw-server automatically.");
|
|
142
|
+
console.warn('Run "caw start" to retry installation.');
|
|
143
|
+
}
|
|
144
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelceyp/caw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Unified Web/MCP server with React web app. Provides MD document management, handlebars based templating (documents, prompts and saved searches), user stories including task management and search (rag, fts & metadata with query language). CAW works with any agent that supports MCP but has specific integrations for Claude Code, Codex and Cursor CLI that enable agent orchestration. For humans, think of this as a browser-based reskinning of these tools enabling all prompts and outputs to be captured. For agents, this means that any of these three agents can be used by any other as a \"sub-agent\". And this works recursively to a user configurable depth.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,13 +27,12 @@
|
|
|
27
27
|
"caw": "dist/caw.js"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "bun build src/main.js --outfile dist/caw.js --target node --format esm",
|
|
30
|
+
"build": "bun build src/main.js --outfile dist/caw.js --target node --format esm && bun build scripts/postinstall.js --outfile dist/postinstall.js --target node --format esm",
|
|
31
31
|
"test": "bun test --isolate",
|
|
32
|
-
"postinstall": "node
|
|
32
|
+
"postinstall": "node dist/postinstall.js"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist/",
|
|
36
|
-
"scripts/postinstall.js",
|
|
37
36
|
"README.md"
|
|
38
37
|
],
|
|
39
38
|
"license": "Proprietary. All rights reserved. Free for personal and commercial use. Closed source.",
|
package/scripts/postinstall.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { runInstallPreflight, emitPreflightFailure } from '../src/guards.js';
|
|
3
|
-
|
|
4
|
-
const preflight = runInstallPreflight({ requireNotRoot: false });
|
|
5
|
-
if (!preflight.ok) {
|
|
6
|
-
emitPreflightFailure(preflight, { warnOnly: true });
|
|
7
|
-
} else {
|
|
8
|
-
try {
|
|
9
|
-
execSync('npm install -g @kelceyp/caw-server@^1 --loglevel=error', { stdio: 'inherit' });
|
|
10
|
-
} catch {
|
|
11
|
-
console.warn('Could not install @kelceyp/caw-server automatically.');
|
|
12
|
-
console.warn('Run "caw start" to retry installation.');
|
|
13
|
-
}
|
|
14
|
-
}
|