better-notion 1.6.0__py3-none-any.whl → 1.7.0__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.
@@ -138,6 +138,7 @@ class Command:
138
138
  workflow: Which workflow this command belongs to
139
139
  when_to_use: When this command should be used
140
140
  error_recovery: Error handling strategies
141
+ subcommands: Dict of subcommand name -> subcommand documentation
141
142
  """
142
143
 
143
144
  name: str
@@ -147,10 +148,11 @@ class Command:
147
148
  workflow: str | None = None
148
149
  when_to_use: list[str] = field(default_factory=list)
149
150
  error_recovery: dict[str, dict[str, Any]] = field(default_factory=dict)
151
+ subcommands: dict[str, dict[str, Any]] = field(default_factory=dict)
150
152
 
151
153
  def to_dict(self) -> dict[str, Any]:
152
154
  """Convert to dictionary for JSON serialization."""
153
- return {
155
+ result = {
154
156
  "name": self.name,
155
157
  "purpose": self.purpose,
156
158
  "description": self.description,
@@ -160,6 +162,12 @@ class Command:
160
162
  "error_recovery": self.error_recovery,
161
163
  }
162
164
 
165
+ # Add subcommands if present
166
+ if self.subcommands:
167
+ result["subcommands"] = self.subcommands
168
+
169
+ return result
170
+
163
171
 
164
172
  @dataclass
165
173
  class Schema:
@@ -169,22 +169,93 @@ class AgentsPlugin(CombinedPluginInterface):
169
169
  "state": "already_initialized",
170
170
  "description": "Agents workspace already exists in this page",
171
171
  },
172
+ "hierarchy": {
173
+ "description": "Agents workflow hierarchy",
174
+ "levels": [
175
+ {
176
+ "level": 1,
177
+ "entity": "Organization",
178
+ "database": "organizations",
179
+ "required_before": ["Projects"]
180
+ },
181
+ {
182
+ "level": 2,
183
+ "entity": "Project",
184
+ "database": "projects",
185
+ "required_before": ["Versions", "Tasks"],
186
+ "requires": ["Organization"]
187
+ },
188
+ {
189
+ "level": 3,
190
+ "entity": "Version",
191
+ "database": "versions",
192
+ "required_before": ["Tasks"],
193
+ "requires": ["Project"]
194
+ },
195
+ {
196
+ "level": 4,
197
+ "entity": "Task",
198
+ "database": "tasks",
199
+ "requires": ["Version"]
200
+ }
201
+ ]
202
+ },
172
203
  "next_steps": [
173
204
  {
174
- "action": "query_tasks",
175
- "command": f"notion databases query --database {database_ids.get('tasks', 'TASKS_DB_ID')}",
176
- "purpose": "List all tasks in workspace",
205
+ "action": "check_organizations",
206
+ "command": "notion agents orgs list",
207
+ "purpose": "Check if organizations exist",
208
+ "why": "Organizations are the starting point - create them first"
209
+ },
210
+ {
211
+ "action": "create_organization",
212
+ "command": "notion agents orgs create --name 'Organization Name'",
213
+ "purpose": "Create a new organization",
214
+ "when": "If no organizations exist",
215
+ "examples": [
216
+ "notion agents orgs create --name 'WareflowX'",
217
+ "notion agents orgs create --name 'WareflowX' --slug 'wareflowx'"
218
+ ]
219
+ },
220
+ {
221
+ "action": "create_project",
222
+ "command": "notion agents projects create --org 'Org Name' --name 'Project Name'",
223
+ "purpose": "Create a project in an organization",
224
+ "requires": ["organization_exists"],
225
+ "examples": [
226
+ "notion agents projects create --org 'WareflowX' --name 'Website Redesign'"
227
+ ]
228
+ },
229
+ {
230
+ "action": "create_version",
231
+ "command": "notion agents versions create --project 'Project' --name 'v1.0.0'",
232
+ "purpose": "Create a version in a project",
233
+ "requires": ["project_exists"],
177
234
  },
178
235
  {
179
236
  "action": "create_task",
180
- "description": "To create a new task, use pages create with Version relation",
237
+ "command": "notion agents tasks create --version 'v1.0.0' --name 'Task Name'",
238
+ "purpose": "Create a task in a version",
239
+ "requires": ["version_exists"],
181
240
  },
182
241
  ],
183
242
  "capabilities": [
243
+ "create_organizations",
244
+ "create_projects",
245
+ "create_versions",
184
246
  "create_tasks",
185
- "manage_versions",
186
- "track_projects",
247
+ "manage_ideas",
248
+ "track_work_issues",
249
+ "manage_incidents",
187
250
  ],
251
+ "quick_reference": {
252
+ "lifecycle": "Organization → Project → Version → Task",
253
+ "create_org": "notion agents orgs create --name NAME",
254
+ "list_orgs": "notion agents orgs list",
255
+ "create_project": "notion agents projects create --org ORG --name NAME",
256
+ "create_version": "notion agents versions create --project PROJECT --name VERSION",
257
+ "create_task": "notion agents tasks create --version VERSION --name TASK",
258
+ }
188
259
  }
189
260
  )
190
261
  except Exception:
@@ -212,40 +283,107 @@ class AgentsPlugin(CombinedPluginInterface):
212
283
  "description": "Agents workspace ready for task management",
213
284
  "workspace_name": workspace_name,
214
285
  },
286
+ "hierarchy": {
287
+ "description": "Agents workflow hierarchy - follow this order",
288
+ "lifecycle": "Organization → Project → Version → Task",
289
+ "levels": [
290
+ {
291
+ "level": 1,
292
+ "entity": "Organization",
293
+ "database": "organizations",
294
+ "command": "notion agents orgs create --name 'Org Name'",
295
+ "next": "Projects"
296
+ },
297
+ {
298
+ "level": 2,
299
+ "entity": "Project",
300
+ "database": "projects",
301
+ "command": "notion agents projects create --org 'Org' --name 'Project'",
302
+ "requires": ["Organization"],
303
+ "next": "Versions"
304
+ },
305
+ {
306
+ "level": 3,
307
+ "entity": "Version",
308
+ "database": "versions",
309
+ "command": "notion agents versions create --project 'Project' --name 'v1.0.0'",
310
+ "requires": ["Project"],
311
+ "next": "Tasks"
312
+ },
313
+ {
314
+ "level": 4,
315
+ "entity": "Task",
316
+ "database": "tasks",
317
+ "command": "notion agents tasks create --version 'v1.0.0' --name 'Task'",
318
+ "requires": ["Version"]
319
+ }
320
+ ]
321
+ },
215
322
  "next_steps": [
216
323
  {
217
- "command": "agents info --parent-page " + parent_page_id,
218
- "purpose": "View workspace status and database IDs",
219
- "when": "To verify workspace setup",
324
+ "action": "first_create_organization",
325
+ "priority": 1,
326
+ "command": "notion agents orgs create --name 'Your Organization Name'",
327
+ "purpose": "Create your first organization (required before projects)",
328
+ "why": "Organizations are the top-level entity - all projects belong to an organization",
329
+ "examples": [
330
+ "notion agents orgs create --name 'WareflowX'",
331
+ "notion agents orgs create --name 'WareflowX' --slug 'wareflowx'"
332
+ ]
220
333
  },
221
334
  {
222
- "command": f"notion databases query --database {database_ids.get('tasks', 'TASKS_DB_ID')}",
223
- "purpose": "List all tasks in workspace",
224
- "when": "To see existing tasks",
335
+ "action": "then_create_project",
336
+ "priority": 2,
337
+ "command": "notion agents projects create --org 'Org Name' --name 'Project Name'",
338
+ "purpose": "Create a project in the organization",
339
+ "requires": ["organization_exists"],
340
+ },
341
+ {
342
+ "action": "then_create_version",
343
+ "priority": 3,
344
+ "command": "notion agents versions create --project 'Project' --name 'v1.0.0'",
345
+ "purpose": "Create a version in the project",
346
+ "requires": ["project_exists"],
225
347
  },
226
- ],
227
- "capabilities": [
228
- "create_tasks",
229
- "manage_versions",
230
- "track_projects",
231
- "manage_ideas",
232
- "track_incidents",
233
- ],
234
- "common_workflows": [
235
348
  {
236
- "name": "create_organization",
237
- "description": "Create a new organization in the workspace",
238
- "command": f"notion pages create --parent {database_ids.get('organizations', 'ORGANIZATIONS_DB_ID')} --title 'Organization Name'",
349
+ "action": "then_create_tasks",
350
+ "priority": 4,
351
+ "command": "notion agents tasks create --version 'v1.0.0' --name 'Task Name'",
352
+ "purpose": "Create tasks in the version",
353
+ "requires": ["version_exists"],
239
354
  },
240
355
  {
241
- "name": "create_task",
242
- "description": "Create a task in the workspace",
243
- "steps": [
244
- f"agents info --parent-page {parent_page_id}",
245
- f"notion pages create --parent {database_ids.get('tasks', 'TASKS_DB_ID')} --title 'Task Name' --properties '{{\"Status\": \"Todo\", \"Version\": \"VERSION_ID\"}}'",
246
- ],
356
+ "action": "verify_setup",
357
+ "command": "agents info --parent-page " + parent_page_id,
358
+ "purpose": "View workspace status and database IDs",
359
+ "when": "Anytime to verify setup",
247
360
  },
248
361
  ],
362
+ "capabilities": [
363
+ "create_organizations",
364
+ "create_projects",
365
+ "create_versions",
366
+ "create_tasks",
367
+ "manage_ideas",
368
+ "track_work_issues",
369
+ "manage_incidents",
370
+ ],
371
+ "quick_start": {
372
+ "description": "Quick start guide - create your first workflow",
373
+ "steps": [
374
+ "1. Create organization: notion agents orgs create --name 'WareflowX'",
375
+ "2. Create project: notion agents projects create --org 'WareflowX' --name 'Website Redesign'",
376
+ "3. Create version: notion agents versions create --project 'Website Redesign' --name 'v1.0.0'",
377
+ "4. Create task: notion agents tasks create --version 'v1.0.0' --name 'Fix login bug'"
378
+ ]
379
+ },
380
+ "quick_reference": {
381
+ "list_orgs": "notion agents orgs list",
382
+ "list_projects": "notion agents projects list",
383
+ "list_versions": "notion agents versions list --project 'Project'",
384
+ "list_tasks": "notion agents tasks list --version 'v1.0.0'",
385
+ "find_next_task": "notion agents tasks next --version 'v1.0.0'"
386
+ }
249
387
  }
250
388
  )
251
389
 
@@ -15,6 +15,175 @@ from better_notion._cli.docs.base import (
15
15
  WorkflowStep,
16
16
  )
17
17
 
18
+ # =============================================================================
19
+ # DATABASE SCHEMAS
20
+ # =============================================================================
21
+
22
+ ORGANIZATIONS_DB_SCHEMA = {
23
+ "title": "Organizations",
24
+ "property_types": {
25
+ "Name": {
26
+ "type": "title",
27
+ "required": True,
28
+ "description": "Organization name"
29
+ },
30
+ "Slug": {
31
+ "type": "rich_text",
32
+ "required": False,
33
+ "description": "URL-friendly identifier"
34
+ },
35
+ "Status": {
36
+ "type": "select",
37
+ "required": False,
38
+ "options": ["Active", "Inactive"],
39
+ "default": "Active"
40
+ },
41
+ "Website": {
42
+ "type": "url",
43
+ "required": False,
44
+ "description": "Organization website URL"
45
+ }
46
+ },
47
+ "example_creation": {
48
+ "command": "notion pages create --parent ORG_DB_ID --title 'WareflowX'",
49
+ "properties": {
50
+ "Name": "WareflowX",
51
+ "Slug": "wareflowx",
52
+ "Status": "Active"
53
+ }
54
+ }
55
+ }
56
+
57
+ PROJECTS_DB_SCHEMA = {
58
+ "title": "Projects",
59
+ "property_types": {
60
+ "Name": {
61
+ "type": "title",
62
+ "required": True,
63
+ "description": "Project name"
64
+ },
65
+ "Organization": {
66
+ "type": "relation",
67
+ "required": True,
68
+ "target": "Organizations",
69
+ "description": "Organization this project belongs to"
70
+ },
71
+ "Status": {
72
+ "type": "select",
73
+ "required": False,
74
+ "options": ["Active", "On Hold", "Completed", "Archived"],
75
+ "default": "Active"
76
+ },
77
+ "Description": {
78
+ "type": "rich_text",
79
+ "required": False,
80
+ "description": "Project description"
81
+ }
82
+ },
83
+ "example_creation": {
84
+ "command": "notion pages create --parent PROJECTS_DB_ID --title 'Website Redesign'",
85
+ "properties": {
86
+ "Name": "Website Redesign",
87
+ "Organization": "ORG_PAGE_ID",
88
+ "Status": "Active"
89
+ }
90
+ }
91
+ }
92
+
93
+ VERSIONS_DB_SCHEMA = {
94
+ "title": "Versions",
95
+ "property_types": {
96
+ "Name": {
97
+ "type": "title",
98
+ "required": True,
99
+ "description": "Version name (e.g., v1.0.0)"
100
+ },
101
+ "Project": {
102
+ "type": "relation",
103
+ "required": True,
104
+ "target": "Projects",
105
+ "description": "Project this version belongs to"
106
+ },
107
+ "Status": {
108
+ "type": "select",
109
+ "required": False,
110
+ "options": ["Planned", "In Progress", "Released", "Archived"],
111
+ "default": "Planned"
112
+ },
113
+ "Release Date": {
114
+ "type": "date",
115
+ "required": False,
116
+ "description": "Planned or actual release date"
117
+ }
118
+ },
119
+ "example_creation": {
120
+ "command": "notion pages create --parent VERSIONS_DB_ID --title 'v1.0.0'",
121
+ "properties": {
122
+ "Name": "v1.0.0",
123
+ "Project": "PROJECT_PAGE_ID",
124
+ "Status": "Planned"
125
+ }
126
+ }
127
+ }
128
+
129
+ TASKS_DB_SCHEMA = {
130
+ "title": "Tasks",
131
+ "property_types": {
132
+ "Name": {
133
+ "type": "title",
134
+ "required": True,
135
+ "description": "Task name"
136
+ },
137
+ "Status": {
138
+ "type": "select",
139
+ "required": True,
140
+ "options": ["Todo", "In Progress", "Done", "Cancelled"],
141
+ "default": "Todo"
142
+ },
143
+ "Version": {
144
+ "type": "relation",
145
+ "required": True,
146
+ "target": "Versions",
147
+ "description": "Version this task belongs to (REQUIRED)"
148
+ },
149
+ "Target Version": {
150
+ "type": "relation",
151
+ "required": False,
152
+ "target": "Versions",
153
+ "description": "Version where task should be implemented"
154
+ },
155
+ "Dependencies": {
156
+ "type": "relation",
157
+ "required": False,
158
+ "target": "Tasks",
159
+ "dual_property": "Dependent Tasks",
160
+ "description": "Tasks that must complete before this task"
161
+ },
162
+ "Dependent Tasks": {
163
+ "type": "relation",
164
+ "required": False,
165
+ "target": "Tasks",
166
+ "dual_property": "Dependencies",
167
+ "description": "Tasks blocked by this task"
168
+ },
169
+ "Priority": {
170
+ "type": "select",
171
+ "required": False,
172
+ "options": ["Low", "Medium", "High", "Critical"],
173
+ "default": "Medium"
174
+ }
175
+ },
176
+ "example_creation": {
177
+ "command": "notion pages create --parent TASKS_DB_ID --title 'Fix login bug'",
178
+ "properties": {
179
+ "Name": "Fix login bug",
180
+ "Status": "Todo",
181
+ "Version": "VERSION_PAGE_ID",
182
+ "Priority": "High"
183
+ }
184
+ }
185
+ }
186
+
18
187
  # =============================================================================
19
188
  # CONCEPTS
20
189
  # =============================================================================
@@ -50,6 +219,36 @@ WORKSPACE_CONCEPT = Concept(
50
219
  },
51
220
  )
52
221
 
222
+ ORGANIZATION_CONCEPT = Concept(
223
+ name="organization",
224
+ description=(
225
+ "An organization represents a company, team, or entity that owns projects. "
226
+ "Organizations are the top-level entities in the agents workflow hierarchy."
227
+ ),
228
+ properties={
229
+ "database_schema": ORGANIZATIONS_DB_SCHEMA,
230
+ "creation": {
231
+ "command": "notion agents orgs create --name 'Org Name' --slug 'org-slug'",
232
+ "alternative": "notion pages create --parent ORG_DB_ID --title 'Org Name' --properties '{...}'",
233
+ "required_properties": ["Name"],
234
+ "property_types": {
235
+ "Name": "title (required)",
236
+ "Slug": "rich_text (optional, URL-friendly identifier)",
237
+ "Status": "select [Active, Inactive] (optional, default: Active)",
238
+ "Website": "url (optional)"
239
+ }
240
+ },
241
+ "listing": {
242
+ "command": "notion agents orgs list",
243
+ "description": "List all organizations in workspace"
244
+ }
245
+ },
246
+ relationships={
247
+ "Projects": "One-to-many - organization contains multiple projects",
248
+ "description": "All projects must belong to an organization"
249
+ },
250
+ )
251
+
53
252
  TASK_CONCEPT = Concept(
54
253
  name="task",
55
254
  description=(
@@ -198,6 +397,122 @@ INITIALIZE_WORKSPACE = Workflow(
198
397
  },
199
398
  )
200
399
 
400
+ CREATE_ORGANIZATION_WORKFLOW = Workflow(
401
+ name="create_organization",
402
+ description="Create a new organization in the agents workspace",
403
+ steps=[
404
+ WorkflowStep(
405
+ description="Verify workspace is initialized",
406
+ command="agents info --parent-page PAGE_ID",
407
+ purpose="Get Organizations database ID and verify workspace exists",
408
+ ),
409
+ WorkflowStep(
410
+ description="Create organization using agents command",
411
+ command="notion agents orgs create --name 'Org Name' --slug 'org-slug'",
412
+ purpose="Create organization with proper properties",
413
+ ),
414
+ ],
415
+ commands=[
416
+ "agents info --parent-page PAGE_ID",
417
+ "notion agents orgs create --name 'WareflowX' --slug 'wareflowx'",
418
+ ],
419
+ prerequisites=["workspace_initialized"],
420
+ error_recovery={
421
+ "workspace_not_found": {
422
+ "message": "No workspace detected in page",
423
+ "solution": "Run 'agents init --parent-page PAGE_ID' first to create workspace",
424
+ },
425
+ "missing_name": {
426
+ "message": "Organization name is required",
427
+ "solution": "Always specify --name flag when creating organization",
428
+ },
429
+ },
430
+ )
431
+
432
+ CREATE_PROJECT_WORKFLOW = Workflow(
433
+ name="create_project",
434
+ description="Create a new project in an organization",
435
+ steps=[
436
+ WorkflowStep(
437
+ description="Verify workspace is initialized",
438
+ command="agents info --parent-page PAGE_ID",
439
+ purpose="Get database IDs and verify workspace exists",
440
+ ),
441
+ WorkflowStep(
442
+ description="List organizations to find target",
443
+ command="notion agents orgs list",
444
+ purpose="Identify which organization the project belongs to",
445
+ ),
446
+ WorkflowStep(
447
+ description="Create project with organization relation",
448
+ command="notion agents projects create --org 'Org Name/Slug' --name 'Project Name'",
449
+ purpose="Create project with Organization relation (required)",
450
+ ),
451
+ ],
452
+ commands=[
453
+ "agents info --parent-page PAGE_ID",
454
+ "notion agents orgs list",
455
+ "notion agents projects create --org 'WareflowX' --name 'Website Redesign'",
456
+ ],
457
+ prerequisites=["workspace_initialized", "organization_exists"],
458
+ error_recovery={
459
+ "workspace_not_found": {
460
+ "message": "No workspace detected in page",
461
+ "solution": "Run 'agents init --parent-page PAGE_ID' first to create workspace",
462
+ },
463
+ "organization_not_found": {
464
+ "message": "Organization not found",
465
+ "solution": "Create organization first with 'agents orgs create --name NAME'",
466
+ },
467
+ "missing_org_relation": {
468
+ "message": "Project must have Organization relation",
469
+ "solution": "Always specify --org flag when creating project",
470
+ },
471
+ },
472
+ )
473
+
474
+ CREATE_VERSION_WORKFLOW = Workflow(
475
+ name="create_version",
476
+ description="Create a new version in a project",
477
+ steps=[
478
+ WorkflowStep(
479
+ description="Verify workspace is initialized",
480
+ command="agents info --parent-page PAGE_ID",
481
+ purpose="Get database IDs and verify workspace exists",
482
+ ),
483
+ WorkflowStep(
484
+ description="List projects to find target",
485
+ command="notion agents projects list",
486
+ purpose="Identify which project the version belongs to",
487
+ ),
488
+ WorkflowStep(
489
+ description="Create version with project relation",
490
+ command="notion agents versions create --project 'Project Name' --name 'v1.0.0'",
491
+ purpose="Create version with Project relation (required)",
492
+ ),
493
+ ],
494
+ commands=[
495
+ "agents info --parent-page PAGE_ID",
496
+ "notion agents projects list",
497
+ "notion agents versions create --project 'Website Redesign' --name 'v1.0.0'",
498
+ ],
499
+ prerequisites=["workspace_initialized", "organization_exists", "project_exists"],
500
+ error_recovery={
501
+ "workspace_not_found": {
502
+ "message": "No workspace detected in page",
503
+ "solution": "Run 'agents init --parent-page PAGE_ID' first to create workspace",
504
+ },
505
+ "project_not_found": {
506
+ "message": "Project not found",
507
+ "solution": "Create project first with 'agents projects create --org ORG --name NAME'",
508
+ },
509
+ "missing_project_relation": {
510
+ "message": "Version must have Project relation",
511
+ "solution": "Always specify --project flag when creating version",
512
+ },
513
+ },
514
+ )
515
+
201
516
  CREATE_TASK_WORKFLOW = Workflow(
202
517
  name="create_task",
203
518
  description="Create a new task in the agents workflow system",
@@ -307,13 +622,153 @@ INFO_COMMAND = Command(
307
622
  ],
308
623
  )
309
624
 
625
+ # =============================================================================
626
+ # SUBCOMMANDS
627
+ # =============================================================================
628
+
629
+ # ORGS_SUBCOMMAND documents the agents orgs commands
630
+ ORGS_COMMAND = Command(
631
+ name="orgs",
632
+ purpose="Organizations management - top-level entities in workflow hierarchy",
633
+ description=(
634
+ "Organizations are the starting point for all projects. "
635
+ "Every project must belong to an organization."
636
+ ),
637
+ subcommands={
638
+ "list": {
639
+ "purpose": "List all organizations in workspace",
640
+ "usage": "notion agents orgs list",
641
+ "output": "Returns list of organizations with their IDs and properties"
642
+ },
643
+ "create": {
644
+ "purpose": "Create a new organization",
645
+ "usage": "notion agents orgs create --name NAME [--slug SLUG] [--status STATUS]",
646
+ "required_flags": {
647
+ "--name": "Organization name (required)"
648
+ },
649
+ "optional_flags": {
650
+ "--slug": "URL-friendly identifier (optional)",
651
+ "--status": "Active or Inactive (default: Active)"
652
+ },
653
+ "examples": [
654
+ "notion agents orgs create --name 'WareflowX'",
655
+ "notion agents orgs create --name 'WareflowX' --slug 'wareflowx' --status 'Active'"
656
+ ]
657
+ },
658
+ "info": {
659
+ "purpose": "Get organization details",
660
+ "usage": "notion agents orgs info --org ORG_NAME_OR_SLUG",
661
+ "output": "Returns organization details with projects count"
662
+ }
663
+ }
664
+ )
665
+
666
+ # PROJECTS_SUBCOMMAND documents the agents projects commands
667
+ PROJECTS_COMMAND = Command(
668
+ name="projects",
669
+ purpose="Projects management - belongs to organizations",
670
+ description=(
671
+ "Projects represent software development efforts. "
672
+ "Every project must belong to an organization."
673
+ ),
674
+ subcommands={
675
+ "list": {
676
+ "purpose": "List all projects (optionally filtered by organization)",
677
+ "usage": "notion agents projects list [--org ORG_NAME]",
678
+ "output": "Returns list of projects with their organizations"
679
+ },
680
+ "create": {
681
+ "purpose": "Create a new project in an organization",
682
+ "usage": "notion agents projects create --org ORG_NAME --name NAME",
683
+ "required_flags": {
684
+ "--org": "Organization name or slug (required)",
685
+ "--name": "Project name (required)"
686
+ },
687
+ "examples": [
688
+ "notion agents projects create --org 'WareflowX' --name 'Website Redesign'"
689
+ ]
690
+ },
691
+ "info": {
692
+ "purpose": "Get project details",
693
+ "usage": "notion agents projects info --project PROJECT_NAME"
694
+ }
695
+ }
696
+ )
697
+
698
+ # VERSIONS_SUBCOMMAND documents the agents versions commands
699
+ VERSIONS_COMMAND = Command(
700
+ name="versions",
701
+ purpose="Versions management - releases and milestones",
702
+ description=(
703
+ "Versions represent releases or milestones. "
704
+ "Every version must belong to a project."
705
+ ),
706
+ subcommands={
707
+ "list": {
708
+ "purpose": "List all versions (optionally filtered by project)",
709
+ "usage": "notion agents versions list [--project PROJECT_NAME]",
710
+ "output": "Returns list of versions with their projects"
711
+ },
712
+ "create": {
713
+ "purpose": "Create a new version in a project",
714
+ "usage": "notion agents versions create --project PROJECT_NAME --name VERSION",
715
+ "required_flags": {
716
+ "--project": "Project name (required)",
717
+ "--name": "Version name e.g. v1.0.0 (required)"
718
+ },
719
+ "examples": [
720
+ "notion agents versions create --project 'Website Redesign' --name 'v1.0.0'",
721
+ "notion agents versions create --project 'Website Redesign' --name 'sprint-1'"
722
+ ]
723
+ }
724
+ }
725
+ )
726
+
727
+ # TASKS_SUBCOMMAND documents the agents tasks commands
728
+ TASKS_COMMAND = Command(
729
+ name="tasks",
730
+ purpose="Tasks management - units of work in versions",
731
+ description=(
732
+ "Tasks represent work items. Every task must belong to a version. "
733
+ "Tasks can have dependencies on other tasks."
734
+ ),
735
+ subcommands={
736
+ "list": {
737
+ "purpose": "List all tasks (optionally filtered by version or status)",
738
+ "usage": "notion agents tasks list [--version VERSION] [--status STATUS]",
739
+ "output": "Returns list of tasks with their versions and status"
740
+ },
741
+ "create": {
742
+ "purpose": "Create a new task in a version",
743
+ "usage": "notion agents tasks create --version VERSION_NAME --name TASK_NAME",
744
+ "required_flags": {
745
+ "--version": "Version name (required)",
746
+ "--name": "Task name (required)"
747
+ },
748
+ "optional_flags": {
749
+ "--status": "Todo, In Progress, Done (default: Todo)",
750
+ "--priority": "Low, Medium, High, Critical (default: Medium)"
751
+ },
752
+ "examples": [
753
+ "notion agents tasks create --version 'v1.0.0' --name 'Fix login bug'",
754
+ "notion agents tasks create --version 'v1.0.0' --name 'Add feature' --status 'Todo' --priority 'High'"
755
+ ]
756
+ },
757
+ "next": {
758
+ "purpose": "Find next available task to work on",
759
+ "usage": "notion agents tasks next [--version VERSION]",
760
+ "description": "Finds tasks with status 'Todo' and no incomplete dependencies"
761
+ }
762
+ }
763
+ )
764
+
310
765
  # =============================================================================
311
766
  # COMPLETE SCHEMA
312
767
  # =============================================================================
313
768
 
314
769
  AGENTS_SCHEMA = Schema(
315
770
  name="agents",
316
- version="1.0.0",
771
+ version="2.0.0",
317
772
  description=(
318
773
  "Workflow management system for software development. "
319
774
  "Provides complete structure for tracking organizations, projects, "
@@ -321,28 +776,38 @@ AGENTS_SCHEMA = Schema(
321
776
  ),
322
777
  concepts=[
323
778
  WORKSPACE_CONCEPT,
324
- TASK_CONCEPT,
779
+ ORGANIZATION_CONCEPT,
325
780
  PROJECT_CONCEPT,
326
781
  VERSION_CONCEPT,
782
+ TASK_CONCEPT,
327
783
  ],
328
784
  workflows=[
329
785
  INITIALIZE_WORKSPACE,
786
+ CREATE_ORGANIZATION_WORKFLOW,
787
+ CREATE_PROJECT_WORKFLOW,
788
+ CREATE_VERSION_WORKFLOW,
330
789
  CREATE_TASK_WORKFLOW,
331
790
  QUERY_TASKS_WORKFLOW,
332
791
  ],
333
792
  commands={
334
793
  "init": INIT_COMMAND,
335
794
  "info": INFO_COMMAND,
795
+ "orgs": ORGS_COMMAND,
796
+ "projects": PROJECTS_COMMAND,
797
+ "versions": VERSIONS_COMMAND,
798
+ "tasks": TASKS_COMMAND,
336
799
  },
337
800
  best_practices=[
338
- "Always run 'agents info' before database operations to verify workspace state",
801
+ "Follow the hierarchy: Organization Project Version Task",
802
+ "Always run 'agents info' before operations to verify workspace state",
339
803
  "Use --skip flag to safely check for existing workspaces (prevents duplicates)",
340
804
  "Use --reset flag only when you need to recreate workspace (causes data loss)",
341
- "Tasks must have a Version relation - always specify Version property",
342
- "Check task dependencies before marking tasks as complete",
343
- "Projects belong to Organizations - create organization first",
344
- "Versions belong to Projects - create project first",
345
- "Query tasks by Status to find next available task",
805
+ "Create organization before creating projects",
806
+ "Create project before creating versions",
807
+ "Create version before creating tasks",
808
+ "Tasks must have a Version relation (required)",
809
+ "Projects must have an Organization relation (required)",
810
+ "Use 'agents tasks next' to find next available task",
346
811
  ],
347
812
  examples={
348
813
  "initial_setup": """# First time setup
@@ -357,13 +822,39 @@ notion agents init --parent-page PAGE_ID --skip""",
357
822
  "force_recreate": """# Delete existing workspace and recreate (WARNING: data loss)
358
823
  notion agents init --parent-page PAGE_ID --reset""",
359
824
 
360
- "query_workspace": """# Get workspace info and database IDs
361
- notion agents info --parent-page PAGE_ID""",
825
+ "complete_lifecycle": """# Complete workflow: Org Project → Version → Task
826
+
827
+ # 1. Create organization
828
+ notion agents orgs create --name "WareflowX" --slug "wareflowx"
829
+
830
+ # 2. Create project in organization
831
+ notion agents projects create --org "WareflowX" --name "Website Redesign"
832
+
833
+ # 3. Create version in project
834
+ notion agents versions create --project "Website Redesign" --name "v1.0.0"
835
+
836
+ # 4. Create task in version
837
+ notion agents tasks create --version "v1.0.0" --name "Fix login bug" --priority "High".""",
838
+
839
+ "query_and_create": """# List existing organizations
840
+ notion agents orgs list
841
+
842
+ # List projects in organization
843
+ notion agents projects list --org "WareflowX"
844
+
845
+ # List tasks in version
846
+ notion agents tasks list --version "v1.0.0"
847
+
848
+ # Find next task to work on
849
+ notion agents tasks next --version "v1.0.0\"""",
850
+
851
+ "create_task": """# Create task using agents command (recommended)
852
+ notion agents tasks create --version "v1.0.0" --name "Fix login bug"
362
853
 
363
- "create_task": """# After workspace is initialized
854
+ # Alternative: Create task directly with pages command
364
855
  notion pages create \\
365
856
  --parent TASKS_DB_ID \\
366
857
  --title "Fix login bug" \\
367
- --properties '{"Status": "Todo", "Version": "VERSION_ID"}'""",
858
+ --properties '{"Status": "Todo", "Version": "VERSION_ID", "Priority": "High"}'""",
368
859
  },
369
860
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: better-notion
3
- Version: 1.6.0
3
+ Version: 1.7.0
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
@@ -49,7 +49,7 @@ better_notion/_cli/commands/update.py,sha256=NfmijzTpCbVTEY2h0QdcJZXEiGmWkk-iyEt
49
49
  better_notion/_cli/commands/users.py,sha256=wpjKCo-HHfpiGsjvLSs8nb2MjZ8nxtppCC0N_OCkz9M,4890
50
50
  better_notion/_cli/commands/workspace.py,sha256=f3VQcXZ6lu2QrAxkQyFVb3FVU7LYC8kag6VOUvVEu-c,3671
51
51
  better_notion/_cli/docs/__init__.py,sha256=NQ2Wt18dVEE43hw2XZtdM8S3OJ5DHzLTKW20byxxYng,415
52
- better_notion/_cli/docs/base.py,sha256=xESWiLIaNqK8jCs34_jM1E33oaIv4lwmhJkJh3Lf4RQ,6538
52
+ better_notion/_cli/docs/base.py,sha256=2l-4mR-Ss_jMrT2ZNF0xT-kr-XbbaGg8-ed-Fy62hE0,6837
53
53
  better_notion/_cli/docs/formatters.py,sha256=bFZ2WOr7Q1O-Q2uUXWki_88jciqHU39wJeaOc_QqSGc,4261
54
54
  better_notion/_cli/docs/registry.py,sha256=D1AyQoUITrs-8r_hP72C6ef1vsEQhOEqV13oBuv3pK0,2281
55
55
  better_notion/_cli/utils/__init__.py,sha256=VV2SaZnclN-HMMRIsqgxlBNL2HB4n1AvAfMJJWCoTxo,29
@@ -111,9 +111,9 @@ 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=Wc3EK934GEbD3lGrU2ZuVW8K5bNVA1BIGqttk52wIno,40859
114
+ better_notion/plugins/official/agents.py,sha256=OHX-vmEsab8b-tMljXJLOB9YRpq1oG125FTK7mtm23A,50667
115
115
  better_notion/plugins/official/agents_cli.py,sha256=8l6e1zJCAT4DdAO-QfdjK_vrrrik3pmrojwakE32ZNY,53048
116
- better_notion/plugins/official/agents_schema.py,sha256=QDMGzOUEtH2QShIig8g6pS8veeZz6x034RXm6MU2PJQ,14136
116
+ better_notion/plugins/official/agents_schema.py,sha256=1efMpTrGGuUbulrk7IO5iDIw93CZjv_YkpVPcXIHheI,32267
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
@@ -132,8 +132,8 @@ better_notion/utils/agents/rbac.py,sha256=8ZA8Y7wbOiVZDbpjpH7iC35SZrZ0jl4fcJ3xWC
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
134
  better_notion/utils/agents/workspace.py,sha256=nS7BNa0-RFCxeAKa0inmBZcPfRKTMB11pi9OW4WzvQ4,15915
135
- better_notion-1.6.0.dist-info/METADATA,sha256=leiPUN0D9auHnDVpw5hos7gPAoxwsEwJVp4xv8vVunk,11096
136
- better_notion-1.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
137
- better_notion-1.6.0.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
138
- better_notion-1.6.0.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
139
- better_notion-1.6.0.dist-info/RECORD,,
135
+ better_notion-1.7.0.dist-info/METADATA,sha256=u205QxZNPO8eTf7S29XGFFx9QPSnYyCp5m4Cy7okHnk,11096
136
+ better_notion-1.7.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
137
+ better_notion-1.7.0.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
138
+ better_notion-1.7.0.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
139
+ better_notion-1.7.0.dist-info/RECORD,,