Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,288 changes: 1,288 additions & 0 deletions .surface

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions API-COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Coverage of Basecamp 3 API endpoints. Source: [bc3-api/sections](https://github.

| Status | Sections | Endpoints |
|--------|----------|-----------|
| ✅ Implemented | 59 | 226 |
| ✅ Implemented | 61 | 232 |
| ⚠️ Blocked | 0 | 0 |
| ⏭️ Out of scope | 4 | 12 |
| **Total tracked** | **63** | **238** |
| **Total tracked** | **65** | **244** |

**226 of 226 tracked in-scope endpoints.** Listing, reading, creating, updating and
**232 of 232 tracked in-scope endpoints.** Adding and editing a link to a cloud file or a
Google document in Docs & Files (`POST /buckets/:id/vaults/:id/cloud_files.json`,
`PUT /cloud_files/:id`, and their `google_documents` counterparts, in the
SDK's `CloudFiles` and `GoogleDocuments` services; `files show` already read both) lands as
`files cloud-files` and `files google-docs`. Listing, reading, creating, updating and
deleting a project's external links (`GET`/`POST /buckets/:id/dock/doors.json`,
`GET`/`PUT`/`DELETE /dock/doors/:id`, added by
[bc3#14314](https://github.com/basecamp/bc3/pull/14314) and modelled by the
Expand Down Expand Up @@ -277,6 +281,8 @@ cannot faithfully cover at least one endpoint for a reason outside the CLI. A
| vaults | 8 | `files`, `vaults` | ✅ | BC4 | - | list, show, create |
| vaults (move) | 1 | `files move` | ✅ | BC5 | - | `POST /recordings/:id/filing.json`: moves a document, upload or folder into another folder in the same project, in place (same id and comments). `--to` takes a folder ID or URL; `--position` is 1-indexed. Flat route, so no `--in`. Moves and copies into another project go through recordings (moves, copies) with `--to-project`/`--to-folder` |
| documents | 8 | `files`, `docs` | ✅ | BC4 | - | list, show, create, update. Create supports `--subscribe`/`--no-subscribe`, `--visible-to-clients` (root vault only) |
| cloud_files | 3 | `files cloud-files`, `files show` | ✅ | BC5 | - | A link to a file in Dropbox, Box, OneDrive or another service, filed in Docs & Files: show (`files show`), create (`POST /vaults/:id/cloud_files.json`; `--service` inferred from the URL's host, else `other`; `--subscribe`/`--no-subscribe`, `--visible-to-clients` at the root vault), update (`PUT /cloud_files/:id`, a full replace: the command reads the cloud file and sends back every field not given). Update has no `--subscribe`: Basecamp applies subscriptions on update only to drafts, and a cloud file is never one |
| google_documents | 3 | `files google-docs`, `files show` | ✅ | BC5 | - | A link to a Google Doc, Sheet or Slides file in Docs & Files: show (`files show`), create (`POST /vaults/:id/google_documents.json`; `--type` doc, sheet, slide or other, inferred from a docs.google.com URL; published unless `--draft`; `--subscribe`/`--no-subscribe`, `--visible-to-clients`), update (`PUT /google_documents/:id`, a full replace like cloud files; `--publish` publishes a draft, and `--subscribe` applies only while it is one) |
| attachments | 1 | `uploads`, `attachments` | ✅ | BC4 | - | Upload via `attach`; list embedded attachments via `attachments list` (parses `<bc-attachment>` from content) |
| embeds | 2 | `embeds` | ✅ | BC5 | - | create, show. Rich-text commands also embed a URL that stands alone on its line in Markdown content, through the same create |
| **Schedule** |
Expand Down
43 changes: 43 additions & 0 deletions e2e/files.bats
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,46 @@ load test_helper
assert_success
assert_output_contains "Docs & Files"
}


# Cloud files and Google documents: validation before any request

@test "files cloud-files create without --url shows error" {
create_credentials
create_global_config '{"account_id": 99999, "project_id": 123}'

run basecamp files cloud-files create "Plans" --json
assert_failure
assert_json_value '.code' 'usage'
assert_json_value '.error' '--url is required'
}

@test "files cloud-files update without any fields shows error" {
create_credentials
create_global_config '{"account_id": 99999, "project_id": 123}'

run basecamp files cloud-files update 456 --json
assert_failure
assert_json_value '.code' 'usage'
assert_json_value '.error' 'No update fields specified'
}

@test "files google-docs create with an unknown --type shows error" {
create_credentials
create_global_config '{"account_id": 99999, "project_id": 123}'

run basecamp files google-docs create "Plan" --url "https://example.com/plan" --type spreadsheet --json
assert_failure
assert_json_value '.code' 'usage'
assert_json_value '.error' 'Invalid --type: spreadsheet'
}

@test "files google-docs update without any fields shows error" {
create_credentials
create_global_config '{"account_id": 99999, "project_id": 123}'

run basecamp files google-docs update 789 --json
assert_failure
assert_json_value '.code' 'usage'
assert_json_value '.error' 'No update fields specified'
}
1 change: 1 addition & 0 deletions e2e/smoke/run_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ level1=(
"$SMOKE_DIR"/smoke_timesheet_write.bats
"$SMOKE_DIR"/smoke_messages_write.bats
"$SMOKE_DIR"/smoke_files_write.bats
"$SMOKE_DIR"/smoke_file_links.bats
"$SMOKE_DIR"/smoke_cards_write.bats
"$SMOKE_DIR"/smoke_comments.bats
"$SMOKE_DIR"/smoke_campfire.bats
Expand Down
60 changes: 60 additions & 0 deletions e2e/smoke/smoke_file_links.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bats
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
# smoke_file_links.bats - Level 1: Cloud files and Google documents in Docs & Files

load smoke_helper

setup_file() {
# Each update reads the id its create wrote.
export BATS_NO_PARALLELIZE_WITHIN_FILE=true
ensure_token || return 1
ensure_project || return 1
}

@test "files cloud-files create adds a cloud file" {
Comment thread
jeremy marked this conversation as resolved.
Resolved
run_smoke basecamp files cloud-files create "Smoke cloud file" \
--url "https://example.com/smoke-$(date +%s)" --description "Kept" \
--no-subscribe -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
assert_json_value '.data.service.code' 'other'

echo "$output" | jq -r '.data.id' > "$BATS_FILE_TMPDIR/cloud_file_id"
}

@test "files cloud-files update renames a cloud file and keeps the rest" {
local id_file="$BATS_FILE_TMPDIR/cloud_file_id"
[[ -f "$id_file" ]] || mark_unverifiable "No cloud file created in prior test"
local cloud_file_id
cloud_file_id=$(<"$id_file")

run_smoke basecamp files cloud-files update "$cloud_file_id" --title "Smoke cloud file renamed" --json
assert_success
assert_json_value '.data.title' 'Smoke cloud file renamed'
assert_json_value '.data.service.code' 'other'
assert_json_value '.data.description | contains("Kept")' 'true'
}

@test "files google-docs create adds a Google document" {
run_smoke basecamp files google-docs create "Smoke Google doc" \
--url "https://docs.google.com/document/d/smoke-$(date +%s)/edit" \
--draft --no-subscribe -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
assert_json_value '.data.document_type' 'doc'
assert_json_value '.data.status' 'drafted'

echo "$output" | jq -r '.data.id' > "$BATS_FILE_TMPDIR/google_doc_id"
}

@test "files google-docs update renames a Google document and keeps it a draft" {
local id_file="$BATS_FILE_TMPDIR/google_doc_id"
[[ -f "$id_file" ]] || mark_unverifiable "No Google document created in prior test"
local google_doc_id
google_doc_id=$(<"$id_file")

run_smoke basecamp files google-docs update "$google_doc_id" --title "Smoke Google doc renamed" --json
assert_success
assert_json_value '.data.title' 'Smoke Google doc renamed'
assert_json_value '.data.document_type' 'doc'
assert_json_value '.data.status' 'drafted'
}
32 changes: 32 additions & 0 deletions e2e/smoke/smoke_lifecycle.bats
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,35 @@ load smoke_helper
@test "vaults uploads list is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "docs cloud-files create is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "docs cloud-files update is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "docs google-docs create is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "docs google-docs update is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "vaults cloud-files create is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "vaults cloud-files update is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "vaults google-docs create is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}

@test "vaults google-docs update is out of scope" {
mark_out_of_scope "Shares implementation with files group (tested)"
}
2 changes: 1 addition & 1 deletion internal/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func CommandCategories() []CommandCategory {
{Name: "chat", Category: "core", Description: "Chat in real-time", Actions: []string{"list", "messages", "post", "upload", "line", "update", "delete"}},
{Name: "pings", Category: "core", Description: "Talk to people directly", Actions: []string{"list", "show", "start", "messages", "post", "upload"}},
{Name: "cards", Category: "core", Description: "Manage Kanban cards", Actions: []string{"list", "show", "create", "update", "move", "copy", "done", "columns", "wormholes", "steps", "trash", "archive", "restore"}},
{Name: "files", Category: "core", Description: "Manage files, documents, and folders", Actions: []string{"list", "show", "versions", "replace", "download", "update", "move", "copy", "trash", "archive", "restore"}},
{Name: "files", Category: "core", Description: "Manage files, documents, and folders", Actions: []string{"list", "show", "versions", "replace", "download", "update", "move", "copy", "trash", "archive", "restore", "cloud-files", "google-docs"}},
{Name: "checkins", Category: "core", Description: "View automatic check-ins", Actions: []string{"questions", "question", "answers", "answer", "reminders"}},
{Name: "schedule", Category: "core", Description: "Manage schedule entries", Actions: []string{"show", "entries", "create", "update", "move", "copy"}},
},
Expand Down
17 changes: 16 additions & 1 deletion internal/commands/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Each project has a root folder containing documents, uploads, and subfolders.`,
newFoldersCmd(&project, &vaultID),
newUploadsCmd(&project, &vaultID),
newDocsCmd(&project, &vaultID),
newCloudFilesCmd(&project, &vaultID),
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
newGoogleDocsCmd(&project, &vaultID),
newFilesShowCmd(),
newFilesVersionsCmd(&project),
newFilesReplaceCmd(&project),
Expand Down Expand Up @@ -1546,7 +1548,20 @@ You can pass either an item ID or a Basecamp URL:
summary := fmt.Sprintf("%s: %s", detectedType, title)

var breadcrumbs []output.Breadcrumb
if detectedType != "cloud_file" && detectedType != "google_document" {
switch detectedType {
case "cloud_file":
breadcrumbs = append(breadcrumbs, output.Breadcrumb{
Action: "update",
Cmd: fmt.Sprintf("basecamp files cloud-files update %s --title \"New title\"", itemIDStr),
Comment thread
jeremy marked this conversation as resolved.
Resolved
Description: "Update cloud file",
})
case "google_document":
breadcrumbs = append(breadcrumbs, output.Breadcrumb{
Action: "update",
Cmd: fmt.Sprintf("basecamp files google-docs update %s --title \"New title\"", itemIDStr),
Description: "Update Google document",
})
default:
breadcrumbs = append(breadcrumbs, output.Breadcrumb{
Action: "update",
Cmd: fmt.Sprintf("basecamp files update %s --in %s", itemIDStr, recordProject(bucket)),
Expand Down
Loading
Loading