sfora-cli 0.7.0 → 0.8.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/README.md +26 -0
- package/dist/SforaFs.d.ts +3 -0
- package/dist/SforaFs.js +231 -7
- package/dist/api-client.d.ts +58 -0
- package/dist/api-client.js +42 -3
- package/dist/cli.js +241 -22
- package/dist/config.d.ts +18 -0
- package/dist/config.js +97 -5
- package/dist/config.test.d.ts +1 -0
- package/dist/config.test.js +94 -0
- package/dist/format/cardMarkdown.d.ts +36 -0
- package/dist/format/cardMarkdown.js +83 -0
- package/dist/format/index.d.ts +13 -0
- package/dist/format/index.js +13 -0
- package/dist/format/markdown/dates.d.ts +3 -0
- package/dist/format/markdown/dates.js +26 -0
- package/dist/format/markdown/document.d.ts +7 -0
- package/dist/format/markdown/document.js +45 -0
- package/dist/format/markdown/index.d.ts +5 -0
- package/dist/format/markdown/index.js +9 -0
- package/dist/format/markdown/mentions.d.ts +8 -0
- package/dist/format/markdown/mentions.js +36 -0
- package/dist/format/markdown/slug.d.ts +2 -0
- package/dist/format/markdown/slug.js +19 -0
- package/dist/format/markdown/yaml.d.ts +4 -0
- package/dist/format/markdown/yaml.js +72 -0
- package/dist/format/noteMarkdown.d.ts +28 -0
- package/dist/format/noteMarkdown.js +66 -0
- package/dist/format/postMarkdown.d.ts +32 -0
- package/dist/format/postMarkdown.js +53 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +15 -1
- package/dist/local/workspace.d.ts +68 -0
- package/dist/local/workspace.js +250 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.js +19 -8
- package/package.json +2 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalWorkspace — the OSS local mode. A `.sfora/` directory in your repo is
|
|
3
|
+
* the workspace: tasks, posts, and docs are plain markdown files on disk, in
|
|
4
|
+
* exactly the same format the cloud serves over /v1/fs (shared `../format`
|
|
5
|
+
* core), so `cp` is a migration.
|
|
6
|
+
*
|
|
7
|
+
* .sfora/
|
|
8
|
+
* board/01-todo/0001-fix-login.md tasks — NNNN-<slug>.md per column dir
|
|
9
|
+
* posts/2026-07-02-standup.md posts — YYYY-MM-DD-<slug>.md
|
|
10
|
+
* docs/architecture.md docs — <slug>.md
|
|
11
|
+
*
|
|
12
|
+
* This module owns the *semantics* (scaffolding, card numbering, canonical
|
|
13
|
+
* filenames, listings). The interactive shell needs no virtualization locally —
|
|
14
|
+
* just-bash's ReadWriteFs jails a real directory, and real `mv` between column
|
|
15
|
+
* dirs IS a card move.
|
|
16
|
+
*/
|
|
17
|
+
/** Directory name that marks a local sfora workspace. */
|
|
18
|
+
export declare const WORKSPACE_DIR = ".sfora";
|
|
19
|
+
/**
|
|
20
|
+
* Walk up from `cwd` looking for a `.sfora/` workspace. A directory only
|
|
21
|
+
* counts when it has workspace markers (board/posts/docs) — `~/.sfora` is also
|
|
22
|
+
* the CLI's config directory (config.json), and a bare config dir must never
|
|
23
|
+
* be mistaken for a workspace.
|
|
24
|
+
*/
|
|
25
|
+
export declare function findWorkspace(cwd: string): Promise<string | undefined>;
|
|
26
|
+
/** Scaffold `.sfora/` under `dir` (idempotent). Returns the workspace root. */
|
|
27
|
+
export declare function initWorkspace(dir: string): Promise<string>;
|
|
28
|
+
export interface TaskWriteResult {
|
|
29
|
+
filename: string;
|
|
30
|
+
column: string;
|
|
31
|
+
number: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TaskEntry {
|
|
34
|
+
filename: string;
|
|
35
|
+
column: string;
|
|
36
|
+
number: number | undefined;
|
|
37
|
+
title: string;
|
|
38
|
+
status: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class LocalWorkspace {
|
|
41
|
+
#private;
|
|
42
|
+
/** Absolute path of the `.sfora` directory. */
|
|
43
|
+
readonly root: string;
|
|
44
|
+
constructor(root: string);
|
|
45
|
+
listColumns(): Promise<string[]>;
|
|
46
|
+
listTasks(column?: string): Promise<TaskEntry[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Create (or, when frontmatter `number:` matches an existing card, update)
|
|
49
|
+
* a task from raw markdown. Mirrors the server's PUT semantics: title
|
|
50
|
+
* required, canonical `NNNN-<slug>.md` filename, next number assigned by
|
|
51
|
+
* scanning the board. The markdown is written verbatim — files are storage.
|
|
52
|
+
*/
|
|
53
|
+
writeTask(markdown: string, opts?: {
|
|
54
|
+
column?: string;
|
|
55
|
+
}): Promise<TaskWriteResult>;
|
|
56
|
+
writePost(markdown: string, opts?: {
|
|
57
|
+
draft?: boolean;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
filename: string;
|
|
60
|
+
}>;
|
|
61
|
+
writeDoc(markdown: string): Promise<{
|
|
62
|
+
filename: string;
|
|
63
|
+
}>;
|
|
64
|
+
listPosts(kind?: "posts" | "drafts"): Promise<string[]>;
|
|
65
|
+
listDocs(): Promise<string[]>;
|
|
66
|
+
/** Filename-level scan (no file reads) — enough for numbering. */
|
|
67
|
+
private listTasksShallow;
|
|
68
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalWorkspace — the OSS local mode. A `.sfora/` directory in your repo is
|
|
3
|
+
* the workspace: tasks, posts, and docs are plain markdown files on disk, in
|
|
4
|
+
* exactly the same format the cloud serves over /v1/fs (shared `../format`
|
|
5
|
+
* core), so `cp` is a migration.
|
|
6
|
+
*
|
|
7
|
+
* .sfora/
|
|
8
|
+
* board/01-todo/0001-fix-login.md tasks — NNNN-<slug>.md per column dir
|
|
9
|
+
* posts/2026-07-02-standup.md posts — YYYY-MM-DD-<slug>.md
|
|
10
|
+
* docs/architecture.md docs — <slug>.md
|
|
11
|
+
*
|
|
12
|
+
* This module owns the *semantics* (scaffolding, card numbering, canonical
|
|
13
|
+
* filenames, listings). The interactive shell needs no virtualization locally —
|
|
14
|
+
* just-bash's ReadWriteFs jails a real directory, and real `mv` between column
|
|
15
|
+
* dirs IS a card move.
|
|
16
|
+
*/
|
|
17
|
+
import { mkdir, readdir, readFile, writeFile, rm, stat } from "node:fs/promises";
|
|
18
|
+
import { join, dirname, resolve } from "node:path";
|
|
19
|
+
import { parseMarkdownCard, cardFilename, numberFromFilename, columnSlugFromDirname, parseMarkdownPost, parseMarkdownNote, noteFilename, slugify, } from "../format/index.js";
|
|
20
|
+
/** Directory name that marks a local sfora workspace. */
|
|
21
|
+
export const WORKSPACE_DIR = ".sfora";
|
|
22
|
+
const DEFAULT_COLUMNS = ["01-todo", "02-in-progress", "03-done"];
|
|
23
|
+
const WORKSPACE_README = `# sfora workspace
|
|
24
|
+
|
|
25
|
+
Everything here is a plain markdown file — edit with any tool, version with git.
|
|
26
|
+
|
|
27
|
+
- \`board/<column>/NNNN-<slug>.md\` — tasks. Frontmatter: \`status\`, \`priority\`,
|
|
28
|
+
\`labels\`, \`assignees\`, \`due\`. Move a task by moving the file between column
|
|
29
|
+
directories (\`mv\` works).
|
|
30
|
+
- \`posts/YYYY-MM-DD-<slug>.md\` — posts. An H1 (\`# Title\`) is the title.
|
|
31
|
+
- \`docs/<slug>.md\` — docs.
|
|
32
|
+
|
|
33
|
+
Create files by hand, or use the CLI: \`sfora task plan.md\`, \`sfora post note.md\`.
|
|
34
|
+
Same format as sfora cloud — \`sfora login\` connects this workspace to a team.
|
|
35
|
+
`;
|
|
36
|
+
/**
|
|
37
|
+
* Walk up from `cwd` looking for a `.sfora/` workspace. A directory only
|
|
38
|
+
* counts when it has workspace markers (board/posts/docs) — `~/.sfora` is also
|
|
39
|
+
* the CLI's config directory (config.json), and a bare config dir must never
|
|
40
|
+
* be mistaken for a workspace.
|
|
41
|
+
*/
|
|
42
|
+
export async function findWorkspace(cwd) {
|
|
43
|
+
let dir = resolve(cwd);
|
|
44
|
+
for (;;) {
|
|
45
|
+
const candidate = join(dir, WORKSPACE_DIR);
|
|
46
|
+
if (await isWorkspace(candidate))
|
|
47
|
+
return candidate;
|
|
48
|
+
const parent = dirname(dir);
|
|
49
|
+
if (parent === dir)
|
|
50
|
+
return undefined;
|
|
51
|
+
dir = parent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function isWorkspace(candidate) {
|
|
55
|
+
try {
|
|
56
|
+
if (!(await stat(candidate)).isDirectory())
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
for (const marker of ["board", "posts", "docs"]) {
|
|
63
|
+
try {
|
|
64
|
+
if ((await stat(join(candidate, marker))).isDirectory())
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// try the next marker
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
/** Scaffold `.sfora/` under `dir` (idempotent). Returns the workspace root. */
|
|
74
|
+
export async function initWorkspace(dir) {
|
|
75
|
+
const root = join(resolve(dir), WORKSPACE_DIR);
|
|
76
|
+
for (const col of DEFAULT_COLUMNS) {
|
|
77
|
+
await mkdir(join(root, "board", col), { recursive: true });
|
|
78
|
+
}
|
|
79
|
+
await mkdir(join(root, "posts"), { recursive: true });
|
|
80
|
+
await mkdir(join(root, "docs"), { recursive: true });
|
|
81
|
+
const readmePath = join(root, "README.md");
|
|
82
|
+
try {
|
|
83
|
+
await stat(readmePath);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
await writeFile(readmePath, WORKSPACE_README, "utf8");
|
|
87
|
+
}
|
|
88
|
+
return root;
|
|
89
|
+
}
|
|
90
|
+
export class LocalWorkspace {
|
|
91
|
+
/** Absolute path of the `.sfora` directory. */
|
|
92
|
+
root;
|
|
93
|
+
constructor(root) {
|
|
94
|
+
this.root = root;
|
|
95
|
+
}
|
|
96
|
+
// ─── Board ───────────────────────────────────────────────────────
|
|
97
|
+
async listColumns() {
|
|
98
|
+
const entries = await readdir(join(this.root, "board"), {
|
|
99
|
+
withFileTypes: true,
|
|
100
|
+
}).catch(() => []);
|
|
101
|
+
return entries
|
|
102
|
+
.filter((e) => e.isDirectory())
|
|
103
|
+
.map((e) => e.name)
|
|
104
|
+
.sort();
|
|
105
|
+
}
|
|
106
|
+
async listTasks(column) {
|
|
107
|
+
const columns = column
|
|
108
|
+
? [await this.#resolveColumn(column)]
|
|
109
|
+
: await this.listColumns();
|
|
110
|
+
const out = [];
|
|
111
|
+
for (const col of columns) {
|
|
112
|
+
const dir = join(this.root, "board", col);
|
|
113
|
+
const files = (await readdir(dir).catch(() => [])).filter((f) => f.endsWith(".md"));
|
|
114
|
+
for (const filename of files.sort()) {
|
|
115
|
+
const md = await readFile(join(dir, filename), "utf8");
|
|
116
|
+
const parsed = parseMarkdownCard(md);
|
|
117
|
+
const status = parsed.frontmatter.status;
|
|
118
|
+
out.push({
|
|
119
|
+
filename,
|
|
120
|
+
column: col,
|
|
121
|
+
number: numberFromFilename(filename),
|
|
122
|
+
title: parsed.title || filename.replace(/\.md$/, ""),
|
|
123
|
+
status: typeof status === "string" ? status : "active",
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create (or, when frontmatter `number:` matches an existing card, update)
|
|
131
|
+
* a task from raw markdown. Mirrors the server's PUT semantics: title
|
|
132
|
+
* required, canonical `NNNN-<slug>.md` filename, next number assigned by
|
|
133
|
+
* scanning the board. The markdown is written verbatim — files are storage.
|
|
134
|
+
*/
|
|
135
|
+
async writeTask(markdown, opts = {}) {
|
|
136
|
+
const parsed = parseMarkdownCard(markdown);
|
|
137
|
+
if (!parsed.title.trim()) {
|
|
138
|
+
throw new Error("Title is required — add an H1 (`# Title`) or a frontmatter `title:`");
|
|
139
|
+
}
|
|
140
|
+
const fmColumn = typeof parsed.frontmatter.column === "string"
|
|
141
|
+
? parsed.frontmatter.column
|
|
142
|
+
: undefined;
|
|
143
|
+
const fmStatus = typeof parsed.frontmatter.status === "string"
|
|
144
|
+
? parsed.frontmatter.status
|
|
145
|
+
: undefined;
|
|
146
|
+
const column = await this.#resolveColumn(opts.column ?? fmColumn, fmStatus);
|
|
147
|
+
// Existing card (by explicit frontmatter number) → replace in place,
|
|
148
|
+
// wherever it currently lives (the new write may also move it).
|
|
149
|
+
const fmNumber = typeof parsed.frontmatter.number === "string"
|
|
150
|
+
? Number.parseInt(parsed.frontmatter.number, 10)
|
|
151
|
+
: undefined;
|
|
152
|
+
const existing = fmNumber !== undefined && Number.isFinite(fmNumber)
|
|
153
|
+
? await this.#findByNumber(fmNumber)
|
|
154
|
+
: undefined;
|
|
155
|
+
if (existing) {
|
|
156
|
+
await rm(join(this.root, "board", existing.column, existing.filename));
|
|
157
|
+
}
|
|
158
|
+
const number = existing?.number ?? (await this.#nextNumber());
|
|
159
|
+
const filename = cardFilename({ number, title: parsed.title });
|
|
160
|
+
await writeFile(join(this.root, "board", column, filename), markdown, "utf8");
|
|
161
|
+
return { filename, column, number };
|
|
162
|
+
}
|
|
163
|
+
// ─── Posts & docs ────────────────────────────────────────────────
|
|
164
|
+
async writePost(markdown, opts = {}) {
|
|
165
|
+
const parsed = parseMarkdownPost(markdown);
|
|
166
|
+
if (!parsed.title.trim()) {
|
|
167
|
+
throw new Error("Title is required — add an H1 (`# Title`) or a frontmatter `title:`");
|
|
168
|
+
}
|
|
169
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
170
|
+
const filename = `${date}-${slugify(parsed.title)}.md`;
|
|
171
|
+
const dir = opts.draft ? "drafts" : "posts";
|
|
172
|
+
await mkdir(join(this.root, dir), { recursive: true });
|
|
173
|
+
await writeFile(join(this.root, dir, filename), markdown, "utf8");
|
|
174
|
+
return { filename };
|
|
175
|
+
}
|
|
176
|
+
async writeDoc(markdown) {
|
|
177
|
+
const parsed = parseMarkdownNote(markdown);
|
|
178
|
+
if (!parsed.title.trim()) {
|
|
179
|
+
throw new Error("Title is required — add an H1 (`# Title`) or a frontmatter `title:`");
|
|
180
|
+
}
|
|
181
|
+
const filename = noteFilename({ title: parsed.title });
|
|
182
|
+
await mkdir(join(this.root, "docs"), { recursive: true });
|
|
183
|
+
await writeFile(join(this.root, "docs", filename), markdown, "utf8");
|
|
184
|
+
return { filename };
|
|
185
|
+
}
|
|
186
|
+
async listPosts(kind = "posts") {
|
|
187
|
+
const files = await readdir(join(this.root, kind)).catch(() => []);
|
|
188
|
+
return files.filter((f) => f.endsWith(".md")).sort();
|
|
189
|
+
}
|
|
190
|
+
async listDocs() {
|
|
191
|
+
const files = await readdir(join(this.root, "docs")).catch(() => []);
|
|
192
|
+
return files.filter((f) => f.endsWith(".md")).sort();
|
|
193
|
+
}
|
|
194
|
+
// ─── Internals ───────────────────────────────────────────────────
|
|
195
|
+
/**
|
|
196
|
+
* Resolve a column reference (slug or name, e.g. "todo" / "In progress") to
|
|
197
|
+
* an existing column dirname. With no reference: a closed status prefers a
|
|
198
|
+
* done-ish column, otherwise the first column.
|
|
199
|
+
*/
|
|
200
|
+
async #resolveColumn(ref, status) {
|
|
201
|
+
const columns = await this.listColumns();
|
|
202
|
+
if (columns.length === 0) {
|
|
203
|
+
throw new Error(`no board columns — run \`sfora init --local\` first`);
|
|
204
|
+
}
|
|
205
|
+
if (ref) {
|
|
206
|
+
const want = slugify(ref);
|
|
207
|
+
const hit = columns.find((c) => columnSlugFromDirname(c) === want);
|
|
208
|
+
if (!hit) {
|
|
209
|
+
throw new Error(`unknown column '${ref}' (have: ${columns
|
|
210
|
+
.map(columnSlugFromDirname)
|
|
211
|
+
.join(", ")})`);
|
|
212
|
+
}
|
|
213
|
+
return hit;
|
|
214
|
+
}
|
|
215
|
+
if (status === "closed") {
|
|
216
|
+
const done = columns.find((c) => /done|closed|complete/.test(columnSlugFromDirname(c)));
|
|
217
|
+
if (done)
|
|
218
|
+
return done;
|
|
219
|
+
}
|
|
220
|
+
return columns[0];
|
|
221
|
+
}
|
|
222
|
+
async #nextNumber() {
|
|
223
|
+
let max = 0;
|
|
224
|
+
for (const t of await this.listTasksShallow()) {
|
|
225
|
+
if (t.number !== undefined && t.number > max)
|
|
226
|
+
max = t.number;
|
|
227
|
+
}
|
|
228
|
+
return max + 1;
|
|
229
|
+
}
|
|
230
|
+
async #findByNumber(number) {
|
|
231
|
+
for (const t of await this.listTasksShallow()) {
|
|
232
|
+
if (t.number === number)
|
|
233
|
+
return { ...t, number };
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
/** Filename-level scan (no file reads) — enough for numbering. */
|
|
238
|
+
async listTasksShallow() {
|
|
239
|
+
const out = [];
|
|
240
|
+
for (const col of await this.listColumns()) {
|
|
241
|
+
const files = await readdir(join(this.root, "board", col)).catch(() => []);
|
|
242
|
+
for (const filename of files) {
|
|
243
|
+
if (!filename.endsWith(".md"))
|
|
244
|
+
continue;
|
|
245
|
+
out.push({ column: col, filename, number: numberFromFilename(filename) });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return out;
|
|
249
|
+
}
|
|
250
|
+
}
|
package/dist/mcp-server.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export interface RunMcpServerOptions {
|
|
|
10
10
|
baseUrl: string;
|
|
11
11
|
apiKey: string;
|
|
12
12
|
org: string;
|
|
13
|
+
/** Absolute path of a local `.sfora/` workspace — serves it instead of the cloud. */
|
|
14
|
+
localRoot?: string;
|
|
13
15
|
}
|
|
14
16
|
export declare function runMcpServer(options: RunMcpServerOptions): Promise<void>;
|
package/dist/mcp-server.js
CHANGED
|
@@ -9,22 +9,31 @@
|
|
|
9
9
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
10
10
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
11
11
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
12
|
-
import { createSforaShell } from "./index.js";
|
|
12
|
+
import { createSforaShell, createLocalShell } from "./index.js";
|
|
13
13
|
const TOOL_DESCRIPTION = `Run a bash command against the sfora workspace — a Unix-style view where every post, task, and doc is a markdown file:
|
|
14
14
|
- /projects/<slug>/posts/<file>.md published posts
|
|
15
15
|
- /projects/<slug>/drafts/<file>.md your drafts
|
|
16
16
|
- /projects/<slug>/board/<NN-col>/<NNNN>.md tasks (kanban cards), by column
|
|
17
17
|
- /projects/<slug>/docs/<file>.md docs / notes
|
|
18
|
+
- /projects/<slug>/pulls/<number>.md pull requests (diff + linked work), read-only
|
|
18
19
|
- /inbox/mentions.md unread mentions
|
|
19
20
|
- /me/api-key your identity
|
|
20
21
|
Examples: 'ls /projects', 'cat /projects/web/board/01-todo/*.md', 'grep -ri TODO /projects', 'echo "# Fix login\\nstatus: active" > /projects/web/board/01-todo/fix.md'.
|
|
21
22
|
Write a file to create or update the entity (frontmatter sets fields like status/priority/assignees/due). cwd and environment persist across calls.`;
|
|
23
|
+
const LOCAL_TOOL_DESCRIPTION = `Run a bash command against the local sfora workspace (a .sfora/ directory of plain markdown files, git-versioned with the repo):
|
|
24
|
+
- /board/<NN-col>/<NNNN>-<slug>.md tasks (kanban cards), by column — 'mv' between column dirs moves a task
|
|
25
|
+
- /posts/<YYYY-MM-DD>-<slug>.md posts
|
|
26
|
+
- /docs/<slug>.md docs / notes
|
|
27
|
+
Examples: 'ls /board/01-todo', 'cat /board/01-todo/*.md', 'grep -ri TODO /', 'echo "# Fix login\\nstatus: active" > /board/01-todo/fix-login.md', 'mv /board/01-todo/0003-*.md /board/03-done/'.
|
|
28
|
+
Frontmatter sets task fields (status/priority/labels/assignees/due). cwd and environment persist across calls.`;
|
|
22
29
|
export async function runMcpServer(options) {
|
|
23
|
-
const { bash } =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const { bash } = options.localRoot
|
|
31
|
+
? createLocalShell(options.localRoot)
|
|
32
|
+
: createSforaShell({
|
|
33
|
+
baseUrl: options.baseUrl,
|
|
34
|
+
apiKey: options.apiKey,
|
|
35
|
+
org: options.org,
|
|
36
|
+
});
|
|
28
37
|
// Persistent shell state across tool calls.
|
|
29
38
|
let cwd = "/";
|
|
30
39
|
let env;
|
|
@@ -33,7 +42,7 @@ export async function runMcpServer(options) {
|
|
|
33
42
|
tools: [
|
|
34
43
|
{
|
|
35
44
|
name: "bash",
|
|
36
|
-
description: TOOL_DESCRIPTION,
|
|
45
|
+
description: options.localRoot ? LOCAL_TOOL_DESCRIPTION : TOOL_DESCRIPTION,
|
|
37
46
|
inputSchema: {
|
|
38
47
|
type: "object",
|
|
39
48
|
properties: {
|
|
@@ -84,5 +93,7 @@ export async function runMcpServer(options) {
|
|
|
84
93
|
});
|
|
85
94
|
const transport = new StdioServerTransport();
|
|
86
95
|
await server.connect(transport);
|
|
87
|
-
process.stderr.write(
|
|
96
|
+
process.stderr.write(options.localRoot
|
|
97
|
+
? `sfora MCP server ready (local workspace: ${options.localRoot})\n`
|
|
98
|
+
: `sfora MCP server ready (org: ${options.org || "—"}, ${options.baseUrl})\n`);
|
|
88
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfora-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Your sfora workspace as a markdown filesystem — a CLI + MCP server. Post/task/doc, ls/cat/grep, and a shell so agents operate sfora natively.",
|
|
6
6
|
"keywords": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/wavyrai/sfora/issues"
|
|
25
25
|
},
|
|
26
26
|
"bin": {
|
|
27
|
-
"sfora": "
|
|
27
|
+
"sfora": "dist/cli.js"
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/index.js",
|
|
30
30
|
"types": "./dist/index.d.ts",
|