canopycms 0.0.16 → 0.0.18

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 (219) hide show
  1. package/README.md +120 -34
  2. package/dist/ai/generate.js +3 -3
  3. package/dist/ai/handler.js +5 -5
  4. package/dist/ai/index.js +3 -3
  5. package/dist/ai/json-to-markdown.js +1 -1
  6. package/dist/ai/json-to-markdown.js.map +1 -1
  7. package/dist/ai/resolve-branch.js +2 -2
  8. package/dist/api/__test__/mock-client.js +1 -1
  9. package/dist/api/assets.js +1 -1
  10. package/dist/api/branch-merge.js +3 -3
  11. package/dist/api/branch-review.js +4 -4
  12. package/dist/api/branch-status.js +8 -8
  13. package/dist/api/branch-withdraw.js +5 -5
  14. package/dist/api/branch.js +9 -9
  15. package/dist/api/comments.js +4 -4
  16. package/dist/api/content.d.ts.map +1 -1
  17. package/dist/api/content.js +17 -16
  18. package/dist/api/content.js.map +1 -1
  19. package/dist/api/entries.js +8 -8
  20. package/dist/api/github-sync.js +3 -3
  21. package/dist/api/groups.js +4 -4
  22. package/dist/api/guards.js +1 -1
  23. package/dist/api/index.js +3 -3
  24. package/dist/api/permissions.js +4 -4
  25. package/dist/api/reference-options.js +5 -5
  26. package/dist/api/resolve-references.js +4 -4
  27. package/dist/api/route-builder.js +1 -1
  28. package/dist/api/schema.js +5 -5
  29. package/dist/api/settings-helpers.js +1 -1
  30. package/dist/api/user.js +1 -1
  31. package/dist/api/validators.js +3 -3
  32. package/dist/asset-store.js +1 -1
  33. package/dist/auth/cache.js +2 -2
  34. package/dist/auth/caching-auth-plugin.js +1 -1
  35. package/dist/auth/file-based-auth-cache.js +1 -1
  36. package/dist/auth/index.js +1 -1
  37. package/dist/authorization/branch.js +1 -1
  38. package/dist/authorization/content.js +3 -3
  39. package/dist/authorization/groups/index.js +2 -2
  40. package/dist/authorization/groups/loader.js +4 -4
  41. package/dist/authorization/index.js +8 -8
  42. package/dist/authorization/path.js +1 -1
  43. package/dist/authorization/permissions/index.js +2 -2
  44. package/dist/authorization/permissions/loader.js +3 -3
  45. package/dist/authorization/permissions/schema.js +1 -1
  46. package/dist/authorization/test-utils.js +1 -1
  47. package/dist/authorization/validation.js +1 -1
  48. package/dist/branch-metadata.js +3 -3
  49. package/dist/branch-registry.js +2 -2
  50. package/dist/branch-schema-cache.js +2 -2
  51. package/dist/branch-workspace.js +6 -6
  52. package/dist/build/generate-ai-content.js +4 -4
  53. package/dist/build/index.js +1 -1
  54. package/dist/cli/cli.js +5 -5
  55. package/dist/cli/generate-ai-content.js +40 -29
  56. package/dist/cli/init.d.ts +5 -0
  57. package/dist/cli/init.d.ts.map +1 -1
  58. package/dist/cli/init.js +68 -25
  59. package/dist/cli/init.js.map +1 -1
  60. package/dist/cli/sync.js +1 -1
  61. package/dist/cli/template-files/canopy.ts.template +10 -6
  62. package/dist/cli/template-files/edit-page-dev.tsx.template +16 -0
  63. package/dist/cli/template-files/edit-page.tsx.template +14 -21
  64. package/dist/cli/template-files/middleware-clerk.ts.template +13 -0
  65. package/dist/cli/template-files/middleware.ts.template +30 -0
  66. package/dist/cli/template-files/next.config-static.ts.template +13 -0
  67. package/dist/cli/template-files/next.config.ts.template +5 -0
  68. package/dist/cli/template-files/schemas.ts.template +4 -2
  69. package/dist/cli/templates.d.ts +8 -0
  70. package/dist/cli/templates.d.ts.map +1 -1
  71. package/dist/cli/templates.js +22 -2
  72. package/dist/cli/templates.js.map +1 -1
  73. package/dist/client.js +9 -9
  74. package/dist/config/flatten.js +2 -2
  75. package/dist/config/helpers.js +3 -3
  76. package/dist/config/index.js +9 -9
  77. package/dist/config/schemas/collection.js +1 -1
  78. package/dist/config/schemas/config.js +2 -2
  79. package/dist/config/schemas/field.d.ts +21 -0
  80. package/dist/config/schemas/field.d.ts.map +1 -1
  81. package/dist/config/schemas/field.js +2 -1
  82. package/dist/config/schemas/field.js.map +1 -1
  83. package/dist/config/types.d.ts +7 -0
  84. package/dist/config/types.d.ts.map +1 -1
  85. package/dist/config/validation.js +2 -2
  86. package/dist/config-test.js +2 -2
  87. package/dist/config.js +2 -2
  88. package/dist/content-id-index.js +2 -2
  89. package/dist/content-listing.d.ts +3 -2
  90. package/dist/content-listing.d.ts.map +1 -1
  91. package/dist/content-listing.js +15 -12
  92. package/dist/content-listing.js.map +1 -1
  93. package/dist/content-reader.d.ts.map +1 -1
  94. package/dist/content-reader.js +18 -14
  95. package/dist/content-reader.js.map +1 -1
  96. package/dist/content-store.d.ts +5 -0
  97. package/dist/content-store.d.ts.map +1 -1
  98. package/dist/content-store.js +34 -24
  99. package/dist/content-store.js.map +1 -1
  100. package/dist/content-tree.d.ts.map +1 -1
  101. package/dist/content-tree.js +8 -3
  102. package/dist/content-tree.js.map +1 -1
  103. package/dist/context.d.ts +38 -7
  104. package/dist/context.d.ts.map +1 -1
  105. package/dist/context.js +38 -6
  106. package/dist/context.js.map +1 -1
  107. package/dist/editor/BranchManager.js +4 -4
  108. package/dist/editor/CanopyEditor.js +3 -3
  109. package/dist/editor/CanopyEditorPage.js +1 -1
  110. package/dist/editor/CommentsPanel.js +1 -1
  111. package/dist/editor/Editor.js +18 -18
  112. package/dist/editor/EntryNavigator.js +1 -1
  113. package/dist/editor/FormRenderer.js +12 -12
  114. package/dist/editor/GroupManager.js +1 -1
  115. package/dist/editor/PermissionManager.js +1 -1
  116. package/dist/editor/client-reference-resolver.js +1 -1
  117. package/dist/editor/comments/BranchComments.js +1 -1
  118. package/dist/editor/comments/EntryComments.js +1 -1
  119. package/dist/editor/comments/FieldWrapper.js +1 -1
  120. package/dist/editor/comments/InlineCommentThread.js +1 -1
  121. package/dist/editor/comments/ThreadCarousel.js +1 -1
  122. package/dist/editor/components/EditorHeader.js +1 -1
  123. package/dist/editor/components/UserBadge.js +1 -1
  124. package/dist/editor/components/index.js +3 -3
  125. package/dist/editor/context/ApiClientContext.js +1 -1
  126. package/dist/editor/context/index.js +2 -2
  127. package/dist/editor/editor-config.js +2 -2
  128. package/dist/editor/editor-config.js.map +1 -1
  129. package/dist/editor/editor-utils.js +1 -1
  130. package/dist/editor/fields/BlockField.js +1 -1
  131. package/dist/editor/fields/ObjectField.js +1 -1
  132. package/dist/editor/fields/ReferenceField.js +1 -1
  133. package/dist/editor/group-manager/GroupCard.js +1 -1
  134. package/dist/editor/group-manager/InternalGroupsTab.js +1 -1
  135. package/dist/editor/group-manager/MemberList.js +1 -1
  136. package/dist/editor/group-manager/index.js +9 -9
  137. package/dist/editor/hooks/__test__/test-utils.js +3 -3
  138. package/dist/editor/hooks/index.js +11 -11
  139. package/dist/editor/hooks/useBranchActions.js +1 -1
  140. package/dist/editor/hooks/useBranchManager.js +1 -1
  141. package/dist/editor/hooks/useCommentSystem.js +2 -2
  142. package/dist/editor/hooks/useDraftManager.js +1 -1
  143. package/dist/editor/hooks/useEntryManager.js +3 -3
  144. package/dist/editor/hooks/useGroupManager.js +1 -1
  145. package/dist/editor/hooks/usePermissionManager.js +1 -1
  146. package/dist/editor/hooks/useReferenceResolution.js +1 -1
  147. package/dist/editor/hooks/useSchemaManager.js +1 -1
  148. package/dist/editor/hooks/useUserContext.js +1 -1
  149. package/dist/editor/permission-manager/PermissionEditor.js +4 -4
  150. package/dist/editor/permission-manager/PermissionLevelBadge.js +1 -1
  151. package/dist/editor/permission-manager/PermissionTree.js +3 -3
  152. package/dist/editor/permission-manager/UserSelector.js +1 -1
  153. package/dist/editor/permission-manager/hooks/usePermissionTree.js +2 -2
  154. package/dist/editor/permission-manager/index.js +6 -6
  155. package/dist/editor/preview-bridge.js +1 -1
  156. package/dist/editor/schema-editor/CollectionEditor.js +2 -2
  157. package/dist/editor/schema-editor/index.js +2 -2
  158. package/dist/entry-schema-registry.d.ts.map +1 -1
  159. package/dist/entry-schema-registry.js +12 -3
  160. package/dist/entry-schema-registry.js.map +1 -1
  161. package/dist/entry-schema.d.ts +1 -0
  162. package/dist/entry-schema.d.ts.map +1 -1
  163. package/dist/entry-schema.js.map +1 -1
  164. package/dist/git-manager.js +4 -4
  165. package/dist/github-service.d.ts.map +1 -1
  166. package/dist/github-service.js +12 -8
  167. package/dist/github-service.js.map +1 -1
  168. package/dist/http/handler.js +7 -7
  169. package/dist/http/index.js +3 -3
  170. package/dist/http/router.js +12 -12
  171. package/dist/id.js +1 -1
  172. package/dist/index.d.ts +1 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +7 -6
  175. package/dist/index.js.map +1 -1
  176. package/dist/operating-mode/client-unsafe-strategy.js +2 -2
  177. package/dist/operating-mode/client.js +1 -1
  178. package/dist/operating-mode/index.js +2 -2
  179. package/dist/paths/branch.js +1 -1
  180. package/dist/paths/index.d.ts +1 -1
  181. package/dist/paths/index.d.ts.map +1 -1
  182. package/dist/paths/index.js +6 -6
  183. package/dist/paths/index.js.map +1 -1
  184. package/dist/paths/normalize.d.ts +8 -0
  185. package/dist/paths/normalize.d.ts.map +1 -1
  186. package/dist/paths/normalize.js +17 -0
  187. package/dist/paths/normalize.js.map +1 -1
  188. package/dist/paths/test-utils.js +1 -1
  189. package/dist/paths/validation.js +1 -1
  190. package/dist/reference-resolver.js +1 -1
  191. package/dist/schema/index.js +2 -2
  192. package/dist/schema/meta-loader.js +1 -1
  193. package/dist/schema/resolver.js +1 -1
  194. package/dist/schema/schema-store.js +4 -4
  195. package/dist/server.js +13 -13
  196. package/dist/services.js +12 -12
  197. package/dist/settings-branch-utils.js +1 -1
  198. package/dist/settings-workspace.js +3 -3
  199. package/dist/task-queue/index.js +1 -1
  200. package/dist/task-queue/task-queue.js +1 -1
  201. package/dist/url-path-resolver.d.ts +16 -0
  202. package/dist/url-path-resolver.d.ts.map +1 -0
  203. package/dist/url-path-resolver.js +31 -0
  204. package/dist/url-path-resolver.js.map +1 -0
  205. package/dist/user.js +1 -1
  206. package/dist/utils/body-field.d.ts +18 -0
  207. package/dist/utils/body-field.d.ts.map +1 -0
  208. package/dist/utils/body-field.js +39 -0
  209. package/dist/utils/body-field.js.map +1 -0
  210. package/dist/utils/fs.js +1 -1
  211. package/dist/utils/sanitize-href.d.ts +19 -0
  212. package/dist/utils/sanitize-href.d.ts.map +1 -0
  213. package/dist/utils/sanitize-href.js +30 -0
  214. package/dist/utils/sanitize-href.js.map +1 -0
  215. package/dist/validation/reference-validator.js +2 -2
  216. package/dist/worker/cms-worker.js +5 -5
  217. package/dist/worker/task-queue-config.js +1 -1
  218. package/dist/worker/task-queue.js +2 -2
  219. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { loadInternalGroups, saveInternalGroups, loadGroupsFile, RESERVED_GROUPS, isReservedGroup, } from '../authorization';
3
- import { defineEndpoint } from './route-builder';
4
- import { getSettingsBranchContext, commitSettings } from './settings-helpers';
5
- import { generateId } from '../id';
2
+ import { loadInternalGroups, saveInternalGroups, loadGroupsFile, RESERVED_GROUPS, isReservedGroup, } from '../authorization/index.js';
3
+ import { defineEndpoint } from './route-builder.js';
4
+ import { getSettingsBranchContext, commitSettings } from './settings-helpers.js';
5
+ import { generateId } from '../id.js';
6
6
  // ============================================================================
7
7
  // Zod Schemas for Validation
8
8
  // ============================================================================
@@ -15,7 +15,7 @@
15
15
  * })
16
16
  * ```
17
17
  */
18
- import { isAdmin, isReviewer, isPrivileged } from '../authorization/helpers';
18
+ import { isAdmin, isReviewer, isPrivileged } from '../authorization/helpers.js';
19
19
  // ============================================================================
20
20
  // Guard runner implementations
21
21
  // ============================================================================
package/dist/api/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // Content API uses path-based routing now - no separate params/body types exported
2
2
  // Export route definitions
3
- export { USER_ROUTES } from './user';
3
+ export { USER_ROUTES } from './user.js';
4
4
  // Note: SCHEMA_ROUTES is not exported here because it imports server-only code (fs module).
5
- // Import it directly from './schema' in server-side code when needed.
5
+ // Import it directly from './schema.js' in server-side code when needed.
6
6
  // Export client
7
- export { CanopyApiClient, createApiClient } from './client';
7
+ export { CanopyApiClient, createApiClient } from './client.js';
8
8
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { loadPathPermissions, savePathPermissions, loadPermissionsFile } from '../authorization';
3
- import { permissionPathSchema } from './validators';
4
- import { defineEndpoint } from './route-builder';
5
- import { getSettingsBranchContext, commitSettings } from './settings-helpers';
2
+ import { loadPathPermissions, savePathPermissions, loadPermissionsFile } from '../authorization/index.js';
3
+ import { permissionPathSchema } from './validators.js';
4
+ import { defineEndpoint } from './route-builder.js';
5
+ import { getSettingsBranchContext, commitSettings } from './settings-helpers.js';
6
6
  // ============================================================================
7
7
  // Zod Schemas for Validation
8
8
  // ============================================================================
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { ContentStore } from '../content-store';
3
- import { defineEndpoint } from './route-builder';
4
- import { ReferenceResolver } from '../reference-resolver';
5
- import { parseLogicalPath } from '../paths';
6
- import { branchNameSchema } from './validators';
2
+ import { ContentStore } from '../content-store.js';
3
+ import { defineEndpoint } from './route-builder.js';
4
+ import { ReferenceResolver } from '../reference-resolver.js';
5
+ import { parseLogicalPath } from '../paths/index.js';
6
+ import { branchNameSchema } from './validators.js';
7
7
  // ============================================================================
8
8
  // Zod Schemas for Validation
9
9
  // ============================================================================
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { ContentStore } from '../content-store';
3
- import { defineEndpoint } from './route-builder';
4
- import { ReferenceResolver } from '../reference-resolver';
5
- import { branchNameSchema, contentIdSchema } from './validators';
2
+ import { ContentStore } from '../content-store.js';
3
+ import { defineEndpoint } from './route-builder.js';
4
+ import { ReferenceResolver } from '../reference-resolver.js';
5
+ import { branchNameSchema, contentIdSchema } from './validators.js';
6
6
  // ============================================================================
7
7
  // Zod Schemas for Validation
8
8
  // ============================================================================
@@ -8,7 +8,7 @@
8
8
  * - Makes code generation trivial (no regex parsing needed)
9
9
  * - Self-documents the API surface
10
10
  */
11
- import { executeGuards } from './guards';
11
+ import { executeGuards } from './guards.js';
12
12
  /**
13
13
  * Global registry - generator reads this
14
14
  */
@@ -11,11 +11,11 @@
11
11
  */
12
12
  import { z } from 'zod';
13
13
  import path from 'node:path';
14
- import { defineEndpoint } from './route-builder';
15
- import { getErrorMessage } from '../utils/error';
16
- import { branchNameSchema, logicalPathSchema } from './validators';
17
- import { SchemaOps, createCollectionInputSchema, updateCollectionInputSchema, entryTypeInputSchema, updateEntryTypeInputSchema, } from '../schema/schema-store';
18
- import { parseLogicalPath } from '../paths';
14
+ import { defineEndpoint } from './route-builder.js';
15
+ import { getErrorMessage } from '../utils/error.js';
16
+ import { branchNameSchema, logicalPathSchema } from './validators.js';
17
+ import { SchemaOps, createCollectionInputSchema, updateCollectionInputSchema, entryTypeInputSchema, updateEntryTypeInputSchema, } from '../schema/schema-store.js';
18
+ import { parseLogicalPath } from '../paths/index.js';
19
19
  /**
20
20
  * Resolve the schemaRef for an entry type. Uses the explicit schemaRef if set,
21
21
  * otherwise does a reverse lookup in the registry by matching the schema array.
@@ -1,4 +1,4 @@
1
- import { operatingStrategy } from '../operating-mode';
1
+ import { operatingStrategy } from '../operating-mode/index.js';
2
2
  /**
3
3
  * Get the appropriate root path for settings (permissions/groups).
4
4
  * Returns the settings root managed by the settings workspace.
package/dist/api/user.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineEndpoint } from './route-builder';
1
+ import { defineEndpoint } from './route-builder.js';
2
2
  /**
3
3
  * Get current user info
4
4
  * This is a PUBLIC endpoint - no special permissions required
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Usage:
8
8
  * ```ts
9
- * import { branchNameSchema, logicalPathSchema } from './validators'
9
+ * import { branchNameSchema, logicalPathSchema } from './validators.js'
10
10
  *
11
11
  * const paramsSchema = z.object({
12
12
  * branch: branchNameSchema,
@@ -20,8 +20,8 @@
20
20
  * ```
21
21
  */
22
22
  import { z } from 'zod';
23
- import { parseBranchName, parseLogicalPath, parseContentId, parseSlug, } from '../paths';
24
- import { parsePermissionPath } from '../authorization';
23
+ import { parseBranchName, parseLogicalPath, parseContentId, parseSlug, } from '../paths/index.js';
24
+ import { parsePermissionPath } from '../authorization/index.js';
25
25
  /**
26
26
  * Zod schema for BranchName - validates git branch naming rules and brands.
27
27
  *
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { isNotFoundError } from './utils/error';
3
+ import { isNotFoundError } from './utils/error.js';
4
4
  const normalizeKey = (key) => key.replace(/^\/+/, '');
5
5
  /**
6
6
  * Local filesystem asset store for dev and tests. In production, swap with S3 adapter.
@@ -3,6 +3,6 @@
3
3
  * These use node:fs/promises and must NOT be imported in client bundles.
4
4
  * Use 'canopycms/auth/cache' as the import path.
5
5
  */
6
- export { FileBasedAuthCache, writeAuthCacheSnapshot } from './file-based-auth-cache';
7
- export { CachingAuthPlugin } from './caching-auth-plugin';
6
+ export { FileBasedAuthCache, writeAuthCacheSnapshot } from './file-based-auth-cache.js';
7
+ export { CachingAuthPlugin } from './caching-auth-plugin.js';
8
8
  //# sourceMappingURL=cache.js.map
@@ -1,4 +1,4 @@
1
- import { createDebugLogger } from '../utils/debug';
1
+ import { createDebugLogger } from '../utils/debug.js';
2
2
  const log = createDebugLogger({ prefix: 'CachingAuthPlugin' });
3
3
  /**
4
4
  * Auth plugin that wraps a token verifier with cached metadata lookups.
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { createDebugLogger } from '../utils/debug';
3
+ import { createDebugLogger } from '../utils/debug.js';
4
4
  const log = createDebugLogger({ prefix: 'FileBasedAuthCache' });
5
5
  /**
6
6
  * Resolve the active cache directory.
@@ -1,2 +1,2 @@
1
- export { isCanopyRequest, isHeadersLike, extractHeaders, validateAuthContext, } from './context-helpers';
1
+ export { isCanopyRequest, isHeadersLike, extractHeaders, validateAuthContext, } from './context-helpers.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Handles checking if a user can access a branch based on ACLs.
5
5
  */
6
- import { isAdmin, isReviewer } from './helpers';
6
+ import { isAdmin, isReviewer } from './helpers.js';
7
7
  /**
8
8
  * Check if user has access to a branch with explicit default behavior.
9
9
  */
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Usage:
8
8
  * ```ts
9
- * import { checkContentAccess } from './authorization'
9
+ * import { checkContentAccess } from './authorization.js'
10
10
  *
11
11
  * const result = await checkContentAccess(deps, context, branchRoot, 'content/posts/my-post.mdx', user, 'edit')
12
12
  * if (result.allowed) {
@@ -14,8 +14,8 @@
14
14
  * }
15
15
  * ```
16
16
  */
17
- import { operatingStrategy } from '../operating-mode';
18
- import { createCheckPathAccess } from './path';
17
+ import { operatingStrategy } from '../operating-mode/index.js';
18
+ import { createCheckPathAccess } from './path.js';
19
19
  /**
20
20
  * Check content access by evaluating both branch and path permissions.
21
21
  * Path permissions are loaded dynamically from the branch root.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Groups module exports
3
3
  */
4
- export { GroupsFileSchema, createDefaultGroupsFile, } from './schema';
5
- export { loadGroupsFile, loadInternalGroups, saveInternalGroups } from './loader';
4
+ export { GroupsFileSchema, createDefaultGroupsFile, } from './schema.js';
5
+ export { loadGroupsFile, loadInternalGroups, saveInternalGroups } from './loader.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -4,10 +4,10 @@
4
4
  * Handles loading and saving internal groups from the filesystem.
5
5
  */
6
6
  import { promises as fs } from 'node:fs';
7
- import { GroupsFileSchema } from './schema';
8
- import { operatingStrategy } from '../../operating-mode';
9
- import { RESERVED_GROUPS } from '../helpers';
10
- import { atomicWriteFile } from '../../utils/atomic-write';
7
+ import { GroupsFileSchema } from './schema.js';
8
+ import { operatingStrategy } from '../../operating-mode/index.js';
9
+ import { RESERVED_GROUPS } from '../helpers.js';
10
+ import { atomicWriteFile } from '../../utils/atomic-write.js';
11
11
  /**
12
12
  * Get the appropriate groups file path based on mode
13
13
  */
@@ -8,7 +8,7 @@
8
8
  * For most use cases, use `checkContentAccess` which handles both branch and path permissions:
9
9
  *
10
10
  * ```ts
11
- * import { checkContentAccess } from './authorization'
11
+ * import { checkContentAccess } from './authorization.js'
12
12
  *
13
13
  * const result = await checkContentAccess(deps, context, branchRoot, 'content/posts/post.mdx', user, 'edit')
14
14
  * if (result.allowed) {
@@ -26,17 +26,17 @@
26
26
  * - `groups/` - Groups file schema and loader
27
27
  */
28
28
  // Validation
29
- export { parsePermissionPath } from './validation';
29
+ export { parsePermissionPath } from './validation.js';
30
30
  // Main content access (recommended for most cases)
31
- export { checkContentAccess, createCheckContentAccess } from './content';
31
+ export { checkContentAccess, createCheckContentAccess } from './content.js';
32
32
  // Branch-level access
33
- export { checkBranchAccessWithDefault, createCheckBranchAccess, canPerformWorkflowAction, } from './branch';
33
+ export { checkBranchAccessWithDefault, createCheckBranchAccess, canPerformWorkflowAction, } from './branch.js';
34
34
  // Path-level access
35
- export { checkPathAccess, createCheckPathAccess } from './path';
35
+ export { checkPathAccess, createCheckPathAccess } from './path.js';
36
36
  // Helper functions
37
- export { RESERVED_GROUPS, isReservedGroup, isAdmin, isReviewer, isPrivileged, } from './helpers';
37
+ export { RESERVED_GROUPS, isReservedGroup, isAdmin, isReviewer, isPrivileged, } from './helpers.js';
38
38
  // Permissions file handling
39
- export { PermissionsFileSchema, createDefaultPermissionsFile, loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './permissions';
39
+ export { PermissionsFileSchema, createDefaultPermissionsFile, loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './permissions/index.js';
40
40
  // Groups file handling
41
- export { GroupsFileSchema, createDefaultGroupsFile, loadGroupsFile, loadInternalGroups, saveInternalGroups, } from './groups';
41
+ export { GroupsFileSchema, createDefaultGroupsFile, loadGroupsFile, loadInternalGroups, saveInternalGroups, } from './groups/index.js';
42
42
  //# sourceMappingURL=index.js.map
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import path from 'node:path';
7
7
  import { minimatch } from 'minimatch';
8
- import { isAdmin } from './helpers';
8
+ import { isAdmin } from './helpers.js';
9
9
  /**
10
10
  * Normalize a path for consistent matching
11
11
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Permissions module exports
3
3
  */
4
- export { PermissionsFileSchema, createDefaultPermissionsFile } from './schema';
5
- export { loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './loader';
4
+ export { PermissionsFileSchema, createDefaultPermissionsFile } from './schema.js';
5
+ export { loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './loader.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -4,9 +4,9 @@
4
4
  * Handles loading and saving path permissions from the filesystem.
5
5
  */
6
6
  import fs from 'node:fs/promises';
7
- import { PermissionsFileSchema } from './schema';
8
- import { operatingStrategy } from '../../operating-mode';
9
- import { atomicWriteFile } from '../../utils/atomic-write';
7
+ import { PermissionsFileSchema } from './schema.js';
8
+ import { operatingStrategy } from '../../operating-mode/index.js';
9
+ import { atomicWriteFile } from '../../utils/atomic-write.js';
10
10
  /**
11
11
  * Get the appropriate permissions file path based on mode
12
12
  */
@@ -2,7 +2,7 @@
2
2
  * Schema for permissions.json file
3
3
  */
4
4
  import { z } from 'zod';
5
- import { parsePermissionPath } from '../validation';
5
+ import { parsePermissionPath } from '../validation.js';
6
6
  const permissionTargetSchema = z.object({
7
7
  allowedUsers: z.array(z.string()).optional(),
8
8
  allowedGroups: z.array(z.string()).optional(),
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @example
8
8
  * // In test files only:
9
- * import { unsafeAsPermissionPath } from '../authorization/test-utils'
9
+ * import { unsafeAsPermissionPath } from '../authorization/test-utils.js'
10
10
  */
11
11
  /** Test-only: cast a string to PermissionPath without validation. */
12
12
  export const unsafeAsPermissionPath = (path) => path;
@@ -4,7 +4,7 @@
4
4
  * SECURITY CRITICAL: These functions validate permission paths
5
5
  * to prevent path traversal attacks.
6
6
  */
7
- import { hasTraversalSequence } from '../paths/normalize';
7
+ import { hasTraversalSequence } from '../paths/normalize.js';
8
8
  /**
9
9
  * Parse and validate a PermissionPath.
10
10
  *
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import fs from 'node:fs/promises';
3
3
  import path from 'node:path';
4
- import { BranchRegistry } from './branch-registry';
5
- import { resolveBranchPath } from './paths';
6
- import { isFileExistsError, isNotFoundError } from './utils/error';
4
+ import { BranchRegistry } from './branch-registry.js';
5
+ import { resolveBranchPath } from './paths/index.js';
6
+ import { isFileExistsError, isNotFoundError } from './utils/error.js';
7
7
  const BRANCH_META_DIR = '.canopy-meta';
8
8
  const BRANCH_META_FILE = 'branch.json';
9
9
  const CURRENT_SCHEMA_VERSION = 1;
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { BranchMetadataFileManager } from './branch-metadata';
4
- import { isNotFoundError } from './utils/error';
3
+ import { BranchMetadataFileManager } from './branch-metadata.js';
4
+ import { isNotFoundError } from './utils/error.js';
5
5
  // Registry files are stored directly in the branches root (not in a subdirectory)
6
6
  const REGISTRY_FILE = 'branches.json';
7
7
  const REGISTRY_STALE_FILE = 'branches.stale.json';
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { resolveSchema, isValidSchema } from './schema/resolver';
4
- import { flattenSchema } from './config/flatten';
3
+ import { resolveSchema, isValidSchema } from './schema/resolver.js';
4
+ import { flattenSchema } from './config/flatten.js';
5
5
  /** Bump when BranchSchemaCacheEntry shape changes to auto-invalidate stale caches */
6
6
  const SCHEMA_CACHE_VERSION = 2;
7
7
  /** Minimum interval between mtime staleness checks (ms) */
@@ -1,8 +1,8 @@
1
- import { ensureBranchRoot } from './paths';
2
- import { getBranchMetadataFileManager, loadBranchContext } from './branch-metadata';
3
- import { isDeployedStatic } from './build-mode';
4
- import { GitManager } from './git-manager';
5
- import { createDebugLogger } from './utils/debug';
1
+ import { ensureBranchRoot } from './paths/index.js';
2
+ import { getBranchMetadataFileManager, loadBranchContext } from './branch-metadata.js';
3
+ import { isDeployedStatic } from './build-mode.js';
4
+ import { GitManager } from './git-manager.js';
5
+ import { createDebugLogger } from './utils/debug.js';
6
6
  const log = createDebugLogger({ prefix: 'BranchWorkspace' });
7
7
  // In-memory lock to prevent concurrent workspace initialization
8
8
  const workspaceInitLocks = new Map();
@@ -84,7 +84,7 @@ export class BranchWorkspaceManager {
84
84
  };
85
85
  }
86
86
  }
87
- export { loadBranchContext } from './branch-metadata';
87
+ export { loadBranchContext } from './branch-metadata.js';
88
88
  /**
89
89
  * Load an existing branch context, or create the workspace if it doesn't exist yet.
90
90
  *
@@ -6,10 +6,10 @@
6
6
  */
7
7
  import fs from 'node:fs/promises';
8
8
  import path from 'node:path';
9
- import { ContentStore } from '../content-store';
10
- import { BranchSchemaCache } from '../branch-schema-cache';
11
- import { generateAIContent } from '../ai/generate';
12
- import { resolveBranchRoot } from '../ai/resolve-branch';
9
+ import { ContentStore } from '../content-store.js';
10
+ import { BranchSchemaCache } from '../branch-schema-cache.js';
11
+ import { generateAIContent } from '../ai/generate.js';
12
+ import { resolveBranchRoot } from '../ai/resolve-branch.js';
13
13
  /**
14
14
  * Generate AI content files and write them to disk.
15
15
  *
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * Provides static build utilities for pre-generating content.
5
5
  */
6
- export { generateAIContentFiles } from './generate-ai-content';
6
+ export { generateAIContentFiles } from './generate-ai-content.js';
7
7
  //# sourceMappingURL=index.js.map
package/dist/cli/cli.js CHANGED
@@ -33,7 +33,7 @@ export function resolveSyncDirection(push, pull, abort) {
33
33
  async function main() {
34
34
  const { argv, flags, command } = parseArgs(process.argv.slice(2));
35
35
  if (command === 'init') {
36
- const { init } = await import('./init');
36
+ const { init } = await import('./init.js');
37
37
  const nonInteractive = flags['non-interactive'] === true;
38
38
  const force = flags['force'] === true;
39
39
  const mode = 'dev';
@@ -84,7 +84,7 @@ async function main() {
84
84
  });
85
85
  }
86
86
  else if (command === 'init-deploy') {
87
- const { initDeployAws } = await import('./init');
87
+ const { initDeployAws } = await import('./init.js');
88
88
  const cloud = argv._[1];
89
89
  if (cloud !== 'aws') {
90
90
  console.error('Usage: canopycms init-deploy aws');
@@ -99,7 +99,7 @@ async function main() {
99
99
  });
100
100
  }
101
101
  else if (command === 'worker') {
102
- const { workerRunOnce } = await import('./init');
102
+ const { workerRunOnce } = await import('./init.js');
103
103
  const subcommand = argv._[1];
104
104
  if (subcommand !== 'run-once') {
105
105
  console.error('Usage: canopycms worker run-once');
@@ -127,7 +127,7 @@ async function main() {
127
127
  await workerRunOnce({ projectDir: process.cwd(), authPlugin });
128
128
  }
129
129
  else if (command === 'generate-ai-content') {
130
- const { generateAIContentCLI } = await import('./generate-ai-content');
130
+ const { generateAIContentCLI } = await import('./generate-ai-content.js');
131
131
  await generateAIContentCLI({
132
132
  projectDir: process.cwd(),
133
133
  outputDir: typeof flags['output'] === 'string' ? flags['output'] : undefined,
@@ -136,7 +136,7 @@ async function main() {
136
136
  });
137
137
  }
138
138
  else if (command === 'sync') {
139
- const { sync } = await import('./sync');
139
+ const { sync } = await import('./sync.js');
140
140
  const direction = resolveSyncDirection(flags['push'] === true, flags['pull'] === true, flags['abort'] === true);
141
141
  await sync({
142
142
  projectDir: process.cwd(),