trackops 2.0.1 → 2.0.3
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 +98 -127
- package/locales/en.json +2 -2
- package/locales/es.json +2 -2
- package/package.json +1 -1
- package/scripts/skills-marketplace-smoke.js +1 -1
- package/scripts/smoke-tests.js +2 -18
- package/scripts/validate-skill.js +18 -4
- package/skills/trackops/SKILL.md +51 -15
- package/skills/trackops/agents/openai.yaml +2 -2
- package/skills/trackops/locales/en/SKILL.md +51 -15
- package/skills/trackops/locales/en/references/activation.md +9 -7
- package/skills/trackops/locales/en/references/troubleshooting.md +16 -10
- package/skills/trackops/locales/en/references/workflow.md +18 -12
- package/skills/trackops/references/activation.md +14 -12
- package/skills/trackops/references/troubleshooting.md +22 -16
- package/skills/trackops/references/workflow.md +21 -15
- package/skills/trackops/skill.json +5 -5
- package/templates/opera/architecture/dependency-graph.md +1 -1
- package/templates/opera/en/architecture/dependency-graph.md +1 -1
- package/templates/skills/project-starter-skill/SKILL.md +2 -0
- package/templates/skills/project-starter-skill/locales/en/SKILL.md +1 -0
- package/skills/trackops/scripts/bootstrap-trackops.js +0 -203
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "trackops"
|
|
3
|
-
description: "Global TrackOps skill for
|
|
3
|
+
description: "Global TrackOps skill for explaining what TrackOps does, requiring explicit npm runtime installation, and guiding local project and OPERA activation inside each repository."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# TrackOps
|
|
7
7
|
|
|
8
8
|
Use this localized file when the conversation and project should run in English.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
TrackOps is for working with agents on real projects without mixing the product itself with the operational layer.
|
|
11
|
+
|
|
12
|
+
Use this skill when someone:
|
|
13
|
+
|
|
14
|
+
- wants to start a project with AI agents
|
|
15
|
+
- already has a repository and needs operational structure
|
|
16
|
+
- needs to activate TrackOps and, if needed, OPERA
|
|
17
|
+
- wants the same workflow in English or Spanish
|
|
18
|
+
|
|
19
|
+
## What this skill does
|
|
20
|
+
|
|
21
|
+
This skill:
|
|
22
|
+
|
|
23
|
+
- explains what TrackOps is and when to use it
|
|
24
|
+
- requires an explicit and visible runtime installation
|
|
25
|
+
- guides per-repository activation
|
|
26
|
+
- helps route OPERA into either `direct bootstrap` or `agent handoff`
|
|
27
|
+
|
|
28
|
+
## What this skill does not do
|
|
29
|
+
|
|
30
|
+
This skill does not:
|
|
31
|
+
|
|
32
|
+
- install packages by itself
|
|
33
|
+
- execute remote code silently
|
|
34
|
+
- modify a repository before the runtime exists
|
|
35
|
+
- replace the `trackops` runtime
|
|
36
|
+
|
|
37
|
+
## Quick flow
|
|
11
38
|
|
|
12
39
|
Install the marketplace skill with:
|
|
13
40
|
|
|
@@ -15,21 +42,21 @@ Install the marketplace skill with:
|
|
|
15
42
|
npx skills add Baxahaun/trackops
|
|
16
43
|
```
|
|
17
44
|
|
|
18
|
-
|
|
45
|
+
Then confirm that the `trackops` runtime exists. If it is missing, ask the user to install it explicitly:
|
|
19
46
|
|
|
20
47
|
```bash
|
|
21
|
-
|
|
48
|
+
npm install -g trackops
|
|
49
|
+
trackops --version
|
|
22
50
|
```
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
Rules:
|
|
25
53
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
54
|
+
- the skill must not install packages or execute remote code by itself
|
|
55
|
+
- the runtime is installed through a visible and auditable npm step
|
|
56
|
+
- the skill may verify `trackops --version`, but it must not chain silent installs
|
|
57
|
+
- the skill must not create repository files by itself
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Local project layer
|
|
59
|
+
## Project activation
|
|
33
60
|
|
|
34
61
|
Inside the repository:
|
|
35
62
|
|
|
@@ -40,7 +67,8 @@ trackops opera install
|
|
|
40
67
|
|
|
41
68
|
Core rules:
|
|
42
69
|
|
|
43
|
-
- treat the global
|
|
70
|
+
- treat the global skill as an instruction layer
|
|
71
|
+
- treat runtime installation as explicit and separate
|
|
44
72
|
- use `ops/contract/operating-contract.json` as the machine contract when it exists
|
|
45
73
|
- use `ops/project_control.json` as the operational source of truth
|
|
46
74
|
- use `ops/policy/autonomy.json` before approval-sensitive actions
|
|
@@ -48,7 +76,7 @@ Core rules:
|
|
|
48
76
|
- keep generated operational docs under `ops/`
|
|
49
77
|
- use `trackops locale get|set` and `trackops doctor locale` when language matters
|
|
50
78
|
|
|
51
|
-
## OPERA
|
|
79
|
+
## How OPERA enters the flow
|
|
52
80
|
|
|
53
81
|
OPERA no longer assumes every user is technical.
|
|
54
82
|
|
|
@@ -79,8 +107,16 @@ If TrackOps routes bootstrap to the agent:
|
|
|
79
107
|
trackops opera bootstrap --resume
|
|
80
108
|
```
|
|
81
109
|
|
|
110
|
+
## What someone arriving from skills.sh should understand
|
|
111
|
+
|
|
112
|
+
- the global skill installs instructions into the agent
|
|
113
|
+
- the runtime is installed separately with npm
|
|
114
|
+
- `trackops init` activates the project
|
|
115
|
+
- `trackops opera install` adds the full operating framework only when needed
|
|
116
|
+
- TrackOps separates product and operations so the repository stays manageable
|
|
117
|
+
|
|
82
118
|
## Which reference to read and when
|
|
83
119
|
|
|
84
|
-
- read `locales/en/references/activation.md` only for installation,
|
|
120
|
+
- read `locales/en/references/activation.md` only for installation, runtime verification, locale bootstrap, and repository activation
|
|
85
121
|
- read `locales/en/references/workflow.md` only when TrackOps is already active and you need day-to-day repository operations
|
|
86
|
-
- read `locales/en/references/troubleshooting.md` only when installation,
|
|
122
|
+
- read `locales/en/references/troubleshooting.md` only when explicit installation, `trackops` detection, resume, or environment contract handling fails
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Global install
|
|
4
4
|
|
|
5
|
-
Install the marketplace skill:
|
|
6
|
-
|
|
7
5
|
```bash
|
|
8
6
|
npx skills add Baxahaun/trackops
|
|
7
|
+
npm install -g trackops
|
|
8
|
+
trackops --version
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The global skill installs instructions for the agent.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
The `trackops` runtime is installed separately through npm so the step stays visible, auditable, and easy to verify.
|
|
14
|
+
|
|
15
|
+
Before continuing:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- confirm that `trackops --version` returns a valid version
|
|
18
|
+
- if it does not, fix PATH or reinstall `trackops`
|
|
19
|
+
- the skill must not try to install the runtime by itself
|
|
18
20
|
|
|
19
21
|
## Local activation
|
|
20
22
|
|
|
@@ -5,18 +5,24 @@
|
|
|
5
5
|
- Install Node 18+ if Node is missing or too old.
|
|
6
6
|
- Install a Node distribution that includes npm if npm is missing.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## The skill is installed, but `trackops` does not start
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Confirm that the global skill exists:
|
|
11
11
|
`npx skills add Baxahaun/trackops`
|
|
12
|
-
-
|
|
13
|
-
`
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
12
|
+
- Install or reinstall the runtime explicitly:
|
|
13
|
+
`npm install -g trackops`
|
|
14
|
+
- Verify:
|
|
15
|
+
`trackops --version`
|
|
16
|
+
- If the binary still does not respond:
|
|
17
|
+
- check Node.js (`>= 18`)
|
|
18
|
+
- check that `npm` exists and works
|
|
19
|
+
- check PATH and reopen the terminal
|
|
20
|
+
|
|
21
|
+
## Explicit runtime installation fails
|
|
22
|
+
|
|
23
|
+
- Re-run `npm install -g trackops`.
|
|
24
|
+
- If `npm` errors, fix that first; the skill cannot continue without the CLI.
|
|
25
|
+
- If the issue is global permissions, use the recommended method for your system or a user-controlled npm prefix.
|
|
20
26
|
|
|
21
27
|
## OPERA routed bootstrap to the agent
|
|
22
28
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Precondition:
|
|
4
|
+
|
|
5
|
+
- the global skill is already installed
|
|
6
|
+
- `trackops --version` responds correctly
|
|
7
|
+
- the repository was already activated with `trackops init`
|
|
8
|
+
|
|
9
|
+
Use TrackOps when the repository is already managed and you need day-to-day operations.
|
|
4
10
|
|
|
5
11
|
1. Run `trackops status`.
|
|
6
12
|
2. Run `trackops next`.
|
|
@@ -10,17 +16,17 @@ Once TrackOps is active in a repository:
|
|
|
10
16
|
|
|
11
17
|
Operational rules:
|
|
12
18
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- `app/.env` is only a compatibility bridge
|
|
19
|
+
- in split workspaces, use `ops/project_control.json` as the source of truth
|
|
20
|
+
- generated operational docs live in `ops/`
|
|
21
|
+
- product code lives in `app/`
|
|
22
|
+
- real secrets live in `/.env`
|
|
23
|
+
- public environment contract lives in `/.env.example`
|
|
24
|
+
- `app/.env` is only a compatibility bridge
|
|
19
25
|
|
|
20
26
|
If OPERA is installed:
|
|
21
27
|
|
|
22
|
-
- `ops/contract/operating-contract.json` holds the machine contract
|
|
23
|
-
- `ops/genesis.md` holds the compiled human view
|
|
24
|
-
- `ops/policy/autonomy.json` holds the executable autonomy policy
|
|
25
|
-
- `ops/bootstrap/` holds onboarding artifacts
|
|
26
|
-
- `ops/.agent/hub/` and `ops/.agents/skills/` hold managed agent artifacts
|
|
28
|
+
- `ops/contract/operating-contract.json` holds the machine contract
|
|
29
|
+
- `ops/genesis.md` holds the compiled human view
|
|
30
|
+
- `ops/policy/autonomy.json` holds the executable autonomy policy
|
|
31
|
+
- `ops/bootstrap/` holds onboarding artifacts
|
|
32
|
+
- `ops/.agent/hub/` and `ops/.agents/skills/` hold managed agent artifacts
|
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Instalacion global
|
|
4
4
|
|
|
5
|
-
Instala la skill del marketplace:
|
|
6
|
-
|
|
7
5
|
```bash
|
|
8
6
|
npx skills add Baxahaun/trackops
|
|
7
|
+
npm install -g trackops
|
|
8
|
+
trackops --version
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
La skill global instala instrucciones para el agente.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
El runtime `trackops` se instala aparte con npm para que el paso sea visible, auditable y facil de verificar.
|
|
14
|
+
|
|
15
|
+
Antes de seguir:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- confirma que `trackops --version` devuelve una version valida
|
|
18
|
+
- si no aparece, resuelve PATH o reinstala `trackops`
|
|
19
|
+
- la skill no debe intentar instalar el runtime por su cuenta
|
|
18
20
|
|
|
19
21
|
## Activacion local
|
|
20
22
|
|
|
21
|
-
Dentro
|
|
23
|
+
Dentro del repo:
|
|
22
24
|
|
|
23
25
|
```bash
|
|
24
26
|
trackops init
|
|
@@ -39,9 +41,9 @@ OPERA siempre empieza clasificando:
|
|
|
39
41
|
|
|
40
42
|
- nivel tecnico
|
|
41
43
|
- estado del proyecto
|
|
42
|
-
- estado de
|
|
44
|
+
- estado de documentacion
|
|
43
45
|
|
|
44
|
-
Si el proyecto
|
|
46
|
+
Si el proyecto esta en fase temprana o el usuario es no tecnico, TrackOps escribe:
|
|
45
47
|
|
|
46
48
|
- `ops/bootstrap/agent-handoff.md`
|
|
47
49
|
- `ops/bootstrap/agent-handoff.json`
|
|
@@ -52,7 +54,7 @@ El agente debe producir:
|
|
|
52
54
|
- `ops/bootstrap/spec-dossier.md`
|
|
53
55
|
- `ops/bootstrap/open-questions.md` cuando haga falta
|
|
54
56
|
|
|
55
|
-
Cuando el quality gate
|
|
57
|
+
Cuando pasa el quality gate, OPERA compila:
|
|
56
58
|
|
|
57
59
|
- `ops/contract/operating-contract.json`
|
|
58
60
|
- `ops/genesis.md`
|
|
@@ -68,6 +70,6 @@ Controles de idioma:
|
|
|
68
70
|
|
|
69
71
|
```bash
|
|
70
72
|
trackops locale get
|
|
71
|
-
trackops locale set
|
|
73
|
+
trackops locale set es
|
|
72
74
|
trackops doctor locale
|
|
73
75
|
```
|
|
@@ -2,28 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Faltan prerequisitos
|
|
4
4
|
|
|
5
|
-
- Instala Node 18+ si Node
|
|
6
|
-
- Instala una distribucion de Node que incluya npm si
|
|
5
|
+
- Instala Node 18+ si Node no existe o es demasiado antiguo.
|
|
6
|
+
- Instala una distribucion de Node que incluya npm si npm no existe.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## La skill se instalo, pero `trackops` no arranca
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Confirma que la skill global existe:
|
|
11
11
|
`npx skills add Baxahaun/trackops`
|
|
12
|
-
-
|
|
13
|
-
`
|
|
14
|
-
-
|
|
12
|
+
- Instala o reinstala el runtime de forma explicita:
|
|
13
|
+
`npm install -g trackops`
|
|
14
|
+
- Verifica:
|
|
15
|
+
`trackops --version`
|
|
16
|
+
- Si el binario sigue sin responder:
|
|
17
|
+
- revisa Node.js (`>= 18`)
|
|
18
|
+
- revisa que `npm` exista y funcione
|
|
19
|
+
- revisa PATH y reabre la terminal
|
|
15
20
|
|
|
16
|
-
##
|
|
21
|
+
## La instalacion explicita del runtime falla
|
|
17
22
|
|
|
18
|
-
- Reejecuta `
|
|
19
|
-
- Si
|
|
23
|
+
- Reejecuta `npm install -g trackops`.
|
|
24
|
+
- Si `npm` devuelve error, resuelvelo primero; la skill no puede continuar sin el CLI.
|
|
25
|
+
- Si el problema es de permisos globales, usa el metodo recomendado para tu sistema o un prefijo npm controlado por el usuario.
|
|
20
26
|
|
|
21
|
-
## OPERA
|
|
27
|
+
## OPERA derivo el bootstrap al agente
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Esto es esperado cuando:
|
|
24
30
|
|
|
25
31
|
- el usuario no es tecnico
|
|
26
|
-
- el proyecto
|
|
32
|
+
- el proyecto esta en fase idea
|
|
27
33
|
- la documentacion es debil
|
|
28
34
|
|
|
29
35
|
Usa:
|
|
@@ -33,11 +39,11 @@ trackops opera handoff --print
|
|
|
33
39
|
trackops opera bootstrap --resume
|
|
34
40
|
```
|
|
35
41
|
|
|
36
|
-
##
|
|
42
|
+
## `trackops opera bootstrap --resume` no avanza
|
|
37
43
|
|
|
38
44
|
TrackOps no inventa contexto faltante.
|
|
39
45
|
|
|
40
|
-
Comprueba que ambos archivos
|
|
46
|
+
Comprueba que existan ambos archivos y contengan datos utiles:
|
|
41
47
|
|
|
42
48
|
- `ops/bootstrap/intake.json`
|
|
43
49
|
- `ops/bootstrap/spec-dossier.md`
|
|
@@ -46,4 +52,4 @@ Comprueba que ambos archivos existan y contengan datos utilizables:
|
|
|
46
52
|
|
|
47
53
|
- Ejecuta `trackops env status`.
|
|
48
54
|
- Ejecuta `trackops env sync`.
|
|
49
|
-
- Si el bridge
|
|
55
|
+
- Si el modo bridge es `copy`, no edites `app/.env` directamente.
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Flujo diario
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Precondicion:
|
|
4
|
+
|
|
5
|
+
- la skill global ya esta instalada
|
|
6
|
+
- `trackops --version` responde correctamente
|
|
7
|
+
- el repo ya fue activado con `trackops init`
|
|
8
|
+
|
|
9
|
+
Usa TrackOps cuando el repositorio ya esta gestionado y necesites operar el dia a dia.
|
|
4
10
|
|
|
5
11
|
1. Ejecuta `trackops status`.
|
|
6
12
|
2. Ejecuta `trackops next`.
|
|
7
13
|
3. Mueve el estado de tareas con `trackops task ...`.
|
|
8
|
-
4. Ejecuta `trackops sync`
|
|
9
|
-
5. Ejecuta `trackops env status` cuando
|
|
14
|
+
4. Ejecuta `trackops sync` despues de cambios relevantes.
|
|
15
|
+
5. Ejecuta `trackops env status` cuando las credenciales importen.
|
|
10
16
|
|
|
11
17
|
Reglas operativas:
|
|
12
18
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- `app/.env` es
|
|
19
|
+
- en workspaces split, usa `ops/project_control.json` como fuente de verdad
|
|
20
|
+
- la documentacion operativa generada vive en `ops/`
|
|
21
|
+
- el codigo de producto vive en `app/`
|
|
22
|
+
- los secretos reales viven en `/.env`
|
|
23
|
+
- el contrato publico de entorno vive en `/.env.example`
|
|
24
|
+
- `app/.env` solo es un puente de compatibilidad
|
|
19
25
|
|
|
20
26
|
Si OPERA esta instalado:
|
|
21
27
|
|
|
22
|
-
- `ops/contract/operating-contract.json`
|
|
23
|
-
- `ops/genesis.md`
|
|
24
|
-
- `ops/policy/autonomy.json`
|
|
25
|
-
- `ops/bootstrap/`
|
|
26
|
-
- `ops/.agent/hub/` y `ops/.agents/skills/`
|
|
28
|
+
- `ops/contract/operating-contract.json` guarda el contrato de maquina
|
|
29
|
+
- `ops/genesis.md` guarda la vista humana compilada
|
|
30
|
+
- `ops/policy/autonomy.json` guarda la politica ejecutable
|
|
31
|
+
- `ops/bootstrap/` guarda artefactos de onboarding
|
|
32
|
+
- `ops/.agent/hub/` y `ops/.agents/skills/` guardan artefactos gestionados de agente
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trackops",
|
|
3
|
-
"shortDescription": "Global TrackOps skill
|
|
4
|
-
"description": "
|
|
5
|
-
"skillVersion": "2.0.
|
|
6
|
-
"trackopsVersion": "2.0.
|
|
3
|
+
"shortDescription": "Global TrackOps skill that explains TrackOps, requires explicit runtime install, and guides per-repository activation.",
|
|
4
|
+
"description": "Explains what TrackOps does, installs the global skill layer, requires explicit runtime installation with npm, supports Spanish and English, activates TrackOps repository by repository, and routes OPERA onboarding into either direct bootstrap or agent-led discovery.",
|
|
5
|
+
"skillVersion": "2.0.3",
|
|
6
|
+
"trackopsVersion": "2.0.3",
|
|
7
7
|
"npmPackage": "trackops",
|
|
8
|
-
"bootstrapPolicy": "
|
|
8
|
+
"bootstrapPolicy": "explicit_install",
|
|
9
9
|
"supportedAgentsV1": [
|
|
10
10
|
"antigravity",
|
|
11
11
|
"claude-code",
|
|
@@ -104,6 +104,7 @@ Explica el flujo correcto:
|
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
npx skills add Baxahaun/trackops
|
|
107
|
+
npm install -g trackops
|
|
107
108
|
trackops init
|
|
108
109
|
trackops opera install
|
|
109
110
|
```
|
|
@@ -122,6 +123,7 @@ Explica el flujo correcto:
|
|
|
122
123
|
|
|
123
124
|
```bash
|
|
124
125
|
npx skills add Baxahaun/trackops
|
|
126
|
+
npm install -g trackops
|
|
125
127
|
trackops init
|
|
126
128
|
trackops opera install
|
|
127
129
|
```
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const os = require("os");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const { spawnSync } = require("child_process");
|
|
7
|
-
const runtimeState = require("../../../lib/runtime-state");
|
|
8
|
-
|
|
9
|
-
const EXIT_CODES = {
|
|
10
|
-
READY: 0,
|
|
11
|
-
PREREQ: 1,
|
|
12
|
-
INSTALL: 2,
|
|
13
|
-
UNVERIFIABLE: 3,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function getNpmCommand() {
|
|
17
|
-
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function readSkillConfig() {
|
|
21
|
-
const skillFile = path.join(__dirname, "..", "skill.json");
|
|
22
|
-
return JSON.parse(fs.readFileSync(skillFile, "utf8"));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getHomeDir() {
|
|
26
|
-
return process.env.TRACKOPS_BOOTSTRAP_HOME || os.homedir();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getPrefixOverride() {
|
|
30
|
-
return process.env.TRACKOPS_BOOTSTRAP_PREFIX || null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function getInstallSource(config) {
|
|
34
|
-
return process.env.TRACKOPS_BOOTSTRAP_INSTALL_SOURCE || `${config.npmPackage}@${config.trackopsVersion}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function parseMajor(version) {
|
|
38
|
-
const major = Number(String(version || "").split(".")[0]);
|
|
39
|
-
return Number.isFinite(major) ? major : null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function hasSupportedNode() {
|
|
43
|
-
const major = parseMajor(process.versions.node);
|
|
44
|
-
return major != null && major >= 18;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function spawnChecked(command, args, extra = {}) {
|
|
48
|
-
const shell = process.platform === "win32" && /\.(cmd|bat)$/i.test(command);
|
|
49
|
-
return spawnSync(command, args, {
|
|
50
|
-
encoding: "utf8",
|
|
51
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
52
|
-
shell,
|
|
53
|
-
...extra,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function spawnNpm(args, extra = {}) {
|
|
58
|
-
return spawnSync(getNpmCommand(), args, {
|
|
59
|
-
encoding: "utf8",
|
|
60
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
61
|
-
shell: process.platform === "win32",
|
|
62
|
-
...extra,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function resolvePrefixExecutables(prefix) {
|
|
67
|
-
if (!prefix) return [];
|
|
68
|
-
if (process.platform === "win32") {
|
|
69
|
-
return [
|
|
70
|
-
path.join(prefix, "trackops.cmd"),
|
|
71
|
-
path.join(prefix, "trackops.exe"),
|
|
72
|
-
path.join(prefix, "trackops"),
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
return [path.join(prefix, "bin", "trackops")];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function buildVerificationTargets(prefix) {
|
|
79
|
-
const targets = [{ command: "trackops", via: "path" }];
|
|
80
|
-
for (const candidate of resolvePrefixExecutables(prefix)) {
|
|
81
|
-
targets.push({ command: candidate, via: "prefix" });
|
|
82
|
-
}
|
|
83
|
-
return targets;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function readInstalledVersion(prefix) {
|
|
87
|
-
for (const target of buildVerificationTargets(prefix)) {
|
|
88
|
-
const result = spawnChecked(target.command, ["--version"]);
|
|
89
|
-
if (result.error || result.status !== 0) continue;
|
|
90
|
-
const version = String(result.stdout || "").trim();
|
|
91
|
-
if (version) {
|
|
92
|
-
return { version, command: target.command, via: target.via };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function verifyRuntime(expectedVersion, prefix) {
|
|
99
|
-
const installed = readInstalledVersion(prefix);
|
|
100
|
-
if (!installed) {
|
|
101
|
-
return { ok: false, reason: "missing-command" };
|
|
102
|
-
}
|
|
103
|
-
if (installed.version !== expectedVersion) {
|
|
104
|
-
return { ok: false, reason: "version-drift", installed };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const help = spawnChecked(installed.command, ["help"]);
|
|
108
|
-
if (help.error || help.status !== 0) {
|
|
109
|
-
return { ok: false, reason: "help-failed", installed };
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return { ok: true, installed };
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function ensureNpmAvailable() {
|
|
116
|
-
const result = spawnNpm(["--version"]);
|
|
117
|
-
return !result.error && result.status === 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function runInstall(config, prefix) {
|
|
121
|
-
const installSource = getInstallSource(config);
|
|
122
|
-
const args = ["install", "-g"];
|
|
123
|
-
if (prefix) {
|
|
124
|
-
args.push("--prefix", prefix);
|
|
125
|
-
}
|
|
126
|
-
args.push(installSource);
|
|
127
|
-
|
|
128
|
-
const result = spawnNpm(args);
|
|
129
|
-
return { ...result, installSource };
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function writeRuntimeStamp(config, verification) {
|
|
133
|
-
const previous = runtimeState.readRuntimeState();
|
|
134
|
-
const payload = runtimeState.writeRuntimeState({
|
|
135
|
-
...previous,
|
|
136
|
-
skill: config.name,
|
|
137
|
-
skillVersion: config.skillVersion,
|
|
138
|
-
runtimePackage: config.npmPackage,
|
|
139
|
-
runtimeVersion: config.trackopsVersion,
|
|
140
|
-
bootstrapPolicy: config.bootstrapPolicy,
|
|
141
|
-
supportedAgentsV1: config.supportedAgentsV1,
|
|
142
|
-
verifiedAt: new Date().toISOString(),
|
|
143
|
-
verifiedWith: verification.installed.via,
|
|
144
|
-
executable: verification.installed.command,
|
|
145
|
-
});
|
|
146
|
-
return payload;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function printInstallGuidance(prefix) {
|
|
150
|
-
if (prefix) {
|
|
151
|
-
console.error(`TrackOps was installed under the custom prefix '${prefix}'.`);
|
|
152
|
-
console.error("Use that prefix's executable or add it to PATH before trying again.");
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
console.error("TrackOps was installed but could not be executed from PATH.");
|
|
157
|
-
console.error("Add your npm global bin directory to PATH, reopen the terminal, and retry.");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
async function main() {
|
|
161
|
-
const config = readSkillConfig();
|
|
162
|
-
const prefix = getPrefixOverride();
|
|
163
|
-
|
|
164
|
-
if (!hasSupportedNode()) {
|
|
165
|
-
console.error("TrackOps requires Node.js 18 or newer.");
|
|
166
|
-
process.exit(EXIT_CODES.PREREQ);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (!ensureNpmAvailable()) {
|
|
170
|
-
console.error("npm is required to bootstrap the TrackOps runtime.");
|
|
171
|
-
process.exit(EXIT_CODES.PREREQ);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const current = verifyRuntime(config.trackopsVersion, prefix);
|
|
175
|
-
if (current.ok) {
|
|
176
|
-
await runtimeState.ensureGlobalLocale({ interactive: false });
|
|
177
|
-
writeRuntimeStamp(config, current);
|
|
178
|
-
console.log(`TrackOps runtime ${config.trackopsVersion} is already ready.`);
|
|
179
|
-
process.exit(EXIT_CODES.READY);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const install = runInstall(config, prefix);
|
|
183
|
-
if (install.error || install.status !== 0) {
|
|
184
|
-
console.error(`Failed to install ${install.installSource}.`);
|
|
185
|
-
if (install.stderr) {
|
|
186
|
-
console.error(install.stderr.trim());
|
|
187
|
-
}
|
|
188
|
-
process.exit(EXIT_CODES.INSTALL);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const verification = verifyRuntime(config.trackopsVersion, prefix);
|
|
192
|
-
if (!verification.ok) {
|
|
193
|
-
printInstallGuidance(prefix);
|
|
194
|
-
process.exit(EXIT_CODES.UNVERIFIABLE);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
await runtimeState.ensureGlobalLocale({ interactive: false });
|
|
198
|
-
writeRuntimeStamp(config, verification);
|
|
199
|
-
console.log(`TrackOps runtime ${config.trackopsVersion} is ready.`);
|
|
200
|
-
process.exit(EXIT_CODES.READY);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
main();
|