@almadar/workspace 0.7.0 → 0.9.0

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/dist/index.js CHANGED
@@ -1718,6 +1718,14 @@ var WorkspaceServiceImpl = class {
1718
1718
  setAppId(id) {
1719
1719
  this._appId = id;
1720
1720
  }
1721
+ /**
1722
+ * Set (or clear) the GitHub config after open. Lets a consumer resolve the
1723
+ * link/token lazily — e.g. from a workspace file read post-open — and wire
1724
+ * `commitAndPush`/`pullIfLinked` without knowing it at construction time.
1725
+ */
1726
+ setGitHub(config) {
1727
+ this.github = config;
1728
+ }
1721
1729
  // === Helpers ===
1722
1730
  /** Run `op` under a per-path serial lock. */
1723
1731
  withLock(absPath, op) {
@@ -2032,6 +2040,16 @@ var WorkspaceServiceImpl = class {
2032
2040
  });
2033
2041
  await this.emit({ kind: "file", relPath, content });
2034
2042
  }
2043
+ async removeFile(relPath) {
2044
+ const abs = sandboxedPath(this.workDir, relPath);
2045
+ let removed = false;
2046
+ await this.withLock(abs, async () => {
2047
+ if (!this.backend.exists(abs)) return;
2048
+ await this.backend.unlink(abs);
2049
+ removed = true;
2050
+ });
2051
+ if (removed) await this.emit({ kind: "file-removed", relPath });
2052
+ }
2035
2053
  async listTree(relPath) {
2036
2054
  const base = relPath === void 0 ? this.workDir : sandboxedPath(this.workDir, relPath);
2037
2055
  if (!this.backend.exists(base)) return [];