hopsule 0.9.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.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/bin/hopsule +22 -0
- package/bin/hopsule.cmd +17 -0
- package/install.js +212 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hopsule
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Hopsule CLI
|
|
2
|
+
|
|
3
|
+
Decision-first, context-aware, portable memory system for your projects.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g hopsule
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Other Installation Methods
|
|
12
|
+
|
|
13
|
+
| Method | Command |
|
|
14
|
+
|--------|---------|
|
|
15
|
+
| **Homebrew** | `brew install hopsule/tap/hopsule` |
|
|
16
|
+
| **Scoop** | `scoop bucket add hopsule https://github.com/Hopsule/scoop-bucket && scoop install hopsule` |
|
|
17
|
+
| **Chocolatey** | `choco install hopsule` |
|
|
18
|
+
| **Shell script** | `curl -fsSL https://raw.githubusercontent.com/Hopsule/cli-tool/main/install.sh \| bash` |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Launch interactive TUI dashboard
|
|
24
|
+
hopsule
|
|
25
|
+
|
|
26
|
+
# Login with device auth
|
|
27
|
+
hopsule login
|
|
28
|
+
|
|
29
|
+
# List decisions
|
|
30
|
+
hopsule list
|
|
31
|
+
|
|
32
|
+
# Create a decision
|
|
33
|
+
hopsule create
|
|
34
|
+
|
|
35
|
+
# Show status
|
|
36
|
+
hopsule status
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What is Hopsule?
|
|
40
|
+
|
|
41
|
+
Hopsule is a decision-first, context-aware, portable memory system. It helps teams and individuals:
|
|
42
|
+
|
|
43
|
+
- **Track architectural decisions** with full lifecycle (Draft -> Pending -> Accepted -> Deprecated)
|
|
44
|
+
- **Preserve project memory** across time, people, and tools
|
|
45
|
+
- **Share context** between projects, teams, and AI agents via Context Packs
|
|
46
|
+
- **Enforce past decisions** in development workflows
|
|
47
|
+
|
|
48
|
+
## Links
|
|
49
|
+
|
|
50
|
+
- [Documentation](https://github.com/Hopsule/cli-tool#readme)
|
|
51
|
+
- [GitHub](https://github.com/Hopsule/cli-tool)
|
|
52
|
+
- [Website](https://hopsule.com)
|
|
53
|
+
- [Issues](https://github.com/Hopsule/cli-tool/issues)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
package/bin/hopsule
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Hopsule CLI - npm wrapper
|
|
4
|
+
# This script launches the Go binary installed by the npm postinstall script.
|
|
5
|
+
|
|
6
|
+
BASEDIR=$(dirname "$0")
|
|
7
|
+
BINARY="$BASEDIR/hopsule"
|
|
8
|
+
|
|
9
|
+
# Check for the actual Go binary (not this wrapper)
|
|
10
|
+
if [ -f "${BINARY}" ] && [ ! "${BINARY}" -ef "$0" ]; then
|
|
11
|
+
exec "${BINARY}" "$@"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# Fallback: look for hopsule.exe (shouldn't happen on unix but be safe)
|
|
15
|
+
if [ -f "${BASEDIR}/hopsule.exe" ]; then
|
|
16
|
+
exec "${BASEDIR}/hopsule.exe" "$@"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "Error: hopsule binary not found." >&2
|
|
20
|
+
echo "Try reinstalling: npm install -g hopsule" >&2
|
|
21
|
+
echo "Or install directly: brew install hopsule/tap/hopsule" >&2
|
|
22
|
+
exit 1
|
package/bin/hopsule.cmd
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
:: Hopsule CLI - Windows npm wrapper
|
|
3
|
+
:: Launches the Go binary installed by the npm postinstall script.
|
|
4
|
+
|
|
5
|
+
setlocal
|
|
6
|
+
|
|
7
|
+
set "BASEDIR=%~dp0"
|
|
8
|
+
set "BINARY=%BASEDIR%hopsule.exe"
|
|
9
|
+
|
|
10
|
+
if exist "%BINARY%" (
|
|
11
|
+
"%BINARY%" %*
|
|
12
|
+
exit /b %ERRORLEVEL%
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
echo Error: hopsule binary not found. 1>&2
|
|
16
|
+
echo Try reinstalling: npm install -g hopsule 1>&2
|
|
17
|
+
exit /b 1
|
package/install.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const https = require("https");
|
|
9
|
+
const { execSync } = require("child_process");
|
|
10
|
+
|
|
11
|
+
const PACKAGE = require("./package.json");
|
|
12
|
+
const VERSION = PACKAGE.version;
|
|
13
|
+
const REPO = "Hopsule/cli-tool";
|
|
14
|
+
const BINARY_NAME = "hopsule";
|
|
15
|
+
|
|
16
|
+
const PLATFORM_MAP = {
|
|
17
|
+
darwin: "darwin",
|
|
18
|
+
linux: "linux",
|
|
19
|
+
win32: "windows",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const ARCH_MAP = {
|
|
23
|
+
x64: "amd64",
|
|
24
|
+
arm64: "arm64",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function getPlatform() {
|
|
28
|
+
const platform = PLATFORM_MAP[os.platform()];
|
|
29
|
+
if (!platform) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Unsupported platform: ${os.platform()}. ` +
|
|
32
|
+
`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return platform;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getArch() {
|
|
39
|
+
const arch = ARCH_MAP[os.arch()];
|
|
40
|
+
if (!arch) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Unsupported architecture: ${os.arch()}. ` +
|
|
43
|
+
`Supported: ${Object.keys(ARCH_MAP).join(", ")}`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return arch;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getDownloadUrl(platform, arch) {
|
|
50
|
+
const ext = platform === "windows" ? "zip" : "tar.gz";
|
|
51
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${BINARY_NAME}-${platform}-${arch}.${ext}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getBinaryPath() {
|
|
55
|
+
const binDir = path.join(__dirname, "bin");
|
|
56
|
+
const ext = os.platform() === "win32" ? ".exe" : "";
|
|
57
|
+
return path.join(binDir, `${BINARY_NAME}${ext}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function downloadFile(url) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const follow = (url, redirects = 0) => {
|
|
63
|
+
if (redirects > 10) {
|
|
64
|
+
return reject(new Error("Too many redirects"));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
https
|
|
68
|
+
.get(url, { headers: { "User-Agent": "hopsule-npm-installer" } }, (res) => {
|
|
69
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
70
|
+
return follow(res.headers.location, redirects + 1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (res.statusCode !== 200) {
|
|
74
|
+
return reject(
|
|
75
|
+
new Error(`Download failed: HTTP ${res.statusCode} from ${url}`)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const chunks = [];
|
|
80
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
81
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
82
|
+
res.on("error", reject);
|
|
83
|
+
})
|
|
84
|
+
.on("error", reject);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
follow(url);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function extractTarGz(buffer, destDir) {
|
|
92
|
+
const tmpFile = path.join(os.tmpdir(), `hopsule-${Date.now()}.tar.gz`);
|
|
93
|
+
fs.writeFileSync(tmpFile, buffer);
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
execSync(`tar xzf "${tmpFile}" -C "${destDir}"`, { stdio: "pipe" });
|
|
97
|
+
} finally {
|
|
98
|
+
try {
|
|
99
|
+
fs.unlinkSync(tmpFile);
|
|
100
|
+
} catch (_) {}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function extractZip(buffer, destDir) {
|
|
105
|
+
const tmpFile = path.join(os.tmpdir(), `hopsule-${Date.now()}.zip`);
|
|
106
|
+
fs.writeFileSync(tmpFile, buffer);
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
if (os.platform() === "win32") {
|
|
110
|
+
execSync(
|
|
111
|
+
`powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${destDir}' -Force"`,
|
|
112
|
+
{ stdio: "pipe" }
|
|
113
|
+
);
|
|
114
|
+
} else {
|
|
115
|
+
execSync(`unzip -o "${tmpFile}" -d "${destDir}"`, { stdio: "pipe" });
|
|
116
|
+
}
|
|
117
|
+
} finally {
|
|
118
|
+
try {
|
|
119
|
+
fs.unlinkSync(tmpFile);
|
|
120
|
+
} catch (_) {}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function install() {
|
|
125
|
+
const platform = getPlatform();
|
|
126
|
+
const arch = getArch();
|
|
127
|
+
const url = getDownloadUrl(platform, arch);
|
|
128
|
+
const binDir = path.join(__dirname, "bin");
|
|
129
|
+
const binaryPath = getBinaryPath();
|
|
130
|
+
|
|
131
|
+
// Skip if binary already exists with correct version
|
|
132
|
+
if (fs.existsSync(binaryPath)) {
|
|
133
|
+
try {
|
|
134
|
+
const output = execSync(`"${binaryPath}" --version`, {
|
|
135
|
+
encoding: "utf8",
|
|
136
|
+
stdio: "pipe",
|
|
137
|
+
});
|
|
138
|
+
if (output.includes(VERSION)) {
|
|
139
|
+
console.log(`hopsule v${VERSION} already installed.`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
} catch (_) {}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(`Installing hopsule v${VERSION} for ${platform}/${arch}...`);
|
|
146
|
+
console.log(`Downloading from: ${url}`);
|
|
147
|
+
|
|
148
|
+
const buffer = await downloadFile(url);
|
|
149
|
+
|
|
150
|
+
// Ensure bin directory exists
|
|
151
|
+
if (!fs.existsSync(binDir)) {
|
|
152
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Extract based on platform
|
|
156
|
+
const tmpExtractDir = path.join(os.tmpdir(), `hopsule-extract-${Date.now()}`);
|
|
157
|
+
fs.mkdirSync(tmpExtractDir, { recursive: true });
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
if (platform === "windows") {
|
|
161
|
+
await extractZip(buffer, tmpExtractDir);
|
|
162
|
+
} else {
|
|
163
|
+
await extractTarGz(buffer, tmpExtractDir);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Find and move the binary
|
|
167
|
+
const ext = platform === "windows" ? ".exe" : "";
|
|
168
|
+
const extractedBinary = path.join(tmpExtractDir, `${BINARY_NAME}${ext}`);
|
|
169
|
+
|
|
170
|
+
if (!fs.existsSync(extractedBinary)) {
|
|
171
|
+
// Some archives nest in a directory
|
|
172
|
+
const files = fs.readdirSync(tmpExtractDir);
|
|
173
|
+
let found = false;
|
|
174
|
+
for (const f of files) {
|
|
175
|
+
const nested = path.join(tmpExtractDir, f, `${BINARY_NAME}${ext}`);
|
|
176
|
+
if (fs.existsSync(nested)) {
|
|
177
|
+
fs.copyFileSync(nested, binaryPath);
|
|
178
|
+
found = true;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!found) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Binary not found in archive. Contents: ${files.join(", ")}`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
fs.copyFileSync(extractedBinary, binaryPath);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Make executable on unix
|
|
192
|
+
if (platform !== "windows") {
|
|
193
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
console.log(`hopsule v${VERSION} installed successfully!`);
|
|
197
|
+
} finally {
|
|
198
|
+
try {
|
|
199
|
+
fs.rmSync(tmpExtractDir, { recursive: true, force: true });
|
|
200
|
+
} catch (_) {}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
install().catch((err) => {
|
|
205
|
+
console.error(`Failed to install hopsule: ${err.message}`);
|
|
206
|
+
console.error("");
|
|
207
|
+
console.error("You can install manually from:");
|
|
208
|
+
console.error(` https://github.com/${REPO}/releases/tag/v${VERSION}`);
|
|
209
|
+
console.error("");
|
|
210
|
+
console.error("Or use Homebrew: brew install hopsule/tap/hopsule");
|
|
211
|
+
process.exit(1);
|
|
212
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hopsule",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "Decision-first, context-aware, portable memory system CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"decisions",
|
|
8
|
+
"architecture",
|
|
9
|
+
"memory",
|
|
10
|
+
"context",
|
|
11
|
+
"governance",
|
|
12
|
+
"hopsule"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://hopsule.com",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Hopsule/cli-tool/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Hopsule/cli-tool.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Hopsule <hello@hopsule.com>",
|
|
24
|
+
"bin": {
|
|
25
|
+
"hopsule": "./bin/hopsule"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"postinstall": "node install.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin/",
|
|
32
|
+
"install.js",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"os": [
|
|
37
|
+
"darwin",
|
|
38
|
+
"linux",
|
|
39
|
+
"win32"
|
|
40
|
+
],
|
|
41
|
+
"cpu": [
|
|
42
|
+
"x64",
|
|
43
|
+
"arm64"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=16"
|
|
47
|
+
}
|
|
48
|
+
}
|