project-mgr 0.1.1 → 0.1.3

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/.env_sample CHANGED
@@ -1,5 +1,7 @@
1
- # SQLite database path. Relative paths are resolved from the current directory.
2
- PMGR_DB_PATH=./data/project-mgr.sqlite
1
+ # Optional SQLite database override. When unset, the database is stored at
2
+ # ~/.local/share/project-mgr/project-mgr.sqlite.
3
+ # Use a literal absolute path here; .env files do not expand ~ or $HOME.
4
+ # PMGR_DB_PATH=/absolute/path/to/project-mgr.sqlite
3
5
 
4
6
  # For isolated manual testing, use a separate database instead:
5
- # PMGR_DB_PATH=./data/manual-test.sqlite
7
+ # PMGR_DB_PATH=/tmp/project-mgr-manual-test.sqlite
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.3 - 2026-08-03
6
+
7
+ ### Added
8
+
9
+ - Packaged the `project-mgr-status` Agent Skill for status ledger operations.
10
+
11
+ ### Fixed
12
+
13
+ - Made the CLI run through npm-created `pmgr` symlinks and corrected the no-install examples.
14
+
15
+ ## 0.1.2 - 2026-08-03
16
+
17
+ ### Changed
18
+
19
+ - Moved the default database from the command's working directory to the stable per-user path `~/.local/share/project-mgr/project-mgr.sqlite`.
20
+
5
21
  ## 0.1.1 - 2026-08-03
6
22
 
7
23
  ### Changed
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `project-mgr` is a local-first, append-only ledger for project status. It stores progress, blockers, decisions, and next steps as timestamped status snapshots, so people and AI agents can quickly inspect each project's current state, complete history, or state at a particular time.
6
6
 
7
- The first release provides only a local CLI and SQLite. It has no HTTP API, long-running service, or agent skills. Data stays on the local machine and requires no account or cloud service.
7
+ The first release provides a local CLI, SQLite, and an optional Agent Skill. It has no HTTP API or long-running service. Data stays on the local machine and requires no account or cloud service.
8
8
 
9
9
  ## Run from npm
10
10
 
@@ -13,7 +13,7 @@ Requires Node.js 22+.
13
13
  Run without installing:
14
14
 
15
15
  ```bash
16
- npx --yes project-mgr current
16
+ npx --yes --package project-mgr pmgr current
17
17
  ```
18
18
 
19
19
  Or install the CLI globally:
@@ -23,12 +23,28 @@ npm install --global project-mgr
23
23
  pmgr current
24
24
  ```
25
25
 
26
- The database defaults to `./data/project-mgr.sqlite` in the current working directory. Set `PMGR_DB_PATH` to use another location:
26
+ The database defaults to `~/.local/share/project-mgr/project-mgr.sqlite`, regardless of the directory where `pmgr` is executed. The CLI resolves this to an absolute path using the current user's home directory and creates the parent directory automatically.
27
+
28
+ Set `PMGR_DB_PATH` to use another location:
29
+
30
+ ```bash
31
+ PMGR_DB_PATH=/absolute/path/projects.sqlite npx --yes --package project-mgr pmgr current
32
+ ```
33
+
34
+ ## Install the Agent Skill
35
+
36
+ The repository includes `skills/project-mgr-status`, which guides compatible AI agents to add, import, query, and export status records. Install it with the [skills CLI](https://skills.sh/docs/cli):
27
37
 
28
38
  ```bash
29
- PMGR_DB_PATH=/absolute/path/projects.sqlite npx --yes project-mgr current
39
+ npx skills add deanplus/project-manager
30
40
  ```
31
41
 
42
+ The installer detects supported agents and asks where to install the skill. No separate `project-mgr` installation is required: the skill runs the CLI through `npx`. Restart or reload the selected agent after installation.
43
+
44
+ The skill uses the same `PMGR_DB_PATH` behavior as the CLI: it defaults to `~/.local/share/project-mgr/project-mgr.sqlite`; set an absolute path to work in another ledger. For manual or exploratory work, use a dedicated database such as `PMGR_DB_PATH=/tmp/project-mgr-skill-test.sqlite` rather than the default ledger.
45
+
46
+ Then ask the agent, for example: `Use project-mgr-status to add an active status for project-mgr after checking its current status.`
47
+
32
48
  ## Build from source
33
49
 
34
50
  Requires Node.js 22+ and pnpm 10.30.2.
@@ -53,26 +69,26 @@ During development, run the TypeScript CLI directly:
53
69
  pnpm pmgr current
54
70
  ```
55
71
 
56
- The default configuration in `.env_sample` is:
72
+ The default database path is:
57
73
 
58
- ```dotenv
59
- PMGR_DB_PATH=./data/project-mgr.sqlite
74
+ ```text
75
+ ~/.local/share/project-mgr/project-mgr.sqlite
60
76
  ```
61
77
 
62
- Set `PMGR_DB_PATH` in `.env` to use another location, or override it for one command:
78
+ `PMGR_DB_PATH` is optional in `.env_sample`. Set it in `.env` to use another location, or override it for one command:
63
79
 
64
80
  ```bash
65
81
  PMGR_DB_PATH=/absolute/path/projects.sqlite pnpm start current
66
82
  ```
67
83
 
68
- Relative paths are resolved from the working directory of the command. When `pnpm start ...` runs from this project's root, the default database is `./data/project-mgr.sqlite`. It is created automatically when the first valid command runs.
84
+ Use a literal absolute path in `.env`; `.env` files do not expand `~` or `$HOME`. The database is created automatically when the first valid command runs.
69
85
 
70
86
  ### Use an isolated test database
71
87
 
72
88
  For manual testing, set a persistent path in `.env` that is separate from production data:
73
89
 
74
90
  ```dotenv
75
- PMGR_DB_PATH=./data/manual-test.sqlite
91
+ PMGR_DB_PATH=/tmp/project-mgr-manual-test.sqlite
76
92
  ```
77
93
 
78
94
  Then run commands normally:
@@ -88,7 +104,7 @@ pnpm start history --project test-project
88
104
 
89
105
  Project keys must match exactly: a record added to `test-project` is not part of `project-mgr` history. Empty human-readable list queries print `No entries found.`; with `--json`, they print `[]`.
90
106
 
91
- `data/` is ignored by Git, so test data is not committed. Delete `data/manual-test.sqlite` when it is no longer needed.
107
+ Delete `/tmp/project-mgr-manual-test.sqlite` when it is no longer needed.
92
108
 
93
109
  Automated tests use an in-memory database or SQLite files in the system temporary directory; they do not read or write the default database. `PMGR_DB_PATH=:memory:` also works for one command, but each CLI command runs in a separate process and its data disappears when the command exits, so it is not suitable for consecutive manual tests.
94
110
 
@@ -189,7 +205,7 @@ Exports omit the database-internal `id` and `recordedAt` fields and can be impor
189
205
  ```bash
190
206
  pnpm start export --format jsonl > project-statuses.jsonl
191
207
 
192
- PMGR_DB_PATH=./data/restored.sqlite \
208
+ PMGR_DB_PATH=/tmp/project-mgr-restored.sqlite \
193
209
  pnpm start import project-statuses.jsonl
194
210
  ```
195
211
 
package/README_CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `project-mgr` 是一个本地优先、只追加的项目状态账本。它把项目进展、阻塞、决策和下一步保存为带时间的状态快照,让个人或 AI Agent 能快速查询每个项目的当前状态、完整历史以及某个时间点的状态。
6
6
 
7
- 首版只提供本地 CLI 和 SQLite,不包含 HTTP API、常驻服务或 Agent Skills。数据默认保存在本机,无需账号或云服务。
7
+ 首版提供本地 CLI、SQLite 和可选的 Agent Skill,不包含 HTTP API 或常驻服务。数据默认保存在本机,无需账号或云服务。
8
8
 
9
9
  ## 从 npm 运行
10
10
 
@@ -13,7 +13,7 @@
13
13
  无需安装即可运行:
14
14
 
15
15
  ```bash
16
- npx --yes project-mgr current
16
+ npx --yes --package project-mgr pmgr current
17
17
  ```
18
18
 
19
19
  也可以全局安装 CLI:
@@ -23,12 +23,28 @@ npm install --global project-mgr
23
23
  pmgr current
24
24
  ```
25
25
 
26
- 数据库默认位于当前工作目录下的 `./data/project-mgr.sqlite`。通过 `PMGR_DB_PATH` 指定其他位置:
26
+ 无论在哪个目录执行 `pmgr`,数据库都默认位于 `~/.local/share/project-mgr/project-mgr.sqlite`。CLI 会根据当前用户的主目录将其解析为绝对路径,并自动创建父目录。
27
+
28
+ 通过 `PMGR_DB_PATH` 指定其他位置:
29
+
30
+ ```bash
31
+ PMGR_DB_PATH=/absolute/path/projects.sqlite npx --yes --package project-mgr pmgr current
32
+ ```
33
+
34
+ ## 安装 Agent Skill
35
+
36
+ 仓库包含 `skills/project-mgr-status`,用于指导兼容 Skills 的 AI Agent 新增、导入、查询和导出项目状态记录。通过 [skills CLI](https://skills.sh/docs/cli) 安装:
27
37
 
28
38
  ```bash
29
- PMGR_DB_PATH=/absolute/path/projects.sqlite npx --yes project-mgr current
39
+ npx skills add deanplus/project-manager
30
40
  ```
31
41
 
42
+ 安装器会检测支持的 Agent,并询问安装目标。无需单独安装 `project-mgr`:该 Skill 会通过 `npx` 运行 CLI。安装后重启或重新加载所选 Agent。
43
+
44
+ 该 Skill 与 CLI 使用相同的 `PMGR_DB_PATH` 规则:默认使用 `~/.local/share/project-mgr/project-mgr.sqlite`;如需使用其他账本,请设置绝对路径。手工或探索性操作请使用独立数据库,例如 `PMGR_DB_PATH=/tmp/project-mgr-skill-test.sqlite`,避免写入默认账本。
45
+
46
+ 随后可向 Agent 提出,例如:`使用 project-mgr-status,在查询当前状态后为 project-mgr 新增一条 active 状态。`
47
+
32
48
  ## 从源码构建
33
49
 
34
50
  需要 Node.js 22+ 和 pnpm 10.30.2。
@@ -53,26 +69,26 @@ pnpm start current
53
69
  pnpm pmgr current
54
70
  ```
55
71
 
56
- 默认配置位于 `.env_sample`:
72
+ 默认数据库路径是:
57
73
 
58
- ```dotenv
59
- PMGR_DB_PATH=./data/project-mgr.sqlite
74
+ ```text
75
+ ~/.local/share/project-mgr/project-mgr.sqlite
60
76
  ```
61
77
 
62
- 通过 `.env` 中的 `PMGR_DB_PATH` 指定其他位置,也可以为单条命令临时覆盖:
78
+ `.env_sample` 中的 `PMGR_DB_PATH` 是可选配置。可以在 `.env` 中指定其他位置,也可以为单条命令临时覆盖:
63
79
 
64
80
  ```bash
65
81
  PMGR_DB_PATH=/absolute/path/projects.sqlite pnpm start current
66
82
  ```
67
83
 
68
- 路径基于启动命令的当前工作目录计算。从本项目根目录执行 `pnpm start ...` 时,默认位置就是 `./data/project-mgr.sqlite`。数据库会在第一次执行有效命令时自动创建。
84
+ 在 `.env` 中应填写字面量绝对路径;`.env` 文件不会展开 `~` 或 `$HOME`。数据库会在第一次执行有效命令时自动创建。
69
85
 
70
86
  ### 使用独立测试数据库
71
87
 
72
88
  手工测试时,建议在 `.env` 中固定设置一个与正式数据分离的路径:
73
89
 
74
90
  ```dotenv
75
- PMGR_DB_PATH=./data/manual-test.sqlite
91
+ PMGR_DB_PATH=/tmp/project-mgr-manual-test.sqlite
76
92
  ```
77
93
 
78
94
  随后正常执行命令:
@@ -88,7 +104,7 @@ pnpm start history --project test-project
88
104
 
89
105
  项目键必须完全一致:写入 `test-project` 的记录不会出现在 `project-mgr` 的历史中。人类可读的空列表查询会输出 `No entries found.`;使用 `--json` 时则输出 `[]`。
90
106
 
91
- `data/` 已加入 Git ignore,测试数据不会进入版本库。不需要保留时,可以删除 `data/manual-test.sqlite`。
107
+ 不需要保留时,可以删除 `/tmp/project-mgr-manual-test.sqlite`。
92
108
 
93
109
  自动化测试会使用内存数据库或系统临时目录中的 SQLite 文件,不会读写默认数据库。`PMGR_DB_PATH=:memory:` 也可用于单条命令,但每个 CLI 命令都是独立进程,命令结束后数据就会消失,不适合连续手工测试。
94
110
 
@@ -189,7 +205,7 @@ pnpm start import --file statuses.jsonl --json
189
205
  ```bash
190
206
  pnpm start export --format jsonl > project-statuses.jsonl
191
207
 
192
- PMGR_DB_PATH=./data/restored.sqlite \
208
+ PMGR_DB_PATH=/tmp/project-mgr-restored.sqlite \
193
209
  pnpm start import project-statuses.jsonl
194
210
  ```
195
211
 
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync } from "node:fs";
3
- import { basename, resolve } from "node:path";
2
+ import { readFileSync, realpathSync } from "node:fs";
3
+ import { basename } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { addStatus, at, current, history, importStatuses, openLedger, parseTime, toPortableStatusEntry, ValidationError, } from "./index.js";
6
6
  const repeats = new Set(["next", "blocker", "decision", "tag"]);
@@ -201,7 +201,7 @@ export function run(argv, write = process.stdout.write.bind(process.stdout)) {
201
201
  }
202
202
  /* c8 ignore start -- process entry glue is covered by the CLI integration tests through run(). */
203
203
  if (process.argv[1] &&
204
- import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
204
+ import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {
205
205
  try {
206
206
  run(process.argv.slice(2));
207
207
  }
package/dist/db.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import Database from "better-sqlite3";
2
2
  import { mkdirSync } from "node:fs";
3
+ import { homedir } from "node:os";
3
4
  import { dirname, resolve } from "node:path";
4
5
  import { validateStatusEntry, ValidationError, } from "./domain.js";
5
6
  const migration = `
@@ -28,7 +29,7 @@ CREATE INDEX IF NOT EXISTS idx_status_entries_project_occurred ON status_entries
28
29
  `;
29
30
  export function databasePath() {
30
31
  return (process.env.PMGR_DB_PATH ||
31
- resolve(process.cwd(), "data", "project-mgr.sqlite"));
32
+ resolve(homedir(), ".local", "share", "project-mgr", "project-mgr.sqlite"));
32
33
  }
33
34
  export function openLedger(path = databasePath()) {
34
35
  if (path !== ":memory:")
@@ -57,7 +57,7 @@ The `project_id, occurred_at DESC, id DESC` index supports current-status and hi
57
57
 
58
58
  After opening the database, `openLedger()` enables foreign keys, creates the migration table, and checks for and applies migration 1 within a `BEGIN IMMEDIATE` transaction. The immediate transaction prevents migration checks and writes from interleaving when several local processes open the database for the first time at once.
59
59
 
60
- The database path is read from `PMGR_DB_PATH` first; otherwise, it uses `data/project-mgr.sqlite` in the process working directory. Non-memory databases create their parent directory automatically.
60
+ The database path is read from `PMGR_DB_PATH` first; otherwise, it uses the absolute path `~/.local/share/project-mgr/project-mgr.sqlite`, resolved from the current user's home directory. Non-memory databases create their parent directory automatically.
61
61
 
62
62
  ## Write flow
63
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-mgr",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first append-only project status ledger",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: project-mgr-status
3
+ description: Manage project status with the local-first project-mgr CLI. Use when an AI agent needs to add an append-only project update, import status records, query current or historical project state, or export a status ledger.
4
+ ---
5
+
6
+ # Project Mgr Status
7
+
8
+ Use `npx --yes --package project-mgr pmgr`. In a source checkout, use `pnpm pmgr` instead.
9
+
10
+ ## Database safety
11
+
12
+ - Read `PMGR_DB_PATH` before operating. If unset, the CLI uses `~/.local/share/project-mgr/project-mgr.sqlite`.
13
+ - For exploratory or test work, set `PMGR_DB_PATH` to a dedicated absolute SQLite path for every command. Do not use `:memory:` when more than one CLI invocation must share data.
14
+ - Query before writing. `add` appends a snapshot; it does not edit the previous one.
15
+ - Set `--source agent` for agent-authored updates. Use `--external-ref` only when a stable idempotency key is available.
16
+
17
+ ## Operations
18
+
19
+ Prefer `--json` for data that must be interpreted or reported programmatically.
20
+
21
+ ```bash
22
+ # Add an agent-authored status snapshot.
23
+ npx --yes --package project-mgr pmgr add --project my-project --status active --summary "Implemented the CLI" \
24
+ --progress "Tests pass" --next "Publish the package" --source agent --json
25
+
26
+ # Query current state, history, or state at a time.
27
+ npx --yes --package project-mgr pmgr current --project my-project --json
28
+ npx --yes --package project-mgr pmgr history --project my-project --limit 20 --json
29
+ npx --yes --package project-mgr pmgr at --project my-project --at 2026-08-03T12:00:00+08:00 --json
30
+
31
+ # Import validated JSON/JSONL, or export portable records.
32
+ npx --yes --package project-mgr pmgr import statuses.jsonl --json
33
+ npx --yes --package project-mgr pmgr export --project my-project --format jsonl > statuses.jsonl
34
+ ```
35
+
36
+ Use `PMGR_DB_PATH=/absolute/path/test.sqlite npx --yes --package project-mgr pmgr ...` to isolate a manual test database. Import validates the entire batch before one transaction writes it; export output can be imported directly.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Project Status Ledger"
3
+ short_description: "Manage local project status records safely"
4
+ default_prompt: "Use $project-mgr-status to add and inspect this project status."
package/src/cli.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync } from "node:fs";
3
- import { basename, resolve } from "node:path";
2
+ import { readFileSync, realpathSync } from "node:fs";
3
+ import { basename } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import {
6
6
  addStatus,
@@ -260,7 +260,7 @@ export function run(
260
260
  /* c8 ignore start -- process entry glue is covered by the CLI integration tests through run(). */
261
261
  if (
262
262
  process.argv[1] &&
263
- import.meta.url === pathToFileURL(resolve(process.argv[1])).href
263
+ import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href
264
264
  ) {
265
265
  try {
266
266
  run(process.argv.slice(2));
package/src/db.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import Database from "better-sqlite3";
2
2
  import { mkdirSync } from "node:fs";
3
+ import { homedir } from "node:os";
3
4
  import { dirname, resolve } from "node:path";
4
5
  import {
5
6
  type Source,
@@ -46,7 +47,7 @@ CREATE INDEX IF NOT EXISTS idx_status_entries_project_occurred ON status_entries
46
47
  export function databasePath(): string {
47
48
  return (
48
49
  process.env.PMGR_DB_PATH ||
49
- resolve(process.cwd(), "data", "project-mgr.sqlite")
50
+ resolve(homedir(), ".local", "share", "project-mgr", "project-mgr.sqlite")
50
51
  );
51
52
  }
52
53
 
package/test/core.test.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import assert from "node:assert/strict";
2
- import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
2
+ import { spawnSync } from "node:child_process";
3
+ import { mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
4
+ import { homedir, tmpdir } from "node:os";
4
5
  import { join } from "node:path";
5
6
  import test from "node:test";
7
+ import { fileURLToPath } from "node:url";
6
8
  import { run } from "../src/cli.js";
7
9
  import {
8
10
  addStatus,
@@ -171,7 +173,7 @@ test("import validates before transaction and default source is import", () => {
171
173
  db.close();
172
174
  });
173
175
 
174
- test("database path uses environment override and file migration creates parent directory", () => {
176
+ test("database path has a stable default and environment override creates its parent directory", () => {
175
177
  const directory = mkdtempSync(join(tmpdir(), "pmgr-"));
176
178
  const previous = process.env.PMGR_DB_PATH;
177
179
  process.env.PMGR_DB_PATH = join(directory, "nested", "ledger.sqlite");
@@ -180,7 +182,30 @@ test("database path uses environment override and file migration creates parent
180
182
  db.close();
181
183
  if (previous === undefined) delete process.env.PMGR_DB_PATH;
182
184
  else process.env.PMGR_DB_PATH = previous;
183
- assert.match(databasePath(), /data\/project-mgr\.sqlite$/);
185
+ assert.equal(
186
+ databasePath(),
187
+ join(homedir(), ".local", "share", "project-mgr", "project-mgr.sqlite"),
188
+ );
189
+ rmSync(directory, { recursive: true, force: true });
190
+ });
191
+
192
+ test("CLI runs through a package-style symlink", () => {
193
+ const directory = mkdtempSync(join(tmpdir(), "pmgr-bin-"));
194
+ const executable = join(directory, "pmgr");
195
+ symlinkSync(
196
+ fileURLToPath(new URL("../src/cli.ts", import.meta.url)),
197
+ executable,
198
+ );
199
+ const result = spawnSync(
200
+ process.execPath,
201
+ ["--import", "tsx", executable, "current", "--json"],
202
+ {
203
+ encoding: "utf8",
204
+ env: { ...process.env, PMGR_DB_PATH: ":memory:" },
205
+ },
206
+ );
207
+ assert.equal(result.status, 0, result.stderr);
208
+ assert.equal(result.stdout, "[]\n");
184
209
  rmSync(directory, { recursive: true, force: true });
185
210
  });
186
211