pltr-cli 0.3.0__tar.gz → 0.4.0__tar.gz

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 (103) hide show
  1. pltr_cli-0.4.0/CHANGELOG.md +26 -0
  2. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/CLAUDE.md +0 -1
  3. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/PKG-INFO +10 -3
  4. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/README.md +9 -2
  5. pltr_cli-0.4.0/children.csv +3 -0
  6. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/commands.md +101 -1
  7. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/quick-start.md +1 -1
  8. pltr_cli-0.4.0/folder_info.json +9 -0
  9. pltr_cli-0.4.0/folders.json +11 -0
  10. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/pyproject.toml +1 -1
  11. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/cli.py +2 -0
  12. pltr_cli-0.4.0/src/pltr/commands/folder.py +338 -0
  13. pltr_cli-0.4.0/src/pltr/services/folder.py +167 -0
  14. pltr_cli-0.4.0/tests/test_commands/test_folder.py +348 -0
  15. pltr_cli-0.4.0/tests/test_services/test_folder.py +262 -0
  16. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/uv.lock +592 -593
  17. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/.github/workflows/ci.yml +0 -0
  18. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/.github/workflows/publish.yml +0 -0
  19. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/.github/workflows/test-publish.yml +0 -0
  20. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/.gitignore +0 -0
  21. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/.pre-commit-config.yaml +0 -0
  22. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/LICENSE +0 -0
  23. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/README.md +0 -0
  24. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/api/wrapper.md +0 -0
  25. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/examples/gallery.md +0 -0
  26. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/aliases.md +0 -0
  27. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/authentication.md +0 -0
  28. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/troubleshooting.md +0 -0
  29. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/docs/user-guide/workflows.md +0 -0
  30. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/mypy.ini +0 -0
  31. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/scripts/release.py +0 -0
  32. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/__init__.py +0 -0
  33. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/__main__.py +0 -0
  34. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/__init__.py +0 -0
  35. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/base.py +0 -0
  36. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/manager.py +0 -0
  37. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/oauth.py +0 -0
  38. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/storage.py +0 -0
  39. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/auth/token.py +0 -0
  40. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/__init__.py +0 -0
  41. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/admin.py +0 -0
  42. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/alias.py +0 -0
  43. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/completion.py +0 -0
  44. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/configure.py +0 -0
  45. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/dataset.py +0 -0
  46. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/ontology.py +0 -0
  47. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/shell.py +0 -0
  48. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/sql.py +0 -0
  49. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/commands/verify.py +0 -0
  50. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/config/__init__.py +0 -0
  51. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/config/aliases.py +0 -0
  52. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/config/profiles.py +0 -0
  53. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/config/settings.py +0 -0
  54. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/__init__.py +0 -0
  55. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/admin.py +0 -0
  56. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/base.py +0 -0
  57. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/dataset.py +0 -0
  58. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/dataset_full.py +0 -0
  59. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/dataset_v2.py +0 -0
  60. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/ontology.py +0 -0
  61. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/services/sql.py +0 -0
  62. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/utils/__init__.py +0 -0
  63. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/utils/alias_resolver.py +0 -0
  64. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/utils/completion.py +0 -0
  65. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/utils/formatting.py +0 -0
  66. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/src/pltr/utils/progress.py +0 -0
  67. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/__init__.py +0 -0
  68. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/conftest.py +0 -0
  69. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/README.md +0 -0
  70. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/__init__.py +0 -0
  71. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/conftest.py +0 -0
  72. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/test_auth_flow.py +0 -0
  73. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/test_cli_integration.py +0 -0
  74. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/test_data_workflows.py +0 -0
  75. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/test_data_workflows_simple.py +0 -0
  76. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/integration/test_simple_integration.py +0 -0
  77. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/__init__.py +0 -0
  78. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/test_base.py +0 -0
  79. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/test_manager.py +0 -0
  80. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/test_oauth.py +0 -0
  81. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/test_storage.py +0 -0
  82. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_auth/test_token.py +0 -0
  83. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/__init__.py +0 -0
  84. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_admin.py +0 -0
  85. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_alias.py +0 -0
  86. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_completion.py +0 -0
  87. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_dataset.py +0 -0
  88. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_ontology.py +0 -0
  89. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_shell.py +0 -0
  90. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_sql.py +0 -0
  91. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_commands/test_verify_simple.py +0 -0
  92. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_config/__init__.py +0 -0
  93. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_config/test_aliases.py +0 -0
  94. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_config/test_profiles.py +0 -0
  95. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_config/test_settings.py +0 -0
  96. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/__init__.py +0 -0
  97. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/test_admin.py +0 -0
  98. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/test_base.py +0 -0
  99. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/test_dataset.py +0 -0
  100. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/test_ontology.py +0 -0
  101. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_services/test_sql.py +0 -0
  102. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_utils/__init__.py +0 -0
  103. {pltr_cli-0.3.0 → pltr_cli-0.4.0}/tests/test_utils/test_alias_resolver.py +0 -0
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.4.0] - 2025-01-31
9
+
10
+ ### Added
11
+ - Comprehensive folder management functionality
12
+ - Preview mode support for folder API operations
13
+
14
+ ### Fixed
15
+ - CI pipeline issues
16
+ - Code style and formatting improvements
17
+
18
+ ## [0.3.0] - 2024-12-XX
19
+
20
+ ### Added
21
+ - Initial release with core CLI functionality
22
+ - Palantir Foundry API integration
23
+ - Command-line interface for data operations
24
+
25
+ [0.4.0]: https://github.com/anjor/pltr-cli/compare/v0.3.0...v0.4.0
26
+ [0.3.0]: https://github.com/anjor/pltr-cli/releases/tag/v0.3.0
@@ -1,6 +1,5 @@
1
1
  ## Development tips
2
2
 
3
- Always keep @DEVELOPMENT_PLAN.md up to date.
4
3
  The basis of the SDK is https://github.com/palantir/foundry-platform-python . This is a
5
4
  CLI that wraps around the SDK to give a CLI interface.
6
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pltr-cli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Command-line interface for Palantir Foundry APIs
5
5
  Project-URL: Homepage, https://github.com/anjor/pltr-cli
6
6
  Project-URL: Repository, https://github.com/anjor/pltr-cli
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  # pltr-cli
39
39
 
40
- A comprehensive command-line interface for Palantir Foundry APIs, providing 65+ commands for data analysis, ontology operations, SQL queries, and administrative tasks.
40
+ A comprehensive command-line interface for Palantir Foundry APIs, providing 70+ commands for data analysis, ontology operations, SQL queries, folder management, and administrative tasks.
41
41
 
42
42
  ## Overview
43
43
 
@@ -47,6 +47,7 @@ A comprehensive command-line interface for Palantir Foundry APIs, providing 65+
47
47
 
48
48
  - 🔐 **Secure Authentication**: Token and OAuth2 support with encrypted credential storage
49
49
  - 📊 **Dataset Operations**: Get dataset information and create new datasets (RID-based API)
50
+ - 📁 **Folder Management**: Create, explore, and manage Foundry filesystem structure
50
51
  - 🎯 **Comprehensive Ontology Access**: 13 commands for objects, actions, and queries
51
52
  - 📝 **Full SQL Support**: Execute, submit, monitor, and export query results
52
53
  - 👥 **Admin Operations**: User, group, role, and organization management (16 commands)
@@ -109,6 +110,12 @@ pltr admin user current
109
110
  # List available ontologies
110
111
  pltr ontology list
111
112
 
113
+ # Create a new folder
114
+ pltr folder create "My Project"
115
+
116
+ # List root folder contents
117
+ pltr folder list ri.compass.main.folder.0
118
+
112
119
  # Execute a simple SQL query
113
120
  pltr sql execute "SELECT 1 as test"
114
121
 
@@ -133,7 +140,7 @@ pltr-cli provides comprehensive documentation to help you get the most out of th
133
140
  ### 📖 User Guides
134
141
  - **[Quick Start Guide](docs/user-guide/quick-start.md)** - Get up and running in 5 minutes
135
142
  - **[Authentication Setup](docs/user-guide/authentication.md)** - Complete guide to token and OAuth2 setup
136
- - **[Command Reference](docs/user-guide/commands.md)** - Complete reference for all 65+ commands
143
+ - **[Command Reference](docs/user-guide/commands.md)** - Complete reference for all 70+ commands
137
144
  - **[Common Workflows](docs/user-guide/workflows.md)** - Real-world data analysis patterns
138
145
  - **[Troubleshooting](docs/user-guide/troubleshooting.md)** - Solutions to common issues
139
146
 
@@ -1,6 +1,6 @@
1
1
  # pltr-cli
2
2
 
3
- A comprehensive command-line interface for Palantir Foundry APIs, providing 65+ commands for data analysis, ontology operations, SQL queries, and administrative tasks.
3
+ A comprehensive command-line interface for Palantir Foundry APIs, providing 70+ commands for data analysis, ontology operations, SQL queries, folder management, and administrative tasks.
4
4
 
5
5
  ## Overview
6
6
 
@@ -10,6 +10,7 @@ A comprehensive command-line interface for Palantir Foundry APIs, providing 65+
10
10
 
11
11
  - 🔐 **Secure Authentication**: Token and OAuth2 support with encrypted credential storage
12
12
  - 📊 **Dataset Operations**: Get dataset information and create new datasets (RID-based API)
13
+ - 📁 **Folder Management**: Create, explore, and manage Foundry filesystem structure
13
14
  - 🎯 **Comprehensive Ontology Access**: 13 commands for objects, actions, and queries
14
15
  - 📝 **Full SQL Support**: Execute, submit, monitor, and export query results
15
16
  - 👥 **Admin Operations**: User, group, role, and organization management (16 commands)
@@ -72,6 +73,12 @@ pltr admin user current
72
73
  # List available ontologies
73
74
  pltr ontology list
74
75
 
76
+ # Create a new folder
77
+ pltr folder create "My Project"
78
+
79
+ # List root folder contents
80
+ pltr folder list ri.compass.main.folder.0
81
+
75
82
  # Execute a simple SQL query
76
83
  pltr sql execute "SELECT 1 as test"
77
84
 
@@ -96,7 +103,7 @@ pltr-cli provides comprehensive documentation to help you get the most out of th
96
103
  ### 📖 User Guides
97
104
  - **[Quick Start Guide](docs/user-guide/quick-start.md)** - Get up and running in 5 minutes
98
105
  - **[Authentication Setup](docs/user-guide/authentication.md)** - Complete guide to token and OAuth2 setup
99
- - **[Command Reference](docs/user-guide/commands.md)** - Complete reference for all 65+ commands
106
+ - **[Command Reference](docs/user-guide/commands.md)** - Complete reference for all 70+ commands
100
107
  - **[Common Workflows](docs/user-guide/workflows.md)** - Real-world data analysis patterns
101
108
  - **[Troubleshooting](docs/user-guide/troubleshooting.md)** - Solutions to common issues
102
109
 
@@ -0,0 +1,3 @@
1
+ description,display_name,name,rid,type
2
+ A child folder,Child Folder,,ri.compass.main.folder.child-folder,folder
3
+ ,Child Dataset,Child Dataset,ri.foundry.main.dataset.child-dataset,dataset
@@ -1,6 +1,6 @@
1
1
  # Command Reference
2
2
 
3
- Complete reference for all pltr-cli commands. The CLI provides 65+ commands across 8 major command groups for comprehensive Foundry API access.
3
+ Complete reference for all pltr-cli commands. The CLI provides 70+ commands across 9 major command groups for comprehensive Foundry API access.
4
4
 
5
5
  ## Global Options
6
6
 
@@ -147,6 +147,101 @@ pltr dataset create "Analysis Results" --parent-folder ri.foundry.main.folder.xy
147
147
 
148
148
  ---
149
149
 
150
+ ## 📁 Folder Commands
151
+
152
+ Folder operations for managing the Foundry filesystem structure using the foundry-platform-sdk.
153
+
154
+ ### `pltr folder create [OPTIONS] NAME`
155
+ Create a new folder in Foundry.
156
+
157
+ **Arguments:**
158
+ - `NAME` (required): Folder display name
159
+
160
+ **Options:**
161
+ - `--parent-folder`, `-p` TEXT: Parent folder RID [default: ri.compass.main.folder.0 (root)]
162
+ - `--profile` TEXT: Profile name
163
+ - `--format`, `-f` TEXT: Output format (table, json, csv) [default: table]
164
+
165
+ **Examples:**
166
+ ```bash
167
+ # Create folder in root
168
+ pltr folder create "My Project"
169
+
170
+ # Create folder in specific parent
171
+ pltr folder create "Sub Folder" --parent-folder ri.compass.main.folder.xyz123
172
+
173
+ # Create with JSON output
174
+ pltr folder create "Analysis" --format json
175
+ ```
176
+
177
+ ### `pltr folder get [OPTIONS] FOLDER_RID`
178
+ Get detailed information about a specific folder.
179
+
180
+ **Arguments:**
181
+ - `FOLDER_RID` (required): Folder Resource Identifier
182
+
183
+ **Options:**
184
+ - `--profile` TEXT: Profile name
185
+ - `--format`, `-f` TEXT: Output format (table, json, csv) [default: table]
186
+ - `--output`, `-o` TEXT: Output file path
187
+
188
+ **Examples:**
189
+ ```bash
190
+ # Get folder info
191
+ pltr folder get ri.compass.main.folder.abc123
192
+
193
+ # Export as JSON
194
+ pltr folder get ri.compass.main.folder.abc123 --format json --output folder-info.json
195
+ ```
196
+
197
+ ### `pltr folder list [OPTIONS] FOLDER_RID`
198
+ List all child resources of a folder.
199
+
200
+ **Arguments:**
201
+ - `FOLDER_RID` (required): Folder Resource Identifier (use 'ri.compass.main.folder.0' for root)
202
+
203
+ **Options:**
204
+ - `--profile` TEXT: Profile name
205
+ - `--format`, `-f` TEXT: Output format (table, json, csv) [default: table]
206
+ - `--output`, `-o` TEXT: Output file path
207
+ - `--page-size` INTEGER: Number of items per page
208
+
209
+ **Examples:**
210
+ ```bash
211
+ # List root folder contents
212
+ pltr folder list ri.compass.main.folder.0
213
+
214
+ # List with pagination
215
+ pltr folder list ri.compass.main.folder.abc123 --page-size 50
216
+
217
+ # Export children list
218
+ pltr folder list ri.compass.main.folder.abc123 --format csv --output children.csv
219
+ ```
220
+
221
+ ### `pltr folder batch-get [OPTIONS] FOLDER_RIDS...`
222
+ Get multiple folders in a single request (max 1000).
223
+
224
+ **Arguments:**
225
+ - `FOLDER_RIDS...` (required): Space-separated list of folder Resource Identifiers
226
+
227
+ **Options:**
228
+ - `--profile` TEXT: Profile name
229
+ - `--format`, `-f` TEXT: Output format (table, json, csv) [default: table]
230
+ - `--output`, `-o` TEXT: Output file path
231
+
232
+ **Examples:**
233
+ ```bash
234
+ # Get multiple folders
235
+ pltr folder batch-get ri.compass.main.folder.abc123 ri.compass.main.folder.def456
236
+
237
+ # Export batch results
238
+ pltr folder batch-get ri.compass.main.folder.abc123 ri.compass.main.folder.def456 --format json --output folders.json
239
+ ```
240
+
241
+ **Root Folder RID**: `ri.compass.main.folder.0` - Use this as the parent folder RID to create folders in the root directory.
242
+
243
+ ---
244
+
150
245
  ## 🎯 Ontology Commands
151
246
 
152
247
  Comprehensive ontology operations for interacting with Foundry ontologies.
@@ -584,6 +679,11 @@ pltr sql execute "SELECT * FROM table" # Run SQL query
584
679
  pltr ontology list # List ontologies
585
680
  pltr dataset get <rid> # Get dataset info
586
681
 
682
+ # Folder Management
683
+ pltr folder create "My Folder" # Create folder
684
+ pltr folder list ri.compass.main.folder.0 # List root contents
685
+ pltr folder get <folder-rid> # Get folder info
686
+
587
687
  # Admin
588
688
  pltr admin user current # Current user info
589
689
  pltr admin user list # List users
@@ -39,7 +39,7 @@ pltr-cli needs to authenticate with your Foundry instance. You have two options:
39
39
  If you have a Foundry API token:
40
40
 
41
41
  ```bash
42
- pltr configure
42
+ pltr configure configure
43
43
  ```
44
44
 
45
45
  Follow the prompts to enter:
@@ -0,0 +1,9 @@
1
+ {
2
+ "rid": "ri.compass.main.folder.test-folder",
3
+ "display_name": "Test Folder",
4
+ "description": "Test folder description",
5
+ "parent_folder_rid": "ri.compass.main.folder.parent",
6
+ "created": "2024-01-01T00:00:00Z",
7
+ "modified": "2024-01-02T00:00:00Z",
8
+ "type": "folder"
9
+ }
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "rid": "ri.compass.main.folder.test-folder",
4
+ "display_name": "Test Folder",
5
+ "description": "Test folder description",
6
+ "parent_folder_rid": "ri.compass.main.folder.parent",
7
+ "created": "2024-01-01T00:00:00Z",
8
+ "modified": "2024-01-02T00:00:00Z",
9
+ "type": "folder"
10
+ }
11
+ ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pltr-cli"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "Command-line interface for Palantir Foundry APIs"
5
5
  authors = [
6
6
  { name = "anjor", email = "anjor@umd.edu" }
@@ -10,6 +10,7 @@ from pltr.commands import (
10
10
  configure,
11
11
  verify,
12
12
  dataset,
13
+ folder,
13
14
  ontology,
14
15
  sql,
15
16
  admin,
@@ -28,6 +29,7 @@ app = typer.Typer(
28
29
  app.add_typer(configure.app, name="configure", help="Manage authentication profiles")
29
30
  app.add_typer(verify.app, name="verify", help="Verify authentication")
30
31
  app.add_typer(dataset.app, name="dataset", help="Manage datasets")
32
+ app.add_typer(folder.app, name="folder", help="Manage folders")
31
33
  app.add_typer(ontology.app, name="ontology", help="Ontology operations")
32
34
  app.add_typer(sql.app, name="sql", help="Execute SQL queries")
33
35
  app.add_typer(
@@ -0,0 +1,338 @@
1
+ """
2
+ Folder management commands for Foundry filesystem.
3
+ """
4
+
5
+ import typer
6
+ from typing import Optional, List
7
+ from rich.console import Console
8
+ from rich.table import Table
9
+
10
+ from ..services.folder import FolderService
11
+ from ..utils.formatting import OutputFormatter
12
+ from ..utils.progress import SpinnerProgressTracker
13
+ from ..auth.base import ProfileNotFoundError, MissingCredentialsError
14
+ from ..utils.completion import (
15
+ complete_rid,
16
+ complete_profile,
17
+ complete_output_format,
18
+ cache_rid,
19
+ )
20
+
21
+ app = typer.Typer()
22
+ console = Console()
23
+ formatter = OutputFormatter(console)
24
+
25
+
26
+ @app.command("create")
27
+ def create_folder(
28
+ name: str = typer.Argument(..., help="Folder display name"),
29
+ parent_folder: str = typer.Option(
30
+ "ri.compass.main.folder.0",
31
+ "--parent-folder",
32
+ "-p",
33
+ help="Parent folder RID (default: root folder)",
34
+ autocompletion=complete_rid,
35
+ ),
36
+ profile: Optional[str] = typer.Option(
37
+ None, "--profile", help="Profile name", autocompletion=complete_profile
38
+ ),
39
+ format: str = typer.Option(
40
+ "table",
41
+ "--format",
42
+ "-f",
43
+ help="Output format (table, json, csv)",
44
+ autocompletion=complete_output_format,
45
+ ),
46
+ ):
47
+ """Create a new folder in Foundry."""
48
+ try:
49
+ service = FolderService(profile=profile)
50
+
51
+ with SpinnerProgressTracker().track_spinner(f"Creating folder '{name}'..."):
52
+ folder = service.create_folder(
53
+ display_name=name, parent_folder_rid=parent_folder
54
+ )
55
+
56
+ # Cache the RID for future completions
57
+ if folder.get("rid"):
58
+ cache_rid(folder["rid"])
59
+
60
+ formatter.print_success(f"Successfully created folder '{name}'")
61
+ formatter.print_info(f"Folder RID: {folder.get('rid', 'unknown')}")
62
+
63
+ # Format output
64
+ if format == "json":
65
+ formatter.format_dict(folder)
66
+ elif format == "csv":
67
+ formatter.format_list([folder])
68
+ else:
69
+ _format_folder_table(folder)
70
+
71
+ except (ProfileNotFoundError, MissingCredentialsError) as e:
72
+ formatter.print_error(f"Authentication error: {e}")
73
+ raise typer.Exit(1)
74
+ except Exception as e:
75
+ formatter.print_error(f"Failed to create folder: {e}")
76
+ raise typer.Exit(1)
77
+
78
+
79
+ @app.command("get")
80
+ def get_folder(
81
+ folder_rid: str = typer.Argument(
82
+ ..., help="Folder Resource Identifier", autocompletion=complete_rid
83
+ ),
84
+ profile: Optional[str] = typer.Option(
85
+ None, "--profile", help="Profile name", autocompletion=complete_profile
86
+ ),
87
+ format: str = typer.Option(
88
+ "table",
89
+ "--format",
90
+ "-f",
91
+ help="Output format (table, json, csv)",
92
+ autocompletion=complete_output_format,
93
+ ),
94
+ output: Optional[str] = typer.Option(
95
+ None, "--output", "-o", help="Output file path"
96
+ ),
97
+ ):
98
+ """Get detailed information about a specific folder."""
99
+ try:
100
+ # Cache the RID for future completions
101
+ cache_rid(folder_rid)
102
+
103
+ service = FolderService(profile=profile)
104
+
105
+ with SpinnerProgressTracker().track_spinner(f"Fetching folder {folder_rid}..."):
106
+ folder = service.get_folder(folder_rid)
107
+
108
+ # Format output
109
+ if format == "json":
110
+ if output:
111
+ formatter.save_to_file(folder, output, "json")
112
+ else:
113
+ formatter.format_dict(folder)
114
+ elif format == "csv":
115
+ if output:
116
+ formatter.save_to_file([folder], output, "csv")
117
+ else:
118
+ formatter.format_list([folder])
119
+ else:
120
+ _format_folder_table(folder)
121
+
122
+ if output:
123
+ formatter.print_success(f"Folder information saved to {output}")
124
+
125
+ except (ProfileNotFoundError, MissingCredentialsError) as e:
126
+ formatter.print_error(f"Authentication error: {e}")
127
+ raise typer.Exit(1)
128
+ except Exception as e:
129
+ formatter.print_error(f"Failed to get folder: {e}")
130
+ raise typer.Exit(1)
131
+
132
+
133
+ @app.command("list")
134
+ def list_children(
135
+ folder_rid: str = typer.Argument(
136
+ ...,
137
+ help="Folder Resource Identifier (use 'ri.compass.main.folder.0' for root)",
138
+ autocompletion=complete_rid,
139
+ ),
140
+ profile: Optional[str] = typer.Option(
141
+ None, "--profile", help="Profile name", autocompletion=complete_profile
142
+ ),
143
+ format: str = typer.Option(
144
+ "table",
145
+ "--format",
146
+ "-f",
147
+ help="Output format (table, json, csv)",
148
+ autocompletion=complete_output_format,
149
+ ),
150
+ output: Optional[str] = typer.Option(
151
+ None, "--output", "-o", help="Output file path"
152
+ ),
153
+ page_size: Optional[int] = typer.Option(
154
+ None, "--page-size", help="Number of items per page"
155
+ ),
156
+ ):
157
+ """List all child resources of a folder."""
158
+ try:
159
+ # Cache the RID for future completions
160
+ cache_rid(folder_rid)
161
+
162
+ service = FolderService(profile=profile)
163
+
164
+ with SpinnerProgressTracker().track_spinner(
165
+ f"Listing children of folder {folder_rid}..."
166
+ ):
167
+ children = service.list_children(folder_rid, page_size=page_size)
168
+
169
+ if not children:
170
+ formatter.print_info("No children found in this folder.")
171
+ return
172
+
173
+ # Format output
174
+ if format == "json":
175
+ if output:
176
+ formatter.save_to_file(children, output, "json")
177
+ else:
178
+ formatter.format_list(children)
179
+ elif format == "csv":
180
+ if output:
181
+ formatter.save_to_file(children, output, "csv")
182
+ else:
183
+ formatter.format_list(children)
184
+ else:
185
+ _format_children_table(children)
186
+
187
+ if output:
188
+ formatter.print_success(f"Folder children saved to {output}")
189
+
190
+ except (ProfileNotFoundError, MissingCredentialsError) as e:
191
+ formatter.print_error(f"Authentication error: {e}")
192
+ raise typer.Exit(1)
193
+ except Exception as e:
194
+ formatter.print_error(f"Failed to list folder children: {e}")
195
+ raise typer.Exit(1)
196
+
197
+
198
+ @app.command("batch-get")
199
+ def get_folders_batch(
200
+ folder_rids: List[str] = typer.Argument(
201
+ ..., help="Folder Resource Identifiers (space-separated)"
202
+ ),
203
+ profile: Optional[str] = typer.Option(
204
+ None, "--profile", help="Profile name", autocompletion=complete_profile
205
+ ),
206
+ format: str = typer.Option(
207
+ "table",
208
+ "--format",
209
+ "-f",
210
+ help="Output format (table, json, csv)",
211
+ autocompletion=complete_output_format,
212
+ ),
213
+ output: Optional[str] = typer.Option(
214
+ None, "--output", "-o", help="Output file path"
215
+ ),
216
+ ):
217
+ """Get multiple folders in a single request (max 1000)."""
218
+ try:
219
+ service = FolderService(profile=profile)
220
+
221
+ with SpinnerProgressTracker().track_spinner(
222
+ f"Fetching {len(folder_rids)} folders..."
223
+ ):
224
+ folders = service.get_folders_batch(folder_rids)
225
+
226
+ # Cache RIDs for future completions
227
+ for folder in folders:
228
+ if folder.get("rid"):
229
+ cache_rid(folder["rid"])
230
+
231
+ # Format output
232
+ if format == "json":
233
+ if output:
234
+ formatter.save_to_file(folders, output, "json")
235
+ else:
236
+ formatter.format_list(folders)
237
+ elif format == "csv":
238
+ if output:
239
+ formatter.save_to_file(folders, output, "csv")
240
+ else:
241
+ formatter.format_list(folders)
242
+ else:
243
+ _format_folders_batch_table(folders)
244
+
245
+ if output:
246
+ formatter.print_success(f"Folders information saved to {output}")
247
+
248
+ except (ProfileNotFoundError, MissingCredentialsError) as e:
249
+ formatter.print_error(f"Authentication error: {e}")
250
+ raise typer.Exit(1)
251
+ except ValueError as e:
252
+ formatter.print_error(f"Invalid request: {e}")
253
+ raise typer.Exit(1)
254
+ except Exception as e:
255
+ formatter.print_error(f"Failed to get folders batch: {e}")
256
+ raise typer.Exit(1)
257
+
258
+
259
+ def _format_folder_table(folder: dict):
260
+ """Format folder information as a table."""
261
+ table = Table(
262
+ title="Folder Information", show_header=True, header_style="bold cyan"
263
+ )
264
+ table.add_column("Property", style="cyan")
265
+ table.add_column("Value")
266
+
267
+ table.add_row("RID", folder.get("rid", "N/A"))
268
+ table.add_row("Display Name", folder.get("display_name", "N/A"))
269
+ table.add_row("Description", folder.get("description", "N/A"))
270
+ table.add_row("Parent Folder", folder.get("parent_folder_rid", "N/A"))
271
+ table.add_row("Created", folder.get("created", "N/A"))
272
+ table.add_row("Modified", folder.get("modified", "N/A"))
273
+
274
+ console.print(table)
275
+
276
+
277
+ def _format_children_table(children: List[dict]):
278
+ """Format folder children as a table."""
279
+ table = Table(title="Folder Children", show_header=True, header_style="bold cyan")
280
+ table.add_column("Type", style="cyan")
281
+ table.add_column("Display Name")
282
+ table.add_column("RID")
283
+
284
+ for child in children:
285
+ table.add_row(
286
+ child.get("type", "unknown"),
287
+ child.get("display_name", child.get("name", "N/A")),
288
+ child.get("rid", "N/A"),
289
+ )
290
+
291
+ console.print(table)
292
+ console.print(f"\nTotal: {len(children)} items")
293
+
294
+
295
+ def _format_folders_batch_table(folders: List[dict]):
296
+ """Format multiple folders as a table."""
297
+ table = Table(title="Folders", show_header=True, header_style="bold cyan")
298
+ table.add_column("Display Name")
299
+ table.add_column("RID")
300
+ table.add_column("Parent Folder")
301
+ table.add_column("Description")
302
+
303
+ for folder in folders:
304
+ table.add_row(
305
+ folder.get("display_name", "N/A"),
306
+ folder.get("rid", "N/A"),
307
+ folder.get("parent_folder_rid", "N/A"),
308
+ folder.get("description", "N/A") or "",
309
+ )
310
+
311
+ console.print(table)
312
+ console.print(f"\nTotal: {len(folders)} folders")
313
+
314
+
315
+ @app.callback()
316
+ def main():
317
+ """
318
+ Folder operations using foundry-platform-sdk.
319
+
320
+ Manage folders in the Foundry filesystem. Create, retrieve, and list
321
+ folder contents using Resource Identifiers (RIDs).
322
+
323
+ The root folder RID is: ri.compass.main.folder.0
324
+
325
+ Examples:
326
+ # Create a folder in root
327
+ pltr folder create "My Folder"
328
+
329
+ # Create a folder in a specific parent
330
+ pltr folder create "Sub Folder" --parent-folder ri.compass.main.folder.xyz123
331
+
332
+ # List root folder contents
333
+ pltr folder list ri.compass.main.folder.0
334
+
335
+ # Get folder information
336
+ pltr folder get ri.compass.main.folder.xyz123
337
+ """
338
+ pass