specpilot 2.7.1 → 2.8.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/README.md CHANGED
@@ -76,7 +76,7 @@ This AI-assisted approach ensures comprehensive, high-quality specifications tai
76
76
  | `list` | Show available templates |
77
77
  | `migrate` | Convert legacy `.project-spec` folder (rarely needed) |
78
78
  | `refine [desc]` | Refine project specifications |
79
- | `serve [folders...]` | Serve a local web UI over the `.specs/` of this project, or of each folder named (task moves, and guided setup of a named folder without `.specs/`, unless `--read-only`) |
79
+ | `serve [folders...]` | Serve a local web UI over the `.specs/` of this project, or of each folder named; open more from the page, remembered in `~/.specpilot/projects.json` (task moves, guided setup of a folder without `.specs/`, unless `--read-only`) |
80
80
 
81
81
  > **Tip — command aliases:** All commands have a short alias you can use instead of the full name.
82
82
  > `init` → `i`  ·  `validate` → `v`  ·  `migrate` → `m`  ·  `list` → `ls`  ·  `refine` → `ref`  ·  `archive` → `ar`  ·  `add-specs` → `add`  ·  `backfill` → `bf`
@@ -116,7 +116,7 @@ specpilot validate --fix
116
116
 
117
117
  ## specpilot serve
118
118
 
119
- Serve a local web UI over a project's `.specs/`, where you can also move tasks between Backlog and Current Sprint, and set up `.specs/` in a folder that has none yet. With no folders it serves the project you run it from (the folder that contains `.specs/`); name one or more folders to serve those instead, all from one server. Press Ctrl+C to stop.
119
+ Serve a local web UI over a project's `.specs/`, where you can also move tasks between Backlog and Current Sprint, set up `.specs/` in a folder that has none yet, and open more projects. With no folders it serves the project you run it from (the folder that contains `.specs/`); name one or more folders to serve those instead, all from one server, or open them later from the page. Press Ctrl+C to stop.
120
120
 
121
121
  ```bash
122
122
  specpilot serve # this project, at http://127.0.0.1:4321
@@ -129,13 +129,15 @@ specpilot serve ../new-project # no .specs/ there yet: the page sets it up (or
129
129
  | ------------- | ------- | ---------------------------------------------------------------------------------------- |
130
130
  | `--port <n>` | `4321` | Port to listen on (127.0.0.1 only) |
131
131
  | `--poll <ms>` | `1000` | Change-detection interval in ms (minimum 250); polling runs only while a page is open |
132
- | `--read-only` | | No task moves and no guided setup: the UI only reads, with no drag handles and no write routes |
132
+ | `--read-only` | | No task moves, no guided setup, no opening folders and no registry: the UI only reads, with no drag handles and no write routes |
133
133
  | `--open` | | Open the UI in the default browser |
134
134
 
135
- - **Several projects**: name any folders; one without `.specs/` is served too and offers guided setup (below). They are numbered in command-line order from 0 (`../api` is project 0, `../web` is project 1), and that number is the `?project=<n>` on the server's `/api/` routes and the `#1/...` at the start of a page link for any project after the first (no number means project 0). Each project keeps its own tasks, files and live reload; a move changes only that project's `tasks.md`. The list is fixed when the server starts: the page cannot add a folder, and nothing is saved outside your projects.
135
+ - **Several projects**: name any folders; one without `.specs/` is served too and offers guided setup (below). They are numbered in command-line order from 0 (`../api` is project 0, `../web` is project 1), and that number is the `?project=<n>` on the server's `/api/` routes and the `#1/...` at the start of a page link for any project after the first (no number means project 0). Each project keeps its own tasks, files and live reload; a move changes only that project's `tasks.md`. Folders opened from the page (below) get the next numbers; a number never changes while the server runs, and one server holds at most 20 projects.
136
136
  - **Task moves**: drag a row, or use `Alt+Up/Down` to reorder and `Alt+Left/Right` to move between Backlog and Current Sprint. A move changes exactly one line of `.specs/planning/tasks.md` and nothing else, and offers Undo; Completed rows do not move. If the file changed on disk since the page loaded, the move is refused and the page redraws. Start with `--read-only` to turn moves off.
137
137
  - **Guided setup**: a folder you name that has no `.specs/` shows, instead of the views, the questions `specpilot add-specs` asks (project type, language and framework when they are not detected, API paradigm, handle, IDE), and one button. It then creates exactly what `add-specs` creates for those answers. Files outside `.specs/` that already exist (your own `.gitattributes`, `CLAUDE.md`, `.vscode/settings.json`, a command file) are never changed: the page lists them before you submit and after, and `specpilot backfill` adds missing SpecPilot sections to kept instruction and command files (a kept `.gitattributes` does not get the `merge=union` lines). Setup is offered only for folders named on the command line, not for the current-directory default, which still needs `.specs/` (`specpilot serve .` names it). The request is protected like a task move. While it runs, the files are generated into a `.specpilot-setup-<id>/` folder inside the project, which is removed when done; if a run is interrupted, the next `specpilot serve` removes that folder (and only that folder, recognised by its marker file).
138
- - **Nothing else is written**: in a project with `.specs/`, its `.specs/planning/tasks.md` is the only file the server can change; in a named folder without `.specs/`, setup creates new files and changes none; everything else is read on every request.
138
+ - **Home**: the logo at the top of the left rail (or the `h` key, or `#home`) shows "Your specs, as a board.", an Open a Project Folder button and your Recent projects (path, last-opened time and, for projects already open, the git branch); click one to open it. `specpilot serve` still starts on the first project's Tasks view, and `--read-only` has no Home.
139
+ - **Open a project from the page**: the `+` tile in the left rail opens a sheet; type a folder path (`/Users/you/project` or `~/project`) and Open, and the folder is served alongside the others, with guided setup if it has no `.specs/`. Folders you open this way are listed under Recent projects next time, remembered in `~/.specpilot/projects.json` (path, last-opened time and a pinned flag, at most 50; the file is created the first time you open a folder from the page, and folders named on the command line are added to it only once it exists). Remove from list forgets a folder without touching it. The home folder, the root of a drive and folders already open are refused; a `projects.json` that cannot be read is left exactly as it is, and the page and the terminal say so. The request is protected like a task move.
140
+ - **Nothing else is written**: in a project with `.specs/`, its `.specs/planning/tasks.md` is the only file the server can change; in a named folder without `.specs/`, setup creates new files and changes none; `~/.specpilot/projects.json` is the one file written outside your projects; everything else is read on every request.
139
141
  - **Loopback only**: binds 127.0.0.1 only; rejects any Host header other than `127.0.0.1:<port>` or `localhost:<port>` (403).
140
142
  - **Live reload**: polls allowlisted files with `stat()` every `--poll` ms while a page is open, and pushes changed paths on `/api/events`; open pages update in place.
141
143
  - **What it shows**: `.specs/`, `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `.claude/commands/`, `.claude/skills/` and `.github/prompts/`, as the files' own text.
@@ -7,7 +7,7 @@ export interface ServeOptions {
7
7
  /**
8
8
  * Runs until Ctrl+C; exits the process with 1 on any startup error. `folders` empty = the current
9
9
  * directory (BL-054), which must contain `.specs/`; a named folder without one is served for guided
10
- * setup (BL-055).
10
+ * setup (BL-055). More folders can be opened from the page and are remembered in the registry (BL-067).
11
11
  */
12
12
  export declare function serveCommand(folders: string[], options: ServeOptions): Promise<void>;
13
13
  //# sourceMappingURL=serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAiBD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+E1F"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAiBD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkG1F"}
@@ -10,6 +10,7 @@ const fs_1 = require("fs");
10
10
  const path_1 = require("path");
11
11
  const specServer_1 = require("../utils/specServer");
12
12
  const specSetup_1 = require("../utils/specSetup");
13
+ const projectRegistry_1 = require("../utils/projectRegistry");
13
14
  const logger_1 = require("../utils/logger");
14
15
  const packageJson = require('../../package.json');
15
16
  const DEFAULT_PORT = 4321;
@@ -27,13 +28,13 @@ function openBrowser(url, logger) {
27
28
  /**
28
29
  * Runs until Ctrl+C; exits the process with 1 on any startup error. `folders` empty = the current
29
30
  * directory (BL-054), which must contain `.specs/`; a named folder without one is served for guided
30
- * setup (BL-055).
31
+ * setup (BL-055). More folders can be opened from the page and are remembered in the registry (BL-067).
31
32
  */
32
33
  async function serveCommand(folders, options) {
33
34
  const logger = new logger_1.Logger();
34
35
  const roots = [];
35
36
  if (!folders.length) {
36
- const root = process.cwd();
37
+ const root = (0, fs_1.realpathSync)(process.cwd()); // like a named folder, so "already served" compares like for like (BL-067)
37
38
  if (!(0, fs_1.existsSync)((0, path_1.join)(root, '.specs'))) {
38
39
  logger.error('No .specs/ folder in this directory. Run `specpilot serve` from a project root, `specpilot init` first, or `specpilot serve .` to set one up in the browser.');
39
40
  return process.exit(1);
@@ -73,9 +74,27 @@ async function serveCommand(folders, options) {
73
74
  for (const dir of (0, specSetup_1.removeStaleStaging)(root))
74
75
  console.log(`Removed ${dir}/, left by an interrupted setup.`);
75
76
  }
77
+ // The registry (BL-067): the folders named here are recorded only when the file already exists, so
78
+ // plain `specpilot serve` never creates one; a file that cannot be used is said so and left alone.
79
+ const home = (0, projectRegistry_1.homeDir)();
80
+ const registry = options.readOnly ? undefined : (0, projectRegistry_1.registryPath)(home);
81
+ let registryNote = null;
82
+ if (registry) {
83
+ const read = (0, projectRegistry_1.readRegistry)(registry);
84
+ if (read.error !== null)
85
+ registryNote = `${(0, specServer_1.displayRoot)(registry, home)} could not be read (${read.error}). It was left as it is; projects opened in this run are not remembered.`;
86
+ else if (read.exists) {
87
+ try {
88
+ (0, projectRegistry_1.writeRegistry)(registry, roots.reduce((entries, root) => (0, projectRegistry_1.upsertEntry)(entries, root, new Date()), read.entries));
89
+ }
90
+ catch (err) {
91
+ registryNote = `${(0, specServer_1.displayRoot)(registry, home)} could not be written (${err.message}). It was left as it is; projects opened in this run are not remembered.`;
92
+ }
93
+ }
94
+ }
76
95
  let handle;
77
96
  try {
78
- handle = await (0, specServer_1.startSpecServer)(roots, port, packageJson.version, { pollMs, readOnly: !!options.readOnly, named, log: m => logger.warn(m) });
97
+ handle = await (0, specServer_1.startSpecServer)(roots, port, packageJson.version, { pollMs, readOnly: !!options.readOnly, named, registry, log: m => logger.warn(m) });
79
98
  }
80
99
  catch (err) {
81
100
  if (err.code === 'EADDRINUSE') {
@@ -101,6 +120,10 @@ async function serveCommand(folders, options) {
101
120
  : empty.length
102
121
  ? 'Tasks can be moved in the page (only .specs/planning/tasks.md is written), and a folder without .specs/ can be set up there (new files only). Open pages update when a spec file changes. Press Ctrl+C to stop.'
103
122
  : 'Tasks can be moved in the page (only .specs/planning/tasks.md is written). Open pages update when a spec file changes. Press Ctrl+C to stop.'));
123
+ if (registry)
124
+ console.log(chalk_1.default.gray(`Folders opened in the page are remembered in ${(0, specServer_1.displayRoot)(registry, home)}.`));
125
+ if (registryNote)
126
+ console.log(registryNote);
104
127
  if (options.open)
105
128
  openBrowser(url, logger);
106
129
  process.once('SIGINT', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":";;;;;AAqCA,oCA+EC;AApHD,kDAA0B;AAC1B,iDAAsC;AACtC,2BAAwD;AACxD,+BAAqC;AACrC,oDAAkE;AAClE,kDAAsE;AACtE,4CAAyC;AAEzC,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AASlD,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,wFAAwF;AACxF,SAAS,WAAW,CAAC,GAAW,EAAE,MAAc;IAC9C,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GACf,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YAClE,CAAC,CAAC,CAAC,UAAU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E,MAAM,CAAC,CAAC;IAE3C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;QAC1B,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,63 @@
1
+ export interface RegistryEntry {
2
+ /** The folder's realpath. */
3
+ path: string;
4
+ /** ISO 8601 UTC. */
5
+ lastOpened: string;
6
+ pinned: boolean;
7
+ }
8
+ /** Most entries the registry keeps; the oldest unpinned one goes first. */
9
+ export declare const MAX_REGISTRY_ENTRIES = 50;
10
+ /** Most projects one server serves; `POST /api/projects` refuses past it (the command line is not capped). */
11
+ export declare const MAX_PROJECTS = 20;
12
+ /**
13
+ * The home directory: `HOME`, else `USERPROFILE`, else `os.homedir()`. The same order libuv uses for
14
+ * `os.homedir()`, read from `process.env` so a test that sets the variable before the server starts is
15
+ * honoured (Jest sandboxes `process.env`, which the native `os.homedir()` does not see).
16
+ */
17
+ export declare function homeDir(): string;
18
+ /** `~/.specpilot/projects.json` for `home`. */
19
+ export declare function registryPath(home?: string): string;
20
+ export type RegistryRead = {
21
+ entries: RegistryEntry[];
22
+ exists: boolean;
23
+ error: null;
24
+ } | {
25
+ entries: null;
26
+ exists: false;
27
+ error: string;
28
+ };
29
+ /**
30
+ * Read the registry: a missing file is an empty registry; anything that is not a regular, readable,
31
+ * well-formed file is a refusal with a plain reason. Never writes.
32
+ */
33
+ export declare function readRegistry(file: string): RegistryRead;
34
+ /**
35
+ * Replace the registry with `entries`: the folder is created with mode 0700 when missing, the content
36
+ * goes to a temp file (mode 0600) in that folder, `fsync`, then `rename`. Throws, writing nothing,
37
+ * when `readRegistry()` would refuse the current state.
38
+ */
39
+ export declare function writeRegistry(file: string, entries: RegistryEntry[]): void;
40
+ /** Display order: pinned first, then newest `lastOpened` first. */
41
+ export declare function sortEntries(entries: RegistryEntry[]): RegistryEntry[];
42
+ /** `path` opened at `now`: its entry refreshed or appended, then the cap applied (oldest unpinned out first). */
43
+ export declare function upsertEntry(entries: RegistryEntry[], path: string, now: Date): RegistryEntry[];
44
+ /** The entries without the one whose stored path equals `path` byte for byte, or null when there is none. */
45
+ export declare function removeEntry(entries: RegistryEntry[], path: string): RegistryEntry[] | null;
46
+ /** Longest path a request may send. */
47
+ export declare const MAX_PATH_LENGTH = 4096;
48
+ /** Shape of a `{path}` body, checked before the lock. Null when fine. */
49
+ export declare function pathShapeError(body: unknown): string | null;
50
+ export type OpenCheck = {
51
+ root: string;
52
+ } | {
53
+ status: 409 | 422;
54
+ error: string;
55
+ project?: number;
56
+ };
57
+ /**
58
+ * The add route's path rule, in one place: `~` expanded against `home`, absolute, realpath-resolved,
59
+ * a directory, not the home folder, not a file-system root, not a served root. Makes no call on the
60
+ * folder but `realpath` and `stat`.
61
+ */
62
+ export declare function checkOpenPath(input: string, roots: string[], home: string): OpenCheck;
63
+ //# sourceMappingURL=projectRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/projectRegistry.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,8GAA8G;AAC9G,eAAO,MAAM,YAAY,KAAK,CAAC;AAI/B;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,IAAI,SAAY,GAAG,MAAM,CAErD;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;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ATH_LENGTH = exports.MAX_PROJECTS = exports.MAX_REGISTRY_ENTRIES = void 0;
4
+ exports.homeDir = homeDir;
5
+ exports.registryPath = registryPath;
6
+ exports.readRegistry = readRegistry;
7
+ exports.writeRegistry = writeRegistry;
8
+ exports.sortEntries = sortEntries;
9
+ exports.upsertEntry = upsertEntry;
10
+ exports.removeEntry = removeEntry;
11
+ exports.pathShapeError = pathShapeError;
12
+ exports.checkOpenPath = checkOpenPath;
13
+ const fs_1 = require("fs");
14
+ const crypto_1 = require("crypto");
15
+ const path_1 = require("path");
16
+ const os_1 = require("os");
17
+ /** Most entries the registry keeps; the oldest unpinned one goes first. */
18
+ exports.MAX_REGISTRY_ENTRIES = 50;
19
+ /** Most projects one server serves; `POST /api/projects` refuses past it (the command line is not capped). */
20
+ exports.MAX_PROJECTS = 20;
21
+ const VERSION = 1;
22
+ /**
23
+ * The home directory: `HOME`, else `USERPROFILE`, else `os.homedir()`. The same order libuv uses for
24
+ * `os.homedir()`, read from `process.env` so a test that sets the variable before the server starts is
25
+ * honoured (Jest sandboxes `process.env`, which the native `os.homedir()` does not see).
26
+ */
27
+ function homeDir() {
28
+ return process.env.HOME || process.env.USERPROFILE || (0, os_1.homedir)();
29
+ }
30
+ /** `~/.specpilot/projects.json` for `home`. */
31
+ function registryPath(home = homeDir()) {
32
+ return (0, path_1.join)(home, '.specpilot', 'projects.json');
33
+ }
34
+ const code = (err) => err.code;
35
+ /** The folder the registry lives in must not exist, or be a real folder (never a link). Null when fine. */
36
+ function folderProblem(dir) {
37
+ try {
38
+ const st = (0, fs_1.lstatSync)(dir);
39
+ if (st.isSymbolicLink())
40
+ return `${dir} is a symbolic link`;
41
+ if (!st.isDirectory())
42
+ return `${dir} is not a folder`;
43
+ return null;
44
+ }
45
+ catch (err) {
46
+ return code(err) === 'ENOENT' ? null : `${dir} could not be read (${code(err)})`;
47
+ }
48
+ }
49
+ /** Parse the file's text into entries, or say what is wrong with its shape. */
50
+ function parseEntries(text) {
51
+ let doc;
52
+ try {
53
+ doc = JSON.parse(text);
54
+ }
55
+ catch {
56
+ return { error: 'it is not valid JSON' };
57
+ }
58
+ const d = doc;
59
+ if (!d || typeof d !== 'object' || Array.isArray(d))
60
+ return { error: 'it is not a JSON object' };
61
+ if (d.version !== VERSION)
62
+ return { error: `its version is not ${VERSION}` };
63
+ if (!Array.isArray(d.projects))
64
+ return { error: 'its projects field is not a list' };
65
+ const seen = new Set();
66
+ const entries = [];
67
+ for (const [i, e] of d.projects.entries()) {
68
+ const at = `entry ${i + 1}`;
69
+ const o = e;
70
+ if (!o || typeof o !== 'object' || Array.isArray(o))
71
+ return { error: `${at} is not an object` };
72
+ const keys = Object.keys(o).sort();
73
+ if (keys.join() !== 'lastOpened,path,pinned')
74
+ return { error: `${at} does not have exactly path, lastOpened and pinned` };
75
+ if (typeof o.path !== 'string' || !(0, path_1.isAbsolute)(o.path))
76
+ return { error: `${at} has no absolute path` };
77
+ if (typeof o.lastOpened !== 'string' || Number.isNaN(Date.parse(o.lastOpened)))
78
+ return { error: `${at} has no valid lastOpened time` };
79
+ if (typeof o.pinned !== 'boolean')
80
+ return { error: `${at} has no boolean pinned flag` };
81
+ if (seen.has(o.path))
82
+ return { error: `${at} repeats a path` };
83
+ seen.add(o.path);
84
+ entries.push({ path: o.path, lastOpened: o.lastOpened, pinned: o.pinned });
85
+ }
86
+ return { entries };
87
+ }
88
+ /**
89
+ * Read the registry: a missing file is an empty registry; anything that is not a regular, readable,
90
+ * well-formed file is a refusal with a plain reason. Never writes.
91
+ */
92
+ function readRegistry(file) {
93
+ const problem = folderProblem((0, path_1.dirname)(file));
94
+ if (problem)
95
+ return { entries: null, exists: false, error: problem };
96
+ let st;
97
+ try {
98
+ st = (0, fs_1.lstatSync)(file);
99
+ }
100
+ catch (err) {
101
+ return code(err) === 'ENOENT' ? { entries: [], exists: false, error: null } : { entries: null, exists: false, error: `${file} could not be read (${code(err)})` };
102
+ }
103
+ if (st.isSymbolicLink())
104
+ return { entries: null, exists: false, error: `${file} is a symbolic link` };
105
+ if (!st.isFile())
106
+ return { entries: null, exists: false, error: `${file} is not a regular file` };
107
+ let text;
108
+ try {
109
+ text = (0, fs_1.readFileSync)(file, 'utf-8');
110
+ }
111
+ catch (err) {
112
+ return { entries: null, exists: false, error: `${file} could not be read (${code(err)})` };
113
+ }
114
+ const parsed = parseEntries(text);
115
+ return 'error' in parsed ? { entries: null, exists: false, error: `${file} could not be used: ${parsed.error}` } : { entries: parsed.entries, exists: true, error: null };
116
+ }
117
+ /**
118
+ * Replace the registry with `entries`: the folder is created with mode 0700 when missing, the content
119
+ * goes to a temp file (mode 0600) in that folder, `fsync`, then `rename`. Throws, writing nothing,
120
+ * when `readRegistry()` would refuse the current state.
121
+ */
122
+ function writeRegistry(file, entries) {
123
+ const current = readRegistry(file);
124
+ if (current.error !== null)
125
+ throw new Error(current.error);
126
+ const dir = (0, path_1.dirname)(file);
127
+ try {
128
+ (0, fs_1.mkdirSync)(dir, { mode: 0o700 });
129
+ }
130
+ catch (err) {
131
+ if (code(err) !== 'EEXIST')
132
+ throw err;
133
+ }
134
+ const tmp = `${file}.${(0, crypto_1.randomBytes)(6).toString('hex')}.tmp`;
135
+ const fd = (0, fs_1.openSync)(tmp, 'wx', 0o600);
136
+ try {
137
+ (0, fs_1.writeSync)(fd, JSON.stringify({ version: VERSION, projects: entries }, null, 2) + '\n');
138
+ (0, fs_1.fsyncSync)(fd);
139
+ (0, fs_1.closeSync)(fd);
140
+ (0, fs_1.renameSync)(tmp, file);
141
+ }
142
+ catch (err) {
143
+ try {
144
+ (0, fs_1.closeSync)(fd);
145
+ }
146
+ catch { /* already closed */ }
147
+ try {
148
+ (0, fs_1.unlinkSync)(tmp);
149
+ }
150
+ catch { /* already gone */ }
151
+ throw err;
152
+ }
153
+ }
154
+ /** Display order: pinned first, then newest `lastOpened` first. */
155
+ function sortEntries(entries) {
156
+ return [...entries].sort((a, b) => Number(b.pinned) - Number(a.pinned) || Date.parse(b.lastOpened) - Date.parse(a.lastOpened));
157
+ }
158
+ /** `path` opened at `now`: its entry refreshed or appended, then the cap applied (oldest unpinned out first). */
159
+ function upsertEntry(entries, path, now) {
160
+ const lastOpened = now.toISOString();
161
+ const found = entries.find(e => e.path === path);
162
+ const next = found ? entries.map(e => (e === found ? { ...e, lastOpened } : e)) : [...entries, { path, lastOpened, pinned: false }];
163
+ while (next.length > exports.MAX_REGISTRY_ENTRIES) {
164
+ const others = next.filter(e => e.path !== path); // never the one just opened
165
+ const pool = others.some(e => !e.pinned) ? others.filter(e => !e.pinned) : others;
166
+ const oldest = pool.reduce((a, b) => (Date.parse(b.lastOpened) < Date.parse(a.lastOpened) ? b : a));
167
+ next.splice(next.indexOf(oldest), 1);
168
+ }
169
+ return next;
170
+ }
171
+ /** The entries without the one whose stored path equals `path` byte for byte, or null when there is none. */
172
+ function removeEntry(entries, path) {
173
+ const i = entries.findIndex(e => e.path === path);
174
+ return i < 0 ? null : [...entries.slice(0, i), ...entries.slice(i + 1)];
175
+ }
176
+ /** Longest path a request may send. */
177
+ exports.MAX_PATH_LENGTH = 4096;
178
+ /** Shape of a `{path}` body, checked before the lock. Null when fine. */
179
+ function pathShapeError(body) {
180
+ const b = body;
181
+ if (!b || typeof b !== 'object' || Array.isArray(b))
182
+ return 'The request must be a JSON object with one field, path.';
183
+ const keys = Object.keys(b);
184
+ if (keys.length !== 1 || keys[0] !== 'path')
185
+ return 'The request must have exactly one field, path.';
186
+ if (typeof b.path !== 'string')
187
+ return '"path" must be a string.';
188
+ if (!b.path.length || b.path.length > exports.MAX_PATH_LENGTH)
189
+ return `"path" must be 1 to ${exports.MAX_PATH_LENGTH} characters.`;
190
+ if (b.path.includes('\0'))
191
+ return '"path" must not contain a NUL character.';
192
+ return null;
193
+ }
194
+ /**
195
+ * The add route's path rule, in one place: `~` expanded against `home`, absolute, realpath-resolved,
196
+ * a directory, not the home folder, not a file-system root, not a served root. Makes no call on the
197
+ * folder but `realpath` and `stat`.
198
+ */
199
+ function checkOpenPath(input, roots, home) {
200
+ const expanded = input === '~' ? home : input.startsWith('~/') ? (0, path_1.join)(home, input.slice(2)) : input;
201
+ if (!(0, path_1.isAbsolute)(expanded))
202
+ return { status: 422, error: 'The path must be absolute, e.g. /Users/you/project or ~/project.' };
203
+ let root;
204
+ try {
205
+ root = (0, fs_1.realpathSync)(expanded);
206
+ }
207
+ catch {
208
+ return { status: 422, error: `Folder not found: ${input}` };
209
+ }
210
+ let isDir;
211
+ try {
212
+ isDir = (0, fs_1.statSync)(root).isDirectory();
213
+ }
214
+ catch {
215
+ return { status: 422, error: `Folder not found: ${input}` };
216
+ }
217
+ if (!isDir)
218
+ return { status: 422, error: `Not a folder: ${input}` };
219
+ let realHome;
220
+ try {
221
+ realHome = (0, fs_1.realpathSync)(home);
222
+ }
223
+ catch {
224
+ realHome = home;
225
+ }
226
+ if (root === realHome || (0, path_1.parse)(root).root === root)
227
+ return { status: 422, error: 'SpecPilot does not open your home folder or the root of a drive.' };
228
+ const served = roots.findIndex(r => {
229
+ try {
230
+ return (0, fs_1.realpathSync)(r) === root;
231
+ }
232
+ catch {
233
+ return r === root;
234
+ }
235
+ });
236
+ if (served >= 0)
237
+ return { status: 409, error: `${root} is already open as project ${served}.`, project: served };
238
+ return { root };
239
+ }
240
+ //# sourceMappingURL=projectRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectRegistry.js","sourceRoot":"","sources":["../../src/utils/projectRegistry.ts"],"names":[],"mappings":";;;AA8BA,0BAEC;AAGD,oCAEC;AAoDD,oCAmBC;AAOD,sCAqBC;AAGD,kCAEC;AAGD,kCAWC;AAGD,kCAGC;AAMD,wCASC;AASD,sCAgCC;AAzND,2BAAmJ;AACnJ,mCAAqC;AACrC,+BAAwD;AACxD,2BAA6B;AAc7B,2EAA2E;AAC9D,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAEvC,8GAA8G;AACjG,QAAA,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,OAAO,GAAG,CAAC,CAAC;AA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E,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,KAAK,EAAE,EAAE,CAAC;IACpE,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,kEAAkE,EAAE,CAAC;IACtJ,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;QACjC,IAAI,CAAC;YACH,OAAO,IAAA,iBAAY,EAAC,CAAC,CAAC,KAAK,IAAI,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,KAAK,IAAI,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,+BAA+B,MAAM,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACjH,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC"}
@@ -56,6 +56,8 @@ export interface SpecServerOptions {
56
56
  readOnly?: boolean;
57
57
  /** Per root, whether it was named on the command line: guided setup is offered only for those (BL-055). Default: all. */
58
58
  named?: boolean[];
59
+ /** The registry file (`~/.specpilot/projects.json`); the registry routes exist only when set and not read-only (BL-067). */
60
+ registry?: string;
59
61
  }
60
62
  export interface SpecServer {
61
63
  server: Server;
@@ -64,7 +66,7 @@ export interface SpecServer {
64
66
  /** End every event stream, clear every timer, then close the listener. */
65
67
  close(): Promise<void>;
66
68
  }
67
- export declare function createSpecServer(roots: string[], specpilotVersion: string, opts?: SpecServerOptions): SpecServer;
69
+ export declare function createSpecServer(initialRoots: string[], specpilotVersion: string, opts?: SpecServerOptions): SpecServer;
68
70
  /** Listen on 127.0.0.1 only. Rejects with the listen error (e.g. EADDRINUSE). */
69
71
  export declare function startSpecServer(roots: string[], port: number, specpilotVersion: string, opts?: SpecServerOptions): Promise<SpecServer>;
70
72
  //# sourceMappingURL=specServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"specServer.d.ts","sourceRoot":"","sources":["../../src/utils/specServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAkB,MAAM,MAAM,CAAC;AA6B7E,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7E;AAED,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAetD;AAgBD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC5C;AAqCD,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BvE;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAY,GAAG,MAAM,CAGlE;AAoCD,6EAA6E;AAC7E,eAAO,MAAM,aAAa,QAAY,CAAC;AAKvC,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BvE;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAY,GAAG,MAAM,CAGlE;AAoCD,6EAA6E;AAC7E,eAAO,MAAM,aAAa,QAAY,CAAC;AAKvC,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yHAAyH;IACzH,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,4HAA4H;IAC5H,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,OAAO,IAAI,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,UAAU,CA6S3H;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,CAS1I"}
@@ -51,9 +51,10 @@ const taskMover_1 = require("./taskMover");
51
51
  const specPaths_1 = require("./specPaths");
52
52
  const specPoller_1 = require("./specPoller");
53
53
  const specSetup_1 = require("./specSetup");
54
+ const projectRegistry_1 = require("./projectRegistry");
54
55
  // Local server behind `specpilot serve` (BL-051, ARCH-004.33, SEC-004.8). Every request re-reads disk;
55
- // nothing is cached. The server writes nothing itself: task moves go through taskMover.ts (BL-053)
56
- // and guided setup through specSetup.ts (BL-055).
56
+ // nothing is cached. The server writes nothing itself: task moves go through taskMover.ts (BL-053),
57
+ // guided setup through specSetup.ts (BL-055) and the project registry through projectRegistry.ts (BL-067).
57
58
  /** Resolved from this module's own location, never from cwd: dist/utils → <package>/ui. */
58
59
  const UI_DIR = (0, path_1.join)(__dirname, '..', '..', 'ui');
59
60
  const UI_ROUTES = {
@@ -177,7 +178,7 @@ function displayRoot(root, home = (0, os_1.homedir)()) {
177
178
  return '~';
178
179
  return root.startsWith(home + path_1.sep) ? '~' + root.slice(home.length) : root;
179
180
  }
180
- /** One entry per served project, in command-line order: what the rail shows (BL-054). */
181
+ /** One entry per served project, in index order: what the rail shows (BL-054). */
181
182
  function projectList(roots) {
182
183
  return roots.map(root => {
183
184
  const yamlFile = (0, specPaths_1.resolveAllowedPath)(root, '.specs/project/project.yaml');
@@ -213,10 +214,14 @@ exports.MAX_MOVE_BODY = 16 * 1024;
213
214
  const TOKEN_SLOT = '<!-- specpilot-token -->';
214
215
  /** Most `/api/events` streams open at once; the next one gets 503 (SEC-004.9). */
215
216
  exports.MAX_EVENT_STREAMS = 8;
216
- function createSpecServer(roots, specpilotVersion, opts = {}) {
217
+ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
218
+ // The served roots: the command line's, then those opened from the page (BL-067). Append-only for the
219
+ // life of the server, so an index never changes and nothing is dropped.
220
+ const roots = [...initialRoots];
221
+ const namedFlags = roots.map((_, i) => opts.named?.[i] ?? true);
217
222
  // ---- live reload (BL-052): streams, heartbeat, and one poller per project (BL-054) that runs
218
223
  // only while that project has a stream open; the heartbeat runs while any stream is open
219
- const projects = roots.map(root => {
224
+ const projectFor = (root) => {
220
225
  const streams = new Set();
221
226
  const poller = (0, specPoller_1.createPoller)(root, {
222
227
  intervalMs: opts.pollMs ?? 1000,
@@ -225,7 +230,8 @@ function createSpecServer(roots, specpilotVersion, opts = {}) {
225
230
  onChange: paths => streams.forEach(res => res.write(`event: change\ndata: ${JSON.stringify({ paths })}\n\n`)),
226
231
  });
227
232
  return { streams, poller };
228
- });
233
+ };
234
+ const projects = roots.map(projectFor);
229
235
  const allStreams = () => projects.flatMap(p => [...p.streams]);
230
236
  let heartbeat = null;
231
237
  const drop = (i, res) => {
@@ -254,8 +260,15 @@ function createSpecServer(roots, specpilotVersion, opts = {}) {
254
260
  };
255
261
  // ---- task moves (BL-053): the only write route, absent with --read-only
256
262
  const token = opts.readOnly ? null : (0, crypto_1.randomBytes)(32).toString('hex');
257
- let writeLock = Promise.resolve(); // moves run strictly one after another, in every project
263
+ let writeLock = Promise.resolve(); // writes run strictly one after another, in every project
258
264
  const payload = (i) => ({ ...buildSpecsPayload(roots[i], specpilotVersion), projects: projectList(roots) });
265
+ /** Run `fn` under the write lock; a throw answers 500 (when nothing was sent) and never breaks the chain for later writes. */
266
+ const underLock = (res, fn) => {
267
+ writeLock = writeLock.then(fn).catch(() => {
268
+ if (!res.headersSent)
269
+ sendJson(res, 500, { error: 'The server could not finish this request.' });
270
+ });
271
+ };
259
272
  /** The checks every write shares (SEC-004.10): Origin, token, content type, size. False = already answered. */
260
273
  const writeAllowed = (req, res) => {
261
274
  // Host was checked already; the page's own origin is exactly "http://" + that Host.
@@ -319,7 +332,7 @@ function createSpecServer(roots, specpilotVersion, opts = {}) {
319
332
  const ifMatch = String(req.headers['if-match'] ?? '').replace(/^W\//, '').replace(/"/g, '').trim();
320
333
  if (!ifMatch)
321
334
  return sendJson(res, 428, { error: 'The move needs an If-Match header with the file hash the page last loaded.' });
322
- writeLock = writeLock.then(() => {
335
+ underLock(res, () => {
323
336
  let out;
324
337
  try {
325
338
  out = (0, taskMover_1.moveTask)(roots[i], body, ifMatch);
@@ -335,8 +348,8 @@ function createSpecServer(roots, specpilotVersion, opts = {}) {
335
348
  });
336
349
  });
337
350
  };
338
- // ---- guided setup (BL-055): only for a root named on the command line that has no .specs/
339
- const named = (i) => opts.named?.[i] ?? true;
351
+ // ---- guided setup (BL-055): only for a named root (command line, or opened from the page) that has no .specs/
352
+ const named = (i) => namedFlags[i];
340
353
  const setupIndex = (url) => {
341
354
  const i = projectIndex(url, roots.length);
342
355
  return i !== null && named(i) && (0, specSetup_1.specsMissing)(roots[i]) ? i : null;
@@ -372,12 +385,112 @@ function createSpecServer(roots, specpilotVersion, opts = {}) {
372
385
  });
373
386
  });
374
387
  };
388
+ // ---- project registry (BL-067): list, open a folder, forget an entry; all absent with --read-only
389
+ const registry = token && opts.registry ? opts.registry : null;
390
+ const home = (0, projectRegistry_1.homeDir)();
391
+ const isDir = (p) => {
392
+ try {
393
+ return (0, fs_1.statSync)(p).isDirectory();
394
+ }
395
+ catch {
396
+ return false;
397
+ }
398
+ };
399
+ /** The `GET /api/projects` body: the registry in display order, or its refusal reason. */
400
+ const registryBody = () => {
401
+ const read = (0, projectRegistry_1.readRegistry)(registry);
402
+ const entries = read.error !== null ? [] : (0, projectRegistry_1.sortEntries)(read.entries);
403
+ return {
404
+ path: displayRoot(registry, home),
405
+ entries: entries.map(e => {
406
+ const i = roots.indexOf(e.path);
407
+ return { path: e.path, root: displayRoot(e.path, home), lastOpened: e.lastOpened, pinned: e.pinned, project: i >= 0 ? i : null, exists: isDir(e.path) };
408
+ }),
409
+ error: read.error,
410
+ };
411
+ };
412
+ /** Re-read, change, write; the refusal reason when the registry cannot be used. */
413
+ const changeRegistry = (change) => {
414
+ const read = (0, projectRegistry_1.readRegistry)(registry);
415
+ if (read.error !== null)
416
+ return read.error;
417
+ const next = change(read.entries);
418
+ if (next === null)
419
+ return 'That folder is not in the list.';
420
+ try {
421
+ (0, projectRegistry_1.writeRegistry)(registry, next);
422
+ }
423
+ catch (err) {
424
+ return `${displayRoot(registry, home)} could not be written (${err.message}).`;
425
+ }
426
+ return null;
427
+ };
428
+ const handleProjectAdd = (req, res) => {
429
+ if (!writeAllowed(req, res))
430
+ return;
431
+ readJson(req, res, body => {
432
+ const problem = (0, projectRegistry_1.pathShapeError)(body);
433
+ if (problem)
434
+ return sendJson(res, 422, { error: problem });
435
+ underLock(res, () => {
436
+ const check = (0, projectRegistry_1.checkOpenPath)(body.path, roots, home);
437
+ if ('status' in check)
438
+ return sendJson(res, check.status, check.project === undefined ? { error: check.error } : { error: check.error, project: check.project });
439
+ if (roots.length >= projectRegistry_1.MAX_PROJECTS)
440
+ return sendJson(res, 409, { error: `This server already serves ${projectRegistry_1.MAX_PROJECTS} projects. Start another specpilot serve for more.` });
441
+ // Read the folder's payload before serving it: a folder whose allowlisted files cannot be read is refused, not half-opened.
442
+ let specs;
443
+ try {
444
+ specs = buildSpecsPayload(check.root, specpilotVersion);
445
+ }
446
+ catch (err) {
447
+ return sendJson(res, 422, { error: `This folder could not be read: ${err.message}` });
448
+ }
449
+ const project = projectFor(check.root); // built before anything is pushed, so the three lists never disagree
450
+ const n = roots.length;
451
+ roots.push(check.root);
452
+ namedFlags.push(true);
453
+ projects.push(project);
454
+ const error = changeRegistry(entries => (0, projectRegistry_1.upsertEntry)(entries, check.root, new Date()));
455
+ sendJson(res, 200, { project: n, specs: { ...specs, projects: projectList(roots) }, registry: { ...registryBody(), ...(error ? { error } : {}) } });
456
+ });
457
+ });
458
+ };
459
+ const handleProjectRemove = (req, res) => {
460
+ if (!writeAllowed(req, res))
461
+ return;
462
+ readJson(req, res, body => {
463
+ const problem = (0, projectRegistry_1.pathShapeError)(body);
464
+ if (problem)
465
+ return sendJson(res, 422, { error: problem });
466
+ underLock(res, () => {
467
+ const error = changeRegistry(entries => (0, projectRegistry_1.removeEntry)(entries, body.path));
468
+ if (error)
469
+ return sendJson(res, 422, { error });
470
+ sendJson(res, 200, registryBody());
471
+ });
472
+ });
473
+ };
375
474
  const server = (0, http_1.createServer)((req, res) => {
376
475
  try {
377
476
  const { port } = server.address();
378
477
  if (!isAllowedHost(req.headers.host, port))
379
478
  return send(res, 403, TEXT, 'Forbidden: unexpected Host header\n');
380
479
  const url = new URL(req.url ?? '/', 'http://127.0.0.1');
480
+ if (url.pathname === '/api/projects') {
481
+ if (registry && req.method === 'GET')
482
+ return sendJson(res, 200, registryBody());
483
+ if (registry && req.method === 'POST')
484
+ return handleProjectAdd(req, res);
485
+ res.setHeader('Allow', registry ? 'GET, POST' : '');
486
+ return send(res, 405, TEXT, 'Method Not Allowed\n');
487
+ }
488
+ if (url.pathname === '/api/projects/remove') {
489
+ if (registry && req.method === 'POST')
490
+ return handleProjectRemove(req, res);
491
+ res.setHeader('Allow', registry ? 'POST' : '');
492
+ return send(res, 405, TEXT, 'Method Not Allowed\n');
493
+ }
381
494
  if (url.pathname === '/api/tasks/move') {
382
495
  if (req.method === 'POST' && token)
383
496
  return handleMove(req, res, url);
@@ -1 +1 @@
1
- {"version":3,"file":"specServer.js","sourceRoot":"","sources":["../../src/utils/specServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,sCAGC;AAGD,gCAeC;AAyDD,8CA6BC;AAGD,kCAGC;AAoED,4CAyMC;AAGD,0CASC;AAxaD,+BAA6E;AAE7E,2BAA4C;AAC5C,+BAA0C;AAC1C,2BAA6B;AAC7B,8CAAgC;AAChC,mCAAsD;AACtD,6CAAyC;AACzC,2CAAyE;AACzE,2CAAkF;AAClF,6CAA4C;AAC5C,2CAA4F;AAE5F,uGAAuG;AACvG,mGAAmG;AACnG,kDAAkD;AAElD,2FAA2F;AAC3F,MAAM,MAAM,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEjD,MAAM,SAAS,GAAiD;IAC9D,GAAG,EAAE,CAAC,YAAY,EAAE,0BAA0B,CAAC;IAC/C,iBAAiB,EAAE,CAAC,SAAS,EAAE,yBAAyB,CAAC;IACz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,OAAO,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE;YAC3C,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACnC,cAAc,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specpilot",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "description": "A CLI tool for initializing specification-driven development projects with flexible, production-ready structures.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/ui/app.css CHANGED
@@ -314,3 +314,46 @@ input.txt{width:100%}
314
314
  .setup .keep{color:var(--label-3);font-size:13px;line-height:1.5;padding:6px 0 0}
315
315
  .setup button.go{display:inline-block;padding:8px 14px;border-radius:var(--rs);background:var(--accent-fill);color:var(--on-accent);font-weight:600}
316
316
  .setup button.go:disabled{opacity:.6;cursor:default}
317
+
318
+ /* Open a Project sheet (BL-067): the mockup's sheet and + tile, Folder tab only */
319
+ .tile.act{background:transparent;border:1px dashed var(--sep-2);color:var(--label-3)}
320
+ .tile.act:hover{border-style:solid;border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}
321
+ .tile.act svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}
322
+ .sheet{width:min(620px,100%);max-height:84vh;display:flex;flex-direction:column;background:var(--ground);border:1px solid var(--sep-2);border-radius:6px;overflow:hidden;animation:rise .25s ease-out}
323
+ @keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
324
+ .sheet .sh{display:flex;align-items:center;gap:10px;padding:16px 18px 6px}
325
+ .sheet .sh h2{margin:0;font-size:18px;font-weight:600;text-wrap:balance}
326
+ .sheet .sh p{margin:2px 0 0;color:var(--label-3);font-size:13px}
327
+ .sheet .sb{padding:12px 18px;display:flex;flex-direction:column;gap:14px;overflow:auto;overscroll-behavior:contain;min-height:0;margin:0}
328
+ .sheet .sf{display:flex;gap:8px;justify-content:flex-end;padding:12px 18px 16px;border-top:1px solid var(--sep)}
329
+ .field{display:flex;gap:8px;align-items:center;padding:6px 14px}
330
+ .field .ico{color:var(--label-3);flex:none}
331
+ .field input{flex:1;background:transparent;border:0;outline:0;font-family:var(--mono);font-size:13px;color:var(--label);min-width:0;padding:6px 0}
332
+ .field input::placeholder{color:var(--label-3)}
333
+ .recent .row{padding-right:8px}
334
+ .recent .row .body{cursor:pointer}
335
+ .recent .btn{flex:none}
336
+ .sheet .note{padding:10px 14px}
337
+
338
+ /* Home (BL-PM-001): the mockup's .welcome column. The sidebar and the top bar give way and the rail
339
+ stays; in a narrow window the bar keeps its menu button, the only way to the rail there. */
340
+ @media (min-width:901px){.win.home{grid-template-columns:60px minmax(0,1fr)}.win.home .tb{display:none}}
341
+ .win.home .src,.win.home .tb>div{display:none}
342
+ .tile.home{background:transparent}
343
+ .tile.home:hover,.tile.home.cur{background:var(--hover)}
344
+ .tile.home .logo{width:26px;height:26px;margin:0}
345
+ #content:focus{outline:0}
346
+ .content>.welcome{width:100%;max-width:560px;margin:0 auto;gap:22px;padding:clamp(28px,8vh,72px) 0 48px}
347
+ .welcome .logo{width:56px;height:56px;border-radius:12px}
348
+ .welcome h1{font-size:clamp(26px,4vw,32px);font-weight:600;letter-spacing:-.02em;line-height:1.15;margin:0;text-wrap:balance}
349
+ .welcome .lead{font-size:16px;line-height:1.55;color:var(--label-2);margin:0;max-width:52ch}
350
+ .welcome .btn.big{min-height:48px;font-size:15px;font-weight:600;padding:0 20px;width:100%}
351
+ .welcome .benefits .row{min-height:52px;align-items:flex-start}
352
+ .welcome .benefits .row .body{padding:10px 0}
353
+ .welcome .benefits .ttl,.welcome .benefits .det{white-space:normal}
354
+ .welcome .ic2{width:28px;height:28px;border-radius:var(--rs);background:var(--muted);display:grid;place-items:center;flex:none;margin-top:10px}
355
+ .welcome .ic2 svg{width:15px;height:15px;stroke:var(--green-ink)}
356
+ .welcome .recents .row{text-align:left}
357
+ .welcome .recents .row .ttl{white-space:normal;overflow-wrap:anywhere}
358
+ .welcome .fine{display:flex;gap:8px;align-items:center;flex-wrap:wrap;color:var(--label-3);font-size:13px}
359
+ .welcome .fine i{width:7px;height:7px;border-radius:50%;background:var(--green);flex:none}
package/ui/app.js CHANGED
@@ -43,17 +43,18 @@ function initials(n){const w=String(n).split(/[^A-Za-z0-9]+/).filter(Boolean);
43
43
  return w[0].slice(0,2).toUpperCase();}
44
44
  function renderProject(){
45
45
  const p=DATA.project, name=p.name!==null?p.name:p.root, where=p.root+(p.branch?' · '+p.branch:'');
46
- $('#projList').innerHTML=DATA.projects.map((q,i)=>{const n=q.name!==null?q.name:q.root,cur=i===PROJECT;
46
+ $('#projList').innerHTML=DATA.projects.map((q,i)=>{const n=q.name!==null?q.name:q.root,cur=i===PROJECT&&curView!=='home';
47
47
  return `<button class="tile blue${cur?' cur':''}" data-project="${i}" data-tip="${esc(n)}" data-path="${esc(q.root+(q.branch?' · '+q.branch:''))}" aria-label="${esc(n)}"${cur?' aria-current="true"':''}><span aria-hidden="true">${esc(initials(n))}</span></button>`;}).join('');
48
48
  $('#curGrp').textContent=name;$('#curGrp').title=p.root;
49
49
  $('#curBranch').textContent=p.branch||'';
50
50
  $('#subName').textContent=name;$('#subPath').textContent=where;
51
- $('#footAddr').textContent=location.host;$('#footVer').textContent='v'+p.specpilotVersion;
51
+ $('#footAddr').textContent=$('#homeAddr').textContent=location.host;$('#footVer').textContent=$('#homeVer').textContent='v'+p.specpilotVersion;
52
52
  document.title=name+' · SpecPilot Local';
53
53
  }
54
54
 
55
55
  /* ---------------- views ---------------- */
56
- const VIEWS={board:'Tasks',explorer:'Explorer',security:'Security',instructions:'Instructions',commands:'Commands',skills:'Skills',setup:''};
56
+ const homeBtn=$('#homeBtn');
57
+ const VIEWS={board:'Tasks',explorer:'Explorer',security:'Security',instructions:'Instructions',commands:'Commands',skills:'Skills',setup:'',home:''};
57
58
  const TITLES={'planning/roadmap.md':'Roadmap','project/requirements.md':'Requirements','architecture/architecture.md':'Architecture','quality/tests.md':'Tests'};
58
59
  const NAV=[['board'],['file','planning/roadmap.md'],['file','project/requirements.md'],['explorer'],['file','architecture/architecture.md'],['file','quality/tests.md'],['security'],['instructions'],['commands'],['skills']];
59
60
  let curView='board',curFile='';
@@ -61,18 +62,25 @@ function syncNav(){
61
62
  $$('.src .srow').forEach(b=>{
62
63
  const on=b.dataset.v==='file'?(curView==='file'&&b.dataset.f===curFile):(b.dataset.v===curView);
63
64
  b.classList.toggle('on',on);b.setAttribute('aria-current',on?'page':'false');});
65
+ /* the rail: on Home (BL-PM-001) the Home tile is the current one and no project tile is */
66
+ const home=curView==='home';
67
+ [homeBtn,...$$('#projList .tile')].forEach(t=>{const cur=t===homeBtn?home:!home&&+t.dataset.project===PROJECT;
68
+ t.classList.toggle('cur',cur);if(cur)t.setAttribute('aria-current','true');else t.removeAttribute('aria-current');});
64
69
  }
65
70
  function go(v,keep,sub){
66
71
  if(v==='file'){if(!DATA||!sub)v='board';else curFile=sub;}
72
+ else if(v==='home'){if(!TOKEN)v='board';} // no Home with --read-only: nothing could be listed or opened
67
73
  else if(!VIEWS[v]||v==='setup')v='board';
68
- if(DATA&&DATA.project.specs===false)v='setup'; // no .specs/ yet: every route shows the setup view (BL-055)
74
+ if(v!=='home'&&DATA&&DATA.project.specs===false)v='setup'; // no .specs/ yet: every route of the project shows the setup view (BL-055)
69
75
  curView=v;
76
+ $('#win').classList.toggle('home',v==='home');
70
77
  $$('.content>.view').forEach(e=>e.classList.toggle('on',e.id==='v-'+v));
71
78
  syncNav();
72
79
  $('#title').textContent=v==='file'?(TITLES[sub]||sub):v==='setup'?'No .specs/ folder in '+DATA.projects[PROJECT].root:VIEWS[v];
73
80
  $('#modeSeg').hidden=v!=='board';
74
81
  setNav(false);closeInsp();
75
82
  if(v!=='file'||sub!==fileNoteFor)clearFileNote();
83
+ if(v==='home')loadRecent();
76
84
  if(v==='setup')renderSetup();
77
85
  if(v==='file')renderFile(sub);
78
86
  if(v==='explorer')renderExplorer();
@@ -86,11 +94,12 @@ let urlOk=true,memHash='';
86
94
  try{history.replaceState(null,'',location.href);}catch(e){urlOk=false;}
87
95
  try{memHash=location.hash;}catch(e){memHash='';}
88
96
  function curHash(){if(!urlOk)return memHash;try{return location.hash;}catch(e){return memHash;}}
89
- function setHash(v,sub){const h='#'+(PROJECT?PROJECT+'/':'')+v+(sub?'/'+sub:'');if(curHash()===h)return;memHash=h;
97
+ function setHash(v,sub){const h='#'+(PROJECT&&v!=='home'?PROJECT+'/':'')+v+(sub?'/'+sub:'');if(curHash()===h)return;memHash=h;
90
98
  if(!urlOk)return;
91
99
  try{history.replaceState(null,'',h);}catch(e){urlOk=false;}}
92
100
  function route(){
93
- const r=resolveRoute(curHash(),DATA?DATA.files:{},DATA?DATA.projects.length:1);
101
+ const r=resolveRoute(curHash(),DATA?DATA.files:{},DATA?DATA.projects.length:1,!!TOKEN);
102
+ if(r.view==='home'){go('home');return;} // Home belongs to no project: the shown one stays loaded behind it
94
103
  if(r.project!==PROJECT){switchProject(r.project,true);return;}
95
104
  if(r.view==='board'&&r.sub==='board'){mode='board';$$('#modeSeg button').forEach(x=>x.classList.toggle('on',x.dataset.m==='board'));renderTasks();}
96
105
  go(r.view,true,r.sub);
@@ -124,7 +133,7 @@ document.addEventListener('focusout',e=>{if(e.target.closest&&e.target.closest('
124
133
  window.addEventListener('scroll',hideTip,true);window.addEventListener('resize',hideTip);
125
134
  $('#rail').addEventListener('keydown',e=>{
126
135
  if(e.key!=='ArrowDown'&&e.key!=='ArrowUp'&&e.key!=='Home'&&e.key!=='End')return;
127
- const tiles=$$('#rail .tile');const i=tiles.indexOf(document.activeElement);if(i<0)return;
136
+ const tiles=$$('#rail .tile').filter(t=>!t.hidden);const i=tiles.indexOf(document.activeElement);if(i<0)return;
128
137
  e.preventDefault();
129
138
  const n=e.key==='Home'?0:e.key==='End'?tiles.length-1:(i+(e.key==='ArrowDown'?1:-1)+tiles.length)%tiles.length;
130
139
  tiles[n].focus();
@@ -288,8 +297,9 @@ document.addEventListener('keydown',e=>{
288
297
  const mod=e.metaKey||e.ctrlKey;const inField=/INPUT|SELECT|TEXTAREA/.test(e.target.tagName);
289
298
  if(mod&&e.key.toLowerCase()==='k'){e.preventDefault();palVeil.classList.contains('open')?closePal():openPal();return}
290
299
  if(mod&&/^[1-9]$/.test(e.key)){e.preventDefault();const n=NAV[+e.key-1];if(n)go(n[0],false,n[1]);return}
291
- if(e.key==='Escape'){hideTip();closeInsp();closePal();setNav(false);return}
300
+ if(e.key==='Escape'){hideTip();closeInsp();closePal();closeSheet();setNav(false);return}
292
301
  if(inField||mod||e.altKey)return;
302
+ if(e.key==='h'&&TOKEN&&!openVeil.classList.contains('open')){go('home');return;}
293
303
  if(/^[1-9]$/.test(e.key)){const n=NAV[+e.key-1];if(n)go(n[0],false,n[1]);}
294
304
  if((e.key==='j'||e.key==='k')&&curView==='board'){const rows=$$((mode==='board'?'#boardMode':'#listMode')+' .row[data-col]');if(!rows.length)return;let i=rows.findIndex(r=>r.dataset.col+':'+r.dataset.i===selected);i=e.key==='j'?Math.min(rows.length-1,i+1):Math.max(0,i-1);if(i<0)i=0;openTask(rows[i].dataset.col,+rows[i].dataset.i);rows[i].scrollIntoView({block:'nearest'});rows[i].focus();}
295
305
  });
@@ -450,11 +460,11 @@ async function apply(d,paths){
450
460
  const key=focusKey(document.activeElement);
451
461
  const scroll=$('#content').scrollTop,ib0=insp.querySelector('.ib2'),inspScroll=ib0?ib0.scrollTop:0;
452
462
  const was=inspOpen;
453
- const hadSpecs=DATA&&DATA.project.specs!==false;
463
+ const hadSpecs=!(DATA&&DATA.project.specs===false);
454
464
  DATA=d;
455
465
  renderProject();renderTasks();renderIde();renderAgentFiles();
456
- if(d.project.specs===false&&curView!=='setup'){go('setup');return;} // .specs/ gone: offer setup
457
- if(hadSpecs===false&&d.project.specs!==false&&curView==='setup'){go('board');return;} // .specs/ appeared another way
466
+ const to=reloadView(curView,hadSpecs,d.project.specs!==false); // .specs/ gone: offer setup; appeared another way: Tasks; Home stays
467
+ if(to){go(to);return;}
458
468
  if(curView==='file')await renderFile(curFile);
459
469
  if(curView==='explorer')renderExplorer();
460
470
  if(curView==='security')await renderSecurity();
@@ -485,12 +495,78 @@ async function switchProject(n,keepRoute){
485
495
  try{const r=await fetch('/api/specs?'+pq(),{cache:'no-store'});if(!r.ok)throw new Error('/api/specs: HTTP '+r.status);d=await r.json();}
486
496
  catch(e){if(PROJECT===n)PROJECT=was;toast('Could not load the project: '+e.message);return;}
487
497
  if(PROJECT!==n)return;
498
+ showProject(d,keepRoute);
499
+ }
500
+ /* Draw project PROJECT from payload d: the tail of a switch, also used with the payload an open returns (BL-067). */
501
+ function showProject(d,keepRoute){
488
502
  Object.keys(fileCache).forEach(k=>{delete fileCache[k];});secShown.clear();
489
503
  DATA=d;selected=null;
490
504
  renderProject();renderTasks();renderIde();renderAgentFiles();listen();
491
505
  if(keepRoute)route();else go('board');
492
506
  }
493
- $('#projList').addEventListener('click',e=>{const b=e.target.closest('[data-project]');if(b&&+b.dataset.project!==PROJECT)switchProject(+b.dataset.project);});
507
+ $('#projList').addEventListener('click',e=>{const b=e.target.closest('[data-project]');if(!b)return;
508
+ if(+b.dataset.project!==PROJECT)switchProject(+b.dataset.project);else if(curView==='home')go('board');});
509
+
510
+ /* ---------------- open a project (BL-067) ----------------
511
+ The + tile opens the mockup's sheet (Folder tab only). The list is GET /api/projects; opening is
512
+ POST /api/projects, which serves one more folder and remembers it; Remove from list edits the
513
+ registry only. Nothing here is file content; the strings are the ones REQ-002.H.21 lists. */
514
+ const openVeil=$('#openVeil'),addBtn=$('#addBtn'),pathIn=$('#pathIn');
515
+ let openBusy=false,sheetFrom=addBtn;
516
+ if(TOKEN){addBtn.hidden=false;homeBtn.hidden=false;$('#rail>.logo').remove();} // the Home tile takes the logo's place (BL-PM-001)
517
+ function openSheet(from){hideTip();sheetFrom=from;openVeil.classList.add('open');pathIn.value='';loadRecent();setTimeout(()=>pathIn.focus(),50);}
518
+ function closeSheet(){if(!openVeil.classList.contains('open'))return;openVeil.classList.remove('open');sheetFrom.focus();}
519
+ /* The registry as GET /api/projects sends it: in the sheet, or on Home (BL-PM-001), where a row opens
520
+ its folder at once, has no Remove, and a served project also shows the branch the rail tooltip shows. */
521
+ function drawRecent(reg,home){
522
+ $(home?'#homePath':'#recentPath').textContent=reg.path||'';
523
+ $(home?'#homeBox':'#recentBox').innerHTML=recentHtml(reg,home,DATA?DATA.projects:[],chev);
524
+ }
525
+ async function loadRecent(){
526
+ let reg;
527
+ try{const r=await fetch('/api/projects',{cache:'no-store'});reg=r.ok?await r.json():{error:'HTTP '+r.status,entries:[]};}
528
+ catch(e){reg={error:'The server did not answer.',entries:[]};}
529
+ if(openVeil.classList.contains('open'))drawRecent(reg);
530
+ if(curView==='home')drawRecent(reg,true);
531
+ }
532
+ async function postPath(path,url){
533
+ const r=await fetch(url,{method:'POST',cache:'no-store',headers:{'Content-Type':'application/json','X-SpecPilot-Token':TOKEN},body:JSON.stringify({path})});
534
+ return {r,res:await r.json().catch(()=>({}))};
535
+ }
536
+ /* Open a folder: the sheet's Open, and a row on Home. */
537
+ async function openPath(path){
538
+ if(!path||openBusy)return;
539
+ openBusy=true;$('#openGo').disabled=true;
540
+ let out;
541
+ try{out=await postPath(path,'/api/projects');}
542
+ catch(e){openBusy=false;$('#openGo').disabled=false;toast('The server did not answer.');return;}
543
+ openBusy=false;$('#openGo').disabled=false;
544
+ const o=openOutcome(out.r.status,out.res),wasHome=curView==='home';
545
+ if(o.project===null){toast(o.toast);return;} // refused: the page stays where it is
546
+ closeSheet();
547
+ if(o.specs){PROJECT=o.project;showProject(o.specs,false);}
548
+ else if(o.project!==PROJECT)await switchProject(o.project);
549
+ else if(wasHome)go('board');
550
+ toast(o.toast);
551
+ if(wasHome)$('#content').focus(); // Home is gone from the screen: focus goes to the project's view, not to a hidden control
552
+ }
553
+ async function removeRecent(path){
554
+ let out;
555
+ try{out=await postPath(path,'/api/projects/remove');}catch(e){toast('The server did not answer.');return;}
556
+ if(out.r.status===200){drawRecent(out.res);if(curView==='home')drawRecent(out.res,true);}else toast(out.res.error||`Nothing was removed (HTTP ${out.r.status}).`);
557
+ }
558
+ addBtn.onclick=()=>openSheet(addBtn);
559
+ homeBtn.onclick=()=>go('home');
560
+ $('#homeOpen').onclick=e=>openSheet(e.currentTarget);
561
+ $('#homeBox').addEventListener('click',e=>{const row=e.target.closest('[data-path]');if(row)openPath(row.dataset.path);});
562
+ $('#openCancel').onclick=closeSheet;
563
+ openVeil.onclick=e=>{if(e.target===openVeil)closeSheet();};
564
+ $('#openForm').onsubmit=e=>{e.preventDefault();openPath(pathIn.value.trim());};
565
+ $('#recentBox').addEventListener('click',e=>{
566
+ const rm=e.target.closest('[data-remove]');if(rm){removeRecent(rm.dataset.remove);return;}
567
+ const row=e.target.closest('[data-path]');if(row){pathIn.value=row.dataset.path;pathIn.focus();}
568
+ });
569
+ $('#recentBox').addEventListener('keydown',e=>{const row=e.target.closest&&e.target.closest('[data-path]');if(row&&(e.key==='Enter'||e.key===' ')){e.preventDefault();pathIn.value=row.dataset.path;pathIn.focus();}});
494
570
 
495
571
  /* boot: the project count is unknown until the first load, so an index past the end falls back to project 0 */
496
572
  insp.setAttribute('aria-hidden','true');
package/ui/index.html CHANGED
@@ -69,8 +69,10 @@
69
69
  <div class="win" id="win">
70
70
  <nav class="rail" id="rail" aria-label="Projects">
71
71
  <svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
72
+ <button class="tile home" id="homeBtn" aria-label="Home" aria-keyshortcuts="h" data-tip="Home" hidden><svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg></button>
72
73
  <div class="rsep" aria-hidden="true"></div>
73
74
  <div class="rlist" id="projList" role="group" aria-label="Open projects"></div>
75
+ <button class="tile act" id="addBtn" aria-label="Add a project" data-tip="Add a project" hidden><svg aria-hidden="true" focusable="false"><use href="#i-plus"/></svg></button>
74
76
  <div class="rfoot">
75
77
  <button class="tile ghost" id="themeBtn" aria-label="Switch between light and dark" data-tip="Light / dark"><svg aria-hidden="true" focusable="false"><use href="#i-sun"/></svg></button>
76
78
  </div>
@@ -111,9 +113,22 @@
111
113
  <div class="seg" id="modeSeg"><button class="on" data-m="list">List</button><button data-m="board">Board</button></div>
112
114
  </div>
113
115
  </div>
114
- <div class="content" id="content">
116
+ <div class="content" id="content" tabindex="-1">
115
117
  <p class="note" id="loadErr" hidden></p>
116
118
 
119
+ <!-- HOME (BL-PM-001): the mockup's #s-welcome column, cut down to what is built and true today -->
120
+ <section class="view welcome" id="v-home" aria-labelledby="wTitle">
121
+ <svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
122
+ <div><h1 id="wTitle">Your specs, as a board.</h1><p class="lead">SpecPilot reads the <span class="mono" translate="no">.specs/</span> folder of any project on this machine and shows its tasks and spec files as they are written. Your AI IDE keeps doing the coding.</p></div>
123
+ <button type="button" class="btn pri big" id="homeOpen">Open a Project Folder</button>
124
+ <div class="gl benefits"><div class="box">
125
+ <div class="row"><span class="ic2"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-folder"/></svg></span><div class="body"><div class="ttl">Files are the truth</div><div class="det">Every view is read from <span class="mono" translate="no">.specs/</span> and git. Every action writes a file you could have edited by hand.</div></div></div>
126
+ <div class="row"><span class="ic2"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-shield"/></svg></span><div class="body"><div class="ttl">Nothing leaves this machine</div><div class="det">Runs on localhost, no account, no telemetry. No <span class="mono" translate="no">.specs/</span> yet? The guided setup writes one for you.</div></div></div>
127
+ </div></div>
128
+ <div class="gl recents"><div class="gh">Recent projects <span class="cnt" id="homePath" translate="no"></span></div><div class="box" id="homeBox"></div></div>
129
+ <div class="fine"><i aria-hidden="true"></i><span>Server running on <span class="mono" id="homeAddr" translate="no"></span> · <span id="homeVer" translate="no"></span></span></div>
130
+ </section>
131
+
117
132
  <!-- TASKS: the rows of planning/tasks.md, from readSpecs() -->
118
133
  <section class="view on" id="v-board">
119
134
  <div id="listMode">
@@ -174,6 +189,16 @@
174
189
  </main>
175
190
  </div>
176
191
 
192
+ <!-- OPEN A PROJECT (BL-067): the mockup's sheet, Folder tab only; the list is GET /api/projects -->
193
+ <div class="veil" id="openVeil"><div class="sheet" role="dialog" aria-modal="true" aria-labelledby="openTitle" tabindex="-1">
194
+ <div class="sh"><div><h2 id="openTitle">Open a Project</h2><p>SpecPilot reads the folder on this machine. Nothing is uploaded.</p></div></div>
195
+ <form class="sb" id="openForm" autocomplete="off">
196
+ <div class="gl"><div class="box"><div class="field"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-folder"/></svg><input id="pathIn" name="folder-path" type="text" spellcheck="false" aria-label="Folder path" placeholder="/path/to/project or ~/project"></div></div></div>
197
+ <div class="gl"><div class="gh">Recent projects <span class="cnt" id="recentPath" translate="no"></span></div><div class="box" id="recentBox"></div></div>
198
+ </form>
199
+ <div class="sf"><button type="button" class="btn" id="openCancel">Cancel</button><button type="submit" class="btn pri" id="openGo" form="openForm">Open</button></div>
200
+ </div></div>
201
+
177
202
  <!-- PALETTE -->
178
203
  <div class="veil pal-veil" id="palVeil"><div class="pal"><input id="palIn" type="search" name="q" aria-label="Search views, spec files and tasks" placeholder="Jump to a view, spec file or task…" autocomplete="off" spellcheck="false"><ul id="palList"></ul></div></div>
179
204
  <div class="toast" id="toast" role="status" aria-live="polite"></div>
package/ui/route.js CHANGED
@@ -8,10 +8,13 @@ const esc=s=>String(s).replace(/[&<>"]/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;',
8
8
  A file the latest /api/specs does not list stays on the file view with missing:true,
9
9
  so the page can say it no longer exists instead of silently showing something else.
10
10
  "#2/board" is project 2 of `count` (BL-054); no index, or "#0/", is project 0; an index
11
- that names no served project goes to project 0's Tasks view. */
12
- function resolveRoute(hash,files,count){
11
+ that names no served project goes to project 0's Tasks view. "#home" is the Home screen
12
+ (BL-PM-001) when `home` says the page has one: it belongs to no project, so an index before
13
+ it and anything after it are ignored; without `home` it is an unknown view. */
14
+ function resolveRoute(hash,files,count,home){
13
15
  let h=String(hash||'').replace(/^#/,''),project=0;
14
16
  const m=/^(\d+)\/(.*)$/.exec(h);
17
+ if(home&&/^home(\/|$)/.test(m?m[2]:h))return {project:0,view:'home',sub:'',missing:false};
15
18
  if(m){
16
19
  if(!/^(0|[1-9][0-9]*)$/.test(m[1])||Number(m[1])>=(count||1))return {project:0,view:'board',sub:'',missing:false};
17
20
  project=Number(m[1]);h=m[2];
@@ -28,6 +31,46 @@ function resolveRoute(hash,files,count){
28
31
  /* The whole content of a view whose file is gone: its path, and that it no longer exists. */
29
32
  function goneHtml(path){return `<p class="note"><span class="mono" translate="no">${esc(path)}</span> no longer exists.</p>`;}
30
33
 
31
- const api={resolveRoute,goneHtml};
34
+ /* A time as "4 Oct 2026, 07:08", local, the same in every locale; what Date cannot parse is shown as it is. */
35
+ const MONTHS=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
36
+ function when(iso){
37
+ const d=new Date(iso),p=n=>String(n).padStart(2,'0');
38
+ return isNaN(d)?iso:`${d.getDate()} ${MONTHS[d.getMonth()]} ${d.getFullYear()}, ${p(d.getHours())}:${p(d.getMinutes())}`;
39
+ }
40
+
41
+ /* The registry as GET /api/projects sends it (BL-067): the rows of the sheet's list, or of Home's
42
+ (BL-PM-001), where a row is one button that opens its folder, has no Remove, and a project that
43
+ is open also shows the branch /api/specs gives for it (`projects`, as the rail tooltip does). */
44
+ function recentHtml(reg,home,projects,chev){
45
+ if(reg.error)return `<p class="note">${esc(reg.error)}</p>`;
46
+ if(!reg.entries.length)return '<div class="empty">No projects remembered yet.</div>';
47
+ return reg.entries.map(e=>{
48
+ const det=[when(e.lastOpened)];
49
+ if(e.project!==null)det.push('open as project '+e.project);
50
+ if(!e.exists)det.push('folder not found');
51
+ if(home){const q=e.project!==null&&projects?projects[e.project]:null;
52
+ return `<button type="button" class="row act" data-path="${esc(e.path)}"><div class="body"><div class="ttl" translate="no">${esc(e.root+(q&&q.branch?' · '+q.branch:''))}</div><div class="det">${esc(det.join(' · '))}</div></div><div class="trail">${chev||''}</div></button>`;}
53
+ return `<div class="row recent"><div class="body" data-path="${esc(e.path)}" role="button" tabindex="0"><div class="ttl" translate="no">${esc(e.root)}</div><div class="det">${esc(det.join(' · '))}</div></div><button type="button" class="btn sm" data-remove="${esc(e.path)}">Remove from list</button></div>`;
54
+ }).join('');
55
+ }
56
+
57
+ /* What the page does with the answer to POST /api/projects, from the sheet or a row on Home:
58
+ `project` is the one to show (null: nothing was opened, the page stays where it is), `specs` its
59
+ payload when the answer carries one, `toast` the message, the server's own when it sent one. */
60
+ function openOutcome(status,res){
61
+ if(status===200)return {project:res.project,specs:res.specs,toast:`${res.specs.projects[res.project].root} opened as project ${res.project}`+(res.registry&&res.registry.error?'. '+res.registry.error:'')};
62
+ if(status===409&&typeof res.project==='number')return {project:res.project,specs:null,toast:res.error||`Already open as project ${res.project}`};
63
+ return {project:null,specs:null,toast:res.error||`Nothing was opened (HTTP ${status}).`};
64
+ }
65
+
66
+ /* The view a live-reload payload forces, or null to stay: setup when .specs/ is gone, Tasks when it
67
+ appeared while the setup view was shown. Home belongs to no project, so it never moves. */
68
+ function reloadView(curView,hadSpecs,hasSpecs){
69
+ if(!hasSpecs&&curView!=='setup'&&curView!=='home')return 'setup';
70
+ if(!hadSpecs&&hasSpecs&&curView==='setup')return 'board';
71
+ return null;
72
+ }
73
+
74
+ const api={resolveRoute,goneHtml,recentHtml,openOutcome,reloadView};
32
75
  if(typeof module==='object'&&module.exports)module.exports=api;else Object.assign(root,api);
33
76
  })(this);