MCPcopy Index your code
hub / github.com/github/copilot-sdk / createSessionFsAdapter

Function createSessionFsAdapter

nodejs/src/sessionFsProvider.ts:119–229  ·  view source on GitHub ↗
(provider: SessionFsProvider)

Source from the content-addressed store, hash-verified

117 * {@link SessionFsError} results.
118 */
119export function createSessionFsAdapter(provider: SessionFsProvider): SessionFsHandler {
120 return {
121 readFile: async ({ path }) => {
122 try {
123 const content = await provider.readFile(path);
124 return { content };
125 } catch (err) {
126 return { content: "", error: toSessionFsError(err) };
127 }
128 },
129 writeFile: async ({ path, content, mode }) => {
130 try {
131 await provider.writeFile(path, content, mode);
132 return undefined;
133 } catch (err) {
134 return toSessionFsError(err);
135 }
136 },
137 appendFile: async ({ path, content, mode }) => {
138 try {
139 await provider.appendFile(path, content, mode);
140 return undefined;
141 } catch (err) {
142 return toSessionFsError(err);
143 }
144 },
145 exists: async ({ path }) => {
146 try {
147 return { exists: await provider.exists(path) };
148 } catch {
149 return { exists: false };
150 }
151 },
152 stat: async ({ path }) => {
153 try {
154 return await provider.stat(path);
155 } catch (err) {
156 return {
157 isFile: false,
158 isDirectory: false,
159 size: 0,
160 mtime: new Date().toISOString(),
161 birthtime: new Date().toISOString(),
162 error: toSessionFsError(err),
163 };
164 }
165 },
166 mkdir: async ({ path, recursive, mode }) => {
167 try {
168 await provider.mkdir(path, recursive ?? false, mode);
169 return undefined;
170 } catch (err) {
171 return toSessionFsError(err);
172 }
173 },
174 readdir: async ({ path }) => {
175 try {
176 const entries = await provider.readdir(path);

Callers 3

setupSessionFsMethod · 0.90

Calls 13

toSessionFsErrorFunction · 0.85
normalizeSqliteParamsFunction · 0.85
queryMethod · 0.80
readFileMethod · 0.65
writeFileMethod · 0.65
appendFileMethod · 0.65
existsMethod · 0.65
statMethod · 0.65
mkdirMethod · 0.65
readdirMethod · 0.65
readdirWithTypesMethod · 0.65
rmMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…