@cueloop/integration-obsidian 0.1.0-alpha.79 → 0.1.0-alpha.80
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/package.json +3 -3
- package/src/export.test.ts +15 -11
- package/src/export.ts +6 -6
- package/src/frontmatter.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cueloop/integration-obsidian",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.80",
|
|
4
4
|
"description": "Export reviewed cueloop plans into an Obsidian vault",
|
|
5
5
|
"homepage": "https://github.com/mmurakaru/cueloop#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cueloop/extension-api": "0.1.0-alpha.
|
|
28
|
-
"@cueloop/schema": "0.1.0-alpha.
|
|
27
|
+
"@cueloop/extension-api": "0.1.0-alpha.80",
|
|
28
|
+
"@cueloop/schema": "0.1.0-alpha.80",
|
|
29
29
|
"valibot": "^1.4.2"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
package/src/export.test.ts
CHANGED
|
@@ -28,7 +28,13 @@ function resolvedSession(overrides: Partial<Thread> = {}): Thread {
|
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
annotations: [],
|
|
31
|
-
|
|
31
|
+
message: {
|
|
32
|
+
id: "msg_1",
|
|
33
|
+
outcome: "approved",
|
|
34
|
+
summary: "ship it",
|
|
35
|
+
body: "",
|
|
36
|
+
sentAt: NOW.toISOString(),
|
|
37
|
+
},
|
|
32
38
|
status: "resolved",
|
|
33
39
|
createdAt: NOW.toISOString(),
|
|
34
40
|
...overrides,
|
|
@@ -65,7 +71,7 @@ describe("exportSession", () => {
|
|
|
65
71
|
expect(written).toContain("created: 2026-08-07T12:34:56.000Z");
|
|
66
72
|
expect(written).toContain("source: cueloop");
|
|
67
73
|
expect(written).toContain("session: s_test1");
|
|
68
|
-
expect(written).toContain("
|
|
74
|
+
expect(written).toContain("message: approved");
|
|
69
75
|
});
|
|
70
76
|
|
|
71
77
|
test("the working copy wins over the submitted content", () => {
|
|
@@ -168,19 +174,17 @@ describe("obsidian extension", () => {
|
|
|
168
174
|
|
|
169
175
|
describe("shouldExport", () => {
|
|
170
176
|
test("approve exports only approvals", () => {
|
|
171
|
-
expect(shouldExport("
|
|
172
|
-
expect(shouldExport("
|
|
173
|
-
expect(shouldExport("approve", "comment")).toBe(false);
|
|
177
|
+
expect(shouldExport("approved", "approved")).toBe(true);
|
|
178
|
+
expect(shouldExport("approved", "changes_requested")).toBe(false);
|
|
174
179
|
});
|
|
175
180
|
|
|
176
|
-
test("
|
|
177
|
-
expect(shouldExport("
|
|
178
|
-
expect(shouldExport("
|
|
179
|
-
expect(shouldExport("resolve", "comment")).toBe(true);
|
|
181
|
+
test("message exports any outcome", () => {
|
|
182
|
+
expect(shouldExport("message", "approved")).toBe(true);
|
|
183
|
+
expect(shouldExport("message", "changes_requested")).toBe(true);
|
|
180
184
|
});
|
|
181
185
|
|
|
182
186
|
test("manual never auto-exports", () => {
|
|
183
|
-
expect(shouldExport("manual", "
|
|
184
|
-
expect(shouldExport("manual", "
|
|
187
|
+
expect(shouldExport("manual", "approved")).toBe(false);
|
|
188
|
+
expect(shouldExport("manual", "changes_requested")).toBe(false);
|
|
185
189
|
});
|
|
186
190
|
});
|
package/src/export.ts
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import type { Thread,
|
|
9
|
+
import type { Thread, MessageOutcome } from "@cueloop/schema";
|
|
10
10
|
import { detectVaults } from "./detect";
|
|
11
11
|
import { formatFilename, titleFrom, uniquePath, type Separator } from "./filename";
|
|
12
12
|
import { frontmatter } from "./frontmatter";
|
|
13
13
|
|
|
14
|
-
export type ExportOn = "
|
|
14
|
+
export type ExportOn = "approved" | "message" | "manual";
|
|
15
15
|
|
|
16
16
|
export interface ObsidianConfig {
|
|
17
17
|
/** Vault path; when unset, the first auto-detected vault is used. */
|
|
@@ -31,11 +31,11 @@ export const OBSIDIAN_DEFAULTS: ObsidianConfig = {
|
|
|
31
31
|
exportOn: "manual",
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
export function shouldExport(exportOn: ExportOn,
|
|
36
|
-
if (exportOn === "
|
|
34
|
+
/** approved exports only approvals; message exports any Message; manual never auto-exports. */
|
|
35
|
+
export function shouldExport(exportOn: ExportOn, message: MessageOutcome): boolean {
|
|
36
|
+
if (exportOn === "approved") return message === "approved";
|
|
37
37
|
|
|
38
|
-
return exportOn === "
|
|
38
|
+
return exportOn === "message";
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface ExportResult {
|
package/src/frontmatter.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function frontmatter(session: Thread, created: Date): string {
|
|
|
8
8
|
`created: ${created.toISOString()}`,
|
|
9
9
|
"source: cueloop",
|
|
10
10
|
`session: ${session.id}`,
|
|
11
|
-
`
|
|
11
|
+
`message: ${session.message?.outcome ?? "pending"}`,
|
|
12
12
|
"---",
|
|
13
13
|
].join("\n");
|
|
14
14
|
}
|