socialcli 0.3.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.
Potentially problematic release.
This version of socialcli might be problematic. Click here for more details.
- socialcli-0.3.0.dist-info/METADATA +168 -0
- socialcli-0.3.0.dist-info/RECORD +224 -0
- socialcli-0.3.0.dist-info/WHEEL +4 -0
- socialcli-0.3.0.dist-info/entry_points.txt +3 -0
- socialcli-0.3.0.dist-info/licenses/LICENSE +21 -0
- socialctl/__init__.py +0 -0
- socialctl/__main__.py +6 -0
- socialctl/adapters/__init__.py +6 -0
- socialctl/adapters/base.py +68 -0
- socialctl/adapters/errores.py +56 -0
- socialctl/adapters/facebook.py +180 -0
- socialctl/adapters/instagram.py +442 -0
- socialctl/adapters/tiktok.py +535 -0
- socialctl/adapters/youtube.py +331 -0
- socialctl/agent_errors.py +176 -0
- socialctl/agent_guide.py +23 -0
- socialctl/approval_cli.py +27 -0
- socialctl/auth.py +139 -0
- socialctl/authflow.py +344 -0
- socialctl/brands.py +194 -0
- socialctl/capabilities.py +57 -0
- socialctl/capabilities.yml +5945 -0
- socialctl/cli.py +1766 -0
- socialctl/connection_service/__init__.py +0 -0
- socialctl/connection_service/__main__.py +33 -0
- socialctl/connection_service/app.py +496 -0
- socialctl/connection_service/assets/PLATFORM-LOGOS-LICENSE.txt +50 -0
- socialctl/connection_service/assets/connection.css +75 -0
- socialctl/connection_service/assets/facebook.webp +0 -0
- socialctl/connection_service/assets/instagram.svg +194 -0
- socialctl/connection_service/assets/socialcli-logo.png +0 -0
- socialctl/connection_service/assets/tiktok.png +0 -0
- socialctl/connection_service/assets/youtube.svg +1 -0
- socialctl/connection_service/landing.py +146 -0
- socialctl/connection_service/legacy.py +48 -0
- socialctl/connection_service/peer.py +13 -0
- socialctl/connection_service/providers.py +324 -0
- socialctl/connection_service/settings.py +76 -0
- socialctl/connection_service/store.py +124 -0
- socialctl/connections/__init__.py +0 -0
- socialctl/connections/account_cli.py +438 -0
- socialctl/connections/cli.py +379 -0
- socialctl/connections/client.py +126 -0
- socialctl/connections/credential_cli.py +224 -0
- socialctl/connections/credential_store.py +49 -0
- socialctl/connections/file_store.py +193 -0
- socialctl/connections/keychain.py +78 -0
- socialctl/connections/meta_user.py +81 -0
- socialctl/connections/rotation_cli.py +116 -0
- socialctl/connections/saas_client.py +91 -0
- socialctl/connections/temporary_media.py +62 -0
- socialctl/delivery_options.py +70 -0
- socialctl/engagement.py +200 -0
- socialctl/engagement_cli.py +50 -0
- socialctl/executor.py +135 -0
- socialctl/formatter.py +291 -0
- socialctl/hosted_media.py +152 -0
- socialctl/identity.py +200 -0
- socialctl/inbox.py +298 -0
- socialctl/inbox_cli.py +46 -0
- socialctl/inventory.py +155 -0
- socialctl/inventory_cli.py +171 -0
- socialctl/inventory_sources.py +101 -0
- socialctl/management/__init__.py +1 -0
- socialctl/management/batch_cli.py +115 -0
- socialctl/management/batches.py +325 -0
- socialctl/management/changes.py +485 -0
- socialctl/management/cli.py +227 -0
- socialctl/management/comments_cli.py +352 -0
- socialctl/management/community_batch_cli.py +63 -0
- socialctl/management/community_batches.py +294 -0
- socialctl/management/community_changes.py +370 -0
- socialctl/management/community_cli.py +142 -0
- socialctl/management/community_schema.py +119 -0
- socialctl/management/facebook_groups.py +1118 -0
- socialctl/management/groups_cli.py +274 -0
- socialctl/management/inbox_readers.py +87 -0
- socialctl/management/meta_changes.py +197 -0
- socialctl/management/meta_cli.py +342 -0
- socialctl/management/meta_client.py +631 -0
- socialctl/management/meta_comment_inbox.py +565 -0
- socialctl/management/meta_comments.py +587 -0
- socialctl/management/meta_errors.py +59 -0
- socialctl/management/meta_pagination.py +52 -0
- socialctl/management/meta_schema.py +128 -0
- socialctl/management/meta_webhooks.py +147 -0
- socialctl/management/metadata_parts.py +144 -0
- socialctl/management/owned_assets.py +85 -0
- socialctl/management/owned_changes.py +470 -0
- socialctl/management/owned_cli.py +128 -0
- socialctl/management/owned_reorder.py +62 -0
- socialctl/management/owned_schema.py +368 -0
- socialctl/management/reply_context.py +24 -0
- socialctl/management/reply_evidence.py +80 -0
- socialctl/management/resource_changes.py +407 -0
- socialctl/management/resource_cli.py +136 -0
- socialctl/management/snippet_readback.py +26 -0
- socialctl/management/stories.py +713 -0
- socialctl/management/stories_cli.py +172 -0
- socialctl/management/youtube.py +323 -0
- socialctl/management/youtube_community.py +326 -0
- socialctl/management/youtube_metadata.py +122 -0
- socialctl/management/youtube_owned.py +259 -0
- socialctl/management/youtube_resources.py +305 -0
- socialctl/media.py +269 -0
- socialctl/media_cli.py +183 -0
- socialctl/media_ingress.py +211 -0
- socialctl/media_preflight.py +114 -0
- socialctl/media_registry.py +301 -0
- socialctl/media_requirements.py +52 -0
- socialctl/metricas/__init__.py +6 -0
- socialctl/metricas/almacen.py +133 -0
- socialctl/metricas/analytics_changes.py +295 -0
- socialctl/metricas/analytics_cli.py +191 -0
- socialctl/metricas/analytics_client.py +304 -0
- socialctl/metricas/analytics_ingest.py +260 -0
- socialctl/metricas/analytics_schema.py +174 -0
- socialctl/metricas/base.py +147 -0
- socialctl/metricas/facebook.py +418 -0
- socialctl/metricas/insights.py +227 -0
- socialctl/metricas/instagram.py +133 -0
- socialctl/metricas/modelos.py +87 -0
- socialctl/metricas/piezas.py +134 -0
- socialctl/metricas/reach.py +94 -0
- socialctl/metricas/reporting_client.py +112 -0
- socialctl/metricas/resumen.py +251 -0
- socialctl/metricas/slugs.py +89 -0
- socialctl/metricas/tiktok.py +185 -0
- socialctl/metricas/youtube.py +403 -0
- socialctl/migration_cli.py +60 -0
- socialctl/migration_files.py +68 -0
- socialctl/models.py +150 -0
- socialctl/native_schedule/__init__.py +13 -0
- socialctl/native_schedule/api_delivery.py +15 -0
- socialctl/native_schedule/api_reconcile.py +40 -0
- socialctl/native_schedule/approval.py +160 -0
- socialctl/native_schedule/cadence.py +73 -0
- socialctl/native_schedule/cli.py +510 -0
- socialctl/native_schedule/dispatcher.py +120 -0
- socialctl/native_schedule/facebook.py +112 -0
- socialctl/native_schedule/facebook_reels.py +140 -0
- socialctl/native_schedule/first_comment.py +181 -0
- socialctl/native_schedule/handoff.py +193 -0
- socialctl/native_schedule/instagram_delivery.py +224 -0
- socialctl/native_schedule/instagram_runtime.py +66 -0
- socialctl/native_schedule/inventory.py +70 -0
- socialctl/native_schedule/migration.py +310 -0
- socialctl/native_schedule/models.py +103 -0
- socialctl/native_schedule/reconcile.py +83 -0
- socialctl/native_schedule/remote_data.py +177 -0
- socialctl/native_schedule/report.py +151 -0
- socialctl/native_schedule/store.py +560 -0
- socialctl/native_schedule/verification.py +32 -0
- socialctl/native_schedule/youtube.py +339 -0
- socialctl/operation_output.py +87 -0
- socialctl/plantillas/accounts.yml +33 -0
- socialctl/plantillas/brand.md +95 -0
- socialctl/plantillas/estrategia.md +64 -0
- socialctl/postfile.py +240 -0
- socialctl/preflight.py +73 -0
- socialctl/publication_policy.py +34 -0
- socialctl/publication_status.py +75 -0
- socialctl/publication_steps.py +398 -0
- socialctl/publish_output.py +96 -0
- socialctl/publisher.py +445 -0
- socialctl/queue_migration.py +302 -0
- socialctl/read_budget.py +224 -0
- socialctl/read_reports.py +91 -0
- socialctl/rutas.py +103 -0
- socialctl/saas/__init__.py +1 -0
- socialctl/saas/access.py +75 -0
- socialctl/saas/auth.py +213 -0
- socialctl/saas/backup.py +124 -0
- socialctl/saas/billing.py +327 -0
- socialctl/saas/billing_enrollment.py +1237 -0
- socialctl/saas/billing_enrollment_schema.py +519 -0
- socialctl/saas/billing_inventory.py +775 -0
- socialctl/saas/billing_reconcile.py +127 -0
- socialctl/saas/billing_routes.py +27 -0
- socialctl/saas/budget.py +66 -0
- socialctl/saas/connections.py +374 -0
- socialctl/saas/consent.py +52 -0
- socialctl/saas/lifecycle.py +341 -0
- socialctl/saas/mail.py +89 -0
- socialctl/saas/maintenance.py +68 -0
- socialctl/saas/meta_user.py +298 -0
- socialctl/saas/meta_webhooks.py +358 -0
- socialctl/saas/migration.py +107 -0
- socialctl/saas/models.py +8 -0
- socialctl/saas/operations.py +102 -0
- socialctl/saas/pages.py +126 -0
- socialctl/saas/pairing.py +158 -0
- socialctl/saas/permissions.py +57 -0
- socialctl/saas/reminders.py +128 -0
- socialctl/saas/renewal.py +74 -0
- socialctl/saas/restore_guard.py +229 -0
- socialctl/saas/revocation.py +97 -0
- socialctl/saas/rotation.py +114 -0
- socialctl/saas/routes.py +221 -0
- socialctl/saas/settings.py +34 -0
- socialctl/saas/store.py +106 -0
- socialctl/saas/temporary_media.py +245 -0
- socialctl/saas/webhooks.py +76 -0
- socialctl/schedule_remote.py +262 -0
- socialctl/schedule_sqlite.py +44 -0
- socialctl/scheduler.py +581 -0
- socialctl/scheduler_launchd.py +319 -0
- socialctl/scheduler_systemd.py +167 -0
- socialctl/source_links.py +119 -0
- socialctl/ui/__init__.py +1 -0
- socialctl/ui/assets/agent-manual.md +850 -0
- socialctl/ui/assets/agents.md +27 -0
- socialctl/ui/assets/components.css +20 -0
- socialctl/ui/assets/connection-layout.css +53 -0
- socialctl/ui/assets/otp.template.html +10 -0
- socialctl/ui/assets/tokens.css +1 -0
- socialctl/ui/assets/trial.template.html +11 -0
- socialctl/ui/assets/web-layout.css +38 -0
- socialctl/ui/email/otp.html +10 -0
- socialctl/ui/email/trial.html +11 -0
- socialctl/upload_consent.py +13 -0
- socialctl/workspace.py +8 -0
- socialctl/youtube_data.py +471 -0
- socialctl/youtube_data_service.py +225 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"""Native YouTube writes, closed by default; API readback is not Studio evidence.
|
|
2
|
+
|
|
3
|
+
Controller supplies independently verified account/project/pilot eligibility. Results
|
|
4
|
+
are transport observations, never ledger attestations. No legacy publish fallback.
|
|
5
|
+
"""
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Literal
|
|
10
|
+
from urllib.parse import urlsplit
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
|
|
14
|
+
import httpx
|
|
15
|
+
|
|
16
|
+
from socialctl.adapters.youtube import URL_UPLOAD, URL_VIDEOS, _TIPO_MIME_VIDEO
|
|
17
|
+
from socialctl.brands import Brand
|
|
18
|
+
from socialctl.management.metadata_parts import MetadataEdit, propose_parts, validate_status
|
|
19
|
+
from socialctl.management.youtube_metadata import YouTubeMetadataClient
|
|
20
|
+
from .approval import native_api_followup_pending, verify_approval
|
|
21
|
+
from .models import NativeJob
|
|
22
|
+
from .store import NativeStore
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class YouTubeEligibility:
|
|
27
|
+
account_id: str = ''
|
|
28
|
+
project_verified: bool = False
|
|
29
|
+
studio_pilot_verified: bool = False
|
|
30
|
+
evidence_ref: str = ''
|
|
31
|
+
api_enabled: bool = False
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass(frozen=True)
|
|
35
|
+
class YouTubeScheduleResult:
|
|
36
|
+
state: Literal['ui_required', 'pending_verification', 'uncertain', 'conflict', 'published']
|
|
37
|
+
remote_id: str | None = None
|
|
38
|
+
reason: str = ''
|
|
39
|
+
resource: dict | None = None
|
|
40
|
+
source: Literal['api'] = 'api'
|
|
41
|
+
calendar_visible: Literal[False] = False
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _context(job, payload, brand, store):
|
|
45
|
+
if (job.brand != brand.nombre or store.brand != job.brand or
|
|
46
|
+
store.path.parent != brand.raiz.resolve() or job.platform != 'youtube' or
|
|
47
|
+
(brand.cuentas.get('youtube') or {}).get('channel_id') != job.account_id):
|
|
48
|
+
raise ValueError('Explicit brand/account/store mismatch')
|
|
49
|
+
if store.get(job.id) != job or store.get_payload(job.id) != payload:
|
|
50
|
+
raise ValueError('Stale job or changed stored payload')
|
|
51
|
+
verify_approval(job, payload)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _future(job):
|
|
55
|
+
if job.publish_at <= datetime.now(timezone.utc):
|
|
56
|
+
raise ValueError('Future publish_at required; immediate publication forbidden')
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _checkpoint(store, job, **values):
|
|
60
|
+
# Resumable URI is a bearer-capable secret. SQLite journal inherits DB mode.
|
|
61
|
+
os.chmod(store.path, 0o600)
|
|
62
|
+
store.checkpoint(job.id, job.attempt_id, values)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _uncertain(store, job, remote_id=None):
|
|
66
|
+
current = store.get(job.id)
|
|
67
|
+
if current.state in {'dispatching', 'verifying'}:
|
|
68
|
+
store.transition(job.id, current.state, 'uncertain')
|
|
69
|
+
return YouTubeScheduleResult('uncertain', remote_id, 'Reconcile existing attempt; never upload again')
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _id(value):
|
|
73
|
+
if not isinstance(value, str) or not re.fullmatch(r'[A-Za-z0-9_-]{11}', value):
|
|
74
|
+
raise ValueError('Invalid video identity')
|
|
75
|
+
return value
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _session(value):
|
|
79
|
+
parsed = urlsplit(value)
|
|
80
|
+
if (parsed.scheme != 'https' or parsed.hostname != 'www.googleapis.com' or
|
|
81
|
+
parsed.port not in (None,443) or parsed.username or parsed.password or parsed.fragment or
|
|
82
|
+
not parsed.path.startswith('/upload/')):
|
|
83
|
+
raise ValueError('Invalid resumable endpoint')
|
|
84
|
+
return value
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
_CHUNK_BYTES = 256 * 1024
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _upload_chunks(client, session, token, path, size, job, store, *, start_offset=0):
|
|
91
|
+
"""Send approved original bytes in resumable chunks; trust only confirmed Range."""
|
|
92
|
+
if not 0 <= start_offset < size:
|
|
93
|
+
raise ValueError('Invalid confirmed upload offset')
|
|
94
|
+
offset = start_offset
|
|
95
|
+
with path.open('rb') as source:
|
|
96
|
+
while offset < size:
|
|
97
|
+
_future(job)
|
|
98
|
+
source.seek(offset)
|
|
99
|
+
chunk = source.read(min(_CHUNK_BYTES, size - offset))
|
|
100
|
+
if not chunk:
|
|
101
|
+
raise ValueError('Original video ended during upload')
|
|
102
|
+
end = offset + len(chunk) - 1
|
|
103
|
+
response = client.put(session, headers={
|
|
104
|
+
'Authorization': f'Bearer {token}',
|
|
105
|
+
'Content-Length': str(len(chunk)),
|
|
106
|
+
'Content-Type': _TIPO_MIME_VIDEO,
|
|
107
|
+
'Content-Range': f'bytes {offset}-{end}/{size}',
|
|
108
|
+
}, content=chunk, timeout=None)
|
|
109
|
+
if response.status_code == 308:
|
|
110
|
+
match = re.fullmatch(r'bytes=0-(\d+)', response.headers.get('Range', ''))
|
|
111
|
+
confirmed = int(match.group(1)) + 1 if match else 0
|
|
112
|
+
if not offset < confirmed <= end + 1 or confirmed >= size:
|
|
113
|
+
raise ValueError('Upload Range did not confirm forward progress')
|
|
114
|
+
offset = confirmed
|
|
115
|
+
_checkpoint(store, job, phase='uploading', offset=offset)
|
|
116
|
+
continue
|
|
117
|
+
response.raise_for_status()
|
|
118
|
+
remote_id = _id(response.json()['id'])
|
|
119
|
+
_checkpoint(store, job, phase='uploaded', offset=size, video_id=remote_id)
|
|
120
|
+
if end + 1 != size:
|
|
121
|
+
raise ValueError('Upload completed before all original bytes were sent')
|
|
122
|
+
return remote_id
|
|
123
|
+
raise ValueError('Upload ended without a remote video ID')
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _confirmed_offset(response, size):
|
|
127
|
+
if response.status_code != 308:
|
|
128
|
+
raise ValueError('Session did not report an incomplete upload')
|
|
129
|
+
value = response.headers.get('Range')
|
|
130
|
+
if value is None:
|
|
131
|
+
return 0
|
|
132
|
+
match = re.fullmatch(r'bytes=0-(\d+)', value)
|
|
133
|
+
if not match:
|
|
134
|
+
raise ValueError('Invalid resumable upload Range')
|
|
135
|
+
offset = int(match.group(1)) + 1
|
|
136
|
+
if not 0 < offset < size:
|
|
137
|
+
raise ValueError('Invalid incomplete upload offset')
|
|
138
|
+
return offset
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _metadata(payload, job):
|
|
142
|
+
options = payload['options']
|
|
143
|
+
allowed = {'format','title','categoryId','tags','defaultLanguage','video_id','never_published',
|
|
144
|
+
'selfDeclaredMadeForKids','containsSyntheticMedia','embeddable','license','publicStatsViewable'}
|
|
145
|
+
if set(options) - allowed or payload.get('visibility') != 'public':
|
|
146
|
+
raise ValueError('Unsupported approved options; reprepare for Studio')
|
|
147
|
+
snippet = {key: options[key] for key in ('title','categoryId','tags','defaultLanguage') if key in options}
|
|
148
|
+
if not isinstance(snippet.get('title'),str) or not snippet['title'].strip():
|
|
149
|
+
raise ValueError('Approved title required')
|
|
150
|
+
snippet['description'] = payload['copy']
|
|
151
|
+
status = {key:options[key] for key in ('selfDeclaredMadeForKids','containsSyntheticMedia','embeddable','license','publicStatsViewable') if key in options}
|
|
152
|
+
status.update(privacyStatus='private',publishAt=job.publish_at.isoformat().replace('+00:00','Z'))
|
|
153
|
+
validate_status(status, outgoing=True)
|
|
154
|
+
return {'snippet':snippet,'status':status}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _readback(job, payload, remote_id, api, expected_parts=None):
|
|
158
|
+
token = api._token()
|
|
159
|
+
if api._authenticated_channel(token) != job.account_id:
|
|
160
|
+
return YouTubeScheduleResult('conflict',remote_id,'Authenticated channel mismatch')
|
|
161
|
+
data=api._get_json(URL_VIDEOS,token,params={'id':remote_id,'part':'snippet,status,processingDetails'},operation='verify scheduling')
|
|
162
|
+
items=data.get('items')
|
|
163
|
+
if not isinstance(items,list) or len(items)!=1 or any(k in data for k in ('nextPageToken', 'prevPageToken')):
|
|
164
|
+
return YouTubeScheduleResult('uncertain',remote_id,'No unique remote readback')
|
|
165
|
+
item=items[0]; snippet=item.get('snippet',{}); status=item.get('status',{})
|
|
166
|
+
expected_options=payload['options']
|
|
167
|
+
matches=(item.get('id')==remote_id and snippet.get('channelId')==job.account_id and
|
|
168
|
+
snippet.get('description')==payload['copy'] and all(snippet.get(k)==expected_options[k]
|
|
169
|
+
for k in ('title','categoryId','tags','defaultLanguage') if k in expected_options) and
|
|
170
|
+
all(status.get(k)==expected_options[k] for k in ('selfDeclaredMadeForKids','containsSyntheticMedia','embeddable','license','publicStatsViewable') if k in expected_options))
|
|
171
|
+
for part, fields in (expected_parts or {}).items():
|
|
172
|
+
actual = item.get(part, {})
|
|
173
|
+
for key, value in fields.items():
|
|
174
|
+
if part == 'status' and key in {'privacyStatus', 'publishAt'}:
|
|
175
|
+
continue
|
|
176
|
+
if actual.get(key) != value:
|
|
177
|
+
matches = False
|
|
178
|
+
if not matches:
|
|
179
|
+
return YouTubeScheduleResult('conflict',remote_id,'Remote identity/copy/options differ',item)
|
|
180
|
+
if status.get('privacyStatus')=='public':
|
|
181
|
+
return YouTubeScheduleResult('published',remote_id,'Remote public visibility observed',item)
|
|
182
|
+
try:
|
|
183
|
+
when=datetime.fromisoformat(status.get('publishAt','').replace('Z','+00:00'))
|
|
184
|
+
except (ValueError,TypeError):
|
|
185
|
+
when=None
|
|
186
|
+
if status.get('privacyStatus')!='private' or when!=job.publish_at:
|
|
187
|
+
return YouTubeScheduleResult('conflict',remote_id,'Remote schedule differs; no overwrite',item)
|
|
188
|
+
if status.get('uploadStatus') in {'failed','rejected','deleted'} or item.get('processingDetails',{}).get('processingStatus') in {'failed','terminated'}:
|
|
189
|
+
return YouTubeScheduleResult('conflict',remote_id,'Remote processing failed',item)
|
|
190
|
+
return YouTubeScheduleResult('pending_verification',remote_id,'Studio calendar evidence required',item)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def schedule_youtube(job: NativeJob, payload: dict, *, brand: Brand, store: NativeStore,
|
|
194
|
+
client: httpx.Client, eligibility: YouTubeEligibility | None = None) -> YouTubeScheduleResult:
|
|
195
|
+
_context(job,payload,brand,store)
|
|
196
|
+
if job.state in {'uncertain','dispatching','verifying'} or store.get_attempts(job.id):
|
|
197
|
+
return YouTubeScheduleResult('uncertain',job.remote_id,'Existing attempt requires reconciliation')
|
|
198
|
+
eligibility=eligibility or YouTubeEligibility()
|
|
199
|
+
if (job.route!='api' or eligibility.account_id!=job.account_id or not eligibility.api_enabled or
|
|
200
|
+
not eligibility.project_verified or not eligibility.studio_pilot_verified or not eligibility.evidence_ref):
|
|
201
|
+
return YouTubeScheduleResult('ui_required',reason='API eligibility unproven; reprepare and approve route=ui')
|
|
202
|
+
pending = native_api_followup_pending(payload)
|
|
203
|
+
if pending:
|
|
204
|
+
return YouTubeScheduleResult('ui_required', reason=pending)
|
|
205
|
+
_future(job)
|
|
206
|
+
metadata=_metadata(payload,job)
|
|
207
|
+
api=YouTubeMetadataClient(brand,client)
|
|
208
|
+
remote_id=payload['options'].get('video_id') or job.remote_id
|
|
209
|
+
if job.remote_id and remote_id!=job.remote_id:
|
|
210
|
+
raise ValueError('Existing video identity mismatch')
|
|
211
|
+
if remote_id:
|
|
212
|
+
_id(remote_id)
|
|
213
|
+
edit=MetadataEdit(video_id=remote_id,kind='schedule',never_published=payload['options'].get('never_published',False),patch={k:metadata['status'][k] for k in ('publishAt','privacyStatus')})
|
|
214
|
+
observed=api.inspect(remote_id)
|
|
215
|
+
if payload.get('first_comment') and observed.resource['status'].get('madeForKids') is True:
|
|
216
|
+
return YouTubeScheduleResult('ui_required', reason='First comments are unavailable for videos made for kids; no submission attempted')
|
|
217
|
+
if observed.resource['status'].get('privacyStatus')!='private':
|
|
218
|
+
raise ValueError('Existing video is not private; no write')
|
|
219
|
+
if any(observed.resource['snippet'].get(k)!=v for k,v in metadata['snippet'].items()):
|
|
220
|
+
raise ValueError('Existing copy differs; reprepare exact metadata')
|
|
221
|
+
if any(observed.resource['status'].get(k)!=v for k,v in metadata['status'].items() if k not in {'privacyStatus','publishAt'}):
|
|
222
|
+
raise ValueError('Existing audience/options differ; reprepare')
|
|
223
|
+
_,parts=propose_parts(observed,edit)
|
|
224
|
+
else:
|
|
225
|
+
if len(payload['media'])!=1: raise ValueError('Exactly one supplied video required')
|
|
226
|
+
path=Path(payload['media'][0]['path']); size=path.stat().st_size
|
|
227
|
+
token=api._token()
|
|
228
|
+
if api._authenticated_channel(token)!=job.account_id: raise ValueError('Authenticated channel mismatch')
|
|
229
|
+
_future(job)
|
|
230
|
+
job=store.claim(job.id,job.state)
|
|
231
|
+
if job is None: raise ValueError('Job could not be claimed')
|
|
232
|
+
try:
|
|
233
|
+
if remote_id:
|
|
234
|
+
_checkpoint(store,job,video_id=remote_id,expected_parts=parts)
|
|
235
|
+
verify_approval(job,payload)
|
|
236
|
+
api.update_parts(remote_id,parts,etag=observed.etag)
|
|
237
|
+
else:
|
|
238
|
+
_future(job)
|
|
239
|
+
response=client.post(URL_UPLOAD,params={'uploadType':'resumable','part':'snippet,status'},headers={'Authorization':f'Bearer {token}','X-Upload-Content-Length':str(size),'X-Upload-Content-Type':_TIPO_MIME_VIDEO},json=metadata)
|
|
240
|
+
response.raise_for_status()
|
|
241
|
+
session=_session(response.headers['Location'])
|
|
242
|
+
_checkpoint(store,job,session_uri=session,total_bytes=size,offset=0,expected_parts=metadata)
|
|
243
|
+
_future(job)
|
|
244
|
+
verify_approval(job,payload)
|
|
245
|
+
remote_id=_upload_chunks(client,session,token,path,size,job,store)
|
|
246
|
+
result=_readback(job,payload,remote_id,api,parts if payload['options'].get('video_id') or job.remote_id else metadata)
|
|
247
|
+
if result.state!='pending_verification':
|
|
248
|
+
_uncertain(store,job,remote_id)
|
|
249
|
+
else: store.transition(job.id,'dispatching','verifying')
|
|
250
|
+
return result
|
|
251
|
+
except Exception:
|
|
252
|
+
return _uncertain(store,job,remote_id)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def resume_youtube(job: NativeJob, payload: dict, *, brand: Brand, store: NativeStore,
|
|
256
|
+
client: httpx.Client,
|
|
257
|
+
eligibility: YouTubeEligibility | None = None) -> YouTubeScheduleResult:
|
|
258
|
+
"""Explicitly resume the existing upload after querying its remote offset."""
|
|
259
|
+
_context(job, payload, brand, store)
|
|
260
|
+
eligibility = eligibility or YouTubeEligibility()
|
|
261
|
+
if (job.state != 'uncertain' or job.route != 'api' or
|
|
262
|
+
eligibility.account_id != job.account_id or not eligibility.api_enabled or
|
|
263
|
+
not eligibility.project_verified or not eligibility.studio_pilot_verified or
|
|
264
|
+
not eligibility.evidence_ref):
|
|
265
|
+
return YouTubeScheduleResult('ui_required', reason='Existing API attempt or eligibility unproven')
|
|
266
|
+
attempts = store.get_attempts(job.id)
|
|
267
|
+
checkpoint = attempts[-1]['checkpoint'] if attempts else {}
|
|
268
|
+
if (not job.attempt_id or not checkpoint.get('session_uri') or
|
|
269
|
+
checkpoint.get('video_id')):
|
|
270
|
+
return YouTubeScheduleResult('uncertain', job.remote_id,
|
|
271
|
+
'No incomplete session can be resumed')
|
|
272
|
+
session = _session(checkpoint['session_uri'])
|
|
273
|
+
media = payload.get('media')
|
|
274
|
+
if not isinstance(media, list) or len(media) != 1:
|
|
275
|
+
raise ValueError('One approved original video required')
|
|
276
|
+
path = Path(media[0]['path'])
|
|
277
|
+
size = path.stat().st_size
|
|
278
|
+
if size != checkpoint.get('total_bytes'):
|
|
279
|
+
raise ValueError('Original video size differs from upload session')
|
|
280
|
+
_future(job)
|
|
281
|
+
claimed = store.resume_attempt(job.id, job.attempt_id)
|
|
282
|
+
if claimed is None:
|
|
283
|
+
return YouTubeScheduleResult('uncertain', job.remote_id,
|
|
284
|
+
'Another worker owns the existing attempt')
|
|
285
|
+
remote_id = None
|
|
286
|
+
try:
|
|
287
|
+
api = YouTubeMetadataClient(brand, client)
|
|
288
|
+
token = api._token()
|
|
289
|
+
if api._authenticated_channel(token) != job.account_id:
|
|
290
|
+
raise ValueError('Authenticated channel mismatch')
|
|
291
|
+
_checkpoint(store, claimed, phase='resume_query_requested')
|
|
292
|
+
response = client.put(session, headers={
|
|
293
|
+
'Authorization': f'Bearer {token}', 'Content-Length': '0',
|
|
294
|
+
'Content-Range': f'bytes */{size}'}, content=b'')
|
|
295
|
+
if response.status_code == 308:
|
|
296
|
+
offset = _confirmed_offset(response, size)
|
|
297
|
+
_checkpoint(store, claimed, phase='resume_offset_confirmed', offset=offset)
|
|
298
|
+
verify_approval(claimed, payload)
|
|
299
|
+
remote_id = _upload_chunks(client, session, token, path, size,
|
|
300
|
+
claimed, store, start_offset=offset)
|
|
301
|
+
else:
|
|
302
|
+
response.raise_for_status()
|
|
303
|
+
remote_id = _id(response.json()['id'])
|
|
304
|
+
_checkpoint(store, claimed, phase='uploaded', offset=size, video_id=remote_id)
|
|
305
|
+
result = _readback(claimed, payload, remote_id, api,
|
|
306
|
+
checkpoint.get('expected_parts'))
|
|
307
|
+
if result.state == 'pending_verification':
|
|
308
|
+
store.transition(job.id, 'dispatching', 'verifying')
|
|
309
|
+
else:
|
|
310
|
+
_uncertain(store, claimed, remote_id)
|
|
311
|
+
return result
|
|
312
|
+
except Exception:
|
|
313
|
+
return _uncertain(store, claimed, remote_id)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def reconcile_youtube(job: NativeJob, payload: dict, *, brand: Brand, store: NativeStore,
|
|
317
|
+
client: httpx.Client) -> YouTubeScheduleResult:
|
|
318
|
+
"""Read or query the existing upload only. Never sends bytes or starts sessions."""
|
|
319
|
+
_context(job,payload,brand,store)
|
|
320
|
+
attempts=store.get_attempts(job.id)
|
|
321
|
+
checkpoint=attempts[-1]['checkpoint'] if attempts else {}
|
|
322
|
+
remote_id=checkpoint.get('video_id') or job.remote_id
|
|
323
|
+
api=YouTubeMetadataClient(brand,client)
|
|
324
|
+
try:
|
|
325
|
+
if not remote_id and checkpoint.get('session_uri'):
|
|
326
|
+
token=api._token()
|
|
327
|
+
if api._authenticated_channel(token)!=job.account_id: raise ValueError('Channel mismatch')
|
|
328
|
+
response=client.put(_session(checkpoint['session_uri']),headers={'Authorization':f'Bearer {token}','Content-Length':'0','Content-Range':f"bytes */{checkpoint['total_bytes']}"},content=b'')
|
|
329
|
+
if response.status_code==308:
|
|
330
|
+
return _uncertain(store,job)
|
|
331
|
+
response.raise_for_status()
|
|
332
|
+
remote_id=_id(response.json()['id'])
|
|
333
|
+
_checkpoint(store,job,video_id=remote_id)
|
|
334
|
+
if not remote_id: return _uncertain(store,job)
|
|
335
|
+
result=_readback(job,payload,_id(remote_id),api,checkpoint.get('expected_parts'))
|
|
336
|
+
if result.state in {'conflict','uncertain'}: _uncertain(store,job,remote_id)
|
|
337
|
+
return result
|
|
338
|
+
except Exception:
|
|
339
|
+
return _uncertain(store,job,remote_id)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Explicit JSON for durable community operations, with separate approval UI."""
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
from contextlib import nullcontext, redirect_stdout
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from socialctl.approval_cli import ApprovalRequired, read_approval
|
|
9
|
+
from socialctl.agent_errors import error_document, error_for_code
|
|
10
|
+
from socialctl.brands import cargar_brand, BrandNoEncontrada, NombreDeMarcaInvalido, AccountsInvalido
|
|
11
|
+
from socialctl.management.changes import ApprovalMismatch
|
|
12
|
+
from socialctl.read_reports import safe_error
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class OperationOutput:
|
|
16
|
+
def __init__(self, json_output, *, read_only=False):
|
|
17
|
+
self.json_output = json_output
|
|
18
|
+
self.read_only = read_only
|
|
19
|
+
self.started = False
|
|
20
|
+
self.change_id = None
|
|
21
|
+
|
|
22
|
+
def __enter__(self):
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def __exit__(self, kind, exc, traceback):
|
|
26
|
+
if exc is None or isinstance(exc, typer.Exit):
|
|
27
|
+
return False
|
|
28
|
+
if not isinstance(exc, (Exception, KeyboardInterrupt)):
|
|
29
|
+
return False
|
|
30
|
+
if not self.json_output:
|
|
31
|
+
if isinstance(exc, (typer.Abort, KeyboardInterrupt)):
|
|
32
|
+
return False
|
|
33
|
+
typer.echo(safe_error(str(exc)))
|
|
34
|
+
raise typer.Exit(1) from None
|
|
35
|
+
from socialctl.management.meta_comments import CommentAlreadyVerified
|
|
36
|
+
if isinstance(exc, CommentAlreadyVerified):
|
|
37
|
+
detail = error_for_code('operation_already_verified', read_only=False)
|
|
38
|
+
elif self.started:
|
|
39
|
+
# Service entry can persist/send a write before a later failure. Even
|
|
40
|
+
# a failed journal save cannot prove that the provider rejected it.
|
|
41
|
+
detail = error_for_code('operation_uncertain', read_only=False)
|
|
42
|
+
elif isinstance(exc, (BrandNoEncontrada, NombreDeMarcaInvalido, AccountsInvalido)):
|
|
43
|
+
detail = error_for_code('invalid_input')
|
|
44
|
+
elif isinstance(exc, ApprovalRequired):
|
|
45
|
+
detail = error_for_code('approval_required', read_only=False)
|
|
46
|
+
elif isinstance(exc, ApprovalMismatch):
|
|
47
|
+
detail = error_for_code('approval_mismatch')
|
|
48
|
+
elif isinstance(exc, (typer.Abort, KeyboardInterrupt)):
|
|
49
|
+
detail = error_for_code('operation_cancelled')
|
|
50
|
+
else:
|
|
51
|
+
detail = error_document(exc, read_only=self.read_only)
|
|
52
|
+
payload = {'version': 1, 'status': 'error', 'error': detail}
|
|
53
|
+
if self.change_id is not None:
|
|
54
|
+
payload['change_id'] = self.change_id
|
|
55
|
+
typer.echo(json.dumps(payload))
|
|
56
|
+
raise typer.Exit(1) from None
|
|
57
|
+
|
|
58
|
+
def brand(self, root, name):
|
|
59
|
+
return cargar_brand(root, name)
|
|
60
|
+
|
|
61
|
+
def approve(self, change, preview, approval=None, *, approval_stdin=False):
|
|
62
|
+
self.change_id = change.id
|
|
63
|
+
typer.echo(preview, err=self.json_output)
|
|
64
|
+
# Typer's input helper still prints the last prompt character to stdout
|
|
65
|
+
# even with err=True. Route the entire prompt interaction, never results.
|
|
66
|
+
with redirect_stdout(sys.stderr) if self.json_output else nullcontext():
|
|
67
|
+
digest = read_approval(approval, approval_stdin=approval_stdin)
|
|
68
|
+
if digest != change.fingerprint:
|
|
69
|
+
raise ApprovalMismatch('approval does not match exact fingerprint')
|
|
70
|
+
return digest
|
|
71
|
+
|
|
72
|
+
def begin_write(self):
|
|
73
|
+
self.started = True
|
|
74
|
+
|
|
75
|
+
def emit(self, result):
|
|
76
|
+
payload = result.model_dump(mode='json')
|
|
77
|
+
if self.json_output and result.status not in {'verified', 'respondido'}:
|
|
78
|
+
code = {
|
|
79
|
+
'proposed': 'approval_required', 'draft': 'approval_required',
|
|
80
|
+
'rejected': 'operation_rejected', 'failed': 'operation_rejected',
|
|
81
|
+
'conflict': 'operation_rejected', 'bloqueado': 'operation_rejected',
|
|
82
|
+
'applying': 'operation_uncertain', 'uncertain': 'operation_uncertain',
|
|
83
|
+
'applied_unverified': 'operation_accepted_unverified', 'partial': 'operation_uncertain',
|
|
84
|
+
'accepted_unverifiable': 'operation_accepted_unverified', 'incierto': 'operation_uncertain',
|
|
85
|
+
}.get(result.status, 'operation_failed')
|
|
86
|
+
payload['error_detail'] = error_for_code(code, read_only=False)
|
|
87
|
+
typer.echo(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Account identifiers for this brand. Never put secrets here:
|
|
2
|
+
# tokens belong in .secrets/ and must never be committed.
|
|
3
|
+
|
|
4
|
+
youtube:
|
|
5
|
+
channel_id: ""
|
|
6
|
+
|
|
7
|
+
facebook:
|
|
8
|
+
page_id: ""
|
|
9
|
+
|
|
10
|
+
instagram:
|
|
11
|
+
# Requires a professional account linked to the Facebook Page above.
|
|
12
|
+
ig_user_id: ""
|
|
13
|
+
# HTTPS base URL for supplied media. With `media transfer`, it must match
|
|
14
|
+
# the server's media-policy.json. `media verify --remote --public` checks
|
|
15
|
+
# all bytes (SHA-256, size, MIME), not merely a HEAD 200 response.
|
|
16
|
+
# See MEDIA-INGESTION.md. Transfer neither approves nor publishes a post.
|
|
17
|
+
media_url_base: ""
|
|
18
|
+
|
|
19
|
+
tiktok:
|
|
20
|
+
# Filled automatically by `socialcli auth tiktok`, which requests
|
|
21
|
+
# user.info.basic and reads open_id from the token exchange response
|
|
22
|
+
# without additional calls. If unavailable (for example, with an older
|
|
23
|
+
# token lacking that scope), the command warns you to fill it manually.
|
|
24
|
+
# See SETUP.md, TikTok section. Request:
|
|
25
|
+
# GET https://open.tiktokapis.com/v2/user/info/?fields=open_id
|
|
26
|
+
# with 'Authorization: Bearer <access_token>' using the token stored
|
|
27
|
+
# by `socialcli auth tiktok` in .secrets/tiktok.json.
|
|
28
|
+
open_id: ""
|
|
29
|
+
# inbox -> upload to inbox; you finish publishing in the app
|
|
30
|
+
# direct -> disabled and excluded from the current offer, regardless of
|
|
31
|
+
# auditada; use creator-reviewed inbox upload
|
|
32
|
+
mode: inbox
|
|
33
|
+
auditada: false
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Brand identity
|
|
2
|
+
|
|
3
|
+
This file defines how the brand speaks, looks and sounds. Shared code and skills contain no preferences for any particular brand. What you write here determines copy and guides audiovisual production.
|
|
4
|
+
|
|
5
|
+
> **How to fill this in.** Each section includes a generic example, not this brand's voice. Replace it with your own choices. While a section is marked as pending, the agent must ask before assuming anything.
|
|
6
|
+
|
|
7
|
+
## Language
|
|
8
|
+
|
|
9
|
+
English.
|
|
10
|
+
|
|
11
|
+
## Tone
|
|
12
|
+
|
|
13
|
+
How the brand sounds. The same fact can be told in different ways.
|
|
14
|
+
|
|
15
|
+
*Example — one fact in three tones:*
|
|
16
|
+
|
|
17
|
+
- **Informative and approachable:** “This existed earlier than you might think.”
|
|
18
|
+
- **Precise and restrained:** “First documented in 1498, according to surviving sources.”
|
|
19
|
+
- **Bold hook:** “Everything you were told about this is wrong 🤯”
|
|
20
|
+
|
|
21
|
+
Choose the tone that fits your brand.
|
|
22
|
+
|
|
23
|
+
**Pending:** rigor, approachability, formality and whether humor belongs.
|
|
24
|
+
|
|
25
|
+
## Topics
|
|
26
|
+
|
|
27
|
+
What the brand covers and excludes. This keeps copy within your scope.
|
|
28
|
+
|
|
29
|
+
*Example:* “X, Y and Z, based on sources. Exclude A, B and comparisons with current events.”
|
|
30
|
+
|
|
31
|
+
**Pending.**
|
|
32
|
+
|
|
33
|
+
## Call to action
|
|
34
|
+
|
|
35
|
+
How posts end. This can be consistent or vary by platform.
|
|
36
|
+
|
|
37
|
+
*Example:* “Watch the full piece on the channel.” / “Subscribe for more on this topic.” / No call to action.
|
|
38
|
+
|
|
39
|
+
**Pending.** The agent must ask if a call to action is needed before one is defined here.
|
|
40
|
+
|
|
41
|
+
## Default hashtags
|
|
42
|
+
|
|
43
|
+
Hashtags used with most posts. **Without this section, add none.** Do not invent hashtags.
|
|
44
|
+
|
|
45
|
+
*Example:* `yourbrand`, `yourtopic`, `yourcategory`
|
|
46
|
+
|
|
47
|
+
**Pending.**
|
|
48
|
+
|
|
49
|
+
## Never
|
|
50
|
+
|
|
51
|
+
The brand's boundaries, including claims or tactics you would not use.
|
|
52
|
+
|
|
53
|
+
*Example:* “No clickbait the content cannot deliver. No claims without sources. Never present a hypothesis as established fact.”
|
|
54
|
+
|
|
55
|
+
**Pending.**
|
|
56
|
+
|
|
57
|
+
## Audiovisual identity
|
|
58
|
+
|
|
59
|
+
Complete this section if the brand produces video. Do not copy another brand's settings by default. Identify approved decisions and proposals. SocialCli itself only accepts produced media.
|
|
60
|
+
|
|
61
|
+
- **Palette and typography:** colors, fonts, logo use and contrast.
|
|
62
|
+
- **Visual style and motion:** pace, composition, maps, graphics and preferred or excluded treatments.
|
|
63
|
+
- **Voice and music:** approved narrator or engine, musical character and available tools.
|
|
64
|
+
- **Generation and 3D:** authorized tools, character continuity and reconstruction criteria.
|
|
65
|
+
- **Editing and delivery:** editor, transitions, aspect ratio, resolution, fps, color space, container and codecs, audio sample rate and channels, loudness and true peak targets, subtitles and horizontal or vertical versions. Record episode-specific values in that project's file.
|
|
66
|
+
|
|
67
|
+
**Pending for this brand.** Episode-specific decisions belong in that project's `estado.md` file.
|
|
68
|
+
|
|
69
|
+
## Copy templates
|
|
70
|
+
|
|
71
|
+
Define how the brand writes for each platform.
|
|
72
|
+
|
|
73
|
+
### YouTube
|
|
74
|
+
|
|
75
|
+
Titles should work on their own and contain no more than 100 characters. Define long descriptions and separate tags here.
|
|
76
|
+
|
|
77
|
+
**Pending.**
|
|
78
|
+
|
|
79
|
+
### Instagram
|
|
80
|
+
|
|
81
|
+
Put the hook in the first line, before the caption is truncated. Place hashtags at the end.
|
|
82
|
+
|
|
83
|
+
**Pending.**
|
|
84
|
+
|
|
85
|
+
### TikTok
|
|
86
|
+
|
|
87
|
+
One or two lines with hashtags included in the text.
|
|
88
|
+
|
|
89
|
+
**Pending.**
|
|
90
|
+
|
|
91
|
+
### Facebook
|
|
92
|
+
|
|
93
|
+
Define longer copy and links to the complete piece where appropriate.
|
|
94
|
+
|
|
95
|
+
**Pending.**
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Brand strategy
|
|
2
|
+
|
|
3
|
+
This file preserves the brand's goals, cadence, upcoming work and lessons between sessions. SocialCli does not parse or validate it; like `brand.md`, it is free text that agents must read and respect.
|
|
4
|
+
|
|
5
|
+
> **How to fill this in.** While a section is marked as pending, the agent must ask before assuming anything. Start with the goal and publishing cadence; other sections can follow later.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Define what the brand is trying to achieve. Subscriber growth, long-form retention and TikTok reach require different decisions.
|
|
10
|
+
|
|
11
|
+
*Example:* “This quarter, improve YouTube long-form retention. Short clips exist to direct viewers to the full video.”
|
|
12
|
+
|
|
13
|
+
**Pending.**
|
|
14
|
+
|
|
15
|
+
## Cadence by platform
|
|
16
|
+
|
|
17
|
+
How many pieces of each format to publish weekly on each platform.
|
|
18
|
+
|
|
19
|
+
*Example:*
|
|
20
|
+
|
|
21
|
+
| Platform | Cadence | Format |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| YouTube | 1 long video every 2 weeks | 15–20 min |
|
|
24
|
+
| Instagram | 3 per week | 9:16 Reel |
|
|
25
|
+
| TikTok | 3 per week | 9:16 |
|
|
26
|
+
| Facebook | 1 per week | Link to full video |
|
|
27
|
+
|
|
28
|
+
**Pending.**
|
|
29
|
+
|
|
30
|
+
## Content pillars
|
|
31
|
+
|
|
32
|
+
The categories and formats behind the brand's posts. `brand.md` defines topics; this section defines their publishing formats.
|
|
33
|
+
|
|
34
|
+
*Example:* “Pillar A → one long video monthly + 3 vertical clips. Pillar B → clips only. Pillar C → image carousel.”
|
|
35
|
+
|
|
36
|
+
**Pending.**
|
|
37
|
+
|
|
38
|
+
## Upcoming plan
|
|
39
|
+
|
|
40
|
+
Track upcoming pieces and their status. Use this sequence: `idea` → `script` → `production` → `published`. These are planning labels in this free-text file, not CLI publication states.
|
|
41
|
+
|
|
42
|
+
*Example:*
|
|
43
|
+
|
|
44
|
+
| Piece | Status | Notes |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Next piece title | idea | Date to confirm |
|
|
47
|
+
|
|
48
|
+
**Pending.**
|
|
49
|
+
|
|
50
|
+
## Lessons
|
|
51
|
+
|
|
52
|
+
Record what worked and what did not, **with a date and data source** so it can be checked again. Use user-provided evidence or authorized metrics outputs.
|
|
53
|
+
|
|
54
|
+
*Example:* “2026-01-15 — Clips opening with a concrete consequence retain more viewers than clips opening with a question. Source: average retention of the last 6 Shorts, YouTube Studio.”
|
|
55
|
+
|
|
56
|
+
**Pending.**
|
|
57
|
+
|
|
58
|
+
## Settled decisions
|
|
59
|
+
|
|
60
|
+
Record decisions that should not be reopened every session.
|
|
61
|
+
|
|
62
|
+
*Example:* “Keep the title format. Review everything before public publication.”
|
|
63
|
+
|
|
64
|
+
**Pending.**
|