@@ -3137,6 +3137,12 @@ def init(
31373137 "--github-token" ,
31383138 help = "GitHub token to use for API requests (or set GH_TOKEN or GITHUB_TOKEN environment variable)" ,
31393139 ),
3140+ team_ai_directives : str = typer .Option (
3141+ None ,
3142+ "--team-ai-directives" ,
3143+ "--team-ai-directive" ,
3144+ help = "Clone or reference a team-ai-directives repository during setup" ,
3145+ ),
31403146 ai_skills : bool = typer .Option (
31413147 False ,
31423148 "--ai-skills" ,
@@ -3155,7 +3161,8 @@ def init(
31553161 3. Download the appropriate template from GitHub
31563162 4. Extract the template to a new project directory or current directory
31573163 5. Initialize a fresh git repository (if not --no-git and no existing repo)
3158- 6. Optionally set up AI assistant commands
3164+ 6. Optionally clone or reference a shared team-ai-directives repository
3165+ 7. Optionally set up AI assistant commands
31593166
31603167 Examples:
31613168 specify init my-project
@@ -3174,6 +3181,8 @@ def init(
31743181 specify init --here --ai gemini --ai-skills
31753182 specify init my-project --ai generic --ai-commands-dir .myagent/commands/ # Unsupported agent
31763183 specify init my-project --ai claude --preset healthcare-compliance # With preset
3184+ specify init --here --ai claude --team-ai-directives https://github.com/org/team-ai-directives.git # With team directives
3185+ specify init --here --ai claude --team-ai-directives ~/workspace/team-ai-directives # Local team directives
31773186 """
31783187
31793188 show_banner ()
@@ -3334,6 +3343,12 @@ def init(
33343343 "[yellow]Git not found - will skip repository initialization[/yellow]"
33353344 )
33363345
3346+ git_required_for_directives = bool (
3347+ team_ai_directives and team_ai_directives .strip ()
3348+ )
3349+ git_required = should_init_git or git_required_for_directives
3350+ git_available = True
3351+
33373352 if not ignore_agent_tools :
33383353 agent_config = AGENT_CONFIG .get (selected_ai )
33393354 if agent_config and agent_config ["requires_cli" ]:
@@ -3398,6 +3413,8 @@ def init(
33983413 tracker .add ("ai-skills" , "Install agent skills" )
33993414 tracker .add ("extensions" , "Install bundled extensions" )
34003415 tracker .add ("presets" , "Install bundled presets" )
3416+ if team_ai_directives :
3417+ tracker .add ("directives" , "Sync team-ai-directives" )
34013418 for key , label in [
34023419 ("cleanup" , "Cleanup" ),
34033420 ("git" , "Initialize git repository" ),
@@ -3490,6 +3507,23 @@ def init(
34903507 # Install bundled presets
34913508 install_bundled_presets (project_path , selected_ai , tracker = tracker )
34923509
3510+ # Sync team-ai-directives if provided
3511+ resolved_team_directives = None
3512+ team_arg = team_ai_directives .strip () if team_ai_directives else ""
3513+ if team_arg :
3514+ tracker .start ("directives" )
3515+ try :
3516+ status , resolved_path = sync_team_ai_directives (
3517+ team_arg , project_path , skip_tls = skip_tls
3518+ )
3519+ resolved_team_directives = resolved_path
3520+ tracker .complete ("directives" , status )
3521+ except Exception as e :
3522+ tracker .error ("directives" , str (e ))
3523+ raise
3524+ else :
3525+ tracker .skip ("directives" , "not provided" )
3526+
34933527 # When --ai-skills is used on a NEW project and skills were
34943528 # successfully installed, remove the command files that the
34953529 # template archive just created. Skills replace commands, so
0 commit comments