@launch11/srgical 0.0.1
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/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/init.js +26 -0
- package/dist/commands/run-next.js +54 -0
- package/dist/commands/studio.js +7 -0
- package/dist/core/agent.js +164 -0
- package/dist/core/claude.js +271 -0
- package/dist/core/codex.js +257 -0
- package/dist/core/execution-controls.js +87 -0
- package/dist/core/execution-state.js +87 -0
- package/dist/core/local-pack.js +125 -0
- package/dist/core/planning-epochs.js +116 -0
- package/dist/core/planning-pack-state.js +121 -0
- package/dist/core/prompts.js +230 -0
- package/dist/core/studio-session.js +99 -0
- package/dist/core/templates.js +189 -0
- package/dist/core/workspace.js +67 -0
- package/dist/index.js +60 -0
- package/dist/ui/studio.js +704 -0
- package/docs/adr/0001-tech-stack.md +27 -0
- package/docs/distribution.md +129 -0
- package/docs/product-foundation.md +50 -0
- package/docs/testing-strategy.md +96 -0
- package/package.json +64 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ADR 0001: Initial Stack
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted on 2026-03-23
|
|
6
|
+
|
|
7
|
+
## Decision
|
|
8
|
+
|
|
9
|
+
The first implementation uses TypeScript on Node with:
|
|
10
|
+
|
|
11
|
+
- `commander` for the CLI surface
|
|
12
|
+
- `blessed` for the full-screen terminal UI
|
|
13
|
+
- native child-process spawning for Codex orchestration
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
- Node is already available in the current environment
|
|
18
|
+
- the product needs fast iteration on terminal UX, subprocess orchestration, and text-heavy state
|
|
19
|
+
- packaging through `npm` is immediate, while other install paths can wrap release artifacts later
|
|
20
|
+
- the first version needs to target a real installed agent today, and `codex` is already present
|
|
21
|
+
|
|
22
|
+
## Consequences
|
|
23
|
+
|
|
24
|
+
- The first release is easiest to distribute through `npm`
|
|
25
|
+
- Homebrew, Chocolatey, and PyPI support should be treated as release-packaging work, not as a reason to block the
|
|
26
|
+
initial product
|
|
27
|
+
- if we later want a single native binary without Node, we can revisit Go or .NET once the workflow is proven
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Distribution Guide
|
|
2
|
+
|
|
3
|
+
## Current Production Channel
|
|
4
|
+
|
|
5
|
+
The current production release channels are GitHub Packages for npm, the public npm registry, and GitHub Releases.
|
|
6
|
+
Versioning is source-controlled with Changesets, which means semver intent lives in pull requests instead of being
|
|
7
|
+
inferred from CI build numbers.
|
|
8
|
+
|
|
9
|
+
The npm package does not bundle `codex` or `claude`. Users still need at least one supported local agent CLI installed
|
|
10
|
+
separately and available on `PATH`, and `srgical doctor` remains the truthful way to confirm which agents are usable on
|
|
11
|
+
the current machine.
|
|
12
|
+
|
|
13
|
+
## Release Flow
|
|
14
|
+
|
|
15
|
+
1. A feature branch that changes the package also adds a changeset with `npm run changeset`.
|
|
16
|
+
2. When that branch lands on `main`, the release workflow runs `npm ci`, `npm test`, and `npm run version-packages`.
|
|
17
|
+
3. If the changesets produce a version bump, the workflow commits the updated `package.json`, `CHANGELOG.md`, and
|
|
18
|
+
consumed changeset files back to `main`.
|
|
19
|
+
4. The same workflow run publishes `@launcheleven/srgical` to GitHub Packages.
|
|
20
|
+
5. The workflow also stages and publishes `@launch11/srgical` to the public npm registry.
|
|
21
|
+
6. After both publishes, the workflow creates a `v<version>` tag and a GitHub Release with the packaged artifacts
|
|
22
|
+
attached.
|
|
23
|
+
|
|
24
|
+
This keeps the published semver repeatable across reruns and tracked in git history instead of being tied to a specific
|
|
25
|
+
Actions run number, without requiring a separate release PR just to ship the version bump.
|
|
26
|
+
|
|
27
|
+
## Local Release Check
|
|
28
|
+
|
|
29
|
+
Run this from the repo root:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run release:pack
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
That command:
|
|
36
|
+
|
|
37
|
+
- builds the TypeScript CLI,
|
|
38
|
+
- runs `node dist/index.js doctor`,
|
|
39
|
+
- creates an npm tarball under `.artifacts/release/`,
|
|
40
|
+
- writes `release-manifest.json` and `release-manifest.md` with the artifact path and SHA256 hash.
|
|
41
|
+
|
|
42
|
+
## Registry Configuration
|
|
43
|
+
|
|
44
|
+
GitHub Packages only supports scoped npm package names. This repo publishes two package names from the same source:
|
|
45
|
+
|
|
46
|
+
- `@launcheleven/srgical` on GitHub Packages
|
|
47
|
+
- `@launch11/srgical` on the public npm registry
|
|
48
|
+
|
|
49
|
+
The repo-local `.npmrc` pins that scope to GitHub Packages:
|
|
50
|
+
|
|
51
|
+
```ini
|
|
52
|
+
@launcheleven:registry=https://npm.pkg.github.com
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The workflow publishes the GitHub package with `GITHUB_TOKEN`, which GitHub supports for packages associated with the
|
|
56
|
+
workflow repository. The npm public package uses the repository secret `NPM_TOKEN`. Local installs and local publishes
|
|
57
|
+
still require authentication in the user's own npm config:
|
|
58
|
+
|
|
59
|
+
```ini
|
|
60
|
+
//npm.pkg.github.com/:_authToken=TOKEN
|
|
61
|
+
@launcheleven:registry=https://npm.pkg.github.com
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```ini
|
|
65
|
+
//registry.npmjs.org/:_authToken=TOKEN
|
|
66
|
+
@launch11:registry=https://registry.npmjs.org
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Post-Install Setup
|
|
70
|
+
|
|
71
|
+
After installing the package, run:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
srgical doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
That verifies the workspace state, shows the active agent, and reports whether `codex` and `claude` are locally
|
|
78
|
+
available or missing.
|
|
79
|
+
|
|
80
|
+
## Artifact Strategy
|
|
81
|
+
|
|
82
|
+
### npm
|
|
83
|
+
|
|
84
|
+
- Source of truth for the first production install path.
|
|
85
|
+
- Install target once published:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm install -g @launcheleven/srgical
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install -g @launch11/srgical
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- Required local prerequisites after install:
|
|
96
|
+
- authenticated access to GitHub Packages
|
|
97
|
+
- `codex` and/or `claude` installed separately
|
|
98
|
+
- available on `PATH` for the current shell session
|
|
99
|
+
|
|
100
|
+
- Local install smoke test from a generated tarball:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install -g ./.artifacts/release/<tarball-name>.tgz
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Standalone Binaries
|
|
107
|
+
|
|
108
|
+
- Not implemented in this step.
|
|
109
|
+
- Defined path: build Windows, macOS, and Linux binaries from tagged releases once the Node-based CLI workflow is
|
|
110
|
+
stable enough to freeze into a single-file artifact.
|
|
111
|
+
- Those binaries should be uploaded to GitHub Releases next to the npm tarball so they remain version-aligned.
|
|
112
|
+
|
|
113
|
+
### Wrapper Package Managers
|
|
114
|
+
|
|
115
|
+
- Not implemented in this step.
|
|
116
|
+
- Defined path: `brew`, `choco`, and similar wrappers should install versioned GitHub Release artifacts instead of
|
|
117
|
+
rebuilding from source in each ecosystem.
|
|
118
|
+
- That keeps wrapper packages thin and aligned with the exact tested release outputs.
|
|
119
|
+
|
|
120
|
+
## Release Inputs
|
|
121
|
+
|
|
122
|
+
The published npm package should include:
|
|
123
|
+
|
|
124
|
+
- `dist/`
|
|
125
|
+
- `README.md`
|
|
126
|
+
- `docs/`
|
|
127
|
+
- `LICENSE`
|
|
128
|
+
|
|
129
|
+
The production entrypoint remains the `srgical` bin mapped to `dist/index.js`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Product Foundation
|
|
2
|
+
|
|
3
|
+
## Source Pattern
|
|
4
|
+
|
|
5
|
+
The system in `Writr\migrations-part-5` has four durable primitives:
|
|
6
|
+
|
|
7
|
+
1. `01`: a stable high-level plan
|
|
8
|
+
2. `02`: a current-context kickoff and handoff log
|
|
9
|
+
3. `03`: a detailed step tracker with strict progression rules
|
|
10
|
+
4. `04`: a repeatable next-agent prompt that forces disciplined continuation
|
|
11
|
+
|
|
12
|
+
That pattern is the product.
|
|
13
|
+
|
|
14
|
+
## Product Thesis
|
|
15
|
+
|
|
16
|
+
Teams should be able to run one command, enter a planning studio, talk with an AI until the approach is ready, write a
|
|
17
|
+
tracker pack into the repo, and then keep executing the next valid chunk without manually reconstructing state each
|
|
18
|
+
time.
|
|
19
|
+
|
|
20
|
+
## Non-Negotiables
|
|
21
|
+
|
|
22
|
+
- Local-first by default
|
|
23
|
+
- Agent actions remain explicit
|
|
24
|
+
- The workflow is markdown-first and repo-visible
|
|
25
|
+
- Execution must be incremental, resumable, and validation-aware
|
|
26
|
+
- The UI cannot feel like a boring debug console
|
|
27
|
+
|
|
28
|
+
## V1 Scope
|
|
29
|
+
|
|
30
|
+
- Two launch-scope agent adapters: `codex` and `claude`
|
|
31
|
+
- One planning-pack format under `.srgical/`
|
|
32
|
+
- One full-screen TUI for planning conversation
|
|
33
|
+
- One execution command that runs the current next-step prompt through the active workspace agent
|
|
34
|
+
- Truthful installed-tool detection plus session-scoped active-agent selection
|
|
35
|
+
|
|
36
|
+
## V1 Success Criteria
|
|
37
|
+
|
|
38
|
+
- A new repo can be bootstrapped without manual prompt copy-paste
|
|
39
|
+
- The user can plan inside a dedicated interface instead of a raw shell
|
|
40
|
+
- The generated pack is close enough to the existing Writr-style system that it feels familiar
|
|
41
|
+
- The user can trigger the next execution loop with a single command
|
|
42
|
+
- The product reports missing supported agents honestly and lets the user choose the active local tool when more than
|
|
43
|
+
one is installed
|
|
44
|
+
|
|
45
|
+
## Distribution Strategy
|
|
46
|
+
|
|
47
|
+
- Native packages: GitHub Packages as `@launcheleven/srgical` and npm public as `@launch11/srgical`
|
|
48
|
+
- Versioning model: semver via Changesets on GitHub Actions, with version commits pushed directly to `main`
|
|
49
|
+
- Release artifacts: standalone binaries for Windows, macOS, and Linux
|
|
50
|
+
- Package-manager wrappers: `brew`, `choco`, and other ecosystems can install those release artifacts
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Testing Strategy
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This plan turns the current srgical CLI into a continuously verifiable tool instead of a repo that only relies on
|
|
6
|
+
manual smoke checks. It is deliberately staged so we cover the highest-risk flows first and use the work to shake out
|
|
7
|
+
real bugs.
|
|
8
|
+
|
|
9
|
+
## Current Risk Map
|
|
10
|
+
|
|
11
|
+
### Tier 1: Command safety
|
|
12
|
+
|
|
13
|
+
- `doctor` must report truthful repo and agent state.
|
|
14
|
+
- `init` must create a usable planning pack and fail safely on accidental overwrite.
|
|
15
|
+
- `run-next` must never execute stale or unsafe work when the tracker has no queued step.
|
|
16
|
+
- `studio` slash-command flows must keep explicit user control over writes and execution.
|
|
17
|
+
|
|
18
|
+
### Tier 2: Pack integrity
|
|
19
|
+
|
|
20
|
+
- workspace path helpers must resolve `.srgical/` files consistently.
|
|
21
|
+
- template generation must always produce a complete four-file planning pack.
|
|
22
|
+
- planning-pack state parsing must keep tracker truth aligned with command output.
|
|
23
|
+
- execution state and durable logs must round-trip without corrupting summaries.
|
|
24
|
+
|
|
25
|
+
### Tier 3: Adapter and Agent behavior
|
|
26
|
+
|
|
27
|
+
- primary-agent status detection must degrade cleanly when Codex is unavailable.
|
|
28
|
+
- planner, pack-writing, and execution adapters must preserve today's Codex-first behavior.
|
|
29
|
+
- Windows command resolution and shell-shim launching must stay covered because that path has already broken once.
|
|
30
|
+
|
|
31
|
+
### Tier 4: Release confidence
|
|
32
|
+
|
|
33
|
+
- `release:pack` must build, validate, and emit the npm tarball plus manifests.
|
|
34
|
+
- package contents must stay intentional.
|
|
35
|
+
- release workflow configuration must remain aligned with the local release script.
|
|
36
|
+
|
|
37
|
+
## Coverage Plan
|
|
38
|
+
|
|
39
|
+
### Phase A: Fast local tests
|
|
40
|
+
|
|
41
|
+
- built-in Node test runner through `tsx`
|
|
42
|
+
- temp-workspace integration tests for command behavior
|
|
43
|
+
- pure-module tests for parser and formatter logic
|
|
44
|
+
|
|
45
|
+
This is the right default layer for the current codebase because most logic is filesystem- and text-driven, not UI DOM
|
|
46
|
+
driven.
|
|
47
|
+
|
|
48
|
+
### Phase B: Studio behavior tests
|
|
49
|
+
|
|
50
|
+
- isolate slash-command handlers into smaller helpers
|
|
51
|
+
- test `/write`, `/preview`, `/run`, and `/help` behavior without booting a full terminal
|
|
52
|
+
- add keyboard behavior tests for transcript scrolling once more of the TUI logic is extracted from Blessed setup
|
|
53
|
+
|
|
54
|
+
### Phase C: Agent and platform regression tests
|
|
55
|
+
|
|
56
|
+
- stub the primary-agent adapter to verify planner, pack-write, and execution command paths
|
|
57
|
+
- add Windows-focused regression cases for command resolution and `.cmd` launch behavior
|
|
58
|
+
- add negative tests for missing agent, malformed tracker files, and partial planning-pack state
|
|
59
|
+
|
|
60
|
+
### Phase D: Release verification
|
|
61
|
+
|
|
62
|
+
- assert that `npm run release:pack` creates the tarball and release manifests
|
|
63
|
+
- inspect packed file lists and fail if unintended files leak into the npm artifact
|
|
64
|
+
- optionally run these as a slower integration suite in CI only
|
|
65
|
+
|
|
66
|
+
## Executable Baseline Added Now
|
|
67
|
+
|
|
68
|
+
- `test/core/planning-pack-state.test.ts`
|
|
69
|
+
- `test/core/execution-state.test.ts`
|
|
70
|
+
- `test/commands/doctor.test.ts`
|
|
71
|
+
- `test/commands/run-next.test.ts`
|
|
72
|
+
|
|
73
|
+
These cover the current highest-signal logic: tracker parsing, execution-state durability, truthful `doctor` output,
|
|
74
|
+
and safe `run-next` behavior.
|
|
75
|
+
|
|
76
|
+
## Bugs Surfaced During This Planning Pass
|
|
77
|
+
|
|
78
|
+
- `run-next` was still willing to execute even when the tracker exposed no next recommended step. That left room for a
|
|
79
|
+
stale `.srgical/04-next-agent-prompt.md` to run after the tracker was effectively complete.
|
|
80
|
+
- The same safety issue existed in the studio `/run` path.
|
|
81
|
+
|
|
82
|
+
Both execution paths are now guarded by the same queued-step safety rule.
|
|
83
|
+
|
|
84
|
+
## Commands
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm test
|
|
88
|
+
npm run test:coverage
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Near-Term Next Test Steps
|
|
92
|
+
|
|
93
|
+
- add `init` command tests, especially overwrite protection
|
|
94
|
+
- extract and test studio slash-command helpers
|
|
95
|
+
- add agent-adapter stubs for unavailable-agent and successful-execution cases
|
|
96
|
+
- add release-pack integration assertions for tarball contents and manifest hashes
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@launch11/srgical",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A polished local-first CLI for planning and executing long AI-driven delivery sequences.",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"README.md",
|
|
8
|
+
"docs",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"srgical": "dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"changeset": "changeset",
|
|
17
|
+
"dev": "tsx src/index.ts",
|
|
18
|
+
"release": "npm run release:pack && npm run publish:github && npm run publish:npm",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"doctor": "tsx src/index.ts doctor",
|
|
21
|
+
"test": "tsx --test test/**/*.test.ts",
|
|
22
|
+
"test:coverage": "tsx --test --experimental-test-coverage test/**/*.test.ts",
|
|
23
|
+
"version-packages": "changeset version",
|
|
24
|
+
"release:pack": "node scripts/release-pack.mjs",
|
|
25
|
+
"publish:github": "changeset publish",
|
|
26
|
+
"publish:npm": "node scripts/publish-npm.mjs",
|
|
27
|
+
"release:version": "node scripts/read-package-version.mjs"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/LaunchEleven/Srgical.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/LaunchEleven/Srgical#readme",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/LaunchEleven/Srgical/issues"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"ai",
|
|
46
|
+
"cli",
|
|
47
|
+
"codex",
|
|
48
|
+
"agent",
|
|
49
|
+
"orchestration",
|
|
50
|
+
"planning"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"blessed": "^0.1.81",
|
|
55
|
+
"commander": "^14.0.3"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@changesets/cli": "^2.30.0",
|
|
59
|
+
"@types/blessed": "^0.1.27",
|
|
60
|
+
"@types/node": "^25.5.0",
|
|
61
|
+
"tsx": "^4.21.0",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
|
+
}
|
|
64
|
+
}
|