@nozomiishii/pm 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +0 -40
- package/README.md +0 -40
- package/dist/cli.js +11 -80
- package/package.json +4 -4
package/README.ja.md
CHANGED
|
@@ -68,9 +68,6 @@ Commands:
|
|
|
68
68
|
ls List project names
|
|
69
69
|
logo Display the pm logo
|
|
70
70
|
uninstall Uninstall pm from your system
|
|
71
|
-
create-workspace Generate a .code-workspace file
|
|
72
|
-
--name <name> Workspace name (outputs <name>.code-workspace)
|
|
73
|
-
--tag <name> Include only projects with this tag (repeatable)
|
|
74
71
|
|
|
75
72
|
Options:
|
|
76
73
|
--config <path> Path to projects.json (or PM_CONFIG)
|
|
@@ -116,43 +113,6 @@ pm ls
|
|
|
116
113
|
|
|
117
114
|

|
|
118
115
|
|
|
119
|
-
### pm create-workspace
|
|
120
|
-
|
|
121
|
-
`--tag` で指定したタグのプロジェクトを `.code-workspace` ファイルにまとめます。
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
pm create-workspace --name <name> --tag <tag>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
たとえば `projects.json` に以下のプロジェクトがある場合:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
[
|
|
131
|
-
{ "name": "dotfiles", "rootPath": "~/Code/nozomiishii/dotfiles", "tags": ["personal"] },
|
|
132
|
-
{ "name": "portfolio", "rootPath": "~/Code/nozomiishii/portfolio", "tags": ["personal"] },
|
|
133
|
-
{ "name": "fzf", "rootPath": "~/Code/junegunn/fzf", "tags": ["oss"] }
|
|
134
|
-
]
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
次のコマンドを実行することで
|
|
138
|
-
|
|
139
|
-
```sh
|
|
140
|
-
pm create-workspace --name my-workspace --tag personal
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
`my-workspace.code-workspace` が生成されます:
|
|
144
|
-
|
|
145
|
-
```json
|
|
146
|
-
{
|
|
147
|
-
"folders": [
|
|
148
|
-
{ "name": "dotfiles", "path": "../nozomiishii/dotfiles" },
|
|
149
|
-
{ "name": "portfolio", "path": "../nozomiishii/portfolio" }
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
`--tag` は複数指定でき、すべてのタグを持つプロジェクトだけが含まれます。
|
|
155
|
-
|
|
156
116
|
## Configuration
|
|
157
117
|
|
|
158
118
|
インストーラーが `.zshrc` を自動で設定しますが、手動でセットアップする場合は以下を追加してください。
|
package/README.md
CHANGED
|
@@ -68,9 +68,6 @@ Commands:
|
|
|
68
68
|
ls List project names
|
|
69
69
|
logo Display the pm logo
|
|
70
70
|
uninstall Uninstall pm from your system
|
|
71
|
-
create-workspace Generate a .code-workspace file
|
|
72
|
-
--name <name> Workspace name (outputs <name>.code-workspace)
|
|
73
|
-
--tag <name> Include only projects with this tag (repeatable)
|
|
74
71
|
|
|
75
72
|
Options:
|
|
76
73
|
--config <path> Path to projects.json (or PM_CONFIG)
|
|
@@ -116,43 +113,6 @@ pm ls
|
|
|
116
113
|
|
|
117
114
|

|
|
118
115
|
|
|
119
|
-
### pm create-workspace
|
|
120
|
-
|
|
121
|
-
Bundles projects matching a `--tag` into a `.code-workspace` file.
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
pm create-workspace --name <name> --tag <tag>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
For example, given the following `projects.json`:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
[
|
|
131
|
-
{ "name": "dotfiles", "rootPath": "~/Code/nozomiishii/dotfiles", "tags": ["personal"] },
|
|
132
|
-
{ "name": "portfolio", "rootPath": "~/Code/nozomiishii/portfolio", "tags": ["personal"] },
|
|
133
|
-
{ "name": "fzf", "rootPath": "~/Code/junegunn/fzf", "tags": ["oss"] }
|
|
134
|
-
]
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Running the following command:
|
|
138
|
-
|
|
139
|
-
```sh
|
|
140
|
-
pm create-workspace --name my-workspace --tag personal
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Generates `my-workspace.code-workspace`:
|
|
144
|
-
|
|
145
|
-
```json
|
|
146
|
-
{
|
|
147
|
-
"folders": [
|
|
148
|
-
{ "name": "dotfiles", "path": "../nozomiishii/dotfiles" },
|
|
149
|
-
{ "name": "portfolio", "path": "../nozomiishii/portfolio" }
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
`--tag` can be specified multiple times — only projects matching all tags are included.
|
|
155
|
-
|
|
156
116
|
## Configuration
|
|
157
117
|
|
|
158
118
|
The installer configures `.zshrc` automatically. For manual setup, add the following:
|
package/dist/cli.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
|
-
import { readFile
|
|
6
|
-
import
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import path2 from "node:path";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
|
|
9
9
|
// src/filter-projects.ts
|
|
@@ -53,37 +53,6 @@ function findProject(projects, query) {
|
|
|
53
53
|
return matches[0];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// src/create-workspace/build-folders.ts
|
|
57
|
-
import path2 from "node:path";
|
|
58
|
-
function buildFolders(projects, opts) {
|
|
59
|
-
const filtered = filterProjects(projects, opts.tags);
|
|
60
|
-
const folders = [];
|
|
61
|
-
for (const p of filtered) {
|
|
62
|
-
const absolute = path2.resolve(expandHome(p.rootPath));
|
|
63
|
-
let rel = path2.relative(opts.workspaceDir, absolute);
|
|
64
|
-
if (!rel || rel === "") {
|
|
65
|
-
rel = ".";
|
|
66
|
-
}
|
|
67
|
-
const relPosix = rel.split(path2.sep).join("/");
|
|
68
|
-
const name = stripEmojiLabel(p.name) || path2.basename(absolute);
|
|
69
|
-
folders.push({ name, path: relPosix });
|
|
70
|
-
}
|
|
71
|
-
return folders;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// src/create-workspace/load-existing-workspace.ts
|
|
75
|
-
import { readFile } from "node:fs/promises";
|
|
76
|
-
async function loadExistingWorkspace(workspacePath) {
|
|
77
|
-
try {
|
|
78
|
-
const raw = await readFile(workspacePath, "utf8");
|
|
79
|
-
const parsed = JSON.parse(raw);
|
|
80
|
-
const { folders: _f, ...rest } = parsed;
|
|
81
|
-
return rest;
|
|
82
|
-
} catch {
|
|
83
|
-
return {};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
56
|
// src/logo/logo-color.ascii
|
|
88
57
|
var logo_color_default = `\x1B[38;2;120;180;255m zzzzzzzzzzzzzzzzzzzzzzzzzz\x1B[0m
|
|
89
58
|
\x1B[38;2;100;160;245m zzzzzzzzzzzzzzzzzzzzzzzzzz\x1B[0m
|
|
@@ -99,7 +68,7 @@ var logo_color_default = `\x1B[38;2;120;180;255m zzzzzzzzzzzzzzzzzzzzzzzzzz\x1B[
|
|
|
99
68
|
// package.json
|
|
100
69
|
var package_default = {
|
|
101
70
|
name: "@nozomiishii/pm",
|
|
102
|
-
version: "0.
|
|
71
|
+
version: "0.2.0",
|
|
103
72
|
description: "Project manager CLI — jump to projects via fzf",
|
|
104
73
|
type: "module",
|
|
105
74
|
homepage: "https://github.com/nozomiishii/pm#readme",
|
|
@@ -133,8 +102,8 @@ var package_default = {
|
|
|
133
102
|
test: "vitest run"
|
|
134
103
|
},
|
|
135
104
|
devDependencies: {
|
|
136
|
-
"@types/node": "
|
|
137
|
-
vitest: "4.1.
|
|
105
|
+
"@types/node": "25.6.0",
|
|
106
|
+
vitest: "4.1.5"
|
|
138
107
|
},
|
|
139
108
|
publishConfig: {
|
|
140
109
|
access: "public",
|
|
@@ -142,7 +111,7 @@ var package_default = {
|
|
|
142
111
|
},
|
|
143
112
|
packageManager: "bun@1.3.11",
|
|
144
113
|
engines: {
|
|
145
|
-
node: "24.
|
|
114
|
+
node: "24.15.0"
|
|
146
115
|
}
|
|
147
116
|
};
|
|
148
117
|
|
|
@@ -151,11 +120,11 @@ function defaultConfigPath() {
|
|
|
151
120
|
const home = process.env.HOME ?? "";
|
|
152
121
|
switch (process.platform) {
|
|
153
122
|
case "darwin":
|
|
154
|
-
return
|
|
123
|
+
return path2.join(home, "Library/Application Support/Code/User/globalStorage/alefragnani.project-manager/projects.json");
|
|
155
124
|
case "win32":
|
|
156
|
-
return
|
|
125
|
+
return path2.join(process.env.APPDATA ?? "", "Code/User/globalStorage/alefragnani.project-manager/projects.json");
|
|
157
126
|
default:
|
|
158
|
-
return
|
|
127
|
+
return path2.join(home, ".config/Code/User/globalStorage/alefragnani.project-manager/projects.json");
|
|
159
128
|
}
|
|
160
129
|
}
|
|
161
130
|
function usage() {
|
|
@@ -166,9 +135,6 @@ Commands:
|
|
|
166
135
|
ls List project names
|
|
167
136
|
logo Display the pm logo
|
|
168
137
|
uninstall Uninstall pm from your system
|
|
169
|
-
create-workspace Generate a .code-workspace file
|
|
170
|
-
--name <name> Workspace name (outputs <name>.code-workspace)
|
|
171
|
-
--tag <name> Include only projects with this tag (repeatable)
|
|
172
138
|
|
|
173
139
|
Options:
|
|
174
140
|
--config <path> Path to projects.json (or PM_CONFIG)
|
|
@@ -180,7 +146,7 @@ Running \`pm\` without a command opens the fzf picker.`);
|
|
|
180
146
|
function printLogo() {
|
|
181
147
|
console.log(logo_color_default);
|
|
182
148
|
}
|
|
183
|
-
var SUBCOMMANDS = new Set(["cd", "ls", "
|
|
149
|
+
var SUBCOMMANDS = new Set(["cd", "ls", "logo", "uninstall"]);
|
|
184
150
|
function parseArgs(argv) {
|
|
185
151
|
let config = process.env.PM_CONFIG ?? defaultConfigPath();
|
|
186
152
|
let help = false;
|
|
@@ -203,19 +169,6 @@ function parseArgs(argv) {
|
|
|
203
169
|
}
|
|
204
170
|
return { config, help, version, subcommand, rest };
|
|
205
171
|
}
|
|
206
|
-
function parseCreateWorkspaceArgs(rest) {
|
|
207
|
-
let workspaceName = "";
|
|
208
|
-
const tags = [];
|
|
209
|
-
for (let i = 0;i < rest.length; i++) {
|
|
210
|
-
const arg = rest[i];
|
|
211
|
-
if (arg === "--name") {
|
|
212
|
-
workspaceName = rest[++i] ?? "";
|
|
213
|
-
} else if (arg === "--tag") {
|
|
214
|
-
tags.push(rest[++i] ?? "");
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return { workspaceName, tags };
|
|
218
|
-
}
|
|
219
172
|
function plainLabel(name) {
|
|
220
173
|
return stripEmojiLabel(name) || name;
|
|
221
174
|
}
|
|
@@ -252,23 +205,6 @@ function fzfSelect(projects) {
|
|
|
252
205
|
});
|
|
253
206
|
});
|
|
254
207
|
}
|
|
255
|
-
function resolveCliPath(p) {
|
|
256
|
-
return path3.isAbsolute(p) ? path3.normalize(p) : path3.resolve(process.cwd(), p);
|
|
257
|
-
}
|
|
258
|
-
async function createWorkspace(projects, args) {
|
|
259
|
-
if (!args.workspaceName) {
|
|
260
|
-
console.error("Error: --name is required with create-workspace.");
|
|
261
|
-
process.exit(1);
|
|
262
|
-
}
|
|
263
|
-
const workspacePath = resolveCliPath(`${args.workspaceName}.code-workspace`);
|
|
264
|
-
const workspaceDir = path3.dirname(path3.resolve(workspacePath));
|
|
265
|
-
const folders = buildFolders(projects, { tags: args.tags, workspaceDir });
|
|
266
|
-
const preserved = await loadExistingWorkspace(workspacePath);
|
|
267
|
-
const out = { ...preserved, folders };
|
|
268
|
-
await writeFile(workspacePath, JSON.stringify(out, null, 2) + `
|
|
269
|
-
`, "utf8");
|
|
270
|
-
console.log(`Wrote ${workspacePath} (${folders.length} folders)`);
|
|
271
|
-
}
|
|
272
208
|
async function jumpToProject(projects, name) {
|
|
273
209
|
let target;
|
|
274
210
|
if (name) {
|
|
@@ -317,14 +253,9 @@ async function main() {
|
|
|
317
253
|
console.error(`File not found: ${filePath}`);
|
|
318
254
|
process.exit(1);
|
|
319
255
|
}
|
|
320
|
-
const raw = await
|
|
256
|
+
const raw = await readFile(filePath, "utf-8");
|
|
321
257
|
const allProjects = JSON.parse(raw);
|
|
322
258
|
switch (args.subcommand) {
|
|
323
|
-
case "create-workspace": {
|
|
324
|
-
const cwArgs = parseCreateWorkspaceArgs(args.rest);
|
|
325
|
-
await createWorkspace(allProjects, cwArgs);
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
259
|
case "ls": {
|
|
329
260
|
const projects = filterProjects(allProjects, []);
|
|
330
261
|
for (const p of projects) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nozomiishii/pm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Project manager CLI — jump to projects via fzf",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/nozomiishii/pm#readme",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"test": "vitest run"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/node": "
|
|
38
|
-
"vitest": "4.1.
|
|
37
|
+
"@types/node": "25.6.0",
|
|
38
|
+
"vitest": "4.1.5"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public",
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
},
|
|
44
44
|
"packageManager": "bun@1.3.11",
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": "24.
|
|
46
|
+
"node": "24.15.0"
|
|
47
47
|
}
|
|
48
48
|
}
|