Skip to content
Merged
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2.0.4

Fix `update` silently no-opping on projects. Things applies the `update`
command to to-dos only; a project needs the separate `update-project` command,
so renaming or editing a project reported success but changed nothing.

- **Project updates now route to `update-project`.** `update` (and the
`things_update` MCP tool) reads the resolved entity type and, when it is a
project (`TMTask.type === 1`), issues `things:///update-project` instead of
`things:///update`. A new `buildUpdateProjectUrl` builder backs this.

Unit test added for the new endpoint builder.

## 2.0.3

Fix recurring tasks across `someday` and `repeating`. Two bugs, both from the same
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thingsctl",
"version": "2.0.3",
"version": "2.0.4",
"description": "A full-featured command-line interface and MCP server for Things 3 on macOS.",
"main": "src/cli.js",
"type": "commonjs",
Expand Down
9 changes: 6 additions & 3 deletions src/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const db = require('../lib/db');
const queries = require('../lib/queries');
const { resolveTaskId } = require('../lib/uuid');
const { buildUpdateUrl } = require('../lib/url');
const { buildUpdateUrl, buildUpdateProjectUrl } = require('../lib/url');
const { openUrl } = require('../lib/exec');
const { getToken } = require('../lib/token');
const { colors } = require('../lib/format');
Expand Down Expand Up @@ -41,8 +41,11 @@ function run(id, opts = {}) {

if (changes.length === 0) throw new Error('No changes specified');

openUrl(buildUpdateUrl(params));
return `${colors.green('✓')} Updated "${task.title}": ${changes.join(', ')}`;
// type 1 = project; Things ignores `update` on projects, so route to `update-project`.
const isProject = ref.type === 1;
openUrl(isProject ? buildUpdateProjectUrl(params) : buildUpdateUrl(params));
const label = isProject ? 'project ' : '';
return `${colors.green('✓')} Updated ${label}"${task.title}": ${changes.join(', ')}`;
}

module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions src/lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ function buildUpdateUrl(params) {
return `things:///update?${_encode(params)}`;
}

// Things applies `update` to to-dos only; projects need `update-project`.
function buildUpdateProjectUrl(params) {
return `things:///update-project?${_encode(params)}`;
}

function buildShowUrl(params) {
return `things:///show?${_encode(params)}`;
}
Expand All @@ -46,6 +51,7 @@ function buildJsonUrl({ data, authToken, reveal }) {
module.exports = {
buildAddUrl,
buildUpdateUrl,
buildUpdateProjectUrl,
buildShowUrl,
buildAddProjectUrl,
buildJsonUrl,
Expand Down
7 changes: 7 additions & 0 deletions test/unit/url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ describe('buildUpdateUrl', () => {
});
});

describe('buildUpdateProjectUrl', () => {
test('targets the update-project endpoint', () => {
const u = url.buildUpdateProjectUrl({ id: 'proj1', title: 'New Name' });
expect(u).toBe('things:///update-project?id=proj1&title=New%20Name');
});
});

describe('buildJsonUrl', () => {
test('encodes nested data as JSON', () => {
const u = url.buildJsonUrl({
Expand Down
Loading