plan-atlas 0.0.0-stage → 0.1.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/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /node_modules
2
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.1] - 2026-11-27
11
+
12
+ ### Changed
13
+
14
+ - Package metadata: the homepage now points to the website (https://wik1ngst-1103.github.io/plan-atlas/), and keywords and categories were added for npm and crates.io.
15
+
16
+ ## [0.1.0] - 2026-11-27
17
+
18
+ ### Added
19
+
20
+ - Plan store: Markdown plans under `~/.plan-atlas/plans/<project>/` stay the source of truth; a SQLite (FTS5, accent-insensitive) index rebuilds from them, with a file watcher and import of `~/.claude/plans`.
21
+ - Local web UI (Svelte, English + Vietnamese): plan documents, task board, live activity feed, topic panel, knowledge map and global search.
22
+ - Claude Code integration: `plan-atlas setup` / `uninstall-claude`, MCP server, hook handler that records tool activity and links sessions to tasks, and the `task` CLI.
23
+ - Single binary with the web UI embedded (pre-compressed, served by `Accept-Encoding`); localhost-only server with Host and `X-Plan-Atlas` guards.
24
+ - Resource budget check (`scripts/bench-memory.sh`): idle RSS ≤ 40 MB with 1,000 plans, binary ≤ 20 MB.
25
+ - Release pipeline (cargo-dist): shell, PowerShell, Homebrew and npm installers for macOS, Linux and Windows.
26
+ - Project scaffold: `plan-atlas` CLI skeleton (`serve`, `mcp`, `hook`, `setup`, `uninstall-claude`, `import`, `task`), CI workflow and GitHub issue/PR templates.
27
+ - `plan-atlas import <file|folder>... [--project <name>]`: import Markdown plans from anywhere. Folders are searched recursively for `*.md` (hidden folders, `node_modules` and `target` skipped, at most 2,000 files). Without `--project`, a plan goes to its git repository's project, else to the project of the Claude session that wrote it, else to `unsorted`. Re-imports are idempotent and files already in the store are skipped.
28
+ - Web **Import plans** button: upload `.md` files or a whole folder from the browser into an existing, new or unsorted project (`POST /api/import`; at most 200 files, 2 MB each, 20 MB in total).
29
+ - Redesigned plan reading view: comfortable reading width, numbered sections, file-path headings, and an outline that highlights the current section (with a collapsible menu on phones).
30
+ - Project website, deployed to GitHub Pages.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Plan Atlas contributors
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 CHANGED
@@ -1,3 +1,212 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Plan Atlas
4
+
5
+ **A local workspace for the implementation plans Claude Code writes, tracked across all your projects.**
6
+
7
+ [![CI](https://github.com/wik1ngst-1103/plan-atlas/actions/workflows/ci.yml/badge.svg)](https://github.com/wik1ngst-1103/plan-atlas/actions/workflows/ci.yml)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ ![Platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey)
10
+ [![Website](https://img.shields.io/badge/website-wik1ngst--1103.github.io%2Fplan--atlas-3b5bdb)](https://wik1ngst-1103.github.io/plan-atlas/)
11
+
12
+ **English** · [Tiếng Việt](README.vi.md)
13
+
14
+ </div>
15
+
16
+ <p align="center">
17
+ <img src="docs/images/plan-document.png" alt="A plan rendered as a document in Plan Atlas" width="900">
18
+ </p>
19
+
20
+ Plan Atlas collects the plans Claude Code produces, organizes them by project and presents each one as a structured document with tasks you can track. While Claude works, it shows which task is in progress and what each subagent is doing, in plain language that non-developers can follow. Everything runs on your machine from a single binary.
21
+
22
+ ## Contents
23
+
24
+ - [Features](#features)
25
+ - [Installation](#installation)
26
+ - [Getting started](#getting-started)
27
+ - [Usage](#usage)
28
+ - [Claude Code integration](#claude-code-integration)
29
+ - [Configuration](#configuration)
30
+ - [Plan format](#plan-format)
31
+ - [Architecture](#architecture)
32
+ - [Security and privacy](#security-and-privacy)
33
+ - [Contributing](#contributing)
34
+ - [License](#license)
35
+
36
+ ## Features
37
+
38
+ - **Central plan store.** Plans from every project live in one place, grouped by project. Plans already in `~/.claude/plans` are imported automatically, and plans stored anywhere else can be imported from a file or folder. Source files are never modified.
39
+ - **Plans as documents.** A consistent structure (Overview, Requirements & Scope, Technical Analysis, Task Breakdown, Risks & Rollback) with a section outline that follows your reading position.
40
+ - **Task tracking.** Each task carries a status, a complexity score from 1 to 5 and a recommended model and effort level. Update tasks from a board by drag and drop.
41
+ - **Live activity.** See which task Claude is working on and what each subagent is doing, nested under the relevant plan. Raw tool calls are available on demand.
42
+ - **Knowledge map.** Topics come from a shared, editable taxonomy. A graph shows how plans relate through dependencies and shared topics.
43
+ - **Search.** Full-text search across plans, tasks and topics, insensitive to diacritics.
44
+ - **Bilingual interface.** English and Vietnamese, selected from the browser language.
45
+ - **Lightweight.** A single binary of about 9 MB that uses roughly 16 MB of memory at idle with 1,000 plans.
46
+
47
+ ## Installation
48
+
49
+ > Prebuilt packages are published starting with v0.1.0.
50
+
51
+ | Platform | Command |
52
+ |---|---|
53
+ | macOS, Linux | `curl --proto '=https' --tlsv1.2 -LsSf https://github.com/wik1ngst-1103/plan-atlas/releases/latest/download/plan-atlas-installer.sh \| sh` |
54
+ | Windows (PowerShell) | `powershell -ExecutionPolicy Bypass -c "irm https://github.com/wik1ngst-1103/plan-atlas/releases/latest/download/plan-atlas-installer.ps1 \| iex"` |
55
+ | Homebrew | `brew install wik1ngst-1103/tap/plan-atlas` |
56
+ | npm | `npm install -g plan-atlas` |
57
+
58
+ Install globally. Running through `npx` is not supported, because Claude Code needs a stable path to the binary.
59
+
60
+ <details>
61
+ <summary>Build from source</summary>
62
+
63
+ Requires Rust 1.89 or later and Node.js 22 or later. The web interface is compiled into the binary.
64
+
65
+ ```sh
66
+ git clone https://github.com/wik1ngst-1103/plan-atlas.git
67
+ cd plan-atlas
68
+ (cd web && npm ci && npm run build)
69
+ cargo build --release
70
+ # binary: target/release/plan-atlas
71
+ ```
72
+
73
+ </details>
74
+
75
+ ## Getting started
76
+
77
+ ```sh
78
+ plan-atlas
79
+ ```
80
+
81
+ On first launch, Plan Atlas:
82
+
83
+ 1. offers to connect to Claude Code (see [Claude Code integration](#claude-code-integration)),
84
+ 2. imports existing plans from `~/.claude/plans`,
85
+ 3. opens the interface at `http://127.0.0.1:7420`.
86
+
87
+ Running the command again while Plan Atlas is already running opens a new browser tab instead of starting a second instance.
88
+
89
+ ## Usage
90
+
91
+ ### Commands
92
+
93
+ | Command | Description |
94
+ |---|---|
95
+ | `plan-atlas` | Start the application and open the browser. Options: `--port <n>`, `--no-open`. |
96
+ | `plan-atlas setup [--yes]` | Connect Plan Atlas to Claude Code. |
97
+ | `plan-atlas uninstall-claude [--yes]` | Remove everything `setup` added. Other settings are left untouched. |
98
+ | `plan-atlas import [PATH]... [--project <name>]` | Import plans. Without a path, imports `~/.claude/plans`. |
99
+ | `plan-atlas task start\|done <plan-id> <task-id>` | Update a task's status from the command line. |
100
+ | `plan-atlas mcp` | Run the MCP server over stdio. Started by Claude Code. |
101
+ | `plan-atlas hook` | Handle a Claude Code hook event. Invoked by Claude Code. |
102
+
103
+ ### Importing plans
104
+
105
+ Plans kept outside `~/.claude/plans` can be imported from the interface or the command line. Imports are idempotent: importing an unchanged file again has no effect.
106
+
107
+ - **Interface:** select **Import plans** below the project list, choose Markdown files or a folder, select a target project and confirm.
108
+ - **Command line:**
109
+
110
+ ```sh
111
+ plan-atlas import ~/notes/plans --project my-app
112
+ ```
113
+
114
+ Folders are searched recursively for `*.md` files. Hidden directories, `node_modules` and `target` are skipped. Without `--project`, each plan is assigned to the Git repository that contains it, then to the project of the Claude Code session that wrote it, and otherwise to `unsorted`.
115
+
116
+ ## Claude Code integration
117
+
118
+ `plan-atlas setup` makes three changes to your Claude Code configuration:
119
+
120
+ | Change | Location |
121
+ |---|---|
122
+ | Installs a Skill that tells Claude where and how to write plans | `~/.claude/skills/plan-atlas/SKILL.md` |
123
+ | Adds hooks for `PreToolUse`, `SubagentStart`, `SubagentStop` and `SessionEnd` | `~/.claude/settings.json` (a timestamped backup is written first; existing hooks are preserved) |
124
+ | Registers the MCP server | `claude mcp add --transport stdio --scope user plan-atlas -- plan-atlas mcp` |
125
+
126
+ With the integration in place, Claude creates plans through the MCP server, records task progress, and links related plans. Plans written in Claude Code's plan mode are registered after you approve them. To revert all changes, run `plan-atlas uninstall-claude`.
127
+
128
+ ## Configuration
129
+
130
+ | Setting | Default | Override |
131
+ |---|---|---|
132
+ | Data directory | `~/.plan-atlas` | `PLAN_ATLAS_HOME` environment variable |
133
+ | Port | `7420`, falling back up to `7430` | `--port` or `PLAN_ATLAS_PORT` |
134
+ | Claude Code directory | `~/.claude` | `CLAUDE_CONFIG_DIR` |
135
+ | Interface language | Browser language (English or Vietnamese) | Language switch in the top bar |
136
+ | Topic taxonomy | `~/.plan-atlas/taxonomy.toml` | Edit the file, then run `plan-atlas setup` to update the Skill |
137
+
138
+ ## Plan format
139
+
140
+ Plans are Markdown files with YAML front matter. Claude creates them through the MCP server, so writing them by hand is rarely necessary. Manual edits are supported: files are re-indexed on save, and structural problems appear as warnings in the interface rather than errors.
141
+
142
+ <details>
143
+ <summary>Example</summary>
144
+
145
+ ```markdown
146
+ ---
147
+ id: PLAN-auth-gateway-001
148
+ project: auth-gateway
149
+ title: Migrate sessions to JWT + RBAC
150
+ tags: [type/feature, domain/security, tech/jwt]
151
+ related:
152
+ - { to: PLAN-auth-gateway-000, type: depends_on }
153
+ created: 2026-11-20
154
+ ---
155
+ ## 01. Overview
156
+ ## 02. Requirements & Scope
157
+ ## 03. Technical Analysis
158
+ ### Current Architecture
159
+ ### Existing Problems
160
+ ### Proposed Architecture
161
+ ## 04. Task Breakdown
162
+ ### TASK-001: Authentication Service
163
+ - complexity: 4
164
+ - model: opus
165
+ - effort: medium
166
+ - status: todo
167
+ - tags: [tech/jwt]
168
+
169
+ Description and acceptance criteria.
170
+ ## 05. Risks & Rollback
171
+ ```
172
+
173
+ Supported relation types: `depends_on`, `extends`, `relates_to`. Task statuses: `todo`, `in_progress`, `review`, `done`.
174
+
175
+ </details>
176
+
177
+ ## Architecture
178
+
179
+ ```
180
+ Claude Code ── MCP (stdio) ── plan-atlas mcp ──┐
181
+ Claude Code ── hooks ──────── plan-atlas hook ─┼──► SQLite index ◄── plan-atlas server (127.0.0.1)
182
+ ~/.plan-atlas/plans/*.md ◄─── file watcher ────┘ ▲
183
+ browser
184
+ ```
185
+
186
+ - A single Rust binary provides the web server, MCP server, hook handler and installer. The Svelte interface is embedded in it.
187
+ - Markdown files are the source of truth. The SQLite database is an index that can be deleted and rebuilt at any time.
188
+ - Live updates reach the browser over Server-Sent Events.
189
+
190
+ ## Security and privacy
191
+
192
+ - No telemetry. The server listens only on `127.0.0.1` and makes no outbound connections.
193
+ - Requests are rejected unless the `Host` header names the local server, which protects against DNS rebinding. Write requests also require a custom header.
194
+ - Plan content is sanitized before rendering.
195
+ - The hook handler is designed never to interfere with Claude Code: it always exits with code 0, prints nothing and finishes within 200 ms.
196
+
197
+ To report a vulnerability, see [SECURITY.md](SECURITY.md).
198
+
199
+ ## Contributing
200
+
201
+ Contributions are welcome, including code, translations, taxonomy topics, documentation and bug reports. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup and guidelines. All participants are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
202
+
203
+ ## Roadmap
204
+
205
+ - Run as a background service (launchd, systemd, Windows service)
206
+ - Per-task cost and token usage
207
+ - Export a plan as a shareable static page
208
+ - Additional interface languages
209
+
210
+ ## License
211
+
212
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,348 @@
1
+ const {
2
+ createWriteStream,
3
+ existsSync,
4
+ mkdirSync,
5
+ mkdtemp,
6
+ rmSync,
7
+ } = require("fs");
8
+ const { join, sep } = require("path");
9
+ const { spawnSync } = require("child_process");
10
+ const { tmpdir } = require("os");
11
+
12
+ const https = require("node:https");
13
+ const http = require("node:http");
14
+
15
+ const tmpDir = tmpdir();
16
+
17
+ const error = (msg) => {
18
+ console.error(msg);
19
+ process.exit(1);
20
+ };
21
+
22
+ function getProxyForUrl(urlString) {
23
+ const url = new URL(urlString);
24
+ const isHttps = url.protocol === "https:";
25
+
26
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy || "";
27
+ if (noProxy === "*") return null;
28
+ if (noProxy) {
29
+ const hostname = url.hostname.toLowerCase();
30
+ const noProxyList = noProxy.split(",").map((s) => s.trim().toLowerCase());
31
+ for (const entry of noProxyList) {
32
+ if (hostname === entry || hostname.endsWith("." + entry)) {
33
+ return null;
34
+ }
35
+ }
36
+ }
37
+
38
+ const proxyEnv = isHttps
39
+ ? process.env.HTTPS_PROXY || process.env.https_proxy
40
+ : process.env.HTTP_PROXY || process.env.http_proxy;
41
+
42
+ if (!proxyEnv) return null;
43
+
44
+ const proxyUrl = new URL(proxyEnv);
45
+
46
+ let auth = null;
47
+ if (proxyUrl.username || proxyUrl.password) {
48
+ auth = `${proxyUrl.username}:${proxyUrl.password}`;
49
+ }
50
+
51
+ return {
52
+ hostname: proxyUrl.hostname,
53
+ port: proxyUrl.port || (proxyUrl.protocol === "https:" ? 443 : 80),
54
+ auth: auth,
55
+ };
56
+ }
57
+
58
+ function connectThroughProxy(proxy, target) {
59
+ return new Promise((resolve, reject) => {
60
+ const headers = {};
61
+ if (proxy.auth) {
62
+ headers["Proxy-Authorization"] =
63
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
64
+ }
65
+
66
+ const connectReq = http.request({
67
+ hostname: proxy.hostname,
68
+ port: proxy.port,
69
+ method: "CONNECT",
70
+ path: `${target.hostname}:${target.port || 443}`,
71
+ headers,
72
+ });
73
+ connectReq.on("connect", (res, socket) => {
74
+ if (res.statusCode === 200) {
75
+ resolve(socket);
76
+ } else {
77
+ reject(new Error(`Proxy CONNECT failed with status ${res.statusCode}`));
78
+ }
79
+ });
80
+ connectReq.on("error", reject);
81
+ connectReq.end();
82
+ });
83
+ }
84
+
85
+ function download(urlString, maxRedirects) {
86
+ if (maxRedirects === undefined) maxRedirects = 5;
87
+ return new Promise((resolve, reject) => {
88
+ if (maxRedirects < 0) {
89
+ return reject(new Error("Too many redirects"));
90
+ }
91
+
92
+ const parsed = new URL(urlString);
93
+ const isHttps = parsed.protocol === "https:";
94
+ const mod = isHttps ? https : http;
95
+ const proxy = getProxyForUrl(urlString);
96
+
97
+ const doRequest = (extraOptions) => {
98
+ const options = Object.assign(
99
+ {
100
+ hostname: parsed.hostname,
101
+ port: parsed.port || (isHttps ? 443 : 80),
102
+ path: parsed.pathname + parsed.search,
103
+ method: "GET",
104
+ headers: { "User-Agent": "cargo-dist-npm-installer" },
105
+ },
106
+ extraOptions || {},
107
+ );
108
+
109
+ if (proxy && !isHttps) {
110
+ // HTTP through HTTP proxy: request the full URL via the proxy
111
+ options.hostname = proxy.hostname;
112
+ options.port = proxy.port;
113
+ options.path = urlString;
114
+ if (proxy.auth) {
115
+ options.headers["Proxy-Authorization"] =
116
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
117
+ }
118
+ }
119
+
120
+ const req = mod.request(options, (res) => {
121
+ if (
122
+ res.statusCode >= 300 &&
123
+ res.statusCode < 400 &&
124
+ res.headers.location
125
+ ) {
126
+ res.resume();
127
+ const nextUrl = new URL(res.headers.location, urlString).toString();
128
+ return download(nextUrl, maxRedirects - 1).then(resolve, reject);
129
+ }
130
+ if (res.statusCode < 200 || res.statusCode >= 300) {
131
+ res.resume();
132
+ return reject(new Error(`HTTP ${res.statusCode} from ${urlString}`));
133
+ }
134
+ resolve(res);
135
+ });
136
+ req.on("error", reject);
137
+ req.end();
138
+ };
139
+
140
+ if (proxy && isHttps) {
141
+ connectThroughProxy(proxy, parsed).then(
142
+ (socket) => doRequest({ socket, agent: false }),
143
+ reject,
144
+ );
145
+ } else {
146
+ doRequest();
147
+ }
148
+ });
149
+ }
150
+
151
+ class Package {
152
+ constructor(platform, name, url, filename, zipExt, binaries) {
153
+ let errors = [];
154
+ if (typeof url !== "string") {
155
+ errors.push("url must be a string");
156
+ } else {
157
+ try {
158
+ new URL(url);
159
+ } catch (e) {
160
+ errors.push(e);
161
+ }
162
+ }
163
+ if (name && typeof name !== "string") {
164
+ errors.push("package name must be a string");
165
+ }
166
+ if (!name) {
167
+ errors.push("You must specify the name of your package");
168
+ }
169
+ if (binaries && typeof binaries !== "object") {
170
+ errors.push("binaries must be a string => string map");
171
+ }
172
+ if (!binaries) {
173
+ errors.push("You must specify the binaries in the package");
174
+ }
175
+
176
+ if (errors.length > 0) {
177
+ let errorMsg =
178
+ "One or more of the parameters you passed to the Binary constructor are invalid:\n";
179
+ errors.forEach((error) => {
180
+ errorMsg += error;
181
+ });
182
+ errorMsg +=
183
+ '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})';
184
+ error(errorMsg);
185
+ }
186
+
187
+ this.platform = platform;
188
+ this.url = url;
189
+ this.name = name;
190
+ this.filename = filename;
191
+ this.zipExt = zipExt;
192
+ this.installDirectory = join(__dirname, "node_modules", ".bin_real");
193
+ this.binaries = binaries;
194
+
195
+ if (!existsSync(this.installDirectory)) {
196
+ mkdirSync(this.installDirectory, { recursive: true });
197
+ }
198
+ }
199
+
200
+ exists() {
201
+ for (const binaryName in this.binaries) {
202
+ const binRelPath = this.binaries[binaryName];
203
+ const binPath = join(this.installDirectory, binRelPath);
204
+ if (!existsSync(binPath)) {
205
+ return false;
206
+ }
207
+ }
208
+ return true;
209
+ }
210
+
211
+ install(suppressLogs = false) {
212
+ if (this.exists()) {
213
+ if (!suppressLogs) {
214
+ console.error(
215
+ `${this.name} is already installed, skipping installation.`,
216
+ );
217
+ }
218
+ return Promise.resolve();
219
+ }
220
+
221
+ try {
222
+ rmSync(this.installDirectory, { recursive: true, force: true });
223
+ } catch {
224
+ // ignore - directory may not exist
225
+ }
226
+
227
+ mkdirSync(this.installDirectory, { recursive: true });
228
+
229
+ if (!suppressLogs) {
230
+ console.error(`Downloading release from ${this.url}`);
231
+ }
232
+
233
+ return download(this.url)
234
+ .then((res) => {
235
+ return new Promise((resolve, reject) => {
236
+ mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
237
+ if (err) return reject(err);
238
+ let tempFile = join(directory, this.filename);
239
+ const sink = res.pipe(createWriteStream(tempFile));
240
+ sink.on("error", (err) => reject(err));
241
+ sink.on("close", () => {
242
+ if (/\.tar\.*/.test(this.zipExt)) {
243
+ const result = spawnSync("tar", [
244
+ "xf",
245
+ tempFile,
246
+ // The tarballs are stored with a leading directory
247
+ // component; we strip one component in the
248
+ // shell installers too.
249
+ "--strip-components",
250
+ "1",
251
+ "-C",
252
+ this.installDirectory,
253
+ ]);
254
+ if (result.status == 0) {
255
+ resolve();
256
+ } else if (result.error) {
257
+ reject(result.error);
258
+ } else {
259
+ reject(
260
+ new Error(
261
+ `An error occurred untarring the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
262
+ ),
263
+ );
264
+ }
265
+ } else if (this.zipExt == ".zip") {
266
+ let result;
267
+ if (this.platform.artifactName.includes("windows")) {
268
+ // Windows does not have "unzip" by default on many installations, instead
269
+ // we use Expand-Archive from powershell
270
+ result = spawnSync("powershell.exe", [
271
+ "-NoProfile",
272
+ "-NonInteractive",
273
+ "-Command",
274
+ `& {
275
+ param([string]$LiteralPath, [string]$DestinationPath)
276
+ Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force
277
+ }`,
278
+ tempFile,
279
+ this.installDirectory,
280
+ ]);
281
+ } else {
282
+ result = spawnSync("unzip", [
283
+ "-q",
284
+ tempFile,
285
+ "-d",
286
+ this.installDirectory,
287
+ ]);
288
+ }
289
+
290
+ if (result.status == 0) {
291
+ resolve();
292
+ } else if (result.error) {
293
+ reject(result.error);
294
+ } else {
295
+ reject(
296
+ new Error(
297
+ `An error occurred unzipping the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
298
+ ),
299
+ );
300
+ }
301
+ } else {
302
+ reject(
303
+ new Error(`Unrecognized file extension: ${this.zipExt}`),
304
+ );
305
+ }
306
+ });
307
+ });
308
+ });
309
+ })
310
+ .then(() => {
311
+ if (!suppressLogs) {
312
+ console.error(`${this.name} has been installed!`);
313
+ }
314
+ })
315
+ .catch((e) => {
316
+ error(`Error fetching release: ${e.message}`);
317
+ });
318
+ }
319
+
320
+ run(binaryName) {
321
+ const promise = !this.exists() ? this.install(true) : Promise.resolve();
322
+
323
+ promise
324
+ .then(() => {
325
+ const [, , ...args] = process.argv;
326
+
327
+ const options = { cwd: process.cwd(), stdio: "inherit" };
328
+
329
+ const binRelPath = this.binaries[binaryName];
330
+ if (!binRelPath) {
331
+ error(`${binaryName} is not a known binary in ${this.name}`);
332
+ }
333
+ const binPath = join(this.installDirectory, binRelPath);
334
+ const result = spawnSync(binPath, args, options);
335
+
336
+ if (result.error) {
337
+ error(result.error);
338
+ }
339
+
340
+ process.exit(result.status);
341
+ })
342
+ .catch((e) => {
343
+ error(e.message);
344
+ });
345
+ }
346
+ }
347
+
348
+ module.exports.Package = Package;
package/binary.js ADDED
@@ -0,0 +1,124 @@
1
+ const { Package } = require("./binary-install");
2
+ const os = require("os");
3
+ const libc = require("detect-libc");
4
+
5
+ const error = (msg) => {
6
+ console.error(msg);
7
+ process.exit(1);
8
+ };
9
+
10
+ const {
11
+ name,
12
+ artifactDownloadUrls,
13
+ supportedPlatforms,
14
+ glibcMinimum,
15
+ } = require("./package.json");
16
+
17
+ // FIXME: implement NPM installer handling of fallback download URLs
18
+ const artifactDownloadUrl = artifactDownloadUrls[0];
19
+ const builderGlibcMajorVersion = glibcMinimum.major;
20
+ const builderGlibcMinorVersion = glibcMinimum.series;
21
+
22
+ const getPlatform = () => {
23
+ const rawOsType = os.type();
24
+ const rawArchitecture = os.arch();
25
+
26
+ // We want to use rust-style target triples as the canonical key
27
+ // for a platform, so translate the "os" library's concepts into rust ones
28
+ let osType = "";
29
+ switch (rawOsType) {
30
+ case "Windows_NT":
31
+ osType = "pc-windows-msvc";
32
+ break;
33
+ case "Darwin":
34
+ osType = "apple-darwin";
35
+ break;
36
+ case "Linux":
37
+ osType = "unknown-linux-gnu";
38
+ break;
39
+ }
40
+
41
+ let arch = "";
42
+ switch (rawArchitecture) {
43
+ case "x64":
44
+ arch = "x86_64";
45
+ break;
46
+ case "arm64":
47
+ arch = "aarch64";
48
+ break;
49
+ }
50
+
51
+ if (rawOsType === "Linux") {
52
+ if (libc.familySync() == "musl") {
53
+ osType = "unknown-linux-musl-dynamic";
54
+ } else if (libc.isNonGlibcLinuxSync()) {
55
+ console.warn(
56
+ "Your libc is neither glibc nor musl; trying static musl binary instead",
57
+ );
58
+ osType = "unknown-linux-musl-static";
59
+ } else {
60
+ let libcVersion = libc.versionSync();
61
+ let splitLibcVersion = libcVersion.split(".");
62
+ let libcMajorVersion = splitLibcVersion[0];
63
+ let libcMinorVersion = splitLibcVersion[1];
64
+ if (
65
+ libcMajorVersion != builderGlibcMajorVersion ||
66
+ libcMinorVersion < builderGlibcMinorVersion
67
+ ) {
68
+ // We can't run the glibc binaries, but we can run the static musl ones
69
+ // if they exist
70
+ console.warn(
71
+ "Your glibc isn't compatible; trying static musl binary instead",
72
+ );
73
+ osType = "unknown-linux-musl-static";
74
+ }
75
+ }
76
+ }
77
+
78
+ // Assume the above succeeded and build a target triple to look things up with.
79
+ // If any of it failed, this lookup will fail and we'll handle it like normal.
80
+ let targetTriple = `${arch}-${osType}`;
81
+ let platform = supportedPlatforms[targetTriple];
82
+
83
+ if (!platform) {
84
+ error(
85
+ `Platform with type "${rawOsType}" and architecture "${rawArchitecture}" is not supported by ${name}.\nYour system must be one of the following:\n\n${Object.keys(
86
+ supportedPlatforms,
87
+ ).join(",")}`,
88
+ );
89
+ }
90
+
91
+ return platform;
92
+ };
93
+
94
+ const getPackage = () => {
95
+ const platform = getPlatform();
96
+ const url = `${artifactDownloadUrl}/${platform.artifactName}`;
97
+ let filename = platform.artifactName;
98
+ let ext = platform.zipExt;
99
+ let binary = new Package(platform, name, url, filename, ext, platform.bins);
100
+
101
+ return binary;
102
+ };
103
+
104
+ const install = (suppressLogs) => {
105
+ if (!artifactDownloadUrl || artifactDownloadUrl.length === 0) {
106
+ console.warn("in demo mode, not installing binaries");
107
+ return;
108
+ }
109
+ const pkg = getPackage();
110
+
111
+ return pkg.install(suppressLogs);
112
+ };
113
+
114
+ const run = (binaryName) => {
115
+ const pkg = getPackage();
116
+
117
+ pkg.run(binaryName);
118
+ };
119
+
120
+ module.exports = {
121
+ install,
122
+ run,
123
+ getPackage,
124
+ };
package/install.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { install } = require("./binary");
4
+ install(false);
@@ -0,0 +1,52 @@
1
+ {
2
+ "lockfileVersion": 3,
3
+ "name": "plan-atlas",
4
+ "packages": {
5
+ "": {
6
+ "bin": {
7
+ "plan-atlas": "run-plan-atlas.js"
8
+ },
9
+ "dependencies": {
10
+ "detect-libc": "^2.1.2"
11
+ },
12
+ "devDependencies": {
13
+ "prettier": "^3.9.10"
14
+ },
15
+ "engines": {
16
+ "node": ">=14.18",
17
+ "npm": ">=6"
18
+ },
19
+ "hasInstallScript": true,
20
+ "license": "MIT",
21
+ "name": "plan-atlas",
22
+ "version": "0.1.1"
23
+ },
24
+ "node_modules/detect-libc": {
25
+ "engines": {
26
+ "node": ">=8"
27
+ },
28
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
29
+ "license": "Apache-2.0",
30
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
31
+ "version": "2.1.2"
32
+ },
33
+ "node_modules/prettier": {
34
+ "bin": {
35
+ "prettier": "bin/prettier.cjs"
36
+ },
37
+ "dev": true,
38
+ "engines": {
39
+ "node": ">=14"
40
+ },
41
+ "funding": {
42
+ "url": "https://github.com/prettier/prettier?sponsor=1"
43
+ },
44
+ "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==",
45
+ "license": "MIT",
46
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz",
47
+ "version": "3.9.10"
48
+ }
49
+ },
50
+ "requires": true,
51
+ "version": "0.1.1"
52
+ }
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
+ "artifactDownloadUrls": [
3
+ "https://github.com/wik1ngst-1103/plan-atlas/releases/download/v0.1.1"
4
+ ],
5
+ "bin": {
6
+ "plan-atlas": "run-plan-atlas.js"
7
+ },
8
+ "dependencies": {
9
+ "detect-libc": "^2.1.2"
10
+ },
11
+ "description": "Local app that aggregates Claude Code plans into one searchable, browsable place",
12
+ "devDependencies": {
13
+ "prettier": "^3.9.10"
14
+ },
15
+ "engines": {
16
+ "node": ">=14.18",
17
+ "npm": ">=6"
18
+ },
19
+ "glibcMinimum": {
20
+ "major": 2,
21
+ "series": 39
22
+ },
23
+ "homepage": "https://wik1ngst-1103.github.io/plan-atlas/",
24
+ "keywords": [
25
+ "development-tools",
26
+ "command-line-utilities",
27
+ "claude-code",
28
+ "mcp",
29
+ "planning",
30
+ "ai-agents",
31
+ "developer-tools"
32
+ ],
33
+ "license": "MIT",
2
34
  "name": "plan-atlas",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
35
+ "preferUnplugged": true,
36
+ "repository": "https://github.com/wik1ngst-1103/plan-atlas",
37
+ "scripts": {
38
+ "fmt": "prettier --write **/*.js",
39
+ "fmt:check": "prettier --check **/*.js",
40
+ "postinstall": "node ./install.js"
41
+ },
42
+ "supportedPlatforms": {
43
+ "aarch64-apple-darwin": {
44
+ "artifactName": "plan-atlas-aarch64-apple-darwin.tar.xz",
45
+ "bins": {
46
+ "plan-atlas": "plan-atlas"
47
+ },
48
+ "zipExt": ".tar.xz"
49
+ },
50
+ "aarch64-pc-windows-msvc": {
51
+ "artifactName": "plan-atlas-x86_64-pc-windows-msvc.zip",
52
+ "bins": {
53
+ "plan-atlas": "plan-atlas.exe"
54
+ },
55
+ "zipExt": ".zip"
56
+ },
57
+ "aarch64-unknown-linux-gnu": {
58
+ "artifactName": "plan-atlas-aarch64-unknown-linux-gnu.tar.xz",
59
+ "bins": {
60
+ "plan-atlas": "plan-atlas"
61
+ },
62
+ "zipExt": ".tar.xz"
63
+ },
64
+ "x86_64-apple-darwin": {
65
+ "artifactName": "plan-atlas-x86_64-apple-darwin.tar.xz",
66
+ "bins": {
67
+ "plan-atlas": "plan-atlas"
68
+ },
69
+ "zipExt": ".tar.xz"
70
+ },
71
+ "x86_64-pc-windows-gnu": {
72
+ "artifactName": "plan-atlas-x86_64-pc-windows-msvc.zip",
73
+ "bins": {
74
+ "plan-atlas": "plan-atlas.exe"
75
+ },
76
+ "zipExt": ".zip"
77
+ },
78
+ "x86_64-pc-windows-msvc": {
79
+ "artifactName": "plan-atlas-x86_64-pc-windows-msvc.zip",
80
+ "bins": {
81
+ "plan-atlas": "plan-atlas.exe"
82
+ },
83
+ "zipExt": ".zip"
84
+ },
85
+ "x86_64-unknown-linux-gnu": {
86
+ "artifactName": "plan-atlas-x86_64-unknown-linux-gnu.tar.xz",
87
+ "bins": {
88
+ "plan-atlas": "plan-atlas"
89
+ },
90
+ "zipExt": ".tar.xz"
91
+ }
92
+ },
93
+ "version": "0.1.1",
94
+ "volta": {
95
+ "node": "18.14.1",
96
+ "npm": "9.5.0"
97
+ }
6
98
  }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { run } = require("./binary");
4
+ run("plan-atlas");