@riebeckite/node 0.0.35 → 0.0.36

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/README.md CHANGED
@@ -96,6 +96,32 @@ useful for inspection tooling; ordinary applications should use `scan()`.
96
96
  These helpers operate on logical content paths with `/` separators, not
97
97
  absolute filesystem paths.
98
98
 
99
+ ## Content mutations
100
+
101
+ `FileSystemContentMutation` is the write-side adapter. It is separate from
102
+ `ContentSource` and `ContentManager`: create a plan first, inspect its warnings
103
+ and conflicts, then explicitly apply it.
104
+
105
+ ```ts
106
+ import { FileSystemContentMutation } from "@riebeckite/node";
107
+
108
+ const mutation = new FileSystemContentMutation("content");
109
+ const plan = await mutation.plan([
110
+ { kind: "rename", from: "draft.md", to: "notes/published.md" },
111
+ ]);
112
+ if (plan.conflicts.length === 0) await mutation.apply(plan);
113
+ ```
114
+
115
+ Plans contain file fingerprints and are rejected when a file changes before
116
+ apply. The adapter accepts create, update, delete, move, rename, frontmatter,
117
+ batch, and binary asset operations. It writes a journal and original-file
118
+ backups under `.riebeckite/mutations`. Call `recover(journalPath)` after an
119
+ interrupted apply; recovery refuses files changed after the interrupted write.
120
+
121
+ Logical paths reject traversal, Windows reserved names, invalid characters, and
122
+ existing symbolic-link parents. Multi-file applies are staged and journaled but
123
+ are not filesystem-atomic.
124
+
99
125
  ## Package boundary
100
126
 
101
127
  `@riebeckite/core` defines the portable `ContentSource` contract and content
package/README_ja.md CHANGED
@@ -90,6 +90,31 @@ const { entries, exclusions } = await source.scanWithExclusions();
90
90
  これらのヘルパーは絶対ファイルシステムパスではなく、`/` 区切りの論理コンテンツパスを
91
91
  対象にします。
92
92
 
93
+ ## コンテンツ変更
94
+
95
+ `FileSystemContentMutation` は書き込み側のアダプターです。`ContentSource` や
96
+ `ContentManager` とは分離されており、まず Plan を作成して警告・競合を確認し、明示的に
97
+ Apply します。
98
+
99
+ ```ts
100
+ import { FileSystemContentMutation } from "@riebeckite/node";
101
+
102
+ const mutation = new FileSystemContentMutation("content");
103
+ const plan = await mutation.plan([
104
+ { kind: "rename", from: "draft.md", to: "notes/published.md" },
105
+ ]);
106
+ if (plan.conflicts.length === 0) await mutation.apply(plan);
107
+ ```
108
+
109
+ Plan にはファイルの fingerprint が含まれ、Apply 前に変更されていれば拒否されます。
110
+ create、update、delete、move、rename、frontmatter、batch、バイナリアセットを扱えます。
111
+ 中断した Apply に備えて `.riebeckite/mutations` に Journal と元ファイルの Backup を残します。
112
+ `recover(journalPath)` は中断後に変更されたファイルを復旧せず、競合として返します。
113
+
114
+ 論理パスでは traversal、Windows の予約名、不正な文字、既存のシンボリックリンクを
115
+ 経由する親ディレクトリを拒否します。複数ファイルの Apply は staging と Journal を使いますが、
116
+ ファイルシステム全体の原子性は保証しません。
117
+
93
118
  ## パッケージ境界
94
119
 
95
120
  `@riebeckite/core` は移植可能な `ContentSource` 契約とコンテンツパイプラインを
package/dist/index.d.ts CHANGED
@@ -1,2 +1,9 @@
1
+ export type { ContentSourceConfig } from "./src/content_source_factory.js";
2
+ export { createContentSource } from "./src/content_source_factory.js";
3
+ export type { ContentMigrationApplyOptions, ContentMigrationApplyResult, ContentMigrationPlan, ContentMigrationPlanFile, ContentMigrationRecoverOptions, ContentMigrationRecoveryResult, ContentMigrationRollbackOptions, ContentMigrationRollbackOutcome, ContentMigrationStatusEntry, ContentMigrationStatusReport, ContentMigrationVerification, FileSystemContentMigrationOptions, FutureContentSource, } from "./src/file_system_content_migration.js";
4
+ export { createFutureContentSource, FileSystemContentMigration, fingerprintContentFiles, } from "./src/file_system_content_migration.js";
5
+ export type { FileSystemContentMutationOptions } from "./src/file_system_content_mutation.js";
6
+ export { FileSystemContentMutation } from "./src/file_system_content_mutation.js";
1
7
  export type { ContentSourceExclusion, ContentSourceScan, } from "./src/file_system_content_source.js";
2
8
  export { FileSystemContentSource, INTERNAL_CONTENT_IGNORE_PATTERNS, isIgnoredContentPath, matchContentExcludePattern, } from "./src/file_system_content_source.js";
9
+ export { isPathInsideDirectory, toLogicalPath } from "./src/path_helpers.js";