planmode 0.1.2 → 0.1.4
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/dist/index.js +17 -7
- package/package.json +1 -1
- package/src/commands/publish.ts +6 -6
- package/src/index.ts +1 -1
- package/src/lib/analytics.ts +12 -0
- package/src/lib/installer.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -616,6 +616,15 @@ var logger = {
|
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
618
|
|
|
619
|
+
// src/lib/analytics.ts
|
|
620
|
+
var API_BASE = "https://api.planmode.org";
|
|
621
|
+
function trackDownload(packageName) {
|
|
622
|
+
fetch(`${API_BASE}/downloads/${encodeURIComponent(packageName)}`, {
|
|
623
|
+
method: "POST"
|
|
624
|
+
}).catch(() => {
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
|
|
619
628
|
// src/lib/installer.ts
|
|
620
629
|
function getInstallDir(type) {
|
|
621
630
|
switch (type) {
|
|
@@ -689,6 +698,7 @@ async function installPackage(packageName, options = {}) {
|
|
|
689
698
|
fs7.mkdirSync(path7.dirname(fullPath), { recursive: true });
|
|
690
699
|
fs7.writeFileSync(fullPath, content, "utf-8");
|
|
691
700
|
logger.success(`Installed ${packageName}@${version} \u2192 ${installPath}`);
|
|
701
|
+
trackDownload(packageName);
|
|
692
702
|
if (type === "plan") {
|
|
693
703
|
addImport(packageName, projectDir);
|
|
694
704
|
logger.dim(`Added @import to CLAUDE.md`);
|
|
@@ -939,7 +949,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
939
949
|
"User-Agent": "planmode-cli",
|
|
940
950
|
"Content-Type": "application/json"
|
|
941
951
|
};
|
|
942
|
-
await fetch("https://api.github.com/repos/planmode/
|
|
952
|
+
await fetch("https://api.github.com/repos/kaihannonen/planmode.org/forks", {
|
|
943
953
|
method: "POST",
|
|
944
954
|
headers
|
|
945
955
|
});
|
|
@@ -984,7 +994,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
984
994
|
);
|
|
985
995
|
const branchName = `add-${manifest.name}-${manifest.version}`;
|
|
986
996
|
const refRes = await fetch(
|
|
987
|
-
`https://api.github.com/repos/${user.login}/
|
|
997
|
+
`https://api.github.com/repos/${user.login}/planmode.org/git/ref/heads/main`,
|
|
988
998
|
{ headers }
|
|
989
999
|
);
|
|
990
1000
|
if (!refRes.ok) {
|
|
@@ -993,7 +1003,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
993
1003
|
}
|
|
994
1004
|
const refData = await refRes.json();
|
|
995
1005
|
const baseSha = refData.object.sha;
|
|
996
|
-
await fetch(`https://api.github.com/repos/${user.login}/
|
|
1006
|
+
await fetch(`https://api.github.com/repos/${user.login}/planmode.org/git/refs`, {
|
|
997
1007
|
method: "POST",
|
|
998
1008
|
headers,
|
|
999
1009
|
body: JSON.stringify({
|
|
@@ -1002,7 +1012,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
1002
1012
|
})
|
|
1003
1013
|
});
|
|
1004
1014
|
await fetch(
|
|
1005
|
-
`https://api.github.com/repos/${user.login}/
|
|
1015
|
+
`https://api.github.com/repos/${user.login}/planmode.org/contents/registry/packages/${manifest.name}/metadata.json`,
|
|
1006
1016
|
{
|
|
1007
1017
|
method: "PUT",
|
|
1008
1018
|
headers,
|
|
@@ -1014,7 +1024,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
1014
1024
|
}
|
|
1015
1025
|
);
|
|
1016
1026
|
await fetch(
|
|
1017
|
-
`https://api.github.com/repos/${user.login}/
|
|
1027
|
+
`https://api.github.com/repos/${user.login}/planmode.org/contents/registry/packages/${manifest.name}/versions/${manifest.version}.json`,
|
|
1018
1028
|
{
|
|
1019
1029
|
method: "PUT",
|
|
1020
1030
|
headers,
|
|
@@ -1025,7 +1035,7 @@ var publishCommand = new Command5("publish").description("Publish the current di
|
|
|
1025
1035
|
})
|
|
1026
1036
|
}
|
|
1027
1037
|
);
|
|
1028
|
-
const prRes = await fetch("https://api.github.com/repos/planmode/
|
|
1038
|
+
const prRes = await fetch("https://api.github.com/repos/kaihannonen/planmode.org/pulls", {
|
|
1029
1039
|
method: "POST",
|
|
1030
1040
|
headers,
|
|
1031
1041
|
body: JSON.stringify({
|
|
@@ -1294,7 +1304,7 @@ var loginCommand = new Command10("login").description("Configure GitHub authenti
|
|
|
1294
1304
|
|
|
1295
1305
|
// src/index.ts
|
|
1296
1306
|
var program = new Command11();
|
|
1297
|
-
program.name("planmode").description("The open source package manager for AI plans, rules, and prompts.").version("0.1.
|
|
1307
|
+
program.name("planmode").description("The open source package manager for AI plans, rules, and prompts.").version("0.1.4");
|
|
1298
1308
|
program.addCommand(installCommand);
|
|
1299
1309
|
program.addCommand(uninstallCommand);
|
|
1300
1310
|
program.addCommand(searchCommand);
|
package/package.json
CHANGED
package/src/commands/publish.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const publishCommand = new Command("publish")
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
// Fork the registry repo (idempotent)
|
|
68
|
-
await fetch("https://api.github.com/repos/planmode/
|
|
68
|
+
await fetch("https://api.github.com/repos/kaihannonen/planmode.org/forks", {
|
|
69
69
|
method: "POST",
|
|
70
70
|
headers,
|
|
71
71
|
});
|
|
@@ -123,7 +123,7 @@ export const publishCommand = new Command("publish")
|
|
|
123
123
|
|
|
124
124
|
// Get main branch ref
|
|
125
125
|
const refRes = await fetch(
|
|
126
|
-
`https://api.github.com/repos/${user.login}/
|
|
126
|
+
`https://api.github.com/repos/${user.login}/planmode.org/git/ref/heads/main`,
|
|
127
127
|
{ headers },
|
|
128
128
|
);
|
|
129
129
|
|
|
@@ -136,7 +136,7 @@ export const publishCommand = new Command("publish")
|
|
|
136
136
|
const baseSha = refData.object.sha;
|
|
137
137
|
|
|
138
138
|
// Create branch
|
|
139
|
-
await fetch(`https://api.github.com/repos/${user.login}/
|
|
139
|
+
await fetch(`https://api.github.com/repos/${user.login}/planmode.org/git/refs`, {
|
|
140
140
|
method: "POST",
|
|
141
141
|
headers,
|
|
142
142
|
body: JSON.stringify({
|
|
@@ -147,7 +147,7 @@ export const publishCommand = new Command("publish")
|
|
|
147
147
|
|
|
148
148
|
// Create metadata.json
|
|
149
149
|
await fetch(
|
|
150
|
-
`https://api.github.com/repos/${user.login}/
|
|
150
|
+
`https://api.github.com/repos/${user.login}/planmode.org/contents/registry/packages/${manifest.name}/metadata.json`,
|
|
151
151
|
{
|
|
152
152
|
method: "PUT",
|
|
153
153
|
headers,
|
|
@@ -161,7 +161,7 @@ export const publishCommand = new Command("publish")
|
|
|
161
161
|
|
|
162
162
|
// Create version file
|
|
163
163
|
await fetch(
|
|
164
|
-
`https://api.github.com/repos/${user.login}/
|
|
164
|
+
`https://api.github.com/repos/${user.login}/planmode.org/contents/registry/packages/${manifest.name}/versions/${manifest.version}.json`,
|
|
165
165
|
{
|
|
166
166
|
method: "PUT",
|
|
167
167
|
headers,
|
|
@@ -174,7 +174,7 @@ export const publishCommand = new Command("publish")
|
|
|
174
174
|
);
|
|
175
175
|
|
|
176
176
|
// Create PR
|
|
177
|
-
const prRes = await fetch("https://api.github.com/repos/planmode/
|
|
177
|
+
const prRes = await fetch("https://api.github.com/repos/kaihannonen/planmode.org/pulls", {
|
|
178
178
|
method: "POST",
|
|
179
179
|
headers,
|
|
180
180
|
body: JSON.stringify({
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ const program = new Command();
|
|
|
15
15
|
program
|
|
16
16
|
.name("planmode")
|
|
17
17
|
.description("The open source package manager for AI plans, rules, and prompts.")
|
|
18
|
-
.version("0.1.
|
|
18
|
+
.version("0.1.4");
|
|
19
19
|
|
|
20
20
|
program.addCommand(installCommand);
|
|
21
21
|
program.addCommand(uninstallCommand);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const API_BASE = "https://api.planmode.org";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fire-and-forget download tracking. Never throws, never blocks.
|
|
5
|
+
*/
|
|
6
|
+
export function trackDownload(packageName: string): void {
|
|
7
|
+
fetch(`${API_BASE}/downloads/${encodeURIComponent(packageName)}`, {
|
|
8
|
+
method: "POST",
|
|
9
|
+
}).catch(() => {
|
|
10
|
+
// Silently ignore — analytics should never affect the install flow
|
|
11
|
+
});
|
|
12
|
+
}
|
package/src/lib/installer.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { addImport, removeImport } from "./claude-md.js";
|
|
|
10
10
|
import { parseManifest, readPackageContent } from "./manifest.js";
|
|
11
11
|
import { renderTemplate, collectVariableValues } from "./template.js";
|
|
12
12
|
import { logger } from "./logger.js";
|
|
13
|
+
import { trackDownload } from "./analytics.js";
|
|
13
14
|
|
|
14
15
|
function getInstallDir(type: PackageType): string {
|
|
15
16
|
switch (type) {
|
|
@@ -116,6 +117,7 @@ export async function installPackage(
|
|
|
116
117
|
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
117
118
|
fs.writeFileSync(fullPath, content, "utf-8");
|
|
118
119
|
logger.success(`Installed ${packageName}@${version} → ${installPath}`);
|
|
120
|
+
trackDownload(packageName);
|
|
119
121
|
|
|
120
122
|
// Update CLAUDE.md for plans
|
|
121
123
|
if (type === "plan") {
|