@first-tree-ai/context-tree 0.1.5 → 0.1.7-alpha.202609010710

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 (35) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +7 -3
  3. package/.codex-plugin/plugin.json +16 -9
  4. package/README.md +150 -117
  5. package/dist/cli/index.mjs +955 -573
  6. package/dist/index.d.mts +64 -15
  7. package/dist/index.mjs +833 -471
  8. package/dist/{schemas-C4bs-FkC.d.mts → schemas-C_7izpsa.d.mts} +130 -134
  9. package/dist/{schemas-BWM6Q6iz.mjs → schemas-DKHE1sWt.mjs} +62 -51
  10. package/dist/schemas.d.mts +2 -2
  11. package/dist/schemas.mjs +2 -2
  12. package/docs/specification.md +158 -144
  13. package/hooks/session-start.mjs +5 -14
  14. package/package.json +1 -1
  15. package/policy/context-tree-policy.md +10 -12
  16. package/skills/context-tree-connect/SKILL.md +34 -0
  17. package/skills/context-tree-connect/agents/openai.yaml +4 -0
  18. package/skills/context-tree-create/SKILL.md +32 -0
  19. package/skills/context-tree-create/agents/openai.yaml +4 -0
  20. package/skills/context-tree-publish/SKILL.md +26 -0
  21. package/skills/context-tree-publish/agents/openai.yaml +4 -0
  22. package/skills/context-tree-publish/scripts/context-tree.mjs +41 -0
  23. package/skills/context-tree-read/SKILL.md +20 -43
  24. package/skills/context-tree-read/agents/openai.yaml +2 -2
  25. package/skills/context-tree-setup/SKILL.md +33 -0
  26. package/skills/context-tree-setup/agents/openai.yaml +4 -0
  27. package/skills/context-tree-setup/scripts/context-tree.mjs +41 -0
  28. package/skills/context-tree-write/SKILL.md +29 -125
  29. package/skills/context-tree-write/agents/openai.yaml +2 -2
  30. package/skills/context-tree-init/SKILL.md +0 -51
  31. package/skills/context-tree-init/agents/openai.yaml +0 -4
  32. package/skills/context-tree-link/SKILL.md +0 -45
  33. package/skills/context-tree-link/agents/openai.yaml +0 -4
  34. /package/skills/{context-tree-init → context-tree-connect}/scripts/context-tree.mjs +0 -0
  35. /package/skills/{context-tree-link → context-tree-create}/scripts/context-tree.mjs +0 -0
@@ -25,13 +25,19 @@ declare const VALIDATION_CODES: {
25
25
  readonly directorySymlinkPathEscape: "TREE_DIRECTORY_SYMLINK_PATH_ESCAPE";
26
26
  };
27
27
  declare const CLI_ERROR_CODES: {
28
- readonly ambiguousLink: "AMBIGUOUS_LINK";
29
- readonly corruptLink: "CORRUPT_LINK";
28
+ readonly corruptConnection: "CORRUPT_CONNECTION";
29
+ readonly dirtyTree: "DIRTY_TREE";
30
30
  readonly failed: "CONTEXT_TREE_FAILED";
31
- readonly noLink: "NO_LINK";
32
- readonly staleLink: "STALE_LINK";
31
+ readonly githubAuth: "GITHUB_AUTH";
32
+ readonly invalidTree: "INVALID_TREE";
33
+ readonly noConnection: "NO_CONNECTION";
34
+ readonly publishIncomplete: "PUBLISH_INCOMPLETE";
35
+ readonly repositoryExists: "REPOSITORY_EXISTS";
36
+ readonly staleConnection: "STALE_CONNECTION";
37
+ readonly writeOutdated: "WRITE_OUTDATED";
33
38
  };
34
39
  declare const credentialFreeRepositoryUrlSchema: z.ZodString;
40
+ declare const treeNameSchema: z.ZodString;
35
41
  declare const githubRepositoryIdentitySchema: z.ZodString;
36
42
  declare const contextTreeRootNodeFrontmatterSchema: z.ZodObject<{
37
43
  schemaVersion: z.ZodLiteral<1>;
@@ -217,160 +223,145 @@ declare const verifyTreeReportSchema: z.ZodObject<{
217
223
  schemaVersion: z.ZodLiteral<1>;
218
224
  }, z.core.$strict>;
219
225
  type VerifyTreeReport = z.infer<typeof verifyTreeReportSchema>;
220
- declare const scaffoldTreeResultSchema: z.ZodObject<{
221
- files: z.ZodArray<z.ZodString>;
222
- root: z.ZodString;
223
- schemaVersion: z.ZodLiteral<1>;
224
- verification: z.ZodObject<{
225
- findings: z.ZodArray<z.ZodObject<{
226
- code: z.ZodEnum<{
227
- readonly rootMissing: "TREE_ROOT_MISSING";
228
- readonly rootNodeInvalid: "TREE_ROOT_NODE_INVALID";
229
- readonly rootOnlyFields: "TREE_ROOT_ONLY_FIELDS";
230
- readonly directoryNodeMissing: "TREE_DIRECTORY_NODE_MISSING";
231
- readonly frontmatterMissing: "TREE_FRONTMATTER_MISSING";
232
- readonly frontmatterParse: "TREE_FRONTMATTER_PARSE";
233
- readonly titleMissing: "TREE_TITLE_MISSING";
234
- readonly titleInvalid: "TREE_TITLE_INVALID";
235
- readonly descriptionInvalid: "TREE_DESCRIPTION_INVALID";
236
- readonly softLinksInvalid: "TREE_SOFT_LINKS_INVALID";
237
- readonly softLinkBroken: "TREE_SOFT_LINK_BROKEN";
238
- readonly softLinkPathEscape: "TREE_SOFT_LINK_PATH_ESCAPE";
239
- readonly markdownPathEscape: "TREE_MARKDOWN_LINK_PATH_ESCAPE";
240
- readonly markdownFileSymlinkBroken: "TREE_MARKDOWN_FILE_SYMLINK_BROKEN";
241
- readonly markdownFileSymlinkUnsupported: "TREE_MARKDOWN_FILE_SYMLINK_UNSUPPORTED";
242
- readonly markdownFilePathEscape: "TREE_MARKDOWN_FILE_PATH_ESCAPE";
243
- readonly markdownFileContentClassMismatch: "TREE_MARKDOWN_FILE_CONTENT_CLASS_MISMATCH";
244
- readonly directorySymlinkUnsupported: "TREE_DIRECTORY_SYMLINK_UNSUPPORTED";
245
- readonly directorySymlinkPathEscape: "TREE_DIRECTORY_SYMLINK_PATH_ESCAPE";
246
- }>;
247
- message: z.ZodString;
248
- path: z.ZodString;
249
- target: z.ZodOptional<z.ZodString>;
250
- }, z.core.$strict>>;
251
- ok: z.ZodBoolean;
252
- root: z.ZodString;
253
- scannedByContentClass: z.ZodObject<{
254
- normal: z.ZodNumber;
255
- member: z.ZodNumber;
256
- "repo-infra": z.ZodNumber;
257
- }, z.core.$strict>;
258
- schemaVersion: z.ZodLiteral<1>;
259
- }, z.core.$strict>;
260
- }, z.core.$strict>;
261
- type ScaffoldTreeResult = z.infer<typeof scaffoldTreeResultSchema>;
262
- declare const contextTreeProjectIdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
- kind: z.ZodLiteral<"git">;
264
- origin: z.ZodString;
226
+ declare const contextTreeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
+ kind: z.ZodLiteral<"local">;
228
+ path: z.ZodString;
265
229
  }, z.core.$strict>, z.ZodObject<{
266
- kind: z.ZodLiteral<"directory">;
230
+ kind: z.ZodLiteral<"github">;
267
231
  path: z.ZodString;
232
+ repository: z.ZodString;
268
233
  }, z.core.$strict>], "kind">;
269
- type ContextTreeProjectIdentity = z.infer<typeof contextTreeProjectIdentitySchema>;
270
- declare const contextTreeLinkSchema: z.ZodObject<{
271
- project: z.ZodDiscriminatedUnion<[z.ZodObject<{
272
- kind: z.ZodLiteral<"git">;
273
- origin: z.ZodString;
234
+ type ContextTreeState = z.infer<typeof contextTreeStateSchema>;
235
+ declare const contextTreeConnectionSchema: z.ZodObject<{
236
+ projectPath: z.ZodString;
237
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
238
+ kind: z.ZodLiteral<"local">;
239
+ path: z.ZodString;
274
240
  }, z.core.$strict>, z.ZodObject<{
275
- kind: z.ZodLiteral<"directory">;
241
+ kind: z.ZodLiteral<"github">;
276
242
  path: z.ZodString;
243
+ repository: z.ZodString;
277
244
  }, z.core.$strict>], "kind">;
278
- tree: z.ZodObject<{
245
+ }, z.core.$strict>;
246
+ type ContextTreeConnection = z.infer<typeof contextTreeConnectionSchema>;
247
+ declare const contextTreeConnectionResultSchema: z.ZodObject<{
248
+ schemaVersion: z.ZodLiteral<1>;
249
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
250
+ kind: z.ZodLiteral<"local">;
251
+ path: z.ZodString;
252
+ }, z.core.$strict>, z.ZodObject<{
253
+ kind: z.ZodLiteral<"github">;
279
254
  path: z.ZodString;
280
255
  repository: z.ZodString;
281
- }, z.core.$strict>;
256
+ }, z.core.$strict>], "kind">;
282
257
  }, z.core.$strict>;
283
- type ContextTreeLink = z.infer<typeof contextTreeLinkSchema>;
284
- declare const contextTreeLinkResultSchema: z.ZodObject<{
285
- link: z.ZodObject<{
286
- project: z.ZodDiscriminatedUnion<[z.ZodObject<{
287
- kind: z.ZodLiteral<"git">;
288
- origin: z.ZodString;
289
- }, z.core.$strict>, z.ZodObject<{
290
- kind: z.ZodLiteral<"directory">;
291
- path: z.ZodString;
292
- }, z.core.$strict>], "kind">;
293
- tree: z.ZodObject<{
294
- path: z.ZodString;
295
- repository: z.ZodString;
296
- }, z.core.$strict>;
297
- }, z.core.$strict>;
258
+ type ContextTreeConnectionResult = z.infer<typeof contextTreeConnectionResultSchema>;
259
+ declare const createProjectResultSchema: z.ZodObject<{
260
+ branch: z.ZodString;
261
+ commitSha: z.ZodString;
262
+ created: z.ZodBoolean;
298
263
  schemaVersion: z.ZodLiteral<1>;
264
+ title: z.ZodString;
265
+ treePath: z.ZodString;
299
266
  }, z.core.$strict>;
300
- type ContextTreeLinkResult = z.infer<typeof contextTreeLinkResultSchema>;
301
- declare const contextTreeRefreshResultSchema: z.ZodObject<{
302
- link: z.ZodObject<{
303
- project: z.ZodDiscriminatedUnion<[z.ZodObject<{
304
- kind: z.ZodLiteral<"git">;
305
- origin: z.ZodString;
306
- }, z.core.$strict>, z.ZodObject<{
307
- kind: z.ZodLiteral<"directory">;
267
+ type CreateProjectResult = z.infer<typeof createProjectResultSchema>;
268
+ declare const connectProjectResultSchema: z.ZodObject<{
269
+ schemaVersion: z.ZodLiteral<1>;
270
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
271
+ kind: z.ZodLiteral<"local">;
272
+ path: z.ZodString;
273
+ }, z.core.$strict>, z.ZodObject<{
274
+ kind: z.ZodLiteral<"github">;
275
+ path: z.ZodString;
276
+ repository: z.ZodString;
277
+ }, z.core.$strict>], "kind">;
278
+ }, z.core.$strict>;
279
+ type ConnectProjectResult = z.infer<typeof connectProjectResultSchema>;
280
+ declare const managedTreeListingEntrySchema: z.ZodObject<{
281
+ name: z.ZodString;
282
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
283
+ kind: z.ZodLiteral<"local">;
284
+ path: z.ZodString;
285
+ }, z.core.$strict>, z.ZodObject<{
286
+ kind: z.ZodLiteral<"github">;
287
+ path: z.ZodString;
288
+ repository: z.ZodString;
289
+ }, z.core.$strict>], "kind">;
290
+ }, z.core.$strict>;
291
+ type ManagedTreeListingEntry = z.infer<typeof managedTreeListingEntrySchema>;
292
+ declare const managedTreeListingResultSchema: z.ZodObject<{
293
+ schemaVersion: z.ZodLiteral<1>;
294
+ trees: z.ZodArray<z.ZodObject<{
295
+ name: z.ZodString;
296
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
297
+ kind: z.ZodLiteral<"local">;
308
298
  path: z.ZodString;
309
- }, z.core.$strict>], "kind">;
310
- tree: z.ZodObject<{
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ kind: z.ZodLiteral<"github">;
311
301
  path: z.ZodString;
312
302
  repository: z.ZodString;
313
- }, z.core.$strict>;
314
- }, z.core.$strict>;
315
- defaultBranch: z.ZodString;
316
- refreshed: z.ZodBoolean;
303
+ }, z.core.$strict>], "kind">;
304
+ }, z.core.$strict>>;
305
+ }, z.core.$strict>;
306
+ type ManagedTreeListingResult = z.infer<typeof managedTreeListingResultSchema>;
307
+ declare const contextTreeSyncResultSchema: z.ZodObject<{
308
+ branch: z.ZodString;
317
309
  schemaVersion: z.ZodLiteral<1>;
318
310
  sha: z.ZodString;
311
+ tree: z.ZodDiscriminatedUnion<[z.ZodObject<{
312
+ kind: z.ZodLiteral<"local">;
313
+ path: z.ZodString;
314
+ }, z.core.$strict>, z.ZodObject<{
315
+ kind: z.ZodLiteral<"github">;
316
+ path: z.ZodString;
317
+ repository: z.ZodString;
318
+ }, z.core.$strict>], "kind">;
319
319
  }, z.core.$strict>;
320
- type ContextTreeRefreshResult = z.infer<typeof contextTreeRefreshResultSchema>;
321
- declare const contextTreeStageResultSchema: z.ZodObject<{
322
- link: z.ZodObject<{
323
- project: z.ZodDiscriminatedUnion<[z.ZodObject<{
324
- kind: z.ZodLiteral<"git">;
325
- origin: z.ZodString;
326
- }, z.core.$strict>, z.ZodObject<{
327
- kind: z.ZodLiteral<"directory">;
328
- path: z.ZodString;
329
- }, z.core.$strict>], "kind">;
330
- tree: z.ZodObject<{
331
- path: z.ZodString;
332
- repository: z.ZodString;
333
- }, z.core.$strict>;
334
- }, z.core.$strict>;
335
- defaultBranch: z.ZodString;
336
- baseSha: z.ZodString;
320
+ type ContextTreeSyncResult = z.infer<typeof contextTreeSyncResultSchema>;
321
+ declare const prepareContextWriteResultSchema: z.ZodObject<{
337
322
  schemaVersion: z.ZodLiteral<1>;
338
- taskBranch: z.ZodString;
339
323
  worktreePath: z.ZodString;
340
324
  }, z.core.$strict>;
341
- type ContextTreeStageResult = z.infer<typeof contextTreeStageResultSchema>;
342
- declare const contextTreeDiffResultSchema: z.ZodObject<{
343
- base: z.ZodString;
344
- files: z.ZodArray<z.ZodObject<{
345
- path: z.ZodString;
346
- status: z.ZodEnum<{
347
- added: "added";
348
- deleted: "deleted";
349
- modified: "modified";
350
- renamed: "renamed";
351
- untracked: "untracked";
352
- }>;
353
- }, z.core.$strict>>;
354
- patch: z.ZodString;
325
+ type PrepareContextWriteResult = z.infer<typeof prepareContextWriteResultSchema>;
326
+ declare const finishContextWriteResultSchema: z.ZodObject<{
327
+ branch: z.ZodString;
355
328
  schemaVersion: z.ZodLiteral<1>;
356
- treePath: z.ZodString;
329
+ sha: z.ZodString;
330
+ }, z.core.$strict>;
331
+ type FinishContextWriteResult = z.infer<typeof finishContextWriteResultSchema>;
332
+ declare const contextTreePublishResultSchema: z.ZodObject<{
333
+ branch: z.ZodString;
334
+ repository: z.ZodString;
335
+ schemaVersion: z.ZodLiteral<1>;
336
+ sha: z.ZodString;
337
+ url: z.ZodString;
357
338
  }, z.core.$strict>;
358
- type ContextTreeDiffResult = z.infer<typeof contextTreeDiffResultSchema>;
339
+ type ContextTreePublishResult = z.infer<typeof contextTreePublishResultSchema>;
359
340
  declare const contextTreeCliErrorCodeSchema: z.ZodEnum<{
360
- readonly ambiguousLink: "AMBIGUOUS_LINK";
361
- readonly corruptLink: "CORRUPT_LINK";
341
+ readonly corruptConnection: "CORRUPT_CONNECTION";
342
+ readonly dirtyTree: "DIRTY_TREE";
362
343
  readonly failed: "CONTEXT_TREE_FAILED";
363
- readonly noLink: "NO_LINK";
364
- readonly staleLink: "STALE_LINK";
344
+ readonly githubAuth: "GITHUB_AUTH";
345
+ readonly invalidTree: "INVALID_TREE";
346
+ readonly noConnection: "NO_CONNECTION";
347
+ readonly publishIncomplete: "PUBLISH_INCOMPLETE";
348
+ readonly repositoryExists: "REPOSITORY_EXISTS";
349
+ readonly staleConnection: "STALE_CONNECTION";
350
+ readonly writeOutdated: "WRITE_OUTDATED";
365
351
  }>;
366
352
  type ContextTreeCliErrorCode = z.infer<typeof contextTreeCliErrorCodeSchema>;
367
353
  declare const contextTreeCliErrorSchema: z.ZodObject<{
368
354
  code: z.ZodEnum<{
369
- readonly ambiguousLink: "AMBIGUOUS_LINK";
370
- readonly corruptLink: "CORRUPT_LINK";
355
+ readonly corruptConnection: "CORRUPT_CONNECTION";
356
+ readonly dirtyTree: "DIRTY_TREE";
371
357
  readonly failed: "CONTEXT_TREE_FAILED";
372
- readonly noLink: "NO_LINK";
373
- readonly staleLink: "STALE_LINK";
358
+ readonly githubAuth: "GITHUB_AUTH";
359
+ readonly invalidTree: "INVALID_TREE";
360
+ readonly noConnection: "NO_CONNECTION";
361
+ readonly publishIncomplete: "PUBLISH_INCOMPLETE";
362
+ readonly repositoryExists: "REPOSITORY_EXISTS";
363
+ readonly staleConnection: "STALE_CONNECTION";
364
+ readonly writeOutdated: "WRITE_OUTDATED";
374
365
  }>;
375
366
  message: z.ZodString;
376
367
  }, z.core.$strict>;
@@ -378,11 +369,16 @@ type ContextTreeCliError = z.infer<typeof contextTreeCliErrorSchema>;
378
369
  declare const contextTreeCliErrorEnvelopeSchema: z.ZodObject<{
379
370
  error: z.ZodObject<{
380
371
  code: z.ZodEnum<{
381
- readonly ambiguousLink: "AMBIGUOUS_LINK";
382
- readonly corruptLink: "CORRUPT_LINK";
372
+ readonly corruptConnection: "CORRUPT_CONNECTION";
373
+ readonly dirtyTree: "DIRTY_TREE";
383
374
  readonly failed: "CONTEXT_TREE_FAILED";
384
- readonly noLink: "NO_LINK";
385
- readonly staleLink: "STALE_LINK";
375
+ readonly githubAuth: "GITHUB_AUTH";
376
+ readonly invalidTree: "INVALID_TREE";
377
+ readonly noConnection: "NO_CONNECTION";
378
+ readonly publishIncomplete: "PUBLISH_INCOMPLETE";
379
+ readonly repositoryExists: "REPOSITORY_EXISTS";
380
+ readonly staleConnection: "STALE_CONNECTION";
381
+ readonly writeOutdated: "WRITE_OUTDATED";
386
382
  }>;
387
383
  message: z.ZodString;
388
384
  }, z.core.$strict>;
@@ -391,4 +387,4 @@ declare const contextTreeCliErrorEnvelopeSchema: z.ZodObject<{
391
387
  }, z.core.$strict>;
392
388
  type ContextTreeCliErrorEnvelope = z.infer<typeof contextTreeCliErrorEnvelopeSchema>;
393
389
  //#endregion
394
- export { contextTreeDiffResultSchema as A, contextTreeRootNodeSchema as B, ValidationCode as C, contextTreeCliErrorCodeSchema as D, contextContentClassSchema as E, contextTreeReadChildSchema as F, scaffoldTreeResultSchema as G, credentialFreeRepositoryUrlSchema as H, contextTreeReadNodeSchema as I, verifyTreeReportSchema as J, treeValidationFindingSchema as K, contextTreeReadResultSchema as L, contextTreeLinkSchema as M, contextTreePolicySchema as N, contextTreeCliErrorEnvelopeSchema as O, contextTreeProjectIdentitySchema as P, contextTreeRefreshResultSchema as R, VALIDATION_CODES as S, contextContentClassCountsSchema as T, githubRepositoryIdentitySchema as U, contextTreeStageResultSchema as V, parseContextTreeRootNode as W, ContextTreeRootNode as _, ContextTreeCliError as a, ScaffoldTreeResult as b, ContextTreeDiffResult as c, ContextTreePolicy as d, ContextTreeProjectIdentity as f, ContextTreeRefreshResult as g, ContextTreeReadResult as h, ContextContentClassCounts as i, contextTreeLinkResultSchema as j, contextTreeCliErrorSchema as k, ContextTreeLink as l, ContextTreeReadNode as m, CONTEXT_TREE_ROOT_NODE_MAX_BYTES as n, ContextTreeCliErrorCode as o, ContextTreeReadChild as p, validationCodeSchema as q, ContextContentClass as r, ContextTreeCliErrorEnvelope as s, CLI_ERROR_CODES as t, ContextTreeLinkResult as u, ContextTreeStageResult as v, VerifyTreeReport as w, TreeValidationFinding as x, SCHEMA_VERSION as y, contextTreeRootNodeFrontmatterSchema as z };
390
+ export { prepareContextWriteResultSchema as $, contextContentClassCountsSchema as A, contextTreeReadNodeSchema as B, PrepareContextWriteResult as C, ValidationCode as D, VALIDATION_CODES as E, contextTreeConnectionResultSchema as F, contextTreeSyncResultSchema as G, contextTreeRootNodeFrontmatterSchema as H, contextTreeConnectionSchema as I, finishContextWriteResultSchema as J, createProjectResultSchema as K, contextTreePolicySchema as L, contextTreeCliErrorCodeSchema as M, contextTreeCliErrorEnvelopeSchema as N, VerifyTreeReport as O, contextTreeCliErrorSchema as P, parseContextTreeRootNode as Q, contextTreePublishResultSchema as R, ManagedTreeListingResult as S, TreeValidationFinding as T, contextTreeRootNodeSchema as U, contextTreeReadResultSchema as V, contextTreeStateSchema as W, managedTreeListingEntrySchema as X, githubRepositoryIdentitySchema as Y, managedTreeListingResultSchema as Z, ContextTreeState as _, ContextContentClassCounts as a, FinishContextWriteResult as b, ContextTreeCliErrorEnvelope as c, ContextTreePolicy as d, treeNameSchema as et, ContextTreePublishResult as f, ContextTreeRootNode as g, ContextTreeReadResult as h, ContextContentClass as i, contextContentClassSchema as j, connectProjectResultSchema as k, ContextTreeConnection as l, ContextTreeReadNode as m, CONTEXT_TREE_ROOT_NODE_MAX_BYTES as n, validationCodeSchema as nt, ContextTreeCliError as o, ContextTreeReadChild as p, credentialFreeRepositoryUrlSchema as q, ConnectProjectResult as r, verifyTreeReportSchema as rt, ContextTreeCliErrorCode as s, CLI_ERROR_CODES as t, treeValidationFindingSchema as tt, ContextTreeConnectionResult as u, ContextTreeSyncResult as v, SCHEMA_VERSION as w, ManagedTreeListingEntry as x, CreateProjectResult as y, contextTreeReadChildSchema as z };
@@ -87,11 +87,16 @@ const VALIDATION_CODES = {
87
87
  directorySymlinkPathEscape: "TREE_DIRECTORY_SYMLINK_PATH_ESCAPE"
88
88
  };
89
89
  const CLI_ERROR_CODES = {
90
- ambiguousLink: "AMBIGUOUS_LINK",
91
- corruptLink: "CORRUPT_LINK",
90
+ corruptConnection: "CORRUPT_CONNECTION",
91
+ dirtyTree: "DIRTY_TREE",
92
92
  failed: "CONTEXT_TREE_FAILED",
93
- noLink: "NO_LINK",
94
- staleLink: "STALE_LINK"
93
+ githubAuth: "GITHUB_AUTH",
94
+ invalidTree: "INVALID_TREE",
95
+ noConnection: "NO_CONNECTION",
96
+ publishIncomplete: "PUBLISH_INCOMPLETE",
97
+ repositoryExists: "REPOSITORY_EXISTS",
98
+ staleConnection: "STALE_CONNECTION",
99
+ writeOutdated: "WRITE_OUTDATED"
95
100
  };
96
101
  function hasUnsafeCharacter(value) {
97
102
  return [...value].some((character) => {
@@ -131,10 +136,16 @@ const credentialFreeRepositoryUrlSchema = z.string().superRefine((value, context
131
136
  });
132
137
  }
133
138
  });
139
+ const treeNameSchema = z.string().superRefine((value, context) => {
140
+ if (!/^[A-Za-z\d][A-Za-z\d._-]{0,99}$/u.test(value) || /\.git$/iu.test(value)) context.addIssue({
141
+ code: "custom",
142
+ message: "Tree name must be a safe single path segment."
143
+ });
144
+ });
134
145
  const githubRepositoryIdentitySchema = z.string().superRefine((value, context) => {
135
146
  const parts = value.split("/");
136
147
  const [owner, name] = parts;
137
- if (parts.length !== 2 || owner === void 0 || name === void 0 || !/^[A-Za-z\d](?:[A-Za-z\d-]{0,37}[A-Za-z\d])?$/u.test(owner) || !/^[A-Za-z\d._-]{1,100}$/u.test(name) || name === "." || name === ".." || /\.git$/iu.test(name)) context.addIssue({
148
+ if (parts.length !== 2 || owner === void 0 || name === void 0 || !/^[A-Za-z\d](?:[A-Za-z\d-]{0,37}[A-Za-z\d])?$/u.test(owner) || !treeNameSchema.safeParse(name).success) context.addIssue({
138
149
  code: "custom",
139
150
  message: "Repository must be an explicit GitHub OWNER/REPO identity."
140
151
  });
@@ -209,60 +220,60 @@ const verifyTreeReportSchema = z.object({
209
220
  scannedByContentClass: contextContentClassCountsSchema,
210
221
  schemaVersion: z.literal(1)
211
222
  }).strict();
212
- const scaffoldTreeResultSchema = z.object({
213
- files: z.array(z.string()),
214
- root: z.string(),
215
- schemaVersion: z.literal(1),
216
- verification: verifyTreeReportSchema
217
- }).strict();
218
- const contextTreeProjectIdentitySchema = z.discriminatedUnion("kind", [z.object({
219
- kind: z.literal("git"),
220
- origin: credentialFreeRepositoryUrlSchema
221
- }).strict(), z.object({
222
- kind: z.literal("directory"),
223
+ const contextTreeStateSchema = z.discriminatedUnion("kind", [z.object({
224
+ kind: z.literal("local"),
223
225
  path: absoluteSingleLinePathSchema
226
+ }).strict(), z.object({
227
+ kind: z.literal("github"),
228
+ path: absoluteSingleLinePathSchema,
229
+ repository: githubRepositoryIdentitySchema
224
230
  }).strict()]);
225
- const contextTreeLinkSchema = z.object({
226
- project: contextTreeProjectIdentitySchema,
227
- tree: z.object({
228
- path: absoluteSingleLinePathSchema,
229
- repository: githubRepositoryIdentitySchema
230
- }).strict()
231
+ const contextTreeConnectionSchema = z.object({
232
+ projectPath: absoluteSingleLinePathSchema,
233
+ tree: contextTreeStateSchema
231
234
  }).strict();
232
- const contextTreeLinkResultSchema = z.object({
233
- link: contextTreeLinkSchema,
234
- schemaVersion: z.literal(1)
235
+ const contextTreeConnectionResultSchema = z.object({
236
+ schemaVersion: z.literal(1),
237
+ tree: contextTreeStateSchema
235
238
  }).strict();
236
- const contextTreeRefreshResultSchema = z.object({
237
- link: contextTreeLinkSchema,
238
- defaultBranch: z.string().trim().min(1),
239
- refreshed: z.boolean(),
239
+ const createProjectResultSchema = z.object({
240
+ branch: z.string().trim().min(1),
241
+ commitSha: z.string(),
242
+ created: z.boolean(),
240
243
  schemaVersion: z.literal(1),
241
- sha: z.string()
244
+ title: z.string().trim().min(1),
245
+ treePath: absoluteSingleLinePathSchema
246
+ }).strict();
247
+ const connectProjectResultSchema = contextTreeConnectionResultSchema;
248
+ const managedTreeListingEntrySchema = z.object({
249
+ name: treeNameSchema,
250
+ tree: contextTreeStateSchema
251
+ }).strict();
252
+ const managedTreeListingResultSchema = z.object({
253
+ schemaVersion: z.literal(1),
254
+ trees: z.array(managedTreeListingEntrySchema)
242
255
  }).strict();
243
- const contextTreeStageResultSchema = z.object({
244
- link: contextTreeLinkSchema,
245
- defaultBranch: z.string().trim().min(1),
246
- baseSha: z.string(),
256
+ const contextTreeSyncResultSchema = z.object({
257
+ branch: z.string().trim().min(1),
247
258
  schemaVersion: z.literal(1),
248
- taskBranch: z.string().trim().min(1),
249
- worktreePath: z.string()
259
+ sha: z.string(),
260
+ tree: contextTreeStateSchema
261
+ }).strict();
262
+ const prepareContextWriteResultSchema = z.object({
263
+ schemaVersion: z.literal(1),
264
+ worktreePath: absoluteSingleLinePathSchema
265
+ }).strict();
266
+ const finishContextWriteResultSchema = z.object({
267
+ branch: z.string().trim().min(1),
268
+ schemaVersion: z.literal(1),
269
+ sha: z.string()
250
270
  }).strict();
251
- const contextTreeDiffResultSchema = z.object({
252
- base: z.string(),
253
- files: z.array(z.object({
254
- path: z.string(),
255
- status: z.enum([
256
- "added",
257
- "deleted",
258
- "modified",
259
- "renamed",
260
- "untracked"
261
- ])
262
- }).strict()).max(4096),
263
- patch: z.string(),
271
+ const contextTreePublishResultSchema = z.object({
272
+ branch: z.string().trim().min(1),
273
+ repository: githubRepositoryIdentitySchema,
264
274
  schemaVersion: z.literal(1),
265
- treePath: z.string()
275
+ sha: z.string(),
276
+ url: credentialFreeRepositoryUrlSchema
266
277
  }).strict();
267
278
  const contextTreeCliErrorCodeSchema = z.enum(CLI_ERROR_CODES);
268
279
  const contextTreeCliErrorSchema = z.object({
@@ -275,4 +286,4 @@ const contextTreeCliErrorEnvelopeSchema = z.object({
275
286
  schemaVersion: z.literal(1)
276
287
  }).strict();
277
288
  //#endregion
278
- export { isRecord as A, githubRepositoryIdentitySchema as C, validationCodeSchema as D, treeValidationFindingSchema as E, verifyTreeReportSchema as O, credentialFreeRepositoryUrlSchema as S, scaffoldTreeResultSchema as T, contextTreeReadResultSchema as _, contextContentClassCountsSchema as a, contextTreeRootNodeSchema as b, contextTreeCliErrorEnvelopeSchema as c, contextTreeLinkResultSchema as d, contextTreeLinkSchema as f, contextTreeReadNodeSchema as g, contextTreeReadChildSchema as h, VALIDATION_CODES as i, parseMarkdownFrontmatter as k, contextTreeCliErrorSchema as l, contextTreeProjectIdentitySchema as m, CONTEXT_TREE_ROOT_NODE_MAX_BYTES as n, contextContentClassSchema as o, contextTreePolicySchema as p, SCHEMA_VERSION as r, contextTreeCliErrorCodeSchema as s, CLI_ERROR_CODES as t, contextTreeDiffResultSchema as u, contextTreeRefreshResultSchema as v, parseContextTreeRootNode as w, contextTreeStageResultSchema as x, contextTreeRootNodeFrontmatterSchema as y };
289
+ export { treeNameSchema as A, credentialFreeRepositoryUrlSchema as C, managedTreeListingResultSchema as D, managedTreeListingEntrySchema as E, isRecord as F, validationCodeSchema as M, verifyTreeReportSchema as N, parseContextTreeRootNode as O, parseMarkdownFrontmatter as P, createProjectResultSchema as S, githubRepositoryIdentitySchema as T, contextTreeReadResultSchema as _, connectProjectResultSchema as a, contextTreeStateSchema as b, contextTreeCliErrorCodeSchema as c, contextTreeConnectionResultSchema as d, contextTreeConnectionSchema as f, contextTreeReadNodeSchema as g, contextTreeReadChildSchema as h, VALIDATION_CODES as i, treeValidationFindingSchema as j, prepareContextWriteResultSchema as k, contextTreeCliErrorEnvelopeSchema as l, contextTreePublishResultSchema as m, CONTEXT_TREE_ROOT_NODE_MAX_BYTES as n, contextContentClassCountsSchema as o, contextTreePolicySchema as p, SCHEMA_VERSION as r, contextContentClassSchema as s, CLI_ERROR_CODES as t, contextTreeCliErrorSchema as u, contextTreeRootNodeFrontmatterSchema as v, finishContextWriteResultSchema as w, contextTreeSyncResultSchema as x, contextTreeRootNodeSchema as y };
@@ -1,2 +1,2 @@
1
- import { A as contextTreeDiffResultSchema, B as contextTreeRootNodeSchema, C as ValidationCode, D as contextTreeCliErrorCodeSchema, E as contextContentClassSchema, F as contextTreeReadChildSchema, G as scaffoldTreeResultSchema, H as credentialFreeRepositoryUrlSchema, I as contextTreeReadNodeSchema, J as verifyTreeReportSchema, K as treeValidationFindingSchema, L as contextTreeReadResultSchema, M as contextTreeLinkSchema, N as contextTreePolicySchema, O as contextTreeCliErrorEnvelopeSchema, P as contextTreeProjectIdentitySchema, R as contextTreeRefreshResultSchema, S as VALIDATION_CODES, T as contextContentClassCountsSchema, U as githubRepositoryIdentitySchema, V as contextTreeStageResultSchema, W as parseContextTreeRootNode, _ as ContextTreeRootNode, a as ContextTreeCliError, b as ScaffoldTreeResult, c as ContextTreeDiffResult, d as ContextTreePolicy, f as ContextTreeProjectIdentity, g as ContextTreeRefreshResult, h as ContextTreeReadResult, i as ContextContentClassCounts, j as contextTreeLinkResultSchema, k as contextTreeCliErrorSchema, l as ContextTreeLink, m as ContextTreeReadNode, n as CONTEXT_TREE_ROOT_NODE_MAX_BYTES, o as ContextTreeCliErrorCode, p as ContextTreeReadChild, q as validationCodeSchema, r as ContextContentClass, s as ContextTreeCliErrorEnvelope, t as CLI_ERROR_CODES, u as ContextTreeLinkResult, v as ContextTreeStageResult, w as VerifyTreeReport, x as TreeValidationFinding, y as SCHEMA_VERSION, z as contextTreeRootNodeFrontmatterSchema } from "./schemas-C4bs-FkC.mjs";
2
- export { CLI_ERROR_CODES, CONTEXT_TREE_ROOT_NODE_MAX_BYTES, ContextContentClass, ContextContentClassCounts, ContextTreeCliError, ContextTreeCliErrorCode, ContextTreeCliErrorEnvelope, ContextTreeDiffResult, ContextTreeLink, ContextTreeLinkResult, ContextTreePolicy, ContextTreeProjectIdentity, ContextTreeReadChild, ContextTreeReadNode, ContextTreeReadResult, ContextTreeRefreshResult, ContextTreeRootNode, ContextTreeStageResult, SCHEMA_VERSION, ScaffoldTreeResult, TreeValidationFinding, VALIDATION_CODES, ValidationCode, VerifyTreeReport, contextContentClassCountsSchema, contextContentClassSchema, contextTreeCliErrorCodeSchema, contextTreeCliErrorEnvelopeSchema, contextTreeCliErrorSchema, contextTreeDiffResultSchema, contextTreeLinkResultSchema, contextTreeLinkSchema, contextTreePolicySchema, contextTreeProjectIdentitySchema, contextTreeReadChildSchema, contextTreeReadNodeSchema, contextTreeReadResultSchema, contextTreeRefreshResultSchema, contextTreeRootNodeFrontmatterSchema, contextTreeRootNodeSchema, contextTreeStageResultSchema, credentialFreeRepositoryUrlSchema, githubRepositoryIdentitySchema, parseContextTreeRootNode, scaffoldTreeResultSchema, treeValidationFindingSchema, validationCodeSchema, verifyTreeReportSchema };
1
+ import { $ as prepareContextWriteResultSchema, A as contextContentClassCountsSchema, B as contextTreeReadNodeSchema, C as PrepareContextWriteResult, D as ValidationCode, E as VALIDATION_CODES, F as contextTreeConnectionResultSchema, G as contextTreeSyncResultSchema, H as contextTreeRootNodeFrontmatterSchema, I as contextTreeConnectionSchema, J as finishContextWriteResultSchema, K as createProjectResultSchema, L as contextTreePolicySchema, M as contextTreeCliErrorCodeSchema, N as contextTreeCliErrorEnvelopeSchema, O as VerifyTreeReport, P as contextTreeCliErrorSchema, Q as parseContextTreeRootNode, R as contextTreePublishResultSchema, S as ManagedTreeListingResult, T as TreeValidationFinding, U as contextTreeRootNodeSchema, V as contextTreeReadResultSchema, W as contextTreeStateSchema, X as managedTreeListingEntrySchema, Y as githubRepositoryIdentitySchema, Z as managedTreeListingResultSchema, _ as ContextTreeState, a as ContextContentClassCounts, b as FinishContextWriteResult, c as ContextTreeCliErrorEnvelope, d as ContextTreePolicy, et as treeNameSchema, f as ContextTreePublishResult, g as ContextTreeRootNode, h as ContextTreeReadResult, i as ContextContentClass, j as contextContentClassSchema, k as connectProjectResultSchema, l as ContextTreeConnection, m as ContextTreeReadNode, n as CONTEXT_TREE_ROOT_NODE_MAX_BYTES, nt as validationCodeSchema, o as ContextTreeCliError, p as ContextTreeReadChild, q as credentialFreeRepositoryUrlSchema, r as ConnectProjectResult, rt as verifyTreeReportSchema, s as ContextTreeCliErrorCode, t as CLI_ERROR_CODES, tt as treeValidationFindingSchema, u as ContextTreeConnectionResult, v as ContextTreeSyncResult, w as SCHEMA_VERSION, x as ManagedTreeListingEntry, y as CreateProjectResult, z as contextTreeReadChildSchema } from "./schemas-C_7izpsa.mjs";
2
+ export { CLI_ERROR_CODES, CONTEXT_TREE_ROOT_NODE_MAX_BYTES, ConnectProjectResult, ContextContentClass, ContextContentClassCounts, ContextTreeCliError, ContextTreeCliErrorCode, ContextTreeCliErrorEnvelope, ContextTreeConnection, ContextTreeConnectionResult, ContextTreePolicy, ContextTreePublishResult, ContextTreeReadChild, ContextTreeReadNode, ContextTreeReadResult, ContextTreeRootNode, ContextTreeState, ContextTreeSyncResult, CreateProjectResult, FinishContextWriteResult, ManagedTreeListingEntry, ManagedTreeListingResult, PrepareContextWriteResult, SCHEMA_VERSION, TreeValidationFinding, VALIDATION_CODES, ValidationCode, VerifyTreeReport, connectProjectResultSchema, contextContentClassCountsSchema, contextContentClassSchema, contextTreeCliErrorCodeSchema, contextTreeCliErrorEnvelopeSchema, contextTreeCliErrorSchema, contextTreeConnectionResultSchema, contextTreeConnectionSchema, contextTreePolicySchema, contextTreePublishResultSchema, contextTreeReadChildSchema, contextTreeReadNodeSchema, contextTreeReadResultSchema, contextTreeRootNodeFrontmatterSchema, contextTreeRootNodeSchema, contextTreeStateSchema, contextTreeSyncResultSchema, createProjectResultSchema, credentialFreeRepositoryUrlSchema, finishContextWriteResultSchema, githubRepositoryIdentitySchema, managedTreeListingEntrySchema, managedTreeListingResultSchema, parseContextTreeRootNode, prepareContextWriteResultSchema, treeNameSchema, treeValidationFindingSchema, validationCodeSchema, verifyTreeReportSchema };
package/dist/schemas.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as githubRepositoryIdentitySchema, D as validationCodeSchema, E as treeValidationFindingSchema, O as verifyTreeReportSchema, S as credentialFreeRepositoryUrlSchema, T as scaffoldTreeResultSchema, _ as contextTreeReadResultSchema, a as contextContentClassCountsSchema, b as contextTreeRootNodeSchema, c as contextTreeCliErrorEnvelopeSchema, d as contextTreeLinkResultSchema, f as contextTreeLinkSchema, g as contextTreeReadNodeSchema, h as contextTreeReadChildSchema, i as VALIDATION_CODES, l as contextTreeCliErrorSchema, m as contextTreeProjectIdentitySchema, n as CONTEXT_TREE_ROOT_NODE_MAX_BYTES, o as contextContentClassSchema, p as contextTreePolicySchema, r as SCHEMA_VERSION, s as contextTreeCliErrorCodeSchema, t as CLI_ERROR_CODES, u as contextTreeDiffResultSchema, v as contextTreeRefreshResultSchema, w as parseContextTreeRootNode, x as contextTreeStageResultSchema, y as contextTreeRootNodeFrontmatterSchema } from "./schemas-BWM6Q6iz.mjs";
2
- export { CLI_ERROR_CODES, CONTEXT_TREE_ROOT_NODE_MAX_BYTES, SCHEMA_VERSION, VALIDATION_CODES, contextContentClassCountsSchema, contextContentClassSchema, contextTreeCliErrorCodeSchema, contextTreeCliErrorEnvelopeSchema, contextTreeCliErrorSchema, contextTreeDiffResultSchema, contextTreeLinkResultSchema, contextTreeLinkSchema, contextTreePolicySchema, contextTreeProjectIdentitySchema, contextTreeReadChildSchema, contextTreeReadNodeSchema, contextTreeReadResultSchema, contextTreeRefreshResultSchema, contextTreeRootNodeFrontmatterSchema, contextTreeRootNodeSchema, contextTreeStageResultSchema, credentialFreeRepositoryUrlSchema, githubRepositoryIdentitySchema, parseContextTreeRootNode, scaffoldTreeResultSchema, treeValidationFindingSchema, validationCodeSchema, verifyTreeReportSchema };
1
+ import { A as treeNameSchema, C as credentialFreeRepositoryUrlSchema, D as managedTreeListingResultSchema, E as managedTreeListingEntrySchema, M as validationCodeSchema, N as verifyTreeReportSchema, O as parseContextTreeRootNode, S as createProjectResultSchema, T as githubRepositoryIdentitySchema, _ as contextTreeReadResultSchema, a as connectProjectResultSchema, b as contextTreeStateSchema, c as contextTreeCliErrorCodeSchema, d as contextTreeConnectionResultSchema, f as contextTreeConnectionSchema, g as contextTreeReadNodeSchema, h as contextTreeReadChildSchema, i as VALIDATION_CODES, j as treeValidationFindingSchema, k as prepareContextWriteResultSchema, l as contextTreeCliErrorEnvelopeSchema, m as contextTreePublishResultSchema, n as CONTEXT_TREE_ROOT_NODE_MAX_BYTES, o as contextContentClassCountsSchema, p as contextTreePolicySchema, r as SCHEMA_VERSION, s as contextContentClassSchema, t as CLI_ERROR_CODES, u as contextTreeCliErrorSchema, v as contextTreeRootNodeFrontmatterSchema, w as finishContextWriteResultSchema, x as contextTreeSyncResultSchema, y as contextTreeRootNodeSchema } from "./schemas-DKHE1sWt.mjs";
2
+ export { CLI_ERROR_CODES, CONTEXT_TREE_ROOT_NODE_MAX_BYTES, SCHEMA_VERSION, VALIDATION_CODES, connectProjectResultSchema, contextContentClassCountsSchema, contextContentClassSchema, contextTreeCliErrorCodeSchema, contextTreeCliErrorEnvelopeSchema, contextTreeCliErrorSchema, contextTreeConnectionResultSchema, contextTreeConnectionSchema, contextTreePolicySchema, contextTreePublishResultSchema, contextTreeReadChildSchema, contextTreeReadNodeSchema, contextTreeReadResultSchema, contextTreeRootNodeFrontmatterSchema, contextTreeRootNodeSchema, contextTreeStateSchema, contextTreeSyncResultSchema, createProjectResultSchema, credentialFreeRepositoryUrlSchema, finishContextWriteResultSchema, githubRepositoryIdentitySchema, managedTreeListingEntrySchema, managedTreeListingResultSchema, parseContextTreeRootNode, prepareContextWriteResultSchema, treeNameSchema, treeValidationFindingSchema, validationCodeSchema, verifyTreeReportSchema };