@clubnet/seedclub 0.2.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/LICENSE +22 -0
- package/README.md +246 -0
- package/assets/extensions/seedclub/api-client.ts +102 -0
- package/assets/extensions/seedclub/auth.ts +89 -0
- package/assets/extensions/seedclub/commands/add.ts +601 -0
- package/assets/extensions/seedclub/commands/seedclub.ts +67 -0
- package/assets/extensions/seedclub/commands/signals.ts +86 -0
- package/assets/extensions/seedclub/commands/sort.ts +91 -0
- package/assets/extensions/seedclub/dia-cookies.ts +126 -0
- package/assets/extensions/seedclub/index.ts +166 -0
- package/assets/extensions/seedclub/package-lock.json +65 -0
- package/assets/extensions/seedclub/package.json +11 -0
- package/assets/extensions/seedclub/tool-utils.ts +32 -0
- package/assets/extensions/seedclub/tools/signals.ts +275 -0
- package/assets/extensions/seedclub/tools/utility.ts +31 -0
- package/assets/extensions/seedclub/twitter-client.ts +277 -0
- package/assets/extensions/seedclub-ui/editor.ts +93 -0
- package/assets/extensions/seedclub-ui/index.ts +15 -0
- package/assets/extensions/seedclub-ui/update.ts +73 -0
- package/assets/extensions/seedclub-ui/welcome.ts +250 -0
- package/assets/theme/seedclub.json +86 -0
- package/bin/cli.js +195 -0
- package/package.json +30 -0
- package/postinstall.js +175 -0
package/postinstall.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, rmSync } = require("fs");
|
|
4
|
+
const { join, dirname } = require("path");
|
|
5
|
+
const { homedir } = require("os");
|
|
6
|
+
const { execSync, execFileSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const HOME = homedir();
|
|
9
|
+
const SC_HOME = join(HOME, ".seedclub");
|
|
10
|
+
const SC_DIR = join(SC_HOME, "agent");
|
|
11
|
+
|
|
12
|
+
// Where this package is installed (contains assets/, package.json, etc.)
|
|
13
|
+
const PKG_ROOT = __dirname;
|
|
14
|
+
|
|
15
|
+
// ── Colors ──────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
const GREEN = "\x1b[32m";
|
|
18
|
+
const CYAN = "\x1b[36m";
|
|
19
|
+
const YELLOW = "\x1b[33m";
|
|
20
|
+
const RESET = "\x1b[0m";
|
|
21
|
+
|
|
22
|
+
function ok(msg) { console.log(`${GREEN}\u2713${RESET} ${msg}`); }
|
|
23
|
+
function info(msg) { console.log(`${CYAN}\u25b8${RESET} ${msg}`); }
|
|
24
|
+
function warn(msg) { console.log(`${YELLOW}\u26a0${RESET} ${msg}`); }
|
|
25
|
+
|
|
26
|
+
// ── 1. Create directory structure ───────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
for (const dir of ["extensions", "themes", "prompts"]) {
|
|
29
|
+
mkdirSync(join(SC_DIR, dir), { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ── 2. Copy theme ───────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
const themeSrc = join(PKG_ROOT, "assets", "theme", "seedclub.json");
|
|
35
|
+
const themeDest = join(SC_DIR, "themes", "seedclub.json");
|
|
36
|
+
if (existsSync(themeSrc)) {
|
|
37
|
+
cpSync(themeSrc, themeDest);
|
|
38
|
+
ok("Installed theme");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ── 3. Copy extensions ──────────────────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
for (const ext of ["seedclub", "seedclub-ui"]) {
|
|
44
|
+
const src = join(PKG_ROOT, "assets", "extensions", ext);
|
|
45
|
+
const dest = join(SC_DIR, "extensions", ext);
|
|
46
|
+
if (existsSync(src)) {
|
|
47
|
+
// Remove old copy first for a clean update
|
|
48
|
+
if (existsSync(dest)) {
|
|
49
|
+
rmSync(dest, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
cpSync(src, dest, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
ok("Installed extensions");
|
|
55
|
+
|
|
56
|
+
// ── 4. Install extension dependencies ───────────────────────────────────
|
|
57
|
+
|
|
58
|
+
const extPkgJson = join(SC_DIR, "extensions", "seedclub", "package.json");
|
|
59
|
+
if (existsSync(extPkgJson)) {
|
|
60
|
+
info("Installing extension dependencies...");
|
|
61
|
+
const extDir = join(SC_DIR, "extensions", "seedclub");
|
|
62
|
+
const hasLock = existsSync(join(extDir, "package-lock.json"));
|
|
63
|
+
const npmCmd = hasLock ? "npm ci" : "npm install";
|
|
64
|
+
let installed = false;
|
|
65
|
+
try {
|
|
66
|
+
execSync(`${npmCmd} --silent`, {
|
|
67
|
+
cwd: extDir,
|
|
68
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
69
|
+
});
|
|
70
|
+
installed = true;
|
|
71
|
+
} catch {
|
|
72
|
+
// Retry without --silent so errors are visible
|
|
73
|
+
try {
|
|
74
|
+
execSync(npmCmd, {
|
|
75
|
+
cwd: extDir,
|
|
76
|
+
stdio: "inherit",
|
|
77
|
+
});
|
|
78
|
+
installed = true;
|
|
79
|
+
} catch {
|
|
80
|
+
warn("Extension dependencies failed to install (non-fatal)");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!hasLock) warn("No lockfile for extension deps; installs may vary over time");
|
|
84
|
+
if (installed) ok("Extension dependencies installed");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ── 5. Create settings.json (only if missing) ──────────────────────────
|
|
88
|
+
|
|
89
|
+
const settingsFile = join(SC_DIR, "settings.json");
|
|
90
|
+
if (!existsSync(settingsFile)) {
|
|
91
|
+
writeFileSync(
|
|
92
|
+
settingsFile,
|
|
93
|
+
JSON.stringify(
|
|
94
|
+
{ theme: "seedclub", quietStartup: true, enableSkillCommands: true },
|
|
95
|
+
null,
|
|
96
|
+
2,
|
|
97
|
+
) + "\n",
|
|
98
|
+
);
|
|
99
|
+
ok("Created default settings");
|
|
100
|
+
} else {
|
|
101
|
+
ok("Settings already exist (preserved)");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ── 6. Pre-download tools (fd, rg) ─────────────────────────────────────
|
|
105
|
+
|
|
106
|
+
info("Downloading tools...");
|
|
107
|
+
try {
|
|
108
|
+
const piPkgPath = require.resolve(
|
|
109
|
+
"@mariozechner/pi-coding-agent/package.json",
|
|
110
|
+
);
|
|
111
|
+
const toolsManagerPath = join(
|
|
112
|
+
dirname(piPkgPath),
|
|
113
|
+
"dist",
|
|
114
|
+
"utils",
|
|
115
|
+
"tools-manager.js",
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
execFileSync(
|
|
119
|
+
process.execPath,
|
|
120
|
+
[
|
|
121
|
+
"-e",
|
|
122
|
+
`import('${toolsManagerPath.replace(/\\/g, "/")}')` +
|
|
123
|
+
`.then(m => Promise.all([m.ensureTool('fd', true), m.ensureTool('rg', true)]))` +
|
|
124
|
+
`.then(() => process.exit(0))` +
|
|
125
|
+
`.catch(() => process.exit(0))`,
|
|
126
|
+
],
|
|
127
|
+
{
|
|
128
|
+
env: {
|
|
129
|
+
...process.env,
|
|
130
|
+
PI_CODING_AGENT_DIR: SC_DIR,
|
|
131
|
+
NODE_OPTIONS: "--no-warnings",
|
|
132
|
+
},
|
|
133
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
134
|
+
timeout: 30000,
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
ok("Tools ready");
|
|
138
|
+
} catch {
|
|
139
|
+
ok("Tools will download on first run");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ── 7. Write version file ───────────────────────────────────────────────
|
|
143
|
+
|
|
144
|
+
const pkg = JSON.parse(
|
|
145
|
+
readFileSync(join(PKG_ROOT, "package.json"), "utf-8"),
|
|
146
|
+
);
|
|
147
|
+
writeFileSync(
|
|
148
|
+
join(SC_DIR, ".seedclub-version"),
|
|
149
|
+
JSON.stringify({
|
|
150
|
+
seedclubVersion: pkg.version,
|
|
151
|
+
piVersion: pkg.dependencies?.["@mariozechner/pi-coding-agent"] ?? "unknown",
|
|
152
|
+
installedAt: new Date().toISOString().replace(/\.\d+Z$/, "Z"),
|
|
153
|
+
}) + "\n",
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// ── 8. Clean up old curl|bash artifacts ─────────────────────────────────
|
|
157
|
+
|
|
158
|
+
const oldBin = join(SC_HOME, "bin");
|
|
159
|
+
const oldNodeModules = join(SC_HOME, "node_modules");
|
|
160
|
+
const oldPkgJson = join(SC_HOME, "package.json");
|
|
161
|
+
|
|
162
|
+
let cleaned = false;
|
|
163
|
+
for (const p of [oldBin, oldNodeModules]) {
|
|
164
|
+
if (existsSync(p)) {
|
|
165
|
+
rmSync(p, { recursive: true, force: true });
|
|
166
|
+
cleaned = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (existsSync(oldPkgJson)) {
|
|
170
|
+
rmSync(oldPkgJson);
|
|
171
|
+
cleaned = true;
|
|
172
|
+
}
|
|
173
|
+
if (cleaned) {
|
|
174
|
+
ok("Cleaned up old installation artifacts");
|
|
175
|
+
}
|