@garyr/pt-cli 1.1.0 → 1.3.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/CHANGELOG.md +47 -0
- package/README.md +11 -6
- package/dist/commands/completionCommand.js +7 -16
- package/dist/commands/initCommand.js +476 -181
- package/dist/commands/learnCommand.js +28 -7
- package/dist/commands/template-utils.js +17 -7
- package/dist/commands/updateCommand.js +56 -25
- package/dist/config.js +3 -0
- package/dist/index.js +23 -5
- package/dist/substitute.js +45 -19
- package/doc/configuration.md +7 -5
- package/doc/usage.md +22 -5
- package/package.json +4 -4
- package/skills/agency-pt-operator/SKILL.md +5 -4
- package/src/commands/completionCommand.ts +7 -15
- package/src/commands/initCommand.ts +495 -194
- package/src/commands/learnCommand.ts +29 -7
- package/src/commands/template-utils.ts +17 -8
- package/src/commands/updateCommand.ts +125 -91
- package/src/config.ts +3 -0
- package/src/index.ts +21 -5
- package/src/substitute.ts +48 -21
- package/tests/config-utils.test.ts +1 -1
- package/tests/learn.test.ts +5 -4
- package/tests/modularity.test.ts +605 -0
- package/tests/update.test.ts +63 -9
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.3.0] - 2026-09-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Multi-template task deduplication**: `pt init` now deduplicates post-config tasks across templates by command+description, executing each unique task only once
|
|
15
|
+
- **ID-based task selection**: Internal `_id` fields prevent key collisions when identical commands exist in multiple templates
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **Aggregated security warnings**: Single security prompt for all templates (was per-template), preventing early abort when one template has dangerous commands
|
|
20
|
+
- **Template attribution in UI**: Deduplicated tasks show all contributing templates (e.g., `[base-template, addon-template]`)
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Duplicate `git init` execution when multiple templates include the same post-config task
|
|
25
|
+
- Security warning loop that cancelled all templates when user declined one template's post-config
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## [1.2.0] - 2026-09-04
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **Modular multi-template initialization**: `pt init <template1> <template2> <target>` combines folders, files, variables, and post-config from multiple templates
|
|
34
|
+
- **Collision handling**: Detects and reports conflicting folder names, file destinations, and variable definitions across templates
|
|
35
|
+
- **Readme renaming**: Auto-renames `README.md` from each template to `README_<template>.md` to prevent overwrites
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **Init command accepts multiple templates**: Space-separated template names before target directory
|
|
40
|
+
- **Variable merging**: Template variables merged with collision detection and clear error messages
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## [1.1.0] - 2026-09-03
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- **Shell completions**: `pt completion <bash|zsh|fish>` generates shell completion scripts
|
|
49
|
+
- **Completion install guidance**: Printed instructions for adding to shell rc files
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **Shell completions interfere with PT-GUI**: Removed auto-install behavior that broke GUI integration; completions now opt-in only
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
10
57
|
## [1.0.0] - 2026-07-31
|
|
11
58
|
|
|
12
59
|
### 🎉 First Stable Release
|
package/README.md
CHANGED
|
@@ -26,7 +26,6 @@ graph LR
|
|
|
26
26
|
RSA -. Update .-> Engine
|
|
27
27
|
|
|
28
28
|
style Engine fill:#f9f,stroke:#333,stroke-width:2px,color:#000
|
|
29
|
-
|
|
30
29
|
```
|
|
31
30
|
|
|
32
31
|
<!-- TOC -->
|
|
@@ -47,6 +46,12 @@ graph LR
|
|
|
47
46
|
- [Documentation](#documentation)
|
|
48
47
|
- [Development](#development)
|
|
49
48
|
- [Where are the Templates?](#where-are-the-templates)
|
|
49
|
+
- [Release & API Stability](#release--api-stability)
|
|
50
|
+
- [🔒 Stability Guarantee 1.x series](#-stability-guarantee-1x-series)
|
|
51
|
+
- [📦 Versioning Policy](#-versioning-policy)
|
|
52
|
+
- [📋 What's Locked in 1.0](#-whats-locked-in-10)
|
|
53
|
+
- [📖 Migration from 0.x to 1.0](#-migration-from-0x-to-10)
|
|
54
|
+
- [Documentation](#documentation)
|
|
50
55
|
|
|
51
56
|
<!-- /TOC -->
|
|
52
57
|
|
|
@@ -54,7 +59,7 @@ graph LR
|
|
|
54
59
|
|
|
55
60
|
Traditional project templating often tightly couples logic and configuration, meaning every new template requires code changes. `pt-cli` breaks that ceiling by separating project definitions from the underlying logic.
|
|
56
61
|
|
|
57
|
-
Instead of writing complex, hard-coded configuration files to scaffold new work, `pt-cli` allows you to **
|
|
62
|
+
Instead of writing complex, hard-coded configuration files to scaffold new work, `pt-cli` allows you to **learn** from your existing project directories and turn them into templates. It doesn't enforce a specific folder structure; it supports *your* existing patterns.
|
|
58
63
|
|
|
59
64
|
## Core Benefits & Uses
|
|
60
65
|
|
|
@@ -108,8 +113,8 @@ pt learn /path/to/PROJECT
|
|
|
108
113
|
# Learn a template from a remote repository (e.g. GitHub, Gitea, or path to tarball)
|
|
109
114
|
pt learn https://github.com/garyritchie/pt_godot
|
|
110
115
|
|
|
111
|
-
# Scaffold a new project from
|
|
112
|
-
pt init <template_name> /path/to/NEW_PROJECT
|
|
116
|
+
# Scaffold a new project from one or more learned templates
|
|
117
|
+
pt init <template_name> [template_name2...] /path/to/NEW_PROJECT
|
|
113
118
|
|
|
114
119
|
# List available templates and configurations
|
|
115
120
|
pt config
|
|
@@ -122,7 +127,6 @@ pt add my-new-template --file my-new-template.json
|
|
|
122
127
|
|
|
123
128
|
# Scaffold directly from a JSON file (no config registration required)
|
|
124
129
|
pt init ./new-project --file my-template.json --yes
|
|
125
|
-
|
|
126
130
|
```
|
|
127
131
|
|
|
128
132
|
### Shell Completions
|
|
@@ -137,6 +141,7 @@ pt completion bash > /etc/bash_completion.d/pt
|
|
|
137
141
|
# Zsh
|
|
138
142
|
pt completion zsh > ~/.zsh/completions/_pt
|
|
139
143
|
# Add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)
|
|
144
|
+
# autoload -U compinit && compinit
|
|
140
145
|
|
|
141
146
|
# Fish
|
|
142
147
|
pt completion fish > ~/.config/fish/completions/pt.fish
|
|
@@ -275,4 +280,4 @@ If you skipped intermediate 0.x versions, the auto-migration handles everything.
|
|
|
275
280
|
* **[Security Guide](doc/security.md)** - Command validation, trusted sources, audit logging.
|
|
276
281
|
* **[Testing Guide](doc/testing.md)** - Test suite structure and running tests.
|
|
277
282
|
* **[Exclusions Reference](doc/exclusions.md)** - Default ignored files and custom patterns.
|
|
278
|
-
* **[Variable Substitution Example](doc/variable_substitution_example.md)** - Practical examples.
|
|
283
|
+
* **[Variable Substitution Example](doc/variable_substitution_example.md)** - Practical examples.
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
2
|
import YAML from 'yaml';
|
|
5
3
|
import { getConfigPath } from '../config.js';
|
|
6
4
|
export function getTemplatesForCompletion() {
|
|
@@ -67,8 +65,8 @@ _pt_completions() {
|
|
|
67
65
|
;;
|
|
68
66
|
init)
|
|
69
67
|
if [[ "$cur" == -* ]]; then
|
|
70
|
-
COMPREPLY=( $(compgen -W "-f --file --skip-post-config --dry-run -y --yes --vars -h --help" -- "$cur") )
|
|
71
|
-
elif [[ $cword -
|
|
68
|
+
COMPREPLY=( $(compgen -W "-f --file --skip-post-config --dry-run -y --yes --vars --collision --json -h --help" -- "$cur") )
|
|
69
|
+
elif [[ $cword -ge 2 ]]; then
|
|
72
70
|
local templates
|
|
73
71
|
templates=$(pt completion --templates 2>/dev/null)
|
|
74
72
|
COMPREPLY=( $(compgen -W "$templates" -- "$cur") )
|
|
@@ -200,9 +198,10 @@ _pt() {
|
|
|
200
198
|
'--dry-run[Show what would be created without making changes]' \\
|
|
201
199
|
'(-y --yes)'{-y,--yes}'[Automatically answer yes to prompts]' \\
|
|
202
200
|
'--vars=[Comma-separated key=value variables]:variables:' \\
|
|
201
|
+
'--collision=[File collision resolution strategy]:mode:(overwrite newest)' \\
|
|
202
|
+
'--json[Output result as JSON]' \\
|
|
203
203
|
'(-h --help)'{-h,--help}'[display help for command]' \\
|
|
204
|
-
'
|
|
205
|
-
'2:destPath:_files -/'
|
|
204
|
+
'*:templates:_pt_templates'
|
|
206
205
|
;;
|
|
207
206
|
config)
|
|
208
207
|
_arguments \\
|
|
@@ -328,6 +327,8 @@ complete -c pt -n '__fish_pt_using_command init' -l skip-post-config -d 'Skip ru
|
|
|
328
327
|
complete -c pt -n '__fish_pt_using_command init' -l dry-run -d 'Show what would be created without making changes'
|
|
329
328
|
complete -c pt -n '__fish_pt_using_command init' -s y -l yes -d 'Automatically answer yes to prompts'
|
|
330
329
|
complete -c pt -n '__fish_pt_using_command init' -l vars -d 'Comma-separated key=value variables'
|
|
330
|
+
complete -c pt -n '__fish_pt_using_command init' -l collision -a 'overwrite newest' -d 'File collision resolution strategy'
|
|
331
|
+
complete -c pt -n '__fish_pt_using_command init' -l json -d 'Output result as JSON'
|
|
331
332
|
|
|
332
333
|
# config
|
|
333
334
|
complete -c pt -n '__fish_pt_using_command config' -a '(__fish_pt_templates)' -d 'Template name'
|
|
@@ -396,13 +397,3 @@ export async function completionCommand(shellArg, options) {
|
|
|
396
397
|
process.exit(1);
|
|
397
398
|
}
|
|
398
399
|
}
|
|
399
|
-
// Allow direct execution via tsx src/commands/completionCommand.ts <shell>
|
|
400
|
-
if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
|
|
401
|
-
const shell = process.argv[2];
|
|
402
|
-
if (shell === '--templates' || shell === '_templates') {
|
|
403
|
-
completionCommand(shell, { templates: true });
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
completionCommand(shell);
|
|
407
|
-
}
|
|
408
|
-
}
|