@erclx/canon 5.58.0 → 5.59.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.
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
- set -o pipefail
4
-
5
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
- PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
7
-
8
- source "$PROJECT_ROOT/scripts/lib/ui.sh"
9
-
10
- ZSHRC="${ZDOTDIR:-$HOME}/.zshrc"
11
- MARKER_OPEN="# >>> canon aliases >>>"
12
- MARKER_CLOSE="# <<< canon aliases <<<"
13
-
14
- check_dependencies() {
15
- command -v bun >/dev/null 2>&1 || log_error "bun is not installed. See https://bun.sh, then re-run."
16
- }
17
-
18
- install_cli() {
19
- log_step "Installing the canon CLI"
20
- bun install --cwd "$PROJECT_ROOT" >/dev/null
21
- bun link --cwd "$PROJECT_ROOT" >/dev/null
22
- log_info "Dependencies installed and canon linked"
23
- }
24
-
25
- alias_block() {
26
- cat <<EOF
27
- $MARKER_OPEN
28
- TOOLKIT="$PROJECT_ROOT"
29
- export CLAUDE_CODE_ENABLE_TODO_TOOLS=1
30
-
31
- alias cl='claude'
32
- alias clr='cl -r'
33
- alias clc='cl -c'
34
- alias clw='cl -w'
35
- alias cls='cl --model sonnet'
36
-
37
- alias clp='claude --plugin-dir \$TOOLKIT/claude'
38
- alias clpc='clp -c'
39
- alias clps='clp --model sonnet'
40
- alias clpa='clp agents'
41
- alias clpac='clpa --cwd .'
42
- $MARKER_CLOSE
43
- EOF
44
- }
45
-
46
- install_aliases() {
47
- log_step "Installing Claude Code shell aliases"
48
- log_info "This step manages a marked alias block in $ZSHRC, the only file outside the repo this script writes."
49
- log_info "Delete the block and its two marker comments to remove the aliases. Re-running never adds a second copy."
50
-
51
- if [ -f "$ZSHRC" ] && grep -qF "$MARKER_OPEN" "$ZSHRC"; then
52
- log_info "Aliases already present in $ZSHRC, skipping"
53
- return
54
- fi
55
-
56
- if [ -f "$ZSHRC" ] && grep -qE "^alias clp=" "$ZSHRC"; then
57
- log_warn "An unmanaged clp alias is already in $ZSHRC. Leaving it untouched."
58
- log_warn "Remove it and re-run to switch to the managed block."
59
- return
60
- fi
61
-
62
- printf '\n%s\n' "$(alias_block)" >>"$ZSHRC"
63
- log_add "Appended canon alias block to $ZSHRC"
64
- log_info "Run 'source $ZSHRC' or open a new shell to load them"
65
- }
66
-
67
- verify_cli() {
68
- log_step "Verifying the install"
69
- if canon --help >/dev/null 2>&1; then
70
- log_info "canon resolves on PATH"
71
- else
72
- log_warn "canon not on PATH yet. Ensure \$BUN_INSTALL/bin is exported, then re-open your shell."
73
- fi
74
- }
75
-
76
- main() {
77
- open_timeline "canon bootstrap"
78
- trap close_timeline EXIT
79
-
80
- check_dependencies
81
- install_cli
82
- install_aliases
83
- verify_cli
84
- }
85
-
86
- main "$@"
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
- set -o pipefail
4
-
5
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
- PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
7
-
8
- source "$PROJECT_ROOT/scripts/lib/ui.sh"
9
-
10
- TMP_ROOT="$PROJECT_ROOT/.canon/tmp/install-check"
11
- PACK_DIR="$TMP_ROOT/pack"
12
- EXTRACT_DIR="$TMP_ROOT/extract"
13
- TARGET_DIR="$TMP_ROOT/target"
14
- KEEP=0
15
-
16
- for arg in "$@"; do
17
- case "$arg" in
18
- --keep) KEEP=1 ;;
19
- --help | -h)
20
- cat <<HELP
21
- Usage: scripts/core/install-check.sh [--keep]
22
-
23
- Verifies the published install path end to end:
24
- 1. Packs this repo into a tarball at .canon/tmp/install-check/pack
25
- 2. Extracts it and asserts sandbox is absent from the tree
26
- 3. Runs bun install --production in the extracted tree
27
- 4. Runs the CLI with --help from the extracted tree to confirm it resolves
28
- 5. Scaffolds a fresh project in .canon/tmp/install-check/target
29
- 6. Runs canon init from the extracted package and asserts a scaffold landed
30
-
31
- Flags:
32
- --keep Keep the tmp tree on exit for inspection
33
- HELP
34
- exit 0
35
- ;;
36
- esac
37
- done
38
-
39
- cleanup() {
40
- if [ "$KEEP" = "1" ]; then
41
- log_info "Kept artifacts at $TMP_ROOT"
42
- else
43
- rm -rf "$TMP_ROOT"
44
- fi
45
- close_timeline
46
- }
47
- trap cleanup EXIT
48
-
49
- rm -rf "$TMP_ROOT"
50
- mkdir -p "$PACK_DIR" "$EXTRACT_DIR"
51
-
52
- open_timeline "Install verification"
53
-
54
- # An absence check over a path the source tree no longer holds passes on
55
- # nothing, so the excluded tree has to exist here before its absence below can
56
- # mean the publish left it out.
57
- log_step "Assert excluded path exists in source"
58
- if [ ! -f "$PROJECT_ROOT/sandbox/exempt.toml" ]; then
59
- log_error "sandbox/exempt.toml is missing from the source tree, so the absence check below would pass on nothing"
60
- fi
61
- log_info "Present: sandbox/exempt.toml"
62
-
63
- log_step "Pack"
64
- TARBALL_PATH="$(cd "$PROJECT_ROOT" && bun pm pack --quiet --ignore-scripts --destination "$PACK_DIR" | tail -n 1)"
65
- log_info "Packed to $TARBALL_PATH"
66
-
67
- log_step "Extract"
68
- tar -xzf "$TARBALL_PATH" -C "$EXTRACT_DIR" --strip-components=1
69
- log_info "Extracted to $EXTRACT_DIR"
70
-
71
- log_step "Assert excluded path is absent"
72
- if [ -e "$EXTRACT_DIR/sandbox" ]; then
73
- log_error "sandbox shipped in the tarball, and the files field in package.json leaves it out"
74
- fi
75
- log_info "Absent: sandbox"
76
-
77
- log_step "Install dependencies (production)"
78
- (cd "$EXTRACT_DIR" && bun install --production --ignore-scripts --silent 2>&1 | pipe_output) || log_error "bun install --production failed"
79
- log_info "Dependencies installed without devDependencies"
80
-
81
- log_step "Confirm CLI runs"
82
- (cd "$EXTRACT_DIR" && bun run src/cli.ts --help >/dev/null) || log_error "canon --help failed"
83
- log_info "canon --help ran clean from the extracted package"
84
-
85
- log_step "Scaffold fresh project"
86
- mkdir -p "$TARGET_DIR"
87
- (cd "$TARGET_DIR" && git init --quiet)
88
- log_info "Initialized git in $TARGET_DIR"
89
-
90
- log_step "Run canon init"
91
- (cd "$TARGET_DIR" && bun run "$EXTRACT_DIR/src/cli.ts" init --stack base </dev/null 2>&1 | pipe_output) || log_error "canon init failed"
92
- log_info "canon init completed"
93
-
94
- log_step "Assert scaffold"
95
- # Every domain canon init installs needs at least one path here. A domain with
96
- # no assertion can truncate silently: init still exits 0 because run_domain
97
- # catches a failed domain, and the gate stays green while the target is
98
- # missing everything that domain provides.
99
- #
100
- # Authoring references name no path because they ship inside the plugin's
101
- # skills rather than installing into a target. The two
102
- # rule paths stand for the `claude` and `canon` groups `base` takes whole.
103
- for path in "CLAUDE.md" ".claude" "canon/context/index.md" \
104
- ".oxfmtrc.json" ".lintstagedrc" ".husky/pre-commit" ".github/workflows/verify.yml" "scripts/verify.ts" \
105
- ".claude/rules/canon/claude/output.md" ".claude/rules/canon/canon/scratch.md"; do
106
- if [ ! -e "$TARGET_DIR/$path" ]; then
107
- log_error "Missing after canon init: $path"
108
- fi
109
- log_info "Found: $path"
110
- done
111
-
112
- log_step "Verification passed"
113
- log_info "Manual check still needed: bun link and global canon invocation"
package/scripts/lib/ui.sh DELETED
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [ "${BASH_VERSINFO[0]:-0}" -lt 4 ]; then
4
- echo "canon requires bash 4 or newer. Current: ${BASH_VERSION:-unknown}." >&2
5
- echo "Install via Homebrew: brew install bash" >&2
6
- exit 1
7
- fi
8
-
9
- # The frame writes no color. The scripts left on it run as setup and gate steps,
10
- # where a pipe or a log reads the output more often than a terminal does.
11
-
12
- log_info() {
13
- echo -e "│ ✓ $1" >&2
14
- }
15
- log_warn() {
16
- echo -e "│ ! $1" >&2
17
- }
18
- log_error() {
19
- echo -e "│ ✗ $1" >&2
20
- exit 1
21
- }
22
- log_step() {
23
- echo -e "│\n├ $1" >&2
24
- }
25
- log_add() {
26
- echo -e "│ + $1" >&2
27
- }
28
- log_rem() {
29
- echo -e "│ - $1" >&2
30
- }
31
-
32
- pipe_output() {
33
- while IFS= read -r line; do echo -e "│ $line" >&2; done
34
- }
35
-
36
- open_timeline() {
37
- echo -e "┌" >&2
38
- if [ -n "${1:-}" ]; then
39
- echo -e "│ $1" >&2
40
- fi
41
- }
42
-
43
- close_timeline() {
44
- echo -e "└" >&2
45
- }