better-notion 1.8.0__py3-none-any.whl → 1.8.1__py3-none-any.whl

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.
@@ -156,12 +156,23 @@ class AgentsPlugin(CombinedPluginInterface):
156
156
 
157
157
  if existing:
158
158
  database_ids = existing.get("database_ids", {})
159
+
160
+ # Save workspace config for subsequent commands
161
+ # This fixes the bug where --skip detected workspace but didn't save config,
162
+ # causing subsequent commands (agents orgs create, etc.) to fail
163
+ initializer._database_ids = database_ids
164
+ initializer._parent_page_id = parent_page_id
165
+ initializer._workspace_id = existing.get("workspace_id")
166
+ initializer._workspace_name = existing.get("workspace_name", workspace_name)
167
+ initializer.save_database_ids()
168
+
159
169
  return format_success(
160
170
  {
161
171
  "message": "Workspace already exists, skipping initialization",
162
172
  "workspace_id": existing.get("workspace_id"),
163
173
  "databases_found": len(database_ids),
164
174
  "database_ids": database_ids,
175
+ "config_saved": True,
165
176
  },
166
177
  meta={
167
178
  "command": "agents init",
@@ -203,18 +203,24 @@ class Organization(BaseEntity):
203
203
  }
204
204
 
205
205
  if slug:
206
- properties["Slug"] = RichText(slug)
206
+ properties["Slug"] = RichText(name="Slug", content=slug)
207
207
  if description:
208
- properties["Description"] = RichText(description)
208
+ properties["Description"] = RichText(name="Description", content=description)
209
209
  if repository_url:
210
- properties["Repository URL"] = URL(repository_url)
210
+ properties["Repository URL"] = URL(name="Repository URL", url=repository_url)
211
211
  if status:
212
- properties["Status"] = Select(status)
212
+ properties["Status"] = Select(name="Status", value=status)
213
+
214
+ # Convert Property objects to dicts for API
215
+ serialized_properties = {
216
+ key: prop.to_dict() if hasattr(prop, 'to_dict') else prop
217
+ for key, prop in properties.items()
218
+ }
213
219
 
214
220
  # Create page
215
221
  data = await client._api.pages.create(
216
222
  parent={"database_id": database_id},
217
- properties=properties,
223
+ properties=serialized_properties,
218
224
  )
219
225
 
220
226
  org = cls(client, data)
@@ -490,24 +496,30 @@ class Project(BaseEntity):
490
496
  properties: dict[str, Any] = {
491
497
  "Name": Title(name),
492
498
  "Organization": Relation([organization_id]),
493
- "Role": Select(role),
499
+ "Role": Select(name="Role", value=role),
494
500
  }
495
501
 
496
502
  if slug:
497
- properties["Slug"] = RichText(slug)
503
+ properties["Slug"] = RichText(name="Slug", content=slug)
498
504
  if description:
499
- properties["Description"] = RichText(description)
505
+ properties["Description"] = RichText(name="Description", content=description)
500
506
  if repository:
501
- properties["Repository"] = URL(repository)
507
+ properties["Repository"] = URL(name="Repository", url=repository)
502
508
  if status:
503
- properties["Status"] = Select(status)
509
+ properties["Status"] = Select(name="Status", value=status)
504
510
  if tech_stack:
505
- properties["Tech Stack"] = MultiSelect(tech_stack)
511
+ properties["Tech Stack"] = MultiSelect(name="Tech Stack", values=tech_stack)
512
+
513
+ # Convert Property objects to dicts for API
514
+ serialized_properties = {
515
+ key: prop.to_dict() if hasattr(prop, 'to_dict') else prop
516
+ for key, prop in properties.items()
517
+ }
506
518
 
507
519
  # Create page
508
520
  data = await client._api.pages.create(
509
521
  parent={"database_id": database_id},
510
- properties=properties,
522
+ properties=serialized_properties,
511
523
  )
512
524
 
513
525
  project = cls(client, data)
@@ -351,6 +351,9 @@ class WorkspaceInitializer:
351
351
  def save_database_ids(self, path: Optional[Path] = None) -> None:
352
352
  """Save workspace metadata (database IDs and workspace info) to config file.
353
353
 
354
+ Saves database IDs at top level with capitalized keys (e.g., "Organizations", "Projects")
355
+ to match what SDK managers expect. Also saves under "database_ids" for compatibility.
356
+
354
357
  Args:
355
358
  path: Path to save config file (default: ~/.notion/workspace.json)
356
359
  """
@@ -359,14 +362,21 @@ class WorkspaceInitializer:
359
362
 
360
363
  path.parent.mkdir(parents=True, exist_ok=True)
361
364
 
365
+ # Map lowercase keys to capitalized keys for SDK manager compatibility
366
+ database_ids_capitalized = {
367
+ key.capitalize(): value for key, value in self._database_ids.items()
368
+ }
369
+
362
370
  # Save full workspace metadata
371
+ # Database IDs are saved at top level with capitalized keys for SDK managers
363
372
  config = {
364
373
  "workspace_id": self._workspace_id,
365
374
  "workspace_name": self._workspace_name,
366
375
  "parent_page": self._parent_page_id,
367
376
  "initialized_at": datetime.now(timezone.utc).isoformat(),
368
377
  "version": "1.5.4",
369
- "database_ids": self._database_ids
378
+ **database_ids_capitalized, # Save at top level: "Organizations", "Projects", etc.
379
+ "database_ids": self._database_ids, # Also save under database_ids for compatibility
370
380
  }
371
381
 
372
382
  with open(path, "w", encoding="utf-8") as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: better-notion
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: A high-level Python SDK for the Notion API with developer experience in mind.
5
5
  Project-URL: Homepage, https://github.com/nesalia-inc/better-notion
6
6
  Project-URL: Documentation, https://github.com/nesalia-inc/better-notion#readme
@@ -111,13 +111,13 @@ better_notion/plugins/base.py,sha256=3h9jOZzS--UqmVW3RREtcQ2h1GTWWPUryTencsJKhTM
111
111
  better_notion/plugins/loader.py,sha256=zCWsMdJyvZs1IHFm0zjEiqm_l_5jB1Uw4x30Kq8rLS4,9527
112
112
  better_notion/plugins/state.py,sha256=jH_tZWvC35hqLO4qwl2Kwq9ziWVavwCEUcCqy3s5wMY,3780
113
113
  better_notion/plugins/official/__init__.py,sha256=rPg5vdk1cEANVstMPzxcWmImtsOpdSR40JSml7h1uUk,426
114
- better_notion/plugins/official/agents.py,sha256=OHX-vmEsab8b-tMljXJLOB9YRpq1oG125FTK7mtm23A,50667
114
+ better_notion/plugins/official/agents.py,sha256=nbqfUPsJCCY3R8c1FvOi3CfP1lVhWkp0Rw6Okm6CrTE,51440
115
115
  better_notion/plugins/official/agents_cli.py,sha256=8l6e1zJCAT4DdAO-QfdjK_vrrrik3pmrojwakE32ZNY,53048
116
116
  better_notion/plugins/official/agents_schema.py,sha256=NQRAJFoBAXRuxB9_9Eaf-4tVth-1OZh7GjmN56Yp9lA,39867
117
117
  better_notion/plugins/official/productivity.py,sha256=_-whP4pYA4HufE1aUFbIdhrjU-O9njI7xUO_Id2M1J8,8726
118
118
  better_notion/plugins/official/agents_sdk/__init__.py,sha256=luQBzZLsJ7fC5U0jFu8dfzMviiXj2SBZXcTohM53wkQ,725
119
119
  better_notion/plugins/official/agents_sdk/managers.py,sha256=0zMZPu63zhdyqiudO2gKsmM3YOJh0nFAR9FrMlwkV2A,31186
120
- better_notion/plugins/official/agents_sdk/models.py,sha256=gwGw9t-Z17NxddzmRKWiD9Noje86sxgPNlLJGARI0KA,75448
120
+ better_notion/plugins/official/agents_sdk/models.py,sha256=IVv6-o3BV4dvV_F7LfgScG31Z058luVKn3XUFyNjRNY,76147
121
121
  better_notion/plugins/official/agents_sdk/plugin.py,sha256=bs9O8Unv6SARGj4lBU5Gj9HGbLTUNqTacJ3RLUhdbI4,4479
122
122
  better_notion/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
123
  better_notion/utils/helpers.py,sha256=HgFuUQlG_HzBOB0z2GA9RxPLoXgwRc0DIxa9Fg6C-Jk,2337
@@ -131,9 +131,9 @@ better_notion/utils/agents/project_context.py,sha256=aJlzy5H2rL4sAfW2jHL_3K2VkBJ
131
131
  better_notion/utils/agents/rbac.py,sha256=8ZA8Y7wbOiVZDbpjpH7iC35SZrZ0jl4fcJ3xWCm3SsE,11820
132
132
  better_notion/utils/agents/schemas.py,sha256=eHfGhY90FAPXA3E8qE6gP75dgNzn-9z5Ju1FMwBKnQQ,22120
133
133
  better_notion/utils/agents/state_machine.py,sha256=xUBEeDTbU1Xq-rsRo2sbr6AUYpYrV9DTHOtZT2cWES8,6699
134
- better_notion/utils/agents/workspace.py,sha256=nS7BNa0-RFCxeAKa0inmBZcPfRKTMB11pi9OW4WzvQ4,15915
135
- better_notion-1.8.0.dist-info/METADATA,sha256=6HwsgB9jczxjDz6qehycler3WfqBs2MLbUz89VWnDYg,11096
136
- better_notion-1.8.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
137
- better_notion-1.8.0.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
138
- better_notion-1.8.0.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
139
- better_notion-1.8.0.dist-info/RECORD,,
134
+ better_notion/utils/agents/workspace.py,sha256=Uy8bqLsT_VFGYAPoiQJNuCvGdjMceaSiVGbR9saMpoU,16558
135
+ better_notion-1.8.1.dist-info/METADATA,sha256=2I8cG_XSaHt9kSskDoOf91QkNRgZxfVfntwgRnZkt-I,11096
136
+ better_notion-1.8.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
137
+ better_notion-1.8.1.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
138
+ better_notion-1.8.1.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
139
+ better_notion-1.8.1.dist-info/RECORD,,