@garyr/pt-cli 0.25.2 → 0.26.0
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.
- package/README.md +3 -3
- package/dist/commands/defaultPostConfigCommand.js +26 -0
- package/dist/index.js +7 -0
- package/doc/configuration.md +7 -2
- package/package.json +1 -1
- package/skills/agency-pt-operator/SKILL.md +1 -1
- package/src/commands/defaultPostConfigCommand.ts +32 -0
- package/src/index.ts +8 -0
package/README.md
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { loadConfig, saveConfig } from '../config.js';
|
|
3
|
+
export function defaultPostConfigCommand(options = {}) {
|
|
4
|
+
const config = loadConfig();
|
|
5
|
+
if (options.set) {
|
|
6
|
+
if (options.json) {
|
|
7
|
+
try {
|
|
8
|
+
const data = options.json.startsWith('{') || options.json.startsWith('[')
|
|
9
|
+
? JSON.parse(options.json)
|
|
10
|
+
: JSON.parse(fs.readFileSync(options.json, 'utf-8'));
|
|
11
|
+
config.default_post_config = Array.isArray(data) ? data : [];
|
|
12
|
+
saveConfig(config);
|
|
13
|
+
console.log('Default post-config updated via JSON.');
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
const error = e;
|
|
17
|
+
console.error('Failed to parse JSON for default post-config:', error.message);
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.error('You must provide --json <data> to set the default post-config array.');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log('Current default post-config tasks:', config.default_post_config || []);
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ignoreCommand } from './commands/ignoreCommand.js';
|
|
|
8
8
|
import { variablesCommand } from './commands/variablesCommand.js';
|
|
9
9
|
import { addCommand } from './commands/addCommand.js';
|
|
10
10
|
import { removeCommand } from './commands/removeCommand.js';
|
|
11
|
+
import { defaultPostConfigCommand } from './commands/defaultPostConfigCommand.js';
|
|
11
12
|
import pkg from '../package.json' with { type: 'json' };
|
|
12
13
|
const program = new Command();
|
|
13
14
|
program
|
|
@@ -61,6 +62,12 @@ program
|
|
|
61
62
|
.option('--json <data>', 'Set variables via JSON string or file')
|
|
62
63
|
.option('--delete <key>', 'Delete a specific global variable')
|
|
63
64
|
.action(variablesCommand);
|
|
65
|
+
program
|
|
66
|
+
.command('default-post-config')
|
|
67
|
+
.description('View or set default post-config tasks')
|
|
68
|
+
.option('--set', 'Set the default post-config tasks via JSON')
|
|
69
|
+
.option('--json <data>', 'JSON string or file containing tasks array')
|
|
70
|
+
.action(defaultPostConfigCommand);
|
|
64
71
|
program
|
|
65
72
|
.command('add <name> [json]')
|
|
66
73
|
.description('Import/add a template from a JSON string or file')
|
package/doc/configuration.md
CHANGED
|
@@ -146,9 +146,14 @@ Each default task supports the same fields as template post-config:
|
|
|
146
146
|
- **`pt learn --yes`**: all applicable default tasks are added automatically to the new template's `post_config`.
|
|
147
147
|
- **Interactive mode (`pt learn`)**: applicable default tasks are shown in a checkbox group. Default tasks default to checked; `checked: false` overrides this.
|
|
148
148
|
|
|
149
|
-
###
|
|
149
|
+
### Management
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
You can view current default tasks using `pt config` or `pt default-post-config`.
|
|
152
|
+
To update default tasks programmatically or via CLI, use the `pt default-post-config` command:
|
|
153
|
+
- `pt default-post-config`: List current default post-config tasks.
|
|
154
|
+
- `pt default-post-config --set --json '...'`: Replace the default post-config tasks list via a JSON string or file.
|
|
155
|
+
|
|
156
|
+
Alternatively, you can edit `~/.pt/config.yaml` directly.
|
|
152
157
|
|
|
153
158
|
## Global Variables
|
|
154
159
|
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ Default post-config tasks are stored in `~/.pt/config.yaml` under `default_post_
|
|
|
42
42
|
|
|
43
43
|
Tasks with `checked: false` stay unchecked by default in interactive mode. In `pt learn --yes` mode, **all applicable** default tasks are included.
|
|
44
44
|
|
|
45
|
-
Use `pt config` to view currently configured default tasks. To
|
|
45
|
+
Use `pt config` to view currently configured default tasks. To update default tasks, you can use `pt default-post-config --set --json '...'` to apply a new JSON array of tasks. Alternatively, you can edit `~/.pt/config.yaml` directly.
|
|
46
46
|
|
|
47
47
|
## Global Variables
|
|
48
48
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { loadConfig, saveConfig, PostConfigTask } from '../config.js';
|
|
3
|
+
|
|
4
|
+
export interface DefaultPostConfigOptions {
|
|
5
|
+
set?: boolean;
|
|
6
|
+
json?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function defaultPostConfigCommand(options: DefaultPostConfigOptions = {}) {
|
|
10
|
+
const config = loadConfig();
|
|
11
|
+
|
|
12
|
+
if (options.set) {
|
|
13
|
+
if (options.json) {
|
|
14
|
+
try {
|
|
15
|
+
const data = options.json.startsWith('{') || options.json.startsWith('[')
|
|
16
|
+
? JSON.parse(options.json)
|
|
17
|
+
: JSON.parse(fs.readFileSync(options.json, 'utf-8'));
|
|
18
|
+
config.default_post_config = Array.isArray(data) ? data : [];
|
|
19
|
+
saveConfig(config);
|
|
20
|
+
console.log('Default post-config updated via JSON.');
|
|
21
|
+
} catch (e) {
|
|
22
|
+
const error = e as Error;
|
|
23
|
+
console.error('Failed to parse JSON for default post-config:', error.message);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.error('You must provide --json <data> to set the default post-config array.');
|
|
29
|
+
} else {
|
|
30
|
+
console.log('Current default post-config tasks:', config.default_post_config || []);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { ignoreCommand } from './commands/ignoreCommand.js';
|
|
|
13
13
|
import { variablesCommand } from './commands/variablesCommand.js';
|
|
14
14
|
import { addCommand } from './commands/addCommand.js';
|
|
15
15
|
import { removeCommand } from './commands/removeCommand.js';
|
|
16
|
+
import { defaultPostConfigCommand } from './commands/defaultPostConfigCommand.js';
|
|
16
17
|
|
|
17
18
|
import pkg from '../package.json' with { type: 'json' };
|
|
18
19
|
|
|
@@ -76,6 +77,13 @@ program
|
|
|
76
77
|
.option('--delete <key>', 'Delete a specific global variable')
|
|
77
78
|
.action(variablesCommand);
|
|
78
79
|
|
|
80
|
+
program
|
|
81
|
+
.command('default-post-config')
|
|
82
|
+
.description('View or set default post-config tasks')
|
|
83
|
+
.option('--set', 'Set the default post-config tasks via JSON')
|
|
84
|
+
.option('--json <data>', 'JSON string or file containing tasks array')
|
|
85
|
+
.action(defaultPostConfigCommand);
|
|
86
|
+
|
|
79
87
|
program
|
|
80
88
|
.command('add <name> [json]')
|
|
81
89
|
.description('Import/add a template from a JSON string or file')
|