@jacklika/dsh-tool-memory-filesystem 0.1.3-alpha.6 → 0.1.3-alpha.7

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.
Files changed (2) hide show
  1. package/lib/index.js +14 -2
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -700,11 +700,23 @@ export function apply(ctx, config) {
700
700
  else {
701
701
  const { frontmatter, body } = splitFrontmatter(existing ?? '');
702
702
  normalizeNoteTimestamps(frontmatter);
703
+ const timestamp = formatBeijingTime(new Date());
704
+ // Track note lifetime the way memory_capture does: `created` on the
705
+ // first write, `updated` on every append thereafter.
706
+ if (existing === undefined) {
707
+ frontmatter.created ??= timestamp;
708
+ }
709
+ else {
710
+ frontmatter.updated = timestamp;
711
+ }
703
712
  const frontmatterText = Object.keys(frontmatter).length > 0
704
713
  ? `---\n${yaml.dump(frontmatter).trim()}\n---\n\n`
705
714
  : '';
706
- const timestamp = formatBeijingTime(new Date());
707
- finalBody = `${frontmatterText}${body}\n\n## ${timestamp}\n\n${args.content}\n`;
715
+ // Content that opens with its own heading supplies the section
716
+ // header, so a bare `## <time>` above it would duplicate it.
717
+ const header = args.content.trimStart().startsWith('#') ? '' : `## ${timestamp}\n\n`;
718
+ const base = `${frontmatterText}${body}`.replace(/\s+$/, '');
719
+ finalBody = base === '' ? `${header}${args.content}\n` : `${base}\n\n${header}${args.content}\n`;
708
720
  }
709
721
  exec.signal.throwIfAborted();
710
722
  await writeAtomic(absolutePath, finalBody);
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.6",
4
+ "version": "0.1.3-alpha.7",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "4.0.4",
40
- "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.3.0-0",
41
- "@deepseek-ai/dsh-util-values": ">=0.1.7-rc.1 <0.3.0-0"
40
+ "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.3.0-0 || >=0.2.0-rc.1 <0.3.0-0",
41
+ "@deepseek-ai/dsh-util-values": ">=0.1.7-rc.1 <0.3.0-0 || >=0.2.0-rc.1 <0.3.0-0"
42
42
  }
43
43
  }