@jacklika/dsh-tool-memory-filesystem 0.1.3-alpha.2 → 0.1.3-alpha.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/lib/index.js CHANGED
@@ -20,6 +20,31 @@ import yaml from 'js-yaml';
20
20
  export function vaultRelativeId(root, absolutePath) {
21
21
  return relative(root, absolutePath).replace(/\\/g, '/');
22
22
  }
23
+ /**
24
+ * Format a Date as an ISO-like string in Asia/Shanghai (+08:00).
25
+ * The project convention is to store all vault timestamps in Beijing time.
26
+ * Keep this in sync with the helper in `@jacklika/dsh-memory-curator`.
27
+ */
28
+ export function formatBeijingTime(date) {
29
+ const parts = new Intl.DateTimeFormat('sv-SE', {
30
+ timeZone: 'Asia/Shanghai',
31
+ year: 'numeric',
32
+ month: '2-digit',
33
+ day: '2-digit',
34
+ hour: '2-digit',
35
+ minute: '2-digit',
36
+ second: '2-digit',
37
+ hour12: false,
38
+ }).formatToParts(date);
39
+ const get = (type) => parts.find((p) => p.type === type)?.value ?? '00';
40
+ const yyyy = get('year');
41
+ const MM = get('month');
42
+ const dd = get('day');
43
+ const HH = get('hour');
44
+ const mm = get('minute');
45
+ const ss = get('second');
46
+ return `${yyyy}-${MM}-${dd}T${HH}:${mm}:${ss}+08:00`;
47
+ }
23
48
  /** Cordis plugin name used by loader diagnostics. */
24
49
  export const name = 'tool-memory-filesystem';
25
50
  /** Services required by the wiki/memory tool suite. */
@@ -481,7 +506,7 @@ export function apply(ctx, config) {
481
506
  const frontmatterText = Object.keys(frontmatter).length > 0
482
507
  ? `---\n${yaml.dump(frontmatter).trim()}\n---\n\n`
483
508
  : '';
484
- const timestamp = new Date().toISOString();
509
+ const timestamp = formatBeijingTime(new Date());
485
510
  finalBody = `${frontmatterText}${body}\n\n## ${timestamp}\n\n${args.content}\n`;
486
511
  }
487
512
  exec.signal.throwIfAborted();
@@ -17,6 +17,12 @@ export type * from './types.ts';
17
17
  * uses POSIX separators so note ids are stable across Windows, macOS, and Linux.
18
18
  */
19
19
  export declare function vaultRelativeId(root: string, absolutePath: string): string;
20
+ /**
21
+ * Format a Date as an ISO-like string in Asia/Shanghai (+08:00).
22
+ * The project convention is to store all vault timestamps in Beijing time.
23
+ * Keep this in sync with the helper in `@jacklika/dsh-memory-curator`.
24
+ */
25
+ export declare function formatBeijingTime(date: Date): string;
20
26
  /** Cordis plugin name used by loader diagnostics. */
21
27
  export declare const name = "tool-memory-filesystem";
22
28
  /** Services required by the wiki/memory tool suite. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jacklika/dsh-tool-memory-filesystem",
3
3
  "description": "Model-facing wiki/memory tools over a local Markdown vault: read, search, and write notes with Obsidian-style links and YAML frontmatter.",
4
- "version": "0.1.3-alpha.2",
4
+ "version": "0.1.3-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },