comfy-pr 0.2.17 → 0.2.18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.2.18](https://github.com/drip-art/Comfy-Registry-PR/compare/v0.2.17...v0.2.18) (2024-06-27)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **follow-rules:** add matcher fields into follow-rule ([4d7bbe7](https://github.com/drip-art/Comfy-Registry-PR/commit/4d7bbe7b941242cbb8edcd73ead6df61d26824df))
10
+ - **is-already-sent-totals-today:** notify if today is not already noti ([33cec0a](https://github.com/drip-art/Comfy-Registry-PR/commit/33cec0adde44612ca66213ce989d0d25f7549aec))
11
+ - **main:** env file tips ([02636f3](https://github.com/drip-art/Comfy-Registry-PR/commit/02636f3beb2efddcb2de69b3dece02816f542b49))
12
+ - **main:** update follow up rule matcher ([57302c3](https://github.com/drip-art/Comfy-Registry-PR/commit/57302c30a119f3275c4626d4f09123f6ac2d7aed))
13
+ - **toml-template-v3:** update template ts file ([24df794](https://github.com/drip-art/Comfy-Registry-PR/commit/24df794851cc6b7190bc0fb3c75ef02a76fed926))
14
+
5
15
  ### [0.2.17](https://github.com/drip-art/Comfy-Registry-PR/compare/v0.2.8...v0.2.17) (2024-06-24)
6
16
 
7
17
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comfy-pr",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Make PRs that publishes ComfyUI Custom Nodes to [ComfyUI Registry]( https://www.comfyregistry.org/ ).",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -13,12 +13,15 @@ import type { zPullStatus } from "./zod/zPullsStatus";
13
13
  export const DashboardDetails = db.collection<any>("DashboardDetails");
14
14
  if (import.meta.main) {
15
15
  const r = peekYaml(await analyzePullsStatus());
16
+
16
17
  // await mkdir(".cache").catch(() => null);
17
18
  // await writeFile(".cache/dump.yaml", YAML.stringify(r));
18
19
  // await writeFile(".cache/dump.csv", csvFormat(r));
19
20
  // console.log("done");
20
21
  // generate zod schema
21
22
  // await writeFile("src/zPullsStatus.ts", jsonToZod(await analyzePullsStatus({ limit: 1 }), "zPullsStatus", true));
23
+
24
+ // analyzePullsStatusPipeline
22
25
  }
23
26
 
24
27
  export type PullStatus = z.infer<typeof zPullStatus>;
@@ -75,6 +78,7 @@ export function analyzePullsStatusPipeline() {
75
78
  ownername: "$base.user.login",
76
79
  head: { $concat: ["$user.login", ":", "$type"] },
77
80
  comments: { $size: "$comments" },
81
+ comments_authors: "$comments.user.login",
78
82
  lastwords: { $arrayElemAt: ["$comments", -1] },
79
83
  latest_comment_at: { $toDate: "$latest_comment_at" },
80
84
  actived_at: 1,
@@ -94,19 +98,20 @@ export function analyzePullsStatusPipeline() {
94
98
  .sort({ OPEN: -1, MERGED: -1, CLOSED: -1, updated_at: 1 })
95
99
  .unset(["CLOSED", "MERGED", "OPEN"])
96
100
  .as<{
97
- updated_at: Date;
98
- created_at: Date;
99
101
  actived_at: Date;
100
- repository: string;
101
102
  author_email: string;
102
- ownername: string;
103
- on_registry: boolean;
103
+ comments: number;
104
+ created_at: Date;
105
+ head: string;
106
+ lastwords: string;
104
107
  on_registry_at: Date;
108
+ on_registry: boolean;
109
+ comments_authors: string;
110
+ ownername: string;
111
+ repository: string;
105
112
  state: "OPEN" | "MERGED" | "CLOSED";
113
+ updated_at: Date;
106
114
  url: string;
107
- head: string;
108
- comments: number;
109
- lastwords: string;
110
115
  }>()
111
116
  // .stage({ ...(!!skip && { $skip: skip }) })
112
117
  // .stage({ ...(!!limit && { $limit: limit }) })
@@ -34,12 +34,17 @@ const zFollowUpRule = z.object({
34
34
  name: z.string(),
35
35
  $match: z
36
36
  .object({
37
- state: z.enum(["OPEN", "CLOSED", "MERGED"]),
37
+ actived_at: mDate,
38
+ author_email: mString,
39
+ comments: mNumber,
40
+ created_at: mDate,
41
+ head: mString,
42
+ lastwords: mString,
38
43
  on_registry: z.boolean(),
44
+ ownername: mString,
45
+ state: z.enum(["OPEN", "CLOSED", "MERGED"]),
39
46
  updated_at: mDate,
40
- lastwords: mString,
41
- head: mString,
42
- comments: mNumber,
47
+ url: mString,
43
48
  })
44
49
  .strict()
45
50
  .partial(),
@@ -11,6 +11,7 @@ if (import.meta.main) {
11
11
  }
12
12
 
13
13
  export async function updateComfyTotals({ notify = true, fresh = "30m" } = {}) {
14
+ await Totals.createIndex({today: 1, "totals.mtime": 1, "totals.state": 1})
14
15
  const today = new Date().toISOString().split("T")[0];
15
16
  const cached = await Totals.findOne($filaten({ today, totals: { mtime: $fresh(fresh), ...$OK } }));
16
17
  if (cached?.totals?.state === "ok")
@@ -21,8 +22,9 @@ export async function updateComfyTotals({ notify = true, fresh = "30m" } = {}) {
21
22
  ].flatMap((e) => (e ? [e] : []));
22
23
  const totals = await analyzeTotals().then(TaskOK).catch(TaskError);
23
24
 
24
- // notify
25
+ // notify if today is not already notify
25
26
  if (notify) {
27
+ if(!await Totals.findOne($filaten({ today, totals: { mtime: $fresh('0.9d'), ...$OK } })))
26
28
  // ignore today
27
29
  await match(totals)
28
30
  .with($OK, async (totals) => {
@@ -20,9 +20,28 @@ export async function updateOutdatedPullsTemplates() {
20
20
  const pyproject = await readTemplate("add-toml.md");
21
21
  const publishcr = await readTemplate("add-action.md");
22
22
  const outdated_pyproject = await readTemplate("outdated/add-toml.md");
23
- const outdated_pyproject_v2 = await readTemplate("outdated/add-toml-v2.md");
24
23
  const outdated_publishcr = await readTemplate("outdated/add-action.md");
24
+ const outdated_pyproject_v2 = await readTemplate("outdated/add-toml-v2.md");
25
25
  const outdated_publishcr_v2 = await readTemplate("outdated/add-action-v2.md");
26
+ const outdated_pyproject_v3 = await readTemplate("outdated/add-toml-v3.md");
27
+ const outdated_publishcr_v3 = await readTemplate("outdated/add-action-v3.md");
28
+ const outdateTitles = [
29
+ outdated_pyproject.title,
30
+ outdated_publishcr.title,
31
+ outdated_pyproject_v2.title,
32
+ outdated_publishcr_v2.title,
33
+ outdated_pyproject_v3.title,
34
+ outdated_publishcr_v3.title,
35
+ ];
36
+ const outdateBodies = [
37
+ outdated_pyproject.body,
38
+ outdated_publishcr.body,
39
+ outdated_pyproject_v2.body,
40
+ outdated_publishcr_v2.body,
41
+ outdated_pyproject_v3.body,
42
+ outdated_publishcr_v3.body,
43
+ ];
44
+
26
45
  // const templateOutdate = new Date("2024-06-13T09:02:56.630Z");
27
46
 
28
47
  await CNRepos.createIndex({
@@ -47,22 +66,8 @@ export async function updateOutdatedPullsTemplates() {
47
66
  },
48
67
  pull: {
49
68
  user: { login: ghUser.login },
50
- title: {
51
- $in: [
52
- outdated_pyproject.title,
53
- outdated_pyproject_v2.title,
54
- outdated_publishcr.title,
55
- outdated_publishcr_v2.title,
56
- ],
57
- },
58
- body: {
59
- $in: [
60
- outdated_pyproject.body,
61
- outdated_pyproject_v2.body,
62
- outdated_publishcr.body,
63
- outdated_publishcr_v2.body,
64
- ],
65
- },
69
+ title: { $in: outdateTitles },
70
+ body: { $in: outdateBodies },
66
71
  },
67
72
  }),
68
73
  },
@@ -99,12 +104,14 @@ export async function updateOutdatedPullsTemplates() {
99
104
  const { number } = pull;
100
105
  if (pull.user.login !== ghUser.login) DIE("not editable");
101
106
  const replacement = match(pull)
102
- .with(pyproject, () => DIE("is already latest template"))
103
- .with(publishcr, () => DIE("is already latest template"))
107
+ .with(pyproject, () => DIE("Is already latest, should never happen here"))
108
+ .with(publishcr, () => DIE("Is already latest, should never happen here"))
104
109
  .with(outdated_pyproject, () => pyproject)
105
110
  .with(outdated_pyproject_v2, () => pyproject)
111
+ .with(outdated_pyproject_v3, () => pyproject)
106
112
  .with(outdated_publishcr, () => publishcr)
107
113
  .with(outdated_publishcr_v2, () => publishcr)
114
+ .with(outdated_publishcr_v3, () => publishcr)
108
115
  // in case author clicked some task as completed, body will be different, may cause template mismatch
109
116
  .otherwise(() => DIE("Template not found: " + pull.title));
110
117
  if (!replacement) return { ...data, edited: TaskError("Template mismatch") };